forked from raiden-network/raiden-contracts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
117 lines (92 loc) · 3.31 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
111
112
113
114
115
116
117
#!/usr/bin/env python3
try:
from setuptools import setup, find_packages
except ImportError:
from distutils.core import setup
import os
from typing import List
from setuptools import Command
from setuptools.command.build_py import build_py
DESCRIPTION = 'Raiden contracts library and utilities'
VERSION = '0.33.3'
def read_requirements(path: str) -> List[str]:
assert os.path.isfile(path)
with open(path) as requirements:
return requirements.read().split()
def _get_single_requirement(requirements: List[str], package: str) -> List[str]:
return [req for req in requirements if req.startswith(package)]
class BuildPyCommand(build_py):
def run(self):
try:
self.run_command('verify_contracts')
except SystemExit:
pass
build_py.run(self)
class VerifyContracts(Command):
description = 'Verify that the compiled contracts have the correct source code checksum'
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
from raiden_contracts.contract_manager import (
contracts_precompiled_path,
)
from raiden_contracts.contract_source_manager import (
ContractSourceManager,
contracts_source_path,
)
manager = ContractSourceManager(contracts_source_path(contracts_version=None))
manager.verify_precompiled_checksums(contracts_precompiled_path())
class CompileContracts(Command):
description = 'Compile contracts and add ABI and checksums to a json file'
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
from raiden_contracts.contract_manager import contracts_precompiled_path
from raiden_contracts.contract_source_manager import (
ContractSourceManager,
contracts_source_path,
)
contract_manager = ContractSourceManager(contracts_source_path())
contract_manager.compile_contracts(contracts_precompiled_path())
requirements = read_requirements('requirements.txt')
config = {
'version': VERSION,
'scripts': [],
'name': 'raiden-contracts',
'author': 'Brainbot Labs Est.',
'author_email': '[email protected]',
'description': DESCRIPTION,
'url': 'https://github.com/raiden-network/raiden-contracts/',
'license': 'MIT',
'keywords': 'raiden ethereum blockchain',
'install_requires': requirements,
'setup_requires': _get_single_requirement(requirements, 'py-solc'),
'packages': find_packages(),
'include_package_data': True,
'classifiers': [
'Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Natural Language :: English',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
],
'entry_points': {
'console_scripts': ['deploy = raiden_contracts.deploy.__main__:main'],
},
'cmdclass': {
'compile_contracts': CompileContracts,
'verify_contracts': VerifyContracts,
'build_py': BuildPyCommand,
},
'zip_safe': False,
'package_data': {"raiden_contracts": ["py.typed"]},
}
setup(**config)