Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass long_description to setup() #353

Merged
merged 2 commits into from
Feb 9, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 16 additions & 27 deletions setup.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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 -*-

Expand All @@ -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))


# -*- %%% -*-
Expand All @@ -100,7 +88,7 @@ def run_tests(self):
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(
Expand Down Expand Up @@ -133,6 +121,7 @@ def run_tests(self):
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'],
Expand Down