refactoring for PYTHON environment

This commit is contained in:
wiredfool 2015-06-11 13:11:26 -07:00
parent 680310c7e2
commit a69a47c042
3 changed files with 39 additions and 28 deletions

View File

@ -109,24 +109,14 @@ def main(op):
print ("Compiled %s: %s" % (version, status))
def run_one(op):
py = os.environ['PYTHON']
py_version = '27'
for k,v in pythons.items():
if k in py:
compiler_version = v
py_version = k
break
bit = 32
if '64' in py:
bit = 64
py_version = '%s-x64' % py_version
compiler = compiler_fromEnv()
py_version = pyversion_fromEnv()
run_script((py_version,
"\n".join([header(op),
build_one(py_version, compilers[(compiler_version, bit)]),
build_one(py_version, compiler),
footer()])
))

View File

@ -250,7 +250,7 @@ def add_compiler(compiler):
mkdirs()
fetch_libs()
#fetch_libs()
#extract_binlib()
script = [header()] #, cp_tk()]
@ -259,20 +259,9 @@ script = [header()] #, cp_tk()]
# add_compiler(compiler)
if 'PYTHON' in os.environ:
bit = 32
if '64' in os.environ['PYTHON']:
bit = 64
break
ver = 7
for k,v in pythons:
if k in os.environ['PYTHON']:
ver = v
break
add_compiler(compilers[(ver,bit)])
add_compiler(compiler_fromEnv())
else:
compiler = compilers[(7,64)]
add_compiler(compilers[(7,64)])
with open('build_deps.cmd', 'w') as f:
f.write("\n".join(script))

View File

@ -1,3 +1,5 @@
import os
SF_MIRROR = 'http://hivelocity.dl.sourceforge.net'
SF_MIRROR = 'http://iweb.dl.sourceforge.net'
@ -102,3 +104,33 @@ compilers = { (7,64): {
},
}
def pyversion_fromEnv():
py = os.environ['PYTHON']
py_version = '27'
for k,v in pythons.items():
if k in py:
py_version = k
break
if '64' in py:
py_version = '%s-x64' % py_version
return py_version
def compiler_fromEnv():
py = os.environ['PYTHON']
for k,v in pythons.items():
if k in py:
compiler_version = v
break
bit = 32
if '64' in py:
bit = 64
return compilers[(compiler_version, bit)]