mirror of
https://github.com/naruxde/revpicommander.git
synced 2025-11-08 16:43:53 +01:00
Adjustments for creating installations on various operating systems
Add code signing options for macOS. Adjust make.bat to create venv to use PyInstaller. Preparing script for Linux to use in /usr/bin.
This commit is contained in:
@@ -2,7 +2,7 @@ recursive-include data *
|
|||||||
recursive-include src/revpicommander *.py *.qm
|
recursive-include src/revpicommander *.py *.qm
|
||||||
recursive-include ui_dev *
|
recursive-include ui_dev *
|
||||||
include LICENSE.txt
|
include LICENSE.txt
|
||||||
include make_installer_win.bat
|
include make.bat
|
||||||
include Makefile
|
include Makefile
|
||||||
include MANIFEST.in
|
include MANIFEST.in
|
||||||
include README.md
|
include README.md
|
||||||
|
|||||||
63
Makefile
63
Makefile
@@ -4,9 +4,12 @@ MAKEFLAGS = --no-print-directory --no-builtin-rules
|
|||||||
|
|
||||||
# Variables
|
# Variables
|
||||||
PACKAGE = revpicommander
|
PACKAGE = revpicommander
|
||||||
|
APP_NAME = RevPi\ Commander
|
||||||
|
APP_IDENT = org.revpimodio.revpicommander
|
||||||
|
APPLE_SIG = "Developer ID Application: Sven Sager (U3N5843D9K)"
|
||||||
|
|
||||||
# If virtualenv exists, use it. If not, use PATH to find
|
# If virtualenv exists, use it. If not, use PATH to find, except python3
|
||||||
SYSTEM_PYTHON = $(or $(shell which python3), $(shell which python))
|
SYSTEM_PYTHON = /usr/bin/python3
|
||||||
PYTHON = $(or $(wildcard venv/bin/python), $(SYSTEM_PYTHON))
|
PYTHON = $(or $(wildcard venv/bin/python), $(SYSTEM_PYTHON))
|
||||||
SYSTEM_PYUIC5 = $(shell which pyuic5)
|
SYSTEM_PYUIC5 = $(shell which pyuic5)
|
||||||
PYUIC5 = $(or $(wildcard venv/bin/pyuic5), $(SYSTEM_PYUIC5))
|
PYUIC5 = $(or $(wildcard venv/bin/pyuic5), $(SYSTEM_PYUIC5))
|
||||||
@@ -15,10 +18,22 @@ PYRCC5 = $(or $(wildcard venv/bin/pyrcc5), $(SYSTEM_PYRCC5))
|
|||||||
SYSTEM_PYLUP5 = $(shell which pylupdate5)
|
SYSTEM_PYLUP5 = $(shell which pylupdate5)
|
||||||
PYLUP5 = $(or $(wildcard venv/bin/pylupdate5), $(SYSTEM_PYLUP5))
|
PYLUP5 = $(or $(wildcard venv/bin/pylupdate5), $(SYSTEM_PYLUP5))
|
||||||
|
|
||||||
|
APP_VERSION = $(shell $(PYTHON) src/$(PACKAGE) --version)
|
||||||
|
|
||||||
all: build_ui build_rc build
|
all: build_ui build_rc build
|
||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
|
|
||||||
|
## Environment
|
||||||
|
venv:
|
||||||
|
$(SYSTEM_PYTHON) -m venv venv
|
||||||
|
source venv/bin/activate && \
|
||||||
|
python3 -m pip install --upgrade pip && \
|
||||||
|
python3 -m pip install -r requirements.txt
|
||||||
|
exit 0
|
||||||
|
|
||||||
|
.PHONY: venv
|
||||||
|
|
||||||
## Compile Qt UI files to python code
|
## Compile Qt UI files to python code
|
||||||
build_ui:
|
build_ui:
|
||||||
cd ui_dev && for ui_file in *.ui; do \
|
cd ui_dev && for ui_file in *.ui; do \
|
||||||
@@ -39,16 +54,6 @@ update_translation:
|
|||||||
|
|
||||||
.PHONY: build_ui build_rc update_translation
|
.PHONY: build_ui build_rc update_translation
|
||||||
|
|
||||||
## Environment
|
|
||||||
venv:
|
|
||||||
rm -rf venv
|
|
||||||
$(SYSTEM_PYTHON) -m venv venv
|
|
||||||
|
|
||||||
deps:
|
|
||||||
$(PYTHON) -m pip install --upgrade pip -r requirements.txt
|
|
||||||
|
|
||||||
.PHONY: venv deps
|
|
||||||
|
|
||||||
## Build, install
|
## Build, install
|
||||||
build: build_ui build_rc
|
build: build_ui build_rc
|
||||||
$(PYTHON) -m setup sdist
|
$(PYTHON) -m setup sdist
|
||||||
@@ -60,24 +65,44 @@ install:
|
|||||||
.PHONY: build install
|
.PHONY: build install
|
||||||
|
|
||||||
## PyInstaller
|
## PyInstaller
|
||||||
installer_mac: build
|
installer_mac: build_ui build_rc
|
||||||
$(PYTHON) -m PyInstaller -n "RevPi Commander" \
|
$(PYTHON) -m PyInstaller -n $(APP_NAME) \
|
||||||
--add-data="src/$(PACKAGE)/locale:./revpicommander/locale" \
|
--add-data="src/$(PACKAGE)/locale:./$(PACKAGE)/locale" \
|
||||||
--add-data="data/$(PACKAGE).icns:." \
|
--add-data="data/$(PACKAGE).icns:." \
|
||||||
--icon=data/$(PACKAGE).icns \
|
--icon=data/$(PACKAGE).icns \
|
||||||
--noconfirm \
|
--noconfirm \
|
||||||
--clean \
|
--clean \
|
||||||
--onedir \
|
--onedir \
|
||||||
--windowed \
|
--windowed \
|
||||||
|
--osx-bundle-identifier $APP_IDENT \
|
||||||
|
--codesign-identity $(APPLE_SIG) \
|
||||||
src/$(PACKAGE)/__main__.py
|
src/$(PACKAGE)/__main__.py
|
||||||
|
|
||||||
installer_win: all
|
installer_mac_dmg: installer_mac
|
||||||
make_installer_win.bat
|
mkdir dist/dmg
|
||||||
|
mv dist/$(APP_NAME).app dist/dmg
|
||||||
|
create-dmg \
|
||||||
|
--volname $(APP_NAME) \
|
||||||
|
--background data/dmg_background.png \
|
||||||
|
--window-pos 200 120 \
|
||||||
|
--window-size 480 300 \
|
||||||
|
--icon-size 64 \
|
||||||
|
--icon $(APP_NAME).app 64 64 \
|
||||||
|
--hide-extension $(APP_NAME).app \
|
||||||
|
--app-drop-link 288 64 \
|
||||||
|
--add-file LICENSE.txt LICENSE.txt 192 180 \
|
||||||
|
--codesign $(APPLE_SIG) \
|
||||||
|
--notarize AC_PASSWORD \
|
||||||
|
dist/$(APP_NAME)\ $(APP_VERSION).dmg \
|
||||||
|
dist/dmg
|
||||||
|
|
||||||
.PHONY: installer_mac installer_win
|
.PHONY: installer_mac installer_mac_dmg
|
||||||
|
|
||||||
## Clean
|
## Clean
|
||||||
clean:
|
clean:
|
||||||
rm -rf build dist src/*.egg-info *.spec
|
rm -rf build dist src/*.egg-info *.spec
|
||||||
|
|
||||||
.PHONY: clean
|
clean-all: clean
|
||||||
|
rm -R venv
|
||||||
|
|
||||||
|
.PHONY: clean clean-all
|
||||||
|
|||||||
BIN
data/dmg_background.png
Normal file
BIN
data/dmg_background.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 172 KiB |
@@ -1,3 +1,9 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
# Used to call the entry point, if packed with pybuild as application.
|
||||||
|
# PYBUILD_INSTALL_ARGS=--install-lib=/usr/share/revpicommander/ \
|
||||||
|
# --install-scripts=/usr/share/revpicommander/
|
||||||
|
#
|
||||||
|
# In that case the entry point will not find the revpicommander module in
|
||||||
|
# the python lib.
|
||||||
|
|
||||||
exec "/usr/share/revpicommander/revpicommander.py" "$@"
|
exec "/usr/share/revpicommander/revpicommander-gui" "$@"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
[Desktop Entry]
|
[Desktop Entry]
|
||||||
Name=RevPi PLC Commander
|
Name=RevPi Commander
|
||||||
Comment=Controls the Python PLC program on your Revolution PI
|
Comment=Controls the Python PLC program on your Revolution PI
|
||||||
Comment[de]=Kontrolliert das Python PLC Programm auf dem Revolution PI
|
Comment[de]=Kontrolliert das Python PLC Programm auf dem Revolution PI
|
||||||
Exec=/usr/bin/revpicommander
|
Exec=/usr/bin/revpicommander
|
||||||
@@ -7,4 +7,3 @@ Icon=revpicommander
|
|||||||
Terminal=false
|
Terminal=false
|
||||||
Type=Application
|
Type=Application
|
||||||
Categories=Application;
|
Categories=Application;
|
||||||
#StartupNotify=true
|
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 5.3 KiB |
39
make.bat
Normal file
39
make.bat
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
@echo off
|
||||||
|
set PACKAGE=revpicommander
|
||||||
|
set APP_NAME=RevPi Commander
|
||||||
|
|
||||||
|
if "%1" == "venv" goto venv
|
||||||
|
if "%1" == "installer" goto installer
|
||||||
|
if "%1" == "clean" goto clean
|
||||||
|
|
||||||
|
echo Make script for "%APP_NAME%" on Windows
|
||||||
|
echo.
|
||||||
|
echo Need action:
|
||||||
|
echo venv Create / update your virtual environment for build process
|
||||||
|
echo installer Build this application with PyInstaller
|
||||||
|
echo clean Clean up your environment after build process
|
||||||
|
goto end
|
||||||
|
|
||||||
|
:venv
|
||||||
|
python -m venv venv
|
||||||
|
venv\\Scripts\\pip.exe install --upgrade -r requirements.txt
|
||||||
|
goto end
|
||||||
|
|
||||||
|
:installer
|
||||||
|
venv\\Scripts\\pyinstaller -n "%APP_NAME%" ^
|
||||||
|
--add-data="src\%PACKAGE%\locale;.\%PACKAGE%\locale" ^
|
||||||
|
--add-data="data\%PACKAGE%.ico;." ^
|
||||||
|
--icon=data\\%PACKAGE%.ico ^
|
||||||
|
--noconfirm ^
|
||||||
|
--clean ^
|
||||||
|
--onedir ^
|
||||||
|
--windowed ^
|
||||||
|
src\\%PACKAGE%\\__main__.py
|
||||||
|
goto end
|
||||||
|
|
||||||
|
:clean
|
||||||
|
rmdir /S /Q build dist
|
||||||
|
rmdir /S /Q src\%PACKAGE%.egg-info
|
||||||
|
del *.spec
|
||||||
|
|
||||||
|
:end
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
@echo off
|
|
||||||
set PACKAGE=revpicommander
|
|
||||||
|
|
||||||
rem python -m venv venv
|
|
||||||
rem venv\\Scripts\\activate.bat
|
|
||||||
rem pip install -r requirements.txt
|
|
||||||
|
|
||||||
pyinstaller -n "RevPi Commander" ^
|
|
||||||
--add-data="src\%PACKAGE%\locale;.\revpicommander\locale" ^
|
|
||||||
--add-data="data\%PACKAGE%.ico;." ^
|
|
||||||
--icon=data\\%PACKAGE%.ico ^
|
|
||||||
--noconfirm ^
|
|
||||||
--clean ^
|
|
||||||
--onedir ^
|
|
||||||
--windowed ^
|
|
||||||
src\\%PACKAGE%\\__main__.py
|
|
||||||
|
|
||||||
rem deactivate
|
|
||||||
1
setup.iss
Executable file → Normal file
1
setup.iss
Executable file → Normal file
@@ -8,6 +8,7 @@
|
|||||||
#define MyAppICO "data\revpicommander.ico"
|
#define MyAppICO "data\revpicommander.ico"
|
||||||
|
|
||||||
[Setup]
|
[Setup]
|
||||||
|
SignTool=kSign
|
||||||
; NOTE: The value of AppId uniquely identifies this application. Do not use the same AppId value in installers for other applications.
|
; 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.)
|
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
|
||||||
AppId={{21E8D429-0C18-462F-AFC0-56EA664DE629}
|
AppId={{21E8D429-0C18-462F-AFC0-56EA664DE629}
|
||||||
|
|||||||
2
setup.py
2
setup.py
@@ -6,7 +6,7 @@ __license__ = "GPLv3"
|
|||||||
|
|
||||||
from setuptools import find_namespace_packages, setup
|
from setuptools import find_namespace_packages, setup
|
||||||
|
|
||||||
from src.revpicommander.__main__ import __version__
|
from src.revpicommander import __version__
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="revpicommander",
|
name="revpicommander",
|
||||||
|
|||||||
@@ -3,5 +3,4 @@
|
|||||||
__author__ = "Sven Sager"
|
__author__ = "Sven Sager"
|
||||||
__copyright__ = "Copyright (C) 2023 Sven Sager"
|
__copyright__ = "Copyright (C) 2023 Sven Sager"
|
||||||
__license__ = "GPLv3"
|
__license__ = "GPLv3"
|
||||||
|
__version__ = "0.9.10rc4"
|
||||||
from .__main__ import __version__
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
__author__ = "Sven Sager"
|
__author__ = "Sven Sager"
|
||||||
__copyright__ = "Copyright (C) 2023 Sven Sager"
|
__copyright__ = "Copyright (C) 2023 Sven Sager"
|
||||||
__license__ = "GPLv3"
|
__license__ = "GPLv3"
|
||||||
__version__ = "0.9.10rc4"
|
|
||||||
|
|
||||||
# If we are running from a wheel, add the wheel to sys.path
|
# If we are running from a wheel, add the wheel to sys.path
|
||||||
if __package__ == "":
|
if __package__ == "":
|
||||||
@@ -20,6 +19,7 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
if len(sys.argv) == 2 and "--version" in sys.argv:
|
if len(sys.argv) == 2 and "--version" in sys.argv:
|
||||||
# Catch --version, if this is the only argument (sys.argv[0] is always the script name)
|
# Catch --version, if this is the only argument (sys.argv[0] is always the script name)
|
||||||
|
from revpicommander import __version__
|
||||||
print(__version__)
|
print(__version__)
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ from paramiko.ssh_exception import AuthenticationException
|
|||||||
from . import proginit as pi
|
from . import proginit as pi
|
||||||
from .ssh_tunneling.server import SSHLocalTunnel
|
from .ssh_tunneling.server import SSHLocalTunnel
|
||||||
|
|
||||||
settings = QtCore.QSettings("revpimodio.org", "RevPiCommander")
|
settings = QtCore.QSettings("revpimodio.org", "revpicommander")
|
||||||
"""Global application settings."""
|
"""Global application settings."""
|
||||||
|
|
||||||
homedir = environ.get("HOME", "") or environ.get("APPDATA", "")
|
homedir = environ.get("HOME", "") or environ.get("APPDATA", "")
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user