Date: Friday, April 7, 2023 @ 21:37:38
  Author: dvzrv
Revision: 1441486

upgpkg: python-libcst 0.4.9-4: Rebuild against Python 3.11.

Run tests using pytest to more easily ignore/ deselect broken tests.
Remove test directories from resulting package.
Switch to PEP517.
Add all direct dependencies.
Remove unnecessary makedepends.

Modified:
  python-libcst/trunk/PKGBUILD

----------+
 PKGBUILD |   48 +++++++++++++++++++++++++++++++++++++-----------
 1 file changed, 37 insertions(+), 11 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD    2023-04-07 21:20:10 UTC (rev 1441485)
+++ PKGBUILD    2023-04-07 21:37:38 UTC (rev 1441486)
@@ -3,14 +3,32 @@
 _pkgname=libcst
 pkgname=python-libcst
 pkgver=0.4.9
-pkgrel=3
+pkgrel=4
 pkgdesc="A concrete syntax tree parser and serializer library for Python that 
preserves many aspects of Python's abstract syntax tree"
 arch=('x86_64')
 url='https://github.com/Instagram/LibCST'
 license=('MIT')
-depends=('python-typing_extensions' 'python-typing_inspect' 'python-yaml')
-makedepends=('python-setuptools-scm' 'python-setuptools-rust' 'python-isort' 
'python-black' 'ufmt')
-checkdepends=('python-hypothesis' 'python-hypothesmith')
+depends=(
+  'glibc'
+  'gcc-libs'
+  'python'
+  'python-typing_extensions'
+  'python-typing_inspect'
+  'python-pyyaml'
+)
+makedepends=(
+  'python-build'
+  'python-installer'
+  'python-setuptools-rust'
+  'python-setuptools-scm'
+  'python-wheel'
+  'ufmt'
+)
+checkdepends=(
+  'python-hypothesis'
+  'python-hypothesmith'
+  'python-pytest'
+)
 source=("https://pypi.io/packages/source/l/libcst/libcst-$pkgver.tar.gz";)
 
sha512sums=('f4f6b89ae06b319d8a7ce29e3a2446318b587684adcc80fae32fd4cf4cb3744ef20e11543d38b27622b4b748df1ca4f829d23cf0327f0f4639c93a4fc118c4df')
 
@@ -17,30 +35,38 @@
 prepare() {
   cd $_pkgname-$pkgver
 
+  # generate code for tests
   sed -i 's/subprocess.check_call/subprocess.run/' libcst/codegen/generate.py
   python -m libcst.codegen.generate all
-
-  rm 
libcst/metadata/tests/{test_full_repo_manager,test_type_inference_provider}.py 
# need pyre
 }
 
 build() {
   cd $_pkgname-$pkgver
 
-  python setup.py build
+  python -m build --wheel --no-isolation
 }
 
 check() {
+  local pytest_options=(
+    --ignore libcst/tests/test_fuzz.py
+    --deselect 
libcst/metadata/tests/test_type_inference_provider.py::TypeInferenceProviderTest::test_gen_cache_0
+    --deselect 
libcst/metadata/tests/test_type_inference_provider.py::TypeInferenceProviderTest::test_simple_class_types_0
+    --deselect 
libcst/metadata/tests/test_type_inference_provider.py::TypeInferenceProviderTest::test_with_empty_cache
+  )
   cd $_pkgname-$pkgver
 
-  python -m unittest
+  pytest -vv "${pytest_options[@]}"
 }
 
 package() {
+  local site_packages=$(python -c "import site; 
print(site.getsitepackages()[0])")
+
   cd $_pkgname-$pkgver
 
-  python setup.py install --root="$pkgdir" --optimize=1 --skip-build
-
-  install -Dm 644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
+  python -m installer --destdir="$pkgdir" dist/*.whl
+  install -Dm 644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname/
+  # remove tests
+  rm -frv "$pkgdir/$site_packages/$_pkgname/"{tests,metadata/tests}
 }
 
 # vim:set ts=2 sw=2 et:

Reply via email to