Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 1884a90

Browse files
committedMar 29, 2020
[setup.py] transition to use repository Markdown README file for long description on PyPI
1 parent cf2454d commit 1884a90

File tree

1 file changed

+43
-33
lines changed

1 file changed

+43
-33
lines changed
 

‎setup.py

Lines changed: 43 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,30 @@
1+
import io
12
import os
23
import re
4+
import sys
35
from setuptools import setup, find_packages
46

57

6-
def docs_read(fname):
7-
return open(os.path.join(os.path.dirname(__file__), 'docs', fname)).read()
8+
# Use repository Markdown README.md for PyPI long description
9+
try:
10+
with io.open("README.md", encoding="utf-8") as f:
11+
readme = f.read()
12+
except IOError as readme_e:
13+
sys.stderr.write(
14+
"[ERROR] setup.py: Failed to read the README.md file for the long description definition: {}".format(
15+
str(readme_e)
16+
)
17+
)
18+
raise readme_e
819

920

1021
def version_read():
11-
settings_file = open(os.path.join(os.path.dirname(__file__), 'lib', 'fontv', 'settings.py')).read()
12-
major_regex = """major_version\s*?=\s*?["']{1}(\d+)["']{1}"""
13-
minor_regex = """minor_version\s*?=\s*?["']{1}(\d+)["']{1}"""
14-
patch_regex = """patch_version\s*?=\s*?["']{1}(\d+)["']{1}"""
22+
settings_file = open(
23+
os.path.join(os.path.dirname(__file__), "lib", "fontv", "settings.py")
24+
).read()
25+
major_regex = r"""major_version\s*?=\s*?["']{1}(\d+)["']{1}"""
26+
minor_regex = r"""minor_version\s*?=\s*?["']{1}(\d+)["']{1}"""
27+
patch_regex = r"""patch_version\s*?=\s*?["']{1}(\d+)["']{1}"""
1528
major_match = re.search(major_regex, settings_file)
1629
minor_match = re.search(minor_regex, settings_file)
1730
patch_match = re.search(patch_regex, settings_file)
@@ -28,36 +41,33 @@ def version_read():
2841

2942

3043
setup(
31-
name='font-v',
44+
name="font-v",
3245
version=version_read(),
33-
description='Font version reporting and modification tool',
34-
long_description=(docs_read('README.rst')),
35-
url='https://github.com/source-foundry/font-v',
36-
license='MIT license',
37-
author='Christopher Simpkins',
38-
author_email='chris@sourcefoundry.org',
39-
platforms=['any'],
46+
description="Font version reporting and modification tool",
47+
long_description=readme,
48+
long_description_content_type="text/markdown",
49+
url="https://github.com/source-foundry/font-v",
50+
license="MIT license",
51+
author="Christopher Simpkins",
52+
author_email="chris@sourcefoundry.org",
53+
platforms=["any"],
4054
packages=find_packages("lib"),
41-
package_dir={'': 'lib'},
42-
install_requires=['gitpython', 'fonttools'],
43-
entry_points={
44-
'console_scripts': [
45-
'font-v = fontv.app:main'
46-
],
47-
},
48-
keywords='',
55+
package_dir={"": "lib"},
56+
install_requires=["gitpython", "fonttools"],
57+
entry_points={"console_scripts": ["font-v = fontv.app:main"],},
58+
keywords="",
4959
include_package_data=True,
5060
classifiers=[
51-
'Development Status :: 4 - Beta',
52-
'Natural Language :: English',
53-
'License :: OSI Approved :: MIT License',
54-
'Operating System :: OS Independent',
55-
'Programming Language :: Python',
56-
'Programming Language :: Python :: 2',
57-
'Programming Language :: Python :: 2.7',
58-
'Programming Language :: Python :: 3',
59-
'Programming Language :: Python :: 3.4',
60-
'Programming Language :: Python :: 3.5',
61-
'Programming Language :: Python :: 3.6'
61+
"Development Status :: 4 - Beta",
62+
"Natural Language :: English",
63+
"License :: OSI Approved :: MIT License",
64+
"Operating System :: OS Independent",
65+
"Programming Language :: Python",
66+
"Programming Language :: Python :: 2",
67+
"Programming Language :: Python :: 2.7",
68+
"Programming Language :: Python :: 3",
69+
"Programming Language :: Python :: 3.4",
70+
"Programming Language :: Python :: 3.5",
71+
"Programming Language :: Python :: 3.6",
6272
],
6373
)

0 commit comments

Comments
 (0)
Please sign in to comment.