Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also .

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also .
...
  • 2 commits
  • 2 files changed
  • 0 commit comments
  • 1 contributor
Showing with 23 additions and 10 deletions.
  1. +8 −0 README
  2. +15 −10 librarywatch/management/commands/check_for_updates.py
View
8 README
@@ -14,6 +14,14 @@ PIL (1.1.7 < 1.1.6)
It's a simple app / function, but will save me (and hopefully you) time and be easily installable on everything you do.
+If you want to ignore versions (for instance you're tracking django-haystack on git, or want to make sure python-dateutil doesn't recommend you go to the 2.x branch with your app on Python 2.x) you can add LIBRARYWATCH_IGNORE_VERSIONS to your settings file.
+
+LIBRARYWATCH_IGNORE_VERSIONS = {
+ 'python-dateutil': '*', # 2.x series it recommends is not for Python 2.x
+ 'django-haystack': '*', # running from git MASTER
+ 'PIL': '1.1.6', # running 1.1.7 which doesn't appear to be on PyPI
+}
+
Future ideas:
- Track versions to allow ignoring when newer versions aren't backwards compatible so you absolutely DON'T want to upgrade.
- Handle projects with multiple versions availabe better (i.e.) python-dateutil with 2.0 for Py3k only, 1.x series for Python 2.x)
View
25 librarywatch/management/commands/check_for_updates.py
@@ -1,6 +1,7 @@
import pip
import xmlrpclib
+from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
'''
@@ -16,15 +17,19 @@
class Command(BaseCommand):
def handle(self, *args, **options):
pypi = xmlrpclib.ServerProxy('http://pypi.python.org/pypi')
- for dist in pip.get_installed_distributions():
- available = pypi.package_releases(dist.project_name)
- if not available:
- # Try to capitalize pkg name
- available = pypi.package_releases(dist.project_name.capitalize())
- try:
- if available[0] != dist.version:
- print '{dist.project_name} ({dist.version} < {available})'.format(dist=dist, available=available[0])
+ ignores = getattr(settings, 'LIBRARYWATCH_IGNORE_VERSIONS', {})
- except IndexError:
- pass
+ for dist in pip.get_installed_distributions():
+ if ignores.get(dist.project_name, '') != '*': # if it's totally ignored, don't even check.
+ available = pypi.package_releases(dist.project_name)
+ if not available:
+ # Try to capitalize pkg name
+ available = pypi.package_releases(dist.project_name.capitalize())
+
+ try:
+ if available[0] != dist.version and available[0] != ignores.get(dist.project_name, ''):
+ print '{dist.project_name} ({dist.version} != {available})'.format(dist=dist, available=available[0])
+
+ except IndexError:
+ print('%s is not available on PyPI.' % dist.project_name)

No commit comments for this range

Something went wrong with that request. Please try again.