• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python sysconfig.get_platform函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中sysconfig.get_platform函数的典型用法代码示例。如果您正苦于以下问题:Python get_platform函数的具体用法?Python get_platform怎么用?Python get_platform使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了get_platform函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: init_lib

def init_lib():
    global lib_wwqLyParse
    if sysconfig.get_platform() == "win-amd64":
        lib_wwqLyParse = ctypes.cdll.LoadLibrary(get_real_path("./wwqLyParse64.dll"))
    else:
        lib_wwqLyParse = ctypes.cdll.LoadLibrary(get_real_path("./wwqLyParse32.dll"))
    lib_wwqLyParse.parse.argtypes = [ctypes.c_char_p, ctypes.c_int,
                                     ctypes.POINTER(ctypes.POINTER(ctypes.c_char)),
                                     ctypes.POINTER(ctypes.c_int)]
    lib_wwqLyParse.get_uuid.restype = ctypes.c_char_p
    lib_wwqLyParse.get_name.restype = ctypes.c_char_p
    logging.debug("successful load lib_wwqLyParse %s" % lib_wwqLyParse)
开发者ID:erics8,项目名称:wwqLyParse,代码行数:12,代码来源:lib_wwqLyParse.py


示例17: loadLibrary

def loadLibrary(directory, name):
    platform = sysconfig.get_platform()

    if platform == "win32":
        pattern = name + "-*.dll"

        import fnmatch

        names = [name for name in os.listdir(directory) if fnmatch.fnmatch(name, pattern)]

        return ctypes.WinDLL(os.path.join(directory, names[0]))

    return ctypes.CDLL(os.path.join(directory, ("lib" + name + ".so")))
开发者ID:plundblad,项目名称:brltty,代码行数:13,代码来源:apitest.py


示例18: configuration

def configuration(parent_package='', top_path=None):
    """Configure all packages that need to be built."""
    config = Configuration('', parent_package, top_path)

    F95FLAGS = get_compiler_flags()

    kwargs = {}
    kwargs['extra_compile_args'] = F95FLAGS
    kwargs['f2py_options'] = ['--quiet']

    # numpy.distutils.fcompiler.FCompiler doesn't support .F95 extension
    compiler = FCompiler(get_default_fcompiler())
    compiler.src_extensions.append('.F95')
    compiler.language_map['.F95'] = 'f90'

    # collect all Fortran sources
    files = os.listdir('src')
    exclude_sources = ['PlanetsConstants.f95', 'PythonWrapper.f95']
    sources = [os.path.join('src', file) for file in files if
               file.lower().endswith('.f95') and file not in exclude_sources]

    # (from http://stackoverflow.com/questions/14320220/
    #              testing-python-c-libraries-get-build-path)):
    build_lib_dir = "{dirname}.{platform}-{version[0]}.{version[1]}"
    dirparams = {'dirname': 'temp',
                 'platform': sysconfig.get_platform(),
                 'version': sys.version_info}
    libdir = os.path.join('build', build_lib_dir.format(**dirparams))
    print('searching SHTOOLS in:', libdir)

    # Fortran compilation
    config.add_library('SHTOOLS',
                       sources=sources,
                       **kwargs)

    # SHTOOLS
    config.add_extension('pyshtools._SHTOOLS',
                         include_dirs=[libdir],
                         library_dirs=[libdir],
                         libraries=['SHTOOLS', 'fftw3', 'm', 'lapack', 'blas'],
                         sources=['src/pyshtools.pyf',
                                  'src/PythonWrapper.f95'],
                         **kwargs)

    # constants
    config.add_extension('pyshtools._constant',
                         sources=['src/PlanetsConstants.f95'],
                         **kwargs)

    return config
开发者ID:QuLogic,项目名称:SHTOOLS,代码行数:50,代码来源:setup.py


示例19: 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:RR2DO2,项目名称:platter,代码行数:15,代码来源:platter.py


示例20: _run

 async def _run(self, arg, need_stderr=False, use_hps=True):
     if sysconfig.get_platform() == "win-amd64":
         annie_bin = get_real_path('./annie/annie64.exe')
     else:
         annie_bin = get_real_path('./annie/annie32.exe')
     if use_hps:
         async with AsyncHttpProxyServer() as hps:
             args = [annie_bin]
             args += ['-x', "http://localhost:%s" % hps.port]
             args += arg
             return await async_run_subprocess(args, asyncio.get_left_time() - 0.1, need_stderr)
     else:
         args = [annie_bin]
         args += arg
         return await async_run_subprocess(args, asyncio.get_left_time() - 0.1, need_stderr)
开发者ID:wwqgtxx,项目名称:wwqLyParse,代码行数:15,代码来源:annieparser.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python sysconfig.get_python_version函数代码示例发布时间:2022-05-27
下一篇:
Python sysconfig.get_paths函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap