1 |
commit: 89debce72a0620a8f562207a7e108a2fa9b29d20 |
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 20:58:49 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=89debce7 |
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 | 118 +-------------------------------------------------- |
23 |
9 files changed, 82 insertions(+), 255 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..74572fcc 100755 |
325 |
--- a/setup.py |
326 |
+++ b/setup.py |
327 |
@@ -1,119 +1,5 @@ |
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 ppsetuptools import setup |
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 |
- |
341 |
- |
342 |
-_this_dir = _os.path.dirname(__file__) |
343 |
-_package_name = 'catalyst' |
344 |
-_maintainer_name, _maintainer_email = _parseaddr(__maintainer__) |
345 |
- |
346 |
- |
347 |
-def _posix_path(path): |
348 |
- """Convert a native path to a POSIX path |
349 |
- |
350 |
- Distutils wants all paths to be written in the Unix convention |
351 |
- (i.e. slash-separated) [1], so that's what we'll do here. |
352 |
- |
353 |
- [1]: https://docs.python.org/2/distutils/setupscript.html |
354 |
- """ |
355 |
- if _os.path.sep != '/': |
356 |
- return path.replace(_os.path.sep, '/') |
357 |
- return path |
358 |
- |
359 |
- |
360 |
-def _files(prefix, root): |
361 |
- """Iterate through all the file paths under `root` |
362 |
- |
363 |
- Yielding `(target_dir, (file_source_paths, ...))` tuples. |
364 |
- """ |
365 |
- for dirpath, _dirnames, filenames in _os.walk(root): |
366 |
- reldir = _os.path.relpath(dirpath, root) |
367 |
- install_directory = _posix_path( |
368 |
- _os.path.join(prefix, reldir)) |
369 |
- file_source_paths = [ |
370 |
- _posix_path(_os.path.join(dirpath, filename)) |
371 |
- for filename in filenames] |
372 |
- yield (install_directory, file_source_paths) |
373 |
- |
374 |
- |
375 |
-_data_files = [('/etc/catalyst', ['etc/catalyst.conf', 'etc/catalystrc']), |
376 |
- ('/usr/share/man/man1', ['files/catalyst.1']), |
377 |
- ('/usr/share/man/man5', |
378 |
- ['files/catalyst-config.5', 'files/catalyst-spec.5']) |
379 |
- ] |
380 |
-_data_files.extend(_files('share/catalyst/arch', 'arch')) |
381 |
-_data_files.extend(_files('share/catalyst/livecd', 'livecd')) |
382 |
-_data_files.extend(_files('share/catalyst/targets', 'targets')) |
383 |
- |
384 |
- |
385 |
-class set_version(_Command): |
386 |
- '''Saves the specified release version information |
387 |
- ''' |
388 |
- description = "hardcode script's version using VERSION from environment" |
389 |
- user_options = [] # [(long_name, short_name, desc),] |
390 |
- |
391 |
- def initialize_options(self): |
392 |
- pass |
393 |
- |
394 |
- def finalize_options(self): |
395 |
- pass |
396 |
- |
397 |
- def run(self): |
398 |
- # pylint: disable=global-statement |
399 |
- global __version__ |
400 |
- try: |
401 |
- version = _os.environ['VERSION'] |
402 |
- except KeyError: |
403 |
- print("Try setting 'VERSION=x.y.z' on the command line... Aborting") |
404 |
- return |
405 |
- _set_release_version(version) |
406 |
- __version__ = _get_version() |
407 |
- print("Version set to:\n", __version__) |
408 |
- |
409 |
- |
410 |
-_setup( |
411 |
- name=_package_name, |
412 |
- version=__version__, |
413 |
- maintainer=_maintainer_name, |
414 |
- maintainer_email=_maintainer_email, |
415 |
- url='https://wiki.gentoo.org/wiki/Catalyst', |
416 |
- download_url='http://distfiles.gentoo.org/distfiles/{0}-{1}.tar.bz2'.format( |
417 |
- _package_name, __version__), |
418 |
- license='GNU General Public License (GPL)', |
419 |
- platforms=['all'], |
420 |
- description=__doc__, |
421 |
- long_description=_codecs.open( |
422 |
- _os.path.join(_this_dir, 'README'), 'r', 'utf-8').read(), |
423 |
- classifiers=[ |
424 |
- 'Development Status :: 5 - Production/Stable', |
425 |
- 'License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)', |
426 |
- 'Intended Audience :: System Administrators', |
427 |
- 'Operating System :: POSIX', |
428 |
- 'Topic :: System :: Archiving :: Packaging', |
429 |
- 'Topic :: System :: Installation/Setup', |
430 |
- 'Topic :: System :: Software Distribution', |
431 |
- 'Programming Language :: Python :: 3', |
432 |
- 'Programming Language :: Python :: 3.6', |
433 |
- 'Programming Language :: Python :: 3.7', |
434 |
- 'Programming Language :: Python :: 3.8', |
435 |
- ], |
436 |
- scripts=['bin/{0}'.format(_package_name)], |
437 |
- packages=[ |
438 |
- _package_name, |
439 |
- '{0}.base'.format(_package_name), |
440 |
- '{0}.targets'.format(_package_name), |
441 |
- ], |
442 |
- data_files=_data_files, |
443 |
- provides=[_package_name], |
444 |
- cmdclass={ |
445 |
- 'set_version': set_version |
446 |
- }, |
447 |
-) |
448 |
+setup() |