Created
October 18, 2012 10:53
-
-
Save Ch00k/3910977 to your computer and use it in GitHub Desktop.
Get PPA list to insert into Allowed-Origins
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import os | |
os.chdir("/var/lib/apt/lists") | |
for file in os.listdir("."): | |
if file.endswith("Release"): | |
with open(file) as f: | |
content = f.readlines() | |
d = {} | |
for line in content: | |
if 'Origin: ' in line or 'Suite: ' in line: | |
key = line.split(': ')[0].rstrip() | |
value = line.split(': ')[1].rstrip() | |
d[key] = value | |
if (d['Origin'] != 'Ubuntu') and (d['Origin'] != 'Canonical'): | |
if not 'Suite' in d: | |
print '"%s:";' % d['Origin'] | |
else: | |
print '"%s: %s";' % (d['Origin'], d['Suite']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment