for prod in p_name_p_info[1]["depend_all"]:
# for each dependency, check the install
prod_name, prod_info=all_products_dict[prod]
- if not(src.product.check_installation(prod_info)):
+ if not(src.product.check_installation(config, prod_info)):
l_depends_not_installed.append(prod_name)
return l_depends_not_installed # non installed deps
continue
# Check if it was already successfully installed
- if src.product.check_installation(p_info):
+ if src.product.check_installation(config, p_info):
logger.write(_("Already installed"))
logger.write(_(" in %s" % p_info.install_dir), 4)
logger.write(_("\n"))
:return: 1 if it fails, else 0.
:rtype: int
'''
+ # a) initialisation
p_name, p_info = p_name_info
-
- # Execute "sat configure", "sat make" and "sat install"
res = 0
error_step = ""
pip_install_in_python=False
pip_wheels_dir=os.path.join(config.LOCAL.archive_dir,"wheels")
+ pip_install_cmd=config.INTERNAL.command.pip_install # parametrized in src/internal
+
+ # b) get the build environment (useful to get the installed python & pip3)
+ build_environ = src.environment.SalomeEnviron(config,
+ src.environment.Environ(dict(os.environ)),
+ True)
+ environ_info = src.product.get_product_dependencies(config,
+ p_info)
+ build_environ.silent = (config.USER.output_verbose_level < 5)
+ build_environ.set_full_environ(logger, environ_info)
+
+ # c- download : check/get pip wheel in pip_wheels_dir
+ pip_download_cmd=config.INTERNAL.command.pip_download +\
+ " --destination-directory %s --no-deps %s==%s " %\
+ (pip_wheels_dir, p_info.name, p_info.version)
+ logger.write("\n"+pip_download_cmd+"\n", 4, False)
+ res_pip_dwl = (subprocess.call(pip_download_cmd,
+ shell=True,
+ cwd=config.LOCAL.workdir,
+ env=build_environ.environ.environ,
+ stdout=logger.logTxtFile,
+ stderr=subprocess.STDOUT) == 0)
+ # error is not managed at the stage. error will be handled by pip install
+ # here we just print a message
+ if not res_pip_dwl:
+ logger.write("Error in pip download\n", 4, False)
+
+
+ # d- install (in python or in separate product directory)
if src.appli_test_property(config,"pip_install_dir", "python"):
# pip will install product in python directory"
- pip_install_cmd="pip3 install --disable-pip-version-check --no-index --find-links=%s --build %s %s==%s" %\
+ pip_install_cmd+=" --find-links=%s --build %s %s==%s" %\
(pip_wheels_dir, p_info.build_dir, p_info.name, p_info.version)
pip_install_in_python=True
else:
# pip will install product in product install_dir
pip_install_dir=os.path.join(p_info.install_dir, "lib", "python${PYTHON_VERSION:0:3}", "site-packages")
- pip_install_cmd="pip3 install --disable-pip-version-check --no-index --find-links=%s --build %s --target %s %s==%s" %\
+ pip_install_cmd+=" --find-links=%s --build %s --target %s %s==%s" %\
(pip_wheels_dir, p_info.build_dir, pip_install_dir, p_info.name, p_info.version)
log_step(logger, header, "PIP")
logger.write("\n"+pip_install_cmd+"\n", 4)
len_end_line = len_end + 3
error_step = ""
- build_environ = src.environment.SalomeEnviron(config,
- src.environment.Environ(dict(os.environ)),
- True)
- environ_info = src.product.get_product_dependencies(config,
- p_info)
- build_environ.silent = (config.USER.output_verbose_level < 5)
- build_environ.set_full_environ(logger, environ_info)
-
- # useless - pip uninstall himself when wheel is alredy installed
- #if pip_install_in_python and (options.clean_install or options.clean_all):
- # # for products installed by pip inside python install dir
- # # finish the clean by uninstalling the product from python install dir
- # pip_clean_cmd="pip3 uninstall -y %s==%s" % (p_name, p_info.version)
- # res_pipclean = (subprocess.call(pip_clean_cmd,
- # shell=True,
- # cwd=config.LOCAL.workdir,
- # env=build_environ.environ.environ,
- # stdout=logger.logTxtFile,
- # stderr=subprocess.STDOUT) == 0)
- # if not res_pipclean:
- # logger.write("\n",1)
- # logger.warning("pip3 uninstall failed!")
res_pip = (subprocess.call(pip_install_cmd,
shell=True,
# get KERNEL bin installation path
# (in order for the launcher to get python salomeContext API)
kernel_cfg = src.product.get_product_config(config, "KERNEL")
- if not src.product.check_installation(kernel_cfg):
+ if not src.product.check_installation(config, kernel_cfg):
raise src.SatException(_("KERNEL is not installed"))
kernel_root_dir = kernel_cfg.install_dir
or src.product.product_is_fixed(prod_info)
or not src.product.product_compiles(prod_info)):
continue
- if src.product.check_installation(prod_info):
+ if src.product.check_installation(config, prod_info):
l_install_dir.append((prod_name, prod_info.install_dir))
else:
l_not_installed.append(prod_name)
# check if pip should be used : pip mode id activated if the application and product have pip property
if (src.appli_test_property(config,"pip", "yes") and
src.product.product_test_property(product_info,"pip", "yes")):
- # download whl in local archive dir
- pip_wheels_dir=os.path.join(config.LOCAL.archive_dir,"wheels")
- pip_download_cmd="pip download --disable-pip-version-check --destination-directory %s --no-deps %s==%s " %\
- (pip_wheels_dir, product_info.name, product_info.version)
- logger.write(pip_download_cmd, 3, False)
- res_pip = (subprocess.call(pip_download_cmd,
- shell=True,
- cwd=config.LOCAL.workdir,
- stdout=logger.logTxtFile,
- stderr=subprocess.STDOUT) == 0)
- return res_pip
+ pip_msg = "PIP : do nothing, product will be downloaded later at compile time "
+ logger.write(pip_msg, 3)
+ return True
# check archive exists
if not os.path.exists(product_info.archive_info.archive_name):
{
copy_prefix : "LOCAL_"
install_dir : "INSTALL"
+ single_install_dir : "PRODUCTS"
}
log :
{
not_shown_commands : ["log"]
}
+ command :
+ {
+ pip_download : "pip3 download --disable-pip-version-check"
+ pip_install : "pip3 install --disable-pip-version-check --no-index"
+ }
}
PRODUCTS :
{
AVAILABLE_VCS = ['git', 'svn', 'cvs']
-CONFIG_FILENAME = "sat-config.pyconf" # trace product depends version(s)
-PRODUCT_FILENAME = "sat-product.pyconf" # trace product compile config
+CONFIG_FILENAME = "sat-config-" # trace product depends version(s)
+PRODUCT_FILENAME = "sat-product-" # trace product compile config
config_expression = "^config-\d+$"
def get_product_config(config, product_name, with_install_dir=True):
else:
if "install_dir" not in prod_info or prod_info.install_dir == "base":
# Set it to the default value (in application directory)
- install_dir = os.path.join(config.APPLICATION.workdir,
- config.INTERNAL.config.install_dir,
- prod_info.name)
+ if ( src.appli_test_property(config,"single_install_dir", "yes") and
+ src.product.product_test_property(prod_info,"single_install_dir", "yes")):
+ # when single_install_dir mode is activated in tha application
+ # we use config.INTERNAL.config.single_install_dir for products
+ # having single_install_dir property
+ install_dir = os.path.join(config.APPLICATION.workdir,
+ config.INTERNAL.config.install_dir,
+ config.INTERNAL.config.single_install_dir)
+ else:
+ install_dir = os.path.join(config.APPLICATION.workdir,
+ config.INTERNAL.config.install_dir,
+ prod_info.name)
else:
install_dir = prod_info.install_dir
# Write it in the install directory of the product
# This file is for automatic reading/checking
# see check_config_exists method
- aFile = os.path.join(p_info.install_dir, CONFIG_FILENAME)
+ afilename = CONFIG_FILENAME + p_info.name + ".pyconf"
+ aFile = os.path.join(p_info.install_dir, afilename)
with open(aFile, 'w') as f:
res.__save__(f)
# this file is not mandatory, is for human eye reading
- aFile = os.path.join(p_info.install_dir, PRODUCT_FILENAME)
+ afilename = PRODUCT_FILENAME + p_info.name + ".pyconf"
+ aFile = os.path.join(p_info.install_dir, afilename)
try:
with open(aFile, 'w') as f:
p_info.__save__(f, evaluated=True) # evaluated expressions mode
continue
# check if there is the file sat-config.pyconf file in the installation
# directory
- config_file = os.path.join(prod_dir, dir_or_file, CONFIG_FILENAME)
+ afilename = PRODUCT_FILENAME + p_info.name + ".pyconf"
+ config_file = os.path.join(prod_dir, dir_or_file, afilename)
DBG.write("check_config_exists 222", config_file, verbose)
if not os.path.exists(config_file):
continue
res.append(prod_in_dep)
return res
-def check_installation(product_info):
+def check_installation(config, product_info):
"""\
Verify if a product is well installed. Checks install directory presence
and some additional files if it is defined in the config
"""
if not product_compiles(product_info):
return True
+
install_dir = product_info.install_dir
- if not os.path.exists(install_dir):
- return False
+ 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.
+ filename = CONFIG_FILENAME + product_info.name + ".pyconf"
+ if not os.path.exists(os.path.join(install_dir, filename)):
+ return False
+ else:
+ if not os.path.exists(install_dir):
+ return False
+
+ # check extra files if specified in present_files.install section
if ("present_files" in product_info and
"install" in product_info.present_files):
for file_relative_path in product_info.present_files.install: