diff --git a/setup.py b/setup.py index 5c02723e7..c76058936 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,6 @@ # borgbackup - main setup code (see also other setup_*.py files) import os -import re import sys from collections import defaultdict from glob import glob @@ -99,18 +98,6 @@ def __init__(self, *args, **kwargs): raise ImportError('The GIT version of Borg needs Cython. Install Cython or use a released version.') -with open('README.rst', 'r') as fd: - long_description = fd.read() - # remove header, but have one \n before first headline - start = long_description.find('What is BorgBackup?') - assert start >= 0 - long_description = '\n' + long_description[start:] - # remove badges - long_description = re.compile(r'^\.\. start-badges.*^\.\. end-badges', re.M | re.S).sub('', long_description) - # remove unknown directives - long_description = re.compile(r'^\.\. highlight:: \w+$', re.M).sub('', long_description) - - def rm(file): try: os.unlink(file) @@ -206,6 +193,7 @@ def members_appended(*ds): cythonize([posix_ext, linux_ext, freebsd_ext, darwin_ext], **cython_opts) ext_modules = cythonize(ext_modules, **cython_opts) + setup( name='borgbackup', use_scm_version={ @@ -215,7 +203,7 @@ def members_appended(*ds): author_email='borgbackup@python.org', url='https://borgbackup.readthedocs.io/', description='Deduplicated, encrypted, authenticated and compressed backups', - long_description=long_description, + long_description=setup_docs.long_desc_from_readme(), license='BSD', platforms=['Linux', 'MacOS X', 'FreeBSD', 'OpenBSD', 'NetBSD', ], classifiers=[ diff --git a/setup_docs.py b/setup_docs.py index f29c66c25..ec84a7d0a 100644 --- a/setup_docs.py +++ b/setup_docs.py @@ -11,6 +11,20 @@ from setuptools import Command +def long_desc_from_readme(): + with open('README.rst', 'r') as fd: + long_description = fd.read() + # remove header, but have one \n before first headline + start = long_description.find('What is BorgBackup?') + assert start >= 0 + long_description = '\n' + long_description[start:] + # remove badges + long_description = re.compile(r'^\.\. start-badges.*^\.\. end-badges', re.M | re.S).sub('', long_description) + # remove unknown directives + long_description = re.compile(r'^\.\. highlight:: \w+$', re.M).sub('', long_description) + return long_description + + def format_metavar(option): if option.nargs in ('*', '...'): return '[%s...]' % option.metavar