From bae773510c55024d644d09faca76778fac0b3885 Mon Sep 17 00:00:00 2001 From: Michal Vasilek Date: Sun, 25 Sep 2022 15:03:02 +0200 Subject: [PATCH] python-scandir: remove package, fix python3 build --- srcpkgs/python-scandir/template | 30 ---------- srcpkgs/python3-scandir | 1 - srcpkgs/python3-scandir/patches/py3.10.patch | 63 ++++++++++++++++++++ srcpkgs/python3-scandir/template | 19 ++++++ 4 files changed, 82 insertions(+), 31 deletions(-) delete mode 100644 srcpkgs/python-scandir/template delete mode 120000 srcpkgs/python3-scandir create mode 100644 srcpkgs/python3-scandir/patches/py3.10.patch create mode 100644 srcpkgs/python3-scandir/template diff --git a/srcpkgs/python-scandir/template b/srcpkgs/python-scandir/template deleted file mode 100644 index fb7c016c411..00000000000 --- a/srcpkgs/python-scandir/template +++ /dev/null @@ -1,30 +0,0 @@ -# Template file for 'python-scandir' -pkgname=python-scandir -version=1.10.0 -revision=5 -wrksrc="scandir-${version}" -build_style=python-module -pycompile_module="scandir.py" -hostmakedepends="python-setuptools python3-setuptools" -makedepends="python-devel python3-devel" -depends="python" -short_desc="Better directory iterator and faster os.walk() (Python2)" -maintainer="Alessio Sergi " -license="BSD-3-Clause" -homepage="https://github.com/benhoyt/scandir" -distfiles="${PYPI_SITE}/s/scandir/scandir-${version}.tar.gz" -checksum=4d4631f6062e658e9007ab3149a9b914f3548cb38bfb021c64f39a025ce578ae - -python3-scandir_package() { - pycompile_module="scandir.py" - depends="python3" - short_desc="${short_desc/Python2/Python3}" - pkg_install() { - vmove usr/lib/python3* - vlicense LICENSE.txt - } -} - -post_install() { - vlicense LICENSE.txt -} diff --git a/srcpkgs/python3-scandir b/srcpkgs/python3-scandir deleted file mode 120000 index a572ade2d3e..00000000000 --- a/srcpkgs/python3-scandir +++ /dev/null @@ -1 +0,0 @@ -python-scandir \ No newline at end of file diff --git a/srcpkgs/python3-scandir/patches/py3.10.patch b/srcpkgs/python3-scandir/patches/py3.10.patch new file mode 100644 index 00000000000..13f221a6e94 --- /dev/null +++ b/srcpkgs/python3-scandir/patches/py3.10.patch @@ -0,0 +1,63 @@ +(only includes changes to _scandir.c, others are irrelevant) + +From 3396aa4155ffde8600a0e9ca50d5872569169b5d Mon Sep 17 00:00:00 2001 +From: Ben Hoyt +Date: Mon, 24 Jan 2022 08:44:07 +1300 +Subject: [PATCH] Add Python 3.10 to tests (#137) +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Fix PyStructSequence_UnnamedField build issues on Python 3.9/3.10 + +_scandir.c:663:7: error: conflicting type qualifiers for ‘PyStructSequence_UnnamedField’ + 663 | char *PyStructSequence_UnnamedField = "unnamed field"; + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +In file included from /usr/local/include/python3.10/Python.h:127, + from _scandir.c:14: +/usr/local/include/python3.10/structseq.h:22:27: note: previous declaration of ‘PyStructSequence_UnnamedField’ was here + 22 | extern const char * const PyStructSequence_UnnamedField; + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Fixes https://github.com/benhoyt/scandir/pull/137 +--- + .github/workflows/tests.yml | 2 +- + _scandir.c | 10 +++++----- + scandir.py | 2 +- + 3 files changed, 7 insertions(+), 7 deletions(-) + +diff --git a/_scandir.c b/_scandir.c +index 6cc28c8..433483f 100644 +--- a/_scandir.c ++++ b/_scandir.c +@@ -660,7 +660,7 @@ _pystat_fromstructstat(STRUCT_STAT *st) + return v; + } + +-char *PyStructSequence_UnnamedField = "unnamed field"; ++static char *scandir_unnamed_field = "unnamed field"; + + PyDoc_STRVAR(stat_result__doc__, + "stat_result: Result from stat, fstat, or lstat.\n\n\ +@@ -681,7 +681,7 @@ static PyStructSequence_Field stat_result_fields[] = { + {"st_uid", "user ID of owner"}, + {"st_gid", "group ID of owner"}, + {"st_size", "total size, in bytes"}, +- /* The NULL is replaced with PyStructSequence_UnnamedField later. */ ++ /* The NULL is replaced with scandir_unnamed_field later. */ + {NULL, "integer time of last access"}, + {NULL, "integer time of last modification"}, + {NULL, "integer time of last change"}, +@@ -1817,9 +1817,9 @@ init_scandir(void) + if (!billion) + INIT_ERROR; + +- stat_result_desc.fields[7].name = PyStructSequence_UnnamedField; +- stat_result_desc.fields[8].name = PyStructSequence_UnnamedField; +- stat_result_desc.fields[9].name = PyStructSequence_UnnamedField; ++ stat_result_desc.fields[7].name = scandir_unnamed_field; ++ stat_result_desc.fields[8].name = scandir_unnamed_field; ++ stat_result_desc.fields[9].name = scandir_unnamed_field; + PyStructSequence_InitType(&StatResultType, &stat_result_desc); + structseq_new = StatResultType.tp_new; + StatResultType.tp_new = statresult_new; diff --git a/srcpkgs/python3-scandir/template b/srcpkgs/python3-scandir/template new file mode 100644 index 00000000000..8525e36bf56 --- /dev/null +++ b/srcpkgs/python3-scandir/template @@ -0,0 +1,19 @@ +# Template file for 'python3-scandir' +pkgname=python3-scandir +version=1.10.0 +revision=8 +wrksrc="scandir-${version}" +build_style=python3-module +hostmakedepends="python3-setuptools" +makedepends="python3-devel" +depends="python3" +short_desc="Better directory iterator and faster os.walk()" +maintainer="Alessio Sergi " +license="BSD-3-Clause" +homepage="https://github.com/benhoyt/scandir" +distfiles="${PYPI_SITE}/s/scandir/scandir-${version}.tar.gz" +checksum=4d4631f6062e658e9007ab3149a9b914f3548cb38bfb021c64f39a025ce578ae + +post_install() { + vlicense LICENSE.txt +}