예제 #1
0
파일: setup.py 프로젝트: qakart/pygit2
import unittest

# Get cffi major version
try:
    import cffi
except ImportError:
    cffi_major_version = None
else:
    cffi_major_version = cffi.__version_info__[0]

# Import stuff from pygit2/_utils.py without loading the whole pygit2 package
sys.path.insert(0, 'pygit2')
from _build import __version__, get_libgit2_paths
if cffi_major_version == 0:
    from _run import ffi, preamble, C_KEYWORDS
    ffi.verify(preamble, **C_KEYWORDS)
del sys.path[0]

libgit2_bin, libgit2_include, libgit2_lib = get_libgit2_paths()

pygit2_exts = [
    os.path.join('src', name) for name in sorted(listdir('src'))
    if name.endswith('.c')
]


class TestCommand(Command):
    """Command for running unittests without install."""

    user_options = [("args=", None, '''The command args string passed to
                                    unittest framework, such as
예제 #2
0
import unittest

# Get cffi major version
try:
    import cffi
except ImportError:
    cffi_major_version = None
else:
    cffi_major_version = cffi.__version_info__[0]

# Import stuff from pygit2/_utils.py without loading the whole pygit2 package
sys.path.insert(0, 'pygit2')
from _build import __version__, get_libgit2_paths
if cffi_major_version == 0:
    from _run import ffi, preamble, C_KEYWORDS
    ffi.verify(preamble, **C_KEYWORDS)
del sys.path[0]

# Python 2 support
# See https://github.com/libgit2/pygit2/pull/180 for a discussion about this.
# Using six isn't an option here yet, we don't necessarily have six installed
if sys.version_info[0] == 2:
    u = lambda s: unicode(s, 'utf-8')
else:
    u = str


libgit2_bin, libgit2_include, libgit2_lib = get_libgit2_paths()

pygit2_exts = [os.path.join('src', name) for name in sorted(listdir('src'))
               if name.endswith('.c')]