diff options
author | Neal Gompa <ngompa13@gmail.com> | 2019-10-06 14:06:51 -0400 |
---|---|---|
committer | Neal Gompa <ngompa13@gmail.com> | 2019-10-06 14:14:54 -0400 |
commit | ac524526d62980400713ba7dcfd78798feb9e829 (patch) | |
tree | 3b9ab8bd5c3d0e25bb29e652f01eb35d858b6576 | |
parent | 67ce3b3d9cdb1c951092a9585cc9d152808aad77 (diff) | |
download | urlgrabber-ac524526d62980400713ba7dcfd78798feb9e829.tar.gz |
Revise setup.py to remove need for extra setup-time dependencies
This rework removes the cyclic dependency on the urlgrabber code to
install urlgrabber, while still supporting the propagation of setuptools
properties into the module.
-rw-r--r-- | setup.py | 123 | ||||
-rw-r--r-- | urlgrabber/__init__.py | 19 |
2 files changed, 70 insertions, 72 deletions
@@ -1,65 +1,58 @@ -# urlgrabber distutils setup -import re as _re -import sys as _sys - -class _pycurlFake(object): - Curl = staticmethod(lambda: None) - -# Unforunately __init__.py imports urlgrabber.grabber which then imports -# pycurl package. And finally pycurl.Curl() is called in the top level -# of grabber module. We don't need pycurl nor pycurl.Curl() during -# setup. Fake this module to be loaded already so we don't need to have -# pycurl installed at all. Maybe developer wants to install it in later -# phase. -_sys.modules["pycurl"] = _pycurlFake - -# We need urlgrabber package for some constants. -import urlgrabber as _urlgrabber - -del _sys.modules["pycurl"] - -name = "urlgrabber" -description = "A high-level cross-protocol url-grabber" -long_description = _urlgrabber.__doc__ -license = "LGPLv2+" -version = _urlgrabber.__version__ -_authors = _re.split(r',\s+', _urlgrabber.__author__) -author = ', '.join([_re.sub(r'\s+<.*', r'', _) for _ in _authors]) -author_email = ', '.join([_re.sub(r'(^.*<)|(>.*$)', r'', _) for _ in _authors]) -url = _urlgrabber.__url__ - -packages = ['urlgrabber'] -package_dir = {'urlgrabber':'urlgrabber'} -scripts = ['scripts/urlgrabber'] -data_files = [ - ('share/doc/' + name + '-' + version, ['README','LICENSE', 'TODO', 'ChangeLog']), - ('libexec', ['scripts/urlgrabber-ext-down']), -] -setup_requires = ['six'] -install_requires = ['pycurl', 'six'] -options = { 'clean' : { 'all' : 1 } } -classifiers = [ - 'Development Status :: 4 - Beta', - 'Environment :: Console', - 'Environment :: Web Environment', - 'Intended Audience :: Developers', - 'Intended Audience :: System Administrators', - 'License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+)', - 'Operating System :: POSIX', - 'Operating System :: POSIX :: Linux', - 'Programming Language :: Python', - 'Topic :: Internet :: File Transfer Protocol (FTP)', - 'Topic :: Internet :: WWW/HTTP', - 'Topic :: Software Development :: Libraries :: Python Modules' - ] - -# load up distutils -if __name__ == '__main__': - config = globals().copy() - keys = list(config.keys()) - for k in keys: - #print '%-20s -> %s' % (k, config[k]) - if k.startswith('_'): del config[k] - - from setuptools import setup - setup(**config) +from setuptools import setup + +pkg_name = "urlgrabber" +pkg_version = "4.0.0" + +setup( + name=pkg_name, + version=pkg_version, + license="LGPLv2+", + description="A high-level cross-protocol url-grabber", + keywords="urlgrabber yum http ftp", + # From https://pypi.python.org/pypi?%3Aaction=list_classifiers + classifiers=[ + # Development status + "Development Status :: 4 - Beta", + # Target audience + "Intended Audience :: Developers", + "Intended Audience :: System Administrators", + # Type of software + "Topic :: Internet :: File Transfer Protocol (FTP)", + "Topic :: Internet :: WWW/HTTP", + "Topic :: Software Development :: Libraries :: Python Modules", + # Kind of software + "Environment :: Console", + "Environment :: Web Environment", + # License (must match license field) + "License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+)", + # Operating systems supported + "Operating System :: POSIX", + "Operating System :: POSIX :: Linux", + # Supported Python versions + "Programming Language :: Python", + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 2.6", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + ], + url="http://urlgrabber.baseurl.org/", + author="Michael D. Stenner, Ryan Tomayko, Seth Vidal, Zdenek Pavlas", + author_email="mstenner@linux.duke.edu, rtomayko@naeblis.cx, skvidal@fedoraproject.org, zpavlas@redhat.com", + maintainer="Neal Gompa", + maintainer_email="ngompa@fedoraproject.org", + packages=["urlgrabber"], + package_dir = {'urlgrabber':'urlgrabber'}, + include_package_data=True, + install_requires=[ + "pycurl", + "six", + "setuptools", + ], + scripts = ['scripts/urlgrabber'], + data_files = [ + ('share/doc/' + pkg_name + '-' + pkg_version, ['README','LICENSE', 'TODO', 'ChangeLog']), + ('libexec', ['scripts/urlgrabber-ext-down']), + ], +) diff --git a/urlgrabber/__init__.py b/urlgrabber/__init__.py index 475a62e..60f56c3 100644 --- a/urlgrabber/__init__.py +++ b/urlgrabber/__init__.py @@ -46,12 +46,17 @@ following features: automatically switching mirrors if there is a failure. """ -__version__ = '4.0.0' -__date__ = '2019/02/25' -__author__ = 'Michael D. Stenner <mstenner@linux.duke.edu>, ' \ - 'Ryan Tomayko <rtomayko@naeblis.cx>' \ - 'Seth Vidal <skvidal@fedoraproject.org>' \ - 'Zdenek Pavlas <zpavlas@redhat.com>' -__url__ = 'http://urlgrabber.baseurl.org/' +try: + from email import message_from_string + from pkg_resources import get_distribution + pkgInfo = get_distribution(__package__).get_metadata('PKG-INFO') + __metadata__ = message_from_string(pkgInfo) + del pkgInfo + + __version__ = __metadata__['Version'] + __author__ = __metadata__['Author'] + __url__ = __metadata__['Home-page'] +except: + __author__ = __version__ = __url__ = '<see setup.cfg>' from .grabber import urlgrab, urlopen, urlread |