Gentoo Archives: gentoo-commits

From: Tony Vroon <chainsaw@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-admin/ansible-lint/files/, app-admin/ansible-lint/
Date: Mon, 10 Feb 2020 13:29:56
Message-Id: 1581341377.9ca887070a0a703a063cac54afd4de9053b91590.chainsaw@gentoo
1 commit: 9ca887070a0a703a063cac54afd4de9053b91590
2 Author: Tony Vroon <chainsaw <AT> gentoo <DOT> org>
3 AuthorDate: Mon Feb 10 13:29:17 2020 +0000
4 Commit: Tony Vroon <chainsaw <AT> gentoo <DOT> org>
5 CommitDate: Mon Feb 10 13:29:37 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9ca88707
7
8 app-admin/ansible-lint: Version bump to 4.1.0
9
10 Squelch DISTUTILS_USE_SETUPTOOLS as suggested by Ferenc Erki on GitHub.
11 Remove unused setuptools-git from DEPEND as per Ferenc Erki on GitHub.
12 Scavenge upstream patch identified by Peter on bug 698864 (setuptools).
13 Concern for Python 2.7 has now ceased due to EOL.
14
15 Closes: https://bugs.gentoo.org/681988
16 Bug: https://bugs.gentoo.org/698864
17 Closes: https://github.com/gentoo/gentoo/pull/14588
18 Reported-by: Lik
19 Suggested-by: Ferenc Erki
20 Signed-Off-By: Tony Vroon <chainsaw <AT> gentoo.org>
21 Package-Manager: Portage-2.3.84, Repoman-2.3.20
22
23 app-admin/ansible-lint/Manifest | 1 +
24 app-admin/ansible-lint/ansible-lint-4.1.0.ebuild | 39 +++++
25 ...-lint-4.1.0-specifierset-split-setuptools.patch | 175 +++++++++++++++++++++
26 3 files changed, 215 insertions(+)
27
28 diff --git a/app-admin/ansible-lint/Manifest b/app-admin/ansible-lint/Manifest
29 index 071396fc34a..eddd28d3cda 100644
30 --- a/app-admin/ansible-lint/Manifest
31 +++ b/app-admin/ansible-lint/Manifest
32 @@ -1 +1,2 @@
33 DIST ansible-lint-4.0.1.tar.gz 2909257 BLAKE2B c030b6fc58eaeeec42e40dd5bc46e5181916433b905bfc4a82382bf6bba8536d2639172aab0e2928ce1dd5489f322e19ab1c0ea5abb637562616addb9733e81a SHA512 a2f3bd44287a2c72f79c5fbb4c02446484cf764d386d403694325bce172e2b195dd4812e0f89e5f4e1930db124e2b383e4f067bed5d4858c354c0ae0b3fb03e4
34 +DIST ansible-lint-4.1.0.tar.gz 2911091 BLAKE2B b6e414dbdeebcc1cae900736829abf2db0930e5e05ae7c2bbd6d30a89b6ac28485ddfb63528bdc3baae6ef97ae7536507632d43b16f9a16dd86887d781940aeb SHA512 c1d07093d68bf5f43c20c3a999adf26d23ba587d5008a35069dcbab514b208737f5d0ecaf032e43d313233ea06193db81b349d5fb62f3ac684af9e51d8bc6e08
35
36 diff --git a/app-admin/ansible-lint/ansible-lint-4.1.0.ebuild b/app-admin/ansible-lint/ansible-lint-4.1.0.ebuild
37 new file mode 100644
38 index 00000000000..46715fcb9b4
39 --- /dev/null
40 +++ b/app-admin/ansible-lint/ansible-lint-4.1.0.ebuild
41 @@ -0,0 +1,39 @@
42 +# Copyright 1999-2020 Gentoo Authors
43 +# Distributed under the terms of the GNU General Public License v2
44 +
45 +EAPI=7
46 +
47 +DISTUTILS_USE_SETUPTOOLS=rdepend
48 +PYTHON_COMPAT=( python3_{6,7} )
49 +
50 +inherit distutils-r1
51 +
52 +DESCRIPTION="Checks ansible playbooks for practices and behaviour that can be improved"
53 +HOMEPAGE="https://github.com/ansible/ansible-lint"
54 +SRC_URI="https://github.com/ansible/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
55 +
56 +LICENSE="MIT"
57 +SLOT="0"
58 +KEYWORDS="~amd64"
59 +IUSE="test"
60 +RESTRICT="!test? ( test )"
61 +PATCHES="${FILESDIR}/${P}-specifierset-split-setuptools.patch"
62 +
63 +CDEPEND="app-admin/ansible[${PYTHON_USEDEP}]
64 + dev-python/pyyaml[${PYTHON_USEDEP}]
65 + dev-python/six[${PYTHON_USEDEP}]"
66 +DEPEND="dev-python/ruamel-yaml[${PYTHON_USEDEP}]
67 + dev-python/setuptools[${PYTHON_USEDEP}]
68 + dev-python/setuptools_scm[${PYTHON_USEDEP}]
69 + dev-python/setuptools_scm_git_archive[${PYTHON_USEDEP}]
70 + test? (
71 + dev-python/flake8[${PYTHON_USEDEP}]
72 + dev-python/nose[${PYTHON_USEDEP}]
73 + dev-python/wheel[${PYTHON_USEDEP}]
74 + )
75 + ${CDEPEND}"
76 +RDEPEND="${CDEPEND}"
77 +
78 +python_test() {
79 + nosetests || die
80 +}
81
82 diff --git a/app-admin/ansible-lint/files/ansible-lint-4.1.0-specifierset-split-setuptools.patch b/app-admin/ansible-lint/files/ansible-lint-4.1.0-specifierset-split-setuptools.patch
83 new file mode 100644
84 index 00000000000..4e4ac16d238
85 --- /dev/null
86 +++ b/app-admin/ansible-lint/files/ansible-lint-4.1.0-specifierset-split-setuptools.patch
87 @@ -0,0 +1,175 @@
88 +From c91d23b2f82b4efb540168132842b243eb2d8b0d Mon Sep 17 00:00:00 2001
89 +From: Sviatoslav Sydorenko <wk@×××××××××××××.ua>
90 +Date: Thu, 24 Oct 2019 01:38:35 +0200
91 +Subject: [PATCH] Drop support for setuptools older than 34.4.0
92 +
93 +Resolves #599
94 +---
95 + setup.py | 141 +++++--------------------------------------------------
96 + 1 file changed, 13 insertions(+), 128 deletions(-)
97 +
98 +diff --git a/setup.py b/setup.py
99 +index 25cc9e80d09e4657b56c4c4ed68d9411b7d7eae9..ff4c5bd65a7f5786c5af32750fb83dd3f6d92cec 100644
100 +--- a/setup.py
101 ++++ b/setup.py
102 +@@ -1,138 +1,16 @@
103 + #! /usr/bin/env python
104 + """Ansible-lint distribution package setuptools installer."""
105 +
106 +-import setuptools
107 +-
108 +-
109 +-try:
110 +- from setuptools.config import read_configuration, ConfigOptionsHandler
111 +- import setuptools.config
112 +- import setuptools.dist
113 +-
114 +- # Set default value for 'use_scm_version'
115 +- setattr(setuptools.dist.Distribution, 'use_scm_version', False)
116 +-
117 +- # Attach bool parser to 'use_scm_version' option
118 +- class ShimConfigOptionsHandler(ConfigOptionsHandler):
119 +- """Extension class for ConfigOptionsHandler."""
120 +-
121 +- @property
122 +- def parsers(self):
123 +- """Return an option mapping with default data type parsers."""
124 +- _orig_parsers = super(ShimConfigOptionsHandler, self).parsers
125 +- return dict(use_scm_version=self._parse_bool, **_orig_parsers)
126 +-
127 +- setuptools.config.ConfigOptionsHandler = ShimConfigOptionsHandler
128 +-except ImportError:
129 +- """This is a shim for setuptools<30.3."""
130 +- import io
131 +- import json
132 +-
133 +- try:
134 +- from configparser import ConfigParser, NoSectionError
135 +- except ImportError:
136 +- from ConfigParser import ConfigParser, NoSectionError
137 +- ConfigParser.read_file = ConfigParser.readfp
138 +-
139 +- def maybe_read_files(d):
140 +- """Read files if the string starts with `file:` marker."""
141 +- d = d.strip()
142 +- if not d.startswith('file:'):
143 +- return d
144 +- descs = []
145 +- for fname in map(str.strip, str(d[5:]).split(',')):
146 +- with io.open(fname, encoding='utf-8') as f:
147 +- descs.append(f.read())
148 +- return ''.join(descs)
149 +-
150 +- def cfg_val_to_list(v):
151 +- """Turn config val to list and filter out empty lines."""
152 +- return list(filter(bool, map(str.strip, str(v).strip().splitlines())))
153 +
154 +- def cfg_val_to_dict(v):
155 +- """Turn config val to dict and filter out empty lines."""
156 +- return dict(
157 +- map(lambda l: list(map(str.strip, l.split('=', 1))),
158 +- filter(bool, map(str.strip, str(v).strip().splitlines())))
159 +- )
160 ++__requires__ = ('setuptools >= 34.4', )
161 +
162 +- def cfg_val_to_primitive(v):
163 +- """Parse primitive config val to appropriate data type."""
164 +- return json.loads(v.strip().lower())
165 +
166 +- def read_configuration(filepath):
167 +- """Read metadata and options from setup.cfg located at filepath."""
168 +- cfg = ConfigParser()
169 +- with io.open(filepath, encoding='utf-8') as f:
170 +- cfg.read_file(f)
171 +-
172 +- md = dict(cfg.items('metadata'))
173 +- for list_key in 'classifiers', 'keywords':
174 +- try:
175 +- md[list_key] = cfg_val_to_list(md[list_key])
176 +- except KeyError:
177 +- pass
178 +- try:
179 +- md['long_description'] = maybe_read_files(md['long_description'])
180 +- except KeyError:
181 +- pass
182 +- opt = dict(cfg.items('options'))
183 +- for list_key in 'use_scm_version', 'zip_safe':
184 +- try:
185 +- opt[list_key] = cfg_val_to_primitive(opt[list_key])
186 +- except KeyError:
187 +- pass
188 +- for list_key in 'scripts', 'install_requires', 'setup_requires':
189 +- try:
190 +- opt[list_key] = cfg_val_to_list(opt[list_key])
191 +- except KeyError:
192 +- pass
193 +- try:
194 +- opt['package_dir'] = cfg_val_to_dict(opt['package_dir'])
195 +- except KeyError:
196 +- pass
197 +- try:
198 +- opt_package_data = dict(cfg.items('options.package_data'))
199 +- if not opt_package_data.get('', '').strip():
200 +- opt_package_data[''] = opt_package_data['*']
201 +- del opt_package_data['*']
202 +- except (KeyError, NoSectionError):
203 +- opt_package_data = {}
204 +- try:
205 +- opt_extras_require = dict(cfg.items('options.extras_require'))
206 +- opt['extras_require'] = {}
207 +- for k, v in opt_extras_require.items():
208 +- opt['extras_require'][k] = cfg_val_to_list(v)
209 +- except NoSectionError:
210 +- pass
211 +- opt['package_data'] = {}
212 +- for k, v in opt_package_data.items():
213 +- opt['package_data'][k] = cfg_val_to_list(v)
214 +- cur_pkgs = opt.get('packages', '').strip()
215 +- if '\n' in cur_pkgs:
216 +- opt['packages'] = cfg_val_to_list(opt['packages'])
217 +- elif cur_pkgs.startswith('find:'):
218 +- opt_packages_find = dict(cfg.items('options.packages.find'))
219 +- opt['packages'] = setuptools.find_packages(**opt_packages_find)
220 +- return {'metadata': md, 'options': opt}
221 +-
222 +-
223 +-setup_params = {}
224 +-declarative_setup_params = read_configuration('setup.cfg')
225 +-
226 +-# Patch incorrectly decoded package_dir option
227 +-# ``egg_info`` demands native strings failing with unicode under Python 2
228 +-# Ref https://github.com/pypa/setuptools/issues/1136
229 +-declarative_setup_params['options']['package_dir'] = {
230 +- str(k): str(v)
231 +- for k, v in declarative_setup_params['options']['package_dir'].items()
232 +-}
233 +-
234 +-setup_params = dict(setup_params, **declarative_setup_params['metadata'])
235 +-setup_params = dict(setup_params, **declarative_setup_params['options'])
236 ++import setuptools
237 ++from setuptools.config import read_configuration
238 +
239 +
240 + def cut_local_version_on_upload(version):
241 ++ """Generate a PEP440 local version if uploading to PyPI."""
242 + import os
243 + import setuptools_scm.version # only present during setup time
244 + IS_PYPI_UPLOAD = os.getenv('PYPI_UPLOAD') == 'true'
245 +@@ -142,8 +20,15 @@ def cut_local_version_on_upload(version):
246 + )
247 +
248 +
249 +-setup_params['use_scm_version'] = {
250 +- 'local_scheme': cut_local_version_on_upload,
251 ++# This is needed because even new
252 ++# setuptools don't parse
253 ++# `setup_requires` from `setup.cfg`:
254 ++declarative_setup_params = read_configuration('setup.cfg')
255 ++setup_params = {
256 ++ 'setup_requires': declarative_setup_params['options']['setup_requires'],
257 ++ 'use_scm_version': {
258 ++ 'local_scheme': cut_local_version_on_upload,
259 ++ }
260 + }
261 +
262 +