[Python-apps-commits] r8975 - in packages/cython/trunk/debian (3 files)

yoh at users.alioth.debian.org yoh at users.alioth.debian.org
Thu Jul 26 14:42:45 UTC 2012


    Date: Thursday, July 26, 2012 @ 14:42:44
  Author: yoh
Revision: 8975

added up_upstream_cache_ext_suffix to resolve failure due to multiarch (see #682795 for the reason)

Added:
  packages/cython/trunk/debian/patches/series
  packages/cython/trunk/debian/patches/up_upstream_cache_ext_suffix
Modified:
  packages/cython/trunk/debian/changelog

Modified: packages/cython/trunk/debian/changelog
===================================================================
--- packages/cython/trunk/debian/changelog	2012-07-26 14:42:36 UTC (rev 8974)
+++ packages/cython/trunk/debian/changelog	2012-07-26 14:42:44 UTC (rev 8975)
@@ -12,6 +12,8 @@
     - allow fetching beta-releases
   * debian/patches
     - dropped (upstreamed)
+    - added up_upstream_cache_ext_suffix to resolve failure due to multiarch
+      (see #682795 for the reason)
 
  -- Yaroslav Halchenko <debian at onerussian.com>  Wed, 18 Jul 2012 21:41:44 -0400
 

Added: packages/cython/trunk/debian/patches/series
===================================================================
--- packages/cython/trunk/debian/patches/series	                        (rev 0)
+++ packages/cython/trunk/debian/patches/series	2012-07-26 14:42:44 UTC (rev 8975)
@@ -0,0 +1 @@
+up_upstream_cache_ext_suffix

Added: packages/cython/trunk/debian/patches/up_upstream_cache_ext_suffix
===================================================================
--- packages/cython/trunk/debian/patches/up_upstream_cache_ext_suffix	                        (rev 0)
+++ packages/cython/trunk/debian/patches/up_upstream_cache_ext_suffix	2012-07-26 14:42:44 UTC (rev 8975)
@@ -0,0 +1,83 @@
+From: Yaroslav Halchenko <debian at onerussian.com>
+Subject: Avoid using imp.get_suffixes() to figure out the suffix of the extension
+
+due to multiarch support the first in the list might differ from the ones later
+used by distutils
+
+Origin: Debian
+Last-Update: 2012-07-25
+
+--- a/Cython/Build/Inline.py
++++ b/Cython/Build/Inline.py
+@@ -29,8 +29,6 @@ if sys.version_info[0] < 3:
+ else:
+     to_unicode = lambda x: x
+ 
+-_code_cache = {}
+-
+ 
+ class AllSymbols(CythonTransform, SkipDeclarations):
+     def __init__(self):
+@@ -94,6 +92,16 @@ def safe_type(arg, context=None):
+                     return '%s.%s' % (base_type.__module__, base_type.__name__)
+         return 'object'
+ 
++def _get_build_extension():
++    dist = Distribution()
++    # Ensure the build respects distutils configuration by parsing
++    # the configuration files
++    config_files = dist.find_config_files()
++    dist.parse_config_files(config_files)
++    build_extension = build_ext(dist)
++    build_extension.finalize_options()
++    return build_extension
++
+ def cython_inline(code,
+                   get_type=unsafe_type,
+                   lib_dir=os.path.join(get_cython_cache_dir(), 'inline'),
+@@ -139,8 +147,13 @@ def cython_inline(code,
+     key = orig_code, arg_sigs, sys.version_info, sys.executable, Cython.__version__
+     module_name = "_cython_inline_" + hashlib.md5(str(key).encode('utf-8')).hexdigest()
+ 
+-    so_ext = [ ext for ext,_,mod_type in imp.get_suffixes() if mod_type == imp.C_EXTENSION ][0]
+-    module_path = os.path.join(lib_dir, module_name+so_ext)
++    build_extension = None
++    if cython_inline.so_ext is None:
++        # Figure out and cache current extension suffix
++        build_extension = _get_build_extension()
++        cython_inline.so_ext = build_extension.get_ext_filename('')
++
++    module_path = os.path.join(lib_dir, module_name + cython_inline.so_ext)
+ 
+     if not os.path.exists(lib_dir):
+         os.makedirs(lib_dir)
+@@ -178,23 +191,21 @@ def __invoke(%(params)s):
+             sources = [pyx_file],
+             include_dirs = c_include_dirs,
+             extra_compile_args = cflags)
+-        dist = Distribution()
+-        # Ensure the build respects distutils configuration by parsing
+-        # the configuration files
+-        config_files = dist.find_config_files()
+-        dist.parse_config_files(config_files)
+-        build_extension = build_ext(dist)
+-        build_extension.finalize_options()
++        if build_extension is None:
++            build_extension = _get_build_extension()
+         build_extension.extensions = cythonize([extension], ctx=ctx, quiet=quiet)
+         build_extension.build_temp = os.path.dirname(pyx_file)
+         build_extension.build_lib  = lib_dir
+         build_extension.run()
+-        _code_cache[key] = module_name
+ 
+     module = imp.load_dynamic(module_name, module_path)
+     arg_list = [kwds[arg] for arg in arg_names]
+     return module.__invoke(*arg_list)
+ 
++# Cached suffix used by cython_inline above.  None should get
++# overridden with actual value upon the first cython_inline invocation
++cython_inline.so_ext = None
++
+ non_space = re.compile('[^ ]')
+ def strip_common_indent(code):
+     min_indent = None




More information about the Python-apps-commits mailing list