[pygobject] setup.py: support building with PyPy. See #180



commit e10d698329529e5e612932567d0bf0ae1acb5674
Author: Christoph Reiter <reiter christoph gmail com>
Date:   Wed Mar 21 08:37:01 2018 +0100

    setup.py: support building with PyPy. See #180
    
    Force the extension for the test libraries, PyPy adds its abi tag by default.
    Make sure -fno-strict-aliasing is used, PyPy doesn't by default.
    Set -Wno-redundant-decls to prevent warning noise from PyPy headers.

 setup.py | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/setup.py b/setup.py
index e44377f8..e7edfe6d 100755
--- a/setup.py
+++ b/setup.py
@@ -24,6 +24,7 @@ import errno
 import subprocess
 import tarfile
 import sysconfig
+import platform
 from email import parser
 
 import pkg_resources
@@ -329,13 +330,14 @@ class build_tests(Command):
 
         if os.name == "nt":
             compiler.shared_lib_extension = ".dll"
-
-        if sys.platform == "darwin":
+        elif sys.platform == "darwin":
             compiler.shared_lib_extension = ".dylib"
             if "-bundle" in compiler.linker_so:
                 compiler.linker_so = list(compiler.linker_so)
                 i = compiler.linker_so.index("-bundle")
                 compiler.linker_so[i] = "-dynamiclib"
+        else:
+            compiler.shared_lib_extension = ".so"
 
         def build_ext(ext):
             if compiler.compiler_type == "msvc":
@@ -773,6 +775,13 @@ def add_ext_warn_flags(ext, compiler, _cache={}):
             "-Wno-unused-command-line-argument",
         ]
 
+        args += [
+            "-fno-strict-aliasing",
+        ]
+
+        if platform.python_implementation() == "PyPy":
+            args.append("-Wno-redundant-decls")
+
         _cache[cache_key] = filter_compiler_arguments(compiler, args)
 
     ext.extra_compile_args += _cache[cache_key]


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