mirror of
https://github.com/borgbackup/borg.git
synced 2025-02-01 12:09:10 +00:00
setup.py: move long_desc_from_readme definition to here
This commit is contained in:
parent
bb473e2daa
commit
19718c3c55
2 changed files with 17 additions and 15 deletions
18
setup.py
18
setup.py
|
@ -1,6 +1,7 @@
|
|||
# borgbackup - main setup code (see also pyproject.toml and other setup_*.py files)
|
||||
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
from collections import defaultdict
|
||||
from glob import glob
|
||||
|
@ -233,4 +234,19 @@ def members_appended(*ds):
|
|||
# generate C code from Cython for THIS platform (and for all platform-independent Cython parts).
|
||||
ext_modules = cythonize(ext_modules, **cython_opts)
|
||||
|
||||
setup(cmdclass=cmdclass, ext_modules=ext_modules, long_description=setup_docs.long_desc_from_readme())
|
||||
|
||||
def long_desc_from_readme():
|
||||
with open('README.rst') 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
|
||||
|
||||
|
||||
setup(cmdclass=cmdclass, ext_modules=ext_modules, long_description=long_desc_from_readme())
|
||||
|
|
|
@ -12,20 +12,6 @@
|
|||
from setuptools import Command
|
||||
|
||||
|
||||
def long_desc_from_readme():
|
||||
with open('README.rst') 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
|
||||
|
|
Loading…
Reference in a new issue