[Checkins] SVN: zope.security/branches/tseaver-no_svn_external/ Use setup_requires + deferred module header to build w/o svn:externals.

Tres Seaver cvs-admin at zope.org
Wed Dec 19 19:30:38 UTC 2012


Log message for revision 128794:
  Use setup_requires + deferred module header to build w/o svn:externals.

Changed:
  _U  zope.security/branches/tseaver-no_svn_external/
  U   zope.security/branches/tseaver-no_svn_external/CHANGES.txt
  U   zope.security/branches/tseaver-no_svn_external/buildout.cfg
  U   zope.security/branches/tseaver-no_svn_external/setup.py
  U   zope.security/branches/tseaver-no_svn_external/src/zope/security/_proxy.c

-=-
Modified: zope.security/branches/tseaver-no_svn_external/CHANGES.txt
===================================================================
--- zope.security/branches/tseaver-no_svn_external/CHANGES.txt	2012-12-19 19:30:35 UTC (rev 128793)
+++ zope.security/branches/tseaver-no_svn_external/CHANGES.txt	2012-12-19 19:30:38 UTC (rev 128794)
@@ -5,6 +5,9 @@
 4.0.0 (unreleased)
 ------------------
 
+- Enabled building extensions without the 'svn:external' of the ``zope.proxy``
+  headers into our 'include' dir.
+
 - Bumped ``zope.proxy`` dependency to ">= 4.1.0" to enable compilation
   on Py3k.
 

Modified: zope.security/branches/tseaver-no_svn_external/buildout.cfg
===================================================================
--- zope.security/branches/tseaver-no_svn_external/buildout.cfg	2012-12-19 19:30:35 UTC (rev 128793)
+++ zope.security/branches/tseaver-no_svn_external/buildout.cfg	2012-12-19 19:30:38 UTC (rev 128794)
@@ -1,23 +1,34 @@
 [buildout]
 develop = .
-parts = test python coverage-test coverage-report
+parts =
+    test
+    python
+    coverage-test
+    coverage-report
 
 [test]
 recipe = zc.recipe.testrunner
-eggs = zope.security [test,untrustedpython,zcml,pytz]
+eggs =
+    zope.proxy >= 4.1.0
+    zope.security [test,untrustedpython,zcml,pytz]
 
 [python]
 recipe = zc.recipe.egg
-eggs = zope.security [untrustedpython]
+eggs =
+    zope.proxy >= 4.1.0
+    zope.security [untrustedpython]
 interpreter = python
 
 [coverage-test]
 recipe = zc.recipe.testrunner
-eggs = zope.security [test]
+eggs =
+    zope.proxy >= 4.1.0
+    zope.security [test]
 defaults = ['--coverage', '../../coverage']
 
 [coverage-report]
 recipe = zc.recipe.egg
-eggs = z3c.coverage
+eggs =
+    z3c.coverage
 scripts = coverage=coverage-report
 arguments = ('coverage', 'coverage/report')

Modified: zope.security/branches/tseaver-no_svn_external/setup.py
===================================================================
--- zope.security/branches/tseaver-no_svn_external/setup.py	2012-12-19 19:30:35 UTC (rev 128793)
+++ zope.security/branches/tseaver-no_svn_external/setup.py	2012-12-19 19:30:38 UTC (rev 128794)
@@ -19,11 +19,65 @@
 """Setup for zope.security package
 """
 import os
-from setuptools import setup, find_packages, Extension
+import platform
+import sys
+from setuptools import setup, find_packages, Extension, Feature
 
+here = os.path.abspath(os.path.dirname(__file__))
 def read(*rnames):
     return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
 
+# Include directories for C extensions
+# Sniff the location of the headers in 'persistent' or fall back
+# to local headers in the include sub-directory
+
+class ModuleHeaderDir(object):
+
+    def __init__(self, require_spec, where='../..'):
+        # By default, assume top-level pkg has the same name as the dist.
+        # Also assume that headers are located in the package dir, and
+        # are meant to be included as follows:
+        #    #include "module/header_name.h"
+        self._require_spec = require_spec
+        self._where = where
+
+    def __str__(self):
+        from pkg_resources import require
+        from pkg_resources import resource_filename
+        from pkg_resources import DistributionNotFound
+        try:
+            require(self._require_spec)
+            path = resource_filename(self._require_spec, self._where)
+        except DistributionNotFound:
+            path = os.path.join(here, 'include')
+        return os.path.abspath(path)
+
+include = [ModuleHeaderDir('zope.proxy')]
+
+# Jython cannot build the C optimizations, while on PyPy they are
+# anti-optimizations (the C extension compatibility layer is known-slow,
+# and defeats JIT opportunities).
+py_impl = getattr(platform, 'python_implementation', lambda: None)
+pure_python = os.environ.get('PURE_PYTHON', False)
+is_pypy = py_impl() == 'PyPy'
+is_jython = 'java' in sys.platform
+
+if pure_python or is_pypy or is_jython:
+    setup_requires = []
+    ext_modules = []
+else:
+    setup_requires = ['zope.proxy >= 4.1.0']
+    ext_modules = [
+        Extension("zope.security._proxy",
+                  [os.path.join('src', 'zope', 'security', "_proxy.c")],
+                  include_dirs=include,
+                 ),
+        Extension("zope.security._zope_security_checker",
+                  [os.path.join('src', 'zope', 'security',
+                                        "_zope_security_checker.c")]
+                 ),
+    ]
+
 setup(name='zope.security',
       version='4.0.0dev',
       author='Zope Foundation and Contributors',
@@ -54,15 +108,8 @@
       packages=find_packages('src'),
       package_dir = {'': 'src'},
       namespace_packages=['zope'],
-      ext_modules=[Extension("zope.security._proxy",
-                             [os.path.join('src', 'zope', 'security',
-                                           "_proxy.c")
-                              ], include_dirs=['include']),
-                   Extension("zope.security._zope_security_checker",
-                             [os.path.join('src', 'zope', 'security',
-                                           "_zope_security_checker.c")
-                              ]),
-                   ],
+      setup_requires=setup_requires,
+      ext_modules=ext_modules,
       install_requires=['setuptools',
                         'zope.component',
                         'zope.i18nmessageid',

Modified: zope.security/branches/tseaver-no_svn_external/src/zope/security/_proxy.c
===================================================================
--- zope.security/branches/tseaver-no_svn_external/src/zope/security/_proxy.c	2012-12-19 19:30:35 UTC (rev 128793)
+++ zope.security/branches/tseaver-no_svn_external/src/zope/security/_proxy.c	2012-12-19 19:30:38 UTC (rev 128794)
@@ -15,7 +15,7 @@
 */
 
 #include <Python.h>
-#include "zope.proxy/proxy.h"
+#include "zope/proxy/proxy.h"
 
 static PyObject *__class__str = 0, *__name__str = 0, *__module__str = 0;
 



More information about the checkins mailing list