forked from CityOfZion/neo-mamba
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
104 lines (90 loc) · 3.26 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
"""The setup script."""
from setuptools import setup, find_packages
from setuptools.command.install import install
from setuptools.command.develop import develop
from contextlib import suppress
from pkg_resources import parse_version
class InstallCommand(install):
user_options = install.user_options + [
('without-leveldb', None, 'Do not install leveldb requirements'),
]
def initialize_options(self):
super().initialize_options()
# Initialize options
self.without_leveldb = None
def run(self): # Use options
if self.without_leveldb:
print("install command called!")
with suppress(ValueError):
idx = list(map(lambda i: "plyvel" in i, self.distribution.install_requires)).index(True)
self.distribution.install_requires.pop(idx)
super().run()
class DevelopCommand(develop):
user_options = develop.user_options + [
('without-leveldb', None, 'Do not install leveldb requirements'),
]
def initialize_options(self):
super().initialize_options()
# Initialize options
self.without_leveldb = None
def run(self):
# Use options
if self.without_leveldb:
with suppress(ValueError):
idx = list(map(lambda i: "plyvel" in i, self.distribution.install_requires)).index(True)
self.distribution.install_requires.pop(idx)
super().run()
try:
from pip._internal.req import parse_requirements
from pip import __version__ as __pip_version
pip_version = parse_version(__pip_version)
if (pip_version >= parse_version("20")):
from pip._internal.network.session import PipSession
elif (pip_version >= parse_version("10")):
from pip._internal.download import PipSession
except ImportError: # pip version < 10.0
from pip.req import parse_requirements
from pip.download import PipSession
with open('README.rst') as readme_file:
readme = readme_file.read()
# get the requirements from requirements.txt
install_reqs = parse_requirements('requirements.txt', session=PipSession())
if pip_version >= parse_version("20"):
reqs = [str(ir.requirement) for ir in install_reqs]
else:
reqs = [str(ir.req) for ir in install_reqs]
setup(
name='neo-mamba',
python_requires='>=3.7',
version='0.4.1',
description="Python SDK for the NEO 3 blockchain",
long_description=readme,
author="Erik van den Brink",
author_email='[email protected]',
maintainer="Erik van den Brink",
maintainer_email='[email protected]',
url='https://github.com/CityOfZion/neo-mamba',
packages=find_packages(include=['neo3']),
include_package_data=True,
install_requires=reqs,
license="MIT license",
zip_safe=False,
keywords='neo3, python, SDK',
entry_points={
'sphinx.html_themes': [
'neo3 = docs.source._theme',
]
},
classifiers=[
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Natural Language :: English',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.7',
],
cmdclass={
'install': InstallCommand,
'develop': DevelopCommand
}
)