summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp A <flying-sheep@web.de>2021-02-09 21:48:57 +0100
committerGitHub <noreply@github.com>2021-02-09 21:48:57 +0100
commit137245bc8cae3290cab20fbbbe03bb5916d237c9 (patch)
tree2b088db6a9cc6634416bf3eb2b8e0ac1de48dc10
parent3db08f6f43f0095893e0284bba96d03bed3caa33 (diff)
downloadpy-amqp-137245bc8cae3290cab20fbbbe03bb5916d237c9.tar.gz
Pass long_description to setup() (#353)
* Pass long_description to setup() * Remove unused import
-rw-r--r--setup.py43
1 files changed, 16 insertions, 27 deletions
diff --git a/setup.py b/setup.py
index fae4cbf..ffa7311 100644
--- a/setup.py
+++ b/setup.py
@@ -1,9 +1,9 @@
#!/usr/bin/env python
-import codecs
-import os
import re
import sys
+from os import environ
+from pathlib import Path
import setuptools
import setuptools.command.test
@@ -45,16 +45,15 @@ def add_doc(m):
pats = {re_meta: add_default,
re_doc: add_doc}
-here = os.path.abspath(os.path.dirname(__file__))
-with open(os.path.join(here, 'amqp/__init__.py')) as meta_fh:
- meta = {}
- for line in meta_fh:
- if line.strip() == '# -eof meta-':
- break
- for pattern, handler in pats.items():
- m = pattern.match(line.strip())
- if m:
- meta.update(handler(m))
+here = Path(__file__).parent
+meta = {}
+for line in (here / 'amqp/__init__.py').read_text().splitlines():
+ if line.strip() == '# -eof meta-':
+ break
+ for pattern, handler in pats.items():
+ m = pattern.match(line.strip())
+ if m:
+ meta.update(handler(m))
# -*- Installation Requires -*-
@@ -68,20 +67,9 @@ def strip_comments(l):
def reqs(f):
- with open(os.path.join(os.getcwd(), 'requirements', f)) as fp:
- req = filter(None, [strip_comments(l) for l in fp.readlines()])
- # filter returns filter object(iterator) in Python 3,
- # but a list in Python 2.7, so make sure it returns a list.
- return list(req)
-
-
-# -*- Long Description -*-
-
-def long_description():
- try:
- return codecs.open('README.rst', 'r', 'utf-8').read()
- except OSError:
- return 'Long description error: Missing README.rst file'
+ lines = (here / 'requirements' / f).read_text().splitlines()
+ reqs = [strip_comments(l) for l in lines]
+ return list(filter(None, reqs))
# -*- %%% -*-
@@ -100,7 +88,7 @@ class pytest(setuptools.command.test.test):
sys.exit(pytest.main(pytest_args))
-if os.environ.get("CELERY_ENABLE_SPEEDUPS"):
+if environ.get("CELERY_ENABLE_SPEEDUPS"):
setup_requires = ['Cython']
ext_modules = [
setuptools.Extension(
@@ -133,6 +121,7 @@ setuptools.setup(
packages=setuptools.find_packages(exclude=['ez_setup', 't', 't.*']),
version=meta['version'],
description=meta['doc'],
+ long_description=(here / 'README.rst').read_text(),
keywords='amqp rabbitmq cloudamqp messaging',
author=meta['author'],
author_email=meta['contact'],