return retcode
-def get_source_from_git(product_info, source_dir, logger, pad, is_dev=False):
+def get_source_from_git(product_info,
+ source_dir,
+ logger,
+ pad,
+ is_dev=False,
+ environ = None):
'''The method called if the product is to be get in git mode
:param product_info Config: The configuration specific to
:param logger Logger: The logger instance to use for the display and logging
:param pad int: The gap to apply for the terminal display
:param is_dev boolean: True if the product is in development mode
+ :param environ src.environment.Environ: The environment to source when
+ extracting.
:return: True if it succeed, else False
:rtype: boolean
'''
# Call the system function that do the extraction in git mode
retcode = src.system.git_extract(repo_git,
product_info.git_info.tag,
- source_dir, logger)
+ source_dir, logger, environ)
return retcode
def get_source_from_archive(product_info, source_dir, logger):
return retcode
-def get_source_from_cvs(user, product_info, source_dir, checkout, logger, pad):
+def get_source_from_cvs(user,
+ product_info,
+ source_dir,
+ checkout,
+ logger,
+ pad,
+ environ = None):
'''The method called if the product is to be get in cvs mode
:param user str: The user to use in for the cvs command
:param checkout boolean: If True, get the source in checkout mode
:param logger Logger: The logger instance to use for the display and logging
:param pad int: The gap to apply for the terminal display
+ :param environ src.environment.Environ: The environment to source when
+ extracting.
:return: True if it succeed, else False
:rtype: boolean
'''
product_info.cvs_info.product_base,
product_info.cvs_info.tag,
product_info.cvs_info.source,
- source_dir, logger, checkout)
+ source_dir, logger, checkout, environ)
return retcode
-def get_source_from_svn(user, product_info, source_dir, checkout, logger):
+def get_source_from_svn(user,
+ product_info,
+ source_dir,
+ checkout,
+ logger,
+ environ = None):
'''The method called if the product is to be get in svn mode
:param user str: The user to use in for the svn command
directory where to put the sources
:param checkout boolean: If True, get the source in checkout mode
:param logger Logger: The logger instance to use for the display and logging
+ :param environ src.environment.Environ: The environment to source when
+ extracting.
:return: True if it succeed, else False
:rtype: boolean
'''
product_info.svn_info.tag,
source_dir,
logger,
- checkout)
+ checkout,
+ environ)
return retcode
def get_product_sources(config,
:return: True if it succeed, else False
:rtype: boolean
'''
+
+ # Get the application environment
+ logger.write(_("Set the application environment\n"), 5)
+ env_appli = src.environment.SalomeEnviron(config,
+ src.environment.Environ(dict(os.environ)))
+ env_appli.set_application_env(logger)
+
+ # Call the right function to get sources regarding the product settings
if not checkout and is_dev:
return get_source_for_dev(config,
product_info,
if product_info.get_source == "git":
return get_source_from_git(product_info, source_dir, logger, pad,
- is_dev)
+ is_dev,env_appli)
if product_info.get_source == "archive":
return get_source_from_archive(product_info, source_dir, logger)
source_dir,
checkout,
logger,
- pad)
+ pad,
+ env_appli)
if product_info.get_source == "svn":
svn_user = config.USER.svn_user
return get_source_from_svn(svn_user, product_info, source_dir,
checkout,
- logger)
+ logger,
+ env_appli)
if product_info.get_source == "native":
# skip
% filePath), 1)
-def git_extract(from_what, tag, where, logger):
+def git_extract(from_what, tag, where, logger, environment=None):
'''Extracts sources from a git repository.
:param from_what str: The remote git repository.
:param tag str: The tag.
:param where str: The path where to extract.
:param logger Logger: The logger instance to use.
+ :param environment src.environment.Environ: The environment to source when
+ extracting.
:return: True if the extraction is successful
:rtype: boolean
'''
logger.logTxtFile.write("\n" + command + "\n")
logger.logTxtFile.flush()
- res = subprocess.call(command, cwd=str(where.dir()), shell=True,
- stdout=logger.logTxtFile, stderr=subprocess.STDOUT)
+ res = subprocess.call(command,
+ cwd=str(where.dir()),
+ env=environment.environ.environ,
+ shell=True,
+ stdout=logger.logTxtFile,
+ stderr=subprocess.STDOUT)
return (res == 0)
def archive_extract(from_what, where, logger):
return False, None
def cvs_extract(protocol, user, server, base, tag, product, where,
- logger, checkout=False):
+ logger, checkout=False, environment=None):
'''Extracts sources from a cvs repository.
:param protocol str: The cvs protocol.
:param where str: The path where to extract.
:param logger Logger: The logger instance to use.
:param checkout boolean: If true use checkout cvs.
+ :param environment src.environment.Environ: The environment to source when
+ extracting.
:return: True if the extraction is successful
:rtype: boolean
'''
logger.logTxtFile.write("\n" + command + "\n")
logger.logTxtFile.flush()
- res = subprocess.call(command, cwd=str(where.dir()), shell=True,
- stdout=logger.logTxtFile, stderr=subprocess.STDOUT)
+ res = subprocess.call(command,
+ cwd=str(where.dir()),
+ env=environment.environ.environ,
+ shell=True,
+ stdout=logger.logTxtFile,
+ stderr=subprocess.STDOUT)
return (res == 0)
-def svn_extract(user, from_what, tag, where, logger, checkout=False):
+def svn_extract(user,
+ from_what,
+ tag,
+ where,
+ logger,
+ checkout=False,
+ environment=None):
'''Extracts sources from a svn repository.
:param user str: The user to be used.
:param where str: The path where to extract.
:param logger Logger: The logger instance to use.
:param checkout boolean: If true use checkout svn.
+ :param environment src.environment.Environ: The environment to source when
+ extracting.
:return: True if the extraction is successful
:rtype: boolean
'''
logger.write(command + "\n", 5)
logger.logTxtFile.write("\n" + command + "\n")
logger.logTxtFile.flush()
- res = subprocess.call(command, cwd=str(where.dir()), shell=True,
- stdout=logger.logTxtFile, stderr=subprocess.STDOUT)
+ res = subprocess.call(command,
+ cwd=str(where.dir()),
+ env=environment.environ.environ,
+ shell=True,
+ stdout=logger.logTxtFile,
+ stderr=subprocess.STDOUT)
return (res == 0)
\ No newline at end of file