+ # Creation of env.d directory
+ virtual_salome.mkdir(os.path.join(home_dir,'env.d'))
+
+ venv_directory_path = _config.get('venv_directory_path')
+ if venv_directory_path and os.path.isdir(venv_directory_path):
+ virtual_salome.symlink(venv_directory_path, os.path.join(home_dir, "venv"))
+
+ # Get the env modules which will be loaded
+ # In the same way as: module load [MODULE_LIST]
+ env_modules = _config.get('env_modules', [])
+ if env_modules:
+ with open(os.path.join(home_dir, 'env_modules.json'), 'w') as fd:
+ json.dump({"env_modules": env_modules}, fd)
+ with open(os.path.join(home_dir, 'env.d', 'envModules.sh'), 'w') as fd:
+ fd.write('#!/bin/bash\n')
+ fd.write('module load %s\n' % (' '.join(env_modules)))
+
+ # Copy salome / salome_mesa scripts:
+
+ for scripts in ('salome', 'salome_mesa', 'salome_common.py'):
+ salome_script = open(os.path.join(appliskel_dir, scripts)).read()
+ salome_file = os.path.join(home_dir, scripts)
+ try:
+ os.remove(salome_file)
+ except Exception:
+ pass
+ with open(salome_file, 'w') as fd:
+ fd.write(salome_script.replace('MODULES = []', 'MODULES = {}'.format(env_modules)))
+ os.chmod(salome_file, 0o755)