How to use the distutils2.util.strtobool 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 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)