-
Notifications
You must be signed in to change notification settings - Fork 5
/
setup.py
108 lines (87 loc) · 2.98 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#! /usr/bin/env python
# encoding: utf-8
import os
import io
import re
import sys
from setuptools import setup, find_packages
cwd = os.path.abspath(os.path.dirname(__file__))
with io.open(os.path.join(cwd, "README.rst"), encoding="utf-8") as fd:
long_description = fd.read()
def file_find_version(filepath):
with io.open(filepath, encoding="utf-8") as fd:
VERSION = None
regex = re.compile(
r"""
( # Group and match
VERSION # Match 'VERSION'
\s* # Match zero or more spaces
= # Match and equal sign
\s* # Match zero or more spaces
) # End group
"
( # Group and match
\d\.\d\.\d # Match digit.digit.digit e.g. 1.2.3
) # End of group
"
""",
re.VERBOSE,
)
for line in fd:
match = regex.match(line)
if not match:
continue
# The second parenthesized subgroup.
VERSION = match.group(2)
break
else:
sys.exit("No VERSION variable defined in {} - aborting!".format(filepath))
return VERSION
def find_version():
wscript_VERSION = file_find_version(filepath=os.path.join(cwd, "wscript"))
return wscript_VERSION
VERSION = find_version()
setup(
name="versjon",
version=VERSION,
description=("Tool for generating a json file with the name and url of versions."),
long_description=long_description,
long_description_content_type="text/x-rst",
url="https://github.com/steinwurf/",
author="Steinwurf ApS",
author_email="[email protected]",
license='BSD 3-clause "New" or "Revised" License',
classifiers=[
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python",
"Topic :: Documentation",
"Topic :: Software Development :: Documentation",
"Topic :: Utilities",
],
entry_points={
"console_scripts": ["versjon=versjon.__main__:cli"],
},
keywords=("versjon"),
packages=find_packages(where="src", exclude=["test"]),
package_dir={"": "src"},
# How to include data in a package? We use the approach
# outlined here https://stackoverflow.com/a/14211600 more
# documentation on this:
# http://setuptools.readthedocs.io/en/latest/setuptools.html#including-data-files
#
package_data={"versjon": ["templates/*"]},
install_requires=[
"semantic_version",
"click",
"colorama",
"sphobjinv",
"beautifulsoup4",
],
)