Skip to content

Commit 72c34fa

Browse files
committed
pyvenv is deprecated
"python3 -m venv" is the recommended replacement since 3.6 pyvenv will be removed in 3.8 Debian (+Ubuntu) need an extra package for the script and the _not deprecated_ python module
1 parent 995ca4e commit 72c34fa

File tree

1 file changed

+25
-3
lines changed

1 file changed

+25
-3
lines changed

manifests/pyvenv.pp

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,31 @@
3737

3838
if $ensure == 'present' {
3939

40-
$virtualenv_cmd = $version ? {
41-
'system' => "${python::exec_prefix}pyvenv",
42-
default => "${python::exec_prefix}pyvenv-${version}",
40+
# Debian splits the venv module into a seperate package
41+
if ( $facts['os']['family'] == 'Debian'){
42+
$python3_venv_package="python${version}-venv"
43+
case $facts['os']['distro']['codename'] {
44+
'xenial','bionic','cosmic','disco',
45+
'jessie','stretch','buster': {
46+
package {$python3_venv_package:
47+
before => File[$venv_dir],
48+
}
49+
}
50+
default: {}
51+
}
52+
}
53+
54+
# pyvenv is deprecated since 3.6 and will be removed in 3.8
55+
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+
}
60+
} else {
61+
$virtualenv_cmd = $version ? {
62+
'system' => "${python::exec_prefix}pyvenv",
63+
default => "${python::exec_prefix}pyvenv-${version}",
64+
}
4365
}
4466

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

0 commit comments

Comments
 (0)