-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Alpine 3.20: add py3-pydocstyle backport (#959)
* Add py3-pydocstyle backport * Add patch file for f-string tests - Based on PyCQA/pydocstyle#656
- Loading branch information
Showing
2 changed files
with
81 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Contributor: Russ Webber <[email protected]> | ||
# Maintainer: Russ Webber <[email protected]> | ||
pkgname=py3-pydocstyle | ||
pkgver=6.3.0 | ||
pkgrel=1 | ||
pkgdesc="Static analysis tool for checking compliance with Python docstring conventions" | ||
url="https://www.pydocstyle.org/" | ||
arch="noarch" | ||
license="MIT" | ||
depends="python3 py3-snowballstemmer" | ||
makedepends=" | ||
py3-gpep517 | ||
py3-poetry-core | ||
py3-setuptools_scm | ||
" | ||
checkdepends="py3-pytest py3-mock" | ||
subpackages="$pkgname-pyc" | ||
source="$pkgname-$pkgver.tar.gz::https://github.com/PyCQA/pydocstyle/archive/$pkgver.tar.gz | ||
fix-fstring-tests.patch" | ||
builddir="$srcdir/pydocstyle-$pkgver" | ||
|
||
prepare() { | ||
default_prepare | ||
|
||
sed -i "s|0.0.0-dev|$pkgver|" pyproject.toml | ||
} | ||
|
||
build() { | ||
gpep517 build-wheel \ | ||
--wheel-dir .dist \ | ||
--output-fd 3 3>&1 >&2 | ||
} | ||
|
||
check() { | ||
python3 -m venv --clear --without-pip --system-site-packages .testenv | ||
.testenv/bin/python3 -m installer .dist/*.whl | ||
.testenv/bin/python3 -m pytest --deselect src/tests/test_integration.py | ||
} | ||
|
||
package() { | ||
python3 -m installer -d "$pkgdir" \ | ||
.dist/*.whl | ||
} | ||
|
||
sha512sums=" | ||
f8473b19ab6ef0b61787875558f9dd6f9f7f1954e1baa0010942af6d4de8dbca30c8c08be6acbf24aadd1c0a601ba9467b747026a6cd22379f0c4b84a38b57c7 py3-pydocstyle-6.3.0.tar.gz | ||
4c751edede0fcc39f929ac6c919452b9cd29ee32597c07abb1d4c31ce1c248b56a8dad55f3652864619a8840aaf300b55e1a351ae88de6814848d08febbafc93 fix-fstring-tests.patch" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
diff --git a/src/pydocstyle/parser.py b/src/pydocstyle/parser.py | ||
index 95bd0a1..875f769 100644 | ||
--- a/src/pydocstyle/parser.py | ||
+++ b/src/pydocstyle/parser.py | ||
@@ -479,6 +479,29 @@ class Parser: | ||
) | ||
self.stream.move() | ||
return docstring | ||
+ if (sys.version_info.major, sys.version_info.minor) >= ( | ||
+ 3, | ||
+ 12, | ||
+ ) and self.current.kind == tk.FSTRING_START: | ||
+ | ||
+ def fstring(string): | ||
+ """Recursively parse fstring tokens to output it as one string.""" | ||
+ while self.current.kind != tk.FSTRING_END: | ||
+ self.stream.move() | ||
+ string += self.current.value | ||
+ if self.current.kind == tk.FSTRING_START: | ||
+ string = fstring(string) | ||
+ self.stream.move() | ||
+ string += self.current.value | ||
+ return string | ||
+ | ||
+ # Reattach fstring tokens together into a string to deal with PEP 701 in python3.12 | ||
+ start = self.current.start[0] | ||
+ string = fstring(self.current.value) | ||
+ end = self.current.end[0] | ||
+ docstring = Docstring(string, start, end) | ||
+ self.stream.move() | ||
+ return docstring | ||
return None | ||
|
||
def parse_decorators(self): |