yuppie schreef op 26-03-15 om 13:32:
Maurits van Rees wrote:
1. In January yuppie did a fix on GenericSetup trunk (r130476), which
deserves a release, as it fixes upgrade step sort order with setuptools
8 and higher. Thank you, yuppie!
my fix was just a quick and dirty solution relying on legacy code in
2. But I just created a branch (maurits-versions-setuptools) with a
minor fix for that fix, which deserves another pair of eyes. It avoids
a warning by pkg_resources.
Your refactoring looks fine.
The code is still a bit hard to read because we convert versions
backwards and forwards: UpgradeEntity.__init__ converts '*' to None and
other strings to tuples, but we no longer use None or tuples. We convert
them back to strings. Is there any third party code that depends on the
There will be upgrade steps that have '*' as source of course.
Looking at the code of a standard Plone 4.3 site plus a few add-ons, the
GenericSetup normalize_version function is only used in
Products/CMFPlone/browser/admin.py, which is where I first noticed the
wrong sort order that we are trying to solve here. normalize_version is
used to show the Plone version of the database and the version of the
software, and it compares them to see if any upgrades need to be done.
It shows up just fine. Tests for that part work fine too.
I could rename the functions that I introduce in this change
(version_matches_all and version_matches) to start with an underscore,
to indicate that third party code should not rely on it. It won't stop
anyone, but seems good to me. Done on that branch.
Maurits van Rees: http://maurits.vanrees.org/
Zest Software: http://zestsoftware.nl
Zope-CMF maillist - Zope-CMF@zope.org
See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests