Python distutils.sysconfig 模块,get_python_lib() 实例源码

我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用distutils.sysconfig.get_python_lib()

项目:TACTIC-Handler    作者:listyque    | 项目源码 | 文件源码
def __init__(self, qt_toolkit='pyside'):
        """
        :param qt_toolkit: Toolkit used to generate files: ``'pyside'`` or ``'pyqt'``
        """
        if qt_toolkit.lower() == 'pyside':
            if sys.platform.startswith('win'):
                PYPATH =  os.path.dirname(sys.executable)
                PYSIDEPATH = os.path.join(get_python_lib(), 'PySide')
                self.PYUIC = os.path.join(PYPATH, "Scripts/pyside-uic")
                self.PYRCC = os.path.join(PYSIDEPATH, "pyside-rcc")
            else:
                self.PYUIC = "pyside-uic"
                self.PYRCC = "pyside-rcc"
        else:  # pyqt
            if sys.platform.startswith('win'):
                PYQTPATH = os.path.join(get_python_lib(), 'PyQt4')
                self.PYUIC = os.path.join(PYQTPATH, "pyuic4")
                self.PYRCC = os.path.join(PYQTPATH, "pyrcc4.exe")
            else:
                self.PYUIC = "pyuic4"
                self.PYRCC = "pyrcc4"
项目:scarlett_os    作者:bossjones    | 项目源码 | 文件源码
def add_gstreamer_packages():
    import os
    import sys
    from distutils.sysconfig import get_python_lib

    dest_dir = get_python_lib()

    packages = ['gobject', 'glib', 'pygst', 'pygst.pyc', 'pygst.pth',
                'gst-0.10', 'pygtk.pth', 'pygtk.py', 'pygtk.pyc']

    python_version = sys.version[:3]
    global_path = os.path.join('/usr/lib', 'python' + python_version)
    global_sitepackages = [os.path.join(global_path,
                                        'dist-packages'),  # for Debian-based
                           os.path.join(global_path,
                                        'site-packages')]  # for others

    for package in packages:
        for pack_dir in global_sitepackages:
            src = os.path.join(pack_dir, package)
            dest = os.path.join(dest_dir, package)
            if not os.path.exists(dest) and os.path.exists(src):
                os.symlink(src, dest)
项目:pg_ninja    作者:transferwise    | 项目源码 | 文件源码
def __init__(self):
        """
            Class constructor.
        """
        python_lib=get_python_lib()
        cham_dir = "%s/.pg_ninja" % os.path.expanduser('~') 
        local_config = "%s/config/" % cham_dir 
        local_logs = "%s/logs/" % cham_dir 
        local_pid = "%s/pid/" % cham_dir 
        self.global_config_example = '%s/pg_ninja/config/config-example.yaml' % python_lib
        self.local_config_example = '%s/config-example.yaml' % local_config
        self.global_obfuscation_example = '%s/pg_ninja/config/obfuscation-example.yaml' % python_lib
        self.local_obfuscation_example = '%s/obfuscation-example.yaml' % local_config
        self.conf_dirs=[
            cham_dir, 
            local_config, 
            local_logs, 
            local_pid, 

        ]
项目:python-    作者:secondtonone1    | 项目源码 | 文件源码
def get_stdlib():
        paths = [
            sysconfig.get_python_lib(standard_lib=True),
            sysconfig.get_python_lib(standard_lib=True, plat_specific=True),
        ]
        return set(filter(bool, paths))
项目:python-    作者:secondtonone1    | 项目源码 | 文件源码
def get_path(name):
        if name not in ('platlib', 'purelib'):
            raise ValueError("Name must be purelib or platlib")
        return get_python_lib(name == 'platlib')
项目:python-    作者:secondtonone1    | 项目源码 | 文件源码
def _get_purelib():
        return get_python_lib(False)
项目:my-first-blog    作者:AnkurBegining    | 项目源码 | 文件源码
def get_stdlib():
        paths = [
            sysconfig.get_python_lib(standard_lib=True),
            sysconfig.get_python_lib(standard_lib=True, plat_specific=True),
        ]
        return set(filter(bool, paths))
项目:my-first-blog    作者:AnkurBegining    | 项目源码 | 文件源码
def get_path(name):
        if name not in ('platlib', 'purelib'):
            raise ValueError("Name must be purelib or platlib")
        return get_python_lib(name == 'platlib')
项目:my-first-blog    作者:AnkurBegining    | 项目源码 | 文件源码
def _get_purelib():
        return get_python_lib(False)
项目:Flask_Blog    作者:sugarguo    | 项目源码 | 文件源码
def get_path(name):
        if name not in ('platlib', 'purelib'):
            raise ValueError("Name must be purelib or platlib")
        return get_python_lib(name=='platlib')
项目:Flask_Blog    作者:sugarguo    | 项目源码 | 文件源码
def _get_purelib():
        return get_python_lib(False)
项目:swjtu-pyscraper    作者:Desgard    | 项目源码 | 文件源码
def get_stdlib():
        paths = [
            sysconfig.get_python_lib(standard_lib=True),
            sysconfig.get_python_lib(standard_lib=True, plat_specific=True),
        ]
        return set(filter(bool, paths))
项目:swjtu-pyscraper    作者:Desgard    | 项目源码 | 文件源码
def get_path(name):
        if name not in ('platlib', 'purelib'):
            raise ValueError("Name must be purelib or platlib")
        return get_python_lib(name == 'platlib')
项目:swjtu-pyscraper    作者:Desgard    | 项目源码 | 文件源码
def _get_purelib():
        return get_python_lib(False)
项目:noc-orchestrator    作者:DirceuSilvaLabs    | 项目源码 | 文件源码
def get_stdlib():
        paths = [
            sysconfig.get_python_lib(standard_lib=True),
            sysconfig.get_python_lib(standard_lib=True, plat_specific=True),
        ]
        return set(filter(bool, paths))
项目:noc-orchestrator    作者:DirceuSilvaLabs    | 项目源码 | 文件源码
def get_path(name):
        if name not in ('platlib', 'purelib'):
            raise ValueError("Name must be purelib or platlib")
        return get_python_lib(name=='platlib')
项目:noc-orchestrator    作者:DirceuSilvaLabs    | 项目源码 | 文件源码
def _get_purelib():
        return get_python_lib(False)
项目:noc-orchestrator    作者:DirceuSilvaLabs    | 项目源码 | 文件源码
def get_stdlib():
        paths = [
            sysconfig.get_python_lib(standard_lib=True),
            sysconfig.get_python_lib(standard_lib=True, plat_specific=True),
        ]
        return set(filter(bool, paths))
项目:noc-orchestrator    作者:DirceuSilvaLabs    | 项目源码 | 文件源码
def get_path(name):
        if name not in ('platlib', 'purelib'):
            raise ValueError("Name must be purelib or platlib")
        return get_python_lib(name=='platlib')
项目:noc-orchestrator    作者:DirceuSilvaLabs    | 项目源码 | 文件源码
def get_stdlib():
        paths = [
            sysconfig.get_python_lib(standard_lib=True),
            sysconfig.get_python_lib(standard_lib=True, plat_specific=True),
        ]
        return set(filter(bool, paths))
项目:noc-orchestrator    作者:DirceuSilvaLabs    | 项目源码 | 文件源码
def get_path(name):
        if name not in ('platlib', 'purelib'):
            raise ValueError("Name must be purelib or platlib")
        return get_python_lib(name=='platlib')
项目:noc-orchestrator    作者:DirceuSilvaLabs    | 项目源码 | 文件源码
def _get_purelib():
        return get_python_lib(False)
项目:noc-orchestrator    作者:DirceuSilvaLabs    | 项目源码 | 文件源码
def get_stdlib():
        paths = [
            sysconfig.get_python_lib(standard_lib=True),
            sysconfig.get_python_lib(standard_lib=True, plat_specific=True),
        ]
        return set(filter(bool, paths))
项目:jira_worklog_scanner    作者:pgarneau    | 项目源码 | 文件源码
def get_stdlib():
        paths = [
            sysconfig.get_python_lib(standard_lib=True),
            sysconfig.get_python_lib(standard_lib=True, plat_specific=True),
        ]
        return set(filter(bool, paths))
项目:jira_worklog_scanner    作者:pgarneau    | 项目源码 | 文件源码
def get_path(name):
        if name not in ('platlib', 'purelib'):
            raise ValueError("Name must be purelib or platlib")
        return get_python_lib(name == 'platlib')
项目:jira_worklog_scanner    作者:pgarneau    | 项目源码 | 文件源码
def _get_purelib():
        return get_python_lib(False)
项目:zanph    作者:zanph    | 项目源码 | 文件源码
def get_stdlib():
        paths = [
            sysconfig.get_python_lib(standard_lib=True),
            sysconfig.get_python_lib(standard_lib=True, plat_specific=True),
        ]
        return set(filter(bool, paths))
项目:zanph    作者:zanph    | 项目源码 | 文件源码
def get_path(name):
        if name not in ('platlib', 'purelib'):
            raise ValueError("Name must be purelib or platlib")
        return get_python_lib(name=='platlib')
项目:zanph    作者:zanph    | 项目源码 | 文件源码
def _get_purelib():
        return get_python_lib(False)
项目:hostapd-mana    作者:adde88    | 项目源码 | 文件源码
def get_stdlib():
        paths = [
            sysconfig.get_python_lib(standard_lib=True),
            sysconfig.get_python_lib(standard_lib=True, plat_specific=True),
        ]
        return set(filter(bool, paths))
项目:hostapd-mana    作者:adde88    | 项目源码 | 文件源码
def test_get_python_lib(self):
        lib_dir = sysconfig.get_python_lib()
        # XXX doesn't work on Linux when Python was never installed before
        #self.assertTrue(os.path.isdir(lib_dir), lib_dir)
        # test for pythonxx.lib?
        self.assertNotEqual(sysconfig.get_python_lib(),
                            sysconfig.get_python_lib(prefix=TESTFN))
        _sysconfig = __import__('sysconfig')
        res = sysconfig.get_python_lib(True, True)
        self.assertEqual(_sysconfig.get_path('platstdlib'), res)
项目:ExcelToCode    作者:youlanhai    | 项目源码 | 文件源码
def install(name):
    package_path = xlsconfig.DEPENDENCIES.get(name)
    if package_path is None:
        print "???????????'%s'" % (name, )
        return

    output_path = xlsconfig.TEMP_PATH

    file_name = os.path.splitext(os.path.basename(package_path))[0]
    setup_path = os.path.join(output_path, file_name)
    if os.path.exists(setup_path):
        shutil.rmtree(setup_path, True)

    with ZipFile(package_path, "r") as zf:
        zf.extractall(output_path)

    if not os.path.exists(os.path.join(setup_path, "setup.py")):
        print "????????????'%s/setup.py'" % setup_path
        return False

    old_cwd = os.getcwd()
    os.chdir(setup_path)
    try:
        _install_in_path()
    except:
        os.chdir(old_cwd)
        traceback.print_exc()
        return False

    os.chdir(old_cwd)

    for fname in os.listdir(get_python_lib()):
        if fname.startswith(name):
            return True

    return False
项目:Sci-Finder    作者:snverse    | 项目源码 | 文件源码
def get_stdlib():
        paths = [
            sysconfig.get_python_lib(standard_lib=True),
            sysconfig.get_python_lib(standard_lib=True, plat_specific=True),
        ]
        return set(filter(bool, paths))
项目:Sci-Finder    作者:snverse    | 项目源码 | 文件源码
def get_path(name):
        if name not in ('platlib', 'purelib'):
            raise ValueError("Name must be purelib or platlib")
        return get_python_lib(name == 'platlib')
项目:Sci-Finder    作者:snverse    | 项目源码 | 文件源码
def _get_purelib():
        return get_python_lib(False)
项目:Sci-Finder    作者:snverse    | 项目源码 | 文件源码
def get_stdlib():
        paths = [
            sysconfig.get_python_lib(standard_lib=True),
            sysconfig.get_python_lib(standard_lib=True, plat_specific=True),
        ]
        return set(filter(bool, paths))
项目:Sci-Finder    作者:snverse    | 项目源码 | 文件源码
def get_path(name):
        if name not in ('platlib', 'purelib'):
            raise ValueError("Name must be purelib or platlib")
        return get_python_lib(name == 'platlib')
项目:ascii-art-py    作者:blinglnav    | 项目源码 | 文件源码
def get_stdlib():
        paths = [
            sysconfig.get_python_lib(standard_lib=True),
            sysconfig.get_python_lib(standard_lib=True, plat_specific=True),
        ]
        return set(filter(bool, paths))
项目:ascii-art-py    作者:blinglnav    | 项目源码 | 文件源码
def get_path(name):
        if name not in ('platlib', 'purelib'):
            raise ValueError("Name must be purelib or platlib")
        return get_python_lib(name == 'platlib')
项目:ascii-art-py    作者:blinglnav    | 项目源码 | 文件源码
def _get_purelib():
        return get_python_lib(False)
项目:ivaochdoc    作者:ivaoch    | 项目源码 | 文件源码
def get_stdlib():
        paths = [
            sysconfig.get_python_lib(standard_lib=True),
            sysconfig.get_python_lib(standard_lib=True, plat_specific=True),
        ]
        return set(filter(bool, paths))
项目:ivaochdoc    作者:ivaoch    | 项目源码 | 文件源码
def get_path(name):
        if name not in ('platlib', 'purelib'):
            raise ValueError("Name must be purelib or platlib")
        return get_python_lib(name == 'platlib')
项目:ivaochdoc    作者:ivaoch    | 项目源码 | 文件源码
def _get_purelib():
        return get_python_lib(False)
项目:aws-cfn-plex    作者:lordmuffin    | 项目源码 | 文件源码
def get_stdlib():
        paths = [
            sysconfig.get_python_lib(standard_lib=True),
            sysconfig.get_python_lib(standard_lib=True, plat_specific=True),
        ]
        return set(filter(bool, paths))
项目:aws-cfn-plex    作者:lordmuffin    | 项目源码 | 文件源码
def get_path(name):
        if name not in ('platlib', 'purelib'):
            raise ValueError("Name must be purelib or platlib")
        return get_python_lib(name == 'platlib')
项目:aws-cfn-plex    作者:lordmuffin    | 项目源码 | 文件源码
def _get_purelib():
        return get_python_lib(False)
项目:django    作者:alexsukhrin    | 项目源码 | 文件源码
def get_stdlib():
        paths = [
            sysconfig.get_python_lib(standard_lib=True),
            sysconfig.get_python_lib(standard_lib=True, plat_specific=True),
        ]
        return set(filter(bool, paths))
项目:RPoint    作者:george17-meet    | 项目源码 | 文件源码
def get_stdlib():
        paths = [
            sysconfig.get_python_lib(standard_lib=True),
            sysconfig.get_python_lib(standard_lib=True, plat_specific=True),
        ]
        return set(filter(bool, paths))
项目:RPoint    作者:george17-meet    | 项目源码 | 文件源码
def get_path(name):
        if name not in ('platlib', 'purelib'):
            raise ValueError("Name must be purelib or platlib")
        return get_python_lib(name == 'platlib')
项目:RPoint    作者:george17-meet    | 项目源码 | 文件源码
def _get_purelib():
        return get_python_lib(False)