-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathsetup.py
81 lines (66 loc) · 2.22 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
#!/usr/bin/env python
from setuptools import setup, find_packages
import re
import sys
import os
BASE_LOCATION = os.path.abspath(os.path.dirname(__file__))
VERSION_FILE = os.path.join(BASE_LOCATION, "src", "ustubby", "__init__.py")
REQUIRES_FILE = 'requirements.txt'
DEPENDENCIES_FILE = None
def filter_comments(fd):
no_comments = list(filter(lambda l: l.strip().startswith("#") is False, fd.readlines()))
return list(filter(lambda l: l.strip().startswith("-") is False, no_comments))
def readfile(filename, func):
try:
with open(os.path.join(BASE_LOCATION, filename)) as f:
data = func(f)
except (IOError, IndexError):
sys.stderr.write(u"""
Can't find '%s' file. This doesn't seem to be a valid release.
""" % filename)
sys.exit(1)
return data
def get_version():
with open(VERSION_FILE, 'r') as f:
data = f.read()
m = re.search(r"__version__ ?= ?\"[\d.]+\"", data)
res = m.group(0)
if res:
ret = re.search(r"(?<=\")[\d\.]+", res).group(0)
if ret:
return ret
raise ValueError("No version for ustubby found")
def get_requires():
return readfile(REQUIRES_FILE, filter_comments)
def get_dependencies():
return readfile(DEPENDENCIES_FILE, filter_comments)
setup(
name="ustubby",
author="Ryan Parry-Jones",
author_email="[email protected]",
description="Micropython c stub generator",
long_description=open("README.md").read(),
long_description_content_type="text/markdown",
package_dir={'': 'src'},
packages=find_packages('src'),
entry_points={
'console_scripts': [
'ustubby = ustubby.__main__:main'
]
},
url="https://github.com/pazzarpj/micropython-ustubby",
version=get_version(),
python_requires='>=3.6',
dependency_links=[],
include_package_data=True,
zip_safe=False,
classifiers=[
"Development Status :: 4 - Beta",
"Intended Audience :: Manufacturing",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
],
)