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

Addressing stankevich/puppet-python issue #258. #260

Merged
merged 1 commit into from
Nov 9, 2015
Merged
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
20 changes: 12 additions & 8 deletions manifests/pip.pp
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,18 @@
# Boolean. If true the package is installed as an editable resource.
#
# [*environment*]
# Additional environment variables required to install the packages. Default: none
# Additional environment variables required to install the packages.
# Default: none
#
# [*timeout*]
# The maximum time in seconds the "pip install" command should take. Default: 1800
# The maximum time in seconds the "pip install" command should take.
# Default: 1800
#
# [*install_args*]
# String. Any additional installation arguments that will be supplied
# when running pip install.
#
# [*uninstall_args*]
# [*uninstall args*]
# String. Any additional arguments that will be supplied when running
# pip uninstall.
#
Expand Down Expand Up @@ -82,6 +84,8 @@
$log_dir = '/tmp',
) {

$pip_freeze_pkgname = regsubst($pkgname, '_', '-', 'G')
notice("Pip freeze pkgname: ${pip_freeze_pkgname}")
# Parameter validation
if ! $virtualenv {
fail('python::pip: virtualenv parameter must not be empty')
Expand Down Expand Up @@ -135,12 +139,12 @@
}

# Check if searching by explicit version.
if $ensure =~ /^((19|20)[0-9][0-9]-(0[1-9]|1[1-2])-([0-2][1-9]|3[0-1])|[0-9]+\.[0-9]+(\.[0-9]+)?)$/ {
$grep_regex = "^${pkgname}==${ensure}\$"
if $ensure =~ /^((19|20)[0-9][0-9]-(0[1-9]|1[1-2])-([0-2][1-9]|3[0-1])|[0-9]+\.[0-9]+(\.[0-9]+)?)$/ { #lint:ignore:80chars
$grep_regex = "^${pip_freeze_pkgname}==${ensure}\$"
} else {
$grep_regex = $pkgname ? {
/==/ => "^${pkgname}\$",
default => "^${pkgname}==",
$grep_regex = $pip_freeze_pkgname ? {
/==/ => "^${pip_freeze_pkgname}\$",
default => "^${pip_freeze_pkgname}==",
}
}

Expand Down