makespec.py 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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 a spec file containing the 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(
  23. 'scriptname',
  24. nargs='+',
  25. )
  26. return p
  27. def run():
  28. p = generate_parser()
  29. args = p.parse_args()
  30. PyInstaller.log.__process_options(p, args)
  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. try:
  37. name = PyInstaller.building.makespec.main(args.scriptname, **vars(args))
  38. print('Wrote %s.' % name)
  39. print('Now run pyinstaller.py to build the executable.')
  40. except KeyboardInterrupt:
  41. raise SystemExit("Aborted by user request.")
  42. if __name__ == '__main__':
  43. run()