mirror of
https://github.com/naruxde/revpicommander.git
synced 2025-11-08 16:43:53 +01:00
build: Upgrade buildsystem with new Makefile and make.bat
If a PyInstaller target is called from the Makefile, all libraries installed in the virtual environment are captured with version and license. The file 'bundled-libraries.md' contains a list of libraries with version and license. The file 'open-source-licenses.txt' includes the name, version, author, project URL, description and complete license for each installed library. The files are included in the output of the PyInstaller.
This commit is contained in:
81
make.bat
81
make.bat
@@ -2,38 +2,77 @@
|
||||
set PACKAGE=revpicommander
|
||||
set APP_NAME=RevPi Commander
|
||||
|
||||
set PYTHON=venv\\Scripts\\python.exe
|
||||
|
||||
if "%1" == "venv" goto venv
|
||||
if "%1" == "installer" goto installer
|
||||
if "%1" == "test" goto test
|
||||
if "%1" == "build" goto build
|
||||
if "%1" == "app" goto app
|
||||
if "%1" == "clean" goto clean
|
||||
if "%1" == "distclean" goto distclean
|
||||
|
||||
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
|
||||
echo venv Create your virtual environment for build process
|
||||
echo test Run defined tests of the project
|
||||
echo build Build PIP packages as source distribution and Wheel
|
||||
echo app Build this application with PyInstaller
|
||||
echo clean Clean up build artifacts after build process
|
||||
echo distclean Same as clean plus removing virtual environment
|
||||
goto end
|
||||
|
||||
:venv
|
||||
python -m venv venv
|
||||
venv\\Scripts\\pip.exe install --upgrade -r requirements.txt
|
||||
goto end
|
||||
python -m venv venv
|
||||
venv\\Scripts\\pip.exe install -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
|
||||
:test
|
||||
set PYTHONPATH=src
|
||||
%PYTHON% -m pytest
|
||||
goto end
|
||||
|
||||
:build
|
||||
%PYTHON% -m setup sdist
|
||||
%PYTHON% -m setup bdist_wheel
|
||||
goto end
|
||||
|
||||
:app
|
||||
mkdir dist
|
||||
%PYTHON% -m piplicenses ^
|
||||
--format=markdown ^
|
||||
--output-file dist/bundled-libraries.md
|
||||
%PYTHON% -m piplicenses ^
|
||||
--with-authors ^
|
||||
--with-urls ^
|
||||
--with-description ^
|
||||
--with-license-file ^
|
||||
--no-license-path ^
|
||||
--format=json ^
|
||||
--output-file dist/open-source-licenses.json
|
||||
%PYTHON% -m piplicenses ^
|
||||
--with-authors ^
|
||||
--with-urls ^
|
||||
--with-description ^
|
||||
--with-license-file ^
|
||||
--no-license-path ^
|
||||
--format=plain-vertical ^
|
||||
--output-file dist/open-source-licenses.txt
|
||||
%PYTHON% -m PyInstaller -n "%APP_NAME%" ^
|
||||
--add-data="dist/bundled-libraries.md;%PACKAGE%\open-source-licenses" ^
|
||||
--add-data="dist/open-source-licenses.*;%PACKAGE%\open-source-licenses" ^
|
||||
--noconfirm ^
|
||||
--clean ^
|
||||
--onefile ^
|
||||
src\\%PACKAGE%\\__main__.py
|
||||
goto end
|
||||
|
||||
:distclean
|
||||
rmdir /S /Q venv
|
||||
|
||||
:clean
|
||||
rmdir /S /Q build dist
|
||||
rmdir /S /Q src\%PACKAGE%.egg-info
|
||||
del *.spec
|
||||
rmdir /S /Q .pytest_cache
|
||||
rmdir /S /Q build dist src\%PACKAGE%.egg-info
|
||||
del /Q *.spec
|
||||
|
||||
:end
|
||||
|
||||
Reference in New Issue
Block a user