var['srcDir'] = osJoin(var['salometoolsway'], 'src')
var['internal_dir'] = osJoin(var['srcDir'], 'internal_config')
var['sep']= os.path.sep
+ if src.architecture.is_windows():
+ var['scriptExtension'] = '.bat'
+ else:
+ var['scriptExtension'] = '.sh'
# datadir has a default location
var['datadir'] = osJoin(var['salometoolsway'], 'data')
file_dir,
src_root=None)
+ if src.architecture.is_windows():
+ shell = "bat"
+ filename = "env_launch.bat"
+ else:
+ shell = "bash"
+ filename = "env_launch.sh"
+
# Write
- filepath = writer.write_env_file("env_launch.sh",
+ filepath = writer.write_env_file(filename,
False, # for launch
- "bash",
+ shell,
for_package = binaries_dir_name)
# Little hack to put out_dir_Path as environment variable
tmp_working_dir,
binaries_dir_name)
- d_products["environment file"] = (env_file, "env_launch.sh")
-
+ if src.architecture.is_windows():
+ filename = "env_launch.bat"
+ else:
+ filename = "env_launch.sh"
+ d_products["environment file"] = (env_file, filename)
+
return d_products
def source_package(sat, config, logger, options, tmp_working_dir):
:rtype: str
'''
if is_windows():
- return "Win"
+ return "W" # in order to fulfill the 8196 length constraint!
# else get linux distribution description from platform, and encode it with code
lin_distrib = platform.dist()[0].lower()
assert self.build_environ is not None
# pass additional variables to environment
# (may be used by the build script)
+ self.build_environ.set("APPLICATION_NAME", self.config.APPLICATION.name)
self.build_environ.set("SOURCE_DIR", str(self.source_dir))
self.build_environ.set("INSTALL_DIR", str(self.install_dir))
self.build_environ.set("PRODUCT_INSTALL", str(self.install_dir))
:param value str: the value to append to key
:param sep str: the separator string
"""
- for c in [";", ":"]: # windows or linux path separators
- if c in value:
+ if src.architecture.is_windows():
+ separators = [';']
+ else:
+ separators = [':']
+ for c in separators: # windows or linux path separators
+ isOK = True
+ if c in value and not src.architecture.is_windows():
+ isOK = False
+ elif c in value and src.architecture.is_windows() and value.count(':') > 1:
+ isOK = False
+ if not isOK:
raise Exception("Environ append key '%s' value '%s' contains forbidden character '%s'" % (key, value, c))
# check if the key is already in the environment
if key in self.environ:
:param value str: the value to prepend to key
:param sep str: the separator string
"""
- for c in [";", ":"]: # windows or linux path separators
- if c in value:
+ if src.architecture.is_windows():
+ separators = [';']
+ else:
+ separators = [':']
+ for c in separators: # windows or linux path separators
+ isOK = True
+ if c in value and not src.architecture.is_windows():
+ isOK = False
+ elif c in value and src.architecture.is_windows() and value.count(':') > 1:
+ isOK = False
+ if not isOK:
raise Exception("Environ prepend key '%s' value '%s' contains forbidden character '%s'" % (key, value, c))
# check if the key is already in the environment
if key in self.environ:
self.prepend('LD_LIBRARY_PATH', lib_path)
l = [ bin_path, lib_path ]
- if self.has_python:
- l.append(pylib1_path)
- l.append(pylib2_path)
-
- self.prepend('PYTHONPATH', l)
+ if not src.product.product_is_wheel(pi):
+ if self.has_python:
+ l.append(pylib1_path)
+ l.append(pylib2_path)
+ self.prepend('PYTHONPATH', l)
def set_cpp_env(self, product_info):
"""\
import os
import pprint as PP
import src.debug as DBG
+import src.architecture
bat_header="""\
@echo off
:param value str: the value to append to key
:param sep str: the separator string
"""
- for c in [";", ":"]: # windows or linux path separators
- if c in value:
+ separators = []
+ if src.architecture.is_windows():
+ separators = [':']
+ else:
+ separators = [';']
+ for c in separators: # windows or linux path separators
+ isOK = True
+ if c in value and not src.architecture.is_windows():
+ isOK = False
+ elif c in value and src.architecture.is_windows() and value.count(':') > 1:
+ isOK = False
+ if not isOK:
raise Exception("FileEnviron append key '%s' value '%s' contains forbidden character '%s'" % (key, value, c))
self.set(key, self.get(key) + sep + value)
if (key, sep) not in self.toclean:
:param value str: the value to prepend to key
:param sep str: the separator string
"""
- for c in [";", ":"]: # windows or linux path separators
- if c in value:
+ separators = []
+ if src.architecture.is_windows():
+ separators = [':']
+ else:
+ separators = [';']
+ for c in separators: # windows or linux path separators
+ isOK = True
+ if c in value and not src.architecture.is_windows():
+ isOK = False
+ elif c in value and src.architecture.is_windows() and value.count(':') > 1:
+ isOK = False
+ if not isOK:
raise Exception("FileEnviron prepend key '%s' value '%s' contains forbidden character '%s'" % (key, value, c))
self.set(key, value + sep + self.get(key))
if (key, sep) not in self.toclean:
:param value str: the value to append to key
:param sep str: the separator string
"""
- for c in [";", ":"]: # windows or linux path separators
- if c in value:
+ separators = []
+ if src.architecture.is_windows():
+ separators = [':']
+ else:
+ separators = [';']
+ for c in separators: # windows or linux path separators
+ isOK = True
+ if c in value and not src.architecture.is_windows():
+ isOK = False
+ elif c in value and src.architecture.is_windows() and value.count(':') > 1:
+ isOK = False
+ if not isOK:
raise Exception("LauncherFileEnviron append key '%s' value '%s' contains forbidden character '%s'" % (key, value, c))
if self.is_defined(key) :
self.add(key, value)
compo_list = [ compo_list ]
return compo_list
+def product_is_wheel(product_info):
+ """ tells whether a product is a wheel
+
+ :param product_info Config: The configuration specific to
+ the product
+ :return: True if the product has a wheel, else False
+ :rtype: Boolean
+ """
+ return ("properties" in product_info and
+ "is_wheel" in product_info.properties and
+ product_info.properties.is_wheel == "yes")
+
import debug as DBG
import utilsSat as UTS
+import src
from . import printcolors
if not where.exists():
where.make()
if tag == "master" or tag == "HEAD":
- cmd = r"""
+ if src.architecture.is_windows():
+ cmd = "git clone %(remote)s %(where)s"
+ else:
+ cmd = r"""
set -x
git clone %(remote)s %(where)s
"""
# NOTICE: this command only works with recent version of git
# because --work-tree does not work with an absolute path
where_git = os.path.join(str(where), ".git")
-
- cmd = r"""
+ if src.architecture.is_windows():
+ cmd = "rmdir %(where)s && git clone %(remote)s %(where)s && git --git-dir=%(where_git)s --work-tree=%(where)s checkout %(tag)s"
+ else:
+ cmd = r"""
set -x
rmdir %(where)s
git clone %(remote)s %(where)s && \
'tmpWhere': tmpWhere,
}
DBG.write("git_extract_sub_dir", aDict)
-
- cmd = r"""
+ if not src.architecture.is_windows():
+ cmd = r"""
set -x
export tmpDir=%(tmpWhere)s && \
rm -rf $tmpDir
git log -1 > %(where)s/README_git_log.txt && \
rm -rf $tmpDir
""" % aDict
+ else:
+ cmd = r"""
+
+set tmpDir=%(tmpWhere)s && \
+rm -rf $tmpDir
+git clone %(remote)s $tmpDir && \
+cd $tmpDir && \
+git checkout %(tag)s && \
+mv %(sub_dir)s %(where)s && \
+git log -1 > %(where)s/README_git_log.txt && \
+rm -rf $tmpDir
+""" % aDict
+
DBG.write("cmd", cmd)
for nbtry in range(0,3): # retries case of network problem