mirror of
https://github.com/naruxde/revpicommander.git
synced 2025-11-08 16:43:53 +01:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f08ea8ebc6 | |||
| 1a087f213d | |||
| 44d9ea4561 |
57
Makefile
57
Makefile
@@ -3,11 +3,14 @@ MAKEFLAGS = --no-print-directory --no-builtin-rules
|
|||||||
.DEFAULT_GOAL = all
|
.DEFAULT_GOAL = all
|
||||||
|
|
||||||
# Variables
|
# Variables
|
||||||
PACKAGE = revpicommander
|
PACKAGE = revpicommander
|
||||||
APP_NAME = RevPi\ Commander
|
APP_NAME = RevPi\ Commander
|
||||||
APP_IDENT = org.revpimodio.revpicommander
|
APP_IDENT = org.revpimodio.revpicommander
|
||||||
APPLE_SIG = "Developer ID Application: Sven Sager (U3N5843D9K)"
|
APPLE_SIG = "Developer ID Application: Sven Sager (U3N5843D9K)"
|
||||||
|
|
||||||
|
# Python interpreter to use for venv creation
|
||||||
|
SYSTEM_PYTHON = python3
|
||||||
|
|
||||||
# Set path to create the virtual environment with package name
|
# Set path to create the virtual environment with package name
|
||||||
ifdef PYTHON3_VENV
|
ifdef PYTHON3_VENV
|
||||||
VENV_PATH = $(PYTHON3_VENV)/$(PACKAGE)
|
VENV_PATH = $(PYTHON3_VENV)/$(PACKAGE)
|
||||||
@@ -15,39 +18,37 @@ else
|
|||||||
VENV_PATH = venv
|
VENV_PATH = venv
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# If virtualenv exists, use it. If not, use PATH to find commands
|
# Set targets for "all"-target
|
||||||
SYSTEM_PYTHON = python3
|
all: build-ui build-rc build
|
||||||
PYTHON = $(or $(wildcard $(VENV_PATH)/bin/python), $(SYSTEM_PYTHON))
|
|
||||||
|
|
||||||
APP_VERSION = $(shell "$(PYTHON)" src/$(PACKAGE) --version | cut -d ' ' -f 2)
|
|
||||||
|
|
||||||
all: build_ui build_rc test build
|
|
||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
|
|
||||||
## Environment
|
## Virtual environment creation with SYSTEM_PYTHON
|
||||||
venv-info:
|
|
||||||
@echo Environment for $(APP_NAME) $(APP_VERSION)
|
|
||||||
@echo Using path: "$(VENV_PATH)"
|
|
||||||
exit 0
|
|
||||||
|
|
||||||
venv:
|
venv:
|
||||||
# Start with empty environment
|
# Start with empty environment
|
||||||
"$(SYSTEM_PYTHON)" -m venv "$(VENV_PATH)"
|
"$(SYSTEM_PYTHON)" -m venv "$(VENV_PATH)"
|
||||||
source "$(VENV_PATH)/bin/activate" && \
|
"$(VENV_PATH)/bin/pip" install --upgrade pip
|
||||||
python3 -m pip install --upgrade pip && \
|
"$(VENV_PATH)/bin/pip" install --upgrade -r requirements.txt
|
||||||
python3 -m pip install -r requirements.txt
|
|
||||||
exit 0
|
|
||||||
|
|
||||||
venv-ssp:
|
venv-ssp:
|
||||||
# Include system installed site-packages and add just missing modules
|
# Include system installed site-packages and add just missing modules
|
||||||
"$(SYSTEM_PYTHON)" -m venv --system-site-packages "$(VENV_PATH)"
|
"$(SYSTEM_PYTHON)" -m venv --system-site-packages "$(VENV_PATH)"
|
||||||
source "$(VENV_PATH)/bin/activate" && \
|
"$(VENV_PATH)/bin/pip" install --upgrade pip
|
||||||
python3 -m pip install --upgrade pip && \
|
"$(VENV_PATH)/bin/pip" install --upgrade -r requirements.txt
|
||||||
python3 -m pip install -r requirements.txt
|
|
||||||
exit 0
|
|
||||||
|
|
||||||
.PHONY: venv-info venv venv-ssp
|
.PHONY: venv venv-ssp
|
||||||
|
|
||||||
|
# Choose python interpreter from venv or system
|
||||||
|
PYTHON = $(or $(wildcard $(VENV_PATH)/bin/python), $(SYSTEM_PYTHON))
|
||||||
|
|
||||||
|
# Read app version from program
|
||||||
|
APP_VERSION = $(shell "$(PYTHON)" src/$(PACKAGE) --version | cut -d ' ' -f 2)
|
||||||
|
|
||||||
|
# Environment info
|
||||||
|
venv-info:
|
||||||
|
@echo Environment for $(APP_NAME) $(APP_VERSION)
|
||||||
|
@echo Using path: "$(VENV_PATH)"
|
||||||
|
|
||||||
|
.PHONY: venv-info
|
||||||
|
|
||||||
## Compile Qt UI files to python code
|
## Compile Qt UI files to python code
|
||||||
build-ui:
|
build-ui:
|
||||||
@@ -109,6 +110,7 @@ app-licenses:
|
|||||||
|
|
||||||
app: build-ui build-rc app-licenses
|
app: build-ui build-rc app-licenses
|
||||||
"$(PYTHON)" -m PyInstaller -n $(APP_NAME) \
|
"$(PYTHON)" -m PyInstaller -n $(APP_NAME) \
|
||||||
|
--collect-submodules=zeroconf \
|
||||||
--add-data="src/$(PACKAGE)/locale:./$(PACKAGE)/locale" \
|
--add-data="src/$(PACKAGE)/locale:./$(PACKAGE)/locale" \
|
||||||
--add-data="dist/bundled-libraries.md:$(PACKAGE)/open-source-licenses" \
|
--add-data="dist/bundled-libraries.md:$(PACKAGE)/open-source-licenses" \
|
||||||
--add-data="dist/open-source-licenses.*:$(PACKAGE)/open-source-licenses" \
|
--add-data="dist/open-source-licenses.*:$(PACKAGE)/open-source-licenses" \
|
||||||
@@ -123,6 +125,7 @@ app: build-ui build-rc app-licenses
|
|||||||
|
|
||||||
app-mac: build-ui build-rc app-licenses
|
app-mac: build-ui build-rc app-licenses
|
||||||
"$(PYTHON)" -m PyInstaller -n $(APP_NAME) \
|
"$(PYTHON)" -m PyInstaller -n $(APP_NAME) \
|
||||||
|
--collect-submodules=zeroconf \
|
||||||
--add-data="src/$(PACKAGE)/locale:./$(PACKAGE)/locale" \
|
--add-data="src/$(PACKAGE)/locale:./$(PACKAGE)/locale" \
|
||||||
--add-data="dist/bundled-libraries.md:$(PACKAGE)/open-source-licenses" \
|
--add-data="dist/bundled-libraries.md:$(PACKAGE)/open-source-licenses" \
|
||||||
--add-data="dist/open-source-licenses.*:$(PACKAGE)/open-source-licenses" \
|
--add-data="dist/open-source-licenses.*:$(PACKAGE)/open-source-licenses" \
|
||||||
@@ -164,6 +167,8 @@ clean:
|
|||||||
rm -rf build dist src/*.egg-info
|
rm -rf build dist src/*.egg-info
|
||||||
# PyInstaller created files
|
# PyInstaller created files
|
||||||
rm -rf *.spec
|
rm -rf *.spec
|
||||||
|
# Pycaches
|
||||||
|
find . -type d -name '__pycache__' -exec rm -r {} \+
|
||||||
|
|
||||||
distclean: clean
|
distclean: clean
|
||||||
# Virtual environment
|
# Virtual environment
|
||||||
|
|||||||
23
make.bat
23
make.bat
@@ -2,7 +2,7 @@
|
|||||||
set PACKAGE=revpicommander
|
set PACKAGE=revpicommander
|
||||||
set APP_NAME=RevPi Commander
|
set APP_NAME=RevPi Commander
|
||||||
|
|
||||||
set PYTHON=venv\\Scripts\\python.exe
|
set PYTHON=venv\Scripts\python.exe
|
||||||
|
|
||||||
if "%1" == "venv" goto venv
|
if "%1" == "venv" goto venv
|
||||||
if "%1" == "test" goto test
|
if "%1" == "test" goto test
|
||||||
@@ -24,7 +24,7 @@ goto end
|
|||||||
|
|
||||||
:venv
|
:venv
|
||||||
python -m venv venv
|
python -m venv venv
|
||||||
venv\\Scripts\\pip.exe install -r requirements.txt
|
venv\Scripts\pip.exe install -r requirements.txt
|
||||||
goto end
|
goto end
|
||||||
|
|
||||||
:test
|
:test
|
||||||
@@ -41,7 +41,7 @@ goto end
|
|||||||
mkdir dist
|
mkdir dist
|
||||||
%PYTHON% -m piplicenses ^
|
%PYTHON% -m piplicenses ^
|
||||||
--format=markdown ^
|
--format=markdown ^
|
||||||
--output-file dist/bundled-libraries.md
|
--output-file dist\\bundled-libraries.md
|
||||||
%PYTHON% -m piplicenses ^
|
%PYTHON% -m piplicenses ^
|
||||||
--with-authors ^
|
--with-authors ^
|
||||||
--with-urls ^
|
--with-urls ^
|
||||||
@@ -49,7 +49,7 @@ goto end
|
|||||||
--with-license-file ^
|
--with-license-file ^
|
||||||
--no-license-path ^
|
--no-license-path ^
|
||||||
--format=json ^
|
--format=json ^
|
||||||
--output-file dist/open-source-licenses.json
|
--output-file dist\\open-source-licenses.json
|
||||||
%PYTHON% -m piplicenses ^
|
%PYTHON% -m piplicenses ^
|
||||||
--with-authors ^
|
--with-authors ^
|
||||||
--with-urls ^
|
--with-urls ^
|
||||||
@@ -57,18 +57,19 @@ goto end
|
|||||||
--with-license-file ^
|
--with-license-file ^
|
||||||
--no-license-path ^
|
--no-license-path ^
|
||||||
--format=plain-vertical ^
|
--format=plain-vertical ^
|
||||||
--output-file dist/open-source-licenses.txt
|
--output-file dist\\open-source-licenses.txt
|
||||||
%PYTHON% -m PyInstaller -n "%APP_NAME%" ^
|
%PYTHON% -m PyInstaller -n "%APP_NAME%" ^
|
||||||
--add-data="dist/bundled-libraries.md;%PACKAGE%\open-source-licenses" ^
|
--collect-submodules=zeroconf ^
|
||||||
--add-data="dist/open-source-licenses.*;%PACKAGE%\open-source-licenses" ^
|
--add-data="dist\\bundled-libraries.md;%PACKAGE%\\open-source-licenses" ^
|
||||||
--add-data="src\%PACKAGE%\locale;.\%PACKAGE%\locale" ^
|
--add-data="dist\\open-source-licenses.*;%PACKAGE%\\open-source-licenses" ^
|
||||||
--add-data="data\%PACKAGE%.ico;." ^
|
--add-data="src\\%PACKAGE%\\locale;.\\%PACKAGE%\\locale" ^
|
||||||
|
--add-data="data\\%PACKAGE%.ico;." ^
|
||||||
--icon=data\\%PACKAGE%.ico ^
|
--icon=data\\%PACKAGE%.ico ^
|
||||||
--noconfirm ^
|
--noconfirm ^
|
||||||
--clean ^
|
--clean ^
|
||||||
--onedir ^
|
--onedir ^
|
||||||
--windowed ^
|
--windowed ^
|
||||||
src\\%PACKAGE%\\__main__.py
|
src\%PACKAGE%\__main__.py
|
||||||
goto end
|
goto end
|
||||||
|
|
||||||
:distclean
|
:distclean
|
||||||
@@ -76,7 +77,7 @@ goto end
|
|||||||
|
|
||||||
:clean
|
:clean
|
||||||
rmdir /S /Q .pytest_cache
|
rmdir /S /Q .pytest_cache
|
||||||
rmdir /S /Q build dist src\%PACKAGE%.egg-info
|
rmdir /S /Q build dist src\\%PACKAGE%.egg-info
|
||||||
del /Q *.spec
|
del /Q *.spec
|
||||||
|
|
||||||
:end
|
:end
|
||||||
|
|||||||
Reference in New Issue
Block a user