summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Stankevich <stankevich@users.noreply.github.com>2014-04-24 08:32:15 -0400
committerSergey Stankevich <stankevich@users.noreply.github.com>2014-04-24 08:32:15 -0400
commite80205d72d47e1284b69ba55fc9cc176783ed1ac (patch)
tree8faef25499c38dd7d922e23eeef702bbc6a784bb
parent327351578a151bf9cf30f746075bb653b77ba57c (diff)
parentd0d3e37f2bc4c0c4473e2cb586c61e3d3359637c (diff)
Merge pull request #80 from lotia/master
Add an editable argument in the pip provider
-rw-r--r--.gitignore6
-rw-r--r--manifests/pip.pp34
2 files changed, 36 insertions, 4 deletions
diff --git a/.gitignore b/.gitignore
index b2bcbe8..b468fdc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,5 @@
-pkg/ \ No newline at end of file
+pkg/
+
+# ignore rbvenv files used for puppet-lint, rspect etc.
+.ruby-version
+.rbenv-gemsets
diff --git a/manifests/pip.pp b/manifests/pip.pp
index 0c78903..637960b 100644
--- a/manifests/pip.pp
+++ b/manifests/pip.pp
@@ -25,9 +25,20 @@
# [*proxy*]
# Proxy server to use for outbound connections. Default: none
#
+# [*editable*]
+# Boolean. If true the package is installed as an editable resource.
+#
# [*environment*]
# Additional environment variables required to install the packages. Default: none
#
+# [*install_args*]
+# String. Any additional installation arguments that will be supplied
+# when running pip install.
+#
+# [*uninstall args*]
+# String. Any additional arguments that will be supplied when running
+# pip uninstall.
+#
# === Examples
#
# python::pip { 'flask':
@@ -48,6 +59,7 @@ define python::pip (
$owner = 'root',
$proxy = false,
$egg = false,
+ $editable = false,
$environment = [],
$install_args = '',
$uninstall_args = '',
@@ -77,6 +89,22 @@ define python::pip (
default => "--proxy=${proxy}",
}
+ if $editable == true {
+ $install_editable = ' -e '
+ }
+ else {
+ $install_editable = ''
+ }
+
+ #TODO: Do more robust argument checking, but below is a start
+ if ($ensure == absent) and ($install_args != '') {
+ fail('python::pip cannot provide install_args with ensure => absent')
+ }
+
+ if $(ensure == present) and ($uninstall_args != '') {
+ fail('python::pip cannot provide uninstall_args with ensure => present')
+ }
+
# 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}\$"
@@ -117,7 +145,7 @@ define python::pip (
# Version formats as per http://guide.python-distribute.org/specification.html#standard-versioning-schemes
# Explicit version.
exec { "pip_install_${name}":
- command => "${pip_env} wheel --help > /dev/null 2>&1 && { ${pip_env} wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; ${pip_env} --log ${cwd}/pip.log install ${install_args} \$wheel_support_flag ${proxy_flag} ${source}==${ensure}",
+ command => "${pip_env} wheel --help > /dev/null 2>&1 && { ${pip_env} wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; ${pip_env} --log ${cwd}/pip.log install ${install_args} \$wheel_support_flag ${proxy_flag} ${install_args} ${install_editable} ${source}==${ensure}",
unless => "${pip_env} freeze | grep -i -e ${grep_regex}",
user => $owner,
environment => $environment,
@@ -128,7 +156,7 @@ define python::pip (
present: {
# Whatever version is available.
exec { "pip_install_${name}":
- command => "${pip_env} wheel --help > /dev/null 2>&1 && { ${pip_env} wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; ${pip_env} --log ${cwd}/pip.log install ${install_args} \$wheel_support_flag ${proxy_flag} ${source}",
+ command => "${pip_env} wheel --help > /dev/null 2>&1 && { ${pip_env} wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; ${pip_env} --log ${cwd}/pip.log install \$wheel_support_flag ${proxy_flag} ${install_args} ${install_editable} ${source}",
unless => "${pip_env} freeze | grep -i -e ${grep_regex}",
user => $owner,
environment => $environment,
@@ -139,7 +167,7 @@ define python::pip (
latest: {
# Latest version.
exec { "pip_install_${name}":
- command => "${pip_env} wheel --help > /dev/null 2>&1 && { ${pip_env} wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; ${pip_env} --log ${cwd}/pip.log install --upgrade \$wheel_support_flag ${proxy_flag} ${source}",
+ command => "${pip_env} wheel --help > /dev/null 2>&1 && { ${pip_env} wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; ${pip_env} --log ${cwd}/pip.log install --upgrade \$wheel_support_flag ${proxy_flag} ${uninstall_args} ${install_editable} ${source}",
unless => "${pip_env} search ${source} | grep -i INSTALLED | grep -i latest",
user => $owner,
environment => $environment,