-
Notifications
You must be signed in to change notification settings - Fork 158
/
setup.py
39 lines (30 loc) · 1002 Bytes
/
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
#!/usr/bin/env python
"""Installation script."""
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
import ast
import codecs
import os
import re
CURRENT_DIR = os.path.dirname(__file__)
def get_long_description():
readme_path = os.path.join(CURRENT_DIR, "README.md")
with codecs.open(readme_path, encoding="utf8") as ld_file:
return ld_file.read()
def get_version():
pydot_py = os.path.join(CURRENT_DIR, "src", "pydot", "__init__.py")
_version_re = re.compile(r"__version__\s+=\s+(?P<version>.*)")
with codecs.open(pydot_py, "r", encoding="utf8") as f:
match = _version_re.search(f.read())
version = match.group("version") if match is not None else '"unknown"'
return str(ast.literal_eval(version))
setup(
name="pydot",
version=get_version(),
package_dir={"": "src"},
packages=["pydot"],
long_description=get_long_description(),
long_description_content_type="text/markdown",
)