-
Notifications
You must be signed in to change notification settings - Fork 11
/
setup.py
57 lines (47 loc) · 1.67 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
import subprocess
from distutils.command.build import build as _build
import setuptools
class build(_build):
sub_commands = _build.sub_commands + [('CustomCommands', None)]
class CustomCommands(setuptools.Command):
def initialize_options(self):
pass
def finalize_options(self):
pass
def RunCustomCommand(self, command_list):
print('Running command: %s' % command_list)
p = subprocess.Popen(
command_list,
stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
stdout_data, _ = p.communicate()
print('Command output: %s' % stdout_data)
if p.returncode != 0:
raise RuntimeError(
'Command %s failed: exit code: %s' % (command_list, p.returncode))
def run(self):
for command in CUSTOM_COMMANDS:
self.RunCustomCommand(command)
CUSTOM_COMMANDS = [
#Get cmake and git
['apt-get', 'update', '-y'],
['apt-get', 'install', '-y' ,'cmake',"unzip",'git','libgtk2.0-dev','pkg-config','libavcodec-dev','libavformat-dev','libswscale-dev'],
['git','clone', 'https://github.com/Itseez/opencv.git', '--depth', '1'],
['mkdir', 'opencv/build'],
['cmake','-Hopencv',"-Bopencv/build", "-DWITH_FFMPEG=ON"],
['make','-C', 'opencv/build','-j4'],
['make', '-C','opencv/build','install'],
['ldconfig']
]
REQUIRED_PACKAGES = ['numpy','tensorflow']
setuptools.setup(
name='DeepMeerkat',
version='0.0.1',
description='Running DeepMeerkat in the Cloud',
install_requires=REQUIRED_PACKAGES,
packages=setuptools.find_packages(),
cmdclass={
# Command class instantiated and run during pip install scenarios.
'build': build,
'CustomCommands': CustomCommands,
}
)