Skip to content

Commit

Permalink
Merge pull request #508 from underworldcode/py_config
Browse files Browse the repository at this point in the history
Tweak for Python config script.
  • Loading branch information
jmansour committed Oct 11, 2020
2 parents 29b2dec + 0393486 commit a369589
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 16 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Release 2.11.0 []
-----------------
Changes
* Enabled user defined Gauss integration swarms for all systems.
* Cleaner Python compile time configuration.

New:
* Added `underworld.function.count()` method, which counts function calls.
Expand Down
28 changes: 12 additions & 16 deletions underworld/libUnderworld/config/packages/Python.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
from config import Package
from distutils.sysconfig import get_python_inc, get_python_lib, get_python_version
import os

class Python(Package):

def gen_locations(self):
python_inc = get_python_inc()
python_base = os.path.dirname(os.path.dirname(get_python_inc()))
python_lib = os.path.join(python_base,"lib")
yield ( python_base, [python_inc,], [python_lib,] )
yield ('/usr/local', ['/usr/local/include'], ['/usr/local/lib'])
yield ('/opt/local', ['/opt/local/include'], ['/opt/local/lib'])

Expand All @@ -13,19 +18,10 @@ def gen_envs(self, loc):
if self.find_libraries(loc[2], 'python'):
env.PrependUnique(LIBS=['python'])
yield env
if self.find_libraries(loc[2], 'python3.5m'):
env.AppendUnique(CPPPATH=[os.path.join(self.location[1][0],'python3.5m')])
env.PrependUnique(LIBS=['python3.5m'])
yield env
if self.find_libraries(loc[2], 'python3.6m'):
env.AppendUnique(CPPPATH=[os.path.join(self.location[1][0],'python3.6m')])
env.PrependUnique(LIBS=['python3.6m'])
yield env
if self.find_libraries(loc[2], 'python3.7m'):
env.AppendUnique(CPPPATH=[os.path.join(self.location[1][0],'python3.7m')])
env.PrependUnique(LIBS=['python3.7m'])
yield env
if self.find_libraries(loc[2], 'python3.8'):
env.AppendUnique(CPPPATH=[os.path.join(self.location[1][0],'python3.8')])
env.PrependUnique(LIBS=['python3.8'])
yield env
ver = "python"+ get_python_version()
for ver in [ver, ver+"m"]:
if self.find_libraries(loc[2], ver ):
env.AppendUnique(CPPPATH=[os.path.join(self.location[1][0],ver)])
env.PrependUnique(LIBS=[ver])
yield env

0 comments on commit a369589

Please sign in to comment.