This repository has been archived by the owner on Oct 20, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.py
60 lines (48 loc) · 1.49 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
#!/usr/bin/env python
from distutils.core import setup
import subprocess
from setuptools.command.install import install
from setuptools.command.develop import develop
import os
def install_deps():
cmd = [
'export V8_HOME=`pwd`/../v8',
'python setup.py build && python setup.py install',
'../../tools/build.sh'
]
retcode = subprocess.call('sh -c "{0}"'.format(';'.join(cmd)),
shell=True, cwd=os.path.join(os.getcwd(), 'vendor/pyv8'))
if retcode != 0:
raise RuntimeError('Non zero exit code')
retcode = subprocess.call('pip install -r requirements.txt', shell=True)
if retcode != 0:
raise RuntimeError('Non zero exit code')
class CustomInstallCommand(install):
def run(self):
install_deps()
install.run(self)
class CustomDevelopCommand(develop):
def run(self):
install_deps()
develop.run(self)
package_name = 'src2img'
package_data = {}
package_data[package_name] = ['VERSION']
__version__ = open(package_name + '/VERSION', 'r').read()
setup(
name=package_name,
version=__version__,
description='Backend for BEM hackathon project',
author='Dmitry Moskowski',
author_email='[email protected]',
url='https://github.com/team411/src2img-backend',
packages=[
package_name,
],
cmdclass={
'install': CustomInstallCommand,
'develop': CustomDevelopCommand
},
scripts=['bin/' + package_name],
package_data=package_data
)