1#-----------------------------------------------------------------------------
2# Copyright (c) 2013-2019, PyInstaller Development Team.
3#
4# Distributed under the terms of the GNU General Public License with exception
5# for distributing bootloader.
6#
7# The full license is in the file COPYING.txt, distributed with this software.
8#-----------------------------------------------------------------------------
9
10
11"""
12Automatically build spec files containing a description of the project
13"""
14
15import argparse
16import os
17
18import PyInstaller.building.makespec
19import PyInstaller.log
20
21
22def run():
23    p = argparse.ArgumentParser()
24    PyInstaller.building.makespec.__add_options(p)
25    PyInstaller.log.__add_options(p)
26    p.add_argument('scriptname', nargs='+')
27
28    args = p.parse_args()
29    PyInstaller.log.__process_options(p, args)
30
31    # Split pathex by using the path separator
32    temppaths = args.pathex[:]
33    args.pathex = []
34    for p in temppaths:
35        args.pathex.extend(p.split(os.pathsep))
36
37    try:
38        name = PyInstaller.building.makespec.main(args.scriptname, **vars(args))
39        print('wrote %s' % name)
40        print('now run pyinstaller.py to build the executable')
41    except KeyboardInterrupt:
42        raise SystemExit("Aborted by user request.")
43
44if __name__ == '__main__':
45    run()
46