This repository has been archived by the owner on Dec 15, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 31
/
setup.py
110 lines (91 loc) · 3.27 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
109
110
#!/usr/bin/env python
import os
import re
from setuptools import setup, find_packages, Command
from setuptools.command.build_py import build_py
from setuptools.command.develop import develop
version = os.environ.get('VERSION')
if version is None:
with open(os.path.join('.', 'VERSION')) as version_file:
version = version_file.read().strip()
install_requires = []
setup_requires = []
with open('requirements.txt') as requirements:
regex = re.compile('(grpcio)|(protobuf).+')
for line in requirements:
req = line.strip()
install_requires.append(req)
if regex.search(req):
setup_requires.append(req)
setup_requires.append('pytest-runner')
class BuildPackageProtos(Command):
"""Command to generate project *_pb2.py modules from proto files."""
description = 'build grpc protobuf modules'
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
import grpc_tools.command
grpc_tools.command.build_package_protos(self.distribution.package_dir[''])
class BuildPyCommand(build_py):
def run(self):
self.run_command('build_proto_modules')
build_py.run(self)
class DevelopCommand(develop):
def run(self):
self.run_command('build_proto_modules')
develop.run(self)
setup_options = {
'name': 'loopchain',
'version': version,
'description': 'Blockchain consensus engine based on LFT',
'author': 'ICON foundation',
'python_requires': '>=3.7,<3.8',
'packages': find_packages(),
'package_dir': {'': '.'},
'license': "Apache License 2.0",
'setup_requires': setup_requires,
'install_requires': install_requires,
'extras_require': {
'tests': ['iconsdk~=1.3.0', 'pytest>=4.6.3', 'pytest-xprocess>=0.12.1', "pytest-benchmark", "pytest-mock",
"pytest-asyncio", "freezegun"],
},
'entry_points': {
'console_scripts': [
'loop=loopchain.__main__:main',
'loopchain=loopchain.__main__:main'
],
},
'tests_require': ['pytest'],
'data_files': [
('conf', ['citizen/conf/citizen_mainnet.json',
'citizen/conf/citizen_testnet.json',
'citizen/conf/iconrpcserver_mainnet.json',
'citizen/conf/iconrpcserver_testnet.json',
'citizen/conf/iconservice_mainnet.json',
'citizen/conf/iconservice_testnet.json']),
('scripts', ['citizen/run_citizen_mainnet.sh',
'citizen/run_citizen_testnet.sh',
'citizen/stop_all.sh']),
('docs', ['README.md',
'citizen/quick_start_snap.md'])
],
'cmdclass': {
'build_proto_modules': BuildPackageProtos,
'build_py': BuildPyCommand,
'develop': DevelopCommand
},
'classifiers': [
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'Intended Audience :: System Administrators',
'Natural Language :: English',
'License :: OSI Approved :: Apache Software License',
'Programming Language :: Python',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3 :: Only'
]
}
setup(**setup_options)