salt.modules.virtualenv

Create virtualenv environments.

0.17.0 新版功能.

salt.modules.virtualenv_mod.create(path, venv_bin=None, system_site_packages=False, distribute=False, clear=False, python=None, extra_search_dir=None, never_download=None, prompt=None, pip=False, symlinks=None, upgrade=None, user=None, use_vt=False, saltenv='base')

Create a virtualenv

path
The path to the virtualenv to be created
venv_bin
The name (and optionally path) of the virtualenv command. This can also be set globally in the minion config file as virtualenv.venv_bin. Defaults to virtualenv.
system_site_packages : False
Passthrough argument given to virtualenv or pyvenv
distribute : False
Passthrough argument given to virtualenv
pip : False
Install pip after creating a virtual environment. Implies distribute=True
clear : False
Passthrough argument given to virtualenv or pyvenv
python : None (default)
Passthrough argument given to virtualenv
extra_search_dir : None (default)
Passthrough argument given to virtualenv
never_download : None (default)
Passthrough argument given to virtualenv if True
prompt : None (default)
Passthrough argument given to virtualenv if not None
symlinks : None
Passthrough argument given to pyvenv if True
upgrade : None
Passthrough argument given to pyvenv if True
user : None
Set ownership for the virtualenv
runas : None

Set ownership for the virtualenv

2014.1.0 版后已移除: user should be used instead

use_vt : False

Use VT terminal emulation (see output while installing)

2015.5.0 新版功能.

saltenv : 'base'

Specify a different environment. The default environment is base.

2014.1.0 新版功能.

注解

The runas argument is deprecated as of 2014.1.0. user should be used instead.

CLI 范例:

salt '*' virtualenv.create /path/to/new/virtualenv
salt.modules.virtualenv_mod.get_distribution_path(venv, distribution)

Return the path to a distribution installed inside a virtualenv

2016.3.0 新版功能.

venv
Path to the virtualenv.
distribution
Name of the distribution. Note, all non-alphanumeric characters will be converted to dashes.

CLI 范例:

salt '*' virtualenv.get_distribution_path /path/to/my/venv my_distribution
salt.modules.virtualenv_mod.get_resource_content(venv, package_or_requirement=None, resource_name=None, package=None, resource=None)

Return the content of a package resource installed inside a virtualenv

venv
Path to the virtualenv
package

Name of the package in which the resource resides

2016.3.0 新版功能.

package_or_requirement

Name of the package in which the resource resides

Nitrogen 版后已移除: Use package instead.

resource

Name of the resource of which the content is to be returned

2016.3.0 新版功能.

resource_name

Name of the resource of which the content is to be returned

Nitrogen 版后已移除.

2015.5.0 新版功能.

venv
Path to the virtualenv.
package_or_requirement
Name of the package where the resource resides in.
resource_name
Name of the resource of which the content is to be returned.

CLI 范例:

salt '*' virtualenv.get_resource_content /path/to/my/venv my_package my/resource.xml
salt.modules.virtualenv_mod.get_resource_path(venv, package_or_requirement=None, resource_name=None, package=None, resource=None)

Return the path to a package resource installed inside a virtualenv

venv
Path to the virtualenv
package

Name of the package in which the resource resides

2016.3.0 新版功能.

package_or_requirement

Name of the package in which the resource resides

Nitrogen 版后已移除: Use package instead.

resource

Name of the resource of which the path is to be returned

2016.3.0 新版功能.

resource_name

Name of the resource of which the path is to be returned

Nitrogen 版后已移除.

2015.5.0 新版功能.

venv
Path to the virtualenv.
package_or_requirement
Name of the package where the resource resides in.
resource_name
Name of the resource of which the path is to be returned.

CLI 范例:

salt '*' virtualenv.get_resource_path /path/to/my/venv my_package my/resource.xml
salt.modules.virtualenv_mod.get_site_packages(venv)

Return the path to the site-packages directory of a virtualenv

venv
Path to the virtualenv.

CLI 范例:

salt '*' virtualenv.get_site_packages /path/to/my/venv