diff --git a/mercurial/cffi/bdiffbuild.py b/mercurial/cffi/bdiffbuild.py --- a/mercurial/cffi/bdiffbuild.py +++ b/mercurial/cffi/bdiffbuild.py @@ -4,7 +4,7 @@ import cffi import os ffi = cffi.FFI() -ffi.set_source("_bdiff_cffi", +ffi.set_source("mercurial.cffi._bdiff", open(os.path.join(os.path.join(os.path.dirname(__file__), '..'), 'bdiff.c')).read(), include_dirs=['mercurial']) ffi.cdef(""" diff --git a/mercurial/cffi/mpatchbuild.py b/mercurial/cffi/mpatchbuild.py --- a/mercurial/cffi/mpatchbuild.py +++ b/mercurial/cffi/mpatchbuild.py @@ -6,7 +6,7 @@ import os ffi = cffi.FFI() mpatch_c = os.path.join(os.path.join(os.path.dirname(__file__), '..', 'mpatch.c')) -ffi.set_source("_mpatch_cffi", open(mpatch_c).read(), +ffi.set_source("mercurial.cffi._mpatch", open(mpatch_c).read(), include_dirs=["mercurial"]) ffi.cdef(""" diff --git a/mercurial/cffi/osutilbuild.py b/mercurial/cffi/osutilbuild.py --- a/mercurial/cffi/osutilbuild.py +++ b/mercurial/cffi/osutilbuild.py @@ -3,7 +3,7 @@ from __future__ import absolute_import import cffi ffi = cffi.FFI() -ffi.set_source("_osutil_cffi", """ +ffi.set_source("mercurial.cffi._osutil", """ #include #include #include diff --git a/mercurial/pure/bdiff.py b/mercurial/pure/bdiff.py --- a/mercurial/pure/bdiff.py +++ b/mercurial/pure/bdiff.py @@ -96,7 +96,7 @@ def fixws(text, allws): if modulepolicy not in policynocffi: try: - from _bdiff_cffi import ffi, lib + from ..cffi._bdiff import ffi, lib except ImportError: if modulepolicy == 'cffi': # strict cffi import raise diff --git a/mercurial/pure/mpatch.py b/mercurial/pure/mpatch.py --- a/mercurial/pure/mpatch.py +++ b/mercurial/pure/mpatch.py @@ -130,7 +130,7 @@ def patchedsize(orig, delta): if modulepolicy not in policynocffi: try: - from _mpatch_cffi import ffi, lib + from ..cffi._mpatch import ffi, lib except ImportError: if modulepolicy == 'cffi': # strict cffi import raise diff --git a/mercurial/pure/osutil.py b/mercurial/pure/osutil.py --- a/mercurial/pure/osutil.py +++ b/mercurial/pure/osutil.py @@ -71,7 +71,7 @@ def listdirpure(path, stat=False, skip=N ffi = None if modulepolicy not in policynocffi and pycompat.sysplatform == 'darwin': try: - from _osutil_cffi import ffi, lib + from ..cffi._osutil import ffi, lib except ImportError: if modulepolicy == 'cffi': # strict cffi import raise diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -582,6 +582,7 @@ cmdclass = {'build': hgbuild, packages = ['mercurial', 'mercurial.cext', + 'mercurial.cffi', 'mercurial.hgweb', 'mercurial.httpclient', 'mercurial.pure',