forked from gregoriorobles/ptavi-p6
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheck-p6.py
64 lines (49 loc) · 1.62 KB
/
check-p6.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
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
Script de comprobación de entrega de práctica
Para ejecutarlo, desde la shell:
$ python3 check-p6.py login_laboratorio
"""
import os
import random
import sys
files = ['README.md',
'LICENSE',
'.gitignore',
'client.py',
'server.py',
'invite.libpcap',
'check-p6.py',
'mp32rtp',
'.git',
'cancion.mp3']
if len(sys.argv) != 2:
print()
sys.exit("Usage: $ python3 check-p6.py login_github")
repo_git = "http://github.com/" + sys.argv[1] + "/ptavi-p6"
aleatorio = str(int(random.random() * 1000000))
error = 0
print
print("Clonando el repositorio " + repo_git)
os.system('git clone ' + repo_git + ' /tmp/' + aleatorio + ' > /dev/null 2>&1')
try:
student_file_list = os.listdir('/tmp/' + aleatorio)
except OSError:
error = 1
print("Error: No se ha podido acceder al repositorio " + repo_git + ".")
print()
sys.exit()
if len(student_file_list) != len(files):
error = 1
print("Error: solamente hay que subir al repositorio los ficheros indicados en las guion de practicas, que son en total " + str(len(student_file_list)) + " (incluyendo .git):")
for filename in files:
error = 1
print("\tError: " + filename + " no encontrado. Tienes que subirlo al repositorio.")
if not error:
print("Parece que la entrega se ha realizado bien.")
print()
print("La salida de pep8 es: (si todo va bien, no ha de mostrar nada)")
print()
os.system('pep8 --repeat --show-source --statistics /tmp/' + aleatorio + '/client.py /tmp/' + aleatorio + '/server.py')
print()