forked from shreyakupadhyay/runeve
-
Notifications
You must be signed in to change notification settings - Fork 0
/
final-script.py
executable file
·69 lines (46 loc) · 1.4 KB
/
final-script.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
#!/usr/bin/env python
import sys
import os
import optparse
from subprocess import call
array = []
update=0
array= sys.argv[1]
for j in range(0,len(array)):
if(array[j] == '.'):
update=j
u=0
arr = []
arr = array[update:len(array)+1]
if(arr[1]=='c'):
parser = optparse.OptionParser()
parser.add_option('-n', '--executable', dest='file', help='file name')
(options, args) = parser.parse_args()
if options.file is None:
options.file=raw_input("Give the name of executable file: ")
call(["gcc" ,sys.argv[1], "-o",options.file])
call(["./"+options.file])
else:
call(["gcc" ,sys.argv[1], "-o",sys.argv[3]])
call(["./"+sys.argv[3]])
os.remove(sys.argv[3])
elif(arr[1]=='c' and arr[2]=='p' and arr[3]=='p'):
parser = optparse.OptionParser()
parser.add_option('-n', '--executable', dest='file', help='file name')
(options, args) = parser.parse_args()
if options.file is None:
options.file=raw_input("Give the name of executable file: ")
call(["g++" ,sys.argv[1], "-o",options.file])
call(["./"+options.file])
else:
call(["g++" ,sys.argv[1], "-o",sys.argv[3]])
call(["./"+sys.argv[3]])
os.remove(sys.argv[3])
elif(arr[1]=='p' and arr[2]=='y'):
call(["python",sys.argv[1]])
elif(arr[1]=='p' and arr[2]=='h' and arr[3]=='p'):
call(["php",sys.argv[1]])
elif(arr[1]=='j' and arr[2]=='s'):
call(["node",sys.argv[1]])
elif(arr[1]=='r' and arr[2]=='b'):
call(["ruby",sys.argv[1]])