diff options
author | V3n3RiX <venerix@redcorelinux.org> | 2020-05-30 11:44:06 +0100 |
---|---|---|
committer | V3n3RiX <venerix@redcorelinux.org> | 2020-05-30 11:44:06 +0100 |
commit | f516638b7fe9592837389826a6152a7e1b251c54 (patch) | |
tree | 8bfecb640b7b6403d7a3d662d923eed630033da7 /dev-python/cffi | |
parent | 1a61119f9f7b057830e2ce0563f913ec86f282ad (diff) |
gentoo resync : 30.05.2020
Diffstat (limited to 'dev-python/cffi')
-rw-r--r-- | dev-python/cffi/Manifest | 3 | ||||
-rw-r--r-- | dev-python/cffi/cffi-1.14.0-r2.ebuild (renamed from dev-python/cffi/cffi-1.14.0.ebuild) | 8 | ||||
-rw-r--r-- | dev-python/cffi/files/cffi-0.14.0-g-line.patch | 250 |
3 files changed, 258 insertions, 3 deletions
diff --git a/dev-python/cffi/Manifest b/dev-python/cffi/Manifest index f504495a1f36..240343299a75 100644 --- a/dev-python/cffi/Manifest +++ b/dev-python/cffi/Manifest @@ -1,3 +1,4 @@ +AUX cffi-0.14.0-g-line.patch 9258 BLAKE2B a57cb8836dfcfb1124b1b72c38fb4c02d231fc7116c2de4b970e6423d037d1aa382173a4bebb9dafab0d690df485a64d824aafcdb16e31d01b391c25f4c239eb SHA512 335758de740050256af711e688072bbe4ac835551437bc2fbfd4dfaf5492efd5c722bca3bd8e5747bb0a88d3e7e6f82b78f85f5f42a4f11efb7b2f6c3ae4a492 DIST cffi-1.14.0.tar.gz 463065 BLAKE2B 4d1e8a92241db801848ef8bd05ea15a31c7f61ea426ce4da184aff00df786348d2c76de9dc48898c814478aed9750b665868df24ad39435062cd7e1c84163e52 SHA512 4c5451eeede1d48a8f4b40e25b845ad1863b8bf3bd39624e6c693c2800d89a13efedc4c43b37e317a035613bffc2e3fd5f7e583c46cb283cb5cb930356f86253 -EBUILD cffi-1.14.0.ebuild 1286 BLAKE2B 034b35097804c1f4fdef63a5329792f370cf938692551a4c2cb5711662b524c3b9f397e49df012d32dff1975bb0d5d7dacde2ae36ab35131fcd7678082187553 SHA512 34f7ae95905999ca622344b8017d38436711e14cf729cf97193db99789aabc2ee4bc14528f3e86f8bdc466d1ca1e1d77c4b64602717392db83b1ca3a70b19237 +EBUILD cffi-1.14.0-r2.ebuild 1342 BLAKE2B 4811dfa305a292b1c009585a6887de68250e469feb2d7621a5c85a561472287df1bfe9e08bdd53e022d76f6407f3734183497c526b354776ca61a539f7ddb8f5 SHA512 1698c7c0b8685a6375a5a2df1d28b2b9e29186ee4be5267b6af22be8c2d6f6ed833d67240b4e72039071fe327b9b200fd9b283d5ee3caf08b6ceb435d3fbc66a MISC metadata.xml 317 BLAKE2B b6416209bd2358c42c2be3bd228238b401bf126919b6e7371d83d7cec8cb55a40f89db562701cc8f3dfa904e225426881b22ff1d3b72085365b5caf9b8c6a403 SHA512 0744ca7b98b2ebe2985bf2a81a337d09be62cfaa51f8380bac52f8d30941e997f09be20e28caf6967226a71369003cf35977790aba56ed0d469cc490cfa089b6 diff --git a/dev-python/cffi/cffi-1.14.0.ebuild b/dev-python/cffi/cffi-1.14.0-r2.ebuild index e603db86aa4b..81a2fac6a16d 100644 --- a/dev-python/cffi/cffi-1.14.0.ebuild +++ b/dev-python/cffi/cffi-1.14.0-r2.ebuild @@ -6,7 +6,7 @@ EAPI=7 # DO NOT ADD pypy to PYTHON_COMPAT # pypy bundles a modified version of cffi. Use python_gen_cond_dep instead. DISTUTILS_USE_SETUPTOOLS=rdepend -PYTHON_COMPAT=( python2_7 python3_{6,7,8} ) +PYTHON_COMPAT=( python2_7 python3_{6,7,8,9} ) inherit distutils-r1 toolchain-funcs @@ -20,7 +20,7 @@ KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 s390 sparc x86 IUSE="test" RESTRICT="!test? ( test )" -DEPEND="virtual/libffi:=" +DEPEND="dev-libs/libffi:=" RDEPEND="${DEPEND} dev-python/pycparser[${PYTHON_USEDEP}]" BDEPEND="${RDEPEND} @@ -29,6 +29,10 @@ BDEPEND="${RDEPEND} distutils_enable_sphinx doc/source +PATCHES=( + "${FILESDIR}"/cffi-0.14.0-g-line.patch +) + src_configure() { tc-export PKG_CONFIG } diff --git a/dev-python/cffi/files/cffi-0.14.0-g-line.patch b/dev-python/cffi/files/cffi-0.14.0-g-line.patch new file mode 100644 index 000000000000..45a1099dce27 --- /dev/null +++ b/dev-python/cffi/files/cffi-0.14.0-g-line.patch @@ -0,0 +1,250 @@ +From 19ff1036043ae40ff3d8a2e1a6a793219e1ec378 Mon Sep 17 00:00:00 2001 +From: Armin Rigo <arigo@tunes.org> +Date: Tue, 26 May 2020 15:51:56 +0200 +Subject: [PATCH] Issue #454 + +Try harder to avoid #line directives confuse the rest of pre-parsing +--- + cffi/cparser.py | 37 ++++++++++++++++++++++++--- + testing/cffi0/test_parsing.py | 48 ++++++++++++++++++++++++++++++++++- + 2 files changed, 81 insertions(+), 4 deletions(-) + +diff --git a/cffi/cparser.py b/cffi/cparser.py +index d7069a73..d9784655 100644 +--- a/cffi/cparser.py ++++ b/cffi/cparser.py +@@ -29,6 +29,7 @@ _r_comment = re.compile(r"/\*.*?\*/|//([^\n\\]|\\.)*?$", + _r_define = re.compile(r"^\s*#\s*define\s+([A-Za-z_][A-Za-z_0-9]*)" + r"\b((?:[^\n\\]|\\.)*?)$", + re.DOTALL | re.MULTILINE) ++_r_line_directive = re.compile(r"^[ \t]*#[ \t]*line\b.*$", re.MULTILINE) + _r_partial_enum = re.compile(r"=\s*\.\.\.\s*[,}]|\.\.\.\s*\}") + _r_enum_dotdotdot = re.compile(r"__dotdotdot\d+__$") + _r_partial_array = re.compile(r"\[\s*\.\.\.\s*\]") +@@ -163,10 +164,37 @@ def _warn_for_non_extern_non_static_global_variable(decl): + "with C it should have a storage class specifier " + "(usually 'extern')" % (decl.name,)) + ++def _remove_line_directives(csource): ++ # _r_line_directive matches whole lines, without the final \n, if they ++ # start with '#line' with some spacing allowed. This function stores ++ # them away and replaces them with exactly the string '#line@N', where ++ # N is the index in the list 'line_directives'. ++ line_directives = [] ++ def replace(m): ++ i = len(line_directives) ++ line_directives.append(m.group()) ++ return '#line@%d' % i ++ csource = _r_line_directive.sub(replace, csource) ++ return csource, line_directives ++ ++def _put_back_line_directives(csource, line_directives): ++ def replace(m): ++ s = m.group() ++ if not s.startswith('#line@'): ++ raise AssertionError("unexpected #line directive " ++ "(should have been processed and removed") ++ return line_directives[int(s[6:])] ++ return _r_line_directive.sub(replace, csource) ++ + def _preprocess(csource): ++ # First, remove the lines of the form '#line N "filename"' because ++ # the "filename" part could confuse the rest ++ csource, line_directives = _remove_line_directives(csource) + # Remove comments. NOTE: this only work because the cdef() section +- # should not contain any string literal! +- csource = _r_comment.sub(' ', csource) ++ # should not contain any string literals (except in line directives)! ++ def replace_keeping_newlines(m): ++ return ' ' + m.group().count('\n') * '\n' ++ csource = _r_comment.sub(replace_keeping_newlines, csource) + # Remove the "#define FOO x" lines + macros = {} + for match in _r_define.finditer(csource): +@@ -219,7 +247,10 @@ def _preprocess(csource): + csource = _r_float_dotdotdot.sub(' __dotdotdotfloat__ ', csource) + # Replace all remaining "..." with the same name, "__dotdotdot__", + # which is declared with a typedef for the purpose of C parsing. +- return csource.replace('...', ' __dotdotdot__ '), macros ++ csource = csource.replace('...', ' __dotdotdot__ ') ++ # Finally, put back the line directives ++ csource = _put_back_line_directives(csource, line_directives) ++ return csource, macros + + def _common_type_names(csource): + # Look in the source for what looks like usages of types from the +diff --git a/testing/cffi0/test_parsing.py b/testing/cffi0/test_parsing.py +index 3fc3783a..5f2d7ec4 100644 +--- a/testing/cffi0/test_parsing.py ++++ b/testing/cffi0/test_parsing.py +@@ -174,7 +174,7 @@ def test_remove_line_continuation_comments(): + double // blah \\ + more comments + x(void); +- double // blah\\\\ ++ double // blah // blah\\\\ + y(void); + double // blah\\ \ + etc +@@ -185,6 +185,52 @@ def test_remove_line_continuation_comments(): + m.y + m.z + ++def test_dont_remove_comment_in_line_directives(): ++ ffi = FFI(backend=FakeBackend()) ++ e = py.test.raises(CDefError, ffi.cdef, """ ++ \t # \t line \t 8 \t "baz.c" \t ++ ++ some syntax error here ++ """) ++ assert str(e.value) == "parse error\nbaz.c:9:14: before: syntax" ++ # ++ e = py.test.raises(CDefError, ffi.cdef, """ ++ #line 7 "foo//bar.c" ++ ++ some syntax error here ++ """) ++ assert str(e.value) == "parse error\nfoo//bar.c:8:14: before: syntax" ++ ++def test_multiple_line_directives(): ++ ffi = FFI(backend=FakeBackend()) ++ e = py.test.raises(CDefError, ffi.cdef, ++ """ #line 5 "foo.c" ++ extern int xx; ++ #line 6 "bar.c" ++ extern int yy; ++ #line 7 "baz.c" ++ some syntax error here ++ #line 8 "yadda.c" ++ extern int zz; ++ """) ++ assert str(e.value) == "parse error\nbaz.c:7:14: before: syntax" ++ ++def test_commented_line_directive(): ++ ffi = FFI(backend=FakeBackend()) ++ e = py.test.raises(CDefError, ffi.cdef, """ ++ /* ++ #line 5 "foo.c" ++ */ ++ void xx(void); ++ ++ #line 6 "bar.c" ++ /* ++ #line 35 "foo.c" ++ */ ++ some syntax error ++ """) ++ assert str(e.value) == "parse error\nbar.c:9:14: before: syntax" ++ + def test_line_continuation_in_defines(): + ffi = FFI(backend=FakeBackend()) + ffi.cdef(""" +-- +2.26.2 + +From 31249d786c833d4960bbbf4e0d7f7bcaecf92d1f Mon Sep 17 00:00:00 2001 +From: Armin Rigo <arigo@tunes.org> +Date: Fri, 29 May 2020 10:27:40 +0200 +Subject: [PATCH] #454 + +Second try with '# NUMBER' instead of '#line NUMBER', as gcc seems to output +--- + cffi/cparser.py | 8 +++---- + testing/cffi0/test_parsing.py | 41 +++++++++++++++++++++++++++++++++++ + 2 files changed, 45 insertions(+), 4 deletions(-) + +diff --git a/cffi/cparser.py b/cffi/cparser.py +index d9784655..74830e91 100644 +--- a/cffi/cparser.py ++++ b/cffi/cparser.py +@@ -29,7 +29,7 @@ _r_comment = re.compile(r"/\*.*?\*/|//([^\n\\]|\\.)*?$", + _r_define = re.compile(r"^\s*#\s*define\s+([A-Za-z_][A-Za-z_0-9]*)" + r"\b((?:[^\n\\]|\\.)*?)$", + re.DOTALL | re.MULTILINE) +-_r_line_directive = re.compile(r"^[ \t]*#[ \t]*line\b.*$", re.MULTILINE) ++_r_line_directive = re.compile(r"^[ \t]*#[ \t]*(?:line|\d+)\b.*$", re.MULTILINE) + _r_partial_enum = re.compile(r"=\s*\.\.\.\s*[,}]|\.\.\.\s*\}") + _r_enum_dotdotdot = re.compile(r"__dotdotdot\d+__$") + _r_partial_array = re.compile(r"\[\s*\.\.\.\s*\]") +@@ -166,9 +166,9 @@ def _warn_for_non_extern_non_static_global_variable(decl): + + def _remove_line_directives(csource): + # _r_line_directive matches whole lines, without the final \n, if they +- # start with '#line' with some spacing allowed. This function stores +- # them away and replaces them with exactly the string '#line@N', where +- # N is the index in the list 'line_directives'. ++ # start with '#line' with some spacing allowed, or '#NUMBER'. This ++ # function stores them away and replaces them with exactly the string ++ # '#line@N', where N is the index in the list 'line_directives'. + line_directives = [] + def replace(m): + i = len(line_directives) +diff --git a/testing/cffi0/test_parsing.py b/testing/cffi0/test_parsing.py +index 5f2d7ec4..a5e45874 100644 +--- a/testing/cffi0/test_parsing.py ++++ b/testing/cffi0/test_parsing.py +@@ -199,6 +199,21 @@ def test_dont_remove_comment_in_line_directives(): + + some syntax error here + """) ++ # ++ assert str(e.value) == "parse error\nfoo//bar.c:8:14: before: syntax" ++ ffi = FFI(backend=FakeBackend()) ++ e = py.test.raises(CDefError, ffi.cdef, """ ++ \t # \t 8 \t "baz.c" \t ++ ++ some syntax error here ++ """) ++ assert str(e.value) == "parse error\nbaz.c:9:14: before: syntax" ++ # ++ e = py.test.raises(CDefError, ffi.cdef, """ ++ # 7 "foo//bar.c" ++ ++ some syntax error here ++ """) + assert str(e.value) == "parse error\nfoo//bar.c:8:14: before: syntax" + + def test_multiple_line_directives(): +@@ -214,6 +229,18 @@ def test_multiple_line_directives(): + extern int zz; + """) + assert str(e.value) == "parse error\nbaz.c:7:14: before: syntax" ++ # ++ e = py.test.raises(CDefError, ffi.cdef, ++ """ # 5 "foo.c" ++ extern int xx; ++ # 6 "bar.c" ++ extern int yy; ++ # 7 "baz.c" ++ some syntax error here ++ # 8 "yadda.c" ++ extern int zz; ++ """) ++ assert str(e.value) == "parse error\nbaz.c:7:14: before: syntax" + + def test_commented_line_directive(): + ffi = FFI(backend=FakeBackend()) +@@ -229,6 +256,20 @@ def test_commented_line_directive(): + */ + some syntax error + """) ++ # ++ assert str(e.value) == "parse error\nbar.c:9:14: before: syntax" ++ e = py.test.raises(CDefError, ffi.cdef, """ ++ /* ++ # 5 "foo.c" ++ */ ++ void xx(void); ++ ++ # 6 "bar.c" ++ /* ++ # 35 "foo.c" ++ */ ++ some syntax error ++ """) + assert str(e.value) == "parse error\nbar.c:9:14: before: syntax" + + def test_line_continuation_in_defines(): +-- +2.26.2 + |