Hi,

I'm trying to package pypy3.3 for the Guix distribution.

In the course of that I found that 
pypy3.3-v5.2.0-alpha1-src/lib-python/3/distutils/sysconfig_pypy.py doesn't 
honor the compiler environment variables ("CC" etc) like sysconfig_cpython.py 
does. Is that on purpose? If not, find attached a patch which makes it honor 
the variables (I have tested it and it works).

Cheers,
   Danny
--- /tmp/sysconfig_pypy.py	2016-09-14 00:38:36.325334296 +0200
+++ pypy3.3-v5.2.0-alpha1-src/lib-python/3/distutils/sysconfig_pypy.py	2016-09-14 00:37:55.068908258 +0200
@@ -123,6 +123,19 @@
     optional C speedup components.
     """
     if compiler.compiler_type == "unix":
+        varnames = ["CC", "CXX", "LDSHARED", "CPP", "LDFLAGS", "CFLAGS", "CPPFLAGS", "AR", "ARFLAGS", "OPT", "CFLAGS", "CCSHARED", "SHLIB_SUFFIX"]
+        cfg = get_config_vars()
+        g = {}
+        for varname in varnames:
+            g[varname] = os.environ.get(varname) or cfg.get(varname)
+        cc = g["CC"] or "cc"
+        cpp = g["CPP"] if "CPP" in os.environ else ("{} -E".format(g["CC"]))
+        cc_cmd = "{} {}".format(g["CC"], g["CFLAGS"] or "")
+        ccshared = g["CCSHARED"] or ""
+        cxx = g["CXX"]
+        ldshared = "{} -shared {} {} {}".format(g["LDSHARED"] or g["CC"], os.environ.get("LDFLAGS", ""), os.environ.get("CFLAGS", ""), os.environ.get("CPPFLAGS", ""))
+        archiver = "{} {}".format(g["AR"], g["ARFLAGS"])
+        compiler.set_executables(preprocessor=cpp, compiler=cc_cmd, compiler_so=cc_cmd + " " + ccshared, compiler_cxx=cxx, linker_so=ldshared, linker_exe=cc, archiver=archiver)
         compiler.compiler_so.extend(['-O2', '-fPIC', '-Wimplicit'])
         compiler.shared_lib_extension = get_config_var('SO')
         if "CPPFLAGS" in os.environ:
_______________________________________________
pypy-dev mailing list
pypy-dev@python.org
https://mail.python.org/mailman/listinfo/pypy-dev

Reply via email to