-
Notifications
You must be signed in to change notification settings - Fork 209
/
setup.py
72 lines (59 loc) · 2.09 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
import os
from distutils.core import Command
import subprocess
import sys
from setuptools import find_packages
from setuptools import setup
from cert_issuer import __version__
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, 'README.md')) as fp:
long_description = fp.read()
with open('requirements.txt') as f:
install_reqs = f.readlines()
reqs = [str(ir) for ir in install_reqs]
class InstallCommand(Command):
description = "Installs Blockcerts cert-issuer with optional blockchain argument."
user_options = [
('blockchain=', None, 'Specify the blockchain. Bitcoin (default) or ethereum.'),
]
def initialize_options(self):
self.blockchain = 'bitcoin'
def finalize_options(self):
assert self.blockchain in ('bitcoin', 'ethereum'), 'Invalid blockchain!'
def run(self):
if self.blockchain == 'ethereum':
with open('ethereum_requirements.txt') as f:
install_reqs = f.readlines()
eth_reqs = [str(ir) for ir in install_reqs]
reqs.extend(eth_reqs)
else:
with open('bitcoin_requirements.txt') as f:
install_reqs = f.readlines()
btc_reqs = [str(ir) for ir in install_reqs]
reqs.extend(btc_reqs)
install(reqs)
def install(packages):
for package in packages:
subprocess.check_call([sys.executable, '-m', 'pip', 'install', package])
setup(
cmdclass={
'experimental': InstallCommand
},
install_requires=reqs,
name='cert-issuer',
version=__version__,
url='https://github.com/blockchain-certificates/cert-issuer',
license='MIT',
author='Blockcerts',
author_email='[email protected]',
description='Issues blockchain certificates using the Bitcoin blockchain',
long_description=long_description,
long_description_content_type='text/markdown',
include_package_data=True,
entry_points={
'console_scripts': [
'cert-issuer = cert_issuer.__main__:cert_issuer_main',
]
},
packages=find_packages()
)