Gentoo Archives: gentoo-commits

From: Matt Turner <mattst88@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/catalyst:wip/mattst88 commit in: catalyst/, /
Date: Thu, 29 Oct 2020 21:52:22
Message-Id: 1604008315.f76d86530bd676051841aef7d1ee958b59812a76.mattst88@gentoo
1 commit: f76d86530bd676051841aef7d1ee958b59812a76
2 Author: Matt Turner <mattst88 <AT> gentoo <DOT> org>
3 AuthorDate: Fri Oct 9 03:47:22 2020 +0000
4 Commit: Matt Turner <mattst88 <AT> gentoo <DOT> org>
5 CommitDate: Thu Oct 29 21:51:55 2020 +0000
6 URL: https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=f76d8653
7
8 catalyst: Use pyproject.toml
9
10 See PEPs 517, 518, and (Draft) 621.
11
12 Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>
13
14 .gitattributes | 1 -
15 .gitignore | 2 +-
16 AUTHORS | 54 ----------------------
17 MANIFEST.in | 6 ---
18 catalyst/__init__.py | 10 +---
19 catalyst/main.py | 4 +-
20 catalyst/version.py | 65 --------------------------
21 pyproject.toml | 77 +++++++++++++++++++++++++++++++
22 setup.py | 127 ++++++---------------------------------------------
23 9 files changed, 93 insertions(+), 253 deletions(-)
24
25 diff --git a/.gitattributes b/.gitattributes
26 index 19ad929b..0b2b43fc 100644
27 --- a/.gitattributes
28 +++ b/.gitattributes
29 @@ -1,4 +1,3 @@
30 -AUTHORS ident
31 ChangeLog ident
32 README ident
33 TODO ident
34
35 diff --git a/.gitignore b/.gitignore
36 index 649b79ab..8979e259 100644
37 --- a/.gitignore
38 +++ b/.gitignore
39 @@ -1,6 +1,6 @@
40 *.py[co]
41 +/catalyst/version.py
42
43 /build/
44 /dist/
45 /files/
46 -/MANIFEST
47
48 diff --git a/AUTHORS b/AUTHORS
49 deleted file mode 100644
50 index 41366b8c..00000000
51 --- a/AUTHORS
52 +++ /dev/null
53 @@ -1,54 +0,0 @@
54 -The copyright for catalyst is held by the Gentoo Foundation and by each
55 -of the individual contributors.
56 -
57 -
58 -Original Authors:
59 ------------------
60 -John Davis <zhen@g.o>
61 -Daniel Robbins <drobbins@g.o>
62 -
63 -
64 -Significant contributors (including the first catalyst3 rewrite):
65 ------------------------------------------------------------------
66 -Andrew Gaffney <agaffney@g.o>
67 -Chris Gianelloni <wolf31o2@××××××××.org>
68 -
69 -
70 -Contributors:
71 --------------
72 -Eric Edgar <rocket@g.o>
73 -Andrew Gaffney <agaffney@g.o>
74 -Chris Gianelloni <wolf31o2@g.o>
75 -David Bryson <mutex@g.o>
76 -Mike Frysinger <vapier@g.o>
77 -Rob Holland <tigger@g.o>
78 -Robin H. Johnson <robbat2@g.o>
79 -Joshua Kinard <kumba@g.o>
80 -Stuart Longland <redhatter@g.o>
81 -Guy Martin <gmsoft@g.o>
82 -Daniel Ostrow <dostrow@g.o>
83 -Robert Paskowitz <r2d2@g.o>
84 -Diego Pettenò <flameeyes@g.o>
85 -Matsuu Takuto <matsuu@g.o>
86 -Lars Weiler <pylon@g.o>
87 -Gustavo Zacarias <gustavoz@g.o>
88 -Raúl Porcel <armin76@g.o>
89 -Jorge Manuel B. S. Vicetto <jmbsvicetto@g.o>
90 -W. Trevor King <wking@×××××××.us>
91 -Matt Turner <mattst88@×××××.com>
92 -Anthony G. Basile <blueness@g.o>
93 -Ben Kohler <bkohler@×××××.com>
94 -Brian Dolbec <dolsen@g.o>
95 -Douglas Freed <dwfreed@×××.edu>
96 -Dylan Baker <baker.dylan.c@×××××.com>
97 -Jeremy Olexa <darkside@g.o>
98 -Kevin Zhao <kevin.zhaoshuai@×××××.com>
99 -Rick Farina (Zero_Chaos) <zerochaos@g.o>
100 -Sebastian Pipping <sebastian@×××××××.org>
101 -Yuta SATOH <nigoro.dev@×××××.com>
102 -William Hubbs <w.d.hubbs@×××××.com>
103 -
104 -Maintainers:
105 -------------
106 -Catalyst maintainers <catalyst@g.o>
107 -Release Engineering <releng@g.o>
108
109 diff --git a/MANIFEST.in b/MANIFEST.in
110 deleted file mode 100644
111 index 4274094a..00000000
112 --- a/MANIFEST.in
113 +++ /dev/null
114 @@ -1,6 +0,0 @@
115 -include AUTHORS
116 -include ChangeLog
117 -include COPYING
118 -include Makefile
119 -recursive-include doc *.conf *.py HOWTO.txt catalyst*.txt
120 -recursive-include examples README *.example *.spec
121
122 diff --git a/catalyst/__init__.py b/catalyst/__init__.py
123 index 143bdf81..13a72c07 100644
124 --- a/catalyst/__init__.py
125 +++ b/catalyst/__init__.py
126 @@ -1,10 +1,2 @@
127 -"Catalyst is the release building tool used by Gentoo Linux"
128
129 -__maintainer__ = 'Catalyst <catalyst@g.o>'
130 -
131 -try:
132 - from .verinfo import version as fullversion
133 - __version__ = fullversion.split('\n')[0].split()[1]
134 -except ImportError:
135 - from .version import get_version, __version__
136 - fullversion = get_version(reset=True)
137 +from .version import version as __version__
138
139 diff --git a/catalyst/main.py b/catalyst/main.py
140 index 543895c6..ab5c2a01 100644
141 --- a/catalyst/main.py
142 +++ b/catalyst/main.py
143 @@ -18,13 +18,11 @@ import catalyst.config
144 from catalyst.defaults import (confdefaults, option_messages,
145 DEFAULT_CONFIG_FILE, valid_config_file_values)
146 from catalyst.support import CatalystError
147 -from catalyst.version import get_version
148
149 conf_values = confdefaults
150
151
152 def version():
153 - log.info(get_version())
154 log.info('Copyright 2003-%s Gentoo Foundation',
155 datetime.datetime.now().year)
156 log.info('Copyright 2008-2012 various authors')
157 @@ -118,7 +116,7 @@ def get_parser():
158 epilog=epilog, formatter_class=argparse.RawDescriptionHelpFormatter)
159
160 parser.add_argument('-V', '--version',
161 - action='version', version=get_version(),
162 + action='version', version=catalyst.__version__,
163 help='display version information')
164
165 group = parser.add_argument_group('Program output options')
166
167 diff --git a/catalyst/version.py b/catalyst/version.py
168 deleted file mode 100644
169 index dbada51a..00000000
170 --- a/catalyst/version.py
171 +++ /dev/null
172 @@ -1,65 +0,0 @@
173 -'''Version information and/or git version information
174 -'''
175 -
176 -import os
177 -
178 -from snakeoil.version import get_git_version as get_ver
179 -
180 -__version__ = "3.0.7"
181 -_ver = None
182 -
183 -
184 -def get_git_version(version=__version__):
185 - """Return: a string describing our version."""
186 - # pylint: disable=global-statement
187 - global _ver
188 - cwd = os.path.dirname(os.path.abspath(__file__))
189 - version_info = get_ver(cwd)
190 -
191 - if not version_info:
192 - s = "extended version info unavailable"
193 - elif version_info['tag'] == __version__:
194 - s = 'released %s' % (version_info['date'],)
195 - else:
196 - s = ('vcs version %s, date %s' %
197 - (version_info['rev'], version_info['date']))
198 -
199 - _ver = 'Catalyst %s\n%s' % (version, s)
200 -
201 - return _ver
202 -
203 -
204 -def get_version(reset=False):
205 - '''Returns a saved release version string or the
206 - generated git release version.
207 - '''
208 - # pylint: disable=global-statement
209 - global __version__, _ver
210 - if _ver and not reset:
211 - return _ver
212 - try: # getting the fixed version
213 - from .verinfo import version
214 - _ver = version
215 - __version__ = version.split('\n')[0].split()[1]
216 - except ImportError: # get the live version
217 - version = get_git_version()
218 - return version
219 -
220 -
221 -def set_release_version(version, root=None):
222 - '''Saves the release version along with the
223 - git log release information
224 -
225 - @param version: string
226 - @param root: string, optional alternate root path to save to
227 - '''
228 - #global __version__
229 - filename = "verinfo.py"
230 - if not root:
231 - path = os.path.join(os.path.dirname(__file__), filename)
232 - else:
233 - path = os.path.join(root, filename)
234 - #__version__ = version
235 - ver = get_git_version(version)
236 - with open(path, 'w') as f:
237 - f.write("version = {0!r}".format(ver))
238
239 diff --git a/pyproject.toml b/pyproject.toml
240 new file mode 100644
241 index 00000000..e6a14f35
242 --- /dev/null
243 +++ b/pyproject.toml
244 @@ -0,0 +1,77 @@
245 +[project]
246 +name = "catalyst"
247 +description = "Tool for creating releases based on Gentoo Linux"
248 +authors = [
249 + "Andrew Gaffney <agaffney@g.o>",
250 + "Anthony G. Basile <blueness@g.o>",
251 + "Ben Kohler <bkohler@×××××.com>",
252 + "Brian Dolbec <dolsen@g.o>",
253 + "Chris Gianelloni <wolf31o2@g.o>",
254 + "Daniel Ostrow <dostrow@g.o>",
255 + "David Bryson <mutex@g.o>",
256 + "Diego Pettenò <flameeyes@g.o>",
257 + "Douglas Freed <dwfreed@×××.edu>",
258 + "Dylan Baker <baker.dylan.c@×××××.com>",
259 + "Eric Edgar <rocket@g.o>",
260 + "Gustavo Zacarias <gustavoz@g.o>",
261 + "Guy Martin <gmsoft@g.o>",
262 + "Jeremy Olexa <darkside@g.o>",
263 + "Jorge Manuel B. S. Vicetto <jmbsvicetto@g.o>",
264 + "Joshua Kinard <kumba@g.o>",
265 + "Kevin Zhao <kevin.zhaoshuai@×××××.com>",
266 + "Lars Weiler <pylon@g.o>",
267 + "Matsuu Takuto <matsuu@g.o>",
268 + "Matt Turner <mattst88@g.o>",
269 + "Mike Frysinger <vapier@g.o>",
270 + "Raúl Porcel <armin76@g.o>",
271 + "Rick Farina <zerochaos@g.o>",
272 + "Robert Paskowitz <r2d2@g.o>",
273 + "Rob Holland <tigger@g.o>",
274 + "Robin H. Johnson <robbat2@g.o>",
275 + "Sebastian Pipping <sebastian@×××××××.org>",
276 + "Stuart Longland <redhatter@g.o>",
277 + "William Hubbs <w.d.hubbs@×××××.com>",
278 + "W. Trevor King <wking@×××××××.us>",
279 + "Yuta SATOH <nigoro.dev@×××××.com>",
280 +]
281 +maintainers = [
282 + "Catalyst maintainers <catalyst@g.o>",
283 + "Catalyst mailing list <gentoo-catalyst@l.g.o>",
284 +]
285 +license = "GPL-2.0-or-later"
286 +readme = "README"
287 +python = "^3.8"
288 +homepage = "https://wiki.gentoo.org/wiki/Project:Catalyst"
289 +repository = "https://gitweb.gentoo.org/proj/catalyst.git/"
290 +documentation = "https://wiki.gentoo.org/wiki/Catalyst"
291 +
292 +keywords = ["gentoo"]
293 +
294 +classifiers = [
295 + 'Development Status :: 5 - Production/Stable',
296 + 'License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)',
297 + 'Intended Audience :: System Administrators',
298 + 'Operating System :: POSIX',
299 + 'Topic :: System :: Archiving :: Packaging',
300 + 'Topic :: System :: Installation/Setup',
301 + 'Topic :: System :: Software Distribution',
302 + 'Programming Language :: Python :: 3',
303 + 'Programming Language :: Python :: 3.8',
304 +]
305 +
306 +# Requirements
307 +[dependencies]
308 +
309 +[dev-dependencies]
310 +
311 +[scripts]
312 +
313 +[build-system]
314 +requires = [
315 + "setuptools >= 42",
316 + "setuptools_scm[toml] >= 3.4",
317 +]
318 +build-backend = "setuptools.build_meta"
319 +
320 +[tool.setuptools_scm]
321 +write_to = "catalyst/version.py"
322
323 diff --git a/setup.py b/setup.py
324 index 7a97b30c..8262cd90 100755
325 --- a/setup.py
326 +++ b/setup.py
327 @@ -1,119 +1,18 @@
328 #!/usr/bin/env python
329 -"""Catalyst is a release building tool used by Gentoo Linux"""
330
331 -import codecs as _codecs
332 -from distutils.core import setup as _setup, Command as _Command
333 -from email.utils import parseaddr as _parseaddr
334 -import os as _os
335 +from glob import glob
336
337 -from catalyst import __version__, __maintainer__
338 -from catalyst.version import set_release_version as _set_release_version
339 -from catalyst.version import get_version as _get_version
340 +from ppsetuptools import setup
341
342 +data_files = [
343 + ('/etc/catalyst', ['etc/catalyst.conf', 'etc/catalystrc']),
344 + ('/usr/share/man/man1', ['files/catalyst.1']),
345 + ('/usr/share/man/man5',
346 + ['files/catalyst-config.5', 'files/catalyst-spec.5']
347 + ),
348 + ('share/catalyst/arch', glob('arch/*')),
349 + ('share/catalyst/livecd', glob('livecd/**', recursive=True)),
350 + ('share/catalyst/targets', glob('targets/**', recursive=True)),
351 +]
352
353 -_this_dir = _os.path.dirname(__file__)
354 -_package_name = 'catalyst'
355 -_maintainer_name, _maintainer_email = _parseaddr(__maintainer__)
356 -
357 -
358 -def _posix_path(path):
359 - """Convert a native path to a POSIX path
360 -
361 - Distutils wants all paths to be written in the Unix convention
362 - (i.e. slash-separated) [1], so that's what we'll do here.
363 -
364 - [1]: https://docs.python.org/2/distutils/setupscript.html
365 - """
366 - if _os.path.sep != '/':
367 - return path.replace(_os.path.sep, '/')
368 - return path
369 -
370 -
371 -def _files(prefix, root):
372 - """Iterate through all the file paths under `root`
373 -
374 - Yielding `(target_dir, (file_source_paths, ...))` tuples.
375 - """
376 - for dirpath, _dirnames, filenames in _os.walk(root):
377 - reldir = _os.path.relpath(dirpath, root)
378 - install_directory = _posix_path(
379 - _os.path.join(prefix, reldir))
380 - file_source_paths = [
381 - _posix_path(_os.path.join(dirpath, filename))
382 - for filename in filenames]
383 - yield (install_directory, file_source_paths)
384 -
385 -
386 -_data_files = [('/etc/catalyst', ['etc/catalyst.conf', 'etc/catalystrc']),
387 - ('/usr/share/man/man1', ['files/catalyst.1']),
388 - ('/usr/share/man/man5',
389 - ['files/catalyst-config.5', 'files/catalyst-spec.5'])
390 - ]
391 -_data_files.extend(_files('share/catalyst/arch', 'arch'))
392 -_data_files.extend(_files('share/catalyst/livecd', 'livecd'))
393 -_data_files.extend(_files('share/catalyst/targets', 'targets'))
394 -
395 -
396 -class set_version(_Command):
397 - '''Saves the specified release version information
398 - '''
399 - description = "hardcode script's version using VERSION from environment"
400 - user_options = [] # [(long_name, short_name, desc),]
401 -
402 - def initialize_options(self):
403 - pass
404 -
405 - def finalize_options(self):
406 - pass
407 -
408 - def run(self):
409 - # pylint: disable=global-statement
410 - global __version__
411 - try:
412 - version = _os.environ['VERSION']
413 - except KeyError:
414 - print("Try setting 'VERSION=x.y.z' on the command line... Aborting")
415 - return
416 - _set_release_version(version)
417 - __version__ = _get_version()
418 - print("Version set to:\n", __version__)
419 -
420 -
421 -_setup(
422 - name=_package_name,
423 - version=__version__,
424 - maintainer=_maintainer_name,
425 - maintainer_email=_maintainer_email,
426 - url='https://wiki.gentoo.org/wiki/Catalyst',
427 - download_url='http://distfiles.gentoo.org/distfiles/{0}-{1}.tar.bz2'.format(
428 - _package_name, __version__),
429 - license='GNU General Public License (GPL)',
430 - platforms=['all'],
431 - description=__doc__,
432 - long_description=_codecs.open(
433 - _os.path.join(_this_dir, 'README'), 'r', 'utf-8').read(),
434 - classifiers=[
435 - 'Development Status :: 5 - Production/Stable',
436 - 'License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)',
437 - 'Intended Audience :: System Administrators',
438 - 'Operating System :: POSIX',
439 - 'Topic :: System :: Archiving :: Packaging',
440 - 'Topic :: System :: Installation/Setup',
441 - 'Topic :: System :: Software Distribution',
442 - 'Programming Language :: Python :: 3',
443 - 'Programming Language :: Python :: 3.6',
444 - 'Programming Language :: Python :: 3.7',
445 - 'Programming Language :: Python :: 3.8',
446 - ],
447 - scripts=['bin/{0}'.format(_package_name)],
448 - packages=[
449 - _package_name,
450 - '{0}.base'.format(_package_name),
451 - '{0}.targets'.format(_package_name),
452 - ],
453 - data_files=_data_files,
454 - provides=[_package_name],
455 - cmdclass={
456 - 'set_version': set_version
457 - },
458 -)
459 +setup(data_files=data_files)