From 854948ddc057f0ce7cc047b3618e8d5f6a1a292c Mon Sep 17 00:00:00 2001 From: Tobias Brox Date: Sat, 14 Feb 2015 18:36:32 +0100 Subject: loading some of the metadata from the script into setup.py, to avoid redundancy and make sure the version number needs to be bumped only one place. Ref http://stackoverflow.com/questions/28213267/design-pattern-for-setup-py-to-avoid-duplicated-metadata --- calendar-cli.py | 4 ++-- setup.py | 28 ++++++++++++++++------------ 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/calendar-cli.py b/calendar-cli.py index ebdb5f8..2cfce5a 100755 --- a/calendar-cli.py +++ b/calendar-cli.py @@ -21,9 +21,9 @@ __author__ = "Tobias Brox" __author_short__ = "tobixen" __copyright__ = "Copyright 2013, Tobias Brox" #__credits__ = [] -__license__ = "GPL" +__license__ = "GPLv3+" __maintainer__ = "Tobias Brox" -__email__ = "t-calendar-cli@tobixen.no" +__author_email__ = "t-calendar-cli@tobixen.no" __status__ = "Development" __product__ = "calendar-cli" diff --git a/setup.py b/setup.py index 659e859..ad45ef7 100644 --- a/setup.py +++ b/setup.py @@ -3,32 +3,35 @@ import sys import os -try: - from setuptools import setup -except ImportError: - from distutils.core import setup +from setuptools import setup, find_packages + +## TODO: "import imp" will not work from python 3.3, ref +## http://stackoverflow.com/questions/67631/how-to-import-a-module-given-the-full-path. +## Since we depend on caldav which depends on vobject which currently +## doesn't support python3, it's not an issue right now. +import imp +my_script = imp.load_source('my_script', './calendar-cli.py') +metadata = {} +for attribute in ('version', 'author', 'author_email', 'license'): + if hasattr(my_script, '__%s__' % attribute): + metadata[attribute] = getattr(my_script, '__%s__' % attribute) setup( name='calendar-cli', - version='0.1', description='Simple command-line CalDav client, for adding and browsing calendar items, todo list items, etc.', url='https://github.com/tobixen/calendar-cli', #packages=['', # ], - license='GPLv3+', - author='Tobias Brox', - author_email='t-calendar-cli@tobixen.no', classifiers=[ - #"Development Status :: 5 - Production/Stable", + #"Development Status :: ..." "Environment :: Web Environment", - "Intended Audience :: Developers", - #"License :: OSI Approved :: Apache Software License", + #"Intended Audience :: Developers", + #"License :: OSI Approved :: ...", "Operating System :: POSIX", "Programming Language :: Python", "Topic :: Internet :: WWW/HTTP", "Topic :: Internet :: WWW/HTTP :: Dynamic Content :: CGI Tools/Libraries", - "Topic :: Software Development :: Libraries :: Python Modules", ], scripts=['calendar-cli.py'], install_requires=[ @@ -37,4 +40,5 @@ setup( 'pytz', 'tzlocal' ], + **metadata ) -- cgit v1.2.3