Merge pull request #61 from hgrecco/master
Fix Python 3.2 and provides testing for travis
This commit is contained in:
commit
edc391f292
11 changed files with 62 additions and 32 deletions
24
.travis.yml
Normal file
24
.travis.yml
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
language: python
|
||||||
|
|
||||||
|
python:
|
||||||
|
- "2.6"
|
||||||
|
- "2.7"
|
||||||
|
- "3.2"
|
||||||
|
- "3.3"
|
||||||
|
|
||||||
|
branches:
|
||||||
|
only:
|
||||||
|
- master
|
||||||
|
|
||||||
|
install:
|
||||||
|
- wget "http://repo.continuum.io/pkgs/free/linux-64/llvm-3.2-0.tar.bz2"
|
||||||
|
- tar -xjf llvm-3.2-0.tar.bz2
|
||||||
|
- PATH+=":`pwd`/bin"
|
||||||
|
- export LD_LIBRARY_PATH="`pwd`/lib"
|
||||||
|
- export LLVM_CONFIG_PATH="`pwd`/bin/llvm-config"
|
||||||
|
- $LLVM_CONFIG_PATH --cflags # test llvm-config
|
||||||
|
- export LLVMPY_DYNLINK=1
|
||||||
|
- python setup.py install -q
|
||||||
|
|
||||||
|
script: cd ~; python -c "import sys;import llvm;sys.exit(0 if llvm.test() == 0 else 1)"
|
||||||
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
#! /usr/bin/env python
|
#! /usr/bin/env python
|
||||||
# ______________________________________________________________________
|
# ______________________________________________________________________
|
||||||
|
from __future__ import absolute_import
|
||||||
import opcode
|
import opcode
|
||||||
import opcode_util
|
from . import opcode_util
|
||||||
import pprint
|
import pprint
|
||||||
|
|
||||||
from bytecode_visitor import BasicBlockVisitor, BenignBytecodeVisitorMixin
|
from .bytecode_visitor import BasicBlockVisitor, BenignBytecodeVisitorMixin
|
||||||
from control_flow import ControlFlowGraph
|
from .control_flow import ControlFlowGraph
|
||||||
|
|
||||||
# ______________________________________________________________________
|
# ______________________________________________________________________
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
#! /usr/bin/env python
|
#! /usr/bin/env python
|
||||||
# ______________________________________________________________________
|
# ______________________________________________________________________
|
||||||
|
from __future__ import absolute_import
|
||||||
import dis
|
import dis
|
||||||
import opcode
|
import opcode
|
||||||
|
|
||||||
from bytecode_visitor import BasicBlockVisitor
|
from .bytecode_visitor import BasicBlockVisitor
|
||||||
import opcode_util
|
from . import opcode_util
|
||||||
|
|
||||||
# ______________________________________________________________________
|
# ______________________________________________________________________
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,19 +4,19 @@
|
||||||
'''
|
'''
|
||||||
# ______________________________________________________________________
|
# ______________________________________________________________________
|
||||||
# Module imports
|
# Module imports
|
||||||
|
from __future__ import absolute_import
|
||||||
import opcode
|
import opcode
|
||||||
import types
|
import types
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import llvm.core as lc
|
import llvm.core as lc
|
||||||
|
|
||||||
import opcode_util
|
from . import opcode_util
|
||||||
import bytetype
|
from . import bytetype
|
||||||
from bytecode_visitor import BytecodeFlowVisitor
|
from .bytecode_visitor import BytecodeFlowVisitor
|
||||||
from byte_flow import BytecodeFlowBuilder
|
from .byte_flow import BytecodeFlowBuilder
|
||||||
from byte_control import ControlFlowBuilder
|
from .byte_control import ControlFlowBuilder
|
||||||
from phi_injector import PhiInjector, synthetic_opname
|
from .phi_injector import PhiInjector, synthetic_opname
|
||||||
|
|
||||||
# ______________________________________________________________________
|
# ______________________________________________________________________
|
||||||
# Module data
|
# Module data
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
#! /usr/bin/env python
|
#! /usr/bin/env python
|
||||||
# ______________________________________________________________________
|
# ______________________________________________________________________
|
||||||
|
from __future__ import absolute_import
|
||||||
import itertools
|
import itertools
|
||||||
|
|
||||||
import opcode
|
import opcode
|
||||||
from opcode_util import itercode
|
from .opcode_util import itercode
|
||||||
|
|
||||||
# ______________________________________________________________________
|
# ______________________________________________________________________
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#! /usr/bin/env python
|
#! /usr/bin/env python
|
||||||
# ______________________________________________________________________
|
# ______________________________________________________________________
|
||||||
|
from __future__ import absolute_import
|
||||||
import opcode_util
|
from . import opcode_util
|
||||||
|
|
||||||
# ______________________________________________________________________
|
# ______________________________________________________________________
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#! /usr/bin/env python
|
#! /usr/bin/env python
|
||||||
# ______________________________________________________________________
|
# ______________________________________________________________________
|
||||||
|
from __future__ import absolute_import
|
||||||
import sys
|
import sys
|
||||||
import os.path
|
import os.path
|
||||||
import imp
|
import imp
|
||||||
|
|
@ -10,9 +10,8 @@ import types
|
||||||
import llvm.core as lc
|
import llvm.core as lc
|
||||||
import llvm.ee as le
|
import llvm.ee as le
|
||||||
|
|
||||||
import bytetype
|
from . import bytetype, byte_translator
|
||||||
import byte_translator
|
from .pyaddfunc import pyaddfunc
|
||||||
from pyaddfunc import pyaddfunc
|
|
||||||
|
|
||||||
LLVM_TO_INT_PARSE_STR_MAP = {
|
LLVM_TO_INT_PARSE_STR_MAP = {
|
||||||
8 : 'b',
|
8 : 'b',
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#! /usr/bin/env python
|
#! /usr/bin/env python
|
||||||
# ______________________________________________________________________
|
# ______________________________________________________________________
|
||||||
|
|
||||||
from bytecode_visitor import BytecodeFlowVisitor, BenignBytecodeVisitorMixin
|
from .bytecode_visitor import BytecodeFlowVisitor, BenignBytecodeVisitorMixin
|
||||||
|
|
||||||
# ______________________________________________________________________
|
# ______________________________________________________________________
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,9 +34,11 @@ class LLVMException(Exception):
|
||||||
def test(verbosity=1):
|
def test(verbosity=1):
|
||||||
"""test(verbosity=1) -> TextTestResult
|
"""test(verbosity=1) -> TextTestResult
|
||||||
|
|
||||||
Run self-test, and return unittest.runner.TextTestResult object.
|
Run self-test, and return the number of failures + errors
|
||||||
"""
|
"""
|
||||||
from llvm.test_llvmpy import run
|
from llvm.test_llvmpy import run
|
||||||
|
|
||||||
return run(verbosity=verbosity)
|
result = run(verbosity=verbosity)
|
||||||
|
|
||||||
|
return len(result.failures) + len(result.errors)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,9 @@ from . import shortnames as types
|
||||||
###
|
###
|
||||||
|
|
||||||
class FunctionAlreadyExists(NameError):
|
class FunctionAlreadyExists(NameError):
|
||||||
pass
|
|
||||||
|
def __init__(self, func):
|
||||||
|
self.func = func
|
||||||
|
|
||||||
def _is_int(ty):
|
def _is_int(ty):
|
||||||
return isinstance(ty, lc.IntegerType)
|
return isinstance(ty, lc.IntegerType)
|
||||||
|
|
@ -830,7 +832,7 @@ class CDefinition(object):
|
||||||
try:
|
try:
|
||||||
func = self.define(module)
|
func = self.define(module)
|
||||||
except FunctionAlreadyExists as e:
|
except FunctionAlreadyExists as e:
|
||||||
(func,) = e
|
func = e.func
|
||||||
return func
|
return func
|
||||||
|
|
||||||
def __getattr__(self, attr):
|
def __getattr__(self, attr):
|
||||||
|
|
|
||||||
|
|
@ -9,13 +9,10 @@
|
||||||
#define PyBytes_FromStringAndSize PyString_FromStringAndSize
|
#define PyBytes_FromStringAndSize PyString_FromStringAndSize
|
||||||
#define PyBytes_FromString PyString_FromString
|
#define PyBytes_FromString PyString_FromString
|
||||||
|
|
||||||
#endif
|
#else
|
||||||
|
|
||||||
#if (PY_VERSION_HEX >= 0x03000000)
|
|
||||||
|
|
||||||
#define PyString_Check PyUnicode_Check
|
#define PyString_Check PyUnicode_Check
|
||||||
#define PyString_Size PyUnicode_GET_SIZE
|
#define PyString_Size PyUnicode_GET_SIZE
|
||||||
#define PyString_AsString PyUnicode_AsUTF8
|
|
||||||
#define PyString_FromStringAndSize PyUnicode_FromStringAndSize
|
#define PyString_FromStringAndSize PyUnicode_FromStringAndSize
|
||||||
#define PyString_FromString PyUnicode_FromString
|
#define PyString_FromString PyUnicode_FromString
|
||||||
|
|
||||||
|
|
@ -27,6 +24,12 @@
|
||||||
|
|
||||||
#define PyFile_Check(x) (1)
|
#define PyFile_Check(x) (1)
|
||||||
|
|
||||||
|
#if (PY_VERSION_HEX < 0x03030000)
|
||||||
|
#define PyString_AsString _PyUnicode_AsString
|
||||||
|
#else
|
||||||
|
#define PyString_AsString PyUnicode_AsUTF8
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif //PYTHON3ADAPT_H
|
#endif // (PY_VERSION_HEX < 0x03000000)
|
||||||
|
|
||||||
|
#endif //PYTHON3ADAPT_H
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue