Skip to content

Commit

Permalink
Issue #304: Wrap PyInstaller/__main__.py in pyinstaller.py.
Browse files Browse the repository at this point in the history
  • Loading branch information
matysek committed Feb 24, 2013
1 parent e1c27d4 commit bf5c5ba
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 36 deletions.
75 changes: 39 additions & 36 deletions PyInstaller/__main__.py
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#! /usr/bin/env python
#-----------------------------------------------------------------------------
# Copyright (c) 2013, PyInstaller Development Team.
#
Expand All @@ -7,9 +6,12 @@
#
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
#
# Wrapper around Configure.py / Makespec.py / Build.py
#


"""
Main command-line interface to PyInstaller.
"""


import os
import optparse
Expand Down Expand Up @@ -47,39 +49,40 @@ def __add_options(parser):
help='show program version')


def main():
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()
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)
def run():
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()
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)

run_build(opts, spec_file)
except KeyboardInterrupt:
raise SystemExit("Aborted by user request.")


if __name__ == '__main__':
try:
main()
except KeyboardInterrupt:
raise SystemExit("Aborted by user request.")
run()
18 changes: 18 additions & 0 deletions pyinstaller.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#! /usr/bin/env python
#-----------------------------------------------------------------------------
# Copyright (c) 2013, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License with exception
# for distributing bootloader.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------


"""
Main command-line interface to PyInstaller.
"""

if __name__ == '__main__':
from PyInstaller.__main__ import run
run()

0 comments on commit bf5c5ba

Please sign in to comment.