Skip to content

Commit a604e8d

Browse files
author
meihuisu
committed
add setting of large files env
1 parent 49621eb commit a604e8d

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

ucvm_setup.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,17 @@ def which(file):
7676
return path + "/" + file
7777
return None
7878

79+
# Check and return the value for a special environment variable
80+
# export CVM_LARGEDATA_DIR=/var/www/html/CVM_DATASET_DIRECTORY
81+
def getSpecialEnvSetting(envstr) :
82+
83+
my_env = os.environ.copy()
84+
if envstr in my_env.keys() :
85+
env_val=my_env[envstr]
86+
return env_val
87+
env[env] = my_env[env]
88+
89+
return None
7990

8091
# Records the command to the global shell script variable.
8192
def callAndRecord(command, nocall = False, noshell = True):
@@ -404,6 +415,12 @@ def makeBashScript(ucvmsrc, ucvmpath, modelsToInstall, librariesToInstall) :
404415
fp.write("\n")
405416
str="export UCVM_INSTALL_PATH="+ucvmpath.rstrip("/")
406417
fp.write(str)
418+
envval=getSpecialEnvSetting('CVM_LARGEDATA_DIR')
419+
if(envval != None) :
420+
str="export CVM_LARGEDATA_DIR="+envval.rstrip("/")
421+
fp.write(str)
422+
fp.write("\n")
423+
407424
fp.write("\n")
408425
fp.write("\n")
409426

@@ -504,6 +521,11 @@ def makePythonScript(ucvmsrc, ucvmpath, modelsToInstall, librariesToInstall) :
504521
fp.write(str)
505522
str="UCVM_INSTALL_PATH=\""+ucvmpath.rstrip("/")+"\"\n"
506523
fp.write(str)
524+
envval=getSpecialEnvSetting('CVM_LARGEDATA_DIR')
525+
if(envval != None) :
526+
str="CVM_LARGEDATA_DIR="+envval.rstrip("/")
527+
fp.write(str)
528+
fp.write("\n")
507529
str="my_env=os.environ\n\n"
508530
fp.write(str)
509531

0 commit comments

Comments
 (0)