Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/ExeBy/smexe_ro.../usr/lib64/python2....
File: sysconfig.py
"""Provide access to Python's configuration information.
[0] Fix | Delete
[1] Fix | Delete
"""
[2] Fix | Delete
import sys
[3] Fix | Delete
import os
[4] Fix | Delete
from os.path import pardir, realpath
[5] Fix | Delete
[6] Fix | Delete
_INSTALL_SCHEMES = {
[7] Fix | Delete
'posix_prefix': {
[8] Fix | Delete
'stdlib': '{base}/lib64/python{py_version_short}',
[9] Fix | Delete
'platstdlib': '{platbase}/lib64/python{py_version_short}',
[10] Fix | Delete
'purelib': '{base}/lib/python{py_version_short}/site-packages',
[11] Fix | Delete
'platlib': '{platbase}/lib64/python{py_version_short}/site-packages',
[12] Fix | Delete
'include': '{base}/include/python{py_version_short}',
[13] Fix | Delete
'platinclude': '{platbase}/include/python{py_version_short}',
[14] Fix | Delete
'scripts': '{base}/bin',
[15] Fix | Delete
'data': '{base}',
[16] Fix | Delete
},
[17] Fix | Delete
'posix_home': {
[18] Fix | Delete
'stdlib': '{base}/lib64/python',
[19] Fix | Delete
'platstdlib': '{base}/lib64/python',
[20] Fix | Delete
'purelib': '{base}/lib/python',
[21] Fix | Delete
'platlib': '{base}/lib64/python',
[22] Fix | Delete
'include': '{base}/include/python',
[23] Fix | Delete
'platinclude': '{base}/include/python',
[24] Fix | Delete
'scripts': '{base}/bin',
[25] Fix | Delete
'data' : '{base}',
[26] Fix | Delete
},
[27] Fix | Delete
'nt': {
[28] Fix | Delete
'stdlib': '{base}/Lib',
[29] Fix | Delete
'platstdlib': '{base}/Lib',
[30] Fix | Delete
'purelib': '{base}/Lib/site-packages',
[31] Fix | Delete
'platlib': '{base}/Lib/site-packages',
[32] Fix | Delete
'include': '{base}/Include',
[33] Fix | Delete
'platinclude': '{base}/Include',
[34] Fix | Delete
'scripts': '{base}/Scripts',
[35] Fix | Delete
'data' : '{base}',
[36] Fix | Delete
},
[37] Fix | Delete
'os2': {
[38] Fix | Delete
'stdlib': '{base}/Lib',
[39] Fix | Delete
'platstdlib': '{base}/Lib',
[40] Fix | Delete
'purelib': '{base}/Lib/site-packages',
[41] Fix | Delete
'platlib': '{base}/Lib/site-packages',
[42] Fix | Delete
'include': '{base}/Include',
[43] Fix | Delete
'platinclude': '{base}/Include',
[44] Fix | Delete
'scripts': '{base}/Scripts',
[45] Fix | Delete
'data' : '{base}',
[46] Fix | Delete
},
[47] Fix | Delete
'os2_home': {
[48] Fix | Delete
'stdlib': '{userbase}/lib/python{py_version_short}',
[49] Fix | Delete
'platstdlib': '{userbase}/lib/python{py_version_short}',
[50] Fix | Delete
'purelib': '{userbase}/lib/python{py_version_short}/site-packages',
[51] Fix | Delete
'platlib': '{userbase}/lib/python{py_version_short}/site-packages',
[52] Fix | Delete
'include': '{userbase}/include/python{py_version_short}',
[53] Fix | Delete
'scripts': '{userbase}/bin',
[54] Fix | Delete
'data' : '{userbase}',
[55] Fix | Delete
},
[56] Fix | Delete
'nt_user': {
[57] Fix | Delete
'stdlib': '{userbase}/Python{py_version_nodot}',
[58] Fix | Delete
'platstdlib': '{userbase}/Python{py_version_nodot}',
[59] Fix | Delete
'purelib': '{userbase}/Python{py_version_nodot}/site-packages',
[60] Fix | Delete
'platlib': '{userbase}/Python{py_version_nodot}/site-packages',
[61] Fix | Delete
'include': '{userbase}/Python{py_version_nodot}/Include',
[62] Fix | Delete
'scripts': '{userbase}/Scripts',
[63] Fix | Delete
'data' : '{userbase}',
[64] Fix | Delete
},
[65] Fix | Delete
'posix_user': {
[66] Fix | Delete
'stdlib': '{userbase}/lib64/python{py_version_short}',
[67] Fix | Delete
'platstdlib': '{userbase}/lib64/python{py_version_short}',
[68] Fix | Delete
'purelib': '{userbase}/lib/python{py_version_short}/site-packages',
[69] Fix | Delete
'platlib': '{userbase}/lib64/python{py_version_short}/site-packages',
[70] Fix | Delete
'include': '{userbase}/include/python{py_version_short}',
[71] Fix | Delete
'scripts': '{userbase}/bin',
[72] Fix | Delete
'data' : '{userbase}',
[73] Fix | Delete
},
[74] Fix | Delete
'osx_framework_user': {
[75] Fix | Delete
'stdlib': '{userbase}/lib/python',
[76] Fix | Delete
'platstdlib': '{userbase}/lib/python',
[77] Fix | Delete
'purelib': '{userbase}/lib/python/site-packages',
[78] Fix | Delete
'platlib': '{userbase}/lib/python/site-packages',
[79] Fix | Delete
'include': '{userbase}/include',
[80] Fix | Delete
'scripts': '{userbase}/bin',
[81] Fix | Delete
'data' : '{userbase}',
[82] Fix | Delete
},
[83] Fix | Delete
}
[84] Fix | Delete
[85] Fix | Delete
_SCHEME_KEYS = ('stdlib', 'platstdlib', 'purelib', 'platlib', 'include',
[86] Fix | Delete
'scripts', 'data')
[87] Fix | Delete
_PY_VERSION = sys.version.split()[0]
[88] Fix | Delete
_PY_VERSION_SHORT = sys.version[:3]
[89] Fix | Delete
_PY_VERSION_SHORT_NO_DOT = _PY_VERSION[0] + _PY_VERSION[2]
[90] Fix | Delete
_PREFIX = os.path.normpath(sys.prefix)
[91] Fix | Delete
_EXEC_PREFIX = os.path.normpath(sys.exec_prefix)
[92] Fix | Delete
_CONFIG_VARS = None
[93] Fix | Delete
_USER_BASE = None
[94] Fix | Delete
[95] Fix | Delete
def _safe_realpath(path):
[96] Fix | Delete
try:
[97] Fix | Delete
return realpath(path)
[98] Fix | Delete
except OSError:
[99] Fix | Delete
return path
[100] Fix | Delete
[101] Fix | Delete
if sys.executable:
[102] Fix | Delete
_PROJECT_BASE = os.path.dirname(_safe_realpath(sys.executable))
[103] Fix | Delete
else:
[104] Fix | Delete
# sys.executable can be empty if argv[0] has been changed and Python is
[105] Fix | Delete
# unable to retrieve the real program name
[106] Fix | Delete
_PROJECT_BASE = _safe_realpath(os.getcwd())
[107] Fix | Delete
[108] Fix | Delete
if os.name == "nt" and "pcbuild" in _PROJECT_BASE[-8:].lower():
[109] Fix | Delete
_PROJECT_BASE = _safe_realpath(os.path.join(_PROJECT_BASE, pardir))
[110] Fix | Delete
# PC/VS7.1
[111] Fix | Delete
if os.name == "nt" and "\\pc\\v" in _PROJECT_BASE[-10:].lower():
[112] Fix | Delete
_PROJECT_BASE = _safe_realpath(os.path.join(_PROJECT_BASE, pardir, pardir))
[113] Fix | Delete
# PC/VS9.0/amd64
[114] Fix | Delete
if (os.name == "nt"
[115] Fix | Delete
and os.path.basename(os.path.dirname(os.path.dirname(_PROJECT_BASE))).lower() == "pc"
[116] Fix | Delete
and os.path.basename(os.path.dirname(_PROJECT_BASE)).lower() == "vs9.0"):
[117] Fix | Delete
_PROJECT_BASE = _safe_realpath(os.path.join(_PROJECT_BASE, pardir, pardir, pardir))
[118] Fix | Delete
# PC/AMD64
[119] Fix | Delete
if os.name == "nt" and "\\pcbuild\\amd64" in _PROJECT_BASE[-14:].lower():
[120] Fix | Delete
_PROJECT_BASE = _safe_realpath(os.path.join(_PROJECT_BASE, pardir, pardir))
[121] Fix | Delete
[122] Fix | Delete
# set for cross builds
[123] Fix | Delete
if "_PYTHON_PROJECT_BASE" in os.environ:
[124] Fix | Delete
# the build directory for posix builds
[125] Fix | Delete
_PROJECT_BASE = os.path.normpath(os.path.abspath("."))
[126] Fix | Delete
def is_python_build():
[127] Fix | Delete
for fn in ("Setup.dist", "Setup.local"):
[128] Fix | Delete
if os.path.isfile(os.path.join(_PROJECT_BASE, "Modules", fn)):
[129] Fix | Delete
return True
[130] Fix | Delete
return False
[131] Fix | Delete
[132] Fix | Delete
_PYTHON_BUILD = is_python_build()
[133] Fix | Delete
[134] Fix | Delete
if _PYTHON_BUILD:
[135] Fix | Delete
for scheme in ('posix_prefix', 'posix_home'):
[136] Fix | Delete
_INSTALL_SCHEMES[scheme]['include'] = '{projectbase}/Include'
[137] Fix | Delete
_INSTALL_SCHEMES[scheme]['platinclude'] = '{srcdir}'
[138] Fix | Delete
[139] Fix | Delete
def _subst_vars(s, local_vars):
[140] Fix | Delete
try:
[141] Fix | Delete
return s.format(**local_vars)
[142] Fix | Delete
except KeyError:
[143] Fix | Delete
try:
[144] Fix | Delete
return s.format(**os.environ)
[145] Fix | Delete
except KeyError, var:
[146] Fix | Delete
raise AttributeError('{%s}' % var)
[147] Fix | Delete
[148] Fix | Delete
def _extend_dict(target_dict, other_dict):
[149] Fix | Delete
target_keys = target_dict.keys()
[150] Fix | Delete
for key, value in other_dict.items():
[151] Fix | Delete
if key in target_keys:
[152] Fix | Delete
continue
[153] Fix | Delete
target_dict[key] = value
[154] Fix | Delete
[155] Fix | Delete
def _expand_vars(scheme, vars):
[156] Fix | Delete
res = {}
[157] Fix | Delete
if vars is None:
[158] Fix | Delete
vars = {}
[159] Fix | Delete
_extend_dict(vars, get_config_vars())
[160] Fix | Delete
[161] Fix | Delete
for key, value in _INSTALL_SCHEMES[scheme].items():
[162] Fix | Delete
if os.name in ('posix', 'nt'):
[163] Fix | Delete
value = os.path.expanduser(value)
[164] Fix | Delete
res[key] = os.path.normpath(_subst_vars(value, vars))
[165] Fix | Delete
return res
[166] Fix | Delete
[167] Fix | Delete
def _get_default_scheme():
[168] Fix | Delete
if os.name == 'posix':
[169] Fix | Delete
# the default scheme for posix is posix_prefix
[170] Fix | Delete
return 'posix_prefix'
[171] Fix | Delete
return os.name
[172] Fix | Delete
[173] Fix | Delete
def _getuserbase():
[174] Fix | Delete
env_base = os.environ.get("PYTHONUSERBASE", None)
[175] Fix | Delete
def joinuser(*args):
[176] Fix | Delete
return os.path.expanduser(os.path.join(*args))
[177] Fix | Delete
[178] Fix | Delete
# what about 'os2emx', 'riscos' ?
[179] Fix | Delete
if os.name == "nt":
[180] Fix | Delete
base = os.environ.get("APPDATA") or "~"
[181] Fix | Delete
return env_base if env_base else joinuser(base, "Python")
[182] Fix | Delete
[183] Fix | Delete
if sys.platform == "darwin":
[184] Fix | Delete
framework = get_config_var("PYTHONFRAMEWORK")
[185] Fix | Delete
if framework:
[186] Fix | Delete
return env_base if env_base else \
[187] Fix | Delete
joinuser("~", "Library", framework, "%d.%d"
[188] Fix | Delete
% (sys.version_info[:2]))
[189] Fix | Delete
[190] Fix | Delete
return env_base if env_base else joinuser("~", ".local")
[191] Fix | Delete
[192] Fix | Delete
[193] Fix | Delete
def _parse_makefile(filename, vars=None):
[194] Fix | Delete
"""Parse a Makefile-style file.
[195] Fix | Delete
[196] Fix | Delete
A dictionary containing name/value pairs is returned. If an
[197] Fix | Delete
optional dictionary is passed in as the second argument, it is
[198] Fix | Delete
used instead of a new dictionary.
[199] Fix | Delete
"""
[200] Fix | Delete
import re
[201] Fix | Delete
# Regexes needed for parsing Makefile (and similar syntaxes,
[202] Fix | Delete
# like old-style Setup files).
[203] Fix | Delete
_variable_rx = re.compile("([a-zA-Z][a-zA-Z0-9_]+)\s*=\s*(.*)")
[204] Fix | Delete
_findvar1_rx = re.compile(r"\$\(([A-Za-z][A-Za-z0-9_]*)\)")
[205] Fix | Delete
_findvar2_rx = re.compile(r"\${([A-Za-z][A-Za-z0-9_]*)}")
[206] Fix | Delete
[207] Fix | Delete
if vars is None:
[208] Fix | Delete
vars = {}
[209] Fix | Delete
done = {}
[210] Fix | Delete
notdone = {}
[211] Fix | Delete
[212] Fix | Delete
with open(filename) as f:
[213] Fix | Delete
lines = f.readlines()
[214] Fix | Delete
[215] Fix | Delete
for line in lines:
[216] Fix | Delete
if line.startswith('#') or line.strip() == '':
[217] Fix | Delete
continue
[218] Fix | Delete
m = _variable_rx.match(line)
[219] Fix | Delete
if m:
[220] Fix | Delete
n, v = m.group(1, 2)
[221] Fix | Delete
v = v.strip()
[222] Fix | Delete
# `$$' is a literal `$' in make
[223] Fix | Delete
tmpv = v.replace('$$', '')
[224] Fix | Delete
[225] Fix | Delete
if "$" in tmpv:
[226] Fix | Delete
notdone[n] = v
[227] Fix | Delete
else:
[228] Fix | Delete
try:
[229] Fix | Delete
v = int(v)
[230] Fix | Delete
except ValueError:
[231] Fix | Delete
# insert literal `$'
[232] Fix | Delete
done[n] = v.replace('$$', '$')
[233] Fix | Delete
else:
[234] Fix | Delete
done[n] = v
[235] Fix | Delete
[236] Fix | Delete
# do variable interpolation here
[237] Fix | Delete
while notdone:
[238] Fix | Delete
for name in notdone.keys():
[239] Fix | Delete
value = notdone[name]
[240] Fix | Delete
m = _findvar1_rx.search(value) or _findvar2_rx.search(value)
[241] Fix | Delete
if m:
[242] Fix | Delete
n = m.group(1)
[243] Fix | Delete
found = True
[244] Fix | Delete
if n in done:
[245] Fix | Delete
item = str(done[n])
[246] Fix | Delete
elif n in notdone:
[247] Fix | Delete
# get it on a subsequent round
[248] Fix | Delete
found = False
[249] Fix | Delete
elif n in os.environ:
[250] Fix | Delete
# do it like make: fall back to environment
[251] Fix | Delete
item = os.environ[n]
[252] Fix | Delete
else:
[253] Fix | Delete
done[n] = item = ""
[254] Fix | Delete
if found:
[255] Fix | Delete
after = value[m.end():]
[256] Fix | Delete
value = value[:m.start()] + item + after
[257] Fix | Delete
if "$" in after:
[258] Fix | Delete
notdone[name] = value
[259] Fix | Delete
else:
[260] Fix | Delete
try: value = int(value)
[261] Fix | Delete
except ValueError:
[262] Fix | Delete
done[name] = value.strip()
[263] Fix | Delete
else:
[264] Fix | Delete
done[name] = value
[265] Fix | Delete
del notdone[name]
[266] Fix | Delete
else:
[267] Fix | Delete
# bogus variable reference; just drop it since we can't deal
[268] Fix | Delete
del notdone[name]
[269] Fix | Delete
# strip spurious spaces
[270] Fix | Delete
for k, v in done.items():
[271] Fix | Delete
if isinstance(v, str):
[272] Fix | Delete
done[k] = v.strip()
[273] Fix | Delete
[274] Fix | Delete
# save the results in the global dictionary
[275] Fix | Delete
vars.update(done)
[276] Fix | Delete
return vars
[277] Fix | Delete
[278] Fix | Delete
[279] Fix | Delete
def get_makefile_filename():
[280] Fix | Delete
"""Return the path of the Makefile."""
[281] Fix | Delete
if _PYTHON_BUILD:
[282] Fix | Delete
return os.path.join(_PROJECT_BASE, "Makefile")
[283] Fix | Delete
return os.path.join(get_path('platstdlib'), "config", "Makefile")
[284] Fix | Delete
[285] Fix | Delete
# Issue #22199: retain undocumented private name for compatibility
[286] Fix | Delete
_get_makefile_filename = get_makefile_filename
[287] Fix | Delete
[288] Fix | Delete
def _generate_posix_vars():
[289] Fix | Delete
"""Generate the Python module containing build-time variables."""
[290] Fix | Delete
import pprint
[291] Fix | Delete
vars = {}
[292] Fix | Delete
# load the installed Makefile:
[293] Fix | Delete
makefile = get_makefile_filename()
[294] Fix | Delete
try:
[295] Fix | Delete
_parse_makefile(makefile, vars)
[296] Fix | Delete
except IOError, e:
[297] Fix | Delete
msg = "invalid Python installation: unable to open %s" % makefile
[298] Fix | Delete
if hasattr(e, "strerror"):
[299] Fix | Delete
msg = msg + " (%s)" % e.strerror
[300] Fix | Delete
raise IOError(msg)
[301] Fix | Delete
[302] Fix | Delete
# load the installed pyconfig.h:
[303] Fix | Delete
config_h = get_config_h_filename()
[304] Fix | Delete
try:
[305] Fix | Delete
with open(config_h) as f:
[306] Fix | Delete
parse_config_h(f, vars)
[307] Fix | Delete
except IOError, e:
[308] Fix | Delete
msg = "invalid Python installation: unable to open %s" % config_h
[309] Fix | Delete
if hasattr(e, "strerror"):
[310] Fix | Delete
msg = msg + " (%s)" % e.strerror
[311] Fix | Delete
raise IOError(msg)
[312] Fix | Delete
[313] Fix | Delete
# On AIX, there are wrong paths to the linker scripts in the Makefile
[314] Fix | Delete
# -- these paths are relative to the Python source, but when installed
[315] Fix | Delete
# the scripts are in another directory.
[316] Fix | Delete
if _PYTHON_BUILD:
[317] Fix | Delete
vars['LDSHARED'] = vars['BLDSHARED']
[318] Fix | Delete
[319] Fix | Delete
# There's a chicken-and-egg situation on OS X with regards to the
[320] Fix | Delete
# _sysconfigdata module after the changes introduced by #15298:
[321] Fix | Delete
# get_config_vars() is called by get_platform() as part of the
[322] Fix | Delete
# `make pybuilddir.txt` target -- which is a precursor to the
[323] Fix | Delete
# _sysconfigdata.py module being constructed. Unfortunately,
[324] Fix | Delete
# get_config_vars() eventually calls _init_posix(), which attempts
[325] Fix | Delete
# to import _sysconfigdata, which we won't have built yet. In order
[326] Fix | Delete
# for _init_posix() to work, if we're on Darwin, just mock up the
[327] Fix | Delete
# _sysconfigdata module manually and populate it with the build vars.
[328] Fix | Delete
# This is more than sufficient for ensuring the subsequent call to
[329] Fix | Delete
# get_platform() succeeds.
[330] Fix | Delete
name = '_sysconfigdata'
[331] Fix | Delete
if 'darwin' in sys.platform:
[332] Fix | Delete
import imp
[333] Fix | Delete
module = imp.new_module(name)
[334] Fix | Delete
module.build_time_vars = vars
[335] Fix | Delete
sys.modules[name] = module
[336] Fix | Delete
[337] Fix | Delete
pybuilddir = 'build/lib.%s-%s' % (get_platform(), sys.version[:3])
[338] Fix | Delete
if hasattr(sys, "gettotalrefcount"):
[339] Fix | Delete
pybuilddir += '-pydebug'
[340] Fix | Delete
try:
[341] Fix | Delete
os.makedirs(pybuilddir)
[342] Fix | Delete
except OSError:
[343] Fix | Delete
pass
[344] Fix | Delete
destfile = os.path.join(pybuilddir, name + '.py')
[345] Fix | Delete
[346] Fix | Delete
with open(destfile, 'wb') as f:
[347] Fix | Delete
f.write('# system configuration generated and used by'
[348] Fix | Delete
' the sysconfig module\n')
[349] Fix | Delete
f.write('build_time_vars = ')
[350] Fix | Delete
pprint.pprint(vars, stream=f)
[351] Fix | Delete
[352] Fix | Delete
# Create file used for sys.path fixup -- see Modules/getpath.c
[353] Fix | Delete
with open('pybuilddir.txt', 'w') as f:
[354] Fix | Delete
f.write(pybuilddir)
[355] Fix | Delete
[356] Fix | Delete
def _init_posix(vars):
[357] Fix | Delete
"""Initialize the module as appropriate for POSIX systems."""
[358] Fix | Delete
# _sysconfigdata is generated at build time, see _generate_posix_vars()
[359] Fix | Delete
from _sysconfigdata import build_time_vars
[360] Fix | Delete
vars.update(build_time_vars)
[361] Fix | Delete
[362] Fix | Delete
def _init_non_posix(vars):
[363] Fix | Delete
"""Initialize the module as appropriate for NT"""
[364] Fix | Delete
# set basic install directories
[365] Fix | Delete
vars['LIBDEST'] = get_path('stdlib')
[366] Fix | Delete
vars['BINLIBDEST'] = get_path('platstdlib')
[367] Fix | Delete
vars['INCLUDEPY'] = get_path('include')
[368] Fix | Delete
vars['SO'] = '.pyd'
[369] Fix | Delete
vars['EXE'] = '.exe'
[370] Fix | Delete
vars['VERSION'] = _PY_VERSION_SHORT_NO_DOT
[371] Fix | Delete
vars['BINDIR'] = os.path.dirname(_safe_realpath(sys.executable))
[372] Fix | Delete
[373] Fix | Delete
#
[374] Fix | Delete
# public APIs
[375] Fix | Delete
#
[376] Fix | Delete
[377] Fix | Delete
[378] Fix | Delete
def parse_config_h(fp, vars=None):
[379] Fix | Delete
"""Parse a config.h-style file.
[380] Fix | Delete
[381] Fix | Delete
A dictionary containing name/value pairs is returned. If an
[382] Fix | Delete
optional dictionary is passed in as the second argument, it is
[383] Fix | Delete
used instead of a new dictionary.
[384] Fix | Delete
"""
[385] Fix | Delete
import re
[386] Fix | Delete
if vars is None:
[387] Fix | Delete
vars = {}
[388] Fix | Delete
define_rx = re.compile("#define ([A-Z][A-Za-z0-9_]+) (.*)\n")
[389] Fix | Delete
undef_rx = re.compile("/[*] #undef ([A-Z][A-Za-z0-9_]+) [*]/\n")
[390] Fix | Delete
[391] Fix | Delete
while True:
[392] Fix | Delete
line = fp.readline()
[393] Fix | Delete
if not line:
[394] Fix | Delete
break
[395] Fix | Delete
m = define_rx.match(line)
[396] Fix | Delete
if m:
[397] Fix | Delete
n, v = m.group(1, 2)
[398] Fix | Delete
try: v = int(v)
[399] Fix | Delete
except ValueError: pass
[400] Fix | Delete
vars[n] = v
[401] Fix | Delete
else:
[402] Fix | Delete
m = undef_rx.match(line)
[403] Fix | Delete
if m:
[404] Fix | Delete
vars[m.group(1)] = 0
[405] Fix | Delete
return vars
[406] Fix | Delete
[407] Fix | Delete
def get_config_h_filename():
[408] Fix | Delete
"""Returns the path of pyconfig.h."""
[409] Fix | Delete
if _PYTHON_BUILD:
[410] Fix | Delete
if os.name == "nt":
[411] Fix | Delete
inc_dir = os.path.join(_PROJECT_BASE, "PC")
[412] Fix | Delete
else:
[413] Fix | Delete
inc_dir = _PROJECT_BASE
[414] Fix | Delete
else:
[415] Fix | Delete
inc_dir = get_path('platinclude')
[416] Fix | Delete
return os.path.join(inc_dir, 'pyconfig-64.h')
[417] Fix | Delete
[418] Fix | Delete
def get_scheme_names():
[419] Fix | Delete
"""Returns a tuple containing the schemes names."""
[420] Fix | Delete
schemes = _INSTALL_SCHEMES.keys()
[421] Fix | Delete
schemes.sort()
[422] Fix | Delete
return tuple(schemes)
[423] Fix | Delete
[424] Fix | Delete
def get_path_names():
[425] Fix | Delete
"""Returns a tuple containing the paths names."""
[426] Fix | Delete
return _SCHEME_KEYS
[427] Fix | Delete
[428] Fix | Delete
def get_paths(scheme=_get_default_scheme(), vars=None, expand=True):
[429] Fix | Delete
"""Returns a mapping containing an install scheme.
[430] Fix | Delete
[431] Fix | Delete
``scheme`` is the install scheme name. If not provided, it will
[432] Fix | Delete
return the default scheme for the current platform.
[433] Fix | Delete
"""
[434] Fix | Delete
if expand:
[435] Fix | Delete
return _expand_vars(scheme, vars)
[436] Fix | Delete
else:
[437] Fix | Delete
return _INSTALL_SCHEMES[scheme]
[438] Fix | Delete
[439] Fix | Delete
def get_path(name, scheme=_get_default_scheme(), vars=None, expand=True):
[440] Fix | Delete
"""Returns a path corresponding to the scheme.
[441] Fix | Delete
[442] Fix | Delete
``scheme`` is the install scheme name.
[443] Fix | Delete
"""
[444] Fix | Delete
return get_paths(scheme, vars, expand)[name]
[445] Fix | Delete
[446] Fix | Delete
def get_config_vars(*args):
[447] Fix | Delete
"""With no arguments, return a dictionary of all configuration
[448] Fix | Delete
variables relevant for the current platform.
[449] Fix | Delete
[450] Fix | Delete
On Unix, this means every variable defined in Python's installed Makefile;
[451] Fix | Delete
On Windows and Mac OS it's a much smaller set.
[452] Fix | Delete
[453] Fix | Delete
With arguments, return a list of values that result from looking up
[454] Fix | Delete
each argument in the configuration variable dictionary.
[455] Fix | Delete
"""
[456] Fix | Delete
import re
[457] Fix | Delete
global _CONFIG_VARS
[458] Fix | Delete
if _CONFIG_VARS is None:
[459] Fix | Delete
_CONFIG_VARS = {}
[460] Fix | Delete
# Normalized versions of prefix and exec_prefix are handy to have;
[461] Fix | Delete
# in fact, these are the standard versions used most places in the
[462] Fix | Delete
# Distutils.
[463] Fix | Delete
_CONFIG_VARS['prefix'] = _PREFIX
[464] Fix | Delete
_CONFIG_VARS['exec_prefix'] = _EXEC_PREFIX
[465] Fix | Delete
_CONFIG_VARS['py_version'] = _PY_VERSION
[466] Fix | Delete
_CONFIG_VARS['py_version_short'] = _PY_VERSION_SHORT
[467] Fix | Delete
_CONFIG_VARS['py_version_nodot'] = _PY_VERSION[0] + _PY_VERSION[2]
[468] Fix | Delete
_CONFIG_VARS['base'] = _PREFIX
[469] Fix | Delete
_CONFIG_VARS['platbase'] = _EXEC_PREFIX
[470] Fix | Delete
_CONFIG_VARS['projectbase'] = _PROJECT_BASE
[471] Fix | Delete
[472] Fix | Delete
if os.name in ('nt', 'os2'):
[473] Fix | Delete
_init_non_posix(_CONFIG_VARS)
[474] Fix | Delete
if os.name == 'posix':
[475] Fix | Delete
_init_posix(_CONFIG_VARS)
[476] Fix | Delete
[477] Fix | Delete
# Setting 'userbase' is done below the call to the
[478] Fix | Delete
# init function to enable using 'get_config_var' in
[479] Fix | Delete
# the init-function.
[480] Fix | Delete
_CONFIG_VARS['userbase'] = _getuserbase()
[481] Fix | Delete
[482] Fix | Delete
if 'srcdir' not in _CONFIG_VARS:
[483] Fix | Delete
_CONFIG_VARS['srcdir'] = _PROJECT_BASE
[484] Fix | Delete
[485] Fix | Delete
# Convert srcdir into an absolute path if it appears necessary.
[486] Fix | Delete
# Normally it is relative to the build directory. However, during
[487] Fix | Delete
# testing, for example, we might be running a non-installed python
[488] Fix | Delete
# from a different directory.
[489] Fix | Delete
if _PYTHON_BUILD and os.name == "posix":
[490] Fix | Delete
base = _PROJECT_BASE
[491] Fix | Delete
try:
[492] Fix | Delete
cwd = os.getcwd()
[493] Fix | Delete
except OSError:
[494] Fix | Delete
cwd = None
[495] Fix | Delete
if (not os.path.isabs(_CONFIG_VARS['srcdir']) and
[496] Fix | Delete
base != cwd):
[497] Fix | Delete
# srcdir is relative and we are not in the same directory
[498] Fix | Delete
# as the executable. Assume executable is in the build
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function