Skip to content

Commit

Permalink
build: add mpldc.exe CLI to Windows binary release
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmueller committed Nov 17, 2023
1 parent 2fe4e48 commit 603e2ce
Show file tree
Hide file tree
Showing 8 changed files with 106 additions and 10 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
0.5.2
- build: add mpldc.exe CLI to Windows binary release
- setup: bump dclab to 0.55.6
0.5.1
- setup: introduce windows and macOS binary releases (#22)
- build: introduce Windows and macOS binary releases (#22)
0.5.0
- fix: fast file size check for detecting invalid upload did not take place
- fix: delete temporary files when they are not needed anymore (#24)
Expand Down
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ The documentation, including the code reference and examples, is available at

Installation
------------
..
Installers for Windows and macOS are available at the `release page <https://github.com/GuckLab/MPL-Data-Cast/releases>`__.

Installers for Windows and macOS are available at the `release page <https://github.com/GuckLab/MPL-Data-Cast/releases>`__.

If you have Python 3 installed, you can install MPL-Data-Cast with

Expand Down
4 changes: 4 additions & 0 deletions build-recipes/MPLDataCastLauncherCLI.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from mpl_data_cast.cli.cli import cli

if __name__ == "__main__":
cli()
25 changes: 25 additions & 0 deletions build-recipes/win_MPLDataCast.spec
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,27 @@ if not exists("./{}Launcher.py".format(NAME)):
"Please run pyinstaller from the 'build-recipes' directory.")


cli_a = Analysis(
[NAME + "LauncherCLI.py"],
pathex=["."],
hookspath=["."],
runtime_hooks=None)

cli_pyz = PYZ(cli_a.pure)

cli_exe = EXE(
cli_pyz,
cli_a.scripts,
[],
exclude_binaries=True,
name="mpldc.exe",
debug=False,
strip=False,
upx=False,
icon=NAME + ".ico",
console=bool(mpl_data_cast.__version__.count("post")),)


gui_a = Analysis(
[NAME + "Launcher.py"],
pathex=["."],
Expand Down Expand Up @@ -42,6 +63,10 @@ gui_exe = EXE(
console=bool(mpl_data_cast.__version__.count("post")),)

coll = COLLECT(
cli_exe,
cli_a.binaries,
cli_a.zipfiles,
cli_a.datas,
gui_exe,
gui_a.binaries,
gui_a.zipfiles,
Expand Down
43 changes: 43 additions & 0 deletions build-recipes/win_environment.iss
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
const EnvironmentKey = 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment';

procedure EnvAddPath(Path: string);
var
Paths: string;
begin
{ Retrieve current path (use empty string if entry not exists) }
if not RegQueryStringValue(HKEY_LOCAL_MACHINE, EnvironmentKey, 'Path', Paths)
then Paths := '';

{ Skip if string already found in path }
if Pos(';' + Uppercase(Path) + ';', ';' + Uppercase(Paths) + ';') > 0 then exit;

{ App string to the end of the path variable }
Paths := Paths + ';'+ Path +';'

{ Overwrite (or create if missing) path environment variable }
if RegWriteStringValue(HKEY_LOCAL_MACHINE, EnvironmentKey, 'Path', Paths)
then Log(Format('The [%s] added to PATH: [%s]', [Path, Paths]))
else Log(Format('Error while adding the [%s] to PATH: [%s]', [Path, Paths]));
end;

procedure EnvRemovePath(Path: string);
var
Paths: string;
P: Integer;
begin
{ Skip if registry entry not exists }
if not RegQueryStringValue(HKEY_LOCAL_MACHINE, EnvironmentKey, 'Path', Paths) then
exit;

{ Skip if string not found in path }
P := Pos(';' + Uppercase(Path) + ';', ';' + Uppercase(Paths) + ';');
if P = 0 then exit;

{ Update path variable }
Delete(Paths, P - 1, Length(Path) + 1);

{ Overwrite path environment variable }
if RegWriteStringValue(HKEY_LOCAL_MACHINE, EnvironmentKey, 'Path', Paths)
then Log(Format('The [%s] removed from PATH: [%s]', [Path, Paths]))
else Log(Format('Error while removing the [%s] from PATH: [%s]', [Path, Paths]));
end;
14 changes: 14 additions & 0 deletions build-recipes/win_mpl-data-cast.iss_dummy
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@
#define MyAppPlatform "win32"
#define MyAppExeName "MPLDataCast.exe"
#define MyAppDir = SourcePath + "dist\MPLDataCast\"
#include "environment.iss"

[Setup]
ChangesEnvironment=true
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
Expand Down Expand Up @@ -113,4 +115,16 @@ begin
UnInstallOldVersion();
end;
end;
if CurStep = ssPostInstall then
begin
EnvAddPath(ExpandConstant('{app}') +'\bin');
end;
end;

procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
if CurUninstallStep = usPostUninstall then
begin
EnvRemovePath(ExpandConstant('{app}') +'\bin');
end;
end;
19 changes: 13 additions & 6 deletions docs/sec_intro.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,36 @@ Introduction
Installation
------------

For Windows and macOS users, there are installers available at the
`release page <https://github.com/GuckLab/MPL-Data-Cast/releases>`_. The
Windows installer also includes the :ref:`command line interface (CLI) <sec_cli>`
``mpldc.exe``.


If you have Python installed, you can install MPL-Data-Cast with::

pip install mpl_data_cast


The :ref:`Command-line interface <sec_cli>` is available via::

mpldc
# or
python -m mpl_data_cast.cli

A graphical user interface (GUI), including installers for Windows and macOS,
is currently under development. An initial GUI to use MPL-Data-Cast for
transfering RT-DC data is already available. If you encounter bugs or have
suggestions for improvement, open an issue on
`GitHub <https://github.com/GuckLab/MPL-Data-Cast/issues>`_.
To start the GUI, run::

mpldc-gui
# or
python -m mpl_data_cast.gui


Issue tracker
-------------

If you encounter bugs or have suggestions for improvement, open an issue on
`GitHub <https://github.com/GuckLab/MPL-Data-Cast/issues>`_.


Motivation
----------

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ classifiers = [
license = {text = "GPL v3"}
dependencies = [
"click>=8",
"dclab>=0.55.5",
"dclab>=0.55.6",
"h5py>=3.8.0",
"hdf5plugin", # compression
"numpy>=1.21", # CVE-2021-33430
Expand Down

0 comments on commit 603e2ce

Please sign in to comment.