set_version.py 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  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. import os
  12. import argparse
  13. def run():
  14. parser = argparse.ArgumentParser()
  15. parser.add_argument('info_file', metavar='info-file',
  16. help="text file containing version info")
  17. parser.add_argument('exe_file', metavar='exe-file',
  18. help="full pathname of a Windows executable")
  19. args = parser.parse_args()
  20. info_file = os.path.abspath(args.info_file)
  21. exe_file = os.path.abspath(args.exe_file)
  22. try:
  23. import PyInstaller.utils.win32.versioninfo
  24. vs = PyInstaller.utils.win32.versioninfo.SetVersion(exe_file, info_file)
  25. print(('Version info set in: %s' % exe_file))
  26. except KeyboardInterrupt:
  27. raise SystemExit("Aborted by user request.")
  28. if __name__ == '__main__':
  29. run()