Generate Python requirements

- Fix RHBZ#2276256

Use upstream's `requirements.txt` to generate Python runtime
requirements. Meson isn't helping us in keeping the list of requirements
complete and up to date. With the added script this becomes semi
automated.
This commit is contained in:
Sandro 2024-04-21 15:01:53 +02:00
commit 60f51c6b15
No known key found for this signature in database
GPG key ID: 68D0FF74FE9F382A
3 changed files with 51 additions and 75 deletions

65
.gitignore vendored
View file

@ -1,63 +1,2 @@
/bottles-2.0.9.7.tar.gz
/bottles-2.0.9.8.tar.gz
/bottles-2.0.9.9.tar.gz
/bottles-2.1.0.tar.gz
/bottles-2.1.0.2.tar.gz
/bottles-2.1.0.4.tar.gz
/bottles-2.1.0.5.tar.gz
/bottles-2.1.0.6.tar.gz
/bottles-2.1.0.7.tar.gz
/bottles-2.1.1.tar.gz
/bottles-2.1.2.tar.gz
/bottles-3.0.1.1.tar.gz
/bottles-3.0.2.tar.gz
/bottles-3.0.5.tar.gz
/bottles-3.0.6.tar.gz
/bottles-3.0.8.tar.gz
/bottles-3.0.9.tar.gz
/bottles-3.1.0.tar.gz
/bottles-3.1.1.tar.gz
/bottles-3.1.2.tar.gz
/bottles-3.1.3.tar.gz
/bottles-3.1.4.tar.gz
/bottles-3.1.5.tar.gz
/bottles-3.1.6.tar.gz
/bottles-3.1.7.tar.gz
/bottles-3.1.8.tar.gz
/bottles-3.1.9.tar.gz
/bottles-3.1.10.tar.gz
/bottles-3.1.11.tar.gz
/bottles-3.1.12.tar.gz
/bottles-3.1.13.tar.gz
/bottles-3.1.14.tar.gz
/bottles-3.1.15.tar.gz
/bottles-2021.7.3.tar.gz
/bottles-2021.7.14.tar.gz
/bottles-2021.7.28.tar.gz
/bottles-2021.8.14.tar.gz
/bottles-2021.8.28.tar.gz
/bottles-2021.9.14.tar.gz
/bottles-2021.9.28.tar.gz
/bottles-2021.10.14.tar.gz
/bottles-2021.10.28.tar.gz
/bottles-2021.11.14.tar.gz
/bottles-2021.11.28.tar.gz
/bottles-2021.12.14.tar.gz
/bottles-2021.12.28.tar.gz
/bottles-2022.1.14.tar.gz
/bottles-2022.1.28.tar.gz
/bottles-2022.2.14.tar.gz
/bottles-2022.2.28.tar.gz
/bottles-2022.3.14.tar.gz
/bottles-2022.3.28.tar.gz
/bottles-2022.4.14.tar.gz
/bottles-2022.4.28.tar.gz
/bottles-2022.5.2.tar.gz
/bottles-2022.5.14.tar.gz
/bottles-2022.5.28-trento-3.tar.gz
/bottles-2022.6.14-brescia-1.tar.gz
/bottles-2022.7.14-brescia-3.tar.gz
/Bottles-51.6.tar.gz
/Bottles-51.9.tar.gz
/Bottles-51.10.tar.gz
/Bottles-51.11.tar.gz
/Bottles*tar.gz
require*.txt

View file

@ -44,20 +44,29 @@ Requires: hicolor-icon-theme
Requires: libadwaita >= 1.1.99
Requires: p7zip p7zip-plugins %dnl # needed by the dependencies manager
Requires: patool
Requires: python3-gobject
Requires: python3-icoextract %dnl # icons support
Requires: python3-markdown
Requires: python3-patool
Requires: python3-pefile %dnl # icons support
Requires: python3-pyyaml
Requires: python3-requests %dnl # needed by the download manager
Requires: python3-urllib3 %dnl # needed by the download manager
Requires: xdpyinfo %dnl # needed by the display util
Requires: python3-pathvalidate
Requires: python3-fvs
Requires: python3-vkbasalt-cli
Requires: ImageMagick %dnl # https://bugzilla.redhat.com/show_bug.cgi?id=2227538
Requires: python3-chardet %dnl # https://bugzilla.redhat.com/show_bug.cgi?id=2240292
# Use `generate_requires.sh` to generate Python runtime dependencies
# using upstream's `requirements.txt`, which is included in the tarball,
# but not used by Meson.
Requires: python3dist(pyyaml)
Requires: python3dist(pycurl)
Requires: python3dist(chardet)
Requires: python3dist(requests)
Requires: python3dist(markdown)
Requires: python3dist(icoextract)
Requires: python3dist(patool)
Requires: python3dist(pathvalidate)
Requires: python3dist(fvs)
Requires: python3dist(orjson)
Requires: python3dist(pycairo)
Requires: python3dist(pygobject)
Requires: python3dist(charset-normalizer)
Requires: python3dist(idna)
Requires: python3dist(urllib3)
Requires: python3dist(certifi)
Requires: python3dist(pefile)
%description
Bottles lets you run Windows software on Linux, such as applications

28
generate_requires.sh Executable file
View file

@ -0,0 +1,28 @@
#!/bin/bash
SPEC_FILE="bottles.spec"
REQUIREMENTS_FILE="requirements.txt"
REQUIREMENTS_SPEC="requires.txt"
# Remove file(s) from previous run
[ -f ${REQUIREMENTS_SPEC} ] && rm -vf ${REQUIREMENTS_SPEC}
[ -f ${REQUIREMENTS_FILE} ] && rm -vf ${REQUIREMENTS_FILE}
# Make sure sources are present
spectool -gSf ${SPEC_FILE} 2>/dev/null
TARBALL="$(rpmspec --parse bottles.spec 2>/dev/null | grep Source0 | sed -r 's/^.*(Bottles.*)/\1/')"
TAR_REQ_FILE="$(tar tzf ${TARBALL} | grep ${REQUIREMENTS_FILE})"
tar -x ${TAR_REQ_FILE} --strip-components=1 -zf ${TARBALL}
# Remove version pinning from listed dependencies
# Require `requests`. The `use_chardet_on_py3` extra is not packaged in
# Fedora, but we have the required version of `chardet` present.
# Remove `wheel` from list - not a runtime requirement.
sed -r -i \
-e 's/(^.*)==.*$/\1/g' \
-e 's/(^requests)\[.*\]/\1/' \
-e '/wheel/d' \
requirements.txt
# Transform requirements for inclusion in spec file
for REQ in $(grep -v '^#' ${REQUIREMENTS_FILE}); do
echo "Requires: python3dist(${REQ@L})" >> ${REQUIREMENTS_SPEC}
done