-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathinit.py
More file actions
80 lines (71 loc) · 2.1 KB
/
init.py
File metadata and controls
80 lines (71 loc) · 2.1 KB
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
import errno
import fileinput
import fnmatch
import os
import shutil
import sys
import subprocess
def copyDirectory(src, dst):
try:
shutil.copytree(src, dst)
except OSError as exc:
if exc.errno in (errno.ENOTDIR, errno.EINVAL):
shutil.copy(src, dst)
else: raise
def removeDirectory(src):
try:
shutil.rmtree(src)
except OSError as exc:
raise
def mass_replace(directory, file_pattern, search_string, replace_string):
for root, dirs, files in os.walk(directory):
for filename in fnmatch.filter(files, file_pattern):
filepath = os.path.join(root, filename)
with fileinput.FileInput(filepath, inplace=True, backup=False) as file:
for line in file:
print(line.replace(search_string, replace_string), end='')
def doVlcj(interactive):
def copyVlcj():
if os.path.exists("src/main/java/uk"): removeDirectory("src/main/java/uk")
copyDirectory("deps/vlcj/src/main/java/uk", "src/main/java/uk")
if os.path.exists("src/main/java/com/spotifyxp/deps/uk"):
if interactive:
inp = input("Overwrite vlcj? [Y/N]")
if inp.lower().__eq__("y"):
copyVlcj()
elif inp.lower().__eq__(""):
copyVlcj()
elif inp.lower().__eq__("n"):
return
else:
doVlcj(interactive)
else:
copyVlcj()
else:
copyVlcj()
def doInit(interactive=False):
subprocess.Popen(
executable="mvn",
args=["clean", "package"],
shell=True,
cwd="deps/mpris-java"
).wait()
subprocess.Popen(
executable="mvn",
args=["clean", "package"],
shell=True,
cwd="deps/JavaSetupTool"
).wait()
doVlcj(interactive)
subprocess.Popen(
executable="mvn",
args=["clean", "package"],
shell=True,
cwd="deps/librespot-java"
).wait()
subprocess.Popen(
args=["./gradlew", "build"],
cwd="deps/mslinks"
).wait()
if __name__ == '__main__':
doInit(True)