8000 Overhaul external process calls by tomspur · Pull Request #7572 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

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 1 commit
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
Prev Previous commit
Next Next commit
Use subprocess instead os.system also in the examples
  • Loading branch information
tomspur committed Apr 9, 2017
commit b09e79c05532e26b50e43b40d5ff04509fd3ffa4
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 8000 @@ -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()
4 changes: 2 additions & 2 deletions examples/tests/backend_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ def run(arglist):
return ret
except ImportError:
def run(arglist):
os.system(' '.join(arglist))
os.system(arglist)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can just drop this whole section, this is <2.7 compat code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed this part of the backend driver and used the compat shim also there.



def drive(backend, directories, python=['python'], switches=[]):
Expand Down Expand Up @@ -420,7 +420,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
0