##
# Creates the config file to create an application with the list of modules.
-def create_config_file(config, modules, env_file, logger):
+def create_config_file(config, modules, env_files, logger):
samples = ""
if 'SAMPLES' in config.APPLICATION.products:
f = open(config_file, "w")
f.write('<application>\n')
- if env_file.endswith("cfg"):
- f.write('<context path="%s"/>\n' % env_file)
- else:
- f.write('<prerequisites path="%s"/>\n' % env_file)
+ for env_file in env_files:
+ if env_file.endswith("cfg"):
+ f.write('<context path="%s"/>\n' % env_file)
+ else:
+ f.write('<prerequisites path="%s"/>\n' % env_file)
+
f.write('<resources path="CatalogResources.xml"/>\n')
f.write('<modules>\n')
flagline = False
for m in modules:
mm = src.product.get_product_config(config, m)
+ # do not include in virtual application application module!
+ if src.get_property_in_product_cfg(mm, "is_salome_application") == "yes":
+ continue
+ # do not include products that do not compile
+ if not src.product.product_compiles(mm):
+ continue
+ #obsolete?
if src.product.product_is_smesh_plugin(mm):
continue
write_step(logger, _("Creating environment files"))
status = src.KO_STATUS
+ # build the application (the name depends upon salome version
+ env_file = os.path.join(config.APPLICATION.workdir, "env_launch")
VersionSalome = src.get_salome_version(config)
if VersionSalome>=820:
# for salome 8+ we use a salome context file for the virtual app
- app_shell="cfg"
- env_ext="cfg"
+ app_shell=["cfg", "bash"]
+ env_files=[env_file+".cfg", env_file+".sh"]
else:
- app_shell="bash"
- env_ext="sh"
+ app_shell=["bash"]
+ env_files=[env_file+".sh"]
try:
import environ
# with the current system.
environ.write_all_source_files(config,
logger,
- shells=[app_shell],
+ shells=app_shell,
silent=True)
status = src.OK_STATUS
finally:
logger.write(src.printcolors.printc(status) + "\n", 2, False)
- # build the application (the name depends upon salome version
- env_file = os.path.join(config.APPLICATION.workdir, "env_launch." + env_ext)
write_step(logger, _("Building application"), level=2)
- cf = create_config_file(config, l_SALOME_modules, env_file, logger)
+ cf = create_config_file(config, l_SALOME_modules, env_files, logger)
# create the application directory
os.makedirs(appli_dir)
catalog = file(catfile, "w")
catalog.write("<!DOCTYPE ResourcesCatalog>\n<resources>\n")
for k in machines:
- logger.write(" ssh %s " % (k + " ").ljust(20, '.'), 4)
- logger.flush()
-
- ssh_cmd = 'ssh -o "StrictHostKeyChecking no" %s %s' % (k, cmd)
- p = subprocess.Popen(ssh_cmd, shell=True,
- stdin=subprocess.PIPE,
- stdout=subprocess.PIPE,
- stderr=subprocess.PIPE)
- p.wait()
-
- if p.returncode != 0:
- logger.write(src.printcolors.printc(src.KO_STATUS) + "\n", 4)
- logger.write(" " + src.printcolors.printcWarning(p.stderr.read()),
- 2)
- else:
- logger.write(src.printcolors.printc(src.OK_STATUS) + "\n", 4)
- lines = p.stdout.readlines()
- freq = lines[0][:-1].split(':')[-1].split('.')[0].strip()
- nb_proc = len(lines) -1
- memory = lines[-1].split(':')[-1].split()[0].strip()
- memory = int(memory) / 1000
+ if not src.architecture.is_windows():
+ logger.write(" ssh %s " % (k + " ").ljust(20, '.'), 4)
+ logger.flush()
+
+ ssh_cmd = 'ssh -o "StrictHostKeyChecking no" %s %s' % (k, cmd)
+ p = subprocess.Popen(ssh_cmd, shell=True,
+ stdin=subprocess.PIPE,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE)
+ p.wait()
+
+ machine_access = (p.returncode == 0)
+ if not machine_access:
+ logger.write(src.printcolors.printc(src.KO_STATUS) + "\n", 4)
+ logger.write(" " + src.printcolors.printcWarning(p.stderr.read()),
+ 2)
+ else:
+ logger.write(src.printcolors.printc(src.OK_STATUS) + "\n", 4)
+ lines = p.stdout.readlines()
+ freq = lines[0][:-1].split(':')[-1].split('.')[0].strip()
+ nb_proc = len(lines) -1
+ memory = lines[-1].split(':')[-1].split()[0].strip()
+ memory = int(memory) / 1000
catalog.write(" <machine\n")
catalog.write(" protocol=\"ssh\"\n")
catalog.write(" nbOfNodes=\"1\"\n")
catalog.write(" mode=\"interactif\"\n")
catalog.write(" OS=\"LINUX\"\n")
- catalog.write(" CPUFreqMHz=\"%s\"\n" % freq)
- catalog.write(" nbOfProcPerNode=\"%s\"\n" % nb_proc)
- catalog.write(" memInMB=\"%s\"\n" % memory)
+
+ if (not src.architecture.is_windows()) and machine_access:
+ catalog.write(" CPUFreqMHz=\"%s\"\n" % freq)
+ catalog.write(" nbOfProcPerNode=\"%s\"\n" % nb_proc)
+ catalog.write(" memInMB=\"%s\"\n" % memory)
+
catalog.write(" userName=\"%s\"\n" % user)
catalog.write(" name=\"%s\"\n" % k)
catalog.write(" hostname=\"%s\"\n" % k)