Commit fca8768d authored by Anders Blomdell's avatar Anders Blomdell
Browse files

Add --interpreter argument

parent 6047b1fe
......@@ -2,7 +2,7 @@
"""
Anders Python Archiver
Copyright (C) 2004-2009 Anders Blomdell <anders.blomdell@control.lth.se>
Copyright (C) 2004-2019 Anders Blomdell <anders.blomdell@control.lth.se>
A small utility program to join a number of python modules
into a single executable python program.
......@@ -54,6 +54,10 @@ if __name__ == '__main__':
optParser.add_option('-d','--documentation',
action='store_true',
help='Show documentation')
optParser.add_option('--interpreter',
default=None,
action='store',
help='Interpreter to use')
optParser.add_option('-o','--output',
action='store',
help='Name of archive')
......@@ -98,13 +102,15 @@ if __name__ == '__main__':
# Emit code
interpreter = code[0][2].splitlines()[0]
if interpreter.find("python") >= 0:
if options.interpreter != None:
print >> apa, "#!%s" % options.interpreter
elif interpreter.find("python") >= 0:
# Take interpreter version from main file
print >> apa, interpreter
else:
# Default interpreter
print >> sys.stderr, "Interpreter defaulting to '#!/usr/bin/python'"
print >> apa, "#!/usr/bin/python"
print >> sys.stderr, "Interpreter defaulting to '#!/usr/bin/python3'"
print >> apa, "#!/usr/bin/python3"
print >> apa, "\"\"\""
print >> apa, "Executable archive of '%s'" % code[0][0]
print >> apa, "\nThe following modules are archived:"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment