Gentoo Archives: gentoo-commits

From: Ionen Wolkens <ionen@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/boltons/files/, dev-python/boltons/
Date: Tue, 30 Nov 2021 00:08:25
Message-Id: 1638230888.ad9db813692e18f42f67db25f114bb1f7a7a10df.ionen@gentoo
1 commit: ad9db813692e18f42f67db25f114bb1f7a7a10df
2 Author: Ionen Wolkens <ionen <AT> gentoo <DOT> org>
3 AuthorDate: Mon Nov 29 22:02:53 2021 +0000
4 Commit: Ionen Wolkens <ionen <AT> gentoo <DOT> org>
5 CommitDate: Tue Nov 30 00:08:08 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ad9db813
7
8 dev-python/boltons: initial import, 21.0.0
9
10 For removing test network restrictions on dev-util/maturin
11
12 Signed-off-by: Ionen Wolkens <ionen <AT> gentoo.org>
13
14 dev-python/boltons/Manifest | 1 +
15 dev-python/boltons/boltons-21.0.0.ebuild | 25 +++++
16 .../boltons/files/boltons-21.0.0-python3.10.patch | 110 +++++++++++++++++++++
17 dev-python/boltons/metadata.xml | 13 +++
18 4 files changed, 149 insertions(+)
19
20 diff --git a/dev-python/boltons/Manifest b/dev-python/boltons/Manifest
21 new file mode 100644
22 index 000000000000..21f53da6a6cf
23 --- /dev/null
24 +++ b/dev-python/boltons/Manifest
25 @@ -0,0 +1 @@
26 +DIST boltons-21.0.0.tar.gz 241010 BLAKE2B e8c7cba3aadc40fbf40b784c8060d7b4f9d89457a4416c8fe9c733c3a35cf292609b2cc4e43e20a1308add6b854c3e00cb55274328a14699b3c704b73c189318 SHA512 5f5d642ab8ce0bc26133f4bd5059071bc86ca8e6619ebac796d522a0e4c39b958176ccc9de9a56e0448b24bdcf569e73f51011d5a9fc875bdef12a363f106018
27
28 diff --git a/dev-python/boltons/boltons-21.0.0.ebuild b/dev-python/boltons/boltons-21.0.0.ebuild
29 new file mode 100644
30 index 000000000000..fc517a50cd75
31 --- /dev/null
32 +++ b/dev-python/boltons/boltons-21.0.0.ebuild
33 @@ -0,0 +1,25 @@
34 +# Copyright 2021 Gentoo Authors
35 +# Distributed under the terms of the GNU General Public License v2
36 +
37 +EAPI=8
38 +
39 +PYTHON_COMPAT=( python3_{8..10} )
40 +inherit distutils-r1
41 +
42 +DESCRIPTION="Pure-python utilities in the same spirit as the standard library"
43 +HOMEPAGE="https://boltons.readthedocs.org/"
44 +SRC_URI="https://github.com/mahmoud/boltons/archive/refs/tags/${PV}.tar.gz -> ${P}.tar.gz"
45 +
46 +LICENSE="BSD"
47 +SLOT="0"
48 +KEYWORDS="~amd64 ~x86"
49 +
50 +distutils_enable_tests pytest
51 +distutils_enable_sphinx docs \
52 + dev-python/sphinx_rtd_theme
53 +
54 +DOCS=( CHANGELOG.md README.md TODO.rst )
55 +
56 +PATCHES=(
57 + "${FILESDIR}"/${P}-python3.10.patch
58 +)
59
60 diff --git a/dev-python/boltons/files/boltons-21.0.0-python3.10.patch b/dev-python/boltons/files/boltons-21.0.0-python3.10.patch
61 new file mode 100644
62 index 000000000000..2e9974a71c9e
63 --- /dev/null
64 +++ b/dev-python/boltons/files/boltons-21.0.0-python3.10.patch
65 @@ -0,0 +1,110 @@
66 +https://github.com/mahmoud/boltons/commit/270e974
67 +From: Mahmoud Hashemi <mahmoud@×××××××.com>
68 +Date: Sun, 10 Oct 2021 23:26:24 -0700
69 +Subject: [PATCH] address ecoutils import issue, fixes #294
70 +--- a/boltons/ecoutils.py
71 ++++ b/boltons/ecoutils.py
72 +@@ -354,38 +354,53 @@ def get_profile(**kwargs):
73 + return ret
74 +
75 +
76 +-_real_safe_repr = pprint._safe_repr
77 +-
78 +-
79 +-def _fake_json_dumps(val, indent=2):
80 +- # never do this. this is a hack for Python 2.4. Python 2.5 added
81 +- # the json module for a reason.
82 +- def _fake_safe_repr(*a, **kw):
83 +- res, is_read, is_rec = _real_safe_repr(*a, **kw)
84 +- if res == 'None':
85 +- res = 'null'
86 +- if res == 'True':
87 +- res = 'true'
88 +- if res == 'False':
89 +- res = 'false'
90 +- if not (res.startswith("'") or res.startswith("u'")):
91 +- res = res
92 +- else:
93 +- if res.startswith('u'):
94 +- res = res[1:]
95 ++try:
96 ++ import json
97 ++
98 ++ def dumps(val, indent):
99 ++ if indent:
100 ++ return json.dumps(val, sort_keys=True, indent=indent)
101 ++ return json.dumps(val, sort_keys=True)
102 ++
103 ++except ImportError:
104 ++ _real_safe_repr = pprint._safe_repr
105 ++
106 ++ def _fake_json_dumps(val, indent=2):
107 ++ # never do this. this is a hack for Python 2.4. Python 2.5 added
108 ++ # the json module for a reason.
109 ++ def _fake_safe_repr(*a, **kw):
110 ++ res, is_read, is_rec = _real_safe_repr(*a, **kw)
111 ++ if res == 'None':
112 ++ res = 'null'
113 ++ if res == 'True':
114 ++ res = 'true'
115 ++ if res == 'False':
116 ++ res = 'false'
117 ++ if not (res.startswith("'") or res.startswith("u'")):
118 ++ res = res
119 ++ else:
120 ++ if res.startswith('u'):
121 ++ res = res[1:]
122 +
123 +- contents = res[1:-1]
124 +- contents = contents.replace('"', '').replace(r'\"', '')
125 +- res = '"' + contents + '"'
126 +- return res, is_read, is_rec
127 ++ contents = res[1:-1]
128 ++ contents = contents.replace('"', '').replace(r'\"', '')
129 ++ res = '"' + contents + '"'
130 ++ return res, is_read, is_rec
131 +
132 +- pprint._safe_repr = _fake_safe_repr
133 +- try:
134 +- ret = pprint.pformat(val, indent=indent)
135 +- finally:
136 +- pprint._safe_repr = _real_safe_repr
137 ++ pprint._safe_repr = _fake_safe_repr
138 ++ try:
139 ++ ret = pprint.pformat(val, indent=indent)
140 ++ finally:
141 ++ pprint._safe_repr = _real_safe_repr
142 ++
143 ++ return ret
144 ++
145 ++ def dumps(val, indent):
146 ++ ret = _fake_json_dumps(val, indent=indent)
147 ++ if not indent:
148 ++ ret = re.sub(r'\n\s*', ' ', ret)
149 ++ return ret
150 +
151 +- return ret
152 +
153 +
154 + def get_profile_json(indent=False):
155 +@@ -393,20 +408,6 @@ def get_profile_json(indent=False):
156 + indent = 2
157 + else:
158 + indent = 0
159 +- try:
160 +- import json
161 +-
162 +- def dumps(val, indent):
163 +- if indent:
164 +- return json.dumps(val, sort_keys=True, indent=indent)
165 +- return json.dumps(val, sort_keys=True)
166 +-
167 +- except ImportError:
168 +- def dumps(val, indent):
169 +- ret = _fake_json_dumps(val, indent=indent)
170 +- if not indent:
171 +- ret = re.sub(r'\n\s*', ' ', ret)
172 +- return ret
173 +
174 + data_dict = get_profile()
175 + return dumps(data_dict, indent)
176
177 diff --git a/dev-python/boltons/metadata.xml b/dev-python/boltons/metadata.xml
178 new file mode 100644
179 index 000000000000..769cd6689ddf
180 --- /dev/null
181 +++ b/dev-python/boltons/metadata.xml
182 @@ -0,0 +1,13 @@
183 +<?xml version="1.0" encoding="UTF-8"?>
184 +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
185 +<pkgmetadata>
186 + <maintainer type="person">
187 + <email>ionen@g.o</email>
188 + <name>Ionen Wolkens</name>
189 + </maintainer>
190 + <stabilize-allarches/>
191 + <upstream>
192 + <remote-id type="github">mahmoud/boltons</remote-id>
193 + <remote-id type="pypi">boltons</remote-id>
194 + </upstream>
195 +</pkgmetadata>