Allow 2-point versions <= gramps version; added ERROR to print statements
svn: r14315
This commit is contained in:
parent
7f83507654
commit
49823df7fe
@ -130,6 +130,25 @@ TOOL_MODES = [TOOL_MODE_GUI, TOOL_MODE_CLI]
|
|||||||
START = 1
|
START = 1
|
||||||
END = 2
|
END = 2
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# Functions and classes
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
def valid_plugin_version(plugin_version_string):
|
||||||
|
"""
|
||||||
|
Checks to see if string is a valid version string for this version
|
||||||
|
of Gramps.
|
||||||
|
"""
|
||||||
|
dots = plugin_version_string.count(".")
|
||||||
|
if dots == 1:
|
||||||
|
plugin_version = [int(n) for n in plugin_version_string.split(".", 1)]
|
||||||
|
return tuple(plugin_version) == (VERSION_TUPLE[0], VERSION_TUPLE[1])
|
||||||
|
elif dots == 2:
|
||||||
|
plugin_version = [int(n) for n in plugin_version_string.split(".", 2)]
|
||||||
|
return tuple(plugin_version) <= VERSION_TUPLE
|
||||||
|
return False
|
||||||
|
|
||||||
class PluginData(object):
|
class PluginData(object):
|
||||||
"""
|
"""
|
||||||
This is the base class for all plugin data objects.
|
This is the base class for all plugin data objects.
|
||||||
@ -922,12 +941,12 @@ class PluginRegister(object):
|
|||||||
make_environment(_=local_gettext),
|
make_environment(_=local_gettext),
|
||||||
{})
|
{})
|
||||||
except ValueError, msg:
|
except ValueError, msg:
|
||||||
print _('Failed reading plugin registration %(filename)s') % \
|
print _('ERROR: Failed reading plugin registration %(filename)s') % \
|
||||||
{'filename' : filename}
|
{'filename' : filename}
|
||||||
print msg
|
print msg
|
||||||
self.__plugindata = self.__plugindata[:lenpd]
|
self.__plugindata = self.__plugindata[:lenpd]
|
||||||
except:
|
except:
|
||||||
print _('Failed reading plugin registration %(filename)s') % \
|
print _('ERROR: Failed reading plugin registration %(filename)s') % \
|
||||||
{'filename' : filename}
|
{'filename' : filename}
|
||||||
print "".join(traceback.format_exception(*sys.exc_info()))
|
print "".join(traceback.format_exception(*sys.exc_info()))
|
||||||
self.__plugindata = self.__plugindata[:lenpd]
|
self.__plugindata = self.__plugindata[:lenpd]
|
||||||
@ -937,16 +956,15 @@ class PluginRegister(object):
|
|||||||
# 3. TOOL_DEBUG only if __debug__ True
|
# 3. TOOL_DEBUG only if __debug__ True
|
||||||
rmlist = []
|
rmlist = []
|
||||||
ind = lenpd-1
|
ind = lenpd-1
|
||||||
GRAMPS_VERSION = "%s.%s" % (VERSION_TUPLE[0], VERSION_TUPLE[1])
|
|
||||||
for plugin in self.__plugindata[lenpd:]:
|
for plugin in self.__plugindata[lenpd:]:
|
||||||
ind += 1
|
ind += 1
|
||||||
plugin.directory = dir
|
plugin.directory = dir
|
||||||
if plugin.gramps_target_version != GRAMPS_VERSION:
|
if not valid_plugin_version(plugin.gramps_target_version):
|
||||||
print _('Plugin file %(filename)s is wrong version: '
|
print _('ERROR: Plugin file %(filename)s has a version of '
|
||||||
'should be "%(gramps_version)s" but is actually '
|
'"%(gramps_target_version)s" which is invalid for Gramps '
|
||||||
'"%(gramps_target_version)s".' %
|
'"%(gramps_version)s".' %
|
||||||
{'filename': os.path.join(dir, plugin.fname),
|
{'filename': os.path.join(dir, plugin.fname),
|
||||||
'gramps_version': GRAMPS_VERSION,
|
'gramps_version': GRAMPSVERSION,
|
||||||
'gramps_target_version': plugin.gramps_target_version,}
|
'gramps_target_version': plugin.gramps_target_version,}
|
||||||
)
|
)
|
||||||
rmlist.append(ind)
|
rmlist.append(ind)
|
||||||
@ -961,7 +979,7 @@ class PluginRegister(object):
|
|||||||
match = pymod.match(plugin.fname)
|
match = pymod.match(plugin.fname)
|
||||||
if not match:
|
if not match:
|
||||||
rmlist.append(ind)
|
rmlist.append(ind)
|
||||||
print _('Wrong python file %(filename)s in register file '
|
print _('ERROR: Wrong python file %(filename)s in register file '
|
||||||
'%(regfile)s') % {
|
'%(regfile)s') % {
|
||||||
'filename': os.path.join(dir, plugin.fname),
|
'filename': os.path.join(dir, plugin.fname),
|
||||||
'regfile': os.path.join(dir, filename)
|
'regfile': os.path.join(dir, filename)
|
||||||
@ -969,7 +987,7 @@ class PluginRegister(object):
|
|||||||
continue
|
continue
|
||||||
if not os.path.isfile(os.path.join(dir, plugin.fname)):
|
if not os.path.isfile(os.path.join(dir, plugin.fname)):
|
||||||
rmlist.append(ind)
|
rmlist.append(ind)
|
||||||
print _('Python file %(filename)s in register file '
|
print _('ERROR: Python file %(filename)s in register file '
|
||||||
'%(regfile)s does not exist') % {
|
'%(regfile)s does not exist') % {
|
||||||
'filename': os.path.join(dir, plugin.fname),
|
'filename': os.path.join(dir, plugin.fname),
|
||||||
'regfile': os.path.join(dir, filename)
|
'regfile': os.path.join(dir, filename)
|
||||||
|
Loading…
Reference in New Issue
Block a user