-
Notifications
You must be signed in to change notification settings - Fork 17
/
setup.py
executable file
·104 lines (84 loc) · 2.8 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
#!/usr/bin/env python
import distutils.log
import os
import subprocess
from distutils.spawn import find_executable
from setuptools import Command, find_packages, setup
from distutils.command.build import build
class BuildCommand(build):
def run(self):
self.run_command('compile_webui')
build.run(self)
class CompileWebUI(Command):
description = 'use yarn to compile raiden_webui'
user_options = [
('dev', 'D', 'use development preset, instead of production (default)'),
]
def initialize_options(self):
self.dev = None
def finalize_options(self):
pass
def run(self):
yarn = find_executable('yarn')
if not yarn:
raise RuntimeError('Yarn not found. Aborting')
yarn_run = 'build:prod'
if self.dev is not None:
yarn_run = 'build:dev'
cwd = os.path.abspath(
os.path.join(
os.path.dirname(__file__)
),
)
yarn_version = subprocess.check_output([yarn, '--version'])
# require yarn 1.x.x
if not int(yarn_version.split(b'.')[0]) == 1:
raise RuntimeError(f'Yarn v1 required. Have {yarn_version} from {yarn}.')
command = [yarn, 'install', '--frozen-lockfile']
self.announce(
'Running %r in %r' % (command, cwd),
level=distutils.log.INFO, # pylint: disable=no-member
)
subprocess.check_call(command, cwd=cwd)
command = [yarn, 'run', yarn_run]
self.announce(
'Running %r in %r' % (command, cwd),
level=distutils.log.INFO, # pylint: disable=no-member
)
subprocess.check_call(command, cwd=cwd)
self.announce(
'WebUI compiled with success!',
level=distutils.log.INFO, # pylint: disable=no-member
)
with open('README.md', encoding='utf-8') as readme_file:
readme = readme_file.read()
history = ''
version = '1.1.1' # Do not edit: this is maintained by bumpversion (see .bumpversion.cfg)
setup(
name='raiden-webui',
description='Raiden webui',
version=version,
long_description=readme,
long_description_content_type='text/markdown',
author='Brainbot Labs Est.',
author_email='contact@brainbot.li',
url='https://github.com/raiden-network/webui',
packages=find_packages(),
include_package_data=True,
license='MIT',
zip_safe=False,
keywords='raiden webui',
classifiers=[
'Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Natural Language :: English'
],
cmdclass={
'compile_webui': CompileWebUI,
'build': BuildCommand
},
use_scm_version=True,
setup_requires=['setuptools_scm'],
python_requires='>=3.6'
)