makespec.py 1.4 KB

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