-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
73 lines (63 loc) · 2.32 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import os
import re
from setuptools import setup, find_packages
NAME = "glaze"
MAINTAINER = "The Font Bakers"
DESCRIPTION = "A Python library and command line tool for rendering algorithmically-generated fonts and typefaces."
LICENSE = "MIT"
URL = "https://github.com/font-bakers/glaze"
PROJECT_URLS = {
"Documentation": "https://font-bakers.github.io/glaze/",
"Issue Tracker": "https://github.com/font-bakers/glaze/issues",
}
PYTHON_REQUIRES = ">=3.5.2"
PROJECT_ROOT = os.path.dirname(os.path.realpath(__file__))
REQUIREMENTS_FILE = os.path.join(PROJECT_ROOT, "requirements.txt")
README_FILE = os.path.join(PROJECT_ROOT, "README.md")
try:
with open(README_FILE, encoding="utf-8") as f:
LONG_DESCRIPTION = "\n" + f.read()
LONG_DESCRIPTION_CONTENT_TYPE = "text/markdown"
except FileNotFoundError:
LONG_DESCRIPTION = DESCRIPTION
LONG_DESCRIPTION_CONTENT_TYPE = "text/plain"
with open(REQUIREMENTS_FILE) as f:
INSTALL_REQUIRES = f.read().splitlines()
CLASSIFIERS = [
"Development Status :: 3 - Alpha",
"Environment :: Console",
"License :: OSI Approved :: MIT License",
"Natural Language :: English",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.5",
"Topic :: Scientific/Engineering",
"Topic :: Text Processing :: Fonts",
]
def get_version():
version_file = os.path.join(NAME, "__init__.py")
lines = open(version_file, "rt").readlines()
version_regex = r"^__version__ = ['\"]([^'\"]*)['\"]"
for line in lines:
matches = re.search(version_regex, line, re.M)
if matches:
return matches.group(1)
raise RuntimeError("Unable to find version in {}.".format(version_file))
if __name__ == "__main__":
setup(
name=NAME,
version=get_version(),
maintainer=MAINTAINER,
description=DESCRIPTION,
long_description=LONG_DESCRIPTION,
long_description_content_type=LONG_DESCRIPTION_CONTENT_TYPE,
license=LICENSE,
classifiers=CLASSIFIERS,
url=URL,
project_urls=PROJECT_URLS,
packages=find_packages(),
python_requires=PYTHON_REQUIRES,
install_requires=INSTALL_REQUIRES,
entry_points={"console_scripts": ["glaze = glaze.__main__:main"]},
)