* [gentoo-commits] repo/gentoo:master commit in: dev-python/yapf/files/, dev-python/yapf/
@ 2023-01-26 10:45 Michał Górny
0 siblings, 0 replies; 2+ messages in thread
From: Michał Górny @ 2023-01-26 10:45 UTC (permalink / raw
To: gentoo-commits
commit: 96211210164eb5dc02ce851a39ca5655d49ca2de
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Thu Jan 26 10:44:52 2023 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu Jan 26 10:45:39 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=96211210
dev-python/yapf: Backport dev-python/tomli support
Closes: https://bugs.gentoo.org/878673
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
dev-python/yapf/Manifest | 2 +-
dev-python/yapf/files/yapf-0.32.0-tomli.patch | 178 +++++++++++++++++++++
.../{yapf-0.32.0.ebuild => yapf-0.32.0-r1.ebuild} | 23 ++-
3 files changed, 198 insertions(+), 5 deletions(-)
diff --git a/dev-python/yapf/Manifest b/dev-python/yapf/Manifest
index 9dd78a39089f..36aac5ba5a5a 100644
--- a/dev-python/yapf/Manifest
+++ b/dev-python/yapf/Manifest
@@ -1 +1 @@
-DIST yapf-0.32.0.tar.gz 178621 BLAKE2B b2132e3fffb96113700e322bba3f49ded0fe417de901522793564d5830951e9f2017c576fb89c5e423f4f547c95659040c2a4fc923887d9fb941e219b21f0cf6 SHA512 c1a05a04f7558a5b51899c29010bedc105c4a4bad4b5358a903a22a39f451e03369d2b4e670ecb44a857a8fef2bf438d9da0afcbdd3a336cf037bbf480d19878
+DIST yapf-0.32.0.gh.tar.gz 178621 BLAKE2B b2132e3fffb96113700e322bba3f49ded0fe417de901522793564d5830951e9f2017c576fb89c5e423f4f547c95659040c2a4fc923887d9fb941e219b21f0cf6 SHA512 c1a05a04f7558a5b51899c29010bedc105c4a4bad4b5358a903a22a39f451e03369d2b4e670ecb44a857a8fef2bf438d9da0afcbdd3a336cf037bbf480d19878
diff --git a/dev-python/yapf/files/yapf-0.32.0-tomli.patch b/dev-python/yapf/files/yapf-0.32.0-tomli.patch
new file mode 100644
index 000000000000..bdbfd96112a2
--- /dev/null
+++ b/dev-python/yapf/files/yapf-0.32.0-tomli.patch
@@ -0,0 +1,178 @@
+From 5909ba87f79ea1d687e5836c62dc82a116f4229f Mon Sep 17 00:00:00 2001
+From: Eric McDonald <221418+emcd@users.noreply.github.com>
+Date: Wed, 30 Nov 2022 14:23:50 -0800
+Subject: [PATCH] Prevent crashes against valid 'pyproject.toml'. (#1040)
+
+* Replace 'toml' dependency with 'tomli', which fully supports TOML 1.
+
+Co-authored-by: Eric McDonald <emcd@users.noreply.github.com>
+---
+ setup.py | 2 +-
+ yapf/yapflib/file_resources.py | 15 ++++++++-------
+ yapf/yapflib/style.py | 25 ++++++++++++++-----------
+ yapftests/file_resources_test.py | 10 +++++-----
+ yapftests/style_test.py | 4 ++--
+ 5 files changed, 30 insertions(+), 26 deletions(-)
+
+diff --git a/yapf/yapflib/file_resources.py b/yapf/yapflib/file_resources.py
+index b5e2612b..6809ca9f 100644
+--- a/yapf/yapflib/file_resources.py
++++ b/yapf/yapflib/file_resources.py
+@@ -49,14 +49,15 @@ def _GetExcludePatternsFromPyprojectToml(filename):
+ """Get a list of file patterns to ignore from pyproject.toml."""
+ ignore_patterns = []
+ try:
+- import toml
++ import tomli as tomllib
+ except ImportError:
+ raise errors.YapfError(
+- "toml package is needed for using pyproject.toml as a "
++ "tomli package is needed for using pyproject.toml as a "
+ "configuration file")
+
+ if os.path.isfile(filename) and os.access(filename, os.R_OK):
+- pyproject_toml = toml.load(filename)
++ with open(filename, 'rb') as fd:
++ pyproject_toml = tomllib.load(fd)
+ ignore_patterns = pyproject_toml.get('tool',
+ {}).get('yapfignore',
+ {}).get('ignore_patterns', [])
+@@ -127,19 +128,19 @@ def GetDefaultStyleForDir(dirname, default_style=style.DEFAULT_STYLE):
+ # See if we have a pyproject.toml file with a '[tool.yapf]' section.
+ config_file = os.path.join(dirname, style.PYPROJECT_TOML)
+ try:
+- fd = open(config_file)
++ fd = open(config_file, 'rb')
+ except IOError:
+ pass # It's okay if it's not there.
+ else:
+ with fd:
+ try:
+- import toml
++ import tomli as tomllib
+ except ImportError:
+ raise errors.YapfError(
+- "toml package is needed for using pyproject.toml as a "
++ "tomli package is needed for using pyproject.toml as a "
+ "configuration file")
+
+- pyproject_toml = toml.load(config_file)
++ pyproject_toml = tomllib.load(fd)
+ style_dict = pyproject_toml.get('tool', {}).get('yapf', None)
+ if style_dict is not None:
+ return config_file
+diff --git a/yapf/yapflib/style.py b/yapf/yapflib/style.py
+index 233a64e6..c8397b32 100644
+--- a/yapf/yapflib/style.py
++++ b/yapf/yapflib/style.py
+@@ -746,17 +746,18 @@ def _CreateConfigParserFromConfigFile(config_filename):
+ # Provide a more meaningful error here.
+ raise StyleConfigError(
+ '"{0}" is not a valid style or file path'.format(config_filename))
+- with open(config_filename) as style_file:
+- config = py3compat.ConfigParser()
+- if config_filename.endswith(PYPROJECT_TOML):
+- try:
+- import toml
+- except ImportError:
+- raise errors.YapfError(
+- "toml package is needed for using pyproject.toml as a "
+- "configuration file")
+-
+- pyproject_toml = toml.load(style_file)
++ config = py3compat.ConfigParser()
++
++ if config_filename.endswith(PYPROJECT_TOML):
++ try:
++ import tomli as tomllib
++ except ImportError:
++ raise errors.YapfError(
++ "tomli package is needed for using pyproject.toml as a "
++ "configuration file")
++
++ with open(config_filename, 'rb') as style_file:
++ pyproject_toml = tomllib.load(style_file)
+ style_dict = pyproject_toml.get("tool", {}).get("yapf", None)
+ if style_dict is None:
+ raise StyleConfigError(
+@@ -766,7 +767,9 @@ def _CreateConfigParserFromConfigFile(config_filename):
+ config.set('style', k, str(v))
+ return config
+
++ with open(config_filename) as style_file:
+ config.read_file(style_file)
++
+ if config_filename.endswith(SETUP_CONFIG):
+ if not config.has_section('yapf'):
+ raise StyleConfigError(
+diff --git a/yapftests/file_resources_test.py b/yapftests/file_resources_test.py
+index 31184c4a..f54f393d 100644
+--- a/yapftests/file_resources_test.py
++++ b/yapftests/file_resources_test.py
+@@ -75,7 +75,7 @@ def test_get_exclude_file_patterns_from_yapfignore_with_wrong_syntax(self):
+
+ def test_get_exclude_file_patterns_from_pyproject(self):
+ try:
+- import toml
++ import tomli
+ except ImportError:
+ return
+ local_ignore_file = os.path.join(self.test_tmpdir, 'pyproject.toml')
+@@ -93,7 +93,7 @@ def test_get_exclude_file_patterns_from_pyproject(self):
+ @unittest.skipUnless(py3compat.PY36, 'Requires Python 3.6')
+ def test_get_exclude_file_patterns_from_pyproject_with_wrong_syntax(self):
+ try:
+- import toml
++ import tomli
+ except ImportError:
+ return
+ local_ignore_file = os.path.join(self.test_tmpdir, 'pyproject.toml')
+@@ -109,7 +109,7 @@ def test_get_exclude_file_patterns_from_pyproject_with_wrong_syntax(self):
+
+ def test_get_exclude_file_patterns_from_pyproject_no_ignore_section(self):
+ try:
+- import toml
++ import tomli
+ except ImportError:
+ return
+ local_ignore_file = os.path.join(self.test_tmpdir, 'pyproject.toml')
+@@ -122,7 +122,7 @@ def test_get_exclude_file_patterns_from_pyproject_no_ignore_section(self):
+
+ def test_get_exclude_file_patterns_from_pyproject_ignore_section_empty(self):
+ try:
+- import toml
++ import tomli
+ except ImportError:
+ return
+ local_ignore_file = os.path.join(self.test_tmpdir, 'pyproject.toml')
+@@ -192,7 +192,7 @@ def test_setup_config(self):
+ def test_pyproject_toml(self):
+ # An empty pyproject.toml file should not be used
+ try:
+- import toml
++ import tomli
+ except ImportError:
+ return
+
+diff --git a/yapftests/style_test.py b/yapftests/style_test.py
+index 8a37f953..d2203d9a 100644
+--- a/yapftests/style_test.py
++++ b/yapftests/style_test.py
+@@ -230,7 +230,7 @@ def testErrorUnknownStyleOption(self):
+
+ def testPyprojectTomlNoYapfSection(self):
+ try:
+- import toml
++ import tomli
+ except ImportError:
+ return
+
+@@ -242,7 +242,7 @@ def testPyprojectTomlNoYapfSection(self):
+
+ def testPyprojectTomlParseYapfSection(self):
+ try:
+- import toml
++ import tomli
+ except ImportError:
+ return
+
diff --git a/dev-python/yapf/yapf-0.32.0.ebuild b/dev-python/yapf/yapf-0.32.0-r1.ebuild
similarity index 58%
rename from dev-python/yapf/yapf-0.32.0.ebuild
rename to dev-python/yapf/yapf-0.32.0-r1.ebuild
index e0552774be32..d8665695e7b3 100644
--- a/dev-python/yapf/yapf-0.32.0.ebuild
+++ b/dev-python/yapf/yapf-0.32.0-r1.ebuild
@@ -1,14 +1,22 @@
# Copyright 2018-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
-EAPI=7
+EAPI=8
+DISTUTILS_USE_PEP517=setuptools
PYTHON_COMPAT=( python3_{9..11} )
+
inherit distutils-r1
DESCRIPTION="A formatter for Python files"
-HOMEPAGE="https://github.com/google/yapf"
-SRC_URI="https://github.com/google/yapf/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+HOMEPAGE="
+ https://github.com/google/yapf/
+ https://pypi.org/project/yapf/
+"
+SRC_URI="
+ https://github.com/google/yapf/archive/v${PV}.tar.gz
+ -> ${P}.gh.tar.gz
+"
LICENSE="Apache-2.0"
SLOT="0"
@@ -17,7 +25,14 @@ IUSE="test"
RESTRICT="!test? ( test )"
BDEPEND="
- test? ( dev-python/toml[${PYTHON_USEDEP}] )"
+ test? (
+ dev-python/tomli[${PYTHON_USEDEP}]
+ )
+"
+
+PATCHES=(
+ "${FILESDIR}"/${P}-tomli.patch
+)
python_test() {
"${EPYTHON}" -m unittest discover -v -p '*_test.py' ||
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: dev-python/yapf/files/, dev-python/yapf/
@ 2023-05-23 18:38 Michał Górny
0 siblings, 0 replies; 2+ messages in thread
From: Michał Górny @ 2023-05-23 18:38 UTC (permalink / raw
To: gentoo-commits
commit: 3215c6d5ba0049399269d11949132429fa019325
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue May 23 18:37:57 2023 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue May 23 18:37:57 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3215c6d5
dev-python/yapf: Remove old
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
dev-python/yapf/Manifest | 1 -
dev-python/yapf/files/yapf-0.32.0-tomli.patch | 178 --------------------------
dev-python/yapf/yapf-0.32.0-r1.ebuild | 40 ------
3 files changed, 219 deletions(-)
diff --git a/dev-python/yapf/Manifest b/dev-python/yapf/Manifest
index 9ac9e3466b70..c78dfd41330c 100644
--- a/dev-python/yapf/Manifest
+++ b/dev-python/yapf/Manifest
@@ -1,2 +1 @@
-DIST yapf-0.32.0.gh.tar.gz 178621 BLAKE2B b2132e3fffb96113700e322bba3f49ded0fe417de901522793564d5830951e9f2017c576fb89c5e423f4f547c95659040c2a4fc923887d9fb941e219b21f0cf6 SHA512 c1a05a04f7558a5b51899c29010bedc105c4a4bad4b5358a903a22a39f451e03369d2b4e670ecb44a857a8fef2bf438d9da0afcbdd3a336cf037bbf480d19878
DIST yapf-0.33.0.gh.tar.gz 186345 BLAKE2B 0ce1b0ca9e3838eecacf36c8f666ad58c0f35fbee1384ae5e02f3294892dd23003c39af954ed9deb3aac70397ed9924b92233e229362da1907a9cd2c692fb7e6 SHA512 82846900a9aec22ad2519ebb29fcd3d6e5a787e71e93f80c0169cf796201ae5e970ad7307f2b528e6454264cf61ca96ac4f99442ce6a52b7cebf78ceb2c9a395
diff --git a/dev-python/yapf/files/yapf-0.32.0-tomli.patch b/dev-python/yapf/files/yapf-0.32.0-tomli.patch
deleted file mode 100644
index bdbfd96112a2..000000000000
--- a/dev-python/yapf/files/yapf-0.32.0-tomli.patch
+++ /dev/null
@@ -1,178 +0,0 @@
-From 5909ba87f79ea1d687e5836c62dc82a116f4229f Mon Sep 17 00:00:00 2001
-From: Eric McDonald <221418+emcd@users.noreply.github.com>
-Date: Wed, 30 Nov 2022 14:23:50 -0800
-Subject: [PATCH] Prevent crashes against valid 'pyproject.toml'. (#1040)
-
-* Replace 'toml' dependency with 'tomli', which fully supports TOML 1.
-
-Co-authored-by: Eric McDonald <emcd@users.noreply.github.com>
----
- setup.py | 2 +-
- yapf/yapflib/file_resources.py | 15 ++++++++-------
- yapf/yapflib/style.py | 25 ++++++++++++++-----------
- yapftests/file_resources_test.py | 10 +++++-----
- yapftests/style_test.py | 4 ++--
- 5 files changed, 30 insertions(+), 26 deletions(-)
-
-diff --git a/yapf/yapflib/file_resources.py b/yapf/yapflib/file_resources.py
-index b5e2612b..6809ca9f 100644
---- a/yapf/yapflib/file_resources.py
-+++ b/yapf/yapflib/file_resources.py
-@@ -49,14 +49,15 @@ def _GetExcludePatternsFromPyprojectToml(filename):
- """Get a list of file patterns to ignore from pyproject.toml."""
- ignore_patterns = []
- try:
-- import toml
-+ import tomli as tomllib
- except ImportError:
- raise errors.YapfError(
-- "toml package is needed for using pyproject.toml as a "
-+ "tomli package is needed for using pyproject.toml as a "
- "configuration file")
-
- if os.path.isfile(filename) and os.access(filename, os.R_OK):
-- pyproject_toml = toml.load(filename)
-+ with open(filename, 'rb') as fd:
-+ pyproject_toml = tomllib.load(fd)
- ignore_patterns = pyproject_toml.get('tool',
- {}).get('yapfignore',
- {}).get('ignore_patterns', [])
-@@ -127,19 +128,19 @@ def GetDefaultStyleForDir(dirname, default_style=style.DEFAULT_STYLE):
- # See if we have a pyproject.toml file with a '[tool.yapf]' section.
- config_file = os.path.join(dirname, style.PYPROJECT_TOML)
- try:
-- fd = open(config_file)
-+ fd = open(config_file, 'rb')
- except IOError:
- pass # It's okay if it's not there.
- else:
- with fd:
- try:
-- import toml
-+ import tomli as tomllib
- except ImportError:
- raise errors.YapfError(
-- "toml package is needed for using pyproject.toml as a "
-+ "tomli package is needed for using pyproject.toml as a "
- "configuration file")
-
-- pyproject_toml = toml.load(config_file)
-+ pyproject_toml = tomllib.load(fd)
- style_dict = pyproject_toml.get('tool', {}).get('yapf', None)
- if style_dict is not None:
- return config_file
-diff --git a/yapf/yapflib/style.py b/yapf/yapflib/style.py
-index 233a64e6..c8397b32 100644
---- a/yapf/yapflib/style.py
-+++ b/yapf/yapflib/style.py
-@@ -746,17 +746,18 @@ def _CreateConfigParserFromConfigFile(config_filename):
- # Provide a more meaningful error here.
- raise StyleConfigError(
- '"{0}" is not a valid style or file path'.format(config_filename))
-- with open(config_filename) as style_file:
-- config = py3compat.ConfigParser()
-- if config_filename.endswith(PYPROJECT_TOML):
-- try:
-- import toml
-- except ImportError:
-- raise errors.YapfError(
-- "toml package is needed for using pyproject.toml as a "
-- "configuration file")
--
-- pyproject_toml = toml.load(style_file)
-+ config = py3compat.ConfigParser()
-+
-+ if config_filename.endswith(PYPROJECT_TOML):
-+ try:
-+ import tomli as tomllib
-+ except ImportError:
-+ raise errors.YapfError(
-+ "tomli package is needed for using pyproject.toml as a "
-+ "configuration file")
-+
-+ with open(config_filename, 'rb') as style_file:
-+ pyproject_toml = tomllib.load(style_file)
- style_dict = pyproject_toml.get("tool", {}).get("yapf", None)
- if style_dict is None:
- raise StyleConfigError(
-@@ -766,7 +767,9 @@ def _CreateConfigParserFromConfigFile(config_filename):
- config.set('style', k, str(v))
- return config
-
-+ with open(config_filename) as style_file:
- config.read_file(style_file)
-+
- if config_filename.endswith(SETUP_CONFIG):
- if not config.has_section('yapf'):
- raise StyleConfigError(
-diff --git a/yapftests/file_resources_test.py b/yapftests/file_resources_test.py
-index 31184c4a..f54f393d 100644
---- a/yapftests/file_resources_test.py
-+++ b/yapftests/file_resources_test.py
-@@ -75,7 +75,7 @@ def test_get_exclude_file_patterns_from_yapfignore_with_wrong_syntax(self):
-
- def test_get_exclude_file_patterns_from_pyproject(self):
- try:
-- import toml
-+ import tomli
- except ImportError:
- return
- local_ignore_file = os.path.join(self.test_tmpdir, 'pyproject.toml')
-@@ -93,7 +93,7 @@ def test_get_exclude_file_patterns_from_pyproject(self):
- @unittest.skipUnless(py3compat.PY36, 'Requires Python 3.6')
- def test_get_exclude_file_patterns_from_pyproject_with_wrong_syntax(self):
- try:
-- import toml
-+ import tomli
- except ImportError:
- return
- local_ignore_file = os.path.join(self.test_tmpdir, 'pyproject.toml')
-@@ -109,7 +109,7 @@ def test_get_exclude_file_patterns_from_pyproject_with_wrong_syntax(self):
-
- def test_get_exclude_file_patterns_from_pyproject_no_ignore_section(self):
- try:
-- import toml
-+ import tomli
- except ImportError:
- return
- local_ignore_file = os.path.join(self.test_tmpdir, 'pyproject.toml')
-@@ -122,7 +122,7 @@ def test_get_exclude_file_patterns_from_pyproject_no_ignore_section(self):
-
- def test_get_exclude_file_patterns_from_pyproject_ignore_section_empty(self):
- try:
-- import toml
-+ import tomli
- except ImportError:
- return
- local_ignore_file = os.path.join(self.test_tmpdir, 'pyproject.toml')
-@@ -192,7 +192,7 @@ def test_setup_config(self):
- def test_pyproject_toml(self):
- # An empty pyproject.toml file should not be used
- try:
-- import toml
-+ import tomli
- except ImportError:
- return
-
-diff --git a/yapftests/style_test.py b/yapftests/style_test.py
-index 8a37f953..d2203d9a 100644
---- a/yapftests/style_test.py
-+++ b/yapftests/style_test.py
-@@ -230,7 +230,7 @@ def testErrorUnknownStyleOption(self):
-
- def testPyprojectTomlNoYapfSection(self):
- try:
-- import toml
-+ import tomli
- except ImportError:
- return
-
-@@ -242,7 +242,7 @@ def testPyprojectTomlNoYapfSection(self):
-
- def testPyprojectTomlParseYapfSection(self):
- try:
-- import toml
-+ import tomli
- except ImportError:
- return
-
diff --git a/dev-python/yapf/yapf-0.32.0-r1.ebuild b/dev-python/yapf/yapf-0.32.0-r1.ebuild
deleted file mode 100644
index db3d7b1b2d2e..000000000000
--- a/dev-python/yapf/yapf-0.32.0-r1.ebuild
+++ /dev/null
@@ -1,40 +0,0 @@
-# Copyright 2018-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-DISTUTILS_USE_PEP517=setuptools
-PYTHON_COMPAT=( python3_{9..11} )
-
-inherit distutils-r1
-
-DESCRIPTION="A formatter for Python files"
-HOMEPAGE="
- https://github.com/google/yapf/
- https://pypi.org/project/yapf/
-"
-SRC_URI="
- https://github.com/google/yapf/archive/v${PV}.tar.gz
- -> ${P}.gh.tar.gz
-"
-
-LICENSE="Apache-2.0"
-SLOT="0"
-KEYWORDS="amd64 ~arm64 ~ppc64 x86"
-IUSE="test"
-RESTRICT="!test? ( test )"
-
-BDEPEND="
- test? (
- dev-python/tomli[${PYTHON_USEDEP}]
- )
-"
-
-PATCHES=(
- "${FILESDIR}"/${P}-tomli.patch
-)
-
-python_test() {
- "${EPYTHON}" -m unittest discover -v -p '*_test.py' ||
- die "Tests failed with ${EPYTHON}"
-}
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-05-23 18:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-23 18:38 [gentoo-commits] repo/gentoo:master commit in: dev-python/yapf/files/, dev-python/yapf/ Michał Górny
-- strict thread matches above, loose matches on Subject: below --
2023-01-26 10:45 Michał Górny
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox