-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcompilation_notation.py
95 lines (74 loc) · 3.09 KB
/
compilation_notation.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
#!/usr/bin/env python3
import subprocess
import sys
NULL = open("/dev/null", "w")
def say(m):
sys.stdout.write(m)
sys.stdout.flush()
def noter():
note=0
rc_base = subprocess.call("gcc -o notation0 notation0.c sudoku.c",shell = True, stdout = NULL, stderr = NULL)
if rc_base == 0:
say("Notation partie 0 compilee\n")
else:
say("Echec de compilation partie 0\nNote provisoire : 0\n")
sys.exit(1)
process=subprocess.Popen("./notation0",shell=True,stdout=subprocess.PIPE,stderr=subprocess.PIPE, bufsize=1)
(out,err)=process.communicate()
if(process.returncode==0):
print(out.decode('utf-8'))
note+=2*(float(err.decode('utf-8'))/172)
#print(err.decode('utf-8'))
rc_base = subprocess.call("gcc -o notation1 notation1.c sudoku.c",shell = True, stdout = NULL, stderr = NULL)
if rc_base == 0:
say("Notation partie 1 compilee\n")
else:
say("Echec de compilation partie 1\n")
print("Note provisoire : "+str(note))
sys.exit(1)
process=subprocess.Popen("./notation1",shell=True,stdout=subprocess.PIPE,stderr=subprocess.PIPE, bufsize=1)
(out,err)=process.communicate()
if(process.returncode==0):
print(out.decode('utf-8'))
note+=2*(float(err.decode('utf-8'))/100)
#print(str(note))
rc_base = subprocess.call("gcc -o notation2 notation2.c sudoku.c",shell = True, stdout = NULL, stderr = NULL)
if rc_base == 0:
say("Notation partie 2 compilee\n")
else:
say("Echec de compilation partie 2\n")
print("Note provisoire : "+str(note))
sys.exit(1)
process=subprocess.Popen("./notation2",shell=True,stdout=subprocess.PIPE,stderr=subprocess.PIPE, bufsize=1)
(out,err)=process.communicate()
if(process.returncode==0):
print(out.decode('utf-8'))
note+=3*(float(err.decode('utf-8'))/100)
#print(str(note))
rc_base = subprocess.call("gcc -o notation3 notation3.c sudoku.c",shell = True, stdout = NULL, stderr = NULL)
if rc_base == 0:
say("Notation partie 3 compilee\n")
else:
say("Echec de compilation partie 3\n")
print("Note provisoire : "+str(note))
sys.exit(1)
process=subprocess.Popen("./notation3",shell=True,stdout=subprocess.PIPE,stderr=subprocess.PIPE, bufsize=1)
(out,err)=process.communicate()
if(process.returncode==0):
print(out.decode('utf-8'))
note+=3*(float(err.decode('utf-8'))/100)
#print(str(note))
rc_base = subprocess.call("gcc -o notation4 notation4.c sudoku.c",shell = True, stdout = NULL, stderr = NULL)
if rc_base == 0:
say("Notation partie 4 compilee\n")
else:
say("Echec de compilation partie 4\n")
print("Note provisoire : "+str(note))
sys.exit(1)
process=subprocess.Popen("./notation4",shell=True,stdout=sys.stdout,stderr=subprocess.PIPE, bufsize=1)
(out,err)=process.communicate()
if(process.returncode==0):
#print(out.decode('utf-8'))
note+=3*(float(err.decode('utf-8'))/10)
print("\nNote provisoire : "+str(note)+"/10")
noter()