當前位置: 首頁>>代碼示例>>Python>>正文


Python virtualenv.create_environment方法代碼示例

本文整理匯總了Python中virtualenv.create_environment方法的典型用法代碼示例。如果您正苦於以下問題:Python virtualenv.create_environment方法的具體用法?Python virtualenv.create_environment怎麽用?Python virtualenv.create_environment使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在virtualenv的用法示例。


在下文中一共展示了virtualenv.create_environment方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: _handle_install

# 需要導入模塊: import virtualenv [as 別名]
# 或者: from virtualenv import create_environment [as 別名]
def _handle_install(args, dependencies):
    if args.install and dependencies:
        if pip is None:
            raise ImportError("Bootstrapping Pulsar dependencies requires pip library.")

        pip.main(["install"] + dependencies)


# def _install_pulsar_in_virtualenv(venv):
#     if virtualenv is None:
#         raise ImportError("Bootstrapping Pulsar into a virtual environment, requires virtualenv.")
#     if IS_WINDOWS:
#         bin_dir = "Scripts"
#     else:
#         bin_dir = "bin"
#     virtualenv.create_environment(venv)
#     # TODO: Remove --pre on release.
#     subprocess.call([os.path.join(venv, bin_dir, 'pip'), 'install', "--pre", "pulsar-app"]) 
開發者ID:galaxyproject,項目名稱:pulsar,代碼行數:20,代碼來源:config.py

示例2: _install_virtualenv

# 需要導入模塊: import virtualenv [as 別名]
# 或者: from virtualenv import create_environment [as 別名]
def _install_virtualenv(path):
    from hashlib import sha256
    from .downloader import download

    log.info('Downloading virtualenv from %r ...', VIRTUALENV_URL)
    data = download(VIRTUALENV_URL).read()
    assert sha256(data).hexdigest() == HASH, 'hash error... MITM?'

    import tempfile

    with tempfile.NamedTemporaryFile('wb', suffix=".zip", delete=False) as zf:
        zf.write(data)
        zf.flush()
        sys.path.insert(0, zf.name)
        import virtualenv

        with FixInterpreter():
            log.info('Creating environment using virtualenv...')
            virtualenv.create_environment(path, site_packages=True)
            log.info('Done!') 
開發者ID:Jinmo,項目名稱:idapkg,代碼行數:22,代碼來源:virtualenv_utils.py

示例3: _setUp

# 需要導入模塊: import virtualenv [as 別名]
# 或者: from virtualenv import create_environment [as 別名]
def _setUp(self):
        path = self.useFixture(fixtures.TempDir()).path
        virtualenv.create_environment(path, clear=True)
        python = os.path.join(path, 'bin', 'python')
        command = [python] + self.pip_cmd + ['-U']
        if self.modules and len(self.modules) > 0:
            command.extend(self.modules)
            self.useFixture(base.CapturedSubprocess(
                'mkvenv-' + self._reason, command))
        self.addCleanup(delattr, self, 'path')
        self.addCleanup(delattr, self, 'python')
        self.path = path
        self.python = python
        return path, python 
開發者ID:abhisuri97,項目名稱:auto-alt-text-lambda-api,代碼行數:16,代碼來源:test_packaging.py

示例4: make_venv

# 需要導入模塊: import virtualenv [as 別名]
# 或者: from virtualenv import create_environment [as 別名]
def make_venv(self, directory):  # pragma: no cover
        import virtualenv
        from virtualenv import Logger
        logger = Logger([(Logger.level_for_integer(2), sys.stdout)])
        virtualenv.logger = logger
        virtualenv.create_environment(directory,
                                      site_packages=False,
                                      clear=False,
                                      unzip_setuptools=True) 
開發者ID:ramses-tech,項目名稱:nefertari,代碼行數:11,代碼來源:scaffold_test.py

示例5: venv

# 需要導入模塊: import virtualenv [as 別名]
# 或者: from virtualenv import create_environment [as 別名]
def venv(tmpdir, isolate):
    """
    Return a virtual environment which is unique to each test function
    invocation created inside of a sub directory of the test function's
    temporary directory.
    """
    venv_location = os.path.join(str(tmpdir), "workspace", "venv")
    venv = virtualenv.create_environment(venv_location)

    os.environ["PIPAPI_PYTHON_LOCATION"] = os.path.join(venv_location, "bin", "python")

    yield venv

    del os.environ["PIPAPI_PYTHON_LOCATION"]
    shutil.rmtree(venv_location) 
開發者ID:di,項目名稱:pip-api,代碼行數:17,代碼來源:conftest.py

示例6: test_execute_virtualenv_wrappers

# 需要導入模塊: import virtualenv [as 別名]
# 或者: from virtualenv import create_environment [as 別名]
def test_execute_virtualenv_wrappers(tmpdir, monkeypatch):
    import virtualenv

    # monkey patch the current dir to make sure we convert the relative paths
    # passed as arguments to absolute
    monkeypatch.chdir(tmpdir)
    virtualenv.create_environment(
        "virtual envs/test", no_setuptools=True, no_pip=True, no_wheel=True
    )

    if sys.platform != "win32":
        bin_dir = "virtual envs/test/bin"
    else:
        bin_dir = "virtual envs/test/Scripts"

    create_wrappers._main(
        [
            "-t",
            "virtualenv",
            "--virtual-env-dir",
            "virtual envs/test",
            "--bin-dir",
            bin_dir,
            "--dest-dir",
            "wrappers",
        ]
    )

    environ_from_activate = _environ_from_activate(
        _activate_virtualenv_script(), tmpdir
    )
    # Remove some variables we don't care
    if sys.platform != "win32":
        environ_from_activate.pop("PS1", None)
        environ_from_activate.pop("SHLVL")
    else:
        environ_from_activate.pop("_OLD_VIRTUAL_PATH")
        environ_from_activate.pop("_OLD_VIRTUAL_PROMPT")
        environ_from_activate.pop("PROMPT")
        environ_from_activate["PATH"] = os.path.normcase(environ_from_activate["PATH"])
        environ_from_activate["VIRTUAL_ENV"] = os.path.normcase(
            environ_from_activate["VIRTUAL_ENV"]
        )

    environ_from_wrapper = _environ_from_wrapper()
    if sys.platform != "win32":
        environ_from_wrapper.pop("SHLVL")
    else:
        environ_from_wrapper.pop("PROMPT")
        environ_from_wrapper["PATH"] = os.path.normcase(environ_from_wrapper["PATH"])
        environ_from_wrapper["VIRTUAL_ENV"] = os.path.normcase(
            environ_from_wrapper["VIRTUAL_ENV"]
        )

    assert environ_from_activate == environ_from_wrapper 
開發者ID:gqmelo,項目名稱:exec-wrappers,代碼行數:57,代碼來源:test_integration.py


注:本文中的virtualenv.create_environment方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。