[Checkins] SVN: Zope/trunk/inst/checknew.py Added a little still stupid helper script to check PyPi for any new releases
Hanno Schlichting
hannosch at hannosch.eu
Sun May 24 12:49:36 EDT 2009
Log message for revision 100337:
Added a little still stupid helper script to check PyPi for any new releases
Changed:
A Zope/trunk/inst/checknew.py
-=-
Added: Zope/trunk/inst/checknew.py
===================================================================
--- Zope/trunk/inst/checknew.py (rev 0)
+++ Zope/trunk/inst/checknew.py 2009-05-24 16:49:35 UTC (rev 100337)
@@ -0,0 +1,53 @@
+import sys
+
+
+def main():
+ import pkg_resources
+ from pkg_resources import parse_requirements
+ from setuptools.package_index import PackageIndex
+
+ ws = pkg_resources.require('Zope2')
+ pi = PackageIndex()
+
+ names = []
+ installed = []
+ for dist in ws:
+ name = dist.project_name
+ if name not in names:
+ names.append(name)
+ installed.append(dict(
+ dist=dist,
+ name=name,
+ req=parse_requirements(name).next(),
+ ))
+
+ def _key(value):
+ return value['name']
+ installed.sort(key=_key)
+
+ upgrade = False
+ for info in installed:
+ print("Checking for new version of %s." % info['name'])
+ new_dist = pi.obtain(info['req'])
+ if new_dist.parsed_version > info['dist'].parsed_version:
+ upgrade = True
+ print()
+ print("Newer version for %s found. Installed: %s - found: %s" %
+ (info['name'], info['dist'].version, new_dist.version))
+ print("Newer version available at: %s" % new_dist.location)
+ print()
+
+ if not upgrade:
+ print("No updates have been found. All packages use current versions.")
+
+
+def help():
+ print("Use this script via ./bin/zopepy inst/checknew.py.")
+
+
+if __name__ == '__main__':
+ args = sys.argv[1:]
+ if '--help' in args:
+ help()
+ else:
+ main()
Property changes on: Zope/trunk/inst/checknew.py
___________________________________________________________________
Added: svn:eol-style
+ native
More information about the Checkins
mailing list