mirror of https://github.com/KLayout/klayout.git
Attempt to fix setup.py for 3.9 (Windows build fails because of quotes around include paths in compiler call)
This commit is contained in:
parent
2eb7c4f6ca
commit
ee60461789
29
setup.py
29
setup.py
|
|
@ -59,6 +59,7 @@ from setuptools.extension import Extension, Library
|
||||||
import glob
|
import glob
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
import sys
|
||||||
import platform
|
import platform
|
||||||
from distutils.errors import CompileError
|
from distutils.errors import CompileError
|
||||||
import distutils.command.build_ext
|
import distutils.command.build_ext
|
||||||
|
|
@ -102,12 +103,20 @@ def parallelCCompile(self, sources, output_dir=None, macros=None, include_dirs=N
|
||||||
|
|
||||||
|
|
||||||
# only if python version > 2.6, somehow the travis compiler hangs in 2.6
|
# only if python version > 2.6, somehow the travis compiler hangs in 2.6
|
||||||
import sys
|
if sys.version_info[0] * 100 + sys.version_info[1] > 206:
|
||||||
if sys.version_info[0] * 10 + sys.version_info[1] > 26:
|
|
||||||
import distutils.ccompiler
|
import distutils.ccompiler
|
||||||
distutils.ccompiler.CCompiler.compile = parallelCCompile
|
distutils.ccompiler.CCompiler.compile = parallelCCompile
|
||||||
|
|
||||||
|
|
||||||
|
# put a path in quotes if required
|
||||||
|
def quote_path(path):
|
||||||
|
# looks like disutils don't need path quoting in version >= 3.9:
|
||||||
|
if " " in path and sys.version_info[0] * 100 + sys.version_info[1] < 309:
|
||||||
|
return "\"" + path + "\""
|
||||||
|
else:
|
||||||
|
return path
|
||||||
|
|
||||||
|
|
||||||
# TODO: delete (Obsolete)
|
# TODO: delete (Obsolete)
|
||||||
# patch get_ext_filename
|
# patch get_ext_filename
|
||||||
from distutils.command.build_ext import build_ext
|
from distutils.command.build_ext import build_ext
|
||||||
|
|
@ -252,10 +261,10 @@ class Config(object):
|
||||||
if platform.system() == "Windows":
|
if platform.system() == "Windows":
|
||||||
bits = os.getenv("KLAYOUT_BITS")
|
bits = os.getenv("KLAYOUT_BITS")
|
||||||
if bits:
|
if bits:
|
||||||
return ["\"-I" + os.path.join(bits, "zlib", "include") + "\"",
|
return [quote_path("-I" + os.path.join(bits, "zlib", "include")),
|
||||||
"\"-I" + os.path.join(bits, "ptw", "include") + "\"",
|
quote_path("-I" + os.path.join(bits, "ptw", "include")),
|
||||||
"\"-I" + os.path.join(bits, "expat", "include") + "\"",
|
quote_path("-I" + os.path.join(bits, "expat", "include")),
|
||||||
"\"-I" + os.path.join(bits, "curl", "include") + "\""]
|
quote_path("-I" + os.path.join(bits, "curl", "include"))]
|
||||||
else:
|
else:
|
||||||
return []
|
return []
|
||||||
elif platform.system() == "Darwin":
|
elif platform.system() == "Darwin":
|
||||||
|
|
@ -285,10 +294,10 @@ class Config(object):
|
||||||
args = ["/DLL"]
|
args = ["/DLL"]
|
||||||
bits = os.getenv("KLAYOUT_BITS")
|
bits = os.getenv("KLAYOUT_BITS")
|
||||||
if bits:
|
if bits:
|
||||||
args += ["\"/LIBPATH:" + os.path.join(bits, "zlib", "libraries") + "\"",
|
args += [quote_path("/LIBPATH:" + os.path.join(bits, "zlib", "libraries")),
|
||||||
"\"/LIBPATH:" + os.path.join(bits, "ptw", "libraries") + "\"",
|
quote_path("/LIBPATH:" + os.path.join(bits, "ptw", "libraries")),
|
||||||
"\"/LIBPATH:" + os.path.join(bits, "expat", "libraries") + "\"",
|
quote_path("/LIBPATH:" + os.path.join(bits, "expat", "libraries")),
|
||||||
"\"/LIBPATH:" + os.path.join(bits, "curl", "libraries") + "\""]
|
quote_path("/LIBPATH:" + os.path.join(bits, "curl", "libraries"))]
|
||||||
return args
|
return args
|
||||||
elif platform.system() == "Darwin":
|
elif platform.system() == "Darwin":
|
||||||
# For the dependency modules, make sure we produce a dylib.
|
# For the dependency modules, make sure we produce a dylib.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue