]> SALOME platform Git repositories - tools/sat.git/blob - data/env_scripts/Python.py
Salome HOME
Add config files and some code update for compilation of SALOME-7.8.0
[tools/sat.git] / data / env_scripts / Python.py
1 #!/usr/bin/env python
2 #-*- coding:utf-8 -*-
3
4 import os.path, platform
5
6 def set_env(env,prereq_dir,version,forBuild=None):
7     # keep only the first two version numbers
8     version = '.'.join(version.replace('-', '.').split('.')[:2])
9
10     env.set('PYTHONHOME', prereq_dir)
11         
12     # [CMake KERNEL] Nouveau nom pour PYTHONHOME = PYTHON_ROOT_DIR 22/03/2013
13     env.set('PYTHON_ROOT_DIR', prereq_dir)
14     root = env.get('PYTHON_ROOT_DIR')
15     
16     env.prepend('PATH', root)
17     env.prepend('PATH', os.path.join(root, 'bin'))
18
19     l = []
20     l.append(os.path.join(root, 'lib'))
21     #l.append(os.path.join(root, 'lib', 'python' + version))
22     
23     if platform.system() == "Windows" :
24         env.prepend('PATH', l)
25         env.set('PYTHON_INCLUDE', os.path.join(root, 'include'))
26         env.prepend('PYTHONPATH', os.path.join(root, 'Lib'))
27         env.prepend('PYTHONPATH', os.path.join(root, 'lib','site-packages'))
28
29         env.set('PYTHONBIN', os.path.join(root, 'python.exe'))  # needed for runSalome.py
30     else :
31         env.prepend('LD_LIBRARY_PATH', l)
32         env.set('PYTHON_INCLUDE', os.path.join(root, 'include', 'python' + version))
33         env.prepend('PYTHONPATH', os.path.join(root, 'lib', 'python' + version))
34         env.prepend('PYTHONPATH', os.path.join(root, 'lib', 'python' + version, 'site-packages'))
35
36         env.set('PYTHONBIN', os.path.join(root, 'bin','python'))  # needed for runSalome.py
37     
38     env.set('PYTHON_VERSION', version)
39
40
41 def set_nativ_env(env):
42     import sys
43     #env.set('PYTHONHOME',"%s.%s" % sys.version_info[0:2])
44     env.set('PYTHON_ROOT_DIR', '/usr')
45     env.set('PYTHON_VERSION', "%s.%s" % sys.version_info[0:2])
46     pass