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
|
#!/usr/bin/python
import os
import sys
import glob
import re
import ConfigParser
if len(sys.argv) == 2:
if sys.argv[1] == '-d':
distributions = []
files = glob.glob('../live-usb-install/presets/*/')
for filename in files:
if os.path.isdir(filename):
m = re.search('live-usb-install/presets/(.*?)/',filename)
distributions.append(m.group(1))
distributions.sort()
print len(distributions)
elif sys.argv[1] == '-v':
versions = []
files = glob.glob('../live-usb-install/presets/*/*/*')
for filename in files:
if filename.endswith("info.txt"):
m = re.search('live-usb-install/presets/(.*?)/(.*?)/info.txt',filename)
info_path = os.path.abspath(filename)
versions.append(m.group(1)+' - '+m.group(2))
print len(versions)
elif sys.argv[1] == '-dl':
distributions = []
files = glob.glob('../live-usb-install/presets/*/')
for filename in files:
if os.path.isdir(filename):
m = re.search('live-usb-install/presets/(.*?)/',filename)
distributions.append(m.group(1))
distributions.sort()
for name in distributions:
print ' -',name
elif sys.argv[1] == '-vl':
versions = []
files = glob.glob('../live-usb-install/presets/*/*/*')
for filename in files:
if filename.endswith("info.txt"):
m = re.search('live-usb-install/presets/(.*?)/(.*?)/info.txt',filename)
info_path = os.path.abspath(filename)
versions.append(m.group(1)+' - '+m.group(2))
for name in versions:
print name
else:
print "Usage: distributions.py [OPTIONS]"
print " -d Show distributions count"
print " -dl Show distributions list"
print " -v Show versions count"
print " -vl Show versions list"
|