else:
if verbose:
print 'Directory %s already exists' % path
+ pass
+ pass
def symlink(src, dest):
"""Create a link if it does not exist"""
if not os.path.exists(dest):
if verbose:
print 'Creating symlink %s' % dest
+ pass
os.symlink(src, dest)
else:
print 'Symlink %s already exists' % dest
+ pass
+ pass
def rmtree(dir):
"""Remove (recursive) a directory if it exists"""
else:
if verbose:
print 'Do not need to delete %s; already gone' % dir
+ pass
+ pass
+ pass
def main():
usage="""usage: %prog [options]
parser = optparse.OptionParser(usage=usage)
parser.add_option('-v', '--verbose', action='count', dest='verbose',
- default=0, help="Increase verbosity")
+ default=0, help="Increase verbosity")
parser.add_option('--prefix', dest="prefix", default='.',
- help="The base directory to install to (default .)")
+ help="The base directory to install to (default .)")
parser.add_option('--module', dest="module",
- help="The module directory to install in (mandatory)")
+ help="The module directory to install in (mandatory)")
parser.add_option('--clear', dest='clear', action='store_true',
help="Clear out the install and start from scratch")
global verbose
if not options.module:
- print "Option module is mandatory"
- return
-
+ print "Option module is mandatory"
+ return
+
module_dir=options.module
if not os.path.exists(module_dir):
- print "Module %s does not exist" % module_dir
- return
+ print "Module %s does not exist" % module_dir
+ return
home_dir = os.path.expanduser(options.prefix)
module_bin_dir=os.path.join(module_dir,'bin','salome')
module_lib_dir=os.path.join(module_dir,'lib','salome')
module_lib_py_dir=os.path.join(module_dir,'lib',py_version,'site-packages','salome')
- module_lib_py_shared_dir=os.path.join(module_dir,'lib',py_version,'site-packages','salome','shared_modules')
+ module_lib_py_shared_dir=os.path.join(module_dir,'lib',py_version,
+ 'site-packages','salome','shared_modules')
module_share_dir=os.path.join(module_dir,'share','salome','resources')
module_doc_gui_dir=os.path.join(module_dir,'doc','salome','gui')
module_doc_tui_dir=os.path.join(module_dir,'doc','salome','tui')
module_doc_dir=os.path.join(module_dir,'doc','salome')
if not os.path.exists(module_lib_py_dir):
- print "Python directory %s does not exist" % module_lib_py_dir
- return
+ print "Python directory %s does not exist" % module_lib_py_dir
+ return
bin_dir=os.path.join(home_dir,'bin','salome')
lib_dir=os.path.join(home_dir,'lib','salome')
lib_py_dir=os.path.join(home_dir,'lib',py_version,'site-packages','salome')
- lib_py_shared_dir=os.path.join(home_dir,'lib',py_version,'site-packages','salome','shared_modules')
+ lib_py_shared_dir=os.path.join(home_dir,'lib',py_version,
+ 'site-packages','salome','shared_modules')
share_dir=os.path.join(home_dir,'share','salome','resources')
doc_gui_dir=os.path.join(home_dir,'doc','salome','gui')
doc_tui_dir=os.path.join(home_dir,'doc','salome','tui')
rmtree(lib_dir)
rmtree(share_dir)
rmtree(doc_dir)
-
+ pass
+
#directory bin/salome : create it and link content
mkdir(bin_dir)
for fn in os.listdir(module_bin_dir):
-# if os.path.splitext(fn)[1] not in (".pyc",".pyo"): #Compiled python are excluded
- symlink(os.path.join(module_bin_dir, fn), os.path.join(bin_dir, fn))
-
+ # if os.path.splitext(fn)[1] not in (".pyc",".pyo"): #Compiled python are excluded
+ symlink(os.path.join(module_bin_dir, fn), os.path.join(bin_dir, fn))
+ pass
+
#directory lib/salome : create it and link content
mkdir(lib_dir)
for fn in os.listdir(module_lib_dir):
#directory lib/py_version/site-packages/salome : create it and link content
mkdir(lib_py_shared_dir)
for fn in os.listdir(module_lib_py_dir):
-# if os.path.splitext(fn)[1] not in (".pyc",".pyo"): #Compiled python are excluded
- symlink(os.path.join(module_lib_py_dir, fn), os.path.join(lib_py_dir, fn))
- for fn in os.listdir(module_lib_py_shared_dir):
-# if os.path.splitext(fn)[1] not in (".pyc",".pyo"): #Compiled python are excluded
- symlink(os.path.join(module_lib_py_shared_dir, fn), os.path.join(lib_py_shared_dir, fn))
+ # if os.path.splitext(fn)[1] not in (".pyc",".pyo"): #Compiled python are excluded
+ if os.path.split(fn)[1] != "shared_modules":
+ 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):
+ # if os.path.splitext(fn)[1] not in (".pyc",".pyo"): #Compiled python are excluded
+ symlink(os.path.join(module_lib_py_shared_dir, fn), os.path.join(lib_py_shared_dir, fn))
+ pass
+ pass
+ else:
+ print module_lib_py_shared_dir, " doesn't exist"
+ pass
+
#directory share/salome/resources : create it and link content
mkdir(share_dir)
if fn == 'gui':continue
if fn == 'tui':continue
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)
for fn in os.listdir(module_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)
for fn in os.listdir(module_doc_tui_dir):
symlink(os.path.join(module_doc_tui_dir, fn), os.path.join(doc_tui_dir, fn))
-
+ pass
+ pass
+
if __name__ == '__main__':
main()
-
+ pass