From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 7F1F1138359 for ; Thu, 29 Oct 2020 22:09:08 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id C9E9CE091F; Thu, 29 Oct 2020 22:09:07 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 9C1C9E091F for ; Thu, 29 Oct 2020 22:09:07 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 72500340D85 for ; Thu, 29 Oct 2020 22:09:06 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 8B4362CA for ; Thu, 29 Oct 2020 22:09:04 +0000 (UTC) From: "Matt Turner" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Matt Turner" Message-ID: <1604009337.79422a5256927c8121cfa296132d8a6dcee4b8e6.mattst88@gentoo> Subject: [gentoo-commits] proj/catalyst:wip/mattst88 commit in: catalyst/, / X-VCS-Repository: proj/catalyst X-VCS-Files: .gitattributes .gitignore AUTHORS MANIFEST.in catalyst/__init__.py catalyst/main.py catalyst/version.py pyproject.toml setup.py X-VCS-Directories: / catalyst/ X-VCS-Committer: mattst88 X-VCS-Committer-Name: Matt Turner X-VCS-Revision: 79422a5256927c8121cfa296132d8a6dcee4b8e6 X-VCS-Branch: wip/mattst88 Date: Thu, 29 Oct 2020 22:09:04 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 05c793ce-c277-48f7-8d34-a3b7cef614d5 X-Archives-Hash: ef96b4622bc43d96b20d4ddc3c1b1227 commit: 79422a5256927c8121cfa296132d8a6dcee4b8e6 Author: Matt Turner gentoo org> AuthorDate: Fri Oct 9 03:47:22 2020 +0000 Commit: Matt Turner gentoo org> CommitDate: Thu Oct 29 22:08:57 2020 +0000 URL: https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=79422a52 catalyst: Use pyproject.toml See PEPs 517, 518, and (Draft) 621. Signed-off-by: Matt Turner gentoo.org> .gitattributes | 1 - .gitignore | 2 +- AUTHORS | 54 ---------------------- MANIFEST.in | 6 --- catalyst/__init__.py | 10 +--- catalyst/main.py | 4 +- catalyst/version.py | 65 -------------------------- pyproject.toml | 77 +++++++++++++++++++++++++++++++ setup.py | 127 ++++++--------------------------------------------- 9 files changed, 93 insertions(+), 253 deletions(-) diff --git a/.gitattributes b/.gitattributes index 19ad929b..0b2b43fc 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,4 +1,3 @@ -AUTHORS ident ChangeLog ident README ident TODO ident diff --git a/.gitignore b/.gitignore index 649b79ab..8979e259 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ *.py[co] +/catalyst/version.py /build/ /dist/ /files/ -/MANIFEST diff --git a/AUTHORS b/AUTHORS deleted file mode 100644 index 41366b8c..00000000 --- a/AUTHORS +++ /dev/null @@ -1,54 +0,0 @@ -The copyright for catalyst is held by the Gentoo Foundation and by each -of the individual contributors. - - -Original Authors: ------------------ -John Davis -Daniel Robbins - - -Significant contributors (including the first catalyst3 rewrite): ------------------------------------------------------------------ -Andrew Gaffney -Chris Gianelloni - - -Contributors: -------------- -Eric Edgar -Andrew Gaffney -Chris Gianelloni -David Bryson -Mike Frysinger -Rob Holland -Robin H. Johnson -Joshua Kinard -Stuart Longland -Guy Martin -Daniel Ostrow -Robert Paskowitz -Diego Pettenò -Matsuu Takuto -Lars Weiler -Gustavo Zacarias -Raúl Porcel -Jorge Manuel B. S. Vicetto -W. Trevor King -Matt Turner -Anthony G. Basile -Ben Kohler -Brian Dolbec -Douglas Freed -Dylan Baker -Jeremy Olexa -Kevin Zhao -Rick Farina (Zero_Chaos) -Sebastian Pipping -Yuta SATOH -William Hubbs - -Maintainers: ------------- -Catalyst maintainers -Release Engineering diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 4274094a..00000000 --- a/MANIFEST.in +++ /dev/null @@ -1,6 +0,0 @@ -include AUTHORS -include ChangeLog -include COPYING -include Makefile -recursive-include doc *.conf *.py HOWTO.txt catalyst*.txt -recursive-include examples README *.example *.spec diff --git a/catalyst/__init__.py b/catalyst/__init__.py index 143bdf81..13a72c07 100644 --- a/catalyst/__init__.py +++ b/catalyst/__init__.py @@ -1,10 +1,2 @@ -"Catalyst is the release building tool used by Gentoo Linux" -__maintainer__ = 'Catalyst ' - -try: - from .verinfo import version as fullversion - __version__ = fullversion.split('\n')[0].split()[1] -except ImportError: - from .version import get_version, __version__ - fullversion = get_version(reset=True) +from .version import version as __version__ diff --git a/catalyst/main.py b/catalyst/main.py index 543895c6..ab5c2a01 100644 --- a/catalyst/main.py +++ b/catalyst/main.py @@ -18,13 +18,11 @@ import catalyst.config from catalyst.defaults import (confdefaults, option_messages, DEFAULT_CONFIG_FILE, valid_config_file_values) from catalyst.support import CatalystError -from catalyst.version import get_version conf_values = confdefaults def version(): - log.info(get_version()) log.info('Copyright 2003-%s Gentoo Foundation', datetime.datetime.now().year) log.info('Copyright 2008-2012 various authors') @@ -118,7 +116,7 @@ def get_parser(): epilog=epilog, formatter_class=argparse.RawDescriptionHelpFormatter) parser.add_argument('-V', '--version', - action='version', version=get_version(), + action='version', version=catalyst.__version__, help='display version information') group = parser.add_argument_group('Program output options') diff --git a/catalyst/version.py b/catalyst/version.py deleted file mode 100644 index dbada51a..00000000 --- a/catalyst/version.py +++ /dev/null @@ -1,65 +0,0 @@ -'''Version information and/or git version information -''' - -import os - -from snakeoil.version import get_git_version as get_ver - -__version__ = "3.0.7" -_ver = None - - -def get_git_version(version=__version__): - """Return: a string describing our version.""" - # pylint: disable=global-statement - global _ver - cwd = os.path.dirname(os.path.abspath(__file__)) - version_info = get_ver(cwd) - - if not version_info: - s = "extended version info unavailable" - elif version_info['tag'] == __version__: - s = 'released %s' % (version_info['date'],) - else: - s = ('vcs version %s, date %s' % - (version_info['rev'], version_info['date'])) - - _ver = 'Catalyst %s\n%s' % (version, s) - - return _ver - - -def get_version(reset=False): - '''Returns a saved release version string or the - generated git release version. - ''' - # pylint: disable=global-statement - global __version__, _ver - if _ver and not reset: - return _ver - try: # getting the fixed version - from .verinfo import version - _ver = version - __version__ = version.split('\n')[0].split()[1] - except ImportError: # get the live version - version = get_git_version() - return version - - -def set_release_version(version, root=None): - '''Saves the release version along with the - git log release information - - @param version: string - @param root: string, optional alternate root path to save to - ''' - #global __version__ - filename = "verinfo.py" - if not root: - path = os.path.join(os.path.dirname(__file__), filename) - else: - path = os.path.join(root, filename) - #__version__ = version - ver = get_git_version(version) - with open(path, 'w') as f: - f.write("version = {0!r}".format(ver)) diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..e6a14f35 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,77 @@ +[project] +name = "catalyst" +description = "Tool for creating releases based on Gentoo Linux" +authors = [ + "Andrew Gaffney ", + "Anthony G. Basile ", + "Ben Kohler ", + "Brian Dolbec ", + "Chris Gianelloni ", + "Daniel Ostrow ", + "David Bryson ", + "Diego Pettenò ", + "Douglas Freed ", + "Dylan Baker ", + "Eric Edgar ", + "Gustavo Zacarias ", + "Guy Martin ", + "Jeremy Olexa ", + "Jorge Manuel B. S. Vicetto ", + "Joshua Kinard ", + "Kevin Zhao ", + "Lars Weiler ", + "Matsuu Takuto ", + "Matt Turner ", + "Mike Frysinger ", + "Raúl Porcel ", + "Rick Farina ", + "Robert Paskowitz ", + "Rob Holland ", + "Robin H. Johnson ", + "Sebastian Pipping ", + "Stuart Longland ", + "William Hubbs ", + "W. Trevor King ", + "Yuta SATOH ", +] +maintainers = [ + "Catalyst maintainers ", + "Catalyst mailing list ", +] +license = "GPL-2.0-or-later" +readme = "README" +python = "^3.8" +homepage = "https://wiki.gentoo.org/wiki/Project:Catalyst" +repository = "https://gitweb.gentoo.org/proj/catalyst.git/" +documentation = "https://wiki.gentoo.org/wiki/Catalyst" + +keywords = ["gentoo"] + +classifiers = [ + 'Development Status :: 5 - Production/Stable', + 'License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)', + 'Intended Audience :: System Administrators', + 'Operating System :: POSIX', + 'Topic :: System :: Archiving :: Packaging', + 'Topic :: System :: Installation/Setup', + 'Topic :: System :: Software Distribution', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.8', +] + +# Requirements +[dependencies] + +[dev-dependencies] + +[scripts] + +[build-system] +requires = [ + "setuptools >= 42", + "setuptools_scm[toml] >= 3.4", +] +build-backend = "setuptools.build_meta" + +[tool.setuptools_scm] +write_to = "catalyst/version.py" diff --git a/setup.py b/setup.py index 7a97b30c..d807ea02 100755 --- a/setup.py +++ b/setup.py @@ -1,119 +1,18 @@ #!/usr/bin/env python -"""Catalyst is a release building tool used by Gentoo Linux""" -import codecs as _codecs -from distutils.core import setup as _setup, Command as _Command -from email.utils import parseaddr as _parseaddr -import os as _os +from glob import glob -from catalyst import __version__, __maintainer__ -from catalyst.version import set_release_version as _set_release_version -from catalyst.version import get_version as _get_version +from ppsetuptools import setup +data_files = [ + ('/etc/catalyst', ['etc/catalyst.conf', 'etc/catalystrc']), + ('/usr/share/man/man1', ['files/catalyst.1']), + ('/usr/share/man/man5', + ['files/catalyst-config.5', 'files/catalyst-spec.5'] + ), + ('share/catalyst/arch', glob('arch/*')), + ('share/catalyst/livecd', glob('livecd/**/*', recursive=True)), + ('share/catalyst/targets', glob('targets/**', recursive=True)), +] -_this_dir = _os.path.dirname(__file__) -_package_name = 'catalyst' -_maintainer_name, _maintainer_email = _parseaddr(__maintainer__) - - -def _posix_path(path): - """Convert a native path to a POSIX path - - Distutils wants all paths to be written in the Unix convention - (i.e. slash-separated) [1], so that's what we'll do here. - - [1]: https://docs.python.org/2/distutils/setupscript.html - """ - if _os.path.sep != '/': - return path.replace(_os.path.sep, '/') - return path - - -def _files(prefix, root): - """Iterate through all the file paths under `root` - - Yielding `(target_dir, (file_source_paths, ...))` tuples. - """ - for dirpath, _dirnames, filenames in _os.walk(root): - reldir = _os.path.relpath(dirpath, root) - install_directory = _posix_path( - _os.path.join(prefix, reldir)) - file_source_paths = [ - _posix_path(_os.path.join(dirpath, filename)) - for filename in filenames] - yield (install_directory, file_source_paths) - - -_data_files = [('/etc/catalyst', ['etc/catalyst.conf', 'etc/catalystrc']), - ('/usr/share/man/man1', ['files/catalyst.1']), - ('/usr/share/man/man5', - ['files/catalyst-config.5', 'files/catalyst-spec.5']) - ] -_data_files.extend(_files('share/catalyst/arch', 'arch')) -_data_files.extend(_files('share/catalyst/livecd', 'livecd')) -_data_files.extend(_files('share/catalyst/targets', 'targets')) - - -class set_version(_Command): - '''Saves the specified release version information - ''' - description = "hardcode script's version using VERSION from environment" - user_options = [] # [(long_name, short_name, desc),] - - def initialize_options(self): - pass - - def finalize_options(self): - pass - - def run(self): - # pylint: disable=global-statement - global __version__ - try: - version = _os.environ['VERSION'] - except KeyError: - print("Try setting 'VERSION=x.y.z' on the command line... Aborting") - return - _set_release_version(version) - __version__ = _get_version() - print("Version set to:\n", __version__) - - -_setup( - name=_package_name, - version=__version__, - maintainer=_maintainer_name, - maintainer_email=_maintainer_email, - url='https://wiki.gentoo.org/wiki/Catalyst', - download_url='http://distfiles.gentoo.org/distfiles/{0}-{1}.tar.bz2'.format( - _package_name, __version__), - license='GNU General Public License (GPL)', - platforms=['all'], - description=__doc__, - long_description=_codecs.open( - _os.path.join(_this_dir, 'README'), 'r', 'utf-8').read(), - classifiers=[ - 'Development Status :: 5 - Production/Stable', - 'License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)', - 'Intended Audience :: System Administrators', - 'Operating System :: POSIX', - 'Topic :: System :: Archiving :: Packaging', - 'Topic :: System :: Installation/Setup', - 'Topic :: System :: Software Distribution', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', - ], - scripts=['bin/{0}'.format(_package_name)], - packages=[ - _package_name, - '{0}.base'.format(_package_name), - '{0}.targets'.format(_package_name), - ], - data_files=_data_files, - provides=[_package_name], - cmdclass={ - 'set_version': set_version - }, -) +setup(data_files=data_files)