At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 3772
revision-id: [EMAIL PROTECTED]
parent: [EMAIL PROTECTED]
parent: [EMAIL PROTECTED]
committer: Canonical.com Patch Queue Manager <[EMAIL PROTECTED]>
branch nick: +trunk
timestamp: Fri 2008-10-10 20:41:44 +0100
message:
  (jam) Change the setup.py build process to fail unless
        --allow-python-fallback is supplied.
modified:
  setup.py                       setup.py-20050314065409-02f8a0a6e3f9bc70
    ------------------------------------------------------------
    revno: 3759.1.1
    revision-id: [EMAIL PROTECTED]
    parent: [EMAIL PROTECTED]
    committer: John Arbash Meinel <[EMAIL PROTECTED]>
    branch nick: setup_fail
    timestamp: Thu 2008-10-02 11:35:05 -0500
    message:
      Default to requiring extensions.
      
      The build process will fail if extensions cannot be compiled, unless
      --allow-python-fallback is supplied.
      This helps PQM to make sure extensions are tested, and helps
      users by having them explicitly allow non-compiled forms.
    modified:
      setup.py                       setup.py-20050314065409-02f8a0a6e3f9bc70
=== modified file 'setup.py'
--- a/setup.py  2008-10-02 15:36:12 +0000
+++ b/setup.py  2008-10-10 19:41:44 +0000
@@ -144,6 +144,7 @@
     """Customized build distutils action.
     Generate bzr.1.
     """
+
     def run(self):
         build.run(self)
 
@@ -180,20 +181,42 @@
 
 class build_ext_if_possible(build_ext):
 
+    user_options = build_ext.user_options + [
+        ('allow-python-fallback', None,
+         "When an extension cannot be built, allow falling"
+         " back to the pure-python implementation.")
+        ]
+
+    def initialize_options(self):
+        build_ext.initialize_options(self)
+        self.allow_python_fallback = False
+
     def run(self):
         try:
             build_ext.run(self)
         except DistutilsPlatformError, e:
+            if not self.allow_python_fallback:
+                log.warn('\n  Cannot build extensions.\n'
+                         '  Use --allow-python-fallback to use slower'
+                         ' python implementations instead.\n')
+                raise
             log.warn(str(e))
-            log.warn('Extensions cannot be built, '
-                     'will use the Python versions instead')
+            log.warn('\n  Extensions cannot be built.\n'
+                     '  Using the slower Python implementations instead.\n')
 
     def build_extension(self, ext):
         try:
             build_ext.build_extension(self, ext)
         except CCompilerError:
-            log.warn('Building of "%s" extension failed, '
-                     'will use the Python version instead' % (ext.name,))
+            if not self.allow_python_fallback:
+                log.warn('\n  Failed to build "%s".\n'
+                         '  Use --allow-python-fallback to use slower'
+                         ' python implementations instead.\n'
+                         % (ext.name,))
+                raise
+            log.warn('\n  Building of "%s" extension failed.\n'
+                     '  Using the slower Python implementation instead.'
+                     % (ext.name,))
 
 
 # Override the build_ext if we have Pyrex available


-- 
bazaar-commits mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/bazaar-commits

Reply via email to