Commit 57f20282 authored by Shane Hathaway's avatar Shane Hathaway

Updated for clarity.

parent 559e24e0
...@@ -3,36 +3,43 @@ from version_txt import getZopeVersion ...@@ -3,36 +3,43 @@ from version_txt import getZopeVersion
from zLOG import LOG, INFO, WARNING from zLOG import LOG, INFO, WARNING
merged_hotfixes = { merged_hotfixes = {
'Hotfix_2001-09-28': 1
} }
APPLY = 1
ALREADY_MERGED = 0
OUTDATED_ZOPE = None
def isMerged(name): def isMerged(name):
return merged_hotfixes.get(name, 0) return merged_hotfixes.get(name, 0)
def logHotfix(id, apply_hotfix): def logHotfix(id, apply_hotfix):
if apply_hotfix > 0: if apply_hotfix:
LOG('Hotfixes', INFO, 'Applying %s' % id) LOG('Hotfixes', INFO, 'Applying %s' % id)
elif apply_hotfix < 0: elif apply_hotfix is OUTDATED_ZOPE:
LOG('Hotfixes', WARNING, 'Not applying %s. It is not designed for ' LOG('Hotfixes', WARNING, 'Not applying %s. It is not designed for '
'this version of Zope. Please uninstall the hotfix product.' 'this version of Zope. Please uninstall the hotfix product.'
% id) % id)
else: else: # ALREADY_MERGED
LOG('Hotfixes', WARNING, 'Not applying %s. The fix has already been ' LOG('Hotfixes', WARNING, 'Not applying %s. The fix has already been '
'merged into Zope. Please uninstall the hotfix product.' 'merged into Zope. Please uninstall the hotfix product.'
% id) % id)
def beforeApplyHotfix(id, req_major, req_minor, req_micro): def beforeApplyHotfix(id, req_major, req_minor, req_micro):
apply_hotfix = 0
major, minor, micro = getZopeVersion()[:3] major, minor, micro = getZopeVersion()[:3]
if major > 0 and ( if major > 0 and (
(major * 10000 + minor * 100 + micro) < (major * 10000 + minor * 100 + micro) <
(req_major * 10000 + req_minor * 100 + req_micro)): (req_major * 10000 + req_minor * 100 + req_micro)):
# The version of Zope is too old for this hotfix. # The version of Zope is too old for this hotfix.
apply_hotfix = -1 apply_hotfix = OUTDATED_ZOPE
elif not isMerged(id): elif isMerged(id):
apply_hotfix = 1 apply_hotfix = ALREADY_MERGED
else:
apply_hotfix = APPLY
logHotfix(id, apply_hotfix) logHotfix(id, apply_hotfix)
return apply_hotfix return apply_hotfix
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment