Skip to content

Commit e54af62

Browse files
committed
use explicit python version
1 parent 12ec419 commit e54af62

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

manifests/pyvenv.pp

+9-9
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,19 @@
3636
include ::python
3737

3838
if $ensure == 'present' {
39+
$python_version = $version ? {
40+
'system' => "$::python3_version",
41+
default => "${version}",
42+
}
3943

4044
# Debian splits the venv module into a seperate package
4145
if ( $facts['os']['family'] == 'Debian'){
42-
$python3_venv_package="python${version}-venv"
46+
$python3_venv_package="python${python_version}-venv"
4347
case $facts['os']['distro']['codename'] {
4448
'xenial','bionic','cosmic','disco',
4549
'jessie','stretch','buster': {
50+
notify {"python3_venv_package: $python3_venv_package":
51+
}
4652
package {$python3_venv_package:
4753
before => File[$venv_dir],
4854
}
@@ -53,15 +59,9 @@
5359

5460
# pyvenv is deprecated since 3.6 and will be removed in 3.8
5561
if (versioncmp($::python3_version, '3.6') >=0) {
56-
$virtualenv_cmd = $version ? {
57-
'system' => "${python::exec_prefix}python3 -m venv",
58-
default => "${python::exec_prefix}python${version} -m venv",
59-
}
62+
$virtualenv_cmd = "${python::exec_prefix}python${python_version} -m venv"
6063
} else {
61-
$virtualenv_cmd = $version ? {
62-
'system' => "${python::exec_prefix}pyvenv",
63-
default => "${python::exec_prefix}pyvenv-${version}",
64-
}
64+
$virtualenv_cmd = "${python::exec_prefix}pyvenv-${python_version}"
6565
}
6666

6767
$_path = $::python::provider ? {

0 commit comments

Comments
 (0)