Removed Python 2.7-style string formatting
This commit is contained in:
parent
4c9a52044a
commit
030e8dd1ac
1 changed files with 7 additions and 7 deletions
|
@ -1401,7 +1401,7 @@ def install_spconfig(self):
|
||||||
spconfig_fname = 'spconfig.py'
|
spconfig_fname = 'spconfig.py'
|
||||||
with open(spconfig_fname, 'w') as fout:
|
with open(spconfig_fname, 'w') as fout:
|
||||||
fout.write(\
|
fout.write(\
|
||||||
r"""#!{}
|
r"""#!%s
|
||||||
#
|
#
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
@ -1411,28 +1411,28 @@ def install_spconfig(self):
|
||||||
def cmdlist(str):
|
def cmdlist(str):
|
||||||
return list(x.strip().replace("'",'') for x in str.split('\n') if x)
|
return list(x.strip().replace("'",'') for x in str.split('\n') if x)
|
||||||
env = dict()
|
env = dict()
|
||||||
""".format(sys.executable))
|
""" % sys.executable)
|
||||||
|
|
||||||
env_vars = sorted(list(env.keys()))
|
env_vars = sorted(list(env.keys()))
|
||||||
for name in env_vars:
|
for name in env_vars:
|
||||||
val = env[name]
|
val = env[name]
|
||||||
if string.find(name, 'PATH') < 0:
|
if string.find(name, 'PATH') < 0:
|
||||||
fout.write('env[{}] = {}\n'.format(repr(name),repr(val)))
|
fout.write('env[%s] = %s\n'. % (repr(name),repr(val)))
|
||||||
else:
|
else:
|
||||||
if name == 'CMAKE_TRANSITIVE_INCLUDE_PATH':
|
if name == 'CMAKE_TRANSITIVE_INCLUDE_PATH':
|
||||||
sep = ';'
|
sep = ';'
|
||||||
else:
|
else:
|
||||||
sep = ':'
|
sep = ':'
|
||||||
|
|
||||||
fout.write('env[{}] = "{}".join(cmdlist("""\n'.format(repr(name),sep))
|
fout.write('env[%s] = "%s".join(cmdlist("""\n' % (repr(name),sep))
|
||||||
for part in string.split(val, sep):
|
for part in string.split(val, sep):
|
||||||
fout.write(' {}\n'.format(part))
|
fout.write(' %s\n' % part)
|
||||||
fout.write('"""))\n')
|
fout.write('"""))\n')
|
||||||
|
|
||||||
fout.write('\ncmd = cmdlist("""\n')
|
fout.write('\ncmd = cmdlist("""\n')
|
||||||
fout.write('{}\n'.format(cmd[0]))
|
fout.write('%s\n' % cmd[0])
|
||||||
for arg in cmd[1:]:
|
for arg in cmd[1:]:
|
||||||
fout.write(' {}\n'.format(arg))
|
fout.write(' %s\n' % arg)
|
||||||
fout.write('""") + sys.argv[1:]\n')
|
fout.write('""") + sys.argv[1:]\n')
|
||||||
fout.write('\nproc = subprocess.Popen(cmd, env=env)\nproc.wait()\n')
|
fout.write('\nproc = subprocess.Popen(cmd, env=env)\nproc.wait()\n')
|
||||||
make_executable(spconfig_fname)
|
make_executable(spconfig_fname)
|
||||||
|
|
Loading…
Reference in a new issue