summaryrefslogtreecommitdiff
path: root/package/windows
diff options
context:
space:
mode:
Diffstat (limited to 'package/windows')
-rw-r--r--package/windows/README.rst13
-rw-r--r--package/windows/bootstrap-silx-view.py3
-rw-r--r--package/windows/bootstrap.py3
-rw-r--r--package/windows/create-installer.iss.template4
-rw-r--r--package/windows/pyinstaller.spec132
5 files changed, 87 insertions, 68 deletions
diff --git a/package/windows/README.rst b/package/windows/README.rst
index cbf6fa3..c263dce 100644
--- a/package/windows/README.rst
+++ b/package/windows/README.rst
@@ -23,3 +23,16 @@ Procedure
- Run ``pyinstaller pyinstaller.spec``.
This will generates the fat binary in ``package/windows/dist/``.
It will then run InnoSetup to create the installer in ``package/windows/artifacts/``.
+
+
+Troubleshooting
+---------------
+
+In case of issues with anti-virus during the build process, try to re-install PyInstaller
+from source and rebuild the bootloader:
+
+```
+SET PYINSTALLER_COMPILE_BOOTLOADER=1
+SET PYINSTALLER_BOOTLOADER_WAF_ARGS=--msvc_target=x64
+pip install pyinstaller --no-binary pyinstaller
+``` \ No newline at end of file
diff --git a/package/windows/bootstrap-silx-view.py b/package/windows/bootstrap-silx-view.py
index f8da02d..e2f2513 100644
--- a/package/windows/bootstrap-silx-view.py
+++ b/package/windows/bootstrap-silx-view.py
@@ -1,5 +1,3 @@
-# coding: utf-8
-
import logging
logging.basicConfig()
@@ -9,4 +7,3 @@ from silx.app.view.main import main
if __name__ == "__main__":
main(sys.argv)
-
diff --git a/package/windows/bootstrap.py b/package/windows/bootstrap.py
index 3c6e887..f7a0155 100644
--- a/package/windows/bootstrap.py
+++ b/package/windows/bootstrap.py
@@ -1,5 +1,3 @@
-# coding: utf-8
-
import logging
logging.basicConfig()
@@ -13,4 +11,3 @@ from silx.__main__ import main
if __name__ == "__main__":
main()
-
diff --git a/package/windows/create-installer.iss.template b/package/windows/create-installer.iss.template
index ffb6af4..88c1a52 100644
--- a/package/windows/create-installer.iss.template
+++ b/package/windows/create-installer.iss.template
@@ -9,9 +9,9 @@ AppSupportURL=https://github.com/silx-kit/silx
AppUpdatesURL=https://github.com/silx-kit/silx/releases
DefaultDirName={autopf}\silx
DefaultGroupName=silx
-LicenseFile=..\..\LICENSE
+LicenseFile=LICENSE
OutputDir=artifacts
-OutputBaseFilename=silx-#Version-x64
+OutputBaseFilename=silx-#Version-windows-installer-x86_64
Compression=lzma
SolidCompression=yes
ArchitecturesAllowed=x64
diff --git a/package/windows/pyinstaller.spec b/package/windows/pyinstaller.spec
index 59b66c1..bff8a9f 100644
--- a/package/windows/pyinstaller.spec
+++ b/package/windows/pyinstaller.spec
@@ -1,31 +1,33 @@
# -*- mode: python -*-
+import importlib.metadata
import os.path
from pathlib import Path
import shutil
import subprocess
+import sys
from PyInstaller.utils.hooks import collect_data_files, collect_submodules
+
datas = []
+
PROJECT_PATH = os.path.abspath(os.path.join(SPECPATH, "..", ".."))
datas.append((os.path.join(PROJECT_PATH, "README.rst"), "."))
datas.append((os.path.join(PROJECT_PATH, "LICENSE"), "."))
datas.append((os.path.join(PROJECT_PATH, "copyright"), "."))
datas += collect_data_files("silx.resources")
-datas += collect_data_files("hdf5plugin")
-hiddenimports = []
-hiddenimports += collect_submodules('fabio')
-hiddenimports += collect_submodules('hdf5plugin')
+hiddenimports = ["hdf5plugin"]
+hiddenimports += collect_submodules("fabio")
block_cipher = None
silx_a = Analysis(
- ['bootstrap.py'],
+ ["bootstrap.py"],
pathex=[],
binaries=[],
datas=datas,
@@ -33,35 +35,13 @@ silx_a = Analysis(
hookspath=[],
runtime_hooks=[],
excludes=[],
- win_no_prefer_redirects=False,
- win_private_assemblies=False,
cipher=block_cipher,
- noarchive=False)
-
-silx_view_a = Analysis(
- ['bootstrap-silx-view.py'],
- pathex=[],
- binaries=[],
- datas=datas,
- hiddenimports=hiddenimports,
- hookspath=[],
- runtime_hooks=[],
- excludes=[],
- win_no_prefer_redirects=False,
- win_private_assemblies=False,
- cipher=block_cipher,
- noarchive=False)
-
-MERGE(
- (silx_a, 'silx', os.path.join('silx', 'silx')),
- (silx_view_a, 'silx-view', os.path.join('silx-view', 'silx-view')),
+ noarchive=False,
)
-silx_pyz = PYZ(
- silx_a.pure,
- silx_a.zipped_data,
- cipher=block_cipher)
+silx_pyz = PYZ(silx_a.pure, silx_a.zipped_data, cipher=block_cipher)
+
silx_exe = EXE(
silx_pyz,
@@ -69,28 +49,32 @@ silx_exe = EXE(
silx_a.dependencies,
[],
exclude_binaries=True,
- name='silx',
+ name="silx",
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=False,
console=True,
- icon='silx.ico')
+ icon="silx.ico",
+)
+
+
+silx_view_a = Analysis(
+ ["bootstrap-silx-view.py"],
+ pathex=[],
+ binaries=[],
+ datas=datas,
+ hiddenimports=hiddenimports,
+ hookspath=[],
+ runtime_hooks=[],
+ excludes=[],
+ cipher=block_cipher,
+ noarchive=False,
+)
-silx_coll = COLLECT(
- silx_exe,
- silx_a.binaries,
- silx_a.zipfiles,
- silx_a.datas,
- strip=False,
- upx=False,
- name='silx')
+silx_view_pyz = PYZ(silx_view_a.pure, silx_view_a.zipped_data, cipher=block_cipher)
-silx_view_pyz = PYZ(
- silx_view_a.pure,
- silx_view_a.zipped_data,
- cipher=block_cipher)
silx_view_exe = EXE(
silx_view_pyz,
@@ -98,46 +82,74 @@ silx_view_exe = EXE(
silx_view_a.dependencies,
[],
exclude_binaries=True,
- name='silx-view',
+ name="silx-view",
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=False,
console=False,
- icon='silx.ico')
+ icon="silx.ico",
+)
-silx_view_coll = COLLECT(
+
+silx_coll = COLLECT(
silx_view_exe,
silx_view_a.binaries,
silx_view_a.zipfiles,
silx_view_a.datas,
+ silx_exe,
+ silx_a.binaries,
+ silx_a.zipfiles,
+ silx_a.datas,
strip=False,
upx=False,
- name='silx-view')
+ name="silx",
+)
+
+
+# Generate license file from current Python env
+def create_license_file(filename: str):
+ import PyQt5.QtCore
+ with open(filename, "w") as f:
+ f.write(
+ f"""
+This is free software.
-# Fix MERGE by copying produced silx-view.exe file
-def move_silx_view_exe():
- dist = Path(SPECPATH) / 'dist'
- shutil.copy2(
- src=dist / 'silx-view' / 'silx-view.exe',
- dst=dist / 'silx',
- )
- shutil.rmtree(dist / 'silx-view')
+This distribution of silx is provided under the
+GNU General Public License v3 (https://www.gnu.org/licenses/gpl-3.0.en.html) since it includes PyQt5.
+
+It includes mainy software packages with different licenses:
+
+- Python ({sys.version}): PSF license, https://www.python.org/
+- Qt ({PyQt5.QtCore.qVersion()}): GNU Lesser General Public License v3, https://www.qt.io/
+"""
+ )
+
+ for dist in sorted(
+ importlib.metadata.distributions(), key=lambda d: d.name.lower()
+ ):
+ license = dist.metadata.get("License")
+ homepage = dist.metadata.get("Home-page")
+ info = ", ".join(info for info in (license, homepage) if info)
+ f.write(f"- {dist.name} ({dist.version}): {info}\n")
+
+
+create_license_file("LICENSE")
-move_silx_view_exe()
# Run innosetup
def innosetup():
- from silx import version
+ from silx import strictversion
config_name = "create-installer.iss"
- with open(config_name + '.template') as f:
- content = f.read().replace("#Version", version)
+ with open(config_name + ".template") as f:
+ content = f.read().replace("#Version", strictversion)
with open(config_name, "w") as f:
f.write(content)
subprocess.call(["iscc", os.path.join(SPECPATH, config_name)])
os.remove(config_name)
+
innosetup()