From f156ed04b9096ae1d70e7e6cbfb09267b91ae93c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20W=C3=B3jcik?= Date: Mon, 20 Apr 2020 19:22:10 +0200 Subject: [PATCH] common/hooks: remove pycompile_version, use python_version instead --- Manual.md | 8 ++------ common/environment/setup-subpkg/subpkg.sh | 2 +- .../post-install/04-create-xbps-metadata-scripts.sh | 12 +++++++++++- srcpkgs/Carla/template | 2 +- srcpkgs/angrysearch/template | 2 +- srcpkgs/anki/template | 2 +- srcpkgs/backintime-qt/template | 2 +- srcpkgs/backintime/template | 2 +- srcpkgs/blender/template | 2 +- srcpkgs/cadence/template | 2 +- srcpkgs/cinnamon-screensaver/template | 2 +- srcpkgs/cinnamon/template | 2 +- srcpkgs/etcetera/template | 2 +- srcpkgs/freecad/template | 2 +- srcpkgs/gedit-plugins/template | 2 +- srcpkgs/gedit/template | 2 +- srcpkgs/glib/template | 2 +- srcpkgs/gobject-introspection/template | 2 +- srcpkgs/gtk-doc/template | 2 +- srcpkgs/kdevelop-python/template | 2 +- srcpkgs/kitty/template | 2 +- srcpkgs/kupfer/template | 2 +- srcpkgs/manuskript/template | 2 +- srcpkgs/rhythmbox/template | 2 +- srcpkgs/sqlmap/template | 2 +- srcpkgs/syncplay/template | 2 +- srcpkgs/system-config-printer/template | 2 +- srcpkgs/treeline/template | 2 +- srcpkgs/virt-manager/template | 2 +- srcpkgs/znc/template | 2 +- 30 files changed, 41 insertions(+), 35 deletions(-) diff --git a/Manual.md b/Manual.md index 6fff065f7c6..576b3d2032e 100644 --- a/Manual.md +++ b/Manual.md @@ -1458,17 +1458,13 @@ by blanks, Example: `pycompile_module="foo blah"`. If a python module installs a recursively by the target python version. This differs from `pycompile_module` in that any path may be specified, Example: `pycompile_dirs="usr/share/foo"`. -- `pycompile_version`: this variable expects the python version that is used to -byte-compile the python code (it generates the `.py[co]` files at post-install time). -By default it's set to `2.7` for `python 2.x` packages. - -> NOTE: you need to define it *only* for non-Python modules. - - `python_version`: this variable expects the supported Python major version. By default it's set to `2`. This variable is needed for multi-language applications (e.g., the application is written in C while the command is written in Python) or just single Python file ones that live in `/usr/bin`. +> NOTE: you need to define it *only* for non-Python modules. + Also, a set of useful variables are defined to use in the templates: | Variable | Value | diff --git a/common/environment/setup-subpkg/subpkg.sh b/common/environment/setup-subpkg/subpkg.sh index 6bf748fdc3d..0243d240048 100644 --- a/common/environment/setup-subpkg/subpkg.sh +++ b/common/environment/setup-subpkg/subpkg.sh @@ -27,7 +27,7 @@ unset -v font_dirs unset -v xml_entries sgml_entries xml_catalogs sgml_catalogs # xbps-triggers: pycompile -unset -v pycompile_version pycompile_dirs pycompile_module +unset -v pycompile_dirs pycompile_module # xbps-triggers: dkms unset -v dkms_modules diff --git a/common/hooks/post-install/04-create-xbps-metadata-scripts.sh b/common/hooks/post-install/04-create-xbps-metadata-scripts.sh index 3b1089cd410..0d9797469b2 100644 --- a/common/hooks/post-install/04-create-xbps-metadata-scripts.sh +++ b/common/hooks/post-install/04-create-xbps-metadata-scripts.sh @@ -258,6 +258,7 @@ _EOF # # Handle python bytecode archives with pycompile trigger. # + local pycompile_version if [ -d ${PKGDESTDIR}/usr/lib/python* ]; then pycompile_version="$(find ${PKGDESTDIR}/usr/lib/python* -prune -type d | grep -o '[[:digit:]]\.[[:digit:]]$')" if [ -z "${pycompile_module}" ]; then @@ -265,8 +266,17 @@ _EOF fi fi + if [ -n "$python_version" ]; then + pycompile_version=${python_version} + fi + + if [ "$pycompile_version" = 3 ]; then + pycompile_version=${py3_ver} + fi + if [ -n "${pycompile_dirs}" -o -n "${pycompile_module}" ]; then - echo "export pycompile_version=\"${pycompile_version:=2.7}\"" >>$tmpf + [ -n "$pycompile_version" ] || msg_error "$pkgver: byte-compilation is required, but python_version is not set\n" + echo "export pycompile_version=\"${pycompile_version}\"" >>$tmpf if [ -n "${pycompile_dirs}" ]; then echo "export pycompile_dirs=\"${pycompile_dirs}\"" >>$tmpf fi diff --git a/srcpkgs/Carla/template b/srcpkgs/Carla/template index bcd662c546a..67d611b1db6 100644 --- a/srcpkgs/Carla/template +++ b/srcpkgs/Carla/template @@ -17,7 +17,7 @@ license="GPL-2.0-or-later" homepage="http://kxstudio.linuxaudio.org/Applications:Carla" distfiles="https://github.com/falkTX/Carla/archive/v${version}.tar.gz" checksum=d0c8d8417f8cce9abe807f6359231f187d60db7121ec1dccce3b596a22ef6c41 -pycompile_version=$py3_ver +python_version=3 case $XBPS_TARGET_MACHINE in x86_64* | i686*);; diff --git a/srcpkgs/angrysearch/template b/srcpkgs/angrysearch/template index 60070f8a424..88a6954ac85 100644 --- a/srcpkgs/angrysearch/template +++ b/srcpkgs/angrysearch/template @@ -10,7 +10,7 @@ short_desc="Instant file search" maintainer="DirectorX " license="GPL-2" homepage="https://github.com/dotheevo/angrysearch/" -pycompile_version="$py3_ver" +python_version=3 pycompile_dirs="usr/share/angrysearch" distfiles="http://github.com/dotheevo/${pkgname}/archive/v${version}.tar.gz" checksum=9a550649c3efafb26660860758f2e75702ce96a0a0c50dc34ced2967b51a843f diff --git a/srcpkgs/anki/template b/srcpkgs/anki/template index c7248395618..680e008a9d4 100644 --- a/srcpkgs/anki/template +++ b/srcpkgs/anki/template @@ -16,7 +16,7 @@ changelog="https://apps.ankiweb.net/docs/changes.html" distfiles="https://apps.ankiweb.net/downloads/current/anki-${version}-source.tgz" checksum=5a53760164c77d619f55107a13099cffe620566a7f610b61b6c4b52487f3bb89 -pycompile_version="$py3_ver" +python_version=3 post_install() { vlicense LICENSE diff --git a/srcpkgs/backintime-qt/template b/srcpkgs/backintime-qt/template index 82f39c652f8..8453da9bafb 100644 --- a/srcpkgs/backintime-qt/template +++ b/srcpkgs/backintime-qt/template @@ -16,4 +16,4 @@ license="GPL-2.0-only" homepage="https://github.com/bit-team/backintime" distfiles="https://github.com/bit-team/backintime/releases/download/v${version}/backintime-${version}.tar.gz" checksum=eef2aa4f43ac23fb0d45239a4bb2f7e5025afdca2ae4e6d6d9d6e722e8b17644 -pycompile_version="$py3_ver" +python_version=3 diff --git a/srcpkgs/backintime/template b/srcpkgs/backintime/template index 58c3c110ba3..2dfc98051f7 100644 --- a/srcpkgs/backintime/template +++ b/srcpkgs/backintime/template @@ -15,4 +15,4 @@ license="GPL-2.0-only" homepage="https://github.com/bit-team/backintime" distfiles="https://github.com/bit-team/backintime/releases/download/v${version}/backintime-${version}.tar.gz" checksum=eef2aa4f43ac23fb0d45239a4bb2f7e5025afdca2ae4e6d6d9d6e722e8b17644 -pycompile_version="$py3_ver" +python_version=3 diff --git a/srcpkgs/blender/template b/srcpkgs/blender/template index e89ca7443ee..6b19078183e 100644 --- a/srcpkgs/blender/template +++ b/srcpkgs/blender/template @@ -19,7 +19,7 @@ distfiles="http://download.blender.org/source/${pkgname}-${version}.tar.xz" checksum=002adf2c51fc58a8941c87fc8e180bb1aacb73a0c223714f36d3d84da345fc65 patch_args="-Np1" -pycompile_version="$py3_ver" +python_version=3 pycompile_dirs="/usr/share/blender/$version/scripts" archs="x86_64* i686* ppc64*" diff --git a/srcpkgs/cadence/template b/srcpkgs/cadence/template index acb84d6fcdf..b429ab1f0fc 100644 --- a/srcpkgs/cadence/template +++ b/srcpkgs/cadence/template @@ -4,7 +4,7 @@ version=0.9.1 revision=1 wrksrc="Cadence-${version}" build_style=gnu-makefile -pycompile_version="$py3_ver" +python_version=3 pycompile_dirs="usr/share/cadence/src" hostmakedepends="pkg-config qt5-host-tools python3-PyQt5-devel-tools" makedepends="jack-devel ladish-devel pulseaudio-devel qt5-devel" diff --git a/srcpkgs/cinnamon-screensaver/template b/srcpkgs/cinnamon-screensaver/template index 058100fc485..e30d58eef1b 100644 --- a/srcpkgs/cinnamon-screensaver/template +++ b/srcpkgs/cinnamon-screensaver/template @@ -19,7 +19,7 @@ homepage="https://developer.linuxmint.com/projects/cinnamon-projects.html/" distfiles="https://github.com/linuxmint/${pkgname}/archive/${version}.tar.gz" checksum=6ae265ebea2adb2b488cbbfbc8647021bc0cabffc01e46c7cfaf8ca1a91b349a -pycompile_version="$py3_ver" +python_version=3 pycompile_dirs="/usr/share/cinnamon-screensaver" do_check() { diff --git a/srcpkgs/cinnamon/template b/srcpkgs/cinnamon/template index 44140d3d2f0..9c1f326b1fe 100644 --- a/srcpkgs/cinnamon/template +++ b/srcpkgs/cinnamon/template @@ -29,7 +29,7 @@ changelog="https://raw.githubusercontent.com/linuxmint/Cinnamon/${version}/debia distfiles="https://github.com/linuxmint/${pkgname}/archive/${version}.tar.gz" checksum=5bc7db4e519aed8b3b76d6b68abc02be966633005a92579071a77d23d33c8af4 -pycompile_version="$py3_ver" +python_version=3 pycompile_dirs=" usr/share/cinnamon/applets usr/share/cinnamon/cinnamon-desktop-editor diff --git a/srcpkgs/etcetera/template b/srcpkgs/etcetera/template index cfcb25f5b92..d6723467c4b 100644 --- a/srcpkgs/etcetera/template +++ b/srcpkgs/etcetera/template @@ -11,7 +11,7 @@ homepage="https://gitlab.com/jeancf/etcetera" pycompile_dirs="usr/lib/etcetera" distfiles="https://gitlab.com/jeancf/etcetera/-/archive/${version}/etcetera-${version}.tar.gz" checksum=3e4b7ff9095f6d311b12e30d745cc5d6b5c777f5daca7d01f7f1c46d273760c1 -pycompile_version="$py3_ver" +python_version=3 conf_files="/etc/etcetera.conf" do_install() { diff --git a/srcpkgs/freecad/template b/srcpkgs/freecad/template index aa7ab109e24..e57b74d7dd0 100644 --- a/srcpkgs/freecad/template +++ b/srcpkgs/freecad/template @@ -30,7 +30,7 @@ esac # FreeCAD help: qt5/assistant with datas in SQLite format depends="python3-matplotlib python3-pyside2 qt5-plugin-sqlite python3-pivy" -pycompile_version="$py3_ver" +python_version=3 pycompile_dirs="usr/lib/${pkgname}/Mod usr/lib/${pkgname}/data/Mod" short_desc="General purpose 3D CAD modeler" diff --git a/srcpkgs/gedit-plugins/template b/srcpkgs/gedit-plugins/template index 4d6b1bbb7f9..f2f94e63f59 100644 --- a/srcpkgs/gedit-plugins/template +++ b/srcpkgs/gedit-plugins/template @@ -15,4 +15,4 @@ license="GPL-2.0-or-later" homepage="https://wiki.gnome.org/action/show/Apps/Gedit/PluginsLists" distfiles="${GNOME_SITE}/${pkgname}/${version%.*}/${pkgname}-${version}.tar.xz" checksum=1151b955393f75b5ee59b51154fda4f1928f498fe986a5584d3cd440876a6af6 -pycompile_version="$py3_ver" +python_version=3 diff --git a/srcpkgs/gedit/template b/srcpkgs/gedit/template index 1c019744d28..4e273aaf182 100644 --- a/srcpkgs/gedit/template +++ b/srcpkgs/gedit/template @@ -19,7 +19,7 @@ homepage="https://wiki.gnome.org/Apps/Gedit" distfiles="${GNOME_SITE}/${pkgname}/${version%.*}/${pkgname}-${version}.tar.xz" checksum=6dc38eda227d1c368e039e9bff485d0bee9a49d5f9560c387ee08f5818a4e387 shlib_provides="libgedit-3.36.so" -pycompile_version=$py3_ver +python_version=3 build_options="gir vala" build_options_default="gir vala" diff --git a/srcpkgs/glib/template b/srcpkgs/glib/template index e6ba61ff487..155d1181426 100644 --- a/srcpkgs/glib/template +++ b/srcpkgs/glib/template @@ -38,7 +38,7 @@ libglib-devel_package() { glib-devel_package() { depends="python3 libglib-devel>=${version}_${revision}" short_desc+=" - development files" - pycompile_version="$py3_ver" + python_version=3 pycompile_dirs="usr/share/glib-2.0/codegen usr/share/glib-2.0/gdb" pkg_install() { vmove usr/bin/glib-compile-resources diff --git a/srcpkgs/gobject-introspection/template b/srcpkgs/gobject-introspection/template index 5a378407a43..c7cc727b6c0 100644 --- a/srcpkgs/gobject-introspection/template +++ b/srcpkgs/gobject-introspection/template @@ -14,7 +14,7 @@ license="GPL-2.0-or-later, LGPL-2.1-or-later" homepage="https://wiki.gnome.org/Projects/GObjectIntrospection" distfiles="${GNOME_SITE}/${pkgname}/${version%.*}/${pkgname}-${version}.tar.xz" checksum=80beae6728c134521926affff9b2e97125749b38d38744dc901f4010ee3e7fa7 -pycompile_version="$py3_ver" +python_version=3 patch_args="-Np1" if [ "$CROSS_BUILD" ]; then diff --git a/srcpkgs/gtk-doc/template b/srcpkgs/gtk-doc/template index 658f91b708c..439da0d796e 100644 --- a/srcpkgs/gtk-doc/template +++ b/srcpkgs/gtk-doc/template @@ -14,4 +14,4 @@ license="GPL-2.0-or-later, GFDL-1.1-or-later" homepage="http://www.gtk.org/gtk-doc/" distfiles="${GNOME_SITE}/${pkgname}/${version}/${pkgname}-${version}.tar.xz" checksum=de0ef034fb17cb21ab0c635ec730d19746bce52984a6706e7bbec6fb5e0b907c -pycompile_version="$py3_ver" +python_version=3 diff --git a/srcpkgs/kdevelop-python/template b/srcpkgs/kdevelop-python/template index 88ae6106146..509a2eecf06 100644 --- a/srcpkgs/kdevelop-python/template +++ b/srcpkgs/kdevelop-python/template @@ -16,7 +16,7 @@ license="LGPL-2.0-or-later, GPL-2.0-or-later" homepage="https://www.kdevelop.org/" distfiles="${KDE_SITE}/kdevelop/${version}/src/kdev-python-${version}.tar.xz" checksum=a87cdc7600545866f5e2cec282fcc5543e35d04bc963efada63f392c96e035ef -pycompile_version="$py3_ver" +python_version=3 post_install() { # don't install this python2 script: generates documentation_files, useless at runtime diff --git a/srcpkgs/kitty/template b/srcpkgs/kitty/template index a78f6c2a7bc..637fa315dcc 100644 --- a/srcpkgs/kitty/template +++ b/srcpkgs/kitty/template @@ -15,7 +15,7 @@ changelog="https://sw.kovidgoyal.net/kitty/changelog.html" distfiles="https://github.com/kovidgoyal/kitty/releases/download/v${version}/kitty-${version}.tar.xz" checksum=cd8e9f5c9932155f9d5e7f5cc72dea64bc8a509f6ff0b5fb7a72b4c79e153f8e patch_args="-Np1" -pycompile_version="$py3_ver" +python_version=3 LDFLAGS+=" -Wl,-z,stack-size=2097152" # TIOCSWINSZ on ppc overflows signed int, used in ioctl() diff --git a/srcpkgs/kupfer/template b/srcpkgs/kupfer/template index 95d1bee9e02..03e80e9fdc9 100644 --- a/srcpkgs/kupfer/template +++ b/srcpkgs/kupfer/template @@ -5,7 +5,7 @@ revision=2 archs=noarch build_style=waf3 wrksrc="${pkgname}-v${version}" -pycompile_version="$py3_ver" +python_version=3 pycompile_dirs="usr/share/kupfer/kupfer" configure_args="--no-update-mime --no-update-icon-cache" hostmakedepends="intltool python3-docutils" diff --git a/srcpkgs/manuskript/template b/srcpkgs/manuskript/template index 5a36709bfd5..c0c3269225c 100644 --- a/srcpkgs/manuskript/template +++ b/srcpkgs/manuskript/template @@ -12,7 +12,7 @@ license="GPL-3.0-or-later" homepage="http://www.theologeek.ch/manuskript" distfiles="https://github.com/olivierkes/manuskript/archive/${version}.tar.gz" checksum=bed0114c5d7787df07b420aa4909a7ae216e1581147058e03fda4c07deef8ef8 -pycompile_version="$py3_ver" +python_version=3 do_install() { vmkdir usr/share/manuskript diff --git a/srcpkgs/rhythmbox/template b/srcpkgs/rhythmbox/template index fa352591ba4..8f7ed24e6b4 100644 --- a/srcpkgs/rhythmbox/template +++ b/srcpkgs/rhythmbox/template @@ -20,7 +20,7 @@ homepage="http://www.rhythmbox.org" distfiles="${GNOME_SITE}/${pkgname}/${version::3}/${pkgname}-${version}.tar.xz" checksum=ee0eb0d7d7bdf696ac9471b19ff3bea3240d63b6cb8a134bf632054af8665d90 -pycompile_version="$py3_ver" +python_version=3 pycompile_dirs="/usr/lib/rhythmbox/plugins /usr/lib/rhythmbox/sample-plugins" diff --git a/srcpkgs/sqlmap/template b/srcpkgs/sqlmap/template index 2a420838f4c..3e0300744a0 100644 --- a/srcpkgs/sqlmap/template +++ b/srcpkgs/sqlmap/template @@ -11,7 +11,7 @@ license="GPL-2.0-or-later" homepage="http://sqlmap.org" distfiles="https://github.com/sqlmapproject/sqlmap/archive/${version}.tar.gz" checksum=3c3e89163c7506b4c09e8c0ee9227db007a4708f3a69a838e8a6b751379ffc49 -pycompile_version="$py3_ver" +python_version=3 do_install() { vmkdir usr/share/${pkgname} diff --git a/srcpkgs/syncplay/template b/srcpkgs/syncplay/template index c51caa224cb..1fa80906be6 100644 --- a/srcpkgs/syncplay/template +++ b/srcpkgs/syncplay/template @@ -13,7 +13,7 @@ license="Apache-2.0" homepage="https://syncplay.pl/" distfiles="https://github.com/syncplay/syncplay/archive/v${version}.tar.gz" checksum=a9acc53a3549af89dba9a603622429095e018f8c7c2054637fecbab87b8e15e2 -pycompile_version="$py3_ver" +python_version=3 post_install() { for res in 16x16 24x24 32x32 48x48 64x64 96x96 128x128 256x256; do diff --git a/srcpkgs/system-config-printer/template b/srcpkgs/system-config-printer/template index 04fe74ff808..c9fd88c7344 100644 --- a/srcpkgs/system-config-printer/template +++ b/srcpkgs/system-config-printer/template @@ -10,7 +10,7 @@ hostmakedepends="pkg-config intltool python3-devel xmlto desktop-file-utils" makedepends="libglib-devel cups-devel eudev-libudev-devel libusb-devel" depends="python3-cupshelpers python3-smbc python3-gobject gir-freedesktop libnotify gtk+3 dconf desktop-file-utils libsecret" -pycompile_version="$py3_ver" +python_version=3 pycompile_dirs="usr/share/system-config-printer" short_desc="CUPS printer configuration tool and status applet" maintainer="Orphaned " diff --git a/srcpkgs/treeline/template b/srcpkgs/treeline/template index 65d26128029..d19c90b8d3f 100644 --- a/srcpkgs/treeline/template +++ b/srcpkgs/treeline/template @@ -13,7 +13,7 @@ license="GPL-2.0-or-later" homepage="http://treeline.bellz.org/" distfiles="https://github.com/doug-101/TreeLine/archive/v${version}.tar.gz" checksum=04501aeebaa1cc9eb0805fc3b7ca8305d682bbf67dd28a51b627f064c9f88a06 -pycompile_version="$py3_ver" +python_version=3 do_install() { python3 install.py -x -p /usr -b "${DESTDIR}" diff --git a/srcpkgs/virt-manager/template b/srcpkgs/virt-manager/template index c0cfcc25fc1..6a5acd9e953 100644 --- a/srcpkgs/virt-manager/template +++ b/srcpkgs/virt-manager/template @@ -27,7 +27,7 @@ virt-manager-tools_package() { short_desc="Programs to create and clone virtual machines" depends="libosinfo python3-gobject libvirt-python3 python3-urllib3 libxml2-python3 python3-requests" pycompile_dirs="/usr/share/${sourcepkg}" - pycompile_version="$py3_ver" + python_version=3 pkg_install() { vmove usr/bin/virt-clone vmove usr/bin/virt-convert diff --git a/srcpkgs/znc/template b/srcpkgs/znc/template index 202e9dd567a..b84e79a9122 100644 --- a/srcpkgs/znc/template +++ b/srcpkgs/znc/template @@ -40,7 +40,7 @@ post_install() { znc-python3_package() { depends="znc>=${version}_${revision}" - pycompile_version="$py3_ver" + python_version=3 pycompile_dirs="/usr/lib/znc/modpython" short_desc+=" - python3 plugin" pkg_install() {