[pygobject] setup.py: build the test extension in a separate build dir. Fixes #181



commit 4164cab88f11bbce63f054863e3eb2c4d66cc88b
Author: Christoph Reiter <reiter christoph gmail com>
Date:   Sun Mar 18 21:57:07 2018 +0100

    setup.py: build the test extension in a separate build dir. Fixes #181
    
    The install command just copies the whole build tree as is when installing
    which installs the test extension when tests are build before install.
    
    To avoid that set the build base of the extension to a a subdirectory
    of the build base of the main build base.

 setup.py | 9 +++++++++
 1 file changed, 9 insertions(+)
---
diff --git a/setup.py b/setup.py
index 52b45884..e44377f8 100755
--- a/setup.py
+++ b/setup.py
@@ -274,12 +274,16 @@ class build_tests(Command):
 
     def initialize_options(self):
         self.build_temp = None
+        self.build_base = None
         self.force = False
 
     def finalize_options(self):
         self.set_undefined_options(
             'build_ext',
             ('build_temp', 'build_temp'))
+        self.set_undefined_options(
+            'build',
+            ('build_base', 'build_base'))
 
     def _newer_group(self, sources, *targets):
         assert targets
@@ -485,6 +489,11 @@ class build_tests(Command):
         add_ext_warn_flags(ext, compiler)
 
         dist = Distribution({"ext_modules": [ext]})
+
+        build_cmd = dist.get_command_obj("build")
+        build_cmd.build_base = os.path.join(self.build_base, "pygobject_tests")
+        build_cmd.ensure_finalized()
+
         cmd = dist.get_command_obj("build_ext")
         cmd.inplace = True
         cmd.force = self.force


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]