Commits

Eli Collins committed d4f8557 Merge

Merged in olasd/cloud_sptheme/bugfix/python3-syntax (pull request #3)

Move make_helper.py to python3 syntax

  • Participants
  • Parent commits bf374cf, f690e15

Comments (0)

Files changed (1)

File cloud_sptheme/make_helper.py

 #imports
 #===============================================================
 #core
+from __future__ import print_function
 import logging; log = logging.getLogger(__name__)
 import os,sys
 from string import Template
     #targets
     #===============================================================
     def target_help(self):
-        print "Please use \`make <target>' where <target> is one of"
-        print "  clean     remove all compiled files"
-        print "  html      to make standalone HTML files"
-        print "  servehtml to serve standalone HTML files on port 8000"
-#        print "  pickle    to make pickle files"
-#        print "  json      to make JSON files"
-        print "  htmlhelp  to make HTML files and a HTML help project"
-#        print "  latex     to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
-#        print "  changes   to make an overview over all changed/added/deprecated items"
-#        print "  linkcheck to check all external links for integrity"
+        print("Please use \`make <target>' where <target> is one of")
+        print("  clean     remove all compiled files")
+        print("  html      to make standalone HTML files")
+        print("  servehtml to serve standalone HTML files on port 8000")
+#        print("  pickle    to make pickle files")
+#        print("  json      to make JSON files")
+        print("  htmlhelp  to make HTML files and a HTML help project")
+#        print("  latex     to make LaTeX files, you can set PAPER=a4 or PAPER=letter")
+#        print("  changes   to make an overview over all changed/added/deprecated items")
+#        print("  linkcheck to check all external links for integrity")
 
     def target_clean(self):
         rmpath(self.BUILD)
             from paste.urlparser import StaticURLParser
         except ImportError:
             # fall back to stdlib server
-            import SimpleHTTPServer as s
+            if sys.version_info[0] >= 3:
+                import http.server as s
+                HTTPServer = s.HTTPServer
+            else:
+                import SimpleHTTPServer as s
+                HTTPServer = s.BaseHTTPServer.HTTPServer
+
             os.chdir(path)
-            print "Serving files from %r on port %r" % (path, port)
-            s.BaseHTTPServer.HTTPServer(('',port), s.SimpleHTTPRequestHandler).serve_forever()
+            print("Serving files from %r on port %r" % (path, port))
+
+            HTTPServer(('',port), s.SimpleHTTPRequestHandler).serve_forever()
         else:
             serve(StaticURLParser(path), host="0.0.0.0", port=port)
 
 
     ##def target_latex(self):
     ##    build("latex")
-    ##    print "Run \`make all-pdf' or \`make all-ps' in that directory to" \
-    ##        "run these through (pdf)latex."
+    ##    print("Run \`make all-pdf' or \`make all-ps' in that directory to" \
+    ##        "run these through (pdf)latex.")
     ##
     ##def target_pdf():
     ##    assert os.name == "posix", "pdf build support not automated for your os"
     ##    target = BUILD / "latex"
     ##    target.chdir()
     ##    subprocess.call(['make', 'all-pdf'])
-    ##    print "pdf built"
+    ##    print("pdf built")
 
     #===============================================================
     #helpers
 
         rc = subprocess.call([self.SPHINXBUILD, "-b", name] + ALLSPHINXOPTS + [ target ])
         if rc:
-            print "Sphinx-Build returned error, exiting."
+            print("Sphinx-Build returned error, exiting.")
             sys.exit(rc)
-        print "Build finished. The %s pages are in %r." % (name, target,)
+        print("Build finished. The %s pages are in %r." % (name, target,))
         return target
 
     def get_paper_opts(self):