lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Some py3 fixes (issue 553430047 by address@hidden)


From: hanwenn
Subject: Re: Some py3 fixes (issue 553430047 by address@hidden)
Date: Sun, 26 Jan 2020 05:27:25 -0800

Reviewers: lemzwerg, hahnjo,

Message:
what is the status of your work?



Description:
Some py3 fixes

* 0777 should be spelled as 0o777. We omit it as it is the mkdir
  default.

* print needs parentheses. Use sys.stderr.write instead.

Please review this at https://codereview.appspot.com/553430047/

Affected files (+12, -13 lines):
  M python/langdefs.py
  M python/lilylib.py
  M scripts/lilypond-book.py


Index: python/langdefs.py
diff --git a/python/langdefs.py b/python/langdefs.py
index 
3bcb1e18b8127e13c6228940cb3e78611a6c4fcf..6181984febc0a44d325747ec38b4e278929322e5
 100644
--- a/python/langdefs.py
+++ b/python/langdefs.py
@@ -80,7 +80,7 @@ if os.getenv("MAKEWEB") == '1':
     LANGUAGES=WEB_LANGUAGES
 
 if __name__ == '__main__':
-    print ' '.join ([l.code for l in LANGUAGES if l.enabled and l.code != 
'en'])
+    print(' '.join ([l.code for l in LANGUAGES if l.enabled and l.code != 
'en']))
 else:
     LANGDICT = {}
     for l in LANGUAGES:
Index: python/lilylib.py
diff --git a/python/lilylib.py b/python/lilylib.py
index 
7fe3ad016a7e76b2f62a8d8b5f69bb37e6ae02b3..26e9ab006803123ab9db449cb778f053539e0025
 100644
--- a/python/lilylib.py
+++ b/python/lilylib.py
@@ -222,18 +222,17 @@ def subprocess_system (cmd,
             retval = proc.returncode
 
     if retval:
-        print >>sys.stderr, 'command failed:', cmd
+        sys.stderr.write('command failed: %s\n' % cmd)
         if retval < 0:
-            print >>sys.stderr, "Child was terminated by signal", -retval
+            sys.stderr.write("Child was terminated by signal %d\n" % -retval)
         elif retval > 0:
-            print >>sys.stderr, "Child returned", retval
-
+            sys.stderr.write("Child returned %d\n" % retval)
         if ignore_error:
-            print >>sys.stderr, "Error ignored by lilylib"
+            sys.stderr.write("Error ignored by lilylib\n")
         else:
             if not show_progress:
-                print log[0]
-                print log[1]
+                print (log[0])
+                print (log[1])
             sys.exit (1)
 
     return abs (retval)
@@ -255,14 +254,14 @@ def ossystem_system (cmd,
 
     retval = os.system (cmd)
     if retval:
-        print >>sys.stderr, 'command failed:', cmd
+        sys.stderr.write('command failed: %s\n' % cmd)
         if retval < 0:
-            print >>sys.stderr, "Child was terminated by signal", -retval
+            sys.stderr.write ("Child was terminated by signal %d\n" % -retval)
         elif retval > 0:
-            print >>sys.stderr, "Child returned", retval
+            sys.stderr.write ("Child returned %d\n" % retval)
 
         if ignore_error:
-            print >>sys.stderr, "Error ignored"
+            sys.stderr.write ("Error ignored\n")
         else:
             sys.exit (1)
 
Index: scripts/lilypond-book.py
diff --git a/scripts/lilypond-book.py b/scripts/lilypond-book.py
index 
86ee35c5f6f541193a5d292dca7b682e214dac22..259bb9ceba58ae30abfd11e83db8e69692a02bca
 100644
--- a/scripts/lilypond-book.py
+++ b/scripts/lilypond-book.py
@@ -568,7 +568,7 @@ def do_file (input_filename, included=False):
         global_options.output_dir = os.path.abspath(global_options.output_dir)
 
         if not os.path.isdir (global_options.output_dir):
-            os.mkdir (global_options.output_dir, 0777)
+            os.mkdir (global_options.output_dir)
         os.chdir (global_options.output_dir)
 
     output_filename = os.path.join(global_options.output_dir,





reply via email to

[Prev in Thread] Current Thread [Next in Thread]