Addresses code review comments

This commit is contained in:
John Richards
2021-11-22 00:51:26 -05:00
parent 9bb40a1faa
commit 9031029ef6

View File

@@ -164,8 +164,8 @@ def build_python_container(snekdir, version):
py_container_tag = 'python:{}'.format(realver)
if subprocess.call([container_exe, 'image', 'inspect', py_container_tag],
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL) == 0:
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL) == 0:
return
fetch_python(snekdir, version)
@@ -244,6 +244,7 @@ def container_compile(snekdir, ver, infile):
container_exe = get_container_exe()
fullver = PYVERS[ver]
indir = os.path.dirname(os.path.abspath(infile))
infile_full_path = infile
infile = os.path.basename(infile)
if infile.endswith('.py'):
@@ -257,15 +258,15 @@ def container_compile(snekdir, ver, infile):
print('*** Compiling for Python {}'.format(fullver))
if ver in {'1.0', '1.1', '1.2', '1.3', '1.4'}:
# The hard way -- hope your code is safe...
srcdir = os.path.dirname(os.path.realpath(infile))
comptmp = os.path.join(indir, 'pymc_temp.py')
if os.path.exists(comptmp):
os.unlink(comptmp)
shutil.copyfile(infile, comptmp)
shutil.copyfile(infile_full_path, comptmp)
proc = subprocess.Popen([container_exe, 'run'] + CONTAINER_EXE_EXTRA_ARGS[container_exe] +
['--rm', '--name', '{}'.format(outfile),
['--rm', '--name', outfile,
'-v', '{}:/indir:Z'.format(indir),
'-v', '{}:/outdir:Z'.format(os.getcwd()), '-w', '/outdir',
'-w', '/indir',
'python:{}'.format(fullver),
'python', '-c',
"import pymc_temp"])
@@ -280,7 +281,7 @@ def container_compile(snekdir, ver, infile):
else:
# The easy way
proc = subprocess.Popen([container_exe, 'run'] + CONTAINER_EXE_EXTRA_ARGS[container_exe] +
['--rm', '--name', '{}'.format(outfile),
['--rm', '--name', outfile,
'-v', '{}:/indir:Z'.format(indir),
'-v', '{}:/outdir:Z'.format(os.getcwd()), '-w', '/outdir',
'python:{}'.format(fullver),