Skip to content

Overhaul external process calls #7572

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Apr 14, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 4 additions & 12 deletions doc/make.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,9 @@ def latex():
raise SystemExit("Building LaTeX failed.")

# Produce pdf.
os.chdir('build/latex')

# Call the makefile produced by sphinx...
if os.system('make'):
raise SystemExit("Rendering LaTeX failed.")

os.chdir('../..')
if subprocess.call("make", cwd="build/latex"):
raise SystemExit("Rendering LaTeX failed with.")
else:
print('latex build has not been tested on windows')

Expand All @@ -195,13 +191,9 @@ def texinfo():
raise SystemExit("Building Texinfo failed.")

# Produce info file.
os.chdir('build/texinfo')

# Call the makefile produced by sphinx...
if os.system('make'):
raise SystemExit("Rendering Texinfo failed.")

os.chdir('../..')
if subprocess.call("make", cwd="build/texinfo"):
raise SystemExit("Rendering Texinfo failed with.")
else:
print('texinfo build has not been tested on windows')

Expand Down
4 changes: 2 additions & 2 deletions examples/pylab_examples/mathtext_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""
from __future__ import print_function
import matplotlib.pyplot as plt
import os
import subprocess
import sys
import re
import gc
Expand Down Expand Up @@ -120,6 +120,6 @@ def doall():
fd.write("\\end{document}\n")
fd.close()

os.system("pdflatex mathtext_examples.ltx")
subprocess.call(["pdflatex", "mathtext_examples.ltx"])
else:
doall()
6 changes: 3 additions & 3 deletions examples/pylab_examples/movie_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from __future__ import print_function

import os
import subprocess
import matplotlib.pyplot as plt
import numpy as np

Expand All @@ -22,8 +22,8 @@
files.append(fname)

print('Making movie animation.mpg - this may take a while')
os.system("mencoder 'mf://_tmp*.png' -mf type=png:fps=10 -ovc lavc -lavcopts vcodec=wmv2 -oac copy -o animation.mpg")
#os.system("convert _tmp*.png animation.mng")
subprocess.call("mencoder 'mf://_tmp*.png' -mf type=png:fps=10 -ovc lavc "
"-lavcopts vcodec=wmv2 -oac copy -o animation.mpg", shell=True)

# cleanup
for fname in files:
Expand Down
4 changes: 2 additions & 2 deletions examples/pylab_examples/stix_fonts_demo.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import unicode_literals

import os
import subprocess
import sys
import re
import gc
Expand Down Expand Up @@ -53,6 +53,6 @@ def doall():
fd.write("\\end{document}\n")
fd.close()

os.system("pdflatex stix_fonts_examples.ltx")
subprocess.call(["pdflatex", "stix_fonts_examples.ltx"])
else:
doall()
25 changes: 11 additions & 14 deletions examples/tests/backend_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,19 +337,16 @@ def report_all_missing(directories):
)


try:
import subprocess

def run(arglist):
try:
ret = subprocess.call(arglist)
except KeyboardInterrupt:
sys.exit()
else:
return ret
except ImportError:
def run(arglist):
os.system(' '.join(arglist))
from matplotlib.compat import subprocess


def run(arglist):
try:
ret = subprocess.call(arglist)
except KeyboardInterrupt:
sys.exit()
else:
return ret


def drive(backend, directories, python=['python'], switches=[]):
Expand Down Expand Up @@ -420,7 +417,7 @@ def drive(backend, directories, python=['python'], switches=[]):
ret = run(program + [tmpfile_name] + switches)
end_time = time.time()
print("%s %s" % ((end_time - start_time), ret))
#os.system('%s %s %s' % (python, tmpfile_name, ' '.join(switches)))
# subprocess.call([python, tmpfile_name] + switches)
os.remove(tmpfile_name)
if ret:
failures.append(fullpath)
Expand Down
Loading