Added --no-download parameter to create virtualenv for offline deployments
Change-Id: I12f96b5d6ef806c38506e3a0364a07e2309a6a1b
diff --git a/src/com/mirantis/mk/Python.groovy b/src/com/mirantis/mk/Python.groovy
index e670013..0919904 100644
--- a/src/com/mirantis/mk/Python.groovy
+++ b/src/com/mirantis/mk/Python.groovy
@@ -17,6 +17,7 @@
def setupVirtualenv(path, python = 'python2', reqs=[], reqs_path=null, clean=false, useSystemPackages=false) {
def common = new com.mirantis.mk.Common()
+ def offlineDeployment = env.getEnvironment().containsKey("OFFLINE_DEPLOYMENT") && env["OFFLINE_DEPLOYMENT"].toBoolean()
def virtualenv_cmd = "virtualenv ${path} --python ${python}"
if (useSystemPackages){
virtualenv_cmd += " --system-site-packages"
@@ -26,9 +27,12 @@
sh("rm -rf \"${path}\"")
}
+ if(offlineDeployment){
+ virtualenv_cmd+=" --no-download"
+ }
common.infoMsg("[Python ${path}] Setup ${python} environment")
sh(returnStdout: true, script: virtualenv_cmd)
- if(!env.getEnvironment().containsKey("OFFLINE_DEPLOYMENT") || !env["OFFLINE_DEPLOYMENT"].toBoolean()){
+ if(!offlineDeployment){
try {
runVirtualenvCommand(path, "pip install -U setuptools pip")
} catch(Exception e) {