From 33a94b644881456b041beacfd48e2acefa75e546 Mon Sep 17 00:00:00 2001 From: Matt Wang Date: Tue, 19 Nov 2024 20:07:16 +0100 Subject: [PATCH] Cleanup: move most pkg metadata info to setup.py --- Makefile | 2 +- setup.py | 14 +++++++------- ydiff.py | 22 ++++++---------------- 3 files changed, 14 insertions(+), 24 deletions(-) diff --git a/Makefile b/Makefile index 7842767..91a66d7 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,7 @@ dogfood: git diff | ./ydiff.py -s lint: - pycodestyle --ignore=E203,W503,W504 *.py */*.py + pycodestyle --ignore=W503,W504 *.py */*.py doc-check: ./setup.py --long-description | rst2html.py --strict > /dev/null diff --git a/setup.py b/setup.py index 7ad196f..9f8f8cf 100755 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- from setuptools import setup -from ydiff import PKG_INFO +from ydiff import __version__, __homepage__, __description__ with open('README.rst') as doc: long_description = doc.read() @@ -11,13 +11,13 @@ setup( name='ydiff', - version=PKG_INFO['version'], - author=PKG_INFO['author'], - license=PKG_INFO['license'], - description=PKG_INFO['description'], + version=__version__, + author='Matt Wang', + license='BSD-3', + description=__description__, long_description=long_description, - keywords=PKG_INFO['keywords'], - url=PKG_INFO['url'], + keywords='colored incremental side-by-side diff', + url=__homepage__, # See https://pypi.python.org/pypi?%3Aaction=list_classifiers classifiers=[ 'Development Status :: 5 - Production/Stable', diff --git a/ydiff.py b/ydiff.py index 8ed40ec..1ee4fac 100755 --- a/ydiff.py +++ b/ydiff.py @@ -1,11 +1,6 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- -""" -Terminmal based tool to view colored, incremental diffs in a version-controlled -workspace or from stdin, in side-by-side or unified mode, and auto paged. -""" - import difflib import os import re @@ -15,15 +10,10 @@ import sys import unicodedata -PKG_INFO = { - 'version' : '1.4.2', - 'license' : 'BSD-3', - 'author' : 'Matt Wang', - 'url' : 'https://github.com/ymattw/ydiff', - 'keywords' : 'colored incremental side-by-side diff', - 'description' : ('View colored, incremental diff in a workspace or from ' - 'stdin, in side-by-side or unified moded, and auto paged') -} +__version__ = '1.4.2' +__homepage__ = 'https://github.com/ymattw/ydiff' +__description__ = ('View colored, incremental diff in a workspace or from ' + 'stdin, in side-by-side or unified moded, and auto paged') if sys.hexversion < 0x03030000: raise SystemExit('*** Requires python >= 3.3.0') # pragma: no cover @@ -756,8 +746,8 @@ def _process_args(self, largs, rargs, values): usage = """%prog [options] [file|dir ...]""" parser = _PassThroughOptionParser( - usage=usage, description=PKG_INFO['description'], - version='%%prog %s' % PKG_INFO['version']) + usage=usage, description=__description__, + version='%%prog %s' % __version__) parser.add_option( '-s', '--side-by-side', action='store_true', default=True, help='enable side-by-side mode (default True; DEPRECATED)')