import time
from datetime import datetime
import re
-import sets
import json
import operator
'etch': 'Debian GNU/Linux 4.0 (etch)',
'lenny': 'Debian GNU/Linux 5.0 (lenny)',
'squeeze': 'Debian GNU/Linux 6.0 (squeeze)',
- 'wheezy': 'Debian testing (wheezy)',
+ 'wheezy': 'Debian GNU/Linux 7.0 (wheezy)',
+ 'jessie': 'Debian testing (jessie)',
'sid': 'Debian unstable (sid)',
'hardy': 'Ubuntu 08.04 LTS "Hardy Heron" (hardy)',
'jaunty': 'Ubuntu 09.04 "Jaunty Jackalope" (jaunty)',
'quantal': 'Ubuntu 12.10 "Quantal Quetzal" (quantal)',
'raring': 'Ubuntu 13.04 "Raring Ringtail" (raring)',
'saucy': 'Ubuntu 13.10 "Saucy Salamander" (saucy)',
+ 'trusty': 'Ubuntu 14.04 LTS "Trusty Tahr" (trusty)',
}
def error(msg):
sys.stderr.write('E: %s\n' % msg)
def info(msg):
- sys.stderr.write("I: %s\n" % msg)
+ # print nothing ATM
+ # sys.stderr.write("I: %s\n" % msg)
+ pass
file_regex = re.compile('.*popcon-(\d{4}-\d{1,2}-\d{1,2})(|.gz)')
entry = dict(submissions = None,
package = {},
release = {},
- architecture = {})
+ architecture = {},
+ vendor = {})
for line in fileinput.FileInput(filename, openhook=fileinput.hook_compressed):
key, values = [x.strip().lower() for x in line.split(':', 1)]
except ValueError:
raise ValueError("Failed to split %s" % values)
entry[key][pkg] = tuple(int(x) for x in (vote, old, recent, nofiles))
- elif key in ('release', 'architecture'):
+ elif key in ('release', 'architecture', 'vendor'):
kvalue, value = values.split()
entry[key][kvalue] = int(value)
elif key == 'submissions':
entry[key] = int(values)
else:
- raise ValueError("Do not know how to handle line" % line)
+ raise ValueError("Do not know how to handle line %r" % line)
return entry
if __name__ == '__main__':
data = {}
popcon_versions = {}
- timestamps = sets.Set()
+ timestamps = set()
for f in sys.argv[1:]:
file_reg = file_regex.match(f)
popcon_[date_int] = count + popcon_.get(date_int, 0)
timestamps.add(date_int)
+ versions = sorted([x for x in popcon_versions.keys() if not 'ubuntu' in x]) + \
+ sorted([x for x in popcon_versions.keys() if 'ubuntu' in x])
+
# we need to make sure that for every date we have an entry for
# every version, otherwise d3 pukes because of ... d3.v2.js:expand
export = [{'key': k,
'values': [[date, popcon_versions[k].get(date, 0)/coarsen_days]
for date in sorted(list(timestamps))]}
- for k in sorted(popcon_versions.keys())]
+ for k in versions]
print json.dumps(export)