summaryrefslogtreecommitdiff
path: root/dev-python/configargparse
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2024-11-23 03:02:57 +0000
committerV3n3RiX <venerix@koprulu.sector>2024-11-23 03:02:57 +0000
commit71dd9d29cdaf7cc0ecdb9ea37d128726a941c630 (patch)
tree4eccd905f575579fe47abb8a83bbdb44ceb8c929 /dev-python/configargparse
parentc7a7ec40cf928d8fc6a8241aa208272c008c7b4d (diff)
gentoo auto-resync : 23:11:2024 - 03:02:56
Diffstat (limited to 'dev-python/configargparse')
-rw-r--r--dev-python/configargparse/Manifest4
-rw-r--r--dev-python/configargparse/configargparse-1.7.ebuild42
-rw-r--r--dev-python/configargparse/files/configargparse-1.7-py313.patch112
-rw-r--r--dev-python/configargparse/metadata.xml13
4 files changed, 171 insertions, 0 deletions
diff --git a/dev-python/configargparse/Manifest b/dev-python/configargparse/Manifest
new file mode 100644
index 000000000000..9193652ab20c
--- /dev/null
+++ b/dev-python/configargparse/Manifest
@@ -0,0 +1,4 @@
+AUX configargparse-1.7-py313.patch 5717 BLAKE2B 9a3bc91ccc2c0f316ba37cc24299aec40aed2d91f1f8185cacc90356af477aab1b04f5ef57885fb221af6f1dbed82c1ddb2d26c4d4b7da94554fbfabb8acc072 SHA512 4ccce5af6aede68c13ff598e32b82397289a5877b070488681314873fc9f540247265cbb4da30f8dafa1a08bbca5a8a204124b1741d7ffbddf25015e5edc0c6a
+DIST ConfigArgParse-1.7.gh.tar.gz 37462 BLAKE2B a351830f79899910039cfee7a830af58afb2534368b53e8f821c161444d81e2eac61ebf7a10ce1c4a6586f05db5fb0277fdc5c0605c0e517f9592bb9a66e2f45 SHA512 4c388768dfda861a58a8c7b5a4de2a7c4070d445d9ea9aaeb5ce2e5af954ed6422b5af33967d086fd4c477156ef89e3dfd1406c02f0c49bafe6a9c980bf5840f
+EBUILD configargparse-1.7.ebuild 848 BLAKE2B 8e4fcad6d575142e8198cb39cd950ed8da73342d72c07174829c6d89443c5b7636d9f8c6a405c2b9506aa055b0214aaa3b188f9c7df0f002a22b7eefef113570 SHA512 217e0706bce22f577053a246822d1424d1a49a5d39a10b97f1a2b4738ccb46a4fbd47be47fe30a15df1e11f8b0189056a244dba1b4e5d0bbdb4937a633da85b4
+MISC metadata.xml 413 BLAKE2B 06bc019926862278b7c7a0f602f737f0ee20df1271bfd4ccd2e96e602b537403ae641f4196496ed0af92830a457af330def85f4d4b30ae2733510b82c0589310 SHA512 df63096d97d9835ee72b03ee144cb1cbed4f29644380c8711718b570938e0ed1dff9bca15b77c91df052f3f68e10633d1880d553cb8c8d7e1827714355dd8593
diff --git a/dev-python/configargparse/configargparse-1.7.ebuild b/dev-python/configargparse/configargparse-1.7.ebuild
new file mode 100644
index 000000000000..d1438b4dbf34
--- /dev/null
+++ b/dev-python/configargparse/configargparse-1.7.ebuild
@@ -0,0 +1,42 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DISTUTILS_USE_PEP517=setuptools
+PYTHON_COMPAT=( python3_{10..13} )
+
+inherit distutils-r1
+
+MY_P=ConfigArgParse-${PV}
+DESCRIPTION="Drop-in replacement for argparse supporting config files and env variables"
+HOMEPAGE="
+ https://github.com/bw2/ConfigArgParse/
+ https://pypi.org/project/ConfigArgParse/"
+SRC_URI="
+ https://github.com/bw2/ConfigArgParse/archive/${PV}.tar.gz
+ -> ${MY_P}.gh.tar.gz
+"
+S=${WORKDIR}/${MY_P}
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="amd64 arm arm64 ~ppc64 ~riscv x86"
+
+BDEPEND="
+ test? (
+ dev-python/pyyaml[${PYTHON_USEDEP}]
+ )
+"
+
+distutils_enable_tests unittest
+
+PATCHES=(
+ # https://github.com/bw2/ConfigArgParse/pull/295
+ "${FILESDIR}/${P}-py313.patch"
+)
+
+src_test() {
+ local -x COLUMNS=80
+ distutils-r1_src_test
+}
diff --git a/dev-python/configargparse/files/configargparse-1.7-py313.patch b/dev-python/configargparse/files/configargparse-1.7-py313.patch
new file mode 100644
index 000000000000..a079f37a18e6
--- /dev/null
+++ b/dev-python/configargparse/files/configargparse-1.7-py313.patch
@@ -0,0 +1,112 @@
+From c6a974211f1a13d492bb807ff6d07cefcc948a87 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Fri, 12 Jul 2024 08:15:40 +0200
+Subject: [PATCH 1/2] update test expectations for Python 3.13
+
+Python 3.13 no longer repeats the placeholder for options with multiple
+aliases in the help message. For example, rather than:
+
+ -c CONFIG_FILE, --config CONFIG_FILE
+
+it now outputs:
+
+ -c, --config CONFIG_FILE
+
+Update the regular expressions to account for both possibilities.
+
+Fixes #294
+---
+ tests/test_configargparse.py | 24 ++++++++++++------------
+ 1 file changed, 12 insertions(+), 12 deletions(-)
+
+diff --git a/tests/test_configargparse.py b/tests/test_configargparse.py
+index 288e082..e325afd 100644
+--- a/tests/test_configargparse.py
++++ b/tests/test_configargparse.py
+@@ -271,9 +271,9 @@ def testBasicCase2(self, use_groups=False):
+ ' -h, --help \\s+ show this help message and exit\n'
+ ' --genome GENOME \\s+ Path to genome file\n'
+ ' -v\n'
+- ' -g MY_CFG_FILE, --my-cfg-file MY_CFG_FILE\n'
+- ' -d DBSNP, --dbsnp DBSNP\\s+\\[env var: DBSNP_PATH\\]\n'
+- ' -f FRMT, --format FRMT\\s+\\[env var: OUTPUT_FORMAT\\]\n\n'%OPTIONAL_ARGS_STRING +
++ ' -g( MY_CFG_FILE)?, --my-cfg-file MY_CFG_FILE\n'
++ ' -d( DBSNP)?, --dbsnp DBSNP\\s+\\[env var: DBSNP_PATH\\]\n'
++ ' -f( FRMT)?, --format FRMT\\s+\\[env var: OUTPUT_FORMAT\\]\n\n'%OPTIONAL_ARGS_STRING +
+ 7*r'(.+\s*)')
+ else:
+ self.assertRegex(self.format_help(),
+@@ -286,10 +286,10 @@ def testBasicCase2(self, use_groups=False):
+ 'g1:\n'
+ ' --genome GENOME \\s+ Path to genome file\n'
+ ' -v\n'
+- ' -g MY_CFG_FILE, --my-cfg-file MY_CFG_FILE\n\n'
++ ' -g( MY_CFG_FILE)?, --my-cfg-file MY_CFG_FILE\n\n'
+ 'g2:\n'
+- ' -d DBSNP, --dbsnp DBSNP\\s+\\[env var: DBSNP_PATH\\]\n'
+- ' -f FRMT, --format FRMT\\s+\\[env var: OUTPUT_FORMAT\\]\n\n'%OPTIONAL_ARGS_STRING +
++ ' -d( DBSNP)?, --dbsnp DBSNP\\s+\\[env var: DBSNP_PATH\\]\n'
++ ' -f( FRMT)?, --format FRMT\\s+\\[env var: OUTPUT_FORMAT\\]\n\n'%OPTIONAL_ARGS_STRING +
+ 7*r'(.+\s*)')
+
+ self.assertParseArgsRaises("invalid choice: 'ZZZ'",
+@@ -387,9 +387,9 @@ def testMutuallyExclusiveArgs(self):
+ ' \\s*-f2 TYPE2_CFG_FILE\\)\\s+\\(-f FRMT \\| -b\\)\n\n'
+ '%s:\n'
+ ' -h, --help show this help message and exit\n'
+- ' -f1 TYPE1_CFG_FILE, --type1-cfg-file TYPE1_CFG_FILE\n'
+- ' -f2 TYPE2_CFG_FILE, --type2-cfg-file TYPE2_CFG_FILE\n'
+- ' -f FRMT, --format FRMT\\s+\\[env var: OUTPUT_FORMAT\\]\n'
++ ' -f1( TYPE1_CFG_FILE)?, --type1-cfg-file TYPE1_CFG_FILE\n'
++ ' -f2( TYPE2_CFG_FILE)?, --type2-cfg-file TYPE2_CFG_FILE\n'
++ ' -f( FRMT)?, --format FRMT\\s+\\[env var: OUTPUT_FORMAT\\]\n'
+ ' -b, --bam\\s+\\[env var: BAM_FORMAT\\]\n\n'
+ 'group1:\n'
+ ' --genome GENOME Path to genome file\n'
+@@ -875,7 +875,7 @@ def testConstructor_ConfigFileArgs(self):
+ 'usage: .* \\[-h\\] -c CONFIG_FILE --genome GENOME\n\n'
+ '%s:\n'
+ ' -h, --help\\s+ show this help message and exit\n'
+- ' -c CONFIG_FILE, --config CONFIG_FILE\\s+ my config file\n'
++ ' -c( CONFIG_FILE)?, --config CONFIG_FILE\\s+ my config file\n'
+ ' --genome GENOME\\s+ Path to genome file\n\n'%OPTIONAL_ARGS_STRING +
+ 5*r'(.+\s*)')
+
+@@ -935,8 +935,8 @@ def test_FormatHelp(self):
+ r'\[-w CONFIG_OUTPUT_PATH\]\s* --arg1\s+ARG1\s*\[--flag\]\s*'
+ '%s:\\s*'
+ '-h, --help \\s* show this help message and exit '
+- r'-c CONFIG_FILE, --config CONFIG_FILE\s+my config file '
+- r'-w CONFIG_OUTPUT_PATH, --write-config CONFIG_OUTPUT_PATH takes '
++ r'-c( CONFIG_FILE)?, --config CONFIG_FILE\s+my config file '
++ r'-w( CONFIG_OUTPUT_PATH)?, --write-config CONFIG_OUTPUT_PATH takes '
+ r'the current command line args and writes them '
+ r'out to a config file at the given path, then exits '
+ r'--arg1 ARG1 Arg1 help text '
+
+From 5e9f442374bc6d9707a43df13aaff684dff6b535 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Fri, 12 Jul 2024 08:25:30 +0200
+Subject: [PATCH 2/2] skip exit_on_error* tests to fix 3.13 test failures
+
+Skip `exit_on_error*` tests from `test.test_argparse` to avoid test
+failures on Python 3.13. The `exit_on_error=False` semantics
+is not supported by ConfigArgParse at the moment.
+---
+ tests/test_configargparse.py | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/tests/test_configargparse.py b/tests/test_configargparse.py
+index e325afd..9718d86 100644
+--- a/tests/test_configargparse.py
++++ b/tests/test_configargparse.py
+@@ -1533,7 +1533,8 @@ def testYAMLConfigFileParser_w_ArgumentParser_parsed_values(self):
+ test_argparse_source_code = test_argparse_source_code.replace(
+ 'argparse.ArgumentParser', 'configargparse.ArgumentParser').replace(
+ 'TestHelpFormattingMetaclass', '_TestHelpFormattingMetaclass').replace(
+- 'test_main', '_test_main')
++ 'test_main', '_test_main').replace(
++ 'test_exit_on_error', '_test_exit_on_error')
+
+ # pytest tries to collect tests from TestHelpFormattingMetaclass, and
+ # test_main, and raises a warning when it finds it's not a test class
diff --git a/dev-python/configargparse/metadata.xml b/dev-python/configargparse/metadata.xml
new file mode 100644
index 000000000000..f46051e99f5b
--- /dev/null
+++ b/dev-python/configargparse/metadata.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="project">
+ <email>python@gentoo.org</email>
+ <name>Python</name>
+ </maintainer>
+ <stabilize-allarches/>
+ <upstream>
+ <remote-id type="pypi">ConfigArgParse</remote-id>
+ <remote-id type="github">bw2/ConfigArgParse</remote-id>
+ </upstream>
+</pkgmetadata>