How to use the distutils2.version.NormalizedVersion function in Distutils2

To help you get started, we’ve selected a few Distutils2 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github domogik / domogik / src / domogik / install / upgrade.py View on Github external
def get_new_app_version(self):
        """Return the version of the application we should upgrade to (normalized version)"""
        return NormalizedVersion(self._suggest_normalized_version(__version__))
github domogik / domogik / src / domogik / install / upgrade.py View on Github external
def get_current_db_version(self):
        """Return the current version of the database"""
        db_version = self._sql_execute("SELECT db_version FROM core_system_info").fetchone()[0]
        if db_version is None or db_version == '':
            # Should only happen for the first upgrade using this script
            return NormalizedVersion('0.1.0')
        else:
            return NormalizedVersion(self._suggest_normalized_version(db_version))
github domogik / domogik / src / domogik / install / upgrade.py View on Github external
def get_current_app_version(self):
        """Return the current version of the application"""
        try:
            
            app_version = self._sql_execute("SELECT app_version FROM core_system_info").fetchone()[0]
            # Should only happen if the 'app_version' column doesn't exist (first application upgrade using this script)
            if app_version is None or app_version == '':
                app_version = NormalizedVersion('0.1.0')
            return NormalizedVersion(self._suggest_normalized_version(app_version))
        except Exception:
            return NormalizedVersion('0.1.0')
github domogik / domogik / src / domogik / install / upgrade_scripts.py View on Github external
def app_upgrade(upgrade_instance):
    """Eventually upgrade the application (depending on the current version number)

    @param upgrade_instance : instance of the Upgrade object    
    @return true if an upgrade was done
    
    """
    old_app_version = upgrade_instance.get_current_app_version()
    new_app_version = upgrade_instance.get_new_app_version()
    if new_app_version == NormalizedVersion('0.2.0'):
        if old_app_version == NormalizedVersion('0.1.0'):
            _upgrade_app_from_0_1_0_to_0_2_0(upgrade_instance)
            return True

    return False
github domogik / domogik / src / domogik / install / upgrade.py View on Github external
def get_current_app_version(self):
        """Return the current version of the application"""
        try:
            
            app_version = self._sql_execute("SELECT app_version FROM core_system_info").fetchone()[0]
            # Should only happen if the 'app_version' column doesn't exist (first application upgrade using this script)
            if app_version is None or app_version == '':
                app_version = NormalizedVersion('0.1.0')
            return NormalizedVersion(self._suggest_normalized_version(app_version))
        except Exception:
            return NormalizedVersion('0.1.0')
github domogik / domogik / src / domogik / install / upgrade.py View on Github external
def get_current_db_version(self):
        """Return the current version of the database"""
        db_version = self._sql_execute("SELECT db_version FROM core_system_info").fetchone()[0]
        if db_version is None or db_version == '':
            # Should only happen for the first upgrade using this script
            return NormalizedVersion('0.1.0')
        else:
            return NormalizedVersion(self._suggest_normalized_version(db_version))
github domogik / domogik / src / domogik / install / upgrade.py View on Github external
def get_new_db_version(self):
        """Return the version of the database we should upgrade to (normalized version)"""
        return NormalizedVersion(self._suggest_normalized_version(DB_VERSION))