public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/catalyst:wip/mattst88 commit in: catalyst/, /
@ 2020-10-29 21:00 Matt Turner
  0 siblings, 0 replies; 4+ messages in thread
From: Matt Turner @ 2020-10-29 21:00 UTC (permalink / raw
  To: gentoo-commits

commit:     89debce72a0620a8f562207a7e108a2fa9b29d20
Author:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Fri Oct  9 03:47:22 2020 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Thu Oct 29 20:58:49 2020 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=89debce7

catalyst: Use pyproject.toml

See PEPs 517, 518, and (Draft) 621.

Signed-off-by: Matt Turner <mattst88 <AT> 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             | 118 +--------------------------------------------------
 9 files changed, 82 insertions(+), 255 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 <zhen@gentoo.org>
-Daniel Robbins <drobbins@gentoo.org>
-
-
-Significant contributors (including the first catalyst3 rewrite):
------------------------------------------------------------------
-Andrew Gaffney <agaffney@gentoo.org>
-Chris Gianelloni <wolf31o2@wolf31o2.org>
-
-
-Contributors:
--------------
-Eric Edgar <rocket@gentoo.org>
-Andrew Gaffney <agaffney@gentoo.org>
-Chris Gianelloni <wolf31o2@gentoo.org>
-David Bryson <mutex@gentoo.org>
-Mike Frysinger <vapier@gentoo.org>
-Rob Holland <tigger@gentoo.org>
-Robin H. Johnson <robbat2@gentoo.org>
-Joshua Kinard <kumba@gentoo.org>
-Stuart Longland <redhatter@gentoo.org>
-Guy Martin <gmsoft@gentoo.org>
-Daniel Ostrow <dostrow@gentoo.org>
-Robert Paskowitz <r2d2@gentoo.org>
-Diego Pettenò <flameeyes@gentoo.org>
-Matsuu Takuto <matsuu@gentoo.org>
-Lars Weiler <pylon@gentoo.org>
-Gustavo Zacarias <gustavoz@gentoo.org>
-Raúl Porcel <armin76@gentoo.org>
-Jorge Manuel B. S. Vicetto <jmbsvicetto@gentoo.org>
-W. Trevor King <wking@tremily.us>
-Matt Turner <mattst88@gmail.com>
-Anthony G. Basile <blueness@gentoo.org>
-Ben Kohler <bkohler@gmail.com>
-Brian Dolbec <dolsen@gentoo.org>
-Douglas Freed <dwfreed@mtu.edu>
-Dylan Baker <baker.dylan.c@gmail.com>
-Jeremy Olexa <darkside@gentoo.org>
-Kevin Zhao <kevin.zhaoshuai@gmail.com>
-Rick Farina (Zero_Chaos) <zerochaos@gentoo.org>
-Sebastian Pipping <sebastian@pipping.org>
-Yuta SATOH <nigoro.dev@gmail.com>
-William Hubbs <w.d.hubbs@gmail.com>
-
-Maintainers:
-------------
-Catalyst maintainers <catalyst@gentoo.org>
-Release Engineering <releng@gentoo.org>

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 <catalyst@gentoo.org>'
-
-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 <agaffney@gentoo.org>",
+    "Anthony G. Basile <blueness@gentoo.org>",
+    "Ben Kohler <bkohler@gmail.com>",
+    "Brian Dolbec <dolsen@gentoo.org>",
+    "Chris Gianelloni <wolf31o2@gentoo.org>",
+    "Daniel Ostrow <dostrow@gentoo.org>",
+    "David Bryson <mutex@gentoo.org>",
+    "Diego Pettenò <flameeyes@gentoo.org>",
+    "Douglas Freed <dwfreed@mtu.edu>",
+    "Dylan Baker <baker.dylan.c@gmail.com>",
+    "Eric Edgar <rocket@gentoo.org>",
+    "Gustavo Zacarias <gustavoz@gentoo.org>",
+    "Guy Martin <gmsoft@gentoo.org>",
+    "Jeremy Olexa <darkside@gentoo.org>",
+    "Jorge Manuel B. S. Vicetto <jmbsvicetto@gentoo.org>",
+    "Joshua Kinard <kumba@gentoo.org>",
+    "Kevin Zhao <kevin.zhaoshuai@gmail.com>",
+    "Lars Weiler <pylon@gentoo.org>",
+    "Matsuu Takuto <matsuu@gentoo.org>",
+    "Matt Turner <mattst88@gentoo.org>",
+    "Mike Frysinger <vapier@gentoo.org>",
+    "Raúl Porcel <armin76@gentoo.org>",
+    "Rick Farina <zerochaos@gentoo.org>",
+    "Robert Paskowitz <r2d2@gentoo.org>",
+    "Rob Holland <tigger@gentoo.org>",
+    "Robin H. Johnson <robbat2@gentoo.org>",
+    "Sebastian Pipping <sebastian@pipping.org>",
+    "Stuart Longland <redhatter@gentoo.org>",
+    "William Hubbs <w.d.hubbs@gmail.com>",
+    "W. Trevor King <wking@tremily.us>",
+    "Yuta SATOH <nigoro.dev@gmail.com>",
+]
+maintainers = [
+    "Catalyst maintainers <catalyst@gentoo.org>",
+    "Catalyst mailing list <gentoo-catalyst@lists.gentoo.org>",
+]
+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..74572fcc 100755
--- a/setup.py
+++ b/setup.py
@@ -1,119 +1,5 @@
 #!/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 ppsetuptools import setup
 
-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
-
-
-_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()


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [gentoo-commits] proj/catalyst:wip/mattst88 commit in: catalyst/, /
@ 2020-10-29 21:30 Matt Turner
  0 siblings, 0 replies; 4+ messages in thread
From: Matt Turner @ 2020-10-29 21:30 UTC (permalink / raw
  To: gentoo-commits

commit:     f83caf98cbd6e02bd1b8d1f21cd9f8803dd46fb4
Author:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Fri Oct  9 03:47:22 2020 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Thu Oct 29 21:30:31 2020 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=f83caf98

catalyst: Use pyproject.toml

See PEPs 517, 518, and (Draft) 621.

Signed-off-by: Matt Turner <mattst88 <AT> 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             | 93 +++++-----------------------------------------------
 9 files changed, 89 insertions(+), 223 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 <zhen@gentoo.org>
-Daniel Robbins <drobbins@gentoo.org>
-
-
-Significant contributors (including the first catalyst3 rewrite):
------------------------------------------------------------------
-Andrew Gaffney <agaffney@gentoo.org>
-Chris Gianelloni <wolf31o2@wolf31o2.org>
-
-
-Contributors:
--------------
-Eric Edgar <rocket@gentoo.org>
-Andrew Gaffney <agaffney@gentoo.org>
-Chris Gianelloni <wolf31o2@gentoo.org>
-David Bryson <mutex@gentoo.org>
-Mike Frysinger <vapier@gentoo.org>
-Rob Holland <tigger@gentoo.org>
-Robin H. Johnson <robbat2@gentoo.org>
-Joshua Kinard <kumba@gentoo.org>
-Stuart Longland <redhatter@gentoo.org>
-Guy Martin <gmsoft@gentoo.org>
-Daniel Ostrow <dostrow@gentoo.org>
-Robert Paskowitz <r2d2@gentoo.org>
-Diego Pettenò <flameeyes@gentoo.org>
-Matsuu Takuto <matsuu@gentoo.org>
-Lars Weiler <pylon@gentoo.org>
-Gustavo Zacarias <gustavoz@gentoo.org>
-Raúl Porcel <armin76@gentoo.org>
-Jorge Manuel B. S. Vicetto <jmbsvicetto@gentoo.org>
-W. Trevor King <wking@tremily.us>
-Matt Turner <mattst88@gmail.com>
-Anthony G. Basile <blueness@gentoo.org>
-Ben Kohler <bkohler@gmail.com>
-Brian Dolbec <dolsen@gentoo.org>
-Douglas Freed <dwfreed@mtu.edu>
-Dylan Baker <baker.dylan.c@gmail.com>
-Jeremy Olexa <darkside@gentoo.org>
-Kevin Zhao <kevin.zhaoshuai@gmail.com>
-Rick Farina (Zero_Chaos) <zerochaos@gentoo.org>
-Sebastian Pipping <sebastian@pipping.org>
-Yuta SATOH <nigoro.dev@gmail.com>
-William Hubbs <w.d.hubbs@gmail.com>
-
-Maintainers:
-------------
-Catalyst maintainers <catalyst@gentoo.org>
-Release Engineering <releng@gentoo.org>

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 <catalyst@gentoo.org>'
-
-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 <agaffney@gentoo.org>",
+    "Anthony G. Basile <blueness@gentoo.org>",
+    "Ben Kohler <bkohler@gmail.com>",
+    "Brian Dolbec <dolsen@gentoo.org>",
+    "Chris Gianelloni <wolf31o2@gentoo.org>",
+    "Daniel Ostrow <dostrow@gentoo.org>",
+    "David Bryson <mutex@gentoo.org>",
+    "Diego Pettenò <flameeyes@gentoo.org>",
+    "Douglas Freed <dwfreed@mtu.edu>",
+    "Dylan Baker <baker.dylan.c@gmail.com>",
+    "Eric Edgar <rocket@gentoo.org>",
+    "Gustavo Zacarias <gustavoz@gentoo.org>",
+    "Guy Martin <gmsoft@gentoo.org>",
+    "Jeremy Olexa <darkside@gentoo.org>",
+    "Jorge Manuel B. S. Vicetto <jmbsvicetto@gentoo.org>",
+    "Joshua Kinard <kumba@gentoo.org>",
+    "Kevin Zhao <kevin.zhaoshuai@gmail.com>",
+    "Lars Weiler <pylon@gentoo.org>",
+    "Matsuu Takuto <matsuu@gentoo.org>",
+    "Matt Turner <mattst88@gentoo.org>",
+    "Mike Frysinger <vapier@gentoo.org>",
+    "Raúl Porcel <armin76@gentoo.org>",
+    "Rick Farina <zerochaos@gentoo.org>",
+    "Robert Paskowitz <r2d2@gentoo.org>",
+    "Rob Holland <tigger@gentoo.org>",
+    "Robin H. Johnson <robbat2@gentoo.org>",
+    "Sebastian Pipping <sebastian@pipping.org>",
+    "Stuart Longland <redhatter@gentoo.org>",
+    "William Hubbs <w.d.hubbs@gmail.com>",
+    "W. Trevor King <wking@tremily.us>",
+    "Yuta SATOH <nigoro.dev@gmail.com>",
+]
+maintainers = [
+    "Catalyst maintainers <catalyst@gentoo.org>",
+    "Catalyst mailing list <gentoo-catalyst@lists.gentoo.org>",
+]
+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..b5b534d4 100755
--- a/setup.py
+++ b/setup.py
@@ -1,20 +1,8 @@
 #!/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 catalyst import __version__, __maintainer__
-from catalyst.version import set_release_version as _set_release_version
-from catalyst.version import get_version as _get_version
-
-
-_this_dir = _os.path.dirname(__file__)
-_package_name = 'catalyst'
-_maintainer_name, _maintainer_email = _parseaddr(__maintainer__)
+import os
 
+from ppsetuptools import setup
 
 def _posix_path(path):
     """Convert a native path to a POSIX path
@@ -24,8 +12,8 @@ def _posix_path(path):
 
     [1]: https://docs.python.org/2/distutils/setupscript.html
     """
-    if _os.path.sep != '/':
-        return path.replace(_os.path.sep, '/')
+    if os.path.sep != '/':
+        return path.replace(os.path.sep, '/')
     return path
 
 
@@ -34,12 +22,12 @@ def _files(prefix, root):
 
     Yielding `(target_dir, (file_source_paths, ...))` tuples.
     """
-    for dirpath, _dirnames, filenames in _os.walk(root):
-        reldir = _os.path.relpath(dirpath, root)
+    for dirpath, _dirnames, filenames in os.walk(root):
+        reldir = os.path.relpath(dirpath, root)
         install_directory = _posix_path(
-            _os.path.join(prefix, reldir))
+            os.path.join(prefix, reldir))
         file_source_paths = [
-            _posix_path(_os.path.join(dirpath, filename))
+            _posix_path(os.path.join(dirpath, filename))
             for filename in filenames]
         yield (install_directory, file_source_paths)
 
@@ -53,67 +41,4 @@ _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)


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [gentoo-commits] proj/catalyst:wip/mattst88 commit in: catalyst/, /
@ 2020-10-29 21:52 Matt Turner
  0 siblings, 0 replies; 4+ messages in thread
From: Matt Turner @ 2020-10-29 21:52 UTC (permalink / raw
  To: gentoo-commits

commit:     f76d86530bd676051841aef7d1ee958b59812a76
Author:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Fri Oct  9 03:47:22 2020 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Thu Oct 29 21:51:55 2020 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=f76d8653

catalyst: Use pyproject.toml

See PEPs 517, 518, and (Draft) 621.

Signed-off-by: Matt Turner <mattst88 <AT> 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 <zhen@gentoo.org>
-Daniel Robbins <drobbins@gentoo.org>
-
-
-Significant contributors (including the first catalyst3 rewrite):
------------------------------------------------------------------
-Andrew Gaffney <agaffney@gentoo.org>
-Chris Gianelloni <wolf31o2@wolf31o2.org>
-
-
-Contributors:
--------------
-Eric Edgar <rocket@gentoo.org>
-Andrew Gaffney <agaffney@gentoo.org>
-Chris Gianelloni <wolf31o2@gentoo.org>
-David Bryson <mutex@gentoo.org>
-Mike Frysinger <vapier@gentoo.org>
-Rob Holland <tigger@gentoo.org>
-Robin H. Johnson <robbat2@gentoo.org>
-Joshua Kinard <kumba@gentoo.org>
-Stuart Longland <redhatter@gentoo.org>
-Guy Martin <gmsoft@gentoo.org>
-Daniel Ostrow <dostrow@gentoo.org>
-Robert Paskowitz <r2d2@gentoo.org>
-Diego Pettenò <flameeyes@gentoo.org>
-Matsuu Takuto <matsuu@gentoo.org>
-Lars Weiler <pylon@gentoo.org>
-Gustavo Zacarias <gustavoz@gentoo.org>
-Raúl Porcel <armin76@gentoo.org>
-Jorge Manuel B. S. Vicetto <jmbsvicetto@gentoo.org>
-W. Trevor King <wking@tremily.us>
-Matt Turner <mattst88@gmail.com>
-Anthony G. Basile <blueness@gentoo.org>
-Ben Kohler <bkohler@gmail.com>
-Brian Dolbec <dolsen@gentoo.org>
-Douglas Freed <dwfreed@mtu.edu>
-Dylan Baker <baker.dylan.c@gmail.com>
-Jeremy Olexa <darkside@gentoo.org>
-Kevin Zhao <kevin.zhaoshuai@gmail.com>
-Rick Farina (Zero_Chaos) <zerochaos@gentoo.org>
-Sebastian Pipping <sebastian@pipping.org>
-Yuta SATOH <nigoro.dev@gmail.com>
-William Hubbs <w.d.hubbs@gmail.com>
-
-Maintainers:
-------------
-Catalyst maintainers <catalyst@gentoo.org>
-Release Engineering <releng@gentoo.org>

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 <catalyst@gentoo.org>'
-
-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 <agaffney@gentoo.org>",
+    "Anthony G. Basile <blueness@gentoo.org>",
+    "Ben Kohler <bkohler@gmail.com>",
+    "Brian Dolbec <dolsen@gentoo.org>",
+    "Chris Gianelloni <wolf31o2@gentoo.org>",
+    "Daniel Ostrow <dostrow@gentoo.org>",
+    "David Bryson <mutex@gentoo.org>",
+    "Diego Pettenò <flameeyes@gentoo.org>",
+    "Douglas Freed <dwfreed@mtu.edu>",
+    "Dylan Baker <baker.dylan.c@gmail.com>",
+    "Eric Edgar <rocket@gentoo.org>",
+    "Gustavo Zacarias <gustavoz@gentoo.org>",
+    "Guy Martin <gmsoft@gentoo.org>",
+    "Jeremy Olexa <darkside@gentoo.org>",
+    "Jorge Manuel B. S. Vicetto <jmbsvicetto@gentoo.org>",
+    "Joshua Kinard <kumba@gentoo.org>",
+    "Kevin Zhao <kevin.zhaoshuai@gmail.com>",
+    "Lars Weiler <pylon@gentoo.org>",
+    "Matsuu Takuto <matsuu@gentoo.org>",
+    "Matt Turner <mattst88@gentoo.org>",
+    "Mike Frysinger <vapier@gentoo.org>",
+    "Raúl Porcel <armin76@gentoo.org>",
+    "Rick Farina <zerochaos@gentoo.org>",
+    "Robert Paskowitz <r2d2@gentoo.org>",
+    "Rob Holland <tigger@gentoo.org>",
+    "Robin H. Johnson <robbat2@gentoo.org>",
+    "Sebastian Pipping <sebastian@pipping.org>",
+    "Stuart Longland <redhatter@gentoo.org>",
+    "William Hubbs <w.d.hubbs@gmail.com>",
+    "W. Trevor King <wking@tremily.us>",
+    "Yuta SATOH <nigoro.dev@gmail.com>",
+]
+maintainers = [
+    "Catalyst maintainers <catalyst@gentoo.org>",
+    "Catalyst mailing list <gentoo-catalyst@lists.gentoo.org>",
+]
+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..8262cd90 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)


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [gentoo-commits] proj/catalyst:wip/mattst88 commit in: catalyst/, /
@ 2020-10-29 22:09 Matt Turner
  0 siblings, 0 replies; 4+ messages in thread
From: Matt Turner @ 2020-10-29 22:09 UTC (permalink / raw
  To: gentoo-commits

commit:     79422a5256927c8121cfa296132d8a6dcee4b8e6
Author:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Fri Oct  9 03:47:22 2020 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> 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 <mattst88 <AT> 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 <zhen@gentoo.org>
-Daniel Robbins <drobbins@gentoo.org>
-
-
-Significant contributors (including the first catalyst3 rewrite):
------------------------------------------------------------------
-Andrew Gaffney <agaffney@gentoo.org>
-Chris Gianelloni <wolf31o2@wolf31o2.org>
-
-
-Contributors:
--------------
-Eric Edgar <rocket@gentoo.org>
-Andrew Gaffney <agaffney@gentoo.org>
-Chris Gianelloni <wolf31o2@gentoo.org>
-David Bryson <mutex@gentoo.org>
-Mike Frysinger <vapier@gentoo.org>
-Rob Holland <tigger@gentoo.org>
-Robin H. Johnson <robbat2@gentoo.org>
-Joshua Kinard <kumba@gentoo.org>
-Stuart Longland <redhatter@gentoo.org>
-Guy Martin <gmsoft@gentoo.org>
-Daniel Ostrow <dostrow@gentoo.org>
-Robert Paskowitz <r2d2@gentoo.org>
-Diego Pettenò <flameeyes@gentoo.org>
-Matsuu Takuto <matsuu@gentoo.org>
-Lars Weiler <pylon@gentoo.org>
-Gustavo Zacarias <gustavoz@gentoo.org>
-Raúl Porcel <armin76@gentoo.org>
-Jorge Manuel B. S. Vicetto <jmbsvicetto@gentoo.org>
-W. Trevor King <wking@tremily.us>
-Matt Turner <mattst88@gmail.com>
-Anthony G. Basile <blueness@gentoo.org>
-Ben Kohler <bkohler@gmail.com>
-Brian Dolbec <dolsen@gentoo.org>
-Douglas Freed <dwfreed@mtu.edu>
-Dylan Baker <baker.dylan.c@gmail.com>
-Jeremy Olexa <darkside@gentoo.org>
-Kevin Zhao <kevin.zhaoshuai@gmail.com>
-Rick Farina (Zero_Chaos) <zerochaos@gentoo.org>
-Sebastian Pipping <sebastian@pipping.org>
-Yuta SATOH <nigoro.dev@gmail.com>
-William Hubbs <w.d.hubbs@gmail.com>
-
-Maintainers:
-------------
-Catalyst maintainers <catalyst@gentoo.org>
-Release Engineering <releng@gentoo.org>

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 <catalyst@gentoo.org>'
-
-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 <agaffney@gentoo.org>",
+    "Anthony G. Basile <blueness@gentoo.org>",
+    "Ben Kohler <bkohler@gmail.com>",
+    "Brian Dolbec <dolsen@gentoo.org>",
+    "Chris Gianelloni <wolf31o2@gentoo.org>",
+    "Daniel Ostrow <dostrow@gentoo.org>",
+    "David Bryson <mutex@gentoo.org>",
+    "Diego Pettenò <flameeyes@gentoo.org>",
+    "Douglas Freed <dwfreed@mtu.edu>",
+    "Dylan Baker <baker.dylan.c@gmail.com>",
+    "Eric Edgar <rocket@gentoo.org>",
+    "Gustavo Zacarias <gustavoz@gentoo.org>",
+    "Guy Martin <gmsoft@gentoo.org>",
+    "Jeremy Olexa <darkside@gentoo.org>",
+    "Jorge Manuel B. S. Vicetto <jmbsvicetto@gentoo.org>",
+    "Joshua Kinard <kumba@gentoo.org>",
+    "Kevin Zhao <kevin.zhaoshuai@gmail.com>",
+    "Lars Weiler <pylon@gentoo.org>",
+    "Matsuu Takuto <matsuu@gentoo.org>",
+    "Matt Turner <mattst88@gentoo.org>",
+    "Mike Frysinger <vapier@gentoo.org>",
+    "Raúl Porcel <armin76@gentoo.org>",
+    "Rick Farina <zerochaos@gentoo.org>",
+    "Robert Paskowitz <r2d2@gentoo.org>",
+    "Rob Holland <tigger@gentoo.org>",
+    "Robin H. Johnson <robbat2@gentoo.org>",
+    "Sebastian Pipping <sebastian@pipping.org>",
+    "Stuart Longland <redhatter@gentoo.org>",
+    "William Hubbs <w.d.hubbs@gmail.com>",
+    "W. Trevor King <wking@tremily.us>",
+    "Yuta SATOH <nigoro.dev@gmail.com>",
+]
+maintainers = [
+    "Catalyst maintainers <catalyst@gentoo.org>",
+    "Catalyst mailing list <gentoo-catalyst@lists.gentoo.org>",
+]
+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)


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-10-29 22:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-29 21:00 [gentoo-commits] proj/catalyst:wip/mattst88 commit in: catalyst/, / Matt Turner
  -- strict thread matches above, loose matches on Subject: below --
2020-10-29 21:30 Matt Turner
2020-10-29 21:52 Matt Turner
2020-10-29 22:09 Matt Turner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox