Reviewers: Graham Percival, John Mandereau,
Message:
Please review
Description:
I tested this on windows by adding a call to Popen (just opening
notepad) at the start of lilypond-book. This is why we need the
conditional test for fds-close - windows does not allow this to be True
when used with the stdin, etc., options. This is running the python
instance that is delivered with the current lilypond. I have also run
make, make doc and confirmed that the deprecation warning is taken out.
Please review this at http://codereview.appspot.com/6471043/
Affected files:
M python/book_snippets.py
Index: python/book_snippets.py
diff --git a/python/book_snippets.py b/python/book_snippets.py
index
f3a11ccca94fa97d5967fb286de53290ab1e604f..69fdc4fa6867401cdcd40fecbf16b4e6324ed4b7
100644
--- a/python/book_snippets.py
+++ b/python/book_snippets.py
@@ -7,11 +7,8 @@ import re
import os
import copy
import shutil
-# TODO: We are using os.popen3, which has been deprecated since python
2.6. The
-# suggested replacement is the Popen function of the subprocess module.
-# Unfortunately, on windows this needs the msvcrt module, which doesn't
seem
-# to be available in GUB?!?!?!
-# from subprocess import Popen, PIPE
+import subprocess
+import sys
progress = ly.progress
warning = ly.warning
@@ -740,10 +737,11 @@ printing diff against existing file." % filename)
debug (_ ("Running through filter `%s'") % cmd, True)
- # TODO: Use Popen once we resolve the problem with msvcrt in
Windows:
- (stdin, stdout, stderr) = os.popen3 (cmd)
- # p = Popen(cmd, shell=True, stdin=PIPE, stdout=PIPE, stderr=PIPE,
close_fds=True)
- # (stdin, stdout, stderr) = (p.stdin, p.stdout, p.stderr)
+ closefds = True
+ if (sys.platform == "mingw32"):
+ closefds = False
+ p = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE,
stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=closefds)
+ (stdin, stdout, stderr) = (p.stdin, p.stdout, p.stderr)
stdin.write (input)
status = stdin.close ()
_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel