Commits

Anthony Tuininga committed 72f6006

The code required to work around code missing in distutils does not appear to
be required when Python is built with a shared library; including it causes the
shared library to be ignored when building the base executables so they are
much larger than they need to be.

  • Participants
  • Parent commits ba9c396

Comments (1)

  1. frol

    I seems that it does appear to be required! Also it links against shared library without this "if", but fails #32 if you don't add "-lpython2.7" for compiler.

Files changed (1)

         extraArgs = ext.extra_link_args or []
         if sys.platform != "win32":
             vars = distutils.sysconfig.get_config_vars()
-            libraryDirs.append(vars["LIBPL"])
-            libraries.append("python%s.%s" % sys.version_info[:2])
-            if vars["LINKFORSHARED"]:
-                extraArgs.extend(vars["LINKFORSHARED"].split())
-            if vars["LIBS"]:
-                extraArgs.extend(vars["LIBS"].split())
-            if vars["LIBM"]:
-                extraArgs.append(vars["LIBM"])
-            if vars["BASEMODLIBS"]:
-                extraArgs.extend(vars["BASEMODLIBS"].split())
-            if vars["LOCALMODLIBS"]:
-                extraArgs.extend(vars["LOCALMODLIBS"].split())
+            if not vars.get("Py_ENABLE_SHARED", 0):
+                libraryDirs.append(vars["LIBPL"])
+                libraries.append("python%s.%s" % sys.version_info[:2])
+                if vars["LINKFORSHARED"]:
+                    extraArgs.extend(vars["LINKFORSHARED"].split())
+                if vars["LIBS"]:
+                    extraArgs.extend(vars["LIBS"].split())
+                if vars["LIBM"]:
+                    extraArgs.append(vars["LIBM"])
+                if vars["BASEMODLIBS"]:
+                    extraArgs.extend(vars["BASEMODLIBS"].split())
+                if vars["LOCALMODLIBS"]:
+                    extraArgs.extend(vars["LOCALMODLIBS"].split())
             extraArgs.append("-s")
         self.compiler.link_executable(objects, fullName,
                 libraries = libraries,