How to use Distutils2 - 10 common examples

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 spacetelescope / PyFITS / pyfits_setuphook.py View on Github external
except ImportError:
        # It's virtually impossible to automatically install numpy through
        # setuptools; I've tried.  It's not pretty.
        # Besides, we don't want users complaining that our software doesn't
        # work just because numpy didn't build on their system.
        sys.stderr.write('\n\nNumpy is required to build this package.\n'
                         'Please install Numpy on your system first.\n\n')
        sys.exit(1)

    includes = [numpy.get_include(), numpy.get_numarray_include()]
    for section in config:
        if not section.startswith('extension='):
            continue
        options = config[section]
        key = 'requires_numpy'
        if key in options and strtobool(options[key]):
            del options[key]
            if 'include_dirs' in options:
                option = options['include_dirs']
                for include in includes:
                    if include not in option:
                        # Have to manipulate the option as a raw string, as it
                        # has not been split into a list at this point
                        option += '\n' + include
                options['include_dirs'] = option
            else:
                options['include_dirs'] = '\n'.join(includes)
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))
github mongolab / mongoctl / mongoctl / mongodb_version.py View on Github external
def is_valid_version(version_number):
    return suggest_normalized_version(version_number) is not None
github johncosta / private-readthedocs.org / readthedocs / projects / utils.py View on Github external
def mkversion(version_obj):
    try:
        if hasattr(version_obj, 'slug'):
            ver =  NormalizedVersion(suggest_normalized_version(version_obj.slug))
        else:
            ver =  NormalizedVersion(suggest_normalized_version(version_obj['slug']))
        return ver
    except TypeError:
        return None