X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FfileEnviron.py;h=3fe41c87945290dc5524abfb57bf98f015cc91e8;hb=c76437f0fb9f7f66bfca0eb10674fbdd3d22ba6c;hp=aa89e0dfd0bbe28c7b7395c2297431e0e42f2ef6;hpb=e4e17ece34900e5bc9afc84a6a37b77f0612e95a;p=tools%2Fsat.git diff --git a/src/fileEnviron.py b/src/fileEnviron.py index aa89e0d..3fe41c8 100644 --- a/src/fileEnviron.py +++ b/src/fileEnviron.py @@ -210,7 +210,10 @@ class FileEnviron(object): :param key str: the environment variable """ - return '${%s}' % key + if src.architecture.is_windows(): + return '%' + key + '%' + else: + return '${%s}' % key def get_value(self, key): """Get the real value of the environment variable "key" @@ -237,9 +240,6 @@ class FileEnviron(object): def value_filter(self, value): res=value - # on windows platform, replace / by \ - if src.architecture.is_windows(): - res = value.replace("/","\\") return res @@ -458,7 +458,6 @@ class LauncherFileEnviron(FileEnviron): self._do_init(output, environ) self.python_version=self.environ.get("sat_python_version") self.bin_kernel_root_dir=self.environ.get("sat_bin_kernel_install_dir") - self.app_root_dir=self.environ.get("sat_app_root_dir") # four whitespaces for first indentation in a python script self.indent=" " @@ -473,6 +472,9 @@ class LauncherFileEnviron(FileEnviron): launcher_header=launcher_header2 else: launcher_header=launcher_header3 + # in case of Windows OS, Python scripts are not executable. PyExe ? + if src.architecture.is_windows(): + launcher_header = launcher_header.replace("#! /usr/bin/env python3",'') self.output.write(launcher_header\ .replace("BIN_KERNEL_INSTALL_DIR", self.bin_kernel_root_dir)) @@ -622,7 +624,7 @@ class LauncherFileEnviron(FileEnviron): def add_comment(self, comment): - # Special comment in case of the distène licence + # Special comment in case of the DISTENE licence if comment=="DISTENE license": self.output.write(self.indent+ "#"+ @@ -727,6 +729,15 @@ tcl_header="""\ bash_header="""\ #!/bin/bash +if [ "$BASH" = "" ] +then + # check that the user is not using another shell + echo + echo "Warning! SALOME environment not initialized" + echo "You must run this script in a bash shell." + echo "As you are using another shell. Please first run: bash" + echo +fi ########################################################################## # # This line is used only in case of a sat package @@ -759,7 +770,7 @@ out_dir_Path=os.path.dirname(os.path.realpath(__file__)) # Preliminary work to initialize path to SALOME Python modules def __initialize(): - sys.path[:0] = [ 'BIN_KERNEL_INSTALL_DIR' ] # to get salomeContext + sys.path[:0] = [ r'BIN_KERNEL_INSTALL_DIR' ] # to get salomeContext # define folder to store omniorb config (initially in virtual application folder) try: @@ -833,7 +844,7 @@ out_dir_Path=os.path.dirname(os.path.realpath(__file__)) # Preliminary work to initialize path to SALOME Python modules def __initialize(): - sys.path[:0] = [ 'BIN_KERNEL_INSTALL_DIR' ] + sys.path[:0] = [ r'BIN_KERNEL_INSTALL_DIR' ] # define folder to store omniorb config (initially in virtual application folder) try: