From a0953f7ac639d8e180f62ab3364ccf9af71f783d Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sun, 26 Feb 2023 21:58:19 +0000 Subject: gentoo auto-resync : 26:02:2023 - 21:58:19 --- dev-python/pycparser/Manifest | 5 +- .../files/pycparser-2.21-lextab-cache.patch | 66 ++++++++++++++++++++++ dev-python/pycparser/pycparser-2.21-r1.ebuild | 5 ++ dev-python/pycparser/pycparser-2.21-r2.ebuild | 5 ++ 4 files changed, 79 insertions(+), 2 deletions(-) create mode 100644 dev-python/pycparser/files/pycparser-2.21-lextab-cache.patch (limited to 'dev-python/pycparser') diff --git a/dev-python/pycparser/Manifest b/dev-python/pycparser/Manifest index 39170fc4734b..56480d94d2ff 100644 --- a/dev-python/pycparser/Manifest +++ b/dev-python/pycparser/Manifest @@ -1,4 +1,5 @@ +AUX pycparser-2.21-lextab-cache.patch 2535 BLAKE2B b0455189f1d64a18655cc43b969e260291acc0812c219490f8592bfc96d7f0653dc9b439acc8fef24e49e560ca3fca28e5b8734ec48fe8a6d9e981e239feafb6 SHA512 d24d3db2dae05e9bc4c76bae0dc1070c0905af239b6585d93da0d026e02ba609df28577c47f88ee33cb6c26c59abc5cdb73f806360cc964e5e834c96b55cf423 DIST pycparser-2.21.tar.gz 170877 BLAKE2B ae6bf42dfc552bf1e3bfb5430cdb0c15b5e011ec53cbd03e0e2507c08a1a78690cefce2de134bd984caccc5dbde90661cb4c18df5c289217967213aac4d52404 SHA512 e61fbdde484d1cf74d4b27bdde40cf2da4b7028ca8ecd37c83d77473dab707d457321aecaf97da3b114c1d58a4eb200290b76f9c958044b57e5fed949895b5f0 -EBUILD pycparser-2.21-r1.ebuild 1779 BLAKE2B fbdd2c5116a1426ddd942c29f0ddb391dfbbcbaa7a8fcf1475cf9a386fd4c919efc2120665a2cef46ba5d54d6cd4c204826d58c467e44b5c1ae289182ee117f0 SHA512 f0313b385d0fc9566ca5aff66e9a626ebd714ae170228988d6ff3fa729830be5d3d27953b148de90dfda8af954ce535ae682866937c317ea9f230d75be138ad0 -EBUILD pycparser-2.21-r2.ebuild 1899 BLAKE2B 66b26e6aff00ef9cda0ca26714784e838d2fb7104cfb9d803cbeb3e0f7ab44e7af7c2bb65b9b0cb24a09521c82f4ec3103f54c0e710f9f08f38704fb4c244c84 SHA512 8030001ab674a3cb5c11b429f6294f94d6f4ac80037247c8e83815ea282f6b2f606de10308fdf94ee3eecda496191a63cc4141b5e3c8fe9da4d7a2acb65fb65b +EBUILD pycparser-2.21-r1.ebuild 1889 BLAKE2B a98b9d564648fe208ec6d6f9ce25667147021659e849a3e88dfc2f4eac26ed357d6ad64dc7ea6acdf895e9c78af2ee67f36279de69aa65a34d72047724b7d324 SHA512 5db1073d092d5f60fe081f43df09e00cbbdb879f69738479f632438b70f3385e745b8cfc1f33a1c1d50b1ef6491ee46aaa6bfc4c44406f1f9c169a21d864e6ca +EBUILD pycparser-2.21-r2.ebuild 2009 BLAKE2B 18ca2a0aaa4f9dcedb4e2554c577332603ba74bba866eee31dc71e88e546528dbb3dd0f34e9cb5972cd08fadeecb8508b17f472535182b5ef18a91ab40aa25eb SHA512 f8bcc629e903fd2a10e4443b56f325063a51e2b5019705a4f263329e7c7f35148052a0de1a51b1f11fa0d5932809a2b63dfb449d49edfee3486546098bf32bde MISC metadata.xml 406 BLAKE2B 61cb250ac460c4ea05f47bd8d208e44706bc80965ca1982e490d759d3a63652e5e13bf357532afb599ecea491f3c9a4cd315b97250b115bb7e8fa769b2ef03ff SHA512 b2d4ffde31f97a98e4a74bdd70751519d1339bbf3384e9e671760506fc2dac9d92bf6f7a743973002b4ae6da1cd2bb11abbfe63cbb330a1c32702b3eef24a62b diff --git a/dev-python/pycparser/files/pycparser-2.21-lextab-cache.patch b/dev-python/pycparser/files/pycparser-2.21-lextab-cache.patch new file mode 100644 index 000000000000..d24999e7273a --- /dev/null +++ b/dev-python/pycparser/files/pycparser-2.21-lextab-cache.patch @@ -0,0 +1,66 @@ +From 35a279ecb9af41a6f95ddbc6a0f1beaa2472d165 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= +Date: Sun, 26 Feb 2023 01:04:34 +0100 +Subject: [PATCH] _build_tables: Invalidate cache before importing generated + modules (#494) + +Make sure to invalidate finder caches before trying to import generated +modules. This is necessary according to the Python documentation: +https://docs.python.org/3/library/importlib.html#importlib.invalidate_caches + +This fixes a hard-to-reproduce bug that Python would be unable to find +just-generated `lextab.py` if mtime of the current directory did not +change from the moment the script was started. This could +e.g. be the case if one has second-precision timestamps and removes +the generated file just before starting the build, e.g.: + + $ rm pycparser/lextab.py; python -m build -nw + +It could also be reproduced easier by doing something like: + + $ cd pycparser + $ touch .; python -B _build_tables.py + Traceback (most recent call last): + File "/var/tmp/pycparser/pycparser/_build_tables.py", line 38, in + import lextab + ModuleNotFoundError: No module named 'lextab' + +This is because the first command (`rm` or `touch`) updates the mtime +of the directory to the current time. If the script is run fast enough, +it manages to scan the directory and then write the new `lextab.py` +within the same second. As a result, mtime of the directory after +writing the new file is the same as when the script was started, finder +does not invalidate the cache and assumes that `lextab.py` does not +exist since it did not exist when the directory was scanned earlier. + +This potentially fixes #493. + +It was originally reported on https://bugs.gentoo.org/701878. +Thanks to Gary E. Miller for patience in reproducing the problem +and proxy-debugging it for me, as well as testing the final patch before +submission. +--- + pycparser/_build_tables.py | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/pycparser/_build_tables.py b/pycparser/_build_tables.py +index 958381ad..4f371079 100644 +--- a/pycparser/_build_tables.py ++++ b/pycparser/_build_tables.py +@@ -13,6 +13,7 @@ + # Insert '.' and '..' as first entries to the search path for modules. + # Restricted environments like embeddable python do not include the + # current working directory on startup. ++import importlib + import sys + sys.path[0:0] = ['.', '..'] + +@@ -32,6 +33,8 @@ + + # Load to compile into .pyc + # ++importlib.invalidate_caches() ++ + import lextab + import yacctab + import c_ast diff --git a/dev-python/pycparser/pycparser-2.21-r1.ebuild b/dev-python/pycparser/pycparser-2.21-r1.ebuild index 1b0d8e6f6901..3848eaeedd3a 100644 --- a/dev-python/pycparser/pycparser-2.21-r1.ebuild +++ b/dev-python/pycparser/pycparser-2.21-r1.ebuild @@ -30,6 +30,11 @@ BDEPEND=" distutils_enable_tests unittest python_prepare_all() { + local PATCHES=( + # https://github.com/eliben/pycparser/pull/494 + "${FILESDIR}"/${P}-lextab-cache.patch + ) + # remove the original files to guarantee their regen rm pycparser/{c_ast,lextab,yacctab}.py || die diff --git a/dev-python/pycparser/pycparser-2.21-r2.ebuild b/dev-python/pycparser/pycparser-2.21-r2.ebuild index edebc42725b5..08416104b7d4 100644 --- a/dev-python/pycparser/pycparser-2.21-r2.ebuild +++ b/dev-python/pycparser/pycparser-2.21-r2.ebuild @@ -29,6 +29,11 @@ BDEPEND=" distutils_enable_tests unittest python_prepare_all() { + local PATCHES=( + # https://github.com/eliben/pycparser/pull/494 + "${FILESDIR}"/${P}-lextab-cache.patch + ) + # remove the original files to guarantee their regen rm pycparser/{c_ast,lextab,yacctab}.py || die -- cgit v1.2.3