[arch-commits] Commit in python-flit/trunk (PKGBUILD)

Eli Schwartz eschwartz at gemini.archlinux.org
Wed Jul 28 04:30:14 UTC 2021


    Date: Wednesday, July 28, 2021 @ 04:30:13
  Author: eschwartz
Revision: 988361

upgpkg: python-flit 3.2.0-3: fix various issues with dephell + PEP 621 metadata

Use flit in-tree to run flit in order to build flit's sdist. Fixes support for
scripts, strangely including flit_core as a subdirectory of flit, and more.

Also remove tests from the install dir while we are at it.

Modified:
  python-flit/trunk/PKGBUILD

----------+
 PKGBUILD |   32 ++++++++++++++++++++++----------
 1 file changed, 22 insertions(+), 10 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2021-07-28 04:04:17 UTC (rev 988360)
+++ PKGBUILD	2021-07-28 04:30:13 UTC (rev 988361)
@@ -5,15 +5,13 @@
 pkgbase=python-$_pkgname
 pkgname=($pkgbase{,-core})
 pkgver=3.2.0
-pkgrel=2
+pkgrel=3
 pkgdesc='Simplified packaging of Python modules'
 arch=('any')
 url='https://github.com/takluyver/flit'
 license=('BSD')
 depends=('python' 'python-toml')
-makedepends=('python-setuptools' 'python-dephell'
-             'python-requests' 'python-docutils')
-             #'python-build' 'python-install' 'python-pyproject2setuppy'
+makedepends=('python-setuptools' 'python-requests' 'python-docutils')
 checkdepends=('python-pytest' 'python-testpath' 'python-responses')
 source=("$pkgbase-$pkgver.tar.gz::$url/archive/$pkgver.tar.gz")
 sha512sums=('b40768fb4b0b2a2e3116ac790dfa629da5a57cda34b10abb8ce6a8febcc3436795d5122dcfa3db2c6d07d493f00391d2ca7300112561c8ff2a0b04d77c879662')
@@ -21,21 +19,32 @@
 prepare() {
   cd $_pkgname-$pkgver
 
-  dephell deps convert --from pyproject.toml --to setup.py
+  # regenerate the dist without the "I don't support people using setup.py" flag
+  PYTHONPATH="$PWD/flit_core/" python -m flit build --format sdist
+  bsdtar --strip-components 1 -xvf \
+    dist/${_pkgname}-${pkgver}.tar.gz ${_pkgname}-${pkgver}/setup.py
 
   cd flit_core
 
-  dephell deps convert --from pyproject.toml --to setup.py
+  # flit_core.buildapi does not ever generate setup.py, only `flit build` does???
+  # since we still rely on them... patch the self builder to import from the flit directory's subclass
+  sed -i 's/from .sdist import SdistBuilder/from flit.sdist import SdistBuilder/' flit_core/build_thyself.py
+  PYTHONPATH="$PWD/../" python ./build_dists.py
+  bsdtar --strip-components 1 -xvf \
+    dist/flit_core-${pkgver}.tar.gz flit_core-${pkgver}/setup.py
 }
 
 build() {
   cd $_pkgname-$pkgver
 
-  python setup.py build
+  # flit doesn't either support people invoking setup.py outside of pip. The
+  # undocumented setuptools.launch reimplements the same thing, but less well
+  # done. Still enough for flit to build.
+  python -m setuptools.launch setup.py build
 
   cd flit_core
 
-  python setup.py build
+  python -m setuptools.launch setup.py build
 }
 
 check() {
@@ -51,7 +60,7 @@
 
   cd $_pkgname-$pkgver
 
-  python setup.py install --root="$pkgdir" --optimize=1 --skip-build
+  python -m setuptools.launch setup.py install --root="$pkgdir" --optimize=1 --skip-build
   cp -a flit/license_templates "$pkgdir"/usr/lib/python3.9/site-packages/flit/
 
   install -Dm 644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
@@ -62,7 +71,10 @@
 
   cd $_pkgname-$pkgver/flit_core
 
-  python setup.py install --root="$pkgdir" --optimize=1 --skip-build
+  python -m setuptools.launch setup.py install --root="$pkgdir" --optimize=1 --skip-build
+  # installing tests to a subdir of your project might not conflict the toplevel, but
+  # don't do it anyway...
+  rm -r "$pkgdir"/usr/lib/python*/site-packages/flit_core/tests/
 
   install -Dm 644 ../LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
 }



More information about the arch-commits mailing list