Skip to content

Commit

Permalink
Addresses code review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
dotjrich committed Nov 22, 2021
1 parent 9bb40a1 commit 9031029
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions scripts/pymultic
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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'):
Expand All @@ -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"])
Expand All @@ -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),
Expand Down

0 comments on commit 9031029

Please sign in to comment.