From 88e9afdefe299286d99d1bb2fe10e3f1406d868d Mon Sep 17 00:00:00 2001 From: caremoli Date: Fri, 19 Sep 2008 17:17:47 +0000 Subject: [PATCH] CCAR: in Salome application generation, try to detect the python version used for modules and application installation independently from the version of the python interpreter used. --- bin/virtual_salome.py | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/bin/virtual_salome.py b/bin/virtual_salome.py index 401b9ccab..b5280a375 100644 --- a/bin/virtual_salome.py +++ b/bin/virtual_salome.py @@ -97,11 +97,30 @@ def link_module(options): return home_dir = os.path.expanduser(options.prefix) + #try to find python version of salome application and put it in versio + pys=[os.path.split(s)[1] for s in glob.glob(os.path.join(home_dir,get_lib_dir(),"python*.*"))] + if not pys : + versio=None + else: + versio=pys[0] + + pys=[os.path.split(s)[1] for s in glob.glob(os.path.join(module_dir,get_lib_dir(),"python*.*"))] + #check if the module has a python version compatible with application version + if not pys : + pyversio=versio or py_version + elif versio is None: + pyversio=pys[0] + elif versio in pys: + pyversio=versio + else: + #incompatible python versions + print "incompatible python versions : application has version %s and module %s has not" % (versio,module_dir) + return module_bin_dir=os.path.join(module_dir,'bin','salome') module_lib_dir=os.path.join(module_dir,get_lib_dir(),'salome') - module_lib_py_dir=os.path.join(module_dir,get_lib_dir(),py_version,'site-packages','salome') - module_lib_py_shared_dir=os.path.join(module_dir,get_lib_dir(),py_version, + module_lib_py_dir=os.path.join(module_dir,get_lib_dir(),pyversio,'site-packages','salome') + module_lib_py_shared_dir=os.path.join(module_dir,get_lib_dir(),pyversio, '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') @@ -113,8 +132,8 @@ def link_module(options): 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, + lib_py_dir=os.path.join(home_dir,'lib',pyversio,'site-packages','salome') + lib_py_shared_dir=os.path.join(home_dir,'lib',pyversio, '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') @@ -157,7 +176,7 @@ def link_module(options): print module_lib_dir, " doesn't exist" pass - #directory lib/py_version/site-packages/salome : create it and link content + #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: -- 2.39.2