-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
59 lines (49 loc) · 1.95 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
"""Python setup information."""
import codecs
import os
import re
from setuptools import find_packages, setup
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")
VERSION_FILE = os.path.join(PROJECT_ROOT, "pyinfraformat", "__init__.py")
def get_requirements():
"""Read contents from requirements.txt."""
with codecs.open(REQUIREMENTS_FILE) as buff:
return buff.read().splitlines()
def get_long_description():
"""Read contents from README.md."""
with codecs.open(README_FILE, "rt") as buff:
return buff.read()
def get_version():
"""Read version info from __init__.py."""
lines = open(VERSION_FILE, "rt").readlines()
version_regex = r"^__version__ = ['\"]([^'\"]*)['\"]"
for line in lines:
version_search = re.search(version_regex, line, re.M)
if version_search:
return version_search.group(1)
raise RuntimeError("Unable to find version in %s." % (VERSION_FILE,))
setup(
name="pyinfraformat",
version=get_version(),
description="Python library for Finnish Infraformat",
author="Ari Hartikainen, Taavi Dettenborn, Martti Hallipelto",
license="Apache-2.0",
long_description=get_long_description(),
long_description_content_type="text/markdown",
classifiers=[
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"Topic :: Scientific/Engineering :: Physics",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
],
keywords="infraformat",
packages=find_packages(exclude=["docs", "tests"]),
package_data={"pyinfraformat": ["plots//icons//*.svg"]},
install_requires=get_requirements(),
)