Patchwork [2,of,5,RFC] policy: add "cpy" package that will host CPython extension modules

login
register
mail settings
Submitter Yuya Nishihara
Date Aug. 13, 2016, 10:15 a.m.
Message ID <bda4422fc315b54356ba.1471083324@mimosa>
Download mbox | patch
Permalink /patch/16269/
State Changes Requested
Headers show

Comments

Yuya Nishihara - Aug. 13, 2016, 10:15 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1470967574 -32400
#      Fri Aug 12 11:06:14 2016 +0900
# Node ID bda4422fc315b54356ba1949e5ba861dd2660e86
# Parent  d2a9c2f4bd5e617a8ecac2a8c0294e69edc92304
policy: add "cpy" package that will host CPython extension modules

I'm going to restructure extension/pure modules as follows:

  osutil -> (cpy|cffi|pure).osutil
  cpy.osutil
  cffi.osutil -> pure.osutil
  pure.osutil

mercurial/osutil.py will be a placeholder to import cpy/cffi/pure module
selectively, and our hgimporter hack will be removed. This will allow us
to import pure.osutil from cffi.osutil.

All CPython extension modules will be moved to mercurial/cpy to free
mercurial.* namespace.

Patch

diff --git a/mercurial/cpy/__init__.py b/mercurial/cpy/__init__.py
new file mode 100644
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -539,7 +539,8 @@  cmdclass = {'build': hgbuild,
             'build_hgexe': buildhgexe,
             }
 
-packages = ['mercurial', 'mercurial.hgweb', 'mercurial.httpclient',
+packages = ['mercurial', 'mercurial.cpy', 'mercurial.hgweb',
+            'mercurial.httpclient',
             'mercurial.pure',
             'hgext', 'hgext.convert', 'hgext.fsmonitor',
             'hgext.fsmonitor.pywatchman', 'hgext.highlight',
@@ -548,6 +549,7 @@  packages = ['mercurial', 'mercurial.hgwe
 common_depends = ['mercurial/bitmanipulation.h',
                   'mercurial/compat.h',
                   'mercurial/util.h']
+common_include_dirs = ['mercurial']
 
 osutil_ldflags = []
 
@@ -556,21 +558,27 @@  if sys.platform == 'darwin':
 
 extmodules = [
     Extension('mercurial.base85', ['mercurial/base85.c'],
+              include_dirs=common_include_dirs,
               depends=common_depends),
     Extension('mercurial.bdiff', ['mercurial/bdiff.c',
                                   'mercurial/bdiff_module.c'],
+              include_dirs=common_include_dirs,
               depends=common_depends + ['mercurial/bdiff.h']),
     Extension('mercurial.diffhelpers', ['mercurial/diffhelpers.c'],
+              include_dirs=common_include_dirs,
               depends=common_depends),
     Extension('mercurial.mpatch', ['mercurial/mpatch.c',
                                    'mercurial/mpatch_module.c'],
+              include_dirs=common_include_dirs,
               depends=common_depends),
     Extension('mercurial.parsers', ['mercurial/dirs.c',
                                     'mercurial/manifest.c',
                                     'mercurial/parsers.c',
                                     'mercurial/pathencode.c'],
+              include_dirs=common_include_dirs,
               depends=common_depends),
     Extension('mercurial.osutil', ['mercurial/osutil.c'],
+              include_dirs=common_include_dirs,
               extra_link_args=osutil_ldflags,
               depends=common_depends),
     Extension('hgext.fsmonitor.pywatchman.bser',