Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ python:
- "3.2"
- "3.3"
- "3.4"
# - "pypy"
# - "pypy3"
- "pypy"
- "pypy3"

env: LIBGIT2=~/libgit2/_install/ LD_LIBRARY_PATH=~/libgit2/_install/lib

before_install:
- sudo apt-get install cmake
- pip install 'cffi>=1.0.0'
- pip install cffi
- "./.travis.sh"

script:
Expand Down
4 changes: 2 additions & 2 deletions pygit2/ffi.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
try:
from ._libgit2 import ffi, lib as C
except ImportError:
from .libgit2_build import ffi, C_HEADER_SRC, C_KEYWORDS
C = ffi.verify(C_HEADER_SRC, **C_KEYWORDS)
from .libgit2_build import ffi, preamble, C_KEYWORDS
C = ffi.verify(preamble, **C_KEYWORDS)
32 changes: 24 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,16 @@
import sys
import unittest

# Get cffi major version
import cffi
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 libgit2_build import __version__, get_libgit2_paths
if cffi_major_version == 0:
from libgit2_build import ffi, preamble, C_KEYWORDS
ffi.verify(preamble, **C_KEYWORDS)
del sys.path[0]

# Python 2 support
Expand Down Expand Up @@ -163,6 +170,21 @@ def run(self):
if os.name == 'nt':
cmdclass['build'] = BuildWithDLLs

extra_args = {
'ext_modules': [
Extension('_pygit2', pygit2_exts, libraries=['git2'],
include_dirs=[libgit2_include],
library_dirs=[libgit2_lib]),
# FFI is added in the build step
],
}

if cffi_major_version == 0:
extra_args['ext_modules'].append(ffi.verifier.get_extension())
else:
extra_args['cffi_modules']=['pygit2/libgit2_build.py:ffi']


setup(name='pygit2',
description='Python bindings for libgit2.',
keywords='git',
Expand All @@ -175,14 +197,8 @@ def run(self):
long_description=long_description,
packages=['pygit2'],
package_data={'pygit2': ['decl.h']},
cffi_modules=['pygit2/libgit2_build.py:ffi'],
setup_requires=['cffi'],
install_requires=['cffi'],
zip_safe=False,
ext_modules=[
Extension('_pygit2', pygit2_exts, libraries=['git2'],
include_dirs=[libgit2_include],
library_dirs=[libgit2_lib]),
# FFI is added in the build step
],
cmdclass=cmdclass)
cmdclass=cmdclass,
**extra_args)