forked from vcon-dev/vcon
-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.py
82 lines (68 loc) · 2.39 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
""" Build script for vcon core package for pypi """
# import os
import sys
import typing
import setuptools
REQUIRES: typing.List[str] = []
# print("CWD: {}".format(os.getcwd()), file=sys.stderr)
# print("files in CWD: {}".format(os.listdir(os.getcwd())), file=sys.stderr)
def get_requirements(
filename: str,
requires: typing.List[str]
) -> typing.List[str]:
""" get pip package names from text file """
with open(filename, "rt") as core_file:
line = core_file.readline()
while line:
line = line.strip()
if(len(line) > 0 and line[0] != '#'):
requires.append(line)
line = core_file.readline()
return(requires)
REQUIRES = get_requirements("vcon/docker_dev/pip_package_list.txt", REQUIRES)
print("vcon package dependencies: {}".format(REQUIRES), file = sys.stderr)
def get_version() -> str:
"""
This is kind of a PITA, but the build system barfs when we import vcon here
as depenencies are not installed yet in the vritual environment that the
build creates. Therefore we cannot access version directly from vcon/__init__.py.
So I have hacked this means of parcing the version value rather than
de-normalizing it and having it set in multiple places.
"""
with open("vcon/__init__.py", "rt") as core_file:
line = core_file.readline()
while line:
if(line.startswith("__version__")):
variable, equals, version = line.split()
assert(variable == "__version__")
assert(equals == "=")
version = version.strip('"')
version_double = float(version)
assert(version_double >= 0.01)
assert(version_double < 10.0)
break
line = core_file.readline()
return(version)
__version__ = get_version()
setuptools.setup(
name='python-vcon',
version=__version__,
# version="0.1",
description='vCon conversational data container manipulation package',
url='https://github.com/py-vcon/py-vcon',
author='Dan Petrie',
author_email='[email protected]',
license='MIT',
packages=['vcon', 'vcon.filter_plugins', 'vcon.filter_plugins.impl'],
data_files=[
("vcon", ["vcon/docker_dev/pip_package_list.txt"])],
python_requires=">=3.7",
tests_require=['pytest', 'pytest-asyncio', 'pytest-dependency', "pytest_httpserver"],
install_requires = REQUIRES,
scripts=['vcon/bin/vcon'],
# entry_points={
# 'console_scripts': [
# 'vcon = vcon:cli:main',
# ]
# }
zip_safe=False)