-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSetupProject.py
More file actions
35 lines (28 loc) · 1.34 KB
/
Copy pathSetupProject.py
File metadata and controls
35 lines (28 loc) · 1.34 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
#!/usr/bin/env python3
import os, shutil, sys
import MirrorHandler as mirror
def CreateStructure(projectDir: str):
projectPath = os.path.abspath(projectDir)
os.makedirs(projectPath, exist_ok=True)
os.makedirs(os.path.join(projectPath, ".scripts"), exist_ok=True)
os.makedirs(os.path.join(projectPath, "gradle", "wrapper"), exist_ok=True)
os.makedirs(os.path.join(projectPath, "patches", "server"), exist_ok=True)
os.makedirs(os.path.join(projectPath, "patches", "client"), exist_ok=True)
os.makedirs(os.path.join(projectPath, "patches", "api"), exist_ok=True)
def MoveSources(srcDir: str, projectDir: str):
src = os.path.abspath(srcDir)
dst = os.path.abspath(os.path.join(projectDir, "src", "main", "java"))
os.makedirs(dst, exist_ok=True)
for item in os.listdir(src):
s = os.path.join(src, item)
d = os.path.join(dst, item)
shutil.move(s, d)
def DownloadGradle(projectDir: dir, projectVersion: str):
data, _ = mirror.load_version(projectVersion)
mirror.DownloadGradle(projectDir, data)
def init(srcDir: dir, projectDir: dir, projectVersion: str):
CreateStructure(projectDir=projectDir)
DownloadGradle(projectDir=projectDir, projectVersion=projectVersion)
MoveSources(srcDir, projectDir)
if __name__ == "__main__":
init(sys.argv[1], sys.argv[2], sys.argv[3])