|
@@ -0,0 +1,32 @@
|
|
|
+import os
|
|
|
+from subprocess import run
|
|
|
+
|
|
|
+pjoin = os.path.join
|
|
|
+
|
|
|
+# Run pynsist to gather the necessary files
|
|
|
+#run([sys.executable, '-m', 'nsist', 'installer.cfg', '--no-makensis'], check=True)
|
|
|
+
|
|
|
+# Remove NSIS script - we're not using it today
|
|
|
+try:
|
|
|
+ os.unlink(pjoin('build', 'nsis', 'installer.nsi'))
|
|
|
+except FileNotFoundError:
|
|
|
+ pass
|
|
|
+
|
|
|
+# Move msvcrt files into Python directory, where they need to be installed
|
|
|
+msvcrt_dir = pjoin('build', 'nsis', 'msvcrt')
|
|
|
+python_dir = pjoin('build', 'nsis', 'Python')
|
|
|
+if os.path.isdir(msvcrt_dir):
|
|
|
+ for file in os.listdir(msvcrt_dir):
|
|
|
+ os.rename(pjoin(msvcrt_dir, file), pjoin(python_dir, file))
|
|
|
+ os.rmdir(msvcrt_dir)
|
|
|
+
|
|
|
+# Run 'heat' (part of Wix) to create a list of the files to install
|
|
|
+HEAT = os.path.join(os.environ['WIX'], 'bin', 'heat')
|
|
|
+run([HEAT, 'dir', pjoin('build', 'nsis'),
|
|
|
+ '-out', 'files.wxs', # Target file (wix xml format)
|
|
|
+ '-ag', # Autogenerated GUIDs for files ('*' - generated at compile time)
|
|
|
+ '-sfrag', # Single fragment. Not sure if it matters, but it looks neater.
|
|
|
+ '-cg', 'ApplicationFiles', # Component group. Referenced from wrapper.wxs
|
|
|
+ '-dr', 'INSTALLDIR', # Directory to install files into
|
|
|
+ '-srd', # Suppress Root Directory (don't make 'nsis' folder in install dir)
|
|
|
+ ], check=True)
|