diff --git a/docs/install.rst b/docs/install.rst index c4b6fb48d..98f85e035 100644 --- a/docs/install.rst +++ b/docs/install.rst @@ -139,7 +139,7 @@ library: Traceback (most recent call last): File "", line 1, in File "pygit2/__init__.py", line 29, in - from _pygit2 import * + from ._pygit2 import * ImportError: libgit2.so.0: cannot open shared object file: No such file or directory This happens for instance in Ubuntu, the libgit2 library is installed within @@ -229,7 +229,7 @@ everytime. Verify yourself if curious: .. code-block:: sh - $ readelf --dynamic lib/python2.7/site-packages/pygit2-0.27.0-py2.7-linux-x86_64.egg/_pygit2.so | grep PATH + $ readelf --dynamic lib/python2.7/site-packages/pygit2-0.27.0-py2.7-linux-x86_64.egg/pygit2/_pygit2.so | grep PATH 0x000000000000001d (RUNPATH) Library runpath: [/tmp/venv/lib] diff --git a/pygit2/__init__.py b/pygit2/__init__.py index 9fcda66ff..5571915ee 100644 --- a/pygit2/__init__.py +++ b/pygit2/__init__.py @@ -27,7 +27,7 @@ import functools # Low level API -from _pygit2 import * +from ._pygit2 import * # High level API from .blame import Blame, BlameHunk diff --git a/pygit2/blame.py b/pygit2/blame.py index 26f4386f5..93f304417 100644 --- a/pygit2/blame.py +++ b/pygit2/blame.py @@ -26,7 +26,7 @@ # Import from pygit2 from .ffi import ffi, C from .utils import GenericIterator -from _pygit2 import Signature, Oid +from ._pygit2 import Signature, Oid def wrap_signature(csig): diff --git a/pygit2/errors.py b/pygit2/errors.py index 2d0c7e7c6..47b40f2d9 100644 --- a/pygit2/errors.py +++ b/pygit2/errors.py @@ -25,7 +25,7 @@ # Import from pygit2 from .ffi import ffi, C -from _pygit2 import GitError +from ._pygit2 import GitError value_errors = set([C.GIT_EEXISTS, C.GIT_EINVALIDSPEC, C.GIT_EAMBIGUOUS]) diff --git a/pygit2/index.py b/pygit2/index.py index aebab28aa..02c8d07e5 100644 --- a/pygit2/index.py +++ b/pygit2/index.py @@ -26,7 +26,7 @@ import weakref # Import from pygit2 -from _pygit2 import Oid, Tree, Diff +from ._pygit2 import Oid, Tree, Diff from .errors import check_error from .ffi import ffi, C from .utils import to_bytes, to_str diff --git a/pygit2/remote.py b/pygit2/remote.py index e4a569c0f..9629b90c3 100644 --- a/pygit2/remote.py +++ b/pygit2/remote.py @@ -24,7 +24,7 @@ # Boston, MA 02110-1301, USA. # Import from pygit2 -from _pygit2 import Oid +from ._pygit2 import Oid from .errors import check_error, Passthrough from .ffi import ffi, C from .refspec import Refspec diff --git a/pygit2/repository.py b/pygit2/repository.py index f60cfdccf..fb0d71f72 100644 --- a/pygit2/repository.py +++ b/pygit2/repository.py @@ -30,14 +30,14 @@ from time import time # Import from pygit2 -from _pygit2 import Repository as _Repository, init_file_backend -from _pygit2 import Oid, GIT_OID_HEXSZ, GIT_OID_MINPREFIXLEN -from _pygit2 import GIT_CHECKOUT_SAFE, GIT_CHECKOUT_RECREATE_MISSING, GIT_DIFF_NORMAL -from _pygit2 import GIT_FILEMODE_LINK -from _pygit2 import GIT_BRANCH_LOCAL, GIT_BRANCH_REMOTE, GIT_BRANCH_ALL -from _pygit2 import GIT_REF_SYMBOLIC -from _pygit2 import Reference, Tree, Commit, Blob -from _pygit2 import InvalidSpecError +from ._pygit2 import Repository as _Repository, init_file_backend +from ._pygit2 import Oid, GIT_OID_HEXSZ, GIT_OID_MINPREFIXLEN +from ._pygit2 import GIT_CHECKOUT_SAFE, GIT_CHECKOUT_RECREATE_MISSING, GIT_DIFF_NORMAL +from ._pygit2 import GIT_FILEMODE_LINK +from ._pygit2 import GIT_BRANCH_LOCAL, GIT_BRANCH_REMOTE, GIT_BRANCH_ALL +from ._pygit2 import GIT_REF_SYMBOLIC +from ._pygit2 import Reference, Tree, Commit, Blob +from ._pygit2 import InvalidSpecError from .config import Config from .errors import check_error diff --git a/pygit2/settings.py b/pygit2/settings.py index b47bf2ef6..3e74a29c8 100644 --- a/pygit2/settings.py +++ b/pygit2/settings.py @@ -29,8 +29,8 @@ from ssl import get_default_verify_paths -import _pygit2 -from _pygit2 import option +from . import _pygit2 +from ._pygit2 import option from .errors import GitError diff --git a/pygit2/submodule.py b/pygit2/submodule.py index af976ecca..3eefa488c 100644 --- a/pygit2/submodule.py +++ b/pygit2/submodule.py @@ -23,7 +23,7 @@ # the Free Software Foundation, 51 Franklin Street, Fifth Floor, # Boston, MA 02110-1301, USA. -from _pygit2 import Oid +from ._pygit2 import Oid from .errors import check_error from .ffi import ffi, C diff --git a/setup.py b/setup.py index 49349814f..130ff5ebf 100644 --- a/setup.py +++ b/setup.py @@ -102,7 +102,7 @@ def _get_dlls(self): elif compiler_type == 'mingw32': libgit2_dlls.append('libgit2.dll') look_dirs = [libgit2_bin] + getenv("PATH", "").split(pathsep) - target = abspath(self.build_lib) + target = abspath(os.path.join(self.build_lib, "pygit2")) for bin in libgit2_dlls: for look in look_dirs: f = os.path.join(look, bin) @@ -124,7 +124,7 @@ def run(self): cmdclass['build'] = BuildWithDLLs ext_modules = [ - Extension('_pygit2', pygit2_exts, libraries=['git2'], + Extension('pygit2._pygit2', pygit2_exts, libraries=['git2'], include_dirs=[libgit2_include], library_dirs=[libgit2_lib]), ]