3 # Copyright (C) 2010-2013 CEA/DEN
5 # This library is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU Lesser General Public
7 # License as published by the Free Software Foundation; either
8 # version 2.1 of the License.
10 # This library is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # Lesser General Public License for more details.
15 # You should have received a copy of the GNU Lesser General Public
16 # License along with this library; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 import src.debug as DBG
26 rem The following variables are used only in case of a sat package
27 set out_dir_Path=%~dp0
28 set PRODUCT_OUT_DIR=%out_dir_Path%
29 set prereq_install_Path=%out_dir_Path%\PREREQUISITES\INSTALL
30 set prereq_build_Path=%out_dir_Path%\PREREQUISITES\BUILD
36 ##########################################################################
39 # cleanup a path (first parameter) from duplicated entries;
40 # second parameter is the separator
42 out_var=`echo $1 | awk -v sep=$2 '{ \\
43 na = split($1,a,sep); \\
45 for(i=0;i<=na;i++) { \\
62 }' | sed -e 's|\\(.*\\)$1|\\1|g' -e 's|^[:;]||' -e 's|[:;]$||'`
69 out_var=`cleandup $xenv $2`
73 # The 3 following variables are used only in case of a sat package
74 export out_dir_Path=$(cd $(dirname ${BASH_SOURCE[0]});pwd)
75 export PRODUCT_OUT_DIR=${out_dir_Path}
76 export PRODUCT_ROOT_DIR=${PRODUCT_OUT_DIR}
78 ###########################################################################
82 [SALOME Configuration]
86 # a generated SALOME Configuration file using python syntax
89 def get_file_environ(output, shell, environ=None):
90 """Instantiate correct FileEnvironment sub-class.
92 :param output file: the output file stream.
93 :param shell str: the type of shell syntax to use.
94 :param environ dict: a potential additional environment.
97 return BashFileEnviron(output, environ)
99 return BatFileEnviron(output, environ)
100 if shell == "cfgForPy":
101 return LauncherFileEnviron(output, environ)
103 return ContextFileEnviron(output, environ)
104 raise Exception("FileEnviron: Unknown shell = %s" % shell)
106 class FileEnviron(object):
108 Base class for shell environment
110 def __init__(self, output, environ=None):
114 :param output file: the output file stream.
115 :param environ dict: a potential additional environment.
117 self._do_init(output, environ)
121 easy non exhaustive quick resume for debug print"""
123 "output" : self.output,
124 "environ" : self.environ,
126 return "%s(\n%s\n)" % (self.__class__.__name__, PP.pformat(res))
129 def _do_init(self, output, environ=None):
133 :param output file: the output file stream.
134 :param environ dict: a potential additional environment.
138 if environ is not None:
139 #if str(type(environ)) == "<type 'instance'>":
140 if id(environ) == id(os.environ):
141 DBG.tofix("set %s environ as python os.environ, are you sure it is safe ?" % self.__class__.__name__, True)
142 self.environ = environ
144 DBG.tofix("set %s environ as COPY of python os.environ, are you sure it is safe ?" % self.__class__.__name__, True)
145 self.environ = dict(os.environ) #make a copy cvw 180320
147 def add_line(self, number):
149 Add some empty lines in the shell file
151 :param number int: the number of lines to add
153 self.output.write("\n" * number)
155 def add_comment(self, comment):
157 Add a comment in the shell file
159 :param comment str: the comment to add
161 self.output.write("# %s\n" % comment)
163 def add_echo(self, text):
165 Add a "echo" in the shell file
167 :param text str: the text to echo
169 self.output.write('echo %s"\n' % text)
171 def add_warning(self, warning):
173 Add a warning "echo" in the shell file
175 :param warning str: the text to echo
177 self.output.write('echo "WARNING %s"\n' % warning)
179 def append_value(self, key, value, sep=os.pathsep):
181 append value to key using sep,
182 if value contains ":" or ";" then raise error
184 :param key str: the environment variable to append
185 :param value str: the value to append to key
186 :param sep str: the separator string
188 for c in [";", ":"]: # windows or linux path separators
190 raise Exception("FileEnviron append key '%s' value '%s' contains forbidden character '%s'" % (key, value, c))
191 self.set(key, self.get(key) + sep + value)
192 if (key, sep) not in self.toclean:
193 self.toclean.append((key, sep))
195 def append(self, key, value, sep=os.pathsep):
197 Same as append_value but the value argument can be a list
199 :param key str: the environment variable to append
200 :param value str or list: the value(s) to append to key
201 :param sep str: the separator string
203 if isinstance(value, list):
205 self.append_value(key, v, sep)
207 self.append_value(key, value, sep)
209 def prepend_value(self, key, value, sep=os.pathsep):
211 prepend value to key using sep,
212 if value contains ":" or ";" then raise error
214 :param key str: the environment variable to prepend
215 :param value str: the value to prepend to key
216 :param sep str: the separator string
218 for c in [";", ":"]: # windows or linux path separators
220 raise Exception("FileEnviron prepend key '%s' value '%s' contains forbidden character '%s'" % (key, value, c))
221 self.set(key, value + sep + self.get(key))
222 if (key, sep) not in self.toclean:
223 self.toclean.append((key, sep))
225 def prepend(self, key, value, sep=os.pathsep):
227 Same as prepend_value but the value argument can be a list
229 :param key str: the environment variable to prepend
230 :param value str or list: the value(s) to prepend to key
231 :param sep str: the separator string
233 if isinstance(value, list):
234 for v in reversed(value): # prepend list, first item at last to stay first
235 self.prepend_value(key, v, sep)
237 self.prepend_value(key, value, sep)
239 def is_defined(self, key):
241 Check if the key exists in the environment
243 :param key str: the environment variable to check
245 return (key in self.environ)
247 def set(self, key, value):
249 Set the environment variable 'key' to value 'value'
251 :param key str: the environment variable to set
252 :param value str: the value
254 raise NotImplementedError("set is not implement for this shell!")
258 Get the value of the environment variable "key"
260 :param key str: the environment variable
264 def command_value(self, key, command):
266 Get the value given by the system command "command"
267 and put it in the environment variable key.
268 Has to be overwritten in the derived classes
269 This can be seen as a virtual method
271 :param key str: the environment variable
272 :param command str: the command to execute
274 raise NotImplementedError("command_value is not implement "
277 def finish(self, required=True):
278 """Add a final instruction in the out file (in case of file generation)
280 :param required bool: Do nothing if required is False
282 for (key, sep) in self.toclean:
284 self.output.write('clean %s "%s"\n' % (key, sep))
286 class BashFileEnviron(FileEnviron):
288 Class for bash shell.
290 def __init__(self, output, environ=None):
293 :param output file: the output file stream.
294 :param environ dict: a potential additional environment.
296 self._do_init(output, environ)
297 self.output.write(bash_header)
299 def set(self, key, value):
300 """Set the environment variable "key" to value "value"
302 :param key str: the environment variable to set
303 :param value str: the value
305 self.output.write('export %s="%s"\n' % (key, value))
306 self.environ[key] = value
308 def command_value(self, key, command):
310 Get the value given by the system command "command"
311 and put it in the environment variable key.
312 Has to be overwritten in the derived classes
313 This can be seen as a virtual method
315 :param key str: the environment variable
316 :param command str: the command to execute
318 self.output.write('export %s=$(%s)\n' % (key, command))
320 def finish(self, required=True):
321 """Add a final instruction in the out file (in case of file generation)
323 :param required bool: Do nothing if required is False
327 FileEnviron.finish(self, required)
329 class BatFileEnviron(FileEnviron):
331 for Windows batch shell.
333 def __init__(self, output, environ=None):
336 :param output file: the output file stream.
337 :param environ dict: a potential additional environment.
339 self._do_init(output, environ)
340 self.output.write(bat_header)
342 def add_comment(self, comment):
343 """Add a comment in the shell file
345 :param comment str: the comment to add
347 self.output.write("rem %s\n" % comment)
350 """Get the value of the environment variable "key"
352 :param key str: the environment variable
354 return '%%%s%%' % key
356 def set(self, key, value):
357 """Set the environment variable "key" to value "value"
359 :param key str: the environment variable to set
360 :param value str: the value
362 self.output.write('set %s=%s\n' % (key, value))
363 self.environ[key] = value
365 def command_value(self, key, command):
367 Get the value given by the system command "command"
368 and put it in the environment variable key.
369 Has to be overwritten in the derived classes
370 This can be seen as a virtual method
372 :param key str: the environment variable
373 :param command str: the command to execute
375 self.output.write('%s > tmp.txt\n' % (command))
376 self.output.write('set /p %s =< tmp.txt\n' % (key))
378 def finish(self, required=True):
380 Add a final instruction in the out file (in case of file generation)
381 In the particular windows case, do nothing
383 :param required bool: Do nothing if required is False
387 class ContextFileEnviron(FileEnviron):
388 """Class for a salome context configuration file.
390 def __init__(self, output, environ=None):
393 :param output file: the output file stream.
394 :param environ dict: a potential additional environment.
396 self._do_init(output, environ)
397 self.output.write(cfg_header)
399 def set(self, key, value):
400 """Set the environment variable "key" to value "value"
402 :param key str: the environment variable to set
403 :param value str: the value
405 self.output.write('%s="%s"\n' % (key, value))
406 self.environ[key] = value
409 """Get the value of the environment variable "key"
411 :param key str: the environment variable
413 return '%({0})s'.format(key)
415 def command_value(self, key, command):
417 Get the value given by the system command "command"
418 and put it in the environment variable key.
419 Has to be overwritten in the derived classes
420 This can be seen as a virtual method
422 :param key str: the environment variable
423 :param command str: the command to execute
425 raise NotImplementedError("command_value is not implement "
426 "for salome context files!")
428 def add_echo(self, text):
431 :param text str: the comment to add
433 self.add_comment(text)
435 def add_warning(self, warning):
438 :param text str: the warning to add
440 self.add_comment("WARNING %s" % warning)
442 def prepend_value(self, key, value, sep=os.pathsep):
443 """prepend value to key using sep
445 :param key str: the environment variable to prepend
446 :param value str: the value to prepend to key
447 :param sep str: the separator string
449 self.output.write('ADD_TO_%s: %s\n' % (key, value))
451 def append_value(self, key, value, sep=os.pathsep):
452 """append value to key using sep
454 :param key str: the environment variable to append
455 :param value str: the value to append to key
456 :param sep str: the separator string
458 self.prepend_value(key, value)
460 def finish(self, required=True):
461 """Add a final instruction in the out file (in case of file generation)
463 :param required bool: Do nothing if required is False
467 def special_path_separator(name):
469 TCLLIBPATH, TKLIBPATH, PV_PLUGIN_PATH environments variables need
470 some exotic path separator.
471 This function gives the separator regarding the name of the variable
472 to append or prepend.
474 :param name str: The name of the variable to find the separator
476 special_blanks_keys=["TCLLIBPATH", "TKLIBPATH"]
477 special_semicolon_keys=["PV_PLUGIN_PATH"]
479 if name in special_blanks_keys: res=" "
480 if name in special_semicolon_keys: res=";"
483 class LauncherFileEnviron:
485 Class to generate a launcher file script
486 (in python syntax) SalomeContext API
488 def __init__(self, output, environ=None):
491 :param output file: the output file stream.
492 :param environ dict: a potential additional environment.
496 if environ is not None:
497 self.environ = environ
499 self.environ = os.environ
500 # Initialize some variables
501 if not "PATH" in self.environ.keys():
502 self.environ["PATH"]=""
503 if not "LD_LIBRARY_PATH" in self.environ.keys():
504 self.environ["LD_LIBRARY_PATH"]=""
505 if not "PYTHONPATH" in self.environ.keys():
506 self.environ["PYTHONPATH"]=""
507 if not "TCLLIBPATH" in self.environ.keys():
508 self.environ["TCLLIBPATH"]=""
509 if not "TKLIBPATH" in self.environ.keys():
510 self.environ["TKLIBPATH"]=""
512 # four whitespaces for first indentation in a python script
514 self.prefix="context."
515 self.setVarEnv="setVariable"
517 self.begin=self.indent+self.prefix
518 self.output.write(Launcher_header)
519 self.specialKeys={"PATH": "Path",
520 "LD_LIBRARY_PATH": "LdLibraryPath",
521 "PYTHONPATH": "PythonPath"}
523 def change_to_launcher(self, value):
527 def add_line(self, number):
528 """Add some empty lines in the launcher file
530 :param number int: the number of lines to add
532 self.output.write("\n" * number)
534 def add_echo(self, text):
537 :param text str: the comment to add
539 self.output.write('# %s"\n' % text)
541 def add_warning(self, warning):
544 :param text str: the warning to add
546 self.output.write('# "WARNING %s"\n' % warning)
548 def append_value(self, key, value, sep=":"):
549 """append value to key using sep,
550 if value contains ":" or ";" then raise error
552 :param key str: the environment variable to append
553 :param value str: the value to append to key
554 :param sep str: the separator string
556 for c in [";", ":"]: # windows or linux path separators
558 raise Exception("LauncherFileEnviron append key '%s' value '%s' contains forbidden character '%s'" % (key, value, c))
559 if self.is_defined(key) :
564 def append(self, key, value, sep=":"):
565 """Same as append_value but the value argument can be a list
567 :param key str: the environment variable to append
568 :param value str or list: the value(s) to append to key
569 :param sep str: the separator string
571 if isinstance(value, list):
573 self.append_value(key, v, sep)
575 self.append_value(key, value, sep)
577 def prepend_value(self, key, value, sep=":"):
578 """prepend value to key using sep,
579 if value contains ":" or ";" then raise error
581 :param key str: the environment variable to prepend
582 :param value str: the value to prepend to key
583 :param sep str: the separator string
585 for c in [";", ":"]: # windows or linux path separators
587 raise Exception("LauncherFileEnviron prepend key '%s' value '%s' contains forbidden character '%s'" % (key, value, c))
588 if self.is_defined(key) :
593 def prepend(self, key, value, sep=":"):
594 """Same as prepend_value but the value argument can be a list
596 :param key str: the environment variable to prepend
597 :param value str or list: the value(s) to prepend to key
598 :param sep str: the separator string
600 if isinstance(value, list):
602 self.prepend_value(key, v, sep)
604 self.prepend_value(key, value, sep)
606 def is_defined(self, key):
607 """Check if the key exists in the environment
609 :param key str: the environment variable to check
611 return key in self.environ.keys()
614 """Get the value of the environment variable "key"
616 :param key str: the environment variable
620 def set(self, key, value):
621 """Set the environment variable "key" to value "value"
623 :param key str: the environment variable to set
624 :param value str: the value
626 self.output.write(self.begin+self.setVarEnv+
627 '(r"%s", r"%s", overwrite=True)\n' %
628 (key, self.change_to_launcher(value)))
629 self.environ[key] = value
631 def add(self, key, value):
632 """prepend value to key using sep
634 :param key str: the environment variable to prepend
635 :param value str: the value to prepend to key
637 if key in self.specialKeys.keys():
638 self.output.write(self.begin+'addTo%s(r"%s")\n' %
639 (self.specialKeys[key],
640 self.change_to_launcher(value)))
641 self.environ[key]+=":"+value
643 sep=special_path_separator(key)
644 self.output.write(self.indent+
645 '#temporary solution!!! have to be defined in API a '
646 '?dangerous? addToSpecial(r"%s", r"%s")\n' %
648 #pathsep not precised because do not know future os launch?
649 self.output.write(self.begin+'addToSpecial(r"%s", r"%s")\n'
650 % (key, self.change_to_launcher(value)))
651 self.environ[key]+=sep+value #here yes we know os for current execution
653 def command_value(self, key, command):
655 Get the value given by the system command "command"
656 and put it in the environment variable key.
658 :param key str: the environment variable
659 :param command str: the command to execute
661 self.output.write(self.indent+'#`%s`\n' % command)
663 import shlex, subprocess
664 args = shlex.split(command)
665 res=subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
666 out, __ = res.communicate()
667 self.output.write(self.begin+
669 '(r"%s", r"%s", overwrite=True)\n' % (key, out))
671 def add_comment(self, comment):
672 # Special comment in case of the distène licence
673 if comment=="DISTENE license":
674 self.output.write(self.indent+
678 '(r"%s", r"%s", overwrite=True)\n' %
679 ('DISTENE_LICENSE_FILE',
680 self.change_to_launcher(
681 'Use global envvar: DLIM8VAR')))
682 self.output.write(self.indent+
686 '(r"%s", r"%s", overwrite=True)\n' %
688 self.change_to_launcher(
691 if "setting environ for" in comment:
692 self.output.write(self.indent+"#[%s]\n" %
693 comment.split("setting environ for ")[1])
696 self.output.write(self.indent+"# %s\n" % comment)
698 def finish(self, required=True):
700 Add a final instruction in the out file (in case of file generation)
701 In the particular launcher case, do nothing
703 :param required bool: Do nothing if required is False
707 class ScreenEnviron(FileEnviron):
708 def __init__(self, output, environ=None):
709 self._do_init(output, environ)
712 def add_line(self, number):
715 def add_comment(self, comment):
718 def add_echo(self, text):
721 def add_warning(self, warning):
724 def write(self, command, name, value, sign="="):
726 self.output.write(" %s%s %s %s %s\n" % \
727 (src.printcolors.printcLabel(command),
728 " " * (12 - len(command)),
729 src.printcolors.printcInfo(name), sign, value))
731 def is_defined(self, name):
732 return self.defined.has_key(name)
735 return "${%s}" % name
737 def set(self, name, value):
738 self.write("set", name, value)
739 self.defined[name] = value
741 def prepend(self, name, value, sep=":"):
742 if isinstance(value, list):
743 value = sep.join(value)
744 value = value + sep + self.get(name)
745 self.write("prepend", name, value)
747 def append(self, name, value, sep=":"):
748 if isinstance(value, list):
749 value = sep.join(value)
750 value = self.get(name) + sep + value
751 self.write("append", name, value)
753 def command_value(self, key, command):
756 def run_env_script(self, module, script):
757 self.write("load", script, "", sign="")
759 # The SALOME launcher template
761 #! /usr/bin/env python
763 ################################################################
764 # WARNING: this file is automatically generated by SalomeTools #
765 # WARNING: and so could be overwritten at any time. #
766 ################################################################
773 # Add the pwdPath to able to run the launcher after unpacking a package
774 # Used only in case of a salomeTools package
775 out_dir_Path=os.path.dirname(os.path.realpath(__file__))
777 # Preliminary work to initialize path to SALOME Python modules
780 sys.path[:0] = [ 'BIN_KERNEL_INSTALL_DIR' ]
781 os.environ['ABSOLUTE_APPLI_PATH'] = 'KERNEL_INSTALL_DIR'
783 # define folder to store omniorb config (initially in virtual application folder)
785 from salomeContextUtils import setOmniOrbUserPath
787 except Exception as e:
790 # End of preliminary work
792 # salome doc only works for virtual applications. Therefore we overwrite it with this function
793 def _showDoc(modules):
794 for module in modules:
795 modulePath = os.getenv(module+"_ROOT_DIR")
796 if modulePath != None:
797 baseDir = os.path.join(modulePath, "share", "doc", "salome")
798 docfile = os.path.join(baseDir, "gui", module.upper(), "index.html")
799 if not os.path.isfile(docfile):
800 docfile = os.path.join(baseDir, "tui", module.upper(), "index.html")
801 if not os.path.isfile(docfile):
802 docfile = os.path.join(baseDir, "dev", module.upper(), "index.html")
803 if os.path.isfile(docfile):
804 out, err = subprocess.Popen(["xdg-open", docfile]).communicate()
806 print "Online documentation is not accessible for module:", module
808 print module+"_ROOT_DIR not found!"
811 # Identify application path then locate configuration files
814 if args == ['--help']:
815 from salomeContext import usage
819 #from salomeContextUtils import getConfigFileNames
820 #configFileNames, args, unexisting = getConfigFileNames( args, checkExistence=True )
821 #if len(unexisting) > 0:
822 # print "ERROR: unexisting configuration file(s): " + ', '.join(unexisting)
825 # Create a SalomeContext which parses configFileNames to initialize environment
827 from salomeContext import SalomeContext, SalomeContextException
828 SalomeContext.addToSpecial=addToSpecial
829 context = SalomeContext(None)
831 # Here set specific variables, if needed
832 # context.addToPath('mypath')
833 # context.addToLdLibraryPath('myldlibrarypath')
834 # context.addToPythonPath('mypythonpath')
835 # context.setVariable('myvarname', 'value')
838 context.getLogger().setLevel(40)
840 context.setVariable(r"PRODUCT_ROOT_DIR", out_dir_Path, overwrite=True)
841 # here your local standalone environment
843 if len(args) >1 and args[0]=='doc':
847 # Start SALOME, parsing command line arguments
848 out, err, status = context.runSalome(args)
851 except SalomeContextException, e:
853 logging.getLogger("salome").error(e)
856 def addToSpecial(self, name, value, pathSep=None):
857 # add special dangerous cases: TCLLIBPATH PV_PLUGIN_PATH etc...
858 # http://computer-programming-forum.com/57-tcl/1dfddc136afccb94.htm
859 # TCLLIBPATH: Tcl treats the contents of that variable as a list. Be happy, for you can now use drive letters on windows.
863 specialBlanksKeys=["TCLLIBPATH", "TKLIBPATH"]
864 specialSemicolonKeys=["PV_PLUGIN_PATH"]
866 if name in specialBlanksKeys: res=" "
867 if name in specialSemicolonKeys: res=";"
873 value = os.path.expandvars(value) # expand environment variables
874 self.getLogger().debug("Add to %s: %s", name, value)
875 env = os.getenv(name, None)
877 os.environ[name] = value
879 os.environ[name] = value + sep + env #explicitely or not special path separator ?whitespace, semicolon?
881 if __name__ == "__main__":
888 #! /usr/bin/env python3
890 ################################################################
891 # WARNING: this file is automatically generated by SalomeTools #
892 # WARNING: and so could be overwritten at any time. #
893 ################################################################
900 # Add the pwdPath to able to run the launcher after unpacking a package
901 # Used only in case of a salomeTools package
902 out_dir_Path=os.path.dirname(os.path.realpath(__file__))
904 # Preliminary work to initialize path to SALOME Python modules
907 sys.path[:0] = [ 'BIN_KERNEL_INSTALL_DIR' ]
908 os.environ['ABSOLUTE_APPLI_PATH'] = 'KERNEL_INSTALL_DIR'
910 # define folder to store omniorb config (initially in virtual application folder)
912 from salomeContextUtils import setOmniOrbUserPath
914 except Exception as e:
917 # End of preliminary work
919 # salome doc only works for virtual applications. Therefore we overwrite it with this function
920 def _showDoc(modules):
921 for module in modules:
922 modulePath = os.getenv(module+"_ROOT_DIR")
923 if modulePath != None:
924 baseDir = os.path.join(modulePath, "share", "doc", "salome")
925 docfile = os.path.join(baseDir, "gui", module.upper(), "index.html")
926 if not os.path.isfile(docfile):
927 docfile = os.path.join(baseDir, "tui", module.upper(), "index.html")
928 if not os.path.isfile(docfile):
929 docfile = os.path.join(baseDir, "dev", module.upper(), "index.html")
930 if os.path.isfile(docfile):
931 out, err = subprocess.Popen(["xdg-open", docfile]).communicate()
933 print("Online documentation is not accessible for module:", module)
935 print(module+"_ROOT_DIR not found!")
938 # Identify application path then locate configuration files
941 if args == ['--help']:
942 from salomeContext import usage
946 #from salomeContextUtils import getConfigFileNames
947 #configFileNames, args, unexisting = getConfigFileNames( args, checkExistence=True )
948 #if len(unexisting) > 0:
949 # print("ERROR: unexisting configuration file(s): " + ', '.join(unexisting))
952 # Create a SalomeContext which parses configFileNames to initialize environment
954 from salomeContext import SalomeContext, SalomeContextException
955 SalomeContext.addToSpecial=addToSpecial
956 context = SalomeContext(None)
958 # Here set specific variables, if needed
959 # context.addToPath('mypath')
960 # context.addToLdLibraryPath('myldlibrarypath')
961 # context.addToPythonPath('mypythonpath')
962 # context.setVariable('myvarname', 'value')
965 context.getLogger().setLevel(40)
967 context.setVariable(r"PRODUCT_ROOT_DIR", out_dir_Path, overwrite=True)
968 # here your local standalone environment
970 if len(args) >1 and args[0]=='doc':
974 # Start SALOME, parsing command line arguments
975 out, err, status = context.runSalome(args)
978 except SalomeContextException as e:
980 logging.getLogger("salome").error(e)
983 def addToSpecial(self, name, value, pathSep=None):
984 # add special dangerous cases: TCLLIBPATH PV_PLUGIN_PATH etc...
985 # http://computer-programming-forum.com/57-tcl/1dfddc136afccb94.htm
986 # TCLLIBPATH: Tcl treats the contents of that variable as a list. Be happy, for you can now use drive letters on windows.
990 specialBlanksKeys=["TCLLIBPATH", "TKLIBPATH"]
991 specialSemicolonKeys=["PV_PLUGIN_PATH"]
993 if name in specialBlanksKeys: res=" "
994 if name in specialSemicolonKeys: res=";"
1000 value = os.path.expandvars(value) # expand environment variables
1001 self.getLogger().debug("Add to %s: %s", name, value)
1002 env = os.getenv(name, None)
1004 os.environ[name] = value
1006 os.environ[name] = value + sep + env #explicitely or not special path separator ?whitespace, semicolon?
1008 if __name__ == "__main__":