fpid = open(filedict, 'r')
#
from salome_utils import generateFileName
- if sys.platform == "win32":
+ if sys.platform == "win32":
username = os.getenv( "USERNAME" )
- else:
+ else:
username = os.getenv('USER')
path = os.path.join('/tmp/logs', username)
fpidomniNames = generateFileName(path,
# 3. return corrected parameters values
return standalone, embedded
-
+
# -----------------------------------------------------------------------------
###
action="store",
dest="test_script_file",
help=help_str)
-
+
# Reproducing test script with help of TestRecorder. Default: False.
help_str = "Reproducing test script with help of TestRecorder."
o_play = optparse.Option("--play",
action="store_true",
dest="gdb_session", default=False,
help=help_str)
-
+
# ddd session
help_str = "Launch session with ddd"
o_ddd = optparse.Option("--ddd-session",
action="store_true",
dest="ddd_session", default=False,
help=help_str)
-
+
# valgrind session
help_str = "Launch session with valgrind $VALGRIND_OPTIONS"
action="callback", callback=store_boolean, callback_args=('shutdown_servers',),
dest="shutdown_servers",
help=help_str)
-
+
# All options
opt_list = [o_t,o_g, # GUI/Terminal
o_d,o_o, # Desktop
# - The directories which are inspected are checked for files "<appname?salomeappname>.xml"
# (SalomeApp.xml) which define SALOME configuration
# - These directories are analyzed beginning from the last one in the list,
- # so the first directory listed in "<appname>Config" environment variable
+ # so the first directory listed in "<appname>Config" environment variable
# has higher priority: it means that if some configuration options
# is found in the next analyzed cofiguration file - it will be replaced
# - The last configuration file which is parsed is user configuration file
sys.exit(0)
pass
- # set resources variable SalomeAppConfig if it is not set yet
+ # set resources variable SalomeAppConfig if it is not set yet
dirs = []
if os.getenv(config_var):
if sys.platform == 'win32':
gui_available = True
if os.getenv("GUI_ROOT_DIR") and os.path.isdir( os.getenv("GUI_ROOT_DIR") + "/share/salome/resources/gui" ):
dirs += [os.getenv("GUI_ROOT_DIR") + "/share/salome/resources/gui"]
- pass
+ pass
else:
- gui_available = False
- if os.getenv("KERNEL_ROOT_DIR") and os.path.isdir( os.getenv("KERNEL_ROOT_DIR") + "/bin/salome/appliskel" ):
- dirs += [os.getenv("KERNEL_ROOT_DIR") + "/bin/salome/appliskel"]
- pass
+ gui_available = False
+ if os.getenv("KERNEL_ROOT_DIR") and os.path.isdir( os.getenv("KERNEL_ROOT_DIR") + "/bin/salome/appliskel" ):
+ dirs += [os.getenv("KERNEL_ROOT_DIR") + "/bin/salome/appliskel"]
+ pass
os.environ[config_var] = separator.join(dirs)
dirs.reverse() # reverse order, like in "path" variable - FILO-style processing
dirs.remove('') # to remove empty dirs if the variable terminate by ":" or if there are "::" inside
except:
pass
-
+
_opts = {} # associative array of options to be filled
# parse SalomeApp.xml files in directories specified by SalomeAppConfig env variable
args[batch_nam] = True
if not gui_available:
- args[gui_nam] = False
-
+ args[gui_nam] = False
+
if args[gui_nam]:
args["session_gui"] = True
if cmd_opts.desktop is not None:
if cmd_opts.py_scripts is not None:
listlist = cmd_opts.py_scripts
for listi in listlist:
- if os.sys.platform == 'win32':
+ if os.sys.platform == 'win32':
args[script_nam] += re.split( "[;,]", listi)
- else:
+ else:
args[script_nam] += re.split( "[:;,]", listi)
for arg in cmd_args:
if arg[-3:] == ".py":
# Interactive python console
if cmd_opts.pinter is not None:
args[pinter_nam] = cmd_opts.pinter
-
+
# Gdb session in xterm
if cmd_opts.gdb_session is not None:
args[gdb_session_nam] = cmd_opts.gdb_session
else:
args[shutdown_servers_nam] = cmd_opts.shutdown_servers
pass
-
+
####################################################
# Add <theAdditionalOptions> values to args
for add_opt in theAdditionalOptions:
args[test_nam] = []
filename = cmd_opts.test_script_file
args[test_nam] += re.split( "[:;,]", filename )
-
+
# Play
if cmd_opts.play_script_file is not None:
args[play_nam] = []
os.system( "mkdir " + '"' + path + '"' )
else:
os.system( "rm -rf " + path + "/*" )
- pass
- pass
else:
- dirs = path.split("/")
- shift1 = shift2 = 0
- if not dirs[0]: shift1 = 1
- if dirs[-1]: shift2 = 1
- for i in range(1+shift1,len(dirs)+shift2):
- p = "/".join(dirs[:i])
- try:
- os.mkdir(p, mode)
- os.chmod(p, mode)
- except:
- pass
- pass
- pass
- pass
+ dirs = path.split("/")
+ shift1 = shift2 = 0
+ if not dirs[0]: shift1 = 1
+ if dirs[-1]: shift2 = 1
+ for i in range(1+shift1,len(dirs)+shift2):
+ p = "/".join(dirs[:i])
+ try:
+ os.mkdir(p, mode)
+ os.chmod(p, mode)
+ except:
+ pass
# ---
# create temporary directory for environment files needed by modules from the list
port = getPortNumber(False)
if port:
- tmp_dir = getTmpDir()
- env_dir = generateFileName(tmp_dir, prefix="env", with_port=True)
- makeTmpDir(env_dir)
- pass
+ tmp_dir = getTmpDir()
+ env_dir = generateFileName(tmp_dir, prefix="env", with_port=True)
+ makeTmpDir(env_dir)
+ pass
python_version="python%d.%d" % sys.version_info[0:2]
modules_root_dir_list = []
salome_subdir,
"shared_modules"),
"PYTHONPATH")
-
+
# set environment by modules from the list
if port:
try:
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-"""Create a virtual Salome installation
+"""Create a virtual Salome installation
Based on a script created by Ian Bicking.
if not options.module:
print "Option module is mandatory"
- return
-
+ return
+
module_dir=os.path.abspath(options.module)
if not os.path.exists(module_dir):
print "Module %s does not exist" % module_dir
rmtree(doc_dir)
rmtree(sharedoc_dir)
pass
-
+
#directory bin/salome : create it and link content
if os.path.exists(module_bin_dir):
mkdir(bin_dir)
else:
if verbose:
print module_bin_dir, " doesn't exist"
- pass
-
+ pass
+
#directory idl/salome : create it and link content
if os.path.exists(module_idl_dir):
mkdir(idl_dir)
else:
if verbose:
print module_lib_dir, " doesn't exist"
- pass
-
+ pass
+
#directory lib/pyversio/site-packages/salome : create it and link content
if not os.path.exists(module_lib_py_dir):
print "Python directory %s does not exist" % module_lib_py_dir
else:
- # __GBO__ specific action for the package salome
- module_lib_pypkg_dir=os.path.join(module_lib_py_dir,"salome")
- lib_pypkg_dir=os.path.join(lib_py_dir,"salome")
- mkdir(lib_pypkg_dir)
- # __GBO__
+ # __GBO__ specific action for the package salome
+ module_lib_pypkg_dir=os.path.join(module_lib_py_dir,"salome")
+ lib_pypkg_dir=os.path.join(lib_py_dir,"salome")
+ mkdir(lib_pypkg_dir)
+ # __GBO__
mkdir(lib_py_shared_dir)
for fn in os.listdir(module_lib_py_dir):
if fn == "shared_modules": continue
- # __GBO__
- if fn == "salome": continue
- # __GBO__
+ # __GBO__
+ if fn == "salome": continue
+ # __GBO__
symlink(os.path.join(module_lib_py_dir, fn), os.path.join(lib_py_dir, fn))
- pass
+ pass
if os.path.exists(module_lib_py_shared_dir):
for fn in os.listdir(module_lib_py_shared_dir):
symlink(os.path.join(module_lib_py_shared_dir, fn), os.path.join(lib_py_shared_dir, fn))
pass
pass
- # __GBO__
- if os.path.exists(module_lib_pypkg_dir):
- for fn in os.listdir(module_lib_pypkg_dir):
- symlink(os.path.join(module_lib_pypkg_dir, fn), os.path.join(lib_pypkg_dir, fn))
- pass
- pass
- # __GBO__
+ # __GBO__
+ if os.path.exists(module_lib_pypkg_dir):
+ for fn in os.listdir(module_lib_pypkg_dir):
+ symlink(os.path.join(module_lib_pypkg_dir, fn), os.path.join(lib_pypkg_dir, fn))
+ pass
+ pass
+ # __GBO__
else:
if verbose:
print module_lib_py_shared_dir, " doesn't exist"
- pass
+ pass
#directory share/doc/salome (KERNEL doc) : create it and link content
if os.path.exists(module_sharedoc_dir):
symlink(os.path.join(module_sharedoc_gui_dir, fn), os.path.join(sharedoc_gui_dir, fn))
pass
pass
-
+
#directory share/doc/salome/tui : create it and link content
if os.path.exists(module_sharedoc_tui_dir):
mkdir(sharedoc_tui_dir)
symlink(os.path.join(module_doc_dir, fn), os.path.join(doc_dir, fn))
pass
pass
-
+
#directory doc/salome/gui : create it and link content
if os.path.exists(module_doc_gui_dir):
mkdir(doc_gui_dir)
symlink(os.path.join(module_doc_gui_dir, fn), os.path.join(doc_gui_dir, fn))
pass
pass
-
+
#directory doc/salome/tui : create it and link content
if os.path.exists(module_doc_tui_dir):
mkdir(doc_tui_dir)
parser.add_option('--prefix', dest="prefix", default='.',
help="The base directory to install to (default .)")
- parser.add_option('--module', dest="module",
+ parser.add_option('--module', dest="module",
help="The module directory to install in (mandatory)")
parser.add_option('--clear', dest='clear', action='store_true',
options, args = parser.parse_args()
link_module(options)
pass
-
+
# -----------------------------------------------------------------------------
if __name__ == '__main__':