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

Python sysconfig.get_makefile_filename函数代码示例

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

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



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

示例1: copy_python_framework

def copy_python_framework(info, dst):
    # XXX - In this particular case we know exactly what we can
    #       get away with.. should this be extended to the general
    #       case?  Per-framework recipes?
    indir = os.path.dirname(os.path.join(info["location"], info["name"]))
    outdir = os.path.dirname(os.path.join(dst, info["name"]))
    mkpath(os.path.join(outdir, "Resources"))
    # Since python 3.2, the naming scheme for config files location has considerably
    # complexified. The old, simple way doesn't work anymore. Fortunately, a new module was
    # added to get such paths easily.

    # It's possible that virtualenv is messing with us here, so we only use the rightmost part of
    # each of the two paths below. For pyconfig_path, it's the last 3 elements of the path
    # (include/python3.2m/pyconfig.h) and for makefile_path it's the last 4
    # (lib/python3.2/config-3.2m/Makefile). Yes, this kind of location can change depending on the
    # platform, but we're only supporting Mac OS X eh? We'll take these last path parts and append
    # them to indir and we'll have our non-virtualenv paths.
    pyconfig_path = sysconfig.get_config_h_filename()
    makefile_path = sysconfig.get_makefile_filename()
    pyconfig_path = op.join(*pyconfig_path.split(os.sep)[-3:])
    makefile_path = op.join(*makefile_path.split(os.sep)[-4:])
    assert pyconfig_path.startswith("include")
    assert makefile_path.startswith("lib")

    # distutils looks for some files relative to sys.executable, which
    # means they have to be in the framework...
    mkpath(op.join(outdir, op.dirname(pyconfig_path)))
    mkpath(op.join(outdir, op.dirname(makefile_path)))
    fmwkfiles = [os.path.basename(info["name"]), "Resources/Info.plist", pyconfig_path, makefile_path]
    for fn in fmwkfiles:
        copy_file(os.path.join(indir, fn), os.path.join(outdir, fn))
开发者ID:hsoft,项目名称:pluginbuilder,代码行数:31,代码来源:build_plugin.py


示例2: build_executable

    def build_executable(self, target, copyexts, script):
        # Build an executable for the target
        appdir, resdir, plist = self.create_bundle(target, script)
        self.appdir = appdir
        self.opts.plist = plist

        for src, dest in self.iter_data_files():
            dest = os.path.join(resdir, dest)
            mkpath(os.path.dirname(dest))
            copy_resource(src, dest, dry_run=self.opts.dry_run)

        bootfn = "__boot__"
        bootfile = open(os.path.join(resdir, bootfn + ".py"), "w")
        for fn in target.prescripts:
            bootfile.write(get_bootstrap_data(fn))
            bootfile.write("\n\n")
        bootfile.write("_run(%r)\n" % (os.path.basename(script),))
        bootfile.close()

        copy_file(script, resdir)
        pydir = os.path.join(resdir, "lib", "python" + sys.version[:3])
        mkpath(pydir)
        force_symlink("../../site.py", os.path.join(pydir, "site.py"))
        realcfg = os.path.dirname(sysconfig.get_makefile_filename())
        cfgdir = os.path.join(resdir, os.path.relpath(realcfg, sys.prefix))
        mkpath(cfgdir)
        for fn in "Makefile", "Setup", "Setup.local", "Setup.config":
            rfn = os.path.join(realcfg, fn)
            if os.path.exists(rfn):
                copy_file(rfn, os.path.join(cfgdir, fn))

        # see copy_python_framework() for explanation.
        pyconfig_path = sysconfig.get_config_h_filename()
        pyconfig_path_relative = os.path.relpath(os.path.dirname(pyconfig_path), sys.prefix)
        inc_dir = os.path.join(resdir, pyconfig_path_relative)
        mkpath(inc_dir)
        copy_file(pyconfig_path, os.path.join(inc_dir, "pyconfig.h"))

        copy_tree(self.folders.collect_dir, pydir)

        ext_dir = os.path.join(pydir, os.path.basename(self.folders.ext_dir))
        copy_tree(self.folders.ext_dir, ext_dir, preserve_symlinks=True)
        copy_tree(self.folders.framework_dir, os.path.join(appdir, "Contents", "Frameworks"), preserve_symlinks=True)
        for pkg in self.opts.packages:
            pkg = get_bootstrap(pkg)
            dst = os.path.join(pydir, os.path.basename(pkg))
            mkpath(dst)
            copy_tree(pkg, dst)
        self.copyexts(copyexts, ext_dir)

        target.appdir = appdir
        return appdir
开发者ID:hsoft,项目名称:pluginbuilder,代码行数:52,代码来源:build_plugin.py


示例3: copy_sysconfig_files_for_embed

def copy_sysconfig_files_for_embed(destpath):
    # This normally shouldn't be needed for Python 3.3+.
    makefile = sysconfig.get_makefile_filename()
    configh = sysconfig.get_config_h_filename()
    shutil.copy(makefile, destpath)
    shutil.copy(configh, destpath)
    with open(op.join(destpath, 'site.py'), 'w') as fp:
        fp.write("""
import os.path as op
from distutils import sysconfig
sysconfig.get_makefile_filename = lambda: op.join(op.dirname(__file__), 'Makefile')
sysconfig.get_config_h_filename = lambda: op.join(op.dirname(__file__), 'pyconfig.h')
""")
开发者ID:BrokenSilence,项目名称:dupeguru,代码行数:13,代码来源:build.py


示例4: test_srcdir

    def test_srcdir(self):
        # See Issues #15322, #15364.
        srcdir = sysconfig.get_config_var('srcdir')

        self.assertTrue(os.path.isabs(srcdir), srcdir)
        self.assertTrue(os.path.isdir(srcdir), srcdir)

        if sysconfig._PYTHON_BUILD:
            # The python executable has not been installed so srcdir
            # should be a full source checkout.
            Python_h = os.path.join(srcdir, 'Include', 'Python.h')
            self.assertTrue(os.path.exists(Python_h), Python_h)
            self.assertTrue(sysconfig._is_python_source_dir(srcdir))
        elif os.name == 'posix':
            self.assertEqual(os.path.dirname(sysconfig.get_makefile_filename()),
                                srcdir)
开发者ID:524777134,项目名称:cpython,代码行数:16,代码来源:test_sysconfig.py


示例5: test_srcdir

    def test_srcdir(self):
        # See Issues #15322, #15364.
        srcdir = sysconfig.get_config_var("srcdir")

        self.assertTrue(os.path.isabs(srcdir), srcdir)
        self.assertTrue(os.path.isdir(srcdir), srcdir)

        if sysconfig._PYTHON_BUILD:
            # The python executable has not been installed so srcdir
            # should be a full source checkout.
            Python_h = os.path.join(srcdir, "Include", "Python.h")
            self.assertTrue(os.path.exists(Python_h), Python_h)
            self.assertTrue(sysconfig._is_python_source_dir(srcdir))
        elif os.name == "posix":
            makefile_dir = os.path.dirname(sysconfig.get_makefile_filename())
            # Issue #19340: srcdir has been realpath'ed already
            makefile_dir = os.path.realpath(makefile_dir)
            self.assertEqual(makefile_dir, srcdir)
开发者ID:francois-wellenreiter,项目名称:cpython,代码行数:18,代码来源:test_sysconfig.py


示例6: hasattr

#-----------------------------------------------------------------------------

"""
`distutils`-specific post-import hook.

This hook freezes the external `Makefile` and `pyconfig.h` files bundled with
the active Python interpreter, which the `distutils.sysconfig` module parses at
runtime for platform-specific metadata.
"""

# TODO Verify that bundling Makefile and pyconfig.h is still required for Python 3.

import os
import sysconfig

from PyInstaller.utils.hooks import relpath_to_config_or_make

_CONFIG_H = sysconfig.get_config_h_filename()
if hasattr(sysconfig, 'get_makefile_filename'):
    # sysconfig.get_makefile_filename is missing in Python < 2.7.9
    _MAKEFILE = sysconfig.get_makefile_filename()
else:
    _MAKEFILE = sysconfig._get_makefile_filename()

# Data files in PyInstaller hook format.
datas = [(_CONFIG_H, relpath_to_config_or_make(_CONFIG_H))]

# The Makefile does not exist on all platforms, eg. on Windows
if os.path.exists(_MAKEFILE):
    datas.append((_MAKEFILE, relpath_to_config_or_make(_MAKEFILE)))
开发者ID:pyinstaller,项目名称:pyinstaller,代码行数:30,代码来源:hook-distutils.py


示例7: test_get_makefile_filename

 def test_get_makefile_filename(self):
     makefile = sysconfig.get_makefile_filename()
     self.assertTrue(os.path.isfile(makefile), makefile)
开发者ID:chidea,项目名称:GoPythonDLLWrapper,代码行数:3,代码来源:test_sysconfig.py


示例8: print

# for distributing bootloader.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------


# distutils module requires Makefile and pyconfig.h files from Python
# installation.


import os
import sys
import sysconfig


config_h = sysconfig.get_config_h_filename()
print(('pyconfig.h: ' + config_h))
files = [config_h]


# On Windows Makefile does not exist.
if not sys.platform.startswith('win'):
    makefile = sysconfig.get_makefile_filename()
    print(('Makefile: ' + makefile))
    files.append(makefile)


for f in files:
    if not os.path.exists(f):
        raise SystemExit('File does not exist: %s' % f)
开发者ID:pyinstaller,项目名称:pyinstaller,代码行数:30,代码来源:pyi_python_makefile.py


示例9: test_get_makefile_filename

 def test_get_makefile_filename(self):
     makefile = sysconfig.get_makefile_filename()
     self.assertTrue(os.path.isfile(makefile), makefile)
     # Issue 22199
     self.assertEqual(sysconfig._get_makefile_filename(), makefile)
开发者ID:billtsay,项目名称:win-demo-opcua,代码行数:5,代码来源:test_sysconfig.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python sysconfig.get_path函数代码示例发布时间:2022-05-27
下一篇:
Python sysconfig.get_config_vars函数代码示例发布时间: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