]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
CCAR: in Salome application generation, try to detect the python version V4_1_4a1
authorcaremoli <caremoli>
Fri, 19 Sep 2008 17:17:47 +0000 (17:17 +0000)
committercaremoli <caremoli>
Fri, 19 Sep 2008 17:17:47 +0000 (17:17 +0000)
used for modules and application installation independently from the version
of the python interpreter used.

bin/virtual_salome.py

index 401b9ccabe9a34bf736ea8e96d2fc49ee4f631f8..b5280a375b0689aadfe3a95842928a12256ff87c 100644 (file)
@@ -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: