Update flatpak script generator

- Make the code cleaner and don't require bash
- Generate less uneeded intermediate files
- Add the flatpak-pip-generator script to make clean
- flatpak-pip-generator now requires requirements-parser from pip
This commit is contained in:
miruka 2020-09-17 18:08:02 -04:00
parent 03e4f9b85e
commit bfc3a60cad
3 changed files with 19 additions and 24 deletions

2
.gitignore vendored
View File

@ -22,7 +22,7 @@ tags
packaging/flatpak/flatpak-env packaging/flatpak/flatpak-env
packaging/flatpak/requirements.txt packaging/flatpak/requirements.txt
packaging/flatpak/flatpak-requirements.txt packaging/flatpak/flatpak-env-requirements.txt
packaging/flatpak/flatpak-pip.json packaging/flatpak/flatpak-pip.json
packaging/flatpak/flatpak-pip-generator packaging/flatpak/flatpak-pip-generator
.flatpak-builder/ .flatpak-builder/

View File

@ -111,6 +111,7 @@ for(file, $$list($$glob_filenames(*.py))) {
QMAKE_CLEAN *= $$MOC_DIR $$OBJECTS_DIR $$RCC_DIR $$PYCACHE_DIRS $$QRC_FILE QMAKE_CLEAN *= $$MOC_DIR $$OBJECTS_DIR $$RCC_DIR $$PYCACHE_DIRS $$QRC_FILE
QMAKE_CLEAN *= $$BUILD_DIR $$TARGET Makefile mirage.pro.user .qmake.stash QMAKE_CLEAN *= $$BUILD_DIR $$TARGET Makefile mirage.pro.user .qmake.stash
QMAKE_CLEAN *= $$glob_filenames(*.pyc, *.qmlc, *.jsc, *.egg-info) QMAKE_CLEAN *= $$glob_filenames(*.pyc, *.qmlc, *.jsc, *.egg-info)
QMAKE_CLEAN *= packaging/flatpak/flatpak-env packaging/flatpak/requirements.txt QMAKE_CLEAN *= packaging/flatpak/flatpak-env
QMAKE_CLEAN *= packaging/flatpak/flatpak-requirements.txt QMAKE_CLEAN *= packaging/flatpak/flatpak-pip-generator
QMAKE_CLEAN *= packaging/flatpak/flatpak-env-requirements.txt
QMAKE_CLEAN *= packaging/flatpak/flatpak-pip.json .flatpak-builder QMAKE_CLEAN *= packaging/flatpak/flatpak-pip.json .flatpak-builder

View File

@ -1,30 +1,24 @@
#!/usr/bin/env bash #!/usr/bin/env sh
set -e set -e
DIR="$(dirname "$(readlink -f "$0")")" dir="$(dirname "$(readlink -f "$0")")"
pip_generator_url='https://raw.githubusercontent.com/flatpak/flatpak-builder-tools/master/pip/flatpak-pip-generator'
cd "$DIR" cd "$dir"
python3.7 -m venv flatpak-env python3 -m venv flatpak-env
export PATH="$DIR/flatpak-env/bin:$PATH" export PATH="$dir/flatpak-env/bin:$PATH"
if [ ! -f flatpak-pip-generator ]; then pip3 install -Ur requirements.flatpak.txt
wget https://raw.githubusercontent.com/flatpak/flatpak-builder-tools/master/pip/flatpak-pip-generator pip3 install -Ur ../../requirements.txt
fi
cat requirements.flatpak.txt ../../requirements.txt > requirements.txt # Freeze requirements, ignore blacklisted packages
pip3 freeze | grep -v six= | grep -v matrix-nio > flatpak-env-requirements.txt
flatpak-env/bin/pip install -Ur requirements.txt # Generate flatpak requirements
pip3 install requirements-parser
[ ! -f flatpak-pip-generator ] && wget "$pip_generator_url"
python3 flatpak-pip-generator -r flatpak-env-requirements.txt -o flatpak-pip
# freeze requirements and ignore blacklisted packages pip3 install PyYAML
flatpak-env/bin/pip freeze | \
grep -v PyYAML | grep -v six= | \
grep -v matrix-nio > flatpak-requirements.txt
# generate flatpak requirements
flatpak-env/bin/python flatpak-pip-generator --output flatpak-pip \
--requirements-file=flatpak-requirements.txt
flatpak-env/bin/pip install PyYAML
python3 collector.py python3 collector.py