Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework determination of virtualenv site-packages flags for v20 #578

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 17 additions & 14 deletions manifests/virtualenv.pp
Original file line number Diff line number Diff line change
Expand Up @@ -86,24 +86,27 @@
}
}

# Virtualenv versions prior to 1.7 do not support the
# --system-site-packages flag, default off for prior versions
# Prior to version 1.7 the default was equal to --system-site-packages
# and the flag --no-site-packages had to be passed to do the opposite
# Virtualenv handling of site packages has changed over time, both its
# default and the flags to control it. See inline comments for details.
$_virtualenv_version = getvar('virtualenv_version') ? {
/.*/ => getvar('virtualenv_version'),
default => '',
}
if (( versioncmp($_virtualenv_version,'1.7') > 0 ) and ( $systempkgs == true )) {
$system_pkgs_flag = '--system-site-packages'
} elsif (( versioncmp($_virtualenv_version,'1.7') < 0 ) and ( $systempkgs == false )) {
$system_pkgs_flag = '--no-site-packages'
} else {
$system_pkgs_flag = $systempkgs ? {
true => '--system-site-packages',
false => '--no-site-packages',
default => fail('Invalid value for systempkgs. Boolean value is expected')
}
$system_pkgs_flag = $systempkgs ? {
# --system-site-packages was introducd in 1.7, and --no-site-packages
# became the default
true => versioncmp($_virtualenv_version,'1.7') > 0 ? {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: I thiiink that this should probably be >=, however I believe the current spelling has the same error.

true => '--system-site-packages',
# Rely on default prior to 1.7
false => '',
},
# --no-site-packages was removed in 20.0
false => versioncmp($_virtualenv_version,'20') < 0 ? {
true => '--no-site-packages',
# Rely on default after 20.0
false => '',
},
default => fail('Invalid value for systempkgs. Boolean value is expected')
}

$distribute_pkg = $distribute ? {
Expand Down