Created
July 15, 2011 23:38
-
-
Save evandrix/1085780 to your computer and use it in GitHub Desktop.
/usr/local/bin/rudix fix
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
# add try-catch block to ignore exceptions raised from re.findall() | |
def get_versions_for_package(pkg): | |
'Get a list of available versions for package' | |
pkg = denormalize(pkg) | |
content = urlopen('http://code.google.com/p/rudix/downloads/list?q=Filename:%s' % pkg).read() | |
try: | |
urls = re.findall('(rudix.googlecode.com/files/(%s-([\w.]+(?:-\d+)?(?:.i386)?)(\.dmg|\.pkg)))' % pkg, content) | |
versions = sorted(list(set(urls)), cmp=lambda x, y: version_compare(x[2], y[2])) | |
if len(versions) == 0: | |
return [] | |
else: | |
return versions | |
except: | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment