public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/proj/guru:dev commit in: app-text/lizard/, app-text/lizard/files/
  2023-07-27 13:52 [gentoo-commits] repo/proj/guru:master commit in: app-text/lizard/files/, app-text/lizard/ David Roman
@ 2023-07-27 13:51 ` David Roman
  0 siblings, 0 replies; 2+ messages in thread
From: David Roman @ 2023-07-27 13:51 UTC (permalink / raw
  To: gentoo-commits

commit:     fb3679d5071a1b10333c964b121eab0223cfb803
Author:     David Roman <davidroman96 <AT> gmail <DOT> com>
AuthorDate: Thu Jul 27 13:50:59 2023 +0000
Commit:     David Roman <davidroman96 <AT> gmail <DOT> com>
CommitDate: Thu Jul 27 13:50:59 2023 +0000
URL:        https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=fb3679d5

app-text/lizard: add support for python3.11

Closes: https://bugs.gentoo.org/907137
Signed-off-by: David Roman <davidroman96 <AT> gmail.com>

 app-text/lizard/files/lizard-1.17.10-py3.11.patch | 60 +++++++++++++++++++++++
 app-text/lizard/lizard-1.17.10-r1.ebuild          | 28 +++++++++++
 2 files changed, 88 insertions(+)

diff --git a/app-text/lizard/files/lizard-1.17.10-py3.11.patch b/app-text/lizard/files/lizard-1.17.10-py3.11.patch
new file mode 100644
index 0000000000..d17b9511db
--- /dev/null
+++ b/app-text/lizard/files/lizard-1.17.10-py3.11.patch
@@ -0,0 +1,60 @@
+commit fc8a14e84acd8a4baa2d98bdec4e7ac18ed137a5
+Author: Mazunki Hoksaas <rolferen@gmail.com>
+Date:   Thu Jul 27 15:04:16 2023 +0200
+
+    add support for python3.11 re module
+
+diff --git a/lizard_languages/code_reader.py b/lizard_languages/code_reader.py
+index 1eb95d5..9e12658 100644
+--- a/lizard_languages/code_reader.py
++++ b/lizard_languages/code_reader.py
+@@ -4,6 +4,8 @@ Base class for all language parsers
+ 
+ import re
+ from copy import copy
++from functools import reduce
++from operator import or_
+ 
+ 
+ class CodeStateMachine(object):
+@@ -112,7 +114,7 @@ class CodeReader:
+         if not token_class:
+             token_class = create_token
+ 
+-        def _generate_tokens(source, add):
++        def _generate_tokens(source, add, flags=re.NOFLAG):
+             # DO NOT put any sub groups in the regex. Good for performance
+             _until_end = r"(?:\\\n|[^\n])*"
+             combined_symbols = ["<<=", ">>=", "||", "&&", "===", "!==",
+@@ -136,7 +138,7 @@ class CodeReader:
+                 r"|\\\n" +
+                 r"|\n" +
+                 r"|[^\S\n]+" +
+-                r"|.)", re.M | re.S)
++                r"|.)", re.M | re.S | flags)
+             macro = ""
+             for match in token_pattern.finditer(source):
+                 token = token_class(match)
+@@ -154,7 +156,21 @@ class CodeReader:
+             if macro:
+                 yield macro
+ 
+-        return _generate_tokens(source_code, addition)
++        flag_dict = {
++            'a': re.A,  # ASCII-only matching
++            'i': re.I,  # Ignore case
++            'L': re.L,  # Locale dependent
++            'm': re.M,  # Multi-line
++            's': re.S,  # Dot matches all
++            'u': re.U,  # Unicode matching
++            'x': re.X   # Verbose
++        }
++
++        pattern = re.compile(r'\(\?[aiLmsux]+\)')
++        re_flags = ''.join(opt[2:-1] for opt in pattern.findall(addition))
++        flags = reduce(or_, (flag_dict[flag] for flag in re_flags), re.NOFLAG)
++
++        return _generate_tokens(source_code, pattern.sub('', addition), flags=flags)
+ 
+     def __call__(self, tokens, reader):
+         self.context = reader.context

diff --git a/app-text/lizard/lizard-1.17.10-r1.ebuild b/app-text/lizard/lizard-1.17.10-r1.ebuild
new file mode 100644
index 0000000000..20e6432fa3
--- /dev/null
+++ b/app-text/lizard/lizard-1.17.10-r1.ebuild
@@ -0,0 +1,28 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{11,12} )
+DISTUTILS_USE_PEP517=setuptools
+
+inherit distutils-r1
+
+DESCRIPTION="A simple code complexity analyser, supports most of the popular languages."
+HOMEPAGE="http://www.lizard.ws/"
+SRC_URI="https://github.com/terryyin/lizard/archive/${PV}.tar.gz -> ${P}.tar.gz"
+
+KEYWORDS="~amd64"
+LICENSE="MIT"
+SLOT="0"
+
+DEPEND="
+	test? (
+		dev-python/jinja[${PYTHON_USEDEP}]
+		dev-python/mock[${PYTHON_USEDEP}]
+	)
+"
+
+PATCHES=( "${FILESDIR}/${P}-py3.11.patch" )
+
+distutils_enable_tests pytest


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [gentoo-commits] repo/proj/guru:master commit in: app-text/lizard/files/, app-text/lizard/
@ 2023-07-27 13:52 David Roman
  2023-07-27 13:51 ` [gentoo-commits] repo/proj/guru:dev commit in: app-text/lizard/, app-text/lizard/files/ David Roman
  0 siblings, 1 reply; 2+ messages in thread
From: David Roman @ 2023-07-27 13:52 UTC (permalink / raw
  To: gentoo-commits

commit:     fb3679d5071a1b10333c964b121eab0223cfb803
Author:     David Roman <davidroman96 <AT> gmail <DOT> com>
AuthorDate: Thu Jul 27 13:50:59 2023 +0000
Commit:     David Roman <davidroman96 <AT> gmail <DOT> com>
CommitDate: Thu Jul 27 13:50:59 2023 +0000
URL:        https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=fb3679d5

app-text/lizard: add support for python3.11

Closes: https://bugs.gentoo.org/907137
Signed-off-by: David Roman <davidroman96 <AT> gmail.com>

 app-text/lizard/files/lizard-1.17.10-py3.11.patch | 60 +++++++++++++++++++++++
 app-text/lizard/lizard-1.17.10-r1.ebuild          | 28 +++++++++++
 2 files changed, 88 insertions(+)

diff --git a/app-text/lizard/files/lizard-1.17.10-py3.11.patch b/app-text/lizard/files/lizard-1.17.10-py3.11.patch
new file mode 100644
index 0000000000..d17b9511db
--- /dev/null
+++ b/app-text/lizard/files/lizard-1.17.10-py3.11.patch
@@ -0,0 +1,60 @@
+commit fc8a14e84acd8a4baa2d98bdec4e7ac18ed137a5
+Author: Mazunki Hoksaas <rolferen@gmail.com>
+Date:   Thu Jul 27 15:04:16 2023 +0200
+
+    add support for python3.11 re module
+
+diff --git a/lizard_languages/code_reader.py b/lizard_languages/code_reader.py
+index 1eb95d5..9e12658 100644
+--- a/lizard_languages/code_reader.py
++++ b/lizard_languages/code_reader.py
+@@ -4,6 +4,8 @@ Base class for all language parsers
+ 
+ import re
+ from copy import copy
++from functools import reduce
++from operator import or_
+ 
+ 
+ class CodeStateMachine(object):
+@@ -112,7 +114,7 @@ class CodeReader:
+         if not token_class:
+             token_class = create_token
+ 
+-        def _generate_tokens(source, add):
++        def _generate_tokens(source, add, flags=re.NOFLAG):
+             # DO NOT put any sub groups in the regex. Good for performance
+             _until_end = r"(?:\\\n|[^\n])*"
+             combined_symbols = ["<<=", ">>=", "||", "&&", "===", "!==",
+@@ -136,7 +138,7 @@ class CodeReader:
+                 r"|\\\n" +
+                 r"|\n" +
+                 r"|[^\S\n]+" +
+-                r"|.)", re.M | re.S)
++                r"|.)", re.M | re.S | flags)
+             macro = ""
+             for match in token_pattern.finditer(source):
+                 token = token_class(match)
+@@ -154,7 +156,21 @@ class CodeReader:
+             if macro:
+                 yield macro
+ 
+-        return _generate_tokens(source_code, addition)
++        flag_dict = {
++            'a': re.A,  # ASCII-only matching
++            'i': re.I,  # Ignore case
++            'L': re.L,  # Locale dependent
++            'm': re.M,  # Multi-line
++            's': re.S,  # Dot matches all
++            'u': re.U,  # Unicode matching
++            'x': re.X   # Verbose
++        }
++
++        pattern = re.compile(r'\(\?[aiLmsux]+\)')
++        re_flags = ''.join(opt[2:-1] for opt in pattern.findall(addition))
++        flags = reduce(or_, (flag_dict[flag] for flag in re_flags), re.NOFLAG)
++
++        return _generate_tokens(source_code, pattern.sub('', addition), flags=flags)
+ 
+     def __call__(self, tokens, reader):
+         self.context = reader.context

diff --git a/app-text/lizard/lizard-1.17.10-r1.ebuild b/app-text/lizard/lizard-1.17.10-r1.ebuild
new file mode 100644
index 0000000000..20e6432fa3
--- /dev/null
+++ b/app-text/lizard/lizard-1.17.10-r1.ebuild
@@ -0,0 +1,28 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{11,12} )
+DISTUTILS_USE_PEP517=setuptools
+
+inherit distutils-r1
+
+DESCRIPTION="A simple code complexity analyser, supports most of the popular languages."
+HOMEPAGE="http://www.lizard.ws/"
+SRC_URI="https://github.com/terryyin/lizard/archive/${PV}.tar.gz -> ${P}.tar.gz"
+
+KEYWORDS="~amd64"
+LICENSE="MIT"
+SLOT="0"
+
+DEPEND="
+	test? (
+		dev-python/jinja[${PYTHON_USEDEP}]
+		dev-python/mock[${PYTHON_USEDEP}]
+	)
+"
+
+PATCHES=( "${FILESDIR}/${P}-py3.11.patch" )
+
+distutils_enable_tests pytest


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-07-27 13:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-27 13:52 [gentoo-commits] repo/proj/guru:master commit in: app-text/lizard/files/, app-text/lizard/ David Roman
2023-07-27 13:51 ` [gentoo-commits] repo/proj/guru:dev commit in: app-text/lizard/, app-text/lizard/files/ David Roman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox