Skip to content

Commit ab8852d

Browse files
committed
Fix for distutils
1 parent e3cae40 commit ab8852d

2 files changed

Lines changed: 7 additions & 8 deletions

File tree

bin/autoConfigPython.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ buildLibs () {
171171
local f2py2Exec=$(hasf2py2)
172172
local f2py3Exec=$(hasf2py3)
173173
local numpyVersion=$(whichNumpy)
174-
local npVersionMeson="1.26"
174+
local npVersionMeson=1.26
175175

176176
if [ $f2pyStdExec != "NotFound" ]; then
177177
local f2pyExec=$f2pyStdExec
@@ -206,7 +206,7 @@ buildLibs () {
206206

207207
if [ $pythonVersion == 3 ] && [ $minor_version -ge 12 ]; then
208208
$SED "s/buildLib.*/buildLib = True/g" $MAGIC_HOME/python/magic/magic.cfg
209-
elif [[ $(echo "$numpyVersion >= $npVersionMeson" |bc -l) ]]; then #Compare using bash calculator
209+
elif (( $(echo "$numpyVersion >= $npVersionMeson" |bc -l) )); then #Compare using bash calculator
210210
echo "Found NumPy version >= 1.26, will use compilers from env variables CC and FC"
211211
$SED "s/buildLib.*/buildLib = True/g" $MAGIC_HOME/python/magic/magic.cfg
212212
else

python/magic/setup.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@
9494

9595
# Decide whether to use distutils or meson backend
9696
npMaj,npMin,npPatch = np.__version__.split('.')
97-
npVersion = float(npMaj+'.'+npMin)
9897

9998
def buildLib(fileName,libName):
10099
t2 = os.stat('fortranLib/' + fileName).st_mtime
@@ -104,23 +103,23 @@ def buildLib(fileName,libName):
104103
else: # in case the file does not exist t2 is set to t1
105104
t1 = t2
106105
if len(sos) < 1 or t2 > t1:
107-
print("Please wait: building %s..." %libName)
108-
if npVersion < 1.26:
106+
107+
if int(npMin) <= 26:
108+
print("Please wait: building %s using distutils..." %libName)
109109
return_code = sp.call(['{}'.format(f2pycmd),
110110
'--fcompiler={}'.format(fcompiler),
111-
'--compiler={}'.format(ccompiler),
112111
'--opt={}'.format(f90options),
113112
'-c', '-m',
114113
'%s' %libName,
115-
'fortranLib/%s' %fileName,
116-
"--backend", "distutils"], stderr=sp.PIPE, stdout=sp.PIPE)
114+
'fortranLib/%s' %fileName], stderr=sp.PIPE, stdout=sp.PIPE)
117115
else:
118116
try:
119117
import ninja
120118
except ImportError:
121119
print("Building libraries with meson backend requires ninja to be installed")
122120
print('Please install it using "pip install ninja"')
123121

122+
print("Please wait: building %s using meson..." %libName)
124123
my_env = os.environ.copy()
125124
my_env["FFLAGS"]=f90options
126125
return_code = sp.call(['{}'.format(f2pycmd),

0 commit comments

Comments
 (0)