- f =open(os.path.join(home_dir,'env.d','configSalome.sh'),'w')
- for module in _config.get("modules",[]):
- command='export '+ module + '_ROOT_DIR=${HOME}/${APPLI}\n'
- f.write(command)
- pass
- if _config.has_key("samples_path"):
- command='export DATA_DIR=' + _config["samples_path"] +'\n'
- f.write(command)
- pass
- if _config.has_key("resources_path") and os.path.isfile(_config["resources_path"]):
- command='export USER_CATALOG_RESOURCES_FILE=' + os.path.abspath(_config["resources_path"]) +'\n'
- f.write(command)
-
- f.close()
+ with open(os.path.join(home_dir, 'env.d', 'configSalome.sh'),'w') as f:
+ for module in _config.get("modules", []):
+ command = 'export '+ module + '_ROOT_DIR=${HOME}/${APPLI}\n'
+ f.write(command)
+ pass
+ if _config.has_key("samples_path"):
+ command = 'export DATA_DIR=' + _config["samples_path"] +'\n'
+ f.write(command)
+ pass
+ if _config.has_key("resources_path") and os.path.isfile(_config["resources_path"]):
+ command = 'export USER_CATALOG_RESOURCES_FILE=' + os.path.abspath(_config["resources_path"]) +'\n'
+ f.write(command)