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


Python site.main函数代码示例

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


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

示例1: run

    def run(self):
        _myinstall('pytest>2.3')
        if self.distribution.install_requires:
            for ir in self.distribution.install_requires:
                _myinstall(ir)

        # reload sys.path for any new libraries installed
        import site
        site.main()
        print sys.path
        # use pytest to run tests
        pytest = __import__('pytest')
        pytest.main(['-s', 'src'])
开发者ID:trec-kba,项目名称:streamcorpus-factorie,代码行数:13,代码来源:setup.py

示例2: addSysPythonPath

def addSysPythonPath():
    import appinfo
    import os

    def addpath(p):
        try:
            p = os.path.normpath(p)
            p = os.path.abspath(p)
        except OSError:
            return
        if not os.path.exists(p):
            return
        if p not in sys.path:
            sys.path += [p]

    paths = os.environ.get("PYTHONPATH", "").split(":")
    for p in paths:
        addpath(p.strip())

    versionStr = ".".join(map(str, sys.version_info[0:2]))

    if sys.platform == "darwin":
        addpath(
            "/usr/local/Frameworks/Python.framework/Versions/%s/lib/python%s/lib-dynload/" % (versionStr, versionStr)
        )
        addpath("/System/Frameworks/Python.framework/Versions/%s/lib/python%s/lib-dynload/" % (versionStr, versionStr))

        # This will add other custom paths, e.g. for eggs.
    import site

    site.main()

    def addsitedir(d):
        try:
            d = os.path.normpath(d)
            d = os.path.abspath(d)
        except OSError:
            return
        if os.path.exists(d):
            site.addsitedir(d)

            # We still might miss some site-dirs.

    addsitedir("/usr/local/lib/python%s/site-packages" % versionStr)
    addsitedir("/usr/lib/python%s/site-packages" % versionStr)
    if sys.platform == "darwin":
        addsitedir("/Library/Python/%s/site-packages" % versionStr)

    if not appinfo.args.forkExecProc:
        print("Python paths after: %r" % sys.path)
开发者ID:BMXE,项目名称:music-player,代码行数:50,代码来源:debug.py

示例3: run

 def run(self):
     # ensure that pytest is installed
     _myinstall('pytest>=2.3')
     # and everything else we'd need. setuptools tests_require is dumb because it copies locally instead of installing to system, and install_requires isn't used untill install (but maybe someone wants to run the test before they install).
     for pkgspec in install_requires:
         _myinstall(pkgspec)
     print sys.path
     # reload sys.path for any new libraries installed
     import site
     site.main()
     print sys.path
     # use pytest to run tests
     pytest = __import__('pytest')
     if pytest.main(['-s', 'src']):
         sys.exit(1)
开发者ID:stephanie-wang,项目名称:streamcorpus,代码行数:15,代码来源:setup.py

示例4: run

    def run(self):
        if self.distribution.install_requires:
            for ir in self.distribution.install_requires:
                _myinstall(ir)
        if self.distribution.tests_require:
            for ir in self.distribution.tests_require:
                _myinstall(ir)

        # reload sys.path for any new libraries installed
        import site
        site.main()
        print sys.path
        pytest = __import__('pytest')
        if pytest.main(['-n', '3', '-vvs', 'poly_test/tests']):
            sys.exit(1)
开发者ID:diffeo,项目名称:poly-open,代码行数:15,代码来源:setup.py

示例5: run

    def run(self):
        if self.distribution.install_requires:
            for ir in self.distribution.install_requires:
                _myinstall(ir)
        if self.distribution.tests_require:
            for ir in self.distribution.tests_require:
                _myinstall(ir)

        # reload sys.path for any new libraries installed
        import site
        site.main()
        print sys.path
        # use pytest to run tests
        pytest = __import__('pytest')
        if pytest.main(['-n', '8', '-s', 'dblogger', '--runperf', '--runslow']):
            sys.exit(1)
开发者ID:diffeo,项目名称:dblogger,代码行数:16,代码来源:setup.py

示例6: get_venv_handler

def get_venv_handler():
    log('Activating venv with executable at %s\n' % activate_this)
    import site
    sys.executable = activate_this
    old_sys_path, sys.path = sys.path, []

    site.main()

    sys.path.insert(0, '')
    for item in old_sys_path:
        if item not in sys.path:
            sys.path.append(item)

    log('Getting handler %s\n' % os.getenv('WSGI_ALT_VIRTUALENV_HANDLER'))
    handler = get_wsgi_handler(os.getenv('WSGI_ALT_VIRTUALENV_HANDLER'))
    log('Got handler: %r\n' % handler)
    return handler
开发者ID:jonomarx,项目名称:Marxchat,代码行数:17,代码来源:ptvs_virtualenv_proxy.py

示例7: run

    def run(self):
        cmd = ['pip', 'install']
        if self.distribution.install_requires:
            cmd.extend(self.distribution.install_requires)
        if self.distribution.tests_require:
            cmd.extend(self.distribution.tests_require)
        errno = subprocess.call(cmd)
        if errno:
            raise SystemExit(errno)

        # reload sys.path for any new libraries installed
        import site
        site.main()
        print sys.path
        # use pytest to run tests
        pytest = __import__('pytest')
        exitcode = pytest.main(['--cov', 'pyaccumulo', '--cov-report', 'term', '-vvs', 'tests'])
        sys.exit(exitcode)
开发者ID:TITAN1287,项目名称:pyaccumulo,代码行数:18,代码来源:setup.py

示例8: RuntimeError

# 
# See the Apache Version 2.0 License for specific language governing
# permissions and limitations under the License.

__author__ = "Microsoft Corporation <[email protected]>"
__version__ = "3.2"

import sys

if 'site' in sys.modules:
    raise RuntimeError('script must be run with -S')

BEFORE_SITE = list(sys.path)
import site
try:
    site.main()
except:
    import traceback
    traceback.print_exc(file=sys.stderr)
AFTER_SITE = list(sys.path)

import os
def clean(path):
    if path:
        return os.path.normcase(os.path.abspath(path).rstrip('/\\'))
    return None

BEFORE_SITE = set(clean(p) for p in BEFORE_SITE)
AFTER_SITE = set(clean(p) for p in AFTER_SITE)

for prefix in [
开发者ID:amos402,项目名称:PTVS,代码行数:31,代码来源:get_search_paths.py

示例9:

#!/usr/bin/python -S
# Automatically generated on Sun Mar  1 16:17:32 2015

'''Runs a specific user program'''


import sys
sys.path[0:0] = [
  '/home/dingz/bob.spear-1.1.8/eggs/gridtk-1.2.0-py2.7.egg',
  '/home/dingz/bob.spear-1.1.8/eggs/six-1.9.0-py2.7.egg',
  '/home/dingz/bob.spear-1.1.8',
  '/home/dingz/bob.spear-1.1.8/eggs/xbob.sox-1.1.0-py2.7-linux-x86_64.egg',
  '/home/dingz/bob.spear-1.1.8/eggs/xbob.db.voxforge-0.1.0-py2.7.egg',
  '/home/dingz/bob.spear-1.1.8/eggs/xbob.db.verification.filelist-1.3.5-py2.7.egg',
  '/home/dingz/bob.spear-1.1.8/eggs/facereclib-1.2.3-py2.7.egg',
  '/home/dingz/bob.spear-1.1.8/eggs/xbob.db.verification.utils-1.0.1-py2.7.egg',
  '/home/dingz/bob.spear-1.1.8/eggs/xbob.db.atnt-1.1.2-py2.7.egg',
  ]
import site #initializes site properly
site.main() #this is required for python>=3.4
import pkg_resources #initializes virtualenvs properly

import spear.script.spkverif_jfa

if __name__ == '__main__':
    sys.exit(spear.script.spkverif_jfa.main())
开发者ID:LollipopLollipop,项目名称:AttendanceSystem,代码行数:26,代码来源:spkverif_jfa.py


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