forked from dreamsxin/cphalcon7
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.py
executable file
·65 lines (45 loc) · 1.69 KB
/
config.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
#!/usr/bin/env python
import os
import stat
from subprocess import check_call, Popen
REPO = "https://github.com/dreamsxin/cphalcon7.git"
HOME_PATH = os.environ['HOME']
GIT_PATH = "/usr/bin/git"
APT_GET_PATH = "/usr/bin/apt-get"
PHP_PATH = "/usr/bin/php"
PHALCON_DIR = HOME_PATH + "/.phalcon"
PHALCON_COMMAND = PHALCON_DIR + "/cphalcon7/devtools/phalcon.php"
PHALCON_SCRIPT_BIN_PATH = "/usr/bin/phalcon"
CPHALCON_BUILD_DIR = PHALCON_DIR + "/cphalcon"
LIBS = ("git-core gcc autoconf make php7.0 php7.0-dev php7.0-cli")
PHP_INIT_FILE_PATH = ("/etc/php/7.0/cli/php.ini")
def devtools():
print("Installing DevTools ... \n")
os.chdir(PHALCON_DIR)
os.chmod(PHALCON_COMMAND, stat.S_IXUSR | stat.S_IRUSR | stat.S_IXGRP |
stat.S_IRGRP | stat.S_IXOTH | stat.S_IROTH)
os.symlink(PHALCON_COMMAND, PHALCON_SCRIPT_BIN_PATH)
print("Finish Installing DevTools \n")
def install_phalcon():
print("Installing Phalcon7 ... \n")
os.mkdir(PHALCON_DIR)
os.chdir(PHALCON_DIR)
check_call([GIT_PATH, "clone", REPO])
os.chdir(CPHALCON_BUILD_DIR)
proc = Popen("./debug.sh", shell=True, stdin=None, executable="/bin/bash")
proc.wait()
for _file in PHP_INIT_FILE_PATH:
with open(_file, "a") as fd:
fd.write("extension=phalcon.so")
print("Writing in "+_file)
print("Finish Installing Phalcon \n")
def install_dependencies():
print("Installing Dependencies ... \n")
proc = Popen(APT_GET_PATH + " -y install " + LIBS, shell=True, stdin=None,
executable="/bin/bash")
proc.wait()
print("Finish Installing Dependencies \n")
if __name__ == '__main__':
install_dependencies()
install_phalcon()
devtools()