Populate the project long_description by reading the README.rst file using "utf-8" encoding and excluding potential Sphinx directives.

This commit is contained in:
Laurent LAPORTE 2018-10-06 15:21:30 +02:00
parent c1a6513314
commit 0324d6bf18

View file

@ -1,6 +1,19 @@
import setuptools
import io
import os
import re
setuptools.setup(
from setuptools import find_packages
from setuptools import setup
def read(filename):
filename = os.path.join(os.path.dirname(__file__), filename)
text_type = type(u"")
with io.open(filename, mode="r", encoding='utf-8') as fd:
return re.sub(text_type(r':[a-z]+:`~?(.*?)`'), text_type(r'``\1``'), fd.read())
setup(
name="{{ cookiecutter.package_name }}",
version="{{ cookiecutter.package_version }}",
url="{{ cookiecutter.package_url }}",
@ -9,9 +22,9 @@ setuptools.setup(
author_email="{{ cookiecutter.author_email }}",
description="{{ cookiecutter.package_description }}",
long_description=open('README.rst').read(),
long_description=read("README.rst"),
packages=setuptools.find_packages(exclude=('tests',)),
packages=find_packages(exclude=('tests',)),
install_requires=[],