forked from RedisGears/RedisGears
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsystem-setup.py
executable file
·96 lines (70 loc) · 3.02 KB
/
system-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
#!/usr/bin/env python2
import sys
import os
import argparse
ROOT = HERE = os.path.abspath(os.path.dirname(__file__))
READIES = os.path.join(ROOT, "deps/readies")
sys.path.insert(0, READIES)
import paella
#----------------------------------------------------------------------------------------------
class RedisGearsSetup(paella.Setup):
def __init__(self, nop=False, with_python=True):
paella.Setup.__init__(self, nop=nop)
self.with_python = with_python
def common_first(self):
self.install_downloaders()
self.pip_install("wheel")
self.pip_install("setuptools --upgrade")
self.install("git openssl")
def debian_compat(self):
self.run("%s/bin/getgcc" % READIES)
self.install("autotools-dev autoconf libtool")
self.install("lsb-release")
self.install("zip unzip gawk")
self.install("python-dev")
# pip cannot build gevent on ARM
if self.platform.is_arm() and self.dist == 'ubuntu' and self.os_version[0] < 20:
self.install("python-gevent")
else:
self.pip_install("gevent")
def redhat_compat(self):
self.run("%s/bin/getgcc --modern" % READIES)
self.install("autoconf automake libtool")
self.install("redhat-lsb-core")
self.install("zip unzip")
self.install("libatomic file")
self.install("python2-devel")
self.run("%s/bin/getepel" % READIES)
if self.arch == 'x64':
self.install_linux_gnu_tar()
if self.platform.is_arm():
self.install("python-gevent python-ujson")
else:
self.pip_install("gevent ujson")
def fedora(self):
self.run("%s/bin/getgcc" % READIES)
self.install("libatomic file")
self.install("python2-ujson")
self.pip_install("gevent")
def linux_last(self):
self.install("valgrind")
def macos(self):
self.install("make libtool autoconf automake")
self.install("openssl readline coreutils")
if not self.has_command("redis-server"):
self.install("redis")
self.install("binutils") # into /usr/local/opt/binutils
self.install_gnu_utils()
self.pip_install("gevent")
def common_last(self):
if self.with_python:
self.run("{PYTHON} {ROOT}/build/cpython/system-setup.py {NOP}".
format(PYTHON=self.python, ROOT=ROOT, NOP="--nop" if self.runner.nop else ""),
nop=False, output=True)
self.run("{PYTHON} {READIES}/bin/getrmpytools".format(PYTHON=self.python, READIES=READIES))
#----------------------------------------------------------------------------------------------
parser = argparse.ArgumentParser(description='Set up system for RedisGears build.')
parser.add_argument('-n', '--nop', action="store_true", help='no operation')
parser.add_argument('--with-python', action="store_true", default=True, help='with Python')
args = parser.parse_args()
RedisGearsSetup(nop = args.nop, with_python=args.with_python).setup()