File tree 3 files changed +19
-3
lines changed
3 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -904,6 +904,7 @@ The following parameters are available in the `python::pyvenv` defined type:
904
904
* [ ` path ` ] ( #-python--pyvenv--path )
905
905
* [ ` environment ` ] ( #-python--pyvenv--environment )
906
906
* [ ` prompt ` ] ( #-python--pyvenv--prompt )
907
+ * [ ` index ` ] ( #-python--pyvenv--index )
907
908
* [ ` pip_version ` ] ( #-python--pyvenv--pip_version )
908
909
909
910
##### <a name =" -python--pyvenv--ensure " ></a >` ensure `
@@ -986,6 +987,14 @@ Optionally specify the virtualenv prompt (python >= 3.6)
986
987
987
988
Default value: ` undef `
988
989
990
+ ##### <a name =" -python--pyvenv--index " ></a >` index `
991
+
992
+ Data type: ` Optional[String[1]] `
993
+
994
+ Optionally specify an index location from where pip and setuptools should be installed
995
+
996
+ Default value: ` undef `
997
+
989
998
##### <a name =" -python--pyvenv--pip_version " ></a >` pip_version `
990
999
991
1000
Data type: ` Python::Venv::PipVersion `
Original file line number Diff line number Diff line change 11
11
# @param path Specifies the PATH variable.
12
12
# @param environment Optionally specify environment variables for pyvenv
13
13
# @param prompt Optionally specify the virtualenv prompt (python >= 3.6)
14
+ # @param index Optionally specify an index location from where pip and setuptools should be installed
14
15
#
15
16
# @example
16
17
# python::pyvenv { '/var/www/project1' :
34
35
Array $environment = [],
35
36
Optional[String[1]] $prompt = undef ,
36
37
Python::Venv::PipVersion $pip_version = ' latest' ,
38
+ Optional[String[1]] $index = undef ,
37
39
) {
38
40
include python
39
41
80
82
81
83
$pip_cmd = " ${python::exec_prefix}${venv_dir} /bin/pip"
82
84
85
+ $index_config = $index ? {
86
+ undef => ' ' ,
87
+ default => " -i ${index} "
88
+ }
89
+
83
90
$pip_upgrade = ($pip_version != ' latest' ) ? {
84
91
true => " --upgrade 'pip ${pip_version} '" ,
85
92
false => ' --upgrade pip' ,
86
93
}
87
94
88
95
exec { "python_virtualenv_${venv_dir}" :
89
- command => " ${virtualenv_cmd} --clear ${system_pkgs_flag} ${prompt_arg} ${venv_dir} && ${pip_cmd} --log ${venv_dir} /pip.log install ${pip_upgrade} && ${pip_cmd} --log ${venv_dir} /pip.log install --upgrade setuptools" ,
96
+ command => " ${virtualenv_cmd} --clear ${system_pkgs_flag} ${prompt_arg} ${venv_dir} && ${pip_cmd} --log ${venv_dir} /pip.log install ${index_config} ${ pip_upgrade} && ${pip_cmd} --log ${venv_dir} /pip.log install ${index_config} --upgrade setuptools" ,
90
97
user => $owner ,
91
98
creates => " ${venv_dir} /bin/activate" ,
92
99
path => $_path,
Original file line number Diff line number Diff line change 155
155
it {
156
156
expect ( subject ) . to contain_exec ( 'python_virtualenv_/opt/env1' ) .
157
157
with (
158
- command : 'python3.8 -m venv --clear /opt/env1 && /opt/env1/bin/pip --log /opt/env1/pip.log install --upgrade pip && /opt/env1/bin/pip --log /opt/env1/pip.log install --upgrade setuptools' ,
158
+ command : 'python3.8 -m venv --clear /opt/env1 && /opt/env1/bin/pip --log /opt/env1/pip.log install --upgrade pip && /opt/env1/bin/pip --log /opt/env1/pip.log install --upgrade setuptools' ,
159
159
user : 'root' ,
160
160
creates : '/opt/env1/bin/activate' ,
161
161
path : [
175
175
it {
176
176
expect ( subject ) . to contain_exec ( 'python_virtualenv_/opt/env2' ) .
177
177
with (
178
- command : 'python3.8 -m venv --clear /opt/env2 && /opt/env2/bin/pip --log /opt/env2/pip.log install --upgrade \'pip <= 20.3.4\' && /opt/env2/bin/pip --log /opt/env2/pip.log install --upgrade setuptools' ,
178
+ command : 'python3.8 -m venv --clear /opt/env2 && /opt/env2/bin/pip --log /opt/env2/pip.log install --upgrade \'pip <= 20.3.4\' && /opt/env2/bin/pip --log /opt/env2/pip.log install --upgrade setuptools' ,
179
179
user : 'root' ,
180
180
creates : '/opt/env2/bin/activate' ,
181
181
path : [
You can’t perform that action at this time.
0 commit comments