Debian Codegraph @

lib_pypy/_sysconfigdata.py

raw symbols SCIP
1 import _imp
2 import os
3 import platform
4 import sys
5 import struct
6 from shutil import which
7
8 so_ext = _imp.extension_suffixes()[0]
9
10 pydot = '%d.%d' % sys.version_info[:2]
11
12 build_time_vars = {
13 'ABIFLAGS': '',
14 # SOABI is PEP 3149 compliant, but CPython3 has so_ext.split('.')[1]
15 # ("ABI tag"-"platform tag") where this is ABI tag only. Wheel 0.34.2
16 # depends on this value, so don't make it CPython compliant without
17 # checking wheel: it uses pep425tags.get_abi_tag with special handling
18 # for CPython
19 "SOABI": '-'.join(so_ext.split('.')[1].split('-')[:2]),
20 "SO": so_ext, # deprecated in Python 3, for backward compatibility
21 'MULTIARCH': sys.implementation._multiarch,
22 'CC': "cc -pthread",
23 'CXX': "c++ -pthread",
24 'OPT': "-DNDEBUG -O2",
25 'CFLAGS': "-DNDEBUG -O2",
26 'CCSHARED': "-fPIC",
27 'LDFLAGS': "-Wl,-Bsymbolic-functions",
28 'LDSHARED': "cc -pthread -shared -Wl,-Bsymbolic-functions",
29 'LDCXXSHARED': "c++ -shared -Wl,-O1 -Wl,-Bsymbolic-functions",
30 'EXT_SUFFIX': so_ext,
31 'SHLIB_SUFFIX': ".so",
32 'AR': "ar",
33 'ARFLAGS': "rc",
34 'EXE': "",
35 'VERSION': pydot,
36 'LDVERSION': pydot,
37 'Py_DEBUG': 0, # cpyext never uses this
38 'Py_ENABLE_SHARED': 0, # if 1, will add python so to link like -lpython3.7
39 'SIZEOF_VOID_P': struct.calcsize("P"),
40 }
41
42 # LIBDIR should point to where the libpypy3.11-c.so file lives, on CPython
43 # it points to "mybase/lib". But that would require rethinking the PyPy
44 # packaging process which copies pypy3 and libpypy3.11-c.so to the
45 # "mybase/bin" directory. Only when making a portable build (the default
46 # for the linux buildbots) is there even a "mybase/lib" created, even so
47 # the mybase/bin layout is left untouched.
48 mybase = sys.base_prefix
49 if sys.platform == 'win32':
50 build_time_vars['LDLIBRARY'] = 'libpypy3.11-c.dll'
51 build_time_vars['INCLUDEPY'] = os.path.join(mybase, 'include')
52 build_time_vars['LIBDIR'] = mybase
53 else:
54 build_time_vars['LDLIBRARY'] = 'libpypy3.11-c.so'
55 build_time_vars['INCLUDEPY'] = os.path.join(mybase, 'include', 'pypy' + pydot)
56 build_time_vars['LIBDIR'] = os.path.join(mybase, 'bin')
57 build_time_vars['CONFINCLUDEPY'] = build_time_vars['INCLUDEPY']
58 # try paths relative to sys.base_prefix first
59 tzpaths = [
60 os.path.join(mybase, 'share', 'zoneinfo'),
61 os.path.join(mybase, 'lib', 'zoneinfo'),
62 os.path.join(mybase, 'share', 'lib', 'zoneinfo'),
63 os.path.join(mybase, '..', 'etc', 'zoneinfo'),
64 ]
65 # add absolute system paths if sys.base_prefix != "/usr"
66 # (then we'd be adding duplicates)
67 if mybase != '/usr':
68 tzpaths.extend([
69 '/usr/share/zoneinfo',
70 '/usr/lib/zoneinfo',
71 '/usr/share/lib/zoneinfo',
72 '/etc/zoneinfo',
73 ])
74 build_time_vars['TZPATH'] = ':'.join(tzpaths)
75
76 if which("gcc"):
77 build_time_vars.update({
78 "CC": "gcc -pthread",
79 "GNULD": "yes",
80 "LDSHARED": "gcc -pthread -shared" + " " + build_time_vars["LDFLAGS"] ,
81 })
82 if which("g++"):
83 build_time_vars["CXX"] = "g++ -pthread"
84
85 if sys.platform[:6] == "darwin":
86 arch = platform.machine()
87 build_time_vars['CC'] += ' -arch %s' % (arch,)
88 build_time_vars["LDFLAGS"] = "-undefined dynamic_lookup"
89 build_time_vars["LDSHARED"] = "clang -bundle -undefined dynamic_lookup "
90 build_time_vars["LDCXXSHARED"] = "clang++ -bundle -undefined dynamic_lookup "
91 build_time_vars['LDLIBRARY'] = 'libpypy3.11-c.dylib'
92 # scikit-build checks this, it is left over from the NextStep rld linker
93 build_time_vars['WITH_DYLD'] = 1
94 if "CXX" in build_time_vars:
95 build_time_vars['CXX'] += ' -arch %s' % (arch,)
96 # This was added to solve problems that may have been
97 # solved elsewhere. Can we remove it? See cibuildwheel PR 185 and
98 # pypa/wheel. Need to check: interaction with build_cffi_imports.py
99 #
100 # In any case, keep this in sync with DARWIN_VERSION_MIN in
101 # rpython/translator/platform/darwin.py and Lib/_osx_support.py
102 if arch == "arm64":
103 build_time_vars['MACOSX_DEPLOYMENT_TARGET'] = '11.0'
104 else:
105 build_time_vars['MACOSX_DEPLOYMENT_TARGET'] = '10.15'
106