本文整理汇总了Python中sysconfig.get_platform函数的典型用法代码示例。如果您正苦于以下问题:Python get_platform函数的具体用法?Python get_platform怎么用?Python get_platform使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_platform函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_non_python_libs
def get_non_python_libs():
"""Returns list of tuples containing extra dependencies required to run
meld on current platform.
Every pair corresponds to a single library file.
First tuple item is path in local filesystem during build.
Second tuple item correspond to path expected in meld installation
relative to meld prefix.
Note that for returned dynamic libraries and executables dependencies
are expected to be resolved by caller, for example by cx_freeze.
"""
local_bin = os.path.join(sys.prefix, "bin")
inst_root = [] # local paths of files "to put at freezed root"
inst_lib = [] # local paths of files "to put at freezed 'lib' subdir"
if 'mingw' in sysconfig.get_platform():
# dll imported by dll dependencies expected to be auto-resolved later
inst_root = [os.path.join(local_bin, 'libgtksourceview-3.0-1.dll')]
# gspawn-helper is needed for Gtk.show_uri function
if platform.architecture()[0] == '32bit':
inst_lib.append(os.path.join(local_bin, 'gspawn-win32-helper.exe'))
else:
inst_lib.append(os.path.join(local_bin, 'gspawn-win64-helper.exe'))
return [
(f, os.path.basename(f)) for f in inst_root
] + [
(f, os.path.join('lib', os.path.basename(f))) for f in inst_lib
]
示例2: sysconfig2
def sysconfig2():
# import sysconfig module - Provide access to Python’s configuration information
import sysconfig
# returns an installation path corresponding to the path name
print("Path Name : ", sysconfig.get_path("stdlib"))
print()
# returns a string that identifies the current platform.
print("Current Platform : ", sysconfig.get_platform())
print()
# returns the MAJOR.MINOR Python version number as a string
print("Python Version Number : ", sysconfig.get_python_version())
print()
# returns a tuple containing all path names
print("Path Names : ", sysconfig.get_path_names())
print()
# returns a tuple containing all schemes
print("Scheme Names : ", sysconfig.get_scheme_names())
print()
# returns the value of a single variable name.
print("Variable name LIBDIR : ", sysconfig.get_config_var('LIBDIR'))
# returns the value of a single variable name.
print("Variable name LIBDEST : ", sysconfig.get_config_var('LIBDEST'))
示例3: test_finalize_options
def test_finalize_options(self):
pkg_dir, dist = self.create_dist()
cmd = build(dist)
cmd.finalize_options()
# if not specified, plat_name gets the current platform
self.assertEqual(cmd.plat_name, get_platform())
# build_purelib is build + lib
wanted = os.path.join(cmd.build_base, 'lib')
self.assertEqual(cmd.build_purelib, wanted)
# build_platlib is 'build/lib.platform-x.x[-pydebug]'
# examples:
# build/lib.macosx-10.3-i386-2.7
plat_spec = '.%s-%s' % (cmd.plat_name, sys.version[0:3])
if hasattr(sys, 'gettotalrefcount'):
self.assertTrue(cmd.build_platlib.endswith('-pydebug'))
plat_spec += '-pydebug'
wanted = os.path.join(cmd.build_base, 'lib' + plat_spec)
self.assertEqual(cmd.build_platlib, wanted)
# by default, build_lib = build_purelib
self.assertEqual(cmd.build_lib, cmd.build_purelib)
# build_temp is build/temp.<plat>
wanted = os.path.join(cmd.build_base, 'temp' + plat_spec)
self.assertEqual(cmd.build_temp, wanted)
# build_scripts is build/scripts-x.x
wanted = os.path.join(cmd.build_base, 'scripts-' + sys.version[0:3])
self.assertEqual(cmd.build_scripts, wanted)
# executable is os.path.normpath(sys.executable)
self.assertEqual(cmd.executable, os.path.normpath(sys.executable))
示例4: _find_libpy3_windows
def _find_libpy3_windows(self, env):
'''
Find python3 libraries on Windows and also verify that the arch matches
what we are building for.
'''
pyarch = sysconfig.get_platform()
arch = detect_cpu_family(env.coredata.compilers)
if arch == 'x86':
arch = '32'
elif arch == 'x86_64':
arch = '64'
else:
# We can't cross-compile Python 3 dependencies on Windows yet
mlog.log('Unknown architecture {!r} for'.format(arch),
mlog.bold(self.name))
self.is_found = False
return
# Pyarch ends in '32' or '64'
if arch != pyarch[-2:]:
mlog.log('Need', mlog.bold(self.name),
'for {}-bit, but found {}-bit'.format(arch, pyarch[-2:]))
self.is_found = False
return
inc = sysconfig.get_path('include')
platinc = sysconfig.get_path('platinclude')
self.compile_args = ['-I' + inc]
if inc != platinc:
self.compile_args.append('-I' + platinc)
# Nothing exposes this directly that I coulf find
basedir = sysconfig.get_config_var('base')
vernum = sysconfig.get_config_var('py_version_nodot')
self.link_args = ['-L{}/libs'.format(basedir),
'-lpython{}'.format(vernum)]
self.version = sysconfig.get_config_var('py_version_short')
self.is_found = True
示例5: addbuilddir
def addbuilddir():
from sysconfig import get_platform
s = 'build/lib.%s-%.3s' % (get_platform(), sys.version)
if hasattr(sys, 'gettotalrefcount'):
s += '-pydebug'
s = os.path.join(os.path.dirname(sys.path.pop()), s)
sys.path.append(s)
示例6: __init__
def __init__(self):
from .for_path import get_real_path
if sysconfig.get_platform() == "win-amd64":
self.lib_path = get_real_path("./wwqLyParse64.dll")
else:
self.lib_path = get_real_path("./wwqLyParse32.dll")
self.ffi = None
示例7: target_dir
def target_dir(name):
'''Returns the name of a distutils build directory'''
f = '{dirname}.{platform}-{version[0]}.{version[1]}'
return f.format(dirname=name,
platform=sysconfig.get_platform(),
version=sys.version_info)
示例8: run
def run():
"""
code here mostly borrowed from Python-2.7.3/Lib/site.py
"""
s = "build/temp.%s-%.3s" % (get_platform(), sys.version)
if hasattr(sys, 'gettotalrefcount'):
s += '-pydebug'
print(s)
示例9: distutils_dir_name
def distutils_dir_name(dname):
"""Returns the name of a distutils build directory"""
import sys
import sysconfig
f = "{dirname}.{platform}-{version[0]}.{version[1]}"
return f.format(dirname=dname,
platform=sysconfig.get_platform(),
version=sys.version_info)
示例10: getBuildDirectory
def getBuildDirectory (directory):
name = "{prefix}.{platform}-{version[0]}.{version[1]}".format(
prefix = directory,
platform = sysconfig.get_platform(),
version = sys.version_info
)
return os.path.join(os.getcwd(), "build", name)
示例11: describe_package
def describe_package(self, python):
# Do dummy invoke first to trigger setup requires.
self.log.info("Invoking dummy setup to trigger requirements.")
self.execute(python, ["setup.py", "--version"], capture=True)
rv = self.execute(python, ["setup.py", "--name", "--version", "--fullname"], capture=True).strip().splitlines()
platform = sysconfig.get_platform()
return {"name": rv[0], "version": rv[1], "platform": platform, "ident": rv[2]}
示例12: addbuilddir
def addbuilddir():
"""Append ./build/lib.<platform> in case we're running in the build dir
(especially for Guido :-)"""
from sysconfig import get_platform
s = "build/lib.%s-%.3s" % (get_platform(), sys.version)
if hasattr(sys, 'gettotalrefcount'):
s += '-pydebug'
s = os.path.join(os.path.dirname(sys.path.pop()), s)
sys.path.append(s)
示例13: distutils_dir_name
def distutils_dir_name(dname):
"""Returns the name of a distutils build directory
see: http://stackoverflow.com/questions/14320220/
testing-python-c-libraries-get-build-path
"""
f = "{dirname}.{platform}-{version[0]}.{version[1]}"
return f.format(dirname=dname,
platform=sysconfig.get_platform(),
version=sys.version_info)
示例14: _get_distutils_build_directory
def _get_distutils_build_directory():
"""
Returns the directory distutils uses to build its files.
We need this directory since we build extensions which have to link
other ones.
"""
pattern = "lib.{platform}-{major}.{minor}"
return os.path.join('build', pattern.format(platform=sysconfig.get_platform(),
major=sys.version_info[0],
minor=sys.version_info[1]))
示例15: get_platform
def get_platform():
"""Return a string that identifies the current platform.
By default, will return the value returned by sysconfig.get_platform(),
but it can be changed by calling set_platform().
"""
global _PLATFORM
if _PLATFORM is None:
_PLATFORM = sysconfig.get_platform()
return _PLATFORM