Permalink
Browse files

Issue #87: Add utility to set version info for exe file.

  • Loading branch information...
1 parent cca4c2c commit e786efb26f5c216b2db6c0dcac9550ec0e7ffd46 @matysek matysek committed Jul 24, 2013
Showing with 61 additions and 0 deletions.
  1. +37 −0 PyInstaller/cliutils/set_version.py
  2. +24 −0 utils/set_version.py
@@ -0,0 +1,37 @@
+#-----------------------------------------------------------------------------
+# 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.
+#-----------------------------------------------------------------------------
+
+
+import codecs
+import os
+import sys
+
+import PyInstaller.utils.versioninfo
+from PyInstaller.utils import misc
+
+
+def run():
+ misc.check_not_running_as_root()
+
+ out_filename = os.path.abspath('file_version_info.txt')
@rhcarvalho

rhcarvalho Oct 9, 2013

Seems that out_filename is declared but never used.

+
+ if len(sys.argv) < 3:
+ print 'Usage: python set_version.py <version_info.txt> <exe>'
+ print ' where: <version_info.txt> is file containing version info'
+ print ' and <exe> is the fullpathname of a Windows executable.'
+ raise SystemExit(1)
+
+ info_file = os.path.abspath(sys.argv[1])
+ exe_file = os.path.abspath(sys.argv[2])
+
+ try:
+ vs = PyInstaller.utils.versioninfo.SetVersion(exe_file, info_file)
+ print('Version info set in: %s' % exe_file)
+ except KeyboardInterrupt:
+ raise SystemExit("Aborted by user request.")
View
@@ -0,0 +1,24 @@
+#! /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.
+#-----------------------------------------------------------------------------
+
+
+import os
+import sys
+
+
+# Expand PYTHONPATH with PyInstaller package to support running without
+# installation.
+pyi_home = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..')
+sys.path.insert(0, pyi_home)
+
+
+if __name__ == '__main__':
+ from PyInstaller.cliutils.set_version import run
+ run()

0 comments on commit e786efb

Please sign in to comment.