I think distutils.version.LooseVersion should be safe to use (django-cms is using it, for example). Not sure about "packaging". Do you want to create a Trac ticket for this issue? Probably the same technique could also be used in other places.
On Friday, February 10, 2017 at 5:58:29 AM UTC-5, not...@gmail.com wrote: > > Hi ! > > psycopg2 is preparing a new release, and currently the git project uses PEP > 440 <https://www.python.org/dev/peps/pep-0440/>-compatible version > numbers : 2.7b1, 2.7b2.dev0 (see > https://github.com/psycopg/psycopg2/blob/master/setup.py#L67) > > In > https://github.com/django/django/blob/master/django/db/backends/postgresql/base.py, > > django parses that version string to check if it is greater than 2.4.5. > > But the psycopg2_version function can't handle version strings like 2.7b1, > and returns (2,). > > Any ideas to improve django ? > > The "packaging" package could be used for that : > https://packaging.pypa.io/en/latest/version/, a correct version parser > does not seem simple ! > Or "from distutils.version import LooseVersion" > > Thanks, > NotSqrt > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/78fa0a7b-dbeb-48fc-8c25-799e174c8373%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.