Package Details: python-flake8-quotes 3.3.2-3

Git Clone URL: https://aur.archlinux.org/python-flake8-quotes.git (read-only, click to copy)
Package Base: python-flake8-quotes
Description: Flake8 lint for quotes
Upstream URL: https://github.com/zheller/flake8-quotes
Licenses: MIT
Submitter: acxz
Maintainer: dmitmel
Last Packager: dmitmel
Votes: 4
Popularity: 0.22
First Submitted: 2020-05-30 22:42 (UTC)
Last Updated: 2024-04-08 12:52 (UTC)

Latest Comments

1 2 Next › Last »

dmitmel commented on 2024-04-08 12:51 (UTC)

I'm going to just disable this one test since making it work has been more trouble than it's worth (basically seems to be double-checking the builtin functionality of flake8 of being able to run plugins when reading input from stdin).

gesh commented on 2024-04-08 12:17 (UTC)

Couldn't reproduce -- could you try https://wiki.archlinux.org/title/DeveloperWiki:Building_in_a_clean_chroot (ie install devtools, then pkgctl build)?

Andrei_Korshikov commented on 2024-04-08 10:33 (UTC)

self = <test.test_checks.TestFlake8Stdin testMethod=test_stdin>

    def test_stdin(self):
        """Test using stdin."""
        filepath = get_absolute_path('data/doubles.py')
        with open(filepath, 'rb') as f:
            p = subprocess.Popen(['flake8', '--select=Q', '-'], stdin=f,
                                 stdout=subprocess.PIPE, stderr=subprocess.PIPE)
            stdout, stderr = p.communicate()

        stdout_lines = stdout.splitlines()
>       self.assertEqual(stderr, b'')
E       AssertionError: b'Unable to find qualified name for module: stdin\n' != b''

test/test_checks.py:23: AssertionError

gesh commented on 2024-03-26 20:45 (UTC) (edited on 2024-03-26 20:46 (UTC) by gesh)

OK, found a workaround:

check() {
    cd "$_pkgname-$pkgver"
    PYTHONPATH=src:"$PYTHONPATH" python -m pytest test
}

gesh commented on 2024-03-26 20:05 (UTC)

For some reason, it appears python setup.py test manages to run flake8 with our package plugged in, whereas python -m {py,unit}test both run it in a clean environment. I've disabled the offending test in the below -- have run out of patience trying to massage it into success.

diff --git a/PKGBUILD b/PKGBUILD
index 8723a35..a40d4a5 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -4,24 +4,31 @@
 pkgname=python-flake8-quotes
 _pkgname=flake8-quotes
 pkgver=3.3.2
-pkgrel=1
+pkgrel=2
 pkgdesc="Flake8 lint for quotes"
 arch=('any')
 url="https://github.com/zheller/${_pkgname}"
 license=('MIT')
 depends=('flake8')
-makedepends=('python-setuptools')
+checkdepends=('python-pytest')
+makedepends=(python-build python-installer python-wheel python-setuptools)
 source=("${pkgname}-${pkgver}.tar.gz::https://github.com/zheller/${_pkgname}/archive/${pkgver}.tar.gz")
 sha256sums=('884d027b6126b6216bdb9fa95a9841c4f07f600569a4a41f3d0cdbf71afe6bcb')

 build() {
-    cd "${_pkgname}-${pkgver}"
-    python setup.py build
+    cd "$_pkgname-$pkgver"
+    python -m build --wheel --no-isolation
+}
+
+check() {
+    cd "$_pkgname-$pkgver"
+    # needs the package to be installed to run
+    python -m pytest -k 'not test_stdin'
 }

 package() {
-    cd "${_pkgname}-${pkgver}"
-    python setup.py install --root="${pkgdir}" --optimize=1
+    cd "$_pkgname-$pkgver"
+    python -m installer --destdir="$pkgdir" dist/*.whl

     install -Dm 644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
 }

gesh commented on 2024-03-26 17:54 (UTC)

And indeed, checking it in this way reveals my implementation of check() is wrong, though I don't know why. But python setup.py test differs in behaviour from python -m unittest

gesh commented on 2024-03-26 17:39 (UTC)

You are correct, my bad. Yeah, PEP517 only controls the invocation of the build process, but at the end of the day you still need the the build backend, in this case python-setuptools. Nice catch!

dmitmel commented on 2024-03-26 16:52 (UTC)

gesh: Shouldn't python-setuptools be present in the dependencies as well?

gesh commented on 2024-03-26 16:43 (UTC)

This is what I had in mind:

diff --git a/PKGBUILD b/PKGBUILD
index 8723a35..97a314d 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -4,24 +4,29 @@
 pkgname=python-flake8-quotes
 _pkgname=flake8-quotes
 pkgver=3.3.2
-pkgrel=1
+pkgrel=2
 pkgdesc="Flake8 lint for quotes"
 arch=('any')
 url="https://github.com/zheller/${_pkgname}"
 license=('MIT')
 depends=('flake8')
-makedepends=('python-setuptools')
+makedepends=(python-build python-installer python-wheel)
 source=("${pkgname}-${pkgver}.tar.gz::https://github.com/zheller/${_pkgname}/archive/${pkgver}.tar.gz")
 sha256sums=('884d027b6126b6216bdb9fa95a9841c4f07f600569a4a41f3d0cdbf71afe6bcb')

 build() {
-    cd "${_pkgname}-${pkgver}"
-    python setup.py build
+    cd "$_pkgname-$pkgver"
+    python -m build --wheel --no-isolation
+}
+
+check() {
+    cd "$_pkgname-$pkgver"
+    python -m unittest
 }

 package() {
-    cd "${_pkgname}-${pkgver}"
-    python setup.py install --root="${pkgdir}" --optimize=1
+    cd "$_pkgname-$pkgver"
+    python -m installer --destdir="$pkgdir" dist/*.whl

     install -Dm 644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
 }

gesh commented on 2024-03-25 21:40 (UTC)

https://wiki.archlinux.org/title/Python_packaging_guidelines#Standards_based_(PEP_517)

Python decided to change the way they recommend installing packages a short while back, and so even if the project doesn't have a pyproject.toml the instructions from the wiki should be followed - that is, using

makedepends=(python-build python-installer python-wheel)

build() {
    cd $_name-$pkgver
    python -m build --wheel --no-isolation
}

package() {
    cd $_name-$pkgver
    python -m installer --destdir="$pkgdir" dist/*.whl
}