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
|
||||
# ______________________________________________________________________
|
||||
|
||||
from __future__ import absolute_import
|
||||
import opcode
|
||||
import opcode_util
|
||||
from . import opcode_util
|
||||
import pprint
|
||||
|
||||
from bytecode_visitor import BasicBlockVisitor, BenignBytecodeVisitorMixin
|
||||
from control_flow import ControlFlowGraph
|
||||
from .bytecode_visitor import BasicBlockVisitor, BenignBytecodeVisitorMixin
|
||||
from .control_flow import ControlFlowGraph
|
||||
|
||||
# ______________________________________________________________________
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
#! /usr/bin/env python
|
||||
# ______________________________________________________________________
|
||||
|
||||
from __future__ import absolute_import
|
||||
import dis
|
||||
import opcode
|
||||
|
||||
from bytecode_visitor import BasicBlockVisitor
|
||||
import opcode_util
|
||||
from .bytecode_visitor import BasicBlockVisitor
|
||||
from . import opcode_util
|
||||
|
||||
# ______________________________________________________________________
|
||||
|
||||
|
|
|
|||
|
|
@ -4,19 +4,19 @@
|
|||
'''
|
||||
# ______________________________________________________________________
|
||||
# Module imports
|
||||
|
||||
from __future__ import absolute_import
|
||||
import opcode
|
||||
import types
|
||||
import logging
|
||||
|
||||
import llvm.core as lc
|
||||
|
||||
import opcode_util
|
||||
import bytetype
|
||||
from bytecode_visitor import BytecodeFlowVisitor
|
||||
from byte_flow import BytecodeFlowBuilder
|
||||
from byte_control import ControlFlowBuilder
|
||||
from phi_injector import PhiInjector, synthetic_opname
|
||||
from . import opcode_util
|
||||
from . import bytetype
|
||||
from .bytecode_visitor import BytecodeFlowVisitor
|
||||
from .byte_flow import BytecodeFlowBuilder
|
||||
from .byte_control import ControlFlowBuilder
|
||||
from .phi_injector import PhiInjector, synthetic_opname
|
||||
|
||||
# ______________________________________________________________________
|
||||
# Module data
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
#! /usr/bin/env python
|
||||
# ______________________________________________________________________
|
||||
|
||||
from __future__ import absolute_import
|
||||
import itertools
|
||||
|
||||
import opcode
|
||||
from opcode_util import itercode
|
||||
from .opcode_util import itercode
|
||||
|
||||
# ______________________________________________________________________
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#! /usr/bin/env python
|
||||
# ______________________________________________________________________
|
||||
|
||||
import opcode_util
|
||||
from __future__ import absolute_import
|
||||
from . import opcode_util
|
||||
|
||||
# ______________________________________________________________________
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#! /usr/bin/env python
|
||||
# ______________________________________________________________________
|
||||
|
||||
from __future__ import absolute_import
|
||||
import sys
|
||||
import os.path
|
||||
import imp
|
||||
|
|
@ -10,9 +10,8 @@ import types
|
|||
import llvm.core as lc
|
||||
import llvm.ee as le
|
||||
|
||||
import bytetype
|
||||
import byte_translator
|
||||
from pyaddfunc import pyaddfunc
|
||||
from . import bytetype, byte_translator
|
||||
from .pyaddfunc import pyaddfunc
|
||||
|
||||
LLVM_TO_INT_PARSE_STR_MAP = {
|
||||
8 : 'b',
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#! /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):
|
||||
"""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
|
||||
|
||||
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):
|
||||
pass
|
||||
|
||||
def __init__(self, func):
|
||||
self.func = func
|
||||
|
||||
def _is_int(ty):
|
||||
return isinstance(ty, lc.IntegerType)
|
||||
|
|
@ -830,7 +832,7 @@ class CDefinition(object):
|
|||
try:
|
||||
func = self.define(module)
|
||||
except FunctionAlreadyExists as e:
|
||||
(func,) = e
|
||||
func = e.func
|
||||
return func
|
||||
|
||||
def __getattr__(self, attr):
|
||||
|
|
|
|||
|
|
@ -9,13 +9,10 @@
|
|||
#define PyBytes_FromStringAndSize PyString_FromStringAndSize
|
||||
#define PyBytes_FromString PyString_FromString
|
||||
|
||||
#endif
|
||||
|
||||
#if (PY_VERSION_HEX >= 0x03000000)
|
||||
#else
|
||||
|
||||
#define PyString_Check PyUnicode_Check
|
||||
#define PyString_Size PyUnicode_GET_SIZE
|
||||
#define PyString_AsString PyUnicode_AsUTF8
|
||||
#define PyString_FromStringAndSize PyUnicode_FromStringAndSize
|
||||
#define PyString_FromString PyUnicode_FromString
|
||||
|
||||
|
|
@ -27,6 +24,12 @@
|
|||
|
||||
#define PyFile_Check(x) (1)
|
||||
|
||||
#if (PY_VERSION_HEX < 0x03030000)
|
||||
#define PyString_AsString _PyUnicode_AsString
|
||||
#else
|
||||
#define PyString_AsString PyUnicode_AsUTF8
|
||||
#endif
|
||||
|
||||
#endif //PYTHON3ADAPT_H
|
||||
#endif // (PY_VERSION_HEX < 0x03000000)
|
||||
|
||||
#endif //PYTHON3ADAPT_H
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue