def run(): misc.check_not_running_as_root() out_filename = os.path.abspath('file_version_info.txt') if len(sys.argv) < 2: print 'Usage: python grab_version.py <exe> [ out.txt ]' print ' where: <exe> is the fullpathname of a Windows executable and' print ' <out.txt> is the optional pathname where the grabbed ' print ' version info will be saved.' print ' default out filename: file_version_info.txt ' print ' The printed output may be saved to a file, edited and ' print ' used as the input for a version resource on any of the ' print ' executable targets in an Installer spec file.' raise SystemExit(1) if len(sys.argv) == 3: out_filename = os.path.abspath(sys.argv[2]) try: vs = PyInstaller.utils.versioninfo.decode(sys.argv[1]) fp = codecs.open(out_filename, 'w', 'utf-8') fp.write(unicode(vs)) fp.close() print('Version info written to: %s' % out_filename) except KeyboardInterrupt: raise SystemExit("Aborted by user request.")
def run(): misc.check_not_running_as_root() parser = optparse.OptionParser( usage='python %s [options] <scriptname>.py [<scriptname>.py ...]', epilog="The next step is to run pyi-build against the generated" " spec file." ) parser.add_option('--debug', default=False, action='store_true', help='Enable bootloader debug messages, and register COM servers with debug') parser.add_option('--verbose', default=False, action='store_true', help='Use verbose flag in COM server registration') parser.add_option('--out', default='.', metavar='DIR', dest='workdir', help='Where to write the generated script and spec file') parser.add_option("-a", "--ascii", action="store_true", help="Do not include unicode encoding support " "(default: included if available)") opts, args = parser.parse_args() if not args: parser.error('Requires at least one script filename') try: print() print(epilog) except KeyboardInterrupt: raise SystemExit("Aborted by user request.")
def run(): misc.check_not_running_as_root() p = optparse.OptionParser( usage='python %prog [opts] <scriptname> [<scriptname> ...]' ) PyInstaller.makespec.__add_options(p) PyInstaller.log.__add_options(p) PyInstaller.compat.__add_obsolete_options(p) opts, args = p.parse_args() PyInstaller.log.__process_options(p, opts) # Split pathex by using the path separator temppaths = opts.pathex[:] opts.pathex = [] for p in temppaths: opts.pathex.extend(p.split(os.pathsep)) if not args: p.error('Requires at least one scriptname file') try: name = PyInstaller.makespec.main(args, **opts.__dict__) print 'wrote %s' % name print 'now run Build.py to build the executable' except KeyboardInterrupt: raise SystemExit("Aborted by user request.")
def run(): misc.check_not_running_as_root() parser = optparse.OptionParser( usage='python %s [options] <scriptname>.py [<scriptname>.py ...]', epilog="The next step is to run pyi-build against the generated" "spec file.") parser.add_option( '--debug', default=False, action='store_true', help= 'Enable bootloader debug messages, and register COM servers with debug' ) parser.add_option('--verbose', default=False, action='store_true', help='Use verbose flag in COM server registration') parser.add_option('--out', default='.', metavar='DIR', dest='workdir', help='Where to write the generated script and spec file') parser.add_option('--ascii', default=False, action='store_true') opts, args = parser.parse_args() if not args: parser.error('Requires at least one script filename') try: print print epilog except KeyboardInterrupt: raise SystemExit("Aborted by user request.")
def run(): misc.check_not_running_as_root() parser = optparse.OptionParser( usage='python %prog <executable_or_dynamic_library> ' '[ <executable_or_dynamic_library> ... ]') PyInstaller.log.__add_options(parser) opts, args = parser.parse_args() PyInstaller.log.__process_options(parser, opts) if len(args) == 0: parser.error('Requires one or more executables or dynamic libraries') # Suppress all informative messages from the dependency code. PyInstaller.log.getLogger('PyInstaller.build.bindepend').setLevel( PyInstaller.log.WARN) try: for a in args: for fn in glob.glob(a): imports = PyInstaller.bindepend.getImports(fn) if is_win: assemblies = PyInstaller.bindepend.getAssemblies(fn) imports.update([a.getid() for a in assemblies]) print fn, imports except KeyboardInterrupt: raise SystemExit("Aborted by user request.")
def run(): misc.check_not_running_as_root() parser = optparse.OptionParser( usage='python %s [options] <scriptname>.py [<scriptname>.py ...]', epilog="The next step is to run Build.py against the generated" "spec file. See doc/Tutorial.html for details." ) parser.add_option('--debug', default=False, action='store_true', help='use debug console build and register COM servers with debug') parser.add_option('--verbose', default=False, action='store_true', help='use verbose flag in COM server registration') parser.add_option('--out', default='.', metavar='DIR', dest='workdir', help='generate script and spec file in dir') parser.add_option('--ascii', default=False, action='store_true') opts, args = parser.parse_args() if not args: parser.error('Requires at least one script filename') try: print print epilog except KeyboardInterrupt: raise SystemExit("Aborted by user request.")
def run(): misc.check_not_running_as_root() p = optparse.OptionParser( usage='python %prog [opts] <scriptname> [<scriptname> ...]') PyInstaller.makespec.__add_options(p) PyInstaller.log.__add_options(p) PyInstaller.compat.__add_obsolete_options(p) opts, args = p.parse_args() PyInstaller.log.__process_options(p, opts) # Split pathex by using the path separator temppaths = opts.pathex[:] opts.pathex = [] for p in temppaths: opts.pathex.extend(p.split(os.pathsep)) if not args: p.error('Requires at least one scriptname file') try: name = PyInstaller.makespec.main(args, **opts.__dict__) print('wrote %s' % name) print('now run pyinstaller.py to build the executable') except KeyboardInterrupt: raise SystemExit("Aborted by user request.")
def run(): misc.check_not_running_as_root() _, args = optparse.OptionParser(usage='usage: %prog toc_files...').parse_args() for toc_file in args: with codecs.open(toc_file, 'r', 'utf-8') as f: pprint.pprint(eval(f.read()))
def run(): misc.check_not_running_as_root() _, args = optparse.OptionParser( usage='usage: %prog toc_files...').parse_args() for toc_file in args: with codecs.open(toc_file, 'r', 'utf-8') as f: pprint.pprint(eval(f.read()))
def run(): misc.check_not_running_as_root() _, args = optparse.OptionParser(usage='usage: %prog toc_files...').parse_args() for toc_file in args: with codecs.open(toc_file, 'r', 'utf-8') as f: from PyInstaller.depend.bindepend import BindingRedirect pprint.pprint(eval(f.read()))
def run(): misc.check_not_running_as_root() _, args = optparse.OptionParser( usage='usage: %prog toc_files...').parse_args() for toc_file in args: with codecs.open(toc_file, 'r', 'utf-8') as f: from PyInstaller.depend.bindepend import BindingRedirect pprint.pprint(eval(f.read()))
def run(): misc.check_not_running_as_root() if len(sys.argv) < 2: print 'Usage: python grab_version.py <exe>' print ' where: <exe> is the fullpathname of a Windows executable.' print ' The printed output may be saved to a file, edited and ' print ' used as the input for a version resource on any of the ' print ' executable targets in an Installer spec file.' else: try: vs = PyInstaller.utils.versioninfo.decode(sys.argv[1]) print vs except KeyboardInterrupt: raise SystemExit("Aborted by user request.")
def run(): misc.check_not_running_as_root() parser = optparse.OptionParser(usage='%prog [options] specfile') PyInstaller.build.__add_options(parser) PyInstaller.log.__add_options(parser) PyInstaller.compat.__add_obsolete_options(parser) opts, args = parser.parse_args() PyInstaller.log.__process_options(parser, opts) if len(args) != 1: parser.error('Requires exactly one .spec-file') try: PyInstaller.build.main(args[0], **opts.__dict__) except KeyboardInterrupt: raise SystemExit("Aborted by user request.")
def run(): misc.check_not_running_as_root() parser = optparse.OptionParser(usage='%prog [options] specfile') PyInstaller.build.__add_options(parser) PyInstaller.log.__add_options(parser) PyInstaller.compat.__add_obsolete_options(parser) opts, args = parser.parse_args() PyInstaller.log.__process_options(parser, opts) if len(args) != 1: parser.error('Requires exactly one .spec-file') try: PyInstaller.build.main(None, args[0], **opts.__dict__) except KeyboardInterrupt: raise SystemExit("Aborted by user request.")
def run(): misc.check_not_running_as_root() out_filename = os.path.abspath('file_version_info.txt') if len(sys.argv) < 3: print 'Usage: python set_version.py <version_info.txt> <exe>' print ' where: <version_info.txt> is file containing version info' print ' and <exe> is the fullpathname of a Windows executable.' raise SystemExit(1) info_file = os.path.abspath(sys.argv[1]) exe_file = os.path.abspath(sys.argv[2]) try: vs = PyInstaller.utils.versioninfo.SetVersion(exe_file, info_file) print('Version info set in: %s' % exe_file) except KeyboardInterrupt: raise SystemExit("Aborted by user request.")
def run(): misc.check_not_running_as_root() out_filename = os.path.abspath('file_version_info.txt') if len(sys.argv) < 3: print('Usage: python set_version.py <version_info.txt> <exe>') print(' where: <version_info.txt> is file containing version info') print(' and <exe> is the fullpathname of a Windows executable.') raise SystemExit(1) info_file = os.path.abspath(sys.argv[1]) exe_file = os.path.abspath(sys.argv[2]) try: vs = PyInstaller.utils.versioninfo.SetVersion(exe_file, info_file) print('Version info set in: %s' % exe_file) except KeyboardInterrupt: raise SystemExit("Aborted by user request.")
def run(pyi_args=sys.argv[1:], pyi_config=None): """ pyi_args allows running PyInstaller programatically without a subprocess pyi_config allows checking configuration once when running multiple tests """ misc.check_not_running_as_root() try: parser = optparse.OptionParser( usage= 'python %prog [opts] <scriptname> [ <scriptname> ...] | <specfile>' ) __add_options(parser) PyInstaller.makespec.__add_options(parser) PyInstaller.build.__add_options(parser) PyInstaller.log.__add_options(parser) PyInstaller.compat.__add_obsolete_options(parser) opts, args = parser.parse_args(pyi_args) PyInstaller.log.__process_options(parser, opts) # Print program version and exit if opts.version: print get_version() raise SystemExit(0) if not args: parser.error('Requires at least one scriptname file ' 'or exactly one .spec-file') # Skip creating .spec when .spec file is supplied if args[0].endswith('.spec'): spec_file = args[0] else: spec_file = run_makespec(opts, args) run_build(opts, spec_file, pyi_config) except KeyboardInterrupt: raise SystemExit("Aborted by user request.")
def run(pyi_args=sys.argv[1:], pyi_config=None): """ pyi_args allows running PyInstaller programatically without a subprocess pyi_config allows checking configuration once when running multiple tests """ misc.check_not_running_as_root() try: parser = optparse.OptionParser( usage='%prog [opts] <scriptname> [ <scriptname> ...] | <specfile>' ) __add_options(parser) PyInstaller.makespec.__add_options(parser) PyInstaller.build.__add_options(parser) PyInstaller.log.__add_options(parser) PyInstaller.compat.__add_obsolete_options(parser) opts, args = parser.parse_args(pyi_args) PyInstaller.log.__process_options(parser, opts) # Print program version and exit if opts.version: print get_version() raise SystemExit(0) if not args: parser.error('Requires at least one scriptname file ' 'or exactly one .spec-file') # Skip creating .spec when .spec file is supplied if args[0].endswith('.spec'): spec_file = args[0] else: spec_file = run_makespec(opts, args) run_build(opts, spec_file, pyi_config) except KeyboardInterrupt: raise SystemExit("Aborted by user request.")
def main(opts, args): misc.check_not_running_as_root() global stack global debug global rec_debug global name global brief name = args[0] debug = opts.log rec_debug = opts.rec brief = opts.brief if not os.path.isfile(name): print "%s is an invalid file name!" % name return 1 arch = get_archive(name) stack.append((name, arch)) if debug or brief: show_log(name, arch) raise SystemExit(0) else: show(name, arch) while 1: try: toks = raw_input('? ').split(None, 1) except EOFError: # Ctrl-D print # Clear line. break if not toks: usage() continue if len(toks) == 1: cmd = toks[0] arg = '' else: cmd, arg = toks cmd = cmd.upper() if cmd == 'U': if len(stack) > 1: arch = stack[-1][1] arch.lib.close() del stack[-1] nm, arch = stack[-1] show(nm, arch) elif cmd == 'O': if not arg: arg = raw_input('open name? ') arg = arg.strip() arch = get_archive(arg) if arch is None: print arg, "not found" continue stack.append((arg, arch)) show(arg, arch) elif cmd == 'X': if not arg: arg = raw_input('extract name? ') arg = arg.strip() data = get_data(arg, arch) if data is None: print "Not found" continue fnm = raw_input('to filename? ') if not fnm: print repr(data) else: open(fnm, 'wb').write(data) elif cmd == 'Q': break else: usage() for (nm, arch) in stack: arch.lib.close() stack = [] for fnm in cleanup: try: os.remove(fnm) except Exception, e: print "couldn't delete", fnm, e.args
def main(name, brief, debug, rec_debug, **unused_options): misc.check_not_running_as_root() global stack if not os.path.isfile(name): print(name, "is an invalid file name!") return 1 arch = get_archive(name) stack.append((name, arch)) if debug or brief: show_log(arch, rec_debug, brief) raise SystemExit(0) else: show(name, arch) while 1: try: toks = stdin_input("? ").split(None, 1) except EOFError: # Ctrl-D print() # Clear line. break if not toks: usage() continue if len(toks) == 1: cmd = toks[0] arg = "" else: cmd, arg = toks cmd = cmd.upper() if cmd == "U": if len(stack) > 1: arch = stack[-1][1] arch.lib.close() del stack[-1] name, arch = stack[-1] show(name, arch) elif cmd == "O": if not arg: arg = stdin_input("open name? ") arg = arg.strip() try: arch = get_archive(arg) except NotAnArchiveError as e: print(e) continue if arch is None: print(arg, "not found") continue stack.append((arg, arch)) show(arg, arch) elif cmd == "X": if not arg: arg = stdin_input("extract name? ") arg = arg.strip() data = get_data(arg, arch) if data is None: print("Not found") continue filename = stdin_input("to filename? ") if not filename: print(repr(data)) else: open(filename, "wb").write(data) elif cmd == "Q": break else: usage() do_cleanup()
def main(name, brief, debug, rec_debug, **unused_options): misc.check_not_running_as_root() global stack if not os.path.isfile(name): print(name, "is an invalid file name!") return 1 arch = get_archive(name) stack.append((name, arch)) if debug or brief: show_log(arch, rec_debug, brief) raise SystemExit(0) else: show(name, arch) while 1: try: toks = stdin_input('? ').split(None, 1) except EOFError: # Ctrl-D print() # Clear line. break if not toks: usage() continue if len(toks) == 1: cmd = toks[0] arg = '' else: cmd, arg = toks cmd = cmd.upper() if cmd == 'U': if len(stack) > 1: arch = stack[-1][1] arch.lib.close() del stack[-1] name, arch = stack[-1] show(name, arch) elif cmd == 'O': if not arg: arg = stdin_input('open name? ') arg = arg.strip() try: arch = get_archive(arg) except NotAnArchiveError as e: print(e) continue if arch is None: print(arg, "not found") continue stack.append((arg, arch)) show(arg, arch) elif cmd == 'X': if not arg: arg = stdin_input('extract name? ') arg = arg.strip() data = get_data(arg, arch) if data is None: print("Not found") continue filename = stdin_input('to filename? ') if not filename: print(repr(data)) else: open(filename, 'wb').write(data) elif cmd == 'Q': break else: usage() do_cleanup()