stderr=subprocess.STDOUT) == 0)
if res_pip:
res=0
- if pip_install_in_python:
- # when product is installed in python, create install_dir
- # (to put inside product info and mark the installation success)
- os.mkdir(p_info.install_dir)
else:
#log_res_step(logger, res)
res=1
'evince',
"This is the pdf_viewer used "
"to read pdf documentation\n")
-# CNC 25/10/17 : plus nécessaire a priori
-# user_cfg.USER.addMapping("base",
-# src.pyconf.Reference(
-# user_cfg,
-# src.pyconf.DOLLAR,
-# 'workdir + $VARS.sep + "BASE"'),
-# "The products installation base (could be "
-# "ignored if this key exists in the local.pyconf"
-# " file of salomTools).\n")
src.ensure_path_exists(config.VARS.personalDir)
src.ensure_path_exists( osJoin(config.VARS.personalDir,
names = sorted(d_content.keys())
DBG.write("add tar names", names)
+ # used to avoid duplications (for pip install in python, or single_install_dir cases)
+ already_added=set()
for name in names:
# display information
len_points = max_len - len(name) + 3
# of the directory or file to add
# Add it in the archive
try:
- tar.add(local_path, arcname=in_archive, exclude=f_exclude)
+ key=local_path+"->"+in_archive
+ if key not in already_added:
+ tar.add(local_path, arcname=in_archive, exclude=f_exclude)
+ already_added.add(key)
logger.write(src.printcolors.printcSuccess(_("OK")), 3)
except Exception as e:
logger.write(src.printcolors.printcError(_("KO ")), 3)
stat.S_IXGRP |
stat.S_IXOTH)
- print "CNC filepath = ", filepath
return filepath
def hack_for_distene_licence(filepath, licence_file):
# actual install directories and there install directory in archive
d_products = {}
for prod_name, install_dir in l_install_dir:
- path_in_archive = os.path.join(binaries_dir_name, prod_name)
+ path_in_archive = os.path.join(binaries_dir_name, os.path.basename(install_dir))
d_products[prod_name + " (bin)"] = (install_dir, path_in_archive)
for prod_name, source_dir in l_source_dir:
pip_wheels_dir=os.path.join(config.LOCAL.archive_dir,"wheels")
pip_wheel_pattern=os.path.join(pip_wheels_dir,
"%s-%s*" % (p_info.name, p_info.version))
- print "CNC pip_wheel_pattern = ",pip_wheel_pattern
pip_wheel_path=glob.glob(pip_wheel_pattern)
msg_pip_not_found="Error in get_archive, pip wheel for "\
"product %s-%s was not found in %s directory"
logger.write("\n", 1)
return 1
- # CNC inutile
- # Ask user confirmation if a module of the same name already exists
- #if options.name in runner.cfg.PRODUCTS and not runner.options.batch:
- # logger.write(src.printcolors.printcWarning(
- # _("A module named '%s' already exists." % options.name)), 1)
- # logger.write("\n", 1)
- # rep = input(_("Are you sure you want to continue? [Yes/No] "))
- # if rep.upper() != _("YES"):
- # return 1
-
if options.target is None:
msg = _("Error: the --%s argument is required\n") % "target"
logger.write(src.printcolors.printcError(msg), 1)
logger.write("\n", 1)
return 1
- # CNC inutile
- #if options.template == "Application":
- # if "_APPLI" not in options.name and not runner.options.batch:
- # msg = _("An Application module named '..._APPLI' "
- # "is usually recommended.")
- # logger.write(src.printcolors.printcWarning(msg), 1)
- # logger.write("\n", 1)
- # rep = input(_("Are you sure you want to continue? [Yes/No] "))
- # if rep.upper() != _("YES"):
- # return 1
logger.write(_('Create sources from template\n'), 1)
src.printcolors.print_value(logger, 'destination', target_dir, 2)
self.set(src_dir, product_info.source_dir)
else:
self.set(src_dir, os.path.join("out_dir_Path",
- "SOURCES",
- product_info.name))
+ "SOURCES",
+ os.path.basename(product_info.source_dir)))
def set_salome_generic_product_env(self, pi):
"""\
bin_path = os.path.join(env_root_dir, 'bin')
if self.has_python:
# if the application doesn't include python, we don't need these two lines
- pylib1_path = os.path.join(env_root_dir, self.python_lib)
+ pylib_path = os.path.join(env_root_dir, self.python_lib)
else:
lib_path = os.path.join(env_root_dir, 'lib', 'salome')
bin_path = os.path.join(env_root_dir, 'bin', 'salome')
if self.has_python:
# if the application doesn't include python, we don't need these two lines
- pylib1_path = os.path.join(env_root_dir, self.python_lib, 'salome')
+ pylib_path = os.path.join(env_root_dir, self.python_lib, 'salome')
# Construct the paths to prepend to PATH and LD_LIBRARY_PATH and
# PYTHONPATH
l = [ bin_path, lib_path ]
if not src.product.product_is_wheel(pi):
if self.has_python:
- l.append(pylib1_path)
- l.append(pylib2_path)
+ l.append(pylib_path)
self.prepend('PYTHONPATH', l)
def set_cpp_env(self, product_info):
if self.for_package:
- pi.install_dir = os.path.join("out_dir_Path",
- self.for_package,
- pi.name)
+ pi.install_dir = os.path.join(
+ "out_dir_Path",
+ self.for_package,
+ os.path.basename(pi.install_dir))
if not self.silent:
logger.write(_("Setting environment for %s\n") % product, 4)
value_list = self.environ.get(key).split(sep)
if self.environ._expandvars(value) in value_list:
do_append=False # value is already in key path : we don't append it again
- #print "\nCNC append_value value is already set!! key=%s, val=%s value_list=%s\n" % (key,self.environ._expandvars(value), value_list)
if do_append:
self.environ.append_value(key, value,sep)
exp_val=self.environ._expandvars(value)
if exp_val in value_list:
do_not_prepend=True
- #print "\nCNC prepend_value value is already set!! key=%s, val=%s value_list=%s\n" % (key,exp_val, value_list)
if not do_not_prepend:
self.environ.prepend_value(key, value,sep)
self.set(key, value + sep + self.get(key))
install_dir = os.path.join(config.APPLICATION.workdir,
config.INTERNAL.config.install_dir,
config.INTERNAL.config.single_install_dir)
+ elif ( src.appli_test_property(config,"pip", "yes") and
+ src.product.product_test_property(prod_info,"pip", "yes") and
+ src.appli_test_property(config,"pip_install_dir", "python") ):
+ # when pip mode is activated in the application
+ # and product is pip, and pip_install_dir is set to python
+ # we assume python in installed in install_dir/Python
+ install_dir = os.path.join(config.APPLICATION.workdir,
+ config.INTERNAL.config.install_dir,
+ "Python")
else:
install_dir = os.path.join(config.APPLICATION.workdir,
config.INTERNAL.config.install_dir,
return True
install_dir = product_info.install_dir
- if ( src.appli_test_property(config,"single_install_dir", "yes") and
- src.product.product_test_property(product_info,"single_install_dir", "yes")):
- # if the product is installed in the single install dir, we check the product file
- #in state of the install directory.
+ if ( (src.appli_test_property(config,"single_install_dir", "yes") and
+ src.product.product_test_property(product_info,"single_install_dir", "yes")) or
+ (src.appli_test_property(config,"pip", "yes") and
+ src.product.product_test_property(product_info,"pip", "yes") and
+ src.appli_test_property(config,"pip_install_dir", "python") ) ):
+ # if the product is installed in the single install dir, or in python (for pip managed products)
+ # we check the product file in state of the install directory.
filename = CONFIG_FILENAME + product_info.name + ".pyconf"
if not os.path.exists(os.path.join(install_dir, filename)):
return False