File: _sysconfigdata.py

package info (click to toggle)
pypy3 7.3.20%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 212,628 kB
  • sloc: python: 2,101,020; ansic: 540,684; sh: 21,462; asm: 14,419; cpp: 4,451; makefile: 4,209; objc: 761; xml: 530; exp: 499; javascript: 314; pascal: 244; lisp: 45; csh: 12; awk: 4
file content (106 lines) | stat: -rw-r--r-- 4,198 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
import _imp
import os
import platform
import sys
import struct
from shutil import which

so_ext = _imp.extension_suffixes()[0]

pydot = '%d.%d' % sys.version_info[:2]

build_time_vars = {
    'ABIFLAGS': '',
    # SOABI is PEP 3149 compliant, but CPython3 has so_ext.split('.')[1]
    # ("ABI tag"-"platform tag") where this is ABI tag only. Wheel 0.34.2
    # depends on this value, so don't make it CPython compliant without
    # checking wheel: it uses pep425tags.get_abi_tag with special handling
    # for CPython
    "SOABI": '-'.join(so_ext.split('.')[1].split('-')[:2]),
    "SO": so_ext,  # deprecated in Python 3, for backward compatibility
    'MULTIARCH': sys.implementation._multiarch,
    'CC': "cc -pthread",
    'CXX': "c++ -pthread",
    'OPT': "-DNDEBUG -O2",
    'CFLAGS': "-DNDEBUG -O2",
    'CCSHARED': "-fPIC",
    'LDFLAGS': "-Wl,-Bsymbolic-functions",
    'LDSHARED': "cc -pthread -shared -Wl,-Bsymbolic-functions",
    'LDCXXSHARED': "c++ -shared -Wl,-O1 -Wl,-Bsymbolic-functions",
    'EXT_SUFFIX': so_ext,
    'SHLIB_SUFFIX': ".so",
    'AR': "ar",
    'ARFLAGS': "rc",
    'EXE': "",
    'VERSION': pydot,
    'LDVERSION': pydot,
    'Py_DEBUG': 0,  # cpyext never uses this
    'Py_ENABLE_SHARED': 0,  # if 1, will add python so to link like -lpython3.7
    'SIZEOF_VOID_P': struct.calcsize("P"),
}

# LIBDIR should point to where the libpypy3.11-c.so file lives, on CPython
# it points to "mybase/lib". But that would require rethinking the PyPy
# packaging process which copies pypy3 and libpypy3.11-c.so to the
# "mybase/bin" directory. Only when making a portable build (the default
# for the linux buildbots) is there even a "mybase/lib" created, even so
# the mybase/bin layout is left untouched.
mybase = sys.base_prefix
if sys.platform == 'win32':
    build_time_vars['LDLIBRARY'] = 'libpypy3.11-c.dll'
    build_time_vars['INCLUDEPY'] = os.path.join(mybase, 'include')
    build_time_vars['LIBDIR'] = mybase
else:
    build_time_vars['LDLIBRARY'] = 'libpypy3.11-c.so'
    build_time_vars['INCLUDEPY'] = os.path.join(mybase, 'include', 'pypy' + pydot)
    build_time_vars['LIBDIR'] = os.path.join(mybase, 'bin')
    build_time_vars['CONFINCLUDEPY'] = build_time_vars['INCLUDEPY']
    # try paths relative to sys.base_prefix first
    tzpaths = [
        os.path.join(mybase, 'share', 'zoneinfo'),
        os.path.join(mybase, 'lib', 'zoneinfo'),
        os.path.join(mybase, 'share', 'lib', 'zoneinfo'),
        os.path.join(mybase, '..', 'etc', 'zoneinfo'),
    ]
    # add absolute system paths if sys.base_prefix != "/usr"
    # (then we'd be adding duplicates)
    if mybase != '/usr':
        tzpaths.extend([
            '/usr/share/zoneinfo',
            '/usr/lib/zoneinfo',
            '/usr/share/lib/zoneinfo',
            '/etc/zoneinfo',
        ])
    build_time_vars['TZPATH'] = ':'.join(tzpaths)

if which("gcc"):
    build_time_vars.update({
        "CC": "gcc -pthread",
        "GNULD": "yes",
        "LDSHARED": "gcc -pthread -shared" + " " + build_time_vars["LDFLAGS"] ,
    })
    if which("g++"):
        build_time_vars["CXX"] = "g++ -pthread"

if sys.platform[:6] == "darwin":
    arch = platform.machine()
    build_time_vars['CC'] += ' -arch %s' % (arch,)
    build_time_vars["LDFLAGS"] = "-undefined dynamic_lookup"
    build_time_vars["LDSHARED"] = "clang -bundle -undefined dynamic_lookup "
    build_time_vars["LDCXXSHARED"] = "clang++ -bundle -undefined dynamic_lookup "
    build_time_vars['LDLIBRARY'] = 'libpypy3.11-c.dylib'
    # scikit-build checks this, it is left over from the NextStep rld linker
    build_time_vars['WITH_DYLD'] = 1
    if "CXX" in build_time_vars:
        build_time_vars['CXX'] += ' -arch %s' % (arch,)
    # This was added to solve problems that may have been
    # solved elsewhere. Can we remove it? See cibuildwheel PR 185 and
    # pypa/wheel. Need to check: interaction with build_cffi_imports.py
    #
    # In any case, keep this in sync with DARWIN_VERSION_MIN in
    # rpython/translator/platform/darwin.py and Lib/_osx_support.py
    if arch == "arm64":
        build_time_vars['MACOSX_DEPLOYMENT_TARGET'] = '11.0'
    else:
        build_time_vars['MACOSX_DEPLOYMENT_TARGET'] = '10.15'