0

contribManager: fix imports, use print_function

We don't need to import nbt from overviewer_core at all so we
can remove the silly fix to do that. Why was that ever there? It's
a mystery!
This commit is contained in:
Nicolas F
2019-03-14 13:40:27 +01:00
parent 4be0f07156
commit 75f2bc1dfc

View File

@@ -3,15 +3,11 @@
"""The contrib manager is used to help control the contrib scripts """The contrib manager is used to help control the contrib scripts
that are shipped with overviewer in Windows packages.""" that are shipped with overviewer in Windows packages."""
import sys from __future__ import print_function
import os.path
import ast import ast
import os.path
# incantation to be able to import overviewer_core import sys
if not hasattr(sys, "frozen"):
sys.path.insert(0, os.path.abspath(os.path.join(os.path.split(__file__)[0], '.')))
from overviewer_core import nbt
scripts = { # keys are names, values are scripts scripts = { # keys are names, values are scripts
"convertCyrillic": "cyrillic_convert.py", "convertCyrillic": "cyrillic_convert.py",
@@ -67,20 +63,20 @@ else:
docstring = docstring.strip().splitlines()[0] docstring = docstring.strip().splitlines()[0]
else: else:
docstring = "(No description found. Add one by adding a docstring to %s.)" % script docstring = "(No description found. Add one by adding a docstring to %s.)" % script
print "%s : %s" % (contrib, docstring) print("%s : %s" % (contrib, docstring))
sys.exit(0) sys.exit(0)
if len(sys.argv) > 1 and sys.argv[1] in scripts.keys(): if len(sys.argv) > 1 and sys.argv[1] in scripts.keys():
script = scripts[sys.argv[1]] script = scripts[sys.argv[1]]
sys.argv = [script] + sys.argv[2:] sys.argv = [script] + sys.argv[2:]
else: else:
print usage print(usage, file=sys.stderr)
sys.exit(1) sys.exit(1)
torun = os.path.join("contrib", script) torun = os.path.join("contrib", script)
if not os.path.exists(torun): if not os.path.exists(torun):
print "Script '%s' is missing!" % script print("Script '%s' is missing!" % script, file=sys.stderr)
sys.exit(1) sys.exit(1)
execfile(torun) execfile(torun)