summaryrefslogtreecommitdiff
path: root/package
diff options
context:
space:
mode:
authorPicca Frédéric-Emmanuel <picca@debian.org>2022-02-02 14:19:58 +0100
committerPicca Frédéric-Emmanuel <picca@debian.org>2022-02-02 14:19:58 +0100
commit4e774db12d5ebe7a20eded6dd434a289e27999e5 (patch)
treea9822974ba45196f1e3740995ab157d6eb214a04 /package
parentd3194b1a9c4404ba93afac43d97172ab24c57098 (diff)
New upstream version 1.0.0+dfsg
Diffstat (limited to 'package')
-rw-r--r--package/debian10/control3
-rw-r--r--package/debian11/control3
-rw-r--r--package/windows/README.rst24
-rw-r--r--package/windows/create-installer.iss.template92
-rw-r--r--package/windows/pyinstaller-silx-view.spec55
-rw-r--r--package/windows/pyinstaller.spec162
6 files changed, 227 insertions, 112 deletions
diff --git a/package/debian10/control b/package/debian10/control
index d724e69..25cf293 100644
--- a/package/debian10/control
+++ b/package/debian10/control
@@ -16,7 +16,6 @@ Build-Depends: cython3 (>= 0.23.2),
python3-all-dev,
python3-dateutil,
python3-qtconsole,
- python3-six,
python3-fabio,
python3-h5py,
python3-mako,
@@ -29,6 +28,8 @@ Build-Depends: cython3 (>= 0.23.2),
python3-pyqt5,
python3-pyqt5.qtopengl,
python3-pyqt5.qtsvg,
+ python3-pytest,
+ python3-pytest-xvfb,
python3-scipy,
python3-setuptools,
python3-sphinx,
diff --git a/package/debian11/control b/package/debian11/control
index 5e387fc..775753d 100644
--- a/package/debian11/control
+++ b/package/debian11/control
@@ -34,11 +34,12 @@ Build-Depends: cython3 (>= 0.23.2),
python3-pyqt5.qtopengl-dbg,
python3-pyqt5.qtsvg,
python3-pyqt5.qtsvg-dbg,
+ python3-pytest,
+ python3-pytest-xvfb,
python3-qtconsole,
python3-scipy,
python3-scipy-dbg,
python3-setuptools,
- python3-six,
python3-sphinx,
python3-sphinxcontrib.programoutput,
xauth,
diff --git a/package/windows/README.rst b/package/windows/README.rst
index 97c1d54..cbf6fa3 100644
--- a/package/windows/README.rst
+++ b/package/windows/README.rst
@@ -4,20 +4,13 @@ Generate silx fat binary for Windows
Pre-requisites
--------------
-- PyInstaller must be installed.
- It is best to use the development version to use package specific hooks up-to-date.
- Run either::
-
- pip install -r requirements-dev.txt
-
- or::
-
- pip install https://github.com/pyinstaller/pyinstaller/archive/develop.zip
-
+- `PyInstaller <https://pyinstaller.readthedocs.io/>`_ must be installed.
+ Run: ``pip install -r requirements-dev.txt``
+- `InnoSetup <https://jrsoftware.org/isinfo.php>`_ must be installed and in the ``PATH``.
- silx and all its dependencies must be INSTALLED::
pip install silx[full]
-
+
or from the source directory::
pip install .[full]
@@ -28,10 +21,5 @@ Procedure
- Go to the ``package/windows`` folder in the source directory
- Run ``pyinstaller pyinstaller.spec``.
- This generates a fat binary in ``package/windows/dist/silx/`` for the generic launcher ``silx.exe``.
-- Run ``pyinstaller pyinstaller-silx-view.spec``.
- This generates a fat binary in ``package/windows/dist/silx-view/`` for the silx view command ``silx-view.exe``.
-- Copy ``silx-view.exe`` and ``silx-view.exe.manifest`` to ``package/windows/dist/silx/``.
- This is a hack until PyInstaller supports multiple executables (see https://github.com/pyinstaller/pyinstaller/issues/1527).
-- Zip ``package\windows\dist\silx`` to make the application available as a single zip file.
-
+ This will generates the fat binary in ``package/windows/dist/``.
+ It will then run InnoSetup to create the installer in ``package/windows/artifacts/``.
diff --git a/package/windows/create-installer.iss.template b/package/windows/create-installer.iss.template
new file mode 100644
index 0000000..ffb6af4
--- /dev/null
+++ b/package/windows/create-installer.iss.template
@@ -0,0 +1,92 @@
+[Setup]
+AppId={{A694A78C-B4D1-4983-8BC6-A84D30341EB4}
+AppName=silx view
+AppVersion=#Version
+AppVerName=silx-view-#Version
+AppPublisher=ESRF
+AppPublisherURL=https://www.silx.org
+AppSupportURL=https://github.com/silx-kit/silx
+AppUpdatesURL=https://github.com/silx-kit/silx/releases
+DefaultDirName={autopf}\silx
+DefaultGroupName=silx
+LicenseFile=..\..\LICENSE
+OutputDir=artifacts
+OutputBaseFilename=silx-#Version-x64
+Compression=lzma
+SolidCompression=yes
+ArchitecturesAllowed=x64
+ArchitecturesInstallIn64BitMode=x64
+WizardStyle=modern
+
+[Languages]
+Name: "english"; MessagesFile: "compiler:Default.isl"
+
+[Files]
+Source: "dist\silx\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs
+Source: "silx.ico"; DestDir: "{app}"
+
+[Icons]
+Name: "{group}\silx"; Filename: "{app}\silx-view.exe"; IconFilename: "{app}\silx.ico"
+Name: "{group}\Uninstall"; Filename: "{uninstallexe}"
+
+// Code from https://stackoverflow.com/questions/2000296/inno-setup-how-to-automatically-uninstall-previous-installed-version/2099805#209980
+[Code]
+
+/////////////////////////////////////////////////////////////////////
+function GetUninstallString(): String;
+var
+ sUnInstPath: String;
+ sUnInstallString: String;
+begin
+ sUnInstPath := ExpandConstant('Software\Microsoft\Windows\CurrentVersion\Uninstall\{#emit SetupSetting("AppId")}_is1');
+ sUnInstallString := '';
+ if not RegQueryStringValue(HKLM, sUnInstPath, 'UninstallString', sUnInstallString) then
+ RegQueryStringValue(HKCU, sUnInstPath, 'UninstallString', sUnInstallString);
+ Result := sUnInstallString;
+end;
+
+
+/////////////////////////////////////////////////////////////////////
+function IsUpgrade(): Boolean;
+begin
+ Result := (GetUninstallString() <> '');
+end;
+
+
+/////////////////////////////////////////////////////////////////////
+function UnInstallOldVersion(): Integer;
+var
+ sUnInstallString: String;
+ iResultCode: Integer;
+begin
+ // Return Values:
+ // 1 - uninstall string is empty
+ // 2 - error executing the UnInstallString
+ // 3 - successfully executed the UnInstallString
+
+ // default return value
+ Result := 0;
+
+ // get the uninstall string of the old app
+ sUnInstallString := GetUninstallString();
+ if sUnInstallString <> '' then begin
+ sUnInstallString := RemoveQuotes(sUnInstallString);
+ if Exec(sUnInstallString, '/VERYSILENT /NORESTART /SUPPRESSMSGBOXES','', SW_HIDE, ewWaitUntilTerminated, iResultCode) then
+ Result := 3
+ else
+ Result := 2;
+ end else
+ Result := 1;
+end;
+
+/////////////////////////////////////////////////////////////////////
+procedure CurStepChanged(CurStep: TSetupStep);
+begin
+ if (CurStep=ssInstall) then
+ begin
+ if (IsUpgrade()) then
+ begin
+ UnInstallOldVersion();
+ end;
+ end;
+end;
diff --git a/package/windows/pyinstaller-silx-view.spec b/package/windows/pyinstaller-silx-view.spec
deleted file mode 100644
index cf01fd1..0000000
--- a/package/windows/pyinstaller-silx-view.spec
+++ /dev/null
@@ -1,55 +0,0 @@
-# -*- mode: python -*-
-import os.path
-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")
-
-
-hiddenimports = collect_submodules('fabio')
-
-
-block_cipher = None
-
-
-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)
-
-pyz = PYZ(a.pure,
- a.zipped_data,
- cipher=block_cipher)
-
-exe = EXE(pyz,
- a.scripts,
- [],
- exclude_binaries=True,
- name='silx-view',
- debug=False,
- bootloader_ignore_signals=False,
- strip=False,
- upx=False,
- console=False,
- icon='silx.ico')
-
-coll = COLLECT(exe,
- a.binaries,
- a.zipfiles,
- a.datas,
- strip=False,
- upx=False,
- name='silx-view')
diff --git a/package/windows/pyinstaller.spec b/package/windows/pyinstaller.spec
index 548e41a..59b66c1 100644
--- a/package/windows/pyinstaller.spec
+++ b/package/windows/pyinstaller.spec
@@ -1,5 +1,9 @@
# -*- mode: python -*-
import os.path
+from pathlib import Path
+import shutil
+import subprocess
+
from PyInstaller.utils.hooks import collect_data_files, collect_submodules
datas = []
@@ -9,47 +13,131 @@ 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 = collect_submodules('fabio')
+hiddenimports = []
+hiddenimports += collect_submodules('fabio')
+hiddenimports += collect_submodules('hdf5plugin')
block_cipher = None
-a = Analysis(['bootstrap.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)
-
-pyz = PYZ(a.pure,
- a.zipped_data,
- cipher=block_cipher)
-
-exe = EXE(pyz,
- a.scripts,
- [],
- exclude_binaries=True,
- name='silx',
- debug=False,
- bootloader_ignore_signals=False,
- strip=False,
- upx=False,
- console=True,
- icon='silx.ico')
-
-coll = COLLECT(exe,
- a.binaries,
- a.zipfiles,
- a.datas,
- strip=False,
- upx=False,
- name='silx')
+silx_a = Analysis(
+ ['bootstrap.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)
+
+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')),
+)
+
+
+silx_pyz = PYZ(
+ silx_a.pure,
+ silx_a.zipped_data,
+ cipher=block_cipher)
+
+silx_exe = EXE(
+ silx_pyz,
+ silx_a.scripts,
+ silx_a.dependencies,
+ [],
+ exclude_binaries=True,
+ name='silx',
+ debug=False,
+ bootloader_ignore_signals=False,
+ strip=False,
+ upx=False,
+ console=True,
+ icon='silx.ico')
+
+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_exe = EXE(
+ silx_view_pyz,
+ silx_view_a.scripts,
+ silx_view_a.dependencies,
+ [],
+ exclude_binaries=True,
+ name='silx-view',
+ debug=False,
+ bootloader_ignore_signals=False,
+ strip=False,
+ upx=False,
+ console=False,
+ icon='silx.ico')
+
+silx_view_coll = COLLECT(
+ silx_view_exe,
+ silx_view_a.binaries,
+ silx_view_a.zipfiles,
+ silx_view_a.datas,
+ strip=False,
+ upx=False,
+ name='silx-view')
+
+
+# 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')
+
+move_silx_view_exe()
+
+# Run innosetup
+def innosetup():
+ from silx import version
+
+ config_name = "create-installer.iss"
+ with open(config_name + '.template') as f:
+ content = f.read().replace("#Version", version)
+ with open(config_name, "w") as f:
+ f.write(content)
+
+ subprocess.call(["iscc", os.path.join(SPECPATH, config_name)])
+ os.remove(config_name)
+
+innosetup()