Beispiel #1
0
    def test_api_versions_1(self):
        """Check api versions format and order (from oldest to newest)"""

        for i in range(len(api_versions) - 1):
            a = version_from_string(api_versions[i])
            b = version_from_string(api_versions[i + 1])
            self.assertLess(a, b)
Beispiel #2
0
    def test_api_versions_1(self):
        """Check api versions format and order (from oldest to newest)"""

        for i in range(len(api_versions) - 1):
            a = version_from_string(api_versions[i])
            b = version_from_string(api_versions[i+1])
            self.assertLess(a, b)
Beispiel #3
0
    def test_api_versions_1(self):
        "Check api versions format and order (from oldest to newest)"
        from picard import api_versions

        len_api_versions = len(api_versions)
        if len_api_versions > 1:
            for i in xrange(len_api_versions - 1):
                a = version_from_string(api_versions[i])
                b = version_from_string(api_versions[i+1])
                self.assertLess(a, b)
        elif len_api_versions == 1:
            a = version_from_string(api_versions[0])
Beispiel #4
0
    def test_api_versions_1(self):
        "Check api versions format and order (from oldest to newest)"
        from picard import api_versions

        len_api_versions = len(api_versions)
        if len_api_versions > 1:
            for i in xrange(len_api_versions - 1):
                a = version_from_string(api_versions[i])
                b = version_from_string(api_versions[i + 1])
                self.assertLess(a, b)
        elif len_api_versions == 1:
            a = version_from_string(api_versions[0])
Beispiel #5
0
    def __initialize(self):
        """Common initializer method for :meth:`from_app` and
        :meth:`from_file`."""

        # If there are no settings, copy existing settings from old format
        # (registry on windows systems)
        if not self.allKeys():
            oldFormat = QtCore.QSettings(PICARD_ORG_NAME, PICARD_APP_NAME)
            for k in oldFormat.allKeys():
                self.setValue(k, oldFormat.value(k))
            self.sync()

        self.application = ConfigSection(self, "application")
        self.setting = ConfigSection(self, "setting")
        self.persist = ConfigSection(self, "persist")
        self.profile = ConfigSection(self, "profile/default")
        self.current_preset = "default"

        TextOption("application", "version", '0.0.0dev0')
        self._version = version_from_string(self.application["version"])
        self._upgrade_hooks = dict()
        # Save known config names for faster access and to prevent
        # strange cases of Qt locking up when accessing QSettings.allKeys()
        # or QSettings.contains() shortly after having written settings
        # inside threads.
        # See https://tickets.metabrainz.org/browse/PICARD-1590
        self.__known_keys = set(self.allKeys())
Beispiel #6
0
 def register_upgrade_hook(self, to_version_str, func, *args):
     """Register a function to upgrade from one config version to another"""
     to_version = version_from_string(to_version_str)
     assert to_version <= PICARD_VERSION, "%r > %r !!!" % (to_version,
                                                           PICARD_VERSION)
     hook = {'to': to_version, 'func': func, 'args': args, 'done': False}
     self._upgrade_hooks.append(hook)
Beispiel #7
0
 def register_upgrade_hook(self, func, *args):
     """Register a function to upgrade from one config version to another"""
     to_version = version_from_string(func.__name__)
     assert to_version <= PICARD_VERSION, "%r > %r !!!" % (to_version, PICARD_VERSION)
     self._upgrade_hooks[to_version] = {
         'func': func,
         'args': args,
         'done': False
     }
Beispiel #8
0
 def register_upgrade_hook(self, func, *args):
     """Register a function to upgrade from one config version to another"""
     to_version = version_from_string(func.__name__)
     assert to_version <= PICARD_VERSION, "%r > %r !!!" % (to_version, PICARD_VERSION)
     self._upgrade_hooks[to_version] = {
         'func': func,
         'args': args,
         'done': False
     }
Beispiel #9
0
 def register_upgrade_hook(self, to_version_str, func, *args):
     """Register a function to upgrade from one config version to another"""
     to_version = version_from_string(to_version_str)
     assert to_version <= PICARD_VERSION, "%r > %r !!!" % (to_version, PICARD_VERSION)
     hook = {
         'to': to_version,
         'func': func,
         'args': args,
         'done': False
     }
     self._upgrade_hooks.append(hook)
Beispiel #10
0
    def load_plugin(self, name, plugindir):
        try:
            info = imp.find_module(name, [plugindir])
        except ImportError:
            log.error("Failed loading plugin %r", name)
            return None

        plugin = None
        try:
            index = None
            for i, p in enumerate(self.plugins):
                if name == p.module_name:
                    log.warning("Module %r conflict: unregistering previously" \
                              " loaded %r version %s from %r",
                              p.module_name,
                              p.name,
                              p.version,
                              p.file)
                    _unregister_module_extensions(name)
                    index = i
                    break
            plugin_module = imp.load_module(_PLUGIN_MODULE_PREFIX + name,
                                            *info)
            plugin = PluginWrapper(plugin_module, plugindir, file=info[1])
            versions = [
                version_from_string(v) for v in list(plugin.api_versions)
            ]
            compatible_versions = list(set(versions) & self._api_versions)
            if compatible_versions:
                log.debug(
                    "Loading plugin %r version %s, compatible with API: %s",
                    plugin.name, plugin.version, ", ".join([
                        version_to_string(v, short=True)
                        for v in sorted(compatible_versions)
                    ]))
                plugin.compatible = True
                setattr(picard.plugins, name, plugin_module)
                if index:
                    self.plugins[index] = plugin
                else:
                    self.plugins.append(plugin)
            else:
                log.warning("Plugin '%s' from '%s' is not compatible"
                            " with this version of Picard." %
                            (plugin.name, plugin.file))
        except VersionError as e:
            log.error("Plugin %r has an invalid API version string : %s", name,
                      e)
        except:
            log.error("Plugin %r : %s", name, traceback.format_exc())
        if info[0] is not None:
            info[0].close()
        return plugin
Beispiel #11
0
    def __init__(self):
        """Initializes the configuration."""
        QtCore.QSettings.__init__(self, "MusicBrainz", "Picard")
        self.application = ConfigSection(self, "application")
        self.setting = ConfigSection(self, "setting")
        self.persist = ConfigSection(self, "persist")
        self.profile = ConfigSection(self, "profile/default")
        self.current_preset = "default"

        TextOption("application", "version", '0.0.0dev0')
        self._version = version_from_string(self.application["version"])
        self._upgrade_hooks = []
Beispiel #12
0
    def __init__(self):
        """Initializes the configuration."""
        QtCore.QSettings.__init__(self, PICARD_ORG_NAME, PICARD_APP_NAME)
        self.application = ConfigSection(self, "application")
        self.setting = ConfigSection(self, "setting")
        self.persist = ConfigSection(self, "persist")
        self.profile = ConfigSection(self, "profile/default")
        self.current_preset = "default"

        TextOption("application", "version", '0.0.0dev0')
        self._version = version_from_string(self.application["version"])
        self._upgrade_hooks = dict()
Beispiel #13
0
 def test_version_conversion(self):
     versions = (
         ((1, 1, 0, 'final', 0), '1.1.0.final0'),
         ((0, 0, 1, 'dev', 1), '0.0.1.dev1'),
         ((1, 1, 0, 'dev', 0), '1.1.0.dev0'),
         ((999, 999, 999, 'dev', 999), '999.999.999.dev999'),
         ((1, 1, 2, 'alpha', 2), '1.1.2.alpha2'),
         ((1, 1, 2, 'beta', 2), '1.1.2.beta2'),
         ((1, 1, 2, 'rc', 2), '1.1.2.rc2'),
     )
     for l, s in versions:
         self.assertEqual(version_to_string(l), s)
         self.assertEqual(l, version_from_string(s))
Beispiel #14
0
 def test_version_conversion_short(self):
     versions = (
         ((1, 1, 0, 'final', 0), '1.1'),
         ((1, 1, 1, 'final', 0), '1.1.1'),
         ((0, 0, 1, 'dev', 1), '0.0.1.dev1'),
         ((1, 1, 0, 'dev', 0), '1.1.0.dev0'),
         ((1, 1, 2, 'alpha', 2), '1.1.2a2'),
         ((1, 1, 2, 'beta', 2), '1.1.2b2'),
         ((1, 1, 2, 'rc', 2), '1.1.2rc2'),
     )
     for l, s in versions:
         self.assertEqual(version_to_string(l, short=True), s)
         self.assertEqual(l, version_from_string(s))
Beispiel #15
0
    def load_plugin(self, name, plugindir):
        try:
            info = imp.find_module(name, [plugindir])
        except ImportError:
            log.error("Failed loading plugin %r", name)
            return None

        plugin = None
        try:
            index = None
            for i, p in enumerate(self.plugins):
                if name == p.module_name:
                    log.warning("Module %r conflict: unregistering previously" \
                              " loaded %r version %s from %r",
                              p.module_name,
                              p.name,
                              p.version,
                              p.file)
                    _unregister_module_extensions(name)
                    index = i
                    break
            plugin_module = imp.load_module(_PLUGIN_MODULE_PREFIX + name, *info)
            plugin = PluginWrapper(plugin_module, plugindir, file=info[1])
            versions = [version_from_string(v) for v in
                        list(plugin.api_versions)]
            compatible_versions = list(set(versions) & self._api_versions)
            if compatible_versions:
                log.debug("Loading plugin %r version %s, compatible with API: %s",
                          plugin.name,
                          plugin.version,
                          ", ".join([version_to_string(v, short=True) for v in
                                     sorted(compatible_versions)]))
                plugin.compatible = True
                setattr(picard.plugins, name, plugin_module)
                if index is not None:
                    self.plugins[index] = plugin
                else:
                    self.plugins.append(plugin)
            else:
                log.warning("Plugin '%s' from '%s' is not compatible"
                            " with this version of Picard."
                            % (plugin.name, plugin.file))
        except VersionError as e:
            log.error("Plugin %r has an invalid API version string : %s", name, e)
        except:
            log.error("Plugin %r : %s", name, traceback.format_exc())
        if info[0] is not None:
            info[0].close()
        return plugin
Beispiel #16
0
    def test_compatible_api_version(self):

        # use first element from picard.api_versions, it should be compatible
        api_versions = picard.api_versions[:1]
        expected = set([version_from_string(v) for v in api_versions])
        result = _compatible_api_versions(api_versions)
        self.assertEqual(result, expected)

        # pretty sure 0.0 isn't compatible
        api_versions = ["0.0"]
        expected = set()
        result = _compatible_api_versions(api_versions)
        self.assertEqual(result, expected)

        # buggy version
        api_versions = ["0.a"]
        with self.assertRaises(VersionError):
            result = _compatible_api_versions(api_versions)
Beispiel #17
0
    def __initialize(self):
        """Common initializer method for :meth:`from_app` and
        :meth:`from_file`."""

        self.application = ConfigSection(self, "application")
        self.setting = ConfigSection(self, "setting")
        self.persist = ConfigSection(self, "persist")
        self.profile = ConfigSection(self, "profile/default")
        self.current_preset = "default"

        TextOption("application", "version", '0.0.0dev0')
        self._version = version_from_string(self.application["version"])
        self._upgrade_hooks = dict()
        # Save known config names for faster access and to prevent
        # strange cases of Qt locking up when accessing QSettings.allKeys()
        # or QSettings.contains() shortly after having written settings
        # inside threads.
        # See https://tickets.metabrainz.org/browse/PICARD-1590
        self.__known_keys = set(self.allKeys())
Beispiel #18
0
    def __initialize(self):
        """Common initializer method for :meth:`from_app` and
        :meth:`from_file`."""

        # If there are no settings, copy existing settings from old format
        # (registry on windows systems)
        if not self.allKeys():
            oldFormat = QtCore.QSettings(PICARD_ORG_NAME, PICARD_APP_NAME)
            for k in oldFormat.allKeys():
                self.setValue(k, oldFormat.value(k))
            self.sync()

        self.application = ConfigSection(self, "application")
        self.setting = ConfigSection(self, "setting")
        self.persist = ConfigSection(self, "persist")
        self.profile = ConfigSection(self, "profile/default")
        self.current_preset = "default"

        TextOption("application", "version", '0.0.0dev0')
        self._version = version_from_string(self.application["version"])
        self._upgrade_hooks = dict()
Beispiel #19
0
    def __initialize(self):
        """Common initializer method for :meth:`from_app` and
        :meth:`from_file`."""

        # If there are no settings, copy existing settings from old format
        # (registry on windows systems)
        if not self.allKeys():
            oldFormat = QtCore.QSettings(PICARD_ORG_NAME, PICARD_APP_NAME)
            for k in oldFormat.allKeys():
                self.setValue(k, oldFormat.value(k))
            self.sync()

        self.application = ConfigSection(self, "application")
        self.setting = ConfigSection(self, "setting")
        self.persist = ConfigSection(self, "persist")
        self.profile = ConfigSection(self, "profile/default")
        self.current_preset = "default"

        TextOption("application", "version", '0.0.0dev0')
        self._version = version_from_string(self.application["version"])
        self._upgrade_hooks = dict()
Beispiel #20
0
    def __init__(self, app):
        """Initializes the configuration."""

        QtCore.QSettings.__init__(self, QtCore.QSettings.IniFormat,
                                  QtCore.QSettings.UserScope, PICARD_ORG_NAME, PICARD_APP_NAME, app)
        # If there are no settings, copy existing settings from old format
        # (registry on windows systems)
        if not self.allKeys():
            oldFormat = QtCore.QSettings(PICARD_ORG_NAME, PICARD_APP_NAME)
            for k in oldFormat.allKeys():
                self.setValue(k, oldFormat.value(k))
            self.sync()

        self.application = ConfigSection(self, "application")
        self.setting = ConfigSection(self, "setting")
        self.persist = ConfigSection(self, "persist")
        self.profile = ConfigSection(self, "profile/default")
        self.current_preset = "default"

        TextOption("application", "version", '0.0.0dev0')
        self._version = version_from_string(self.application["version"])
        self._upgrade_hooks = dict()
Beispiel #21
0
    def __init__(self, app):
        """Initializes the configuration."""

        QtCore.QSettings.__init__(self, QtCore.QSettings.IniFormat,
                                  QtCore.QSettings.UserScope, PICARD_ORG_NAME,
                                  PICARD_APP_NAME, app)
        # If there are no settings, copy existing settings from old format
        # (registry on windows systems)
        if not self.allKeys():
            oldFormat = QtCore.QSettings(PICARD_ORG_NAME, PICARD_APP_NAME)
            for k in oldFormat.allKeys():
                self.setValue(k, oldFormat.value(k))
            self.sync()

        self.application = ConfigSection(self, "application")
        self.setting = ConfigSection(self, "setting")
        self.persist = ConfigSection(self, "persist")
        self.profile = ConfigSection(self, "profile/default")
        self.current_preset = "default"

        TextOption("application", "version", '0.0.0dev0')
        self._version = version_from_string(self.application["version"])
        self._upgrade_hooks = dict()
Beispiel #22
0
 def test_version_single_digit(self):
     l, s = (2, 0, 0, 'final', 0), '2'
     self.assertEqual(l, version_from_string(s))
     self.assertEqual(l, Version(2))
Beispiel #23
0
def _compatible_api_versions(api_versions):
    versions = [version_from_string(v) for v in list(api_versions)]
    return set(versions) & set(picard.api_versions_tuple)
Beispiel #24
0
 def __init__(self):
     super().__init__()
     self.plugins = []
     self._api_versions = set(
         [version_from_string(v) for v in picard.api_versions])
     self._available_plugins = {}
Beispiel #25
0
 def test_version_conv_18(self):
     l, s = (1, 1, 0, 'final', 0), '1.1'
     self.assertEqual(version_to_string(l, short=True), s)
     self.assertEqual(l, version_from_string(s))
Beispiel #26
0
 def _compatible_api_versions(self, api_versions):
     versions = [version_from_string(v) for v in list(api_versions)]
     return set(versions) & self._api_versions
Beispiel #27
0
 def test_version_conv_2(self):
     l, s = (1, 1, 0, 'final', 0), '1.1.0final0'
     self.assertEqual(version_to_string(l), s)
     self.assertEqual(l, version_from_string(s))
Beispiel #28
0
 def test_version_conv_13(self):
     l, s = (1, 1, 0, 'dev', 0), 'anything_28_1_1_0_dev_0'
     self.assertEqual(l, version_from_string(s))
Beispiel #29
0
 def __init__(self):
     QtCore.QObject.__init__(self)
     self.plugins = []
     self._api_versions = set(
         [version_from_string(v) for v in picard.api_versions])
     self._available_plugins = {}
Beispiel #30
0
 def test_version_conv_1(self):
     l, s = (0, 0, 1, 'dev', 1), '0.0.1.dev1'
     r = '0.0.1.dev1'
     self.assertEqual(version_to_string(l), s)
     self.assertEqual(l, version_from_string(s))
     self.assertEqual(l, version_from_string(r))
Beispiel #31
0
 def __init__(self):
     super().__init__()
     self.plugins = []
     self._api_versions = set([version_from_string(v) for v in picard.api_versions])
     self._available_plugins = None  # None=never loaded, [] = empty
Beispiel #32
0
 def test_version_conv_18(self):
     l, s = (1, 1, 0, 'final', 0), '1.1'
     self.assertEqual(version_to_string(l, short=True), s)
     self.assertEqual(l, version_from_string(s))
Beispiel #33
0
 def test_version_conv_13(self):
     l, s = (1, 1, 0, 'dev', 0), 'anything_28_1_1_0_dev_0'
     self.assertEqual(l, version_from_string(s))
Beispiel #34
0
    def load_plugin(self, name, plugindir):
        module_file = None
        (importer, module_name, manifest_data) = zip_import(os.path.join(plugindir, name))
        if importer:
            name = module_name
            if not importer.find_module(name):
                error = _("Failed loading zipped plugin %r") % name
                self.plugin_error(name, error)
                return None
            module_pathname = importer.get_filename(name)
        else:
            try:
                info = imp.find_module(name, [plugindir])
                module_file = info[0]
                module_pathname = info[1]
            except ImportError:
                error = _("Failed loading plugin %r") % name
                self.plugin_error(name, error)
                return None

        plugin = None
        try:
            index = None
            for i, p in enumerate(self.plugins):
                if name == p.module_name:
                    log.warning("Module %r conflict: unregistering previously"
                                " loaded %r version %s from %r",
                                p.module_name,
                                p.name,
                                p.version,
                                p.file)
                    _unregister_module_extensions(name)
                    index = i
                    break
            if not importer:
                plugin_module = imp.load_module(_PLUGIN_MODULE_PREFIX + name, *info)
            else:
                plugin_module = importer.load_module(_PLUGIN_MODULE_PREFIX + name)
            plugin = PluginWrapper(plugin_module, plugindir,
                                   file=module_pathname, manifest_data=manifest_data)
            versions = [version_from_string(v) for v in
                        list(plugin.api_versions)]
            compatible_versions = list(set(versions) & self._api_versions)
            if compatible_versions:
                log.debug("Loading plugin %r version %s, compatible with API: %s",
                          plugin.name,
                          plugin.version,
                          ", ".join([version_to_string(v, short=True) for v in
                                     sorted(compatible_versions)]))
                plugin.compatible = True
                setattr(picard.plugins, name, plugin_module)
                if index is not None:
                    self.plugins[index] = plugin
                else:
                    self.plugins.append(plugin)
            else:
                error = _("Plugin '%s' from '%s' is not compatible with this "
                          "version of Picard.") % (plugin.name, plugin.file)
                self.plugin_error(plugin.name, error, log_func=log.warning)
        except VersionError as e:
            error = _("Plugin %r has an invalid API version string : %s") % (name, e)
            self.plugin_error(name, error)
        except BaseException:
            error = _("Plugin %r : %s") % (name, traceback.format_exc())
            self.plugin_error(name, error)
        if module_file is not None:
            module_file.close()
        return plugin
Beispiel #35
0
 def test_version_conv_3(self):
     l, s = (1, 1, 0, 'dev', 0), '1.1.0dev0'
     self.assertEqual(version_to_string(l), s)
     self.assertEqual(l, version_from_string(s))
Beispiel #36
0
def _compatible_api_versions(api_versions):
    versions = [version_from_string(v) for v in list(api_versions)]
    return set(versions) & set(picard.api_versions_tuple)
Beispiel #37
0
 def test_version_conv_3(self):
     l, s = (1, 1, 0, 'dev', 0), '1.1.0.dev0'
     r = '1.1.0.dev0'
     self.assertEqual(version_to_string(l), s)
     self.assertEqual(l, version_from_string(s))
     self.assertEqual(l, version_from_string(r))
Beispiel #38
0
 def __init__(self):
     super().__init__()
     self.plugins = []
     self._api_versions = set(
         [version_from_string(v) for v in picard.api_versions])
     self._available_plugins = None  #  None=never loaded, [] = empty
Beispiel #39
0
 def test_version_conv_1(self):
     l, s = (0, 0, 1, 'dev', 1), '0.0.1dev1'
     self.assertEqual(version_to_string(l), s)
     self.assertEqual(l, version_from_string(s))
Beispiel #40
0
 def register_upgrade_hook(self, to_version_str, func, *args):
     """Register a function to upgrade from one config version to another"""
     to_version = version_from_string(to_version_str)
     assert to_version <= PICARD_VERSION, "%r > %r !!!" % (to_version, PICARD_VERSION)
     hook = {"to": to_version, "func": func, "args": args, "done": False}
     self._upgrade_hooks.append(hook)
Beispiel #41
0
    def load_plugin(self, name, plugindir):
        module_file = None
        (importer, module_name,
         manifest_data) = zip_import(os.path.join(plugindir, name))
        if importer:
            name = module_name
            if not importer.find_module(name):
                error = _("Failed loading zipped plugin %r") % name
                self.plugin_error(name, error)
                return None
            module_pathname = importer.get_filename(name)
        else:
            try:
                info = imp.find_module(name, [plugindir])
                module_file = info[0]
                module_pathname = info[1]
            except ImportError:
                error = _("Failed loading plugin %r") % name
                self.plugin_error(name, error)
                return None

        plugin = None
        try:
            index = None
            for i, p in enumerate(self.plugins):
                if name == p.module_name:
                    log.warning(
                        "Module %r conflict: unregistering previously"
                        " loaded %r version %s from %r", p.module_name, p.name,
                        p.version, p.file)
                    _unregister_module_extensions(name)
                    index = i
                    break
            if not importer:
                plugin_module = imp.load_module(_PLUGIN_MODULE_PREFIX + name,
                                                *info)
            else:
                plugin_module = importer.load_module(_PLUGIN_MODULE_PREFIX +
                                                     name)
            plugin = PluginWrapper(plugin_module,
                                   plugindir,
                                   file=module_pathname,
                                   manifest_data=manifest_data)
            versions = [
                version_from_string(v) for v in list(plugin.api_versions)
            ]
            compatible_versions = list(set(versions) & self._api_versions)
            if compatible_versions:
                log.debug(
                    "Loading plugin %r version %s, compatible with API: %s",
                    plugin.name, plugin.version, ", ".join([
                        version_to_string(v, short=True)
                        for v in sorted(compatible_versions)
                    ]))
                plugin.compatible = True
                setattr(picard.plugins, name, plugin_module)
                if index is not None:
                    self.plugins[index] = plugin
                else:
                    self.plugins.append(plugin)
            else:
                error = _("Plugin '%s' from '%s' is not compatible with this "
                          "version of Picard.") % (plugin.name, plugin.file)
                self.plugin_error(plugin.name, error, log_func=log.warning)
        except VersionError as e:
            error = _("Plugin %r has an invalid API version string : %s") % (
                name, e)
            self.plugin_error(name, error)
        except:
            error = _("Plugin %r : %s") % (name, traceback.format_exc())
            self.plugin_error(name, error)
        if module_file is not None:
            module_file.close()
        return plugin
Beispiel #42
0
 def test_version_conv_2(self):
     l, s = (1, 1, 0, 'final', 0), '1.1.0.final0'
     r = '1.1.0.final0'
     self.assertEqual(version_to_string(l), s)
     self.assertEqual(l, version_from_string(s))
     self.assertEqual(l, version_from_string(r))
Beispiel #43
0
 def test_version_conv_15(self):
     l, s = (1, 1, 0, 'final', 0), 'anything_28_1_1_0'
     self.assertEqual(l, version_from_string(s))
Beispiel #44
0
 def test_version_conv_5(self):
     l, s = (999, 999, 999, 'dev', 999), '999.999.999.dev999'
     r = '999.999.999dev999'
     self.assertEqual(version_to_string(l), s)
     self.assertEqual(l, version_from_string(s))
     self.assertEqual(l, version_from_string(r))
Beispiel #45
0
 def test_version_from_string_underscores(self):
     l, s = (1, 1, 0, 'dev', 0), '1_1_0_dev_0'
     self.assertEqual(l, version_from_string(s))
Beispiel #46
0
 def test_version_conv_15(self):
     l, s = (1, 1, 0, 'final', 0), 'anything_28_1_1_0'
     self.assertEqual(l, version_from_string(s))
Beispiel #47
0
 def __init__(self):
     QtCore.QObject.__init__(self)
     self.plugins = []
     self._api_versions = set([version_from_string(v) for v in picard.api_versions])
Beispiel #48
0
 def test_version_conv_5(self):
     l, s = (999, 999, 999, 'dev', 999), '999.999.999dev999'
     self.assertEqual(version_to_string(l), s)
     self.assertEqual(l, version_from_string(s))
Beispiel #49
0
 def _compatible_api_versions(self, api_versions):
     versions = [version_from_string(v) for v in list(api_versions)]
     return set(versions) & self._api_versions