-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.py
More file actions
42 lines (32 loc) · 1.26 KB
/
Copy pathscript.py
File metadata and controls
42 lines (32 loc) · 1.26 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
import subprocess
import sys
print("This is a python script. Can be used both to compile the java files and to test the java files.")
print("Enter 1 if you want to compile the files. Enter 2 if you want to run test the java files.")
usr_choice = ""
while usr_choice=="":
usr_choice = input("Choice: ")
if(usr_choice=="1"):
compile = subprocess.run(["ant"], capture_output=False, text=True)
if compile.returncode == 0:
print("Compilation successful")
else:
print("Compilation failed")
print(compile.stderr)
elif(usr_choice=="2"):
print("Enter Arguments:")
arguments = input()
print("Running java files with given arguments.")
print("Java init: ")
print()
command = ["java", "-cp", "build", "MyInfArith"] + arguments.split(" ")
run = subprocess.run(command, capture_output=False, text=True)
print()
print("Java exited.")
if run.returncode == 0:
print("Run successful")
else:
print("Failed to run java file.")
else:
print("Unknown choice entered.")
print("Enter 1 if you want to compile the files. Enter 2 if you want to run test the java files.")
usr_choice = ""