当前位置: 首页>>代码示例>>Python>>正文


Python sysconfig.get_platform函数代码示例

本文整理汇总了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
        ]
开发者ID:GNOME,项目名称:meld,代码行数:30,代码来源:setup_win32.py

示例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'))
开发者ID:mcclayac,项目名称:LearnSmart1,代码行数:29,代码来源:sysconfigExample.py

示例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))
开发者ID:irslambouf,项目名称:SyncServer,代码行数:35,代码来源:test_command_build.py

示例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
开发者ID:pombredanne,项目名称:meson,代码行数:35,代码来源:misc.py

示例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)
开发者ID:Pluckyduck,项目名称:eve,代码行数:7,代码来源:site.py

示例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
开发者ID:wwqgtxx,项目名称:wwqLyParse,代码行数:7,代码来源:lib_wwqLyParse.py

示例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)
开发者ID:liuy0813,项目名称:PyGnome,代码行数:7,代码来源:setup.py

示例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)
开发者ID:nwilson5,项目名称:python-cityhash,代码行数:8,代码来源:get_build_dir.py

示例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)
开发者ID:goldmanm,项目名称:pyJac,代码行数:8,代码来源:pywrap_gen.py

示例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)
开发者ID:junwuwei,项目名称:brltty,代码行数:8,代码来源:apitest.py

示例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]}
开发者ID:ydaniv,项目名称:platter,代码行数:8,代码来源:platter.py

示例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)
开发者ID:321boom,项目名称:The-Powder-Toy,代码行数:9,代码来源:site.py

示例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)
开发者ID:bayolau,项目名称:pysam,代码行数:9,代码来源:setup.py

示例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]))
开发者ID:rlugojr,项目名称:turbodbc,代码行数:10,代码来源:setup.py

示例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
开发者ID:Naddiseo,项目名称:cpython,代码行数:10,代码来源:util.py


注:本文中的sysconfig.get_platform函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。