#2 Fixups for the Python 3 port
Merged 4 years ago by bex. Opened 4 years ago by pviktori.
pviktori/fedora-business-cards fixups  into  master

file modified
+1 -1
@@ -1,4 +1,4 @@ 

- #!/usr/bin/python

+ #!/usr/bin/python3

  # This file is provided as a conveinence to people using the Git repository.

  # It is not included in source distributions, and it is created in binary

  # distributions as a setuptools entry point.

@@ -137,7 +137,7 @@ 

      gen.collect_information()

  

      # generate front of business card

-     print("Generating front...", file=sys.stdout, flush=False)

+     print("Generating front...")

      xml = gen.generate_front()

      if options.output == "svg":

          export.svg_to_file(xml, 'front.' + options.output)
@@ -148,7 +148,7 @@ 

          export.svg_to_pdf_png(xml, 'front.' + options.output, options.output,

                                options.dpi)

      # generate back of business card

-     print("Generating back...", file=sys.stdout, flush=False)

+     print("Generating back...")

      xml = gen.generate_back()

      if xml:

          if options.output == "svg":
@@ -162,4 +162,4 @@ 

                                    options.output, options.dpi)

      else:

          print("(no back generated)")

-     print("Done.", file=sys.stdout, flush=False)

+     print("Done.")

Change shebang of the convenience script to Python 3

The code is not compatible with Python 2. (Should it have been?)

Simplify status prints

The Python 2 original with trailing comma and explicit flush:

print "Generating front...",
sys.stdout.flush()

would be best translated as:

print("Generating front...", end=" ", flush=True)

(file=sys.stdout is the default)
but I see no reason to print all statuses on the same line, possibly making other messages more unreadable.
So, I changed them to simple print().

Thank you! I have a new PR coming in that adds new generators. If you don't mind looking at it as well that would be awesome. I've had to move from optparse to argparser ...

Pull-Request has been merged by bex

4 years ago