Date: Tuesday, March 31, 2020 @ 20:15:43
  Author: diabonas
Revision: 608346

upgpkg: weechat-matrix 0.1.0-2: install to site-packages

Improve the packaging thanks to dvzrv and eschwartz: the Python module is now
properly installed to site-pages, which has the advantage of tracked dependency
versions as well as pregenerated bytecode. The only thing left in
/usr/share/weechat/python/ is the WeeChat script that needs to be symlinked to
WEECHAT_HOME by the user. It was renamed to weechat-matrix.py because using the
name matrix.py leads to a circular import error.

As a result users will have to update their symbolic links after the upgrade,
this is documented by a post_upgrade message.

Modified:
  weechat-matrix/trunk/PKGBUILD
  weechat-matrix/trunk/weechat-matrix.install

------------------------+
 PKGBUILD               |   23 ++++++++++++++++++-----
 weechat-matrix.install |   11 ++++++++++-
 2 files changed, 28 insertions(+), 6 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD    2020-03-31 20:08:12 UTC (rev 608345)
+++ PKGBUILD    2020-03-31 20:15:43 UTC (rev 608346)
@@ -2,7 +2,7 @@
 pkgname=weechat-matrix
 pkgver=0.1.0
 _tag=f0249bd923607220508386aefb2cb2507e11669e # git show-ref "$pkgver"
-pkgrel=1
+pkgrel=2
 pkgdesc='Weechat Matrix protocol script written in Python'
 arch=('any')
 url='https://github.com/poljar/weechat-matrix'
@@ -9,7 +9,7 @@
 license=('ISC')
 depends=('python-atomicwrites' 'python-attrs' 'python-future' 'python-logbook' 
'python-matrix-nio'
          'python-pygments' 'python-pyopenssl' 'python-webcolors')
-makedepends=('git')
+makedepends=('git' 'python-dephell')
 checkdepends=('python-hypothesis' 'python-pytest')
 optdepends=('python-aiohttp: matrix_sso_helper support'
             'python-magic: matrix_upload support'
@@ -16,8 +16,10 @@
             'python-requests: matrix_decrypt and matrix_upload support'
             'ranger: default plumber for matrix_decrypt')
 install='weechat-matrix.install'
-source=("git+$url.git?signed#tag=$_tag")
-sha512sums=('SKIP')
+source=("git+$url.git?signed#tag=$_tag"
+        "weechat-matrix_fix-pyproject.patch::$url/pull/170.patch")
+sha512sums=('SKIP'
+            
'64a7b3a9db4b2414e2cdcf8e4a3af3c5336136518066473dfe4cc7cc07351d0a4b37460fa20c8fb26a011295808da16dc9bb94ccf6e944c3391c7ed7569fc4ef')
 validpgpkeys=('689A3B5BC6560AB4C99A2A0581314DA807EF4E22') # Damir Jelić 
(poljar) <[email protected]>
 
 pkgver() {
@@ -28,8 +30,18 @@
 prepare() {
        cd "$pkgname"
        sed -ri 's|#!/usr/bin/env( -S)? python3|#!/usr/bin/python3|' 
contrib/*.py
+
+       # https://github.com/poljar/weechat-matrix/pull/170
+       # https://github.com/poljar/weechat-matrix/issues/166
+       patch --strip=1 --input="$srcdir/weechat-matrix_fix-pyproject.patch"
+       dephell deps convert --from pyproject.toml --to setup.py
 }
 
+build() {
+       cd "$pkgname"
+       python setup.py build
+}
+
 check() {
        cd "$pkgname"
        python -m pytest
@@ -37,7 +49,8 @@
 
 package() {
        cd "$pkgname"
-       make DESTDIR="$pkgdir" PREFIX=/usr/share/weechat install
+       python setup.py install --root="$pkgdir" --optimize=1 --skip-build
+       install -Dm755 main.py 
"$pkgdir/usr/share/weechat/python/weechat-matrix.py"
        for _script in matrix_decrypt matrix_sso_helper matrix_upload
        do
                install -Dm755 "contrib/$_script.py" "$pkgdir/usr/bin/$_script"

Modified: weechat-matrix.install
===================================================================
--- weechat-matrix.install      2020-03-31 20:08:12 UTC (rev 608345)
+++ weechat-matrix.install      2020-03-31 20:15:43 UTC (rev 608346)
@@ -1,4 +1,13 @@
 post_install() {
        echo "To add this script to your WeeChat installation, please execute 
the following command:"
-       echo "ln -s /usr/share/weechat/python/{matrix,matrix.py} -t 
~/.weechat/python"
+       echo "ln -s /usr/share/weechat/python/weechat-matrix.py -t 
~/.weechat/python"
 }
+
+post_upgrade() {
+       if [ "$2" = "0.1.0-1" ]
+       then
+               echo "The location of the script has changed, please update 
your symbolic links:"
+               echo "rm ~/.weechat/python/{matrix,matrix.py}"
+               echo "ln -s /usr/share/weechat/python/weechat-matrix.py -t 
~/.weechat/python"
+       fi
+}

Reply via email to