Exemplo n.º 1
0
def get_extensions():
    # 'numpy' will be replaced with the proper path to the numpy includes
    cfg = setup_helpers.DistutilsExtensionArgs()
    cfg['include_dirs'].append('numpy')
    cfg['sources'].extend(
        os.path.relpath(fname) for fname in
        glob(os.path.join(os.path.dirname(__file__), 'src', '*.c')))

    if not setup_helpers.use_system_library('cfitsio'):
        if setup_helpers.get_compiler_option() == 'msvc':
            # These come from the CFITSIO vcc makefile
            cfg['extra_compile_args'].extend([
                    '/D', '"WIN32"',
                    '/D', '"_WINDOWS"',
                    '/D', '"_MBCS"',
                    '/D', '"_USRDLL"',
                    '/D', '"_CRT_SECURE_NO_DEPRECATE"'])
        else:
            # All of these switches are to silence warnings from compiling CFITSIO
            cfg['extra_compile_args'].extend([
                '-Wno-unused-variable', '-Wno-parentheses',
                '-Wno-uninitialized', '-Wno-format', '-Wno-strict-prototypes',
                '-Wno-unused', '-Wno-comments', '-Wno-switch'])

        cfitsio_path = os.path.join('cextern', 'cfitsio')
        cfitsio_files = glob(os.path.join(cfitsio_path, '*.c'))
        cfg['include_dirs'].append(cfitsio_path)
        cfg['sources'].extend(cfitsio_files)
    else:
        cfg.update(setup_helpers.pkg_config(['cfitsio'], ['cfitsio']))

    return [Extension('astropy.io.fits.compression', **cfg)]
Exemplo n.º 2
0
def get_extensions():
    # 'numpy' will be replaced with the proper path to the numpy includes
    cfg = setup_helpers.DistutilsExtensionArgs()
    cfg['include_dirs'].append('numpy')
    cfg['sources'].extend(
        os.path.relpath(fname) for fname in glob(
            os.path.join(os.path.dirname(__file__), 'src', '*.c')))

    if not setup_helpers.use_system_library('cfitsio'):
        if setup_helpers.get_compiler_option() == 'msvc':
            # These come from the CFITSIO vcc makefile
            cfg['extra_compile_args'].extend([
                '/D', '"WIN32"', '/D', '"_WINDOWS"', '/D', '"_MBCS"', '/D',
                '"_USRDLL"', '/D', '"_CRT_SECURE_NO_DEPRECATE"'
            ])
        else:
            # All of these switches are to silence warnings from compiling CFITSIO
            cfg['extra_compile_args'].extend([
                '-Wno-unused-variable', '-Wno-parentheses',
                '-Wno-uninitialized', '-Wno-format', '-Wno-strict-prototypes',
                '-Wno-unused', '-Wno-comments', '-Wno-switch'
            ])

        cfitsio_path = os.path.join('cextern', 'cfitsio')
        cfitsio_files = glob(os.path.join(cfitsio_path, '*.c'))
        cfg['include_dirs'].append(cfitsio_path)
        cfg['sources'].extend(cfitsio_files)
    else:
        cfg.update(setup_helpers.pkg_config(['cfitsio'], ['cfitsio']))

    return [Extension('astropy.io.fits.compression', **cfg)]
Exemplo n.º 3
0
def get_extensions():
    if setup_helpers.get_compiler_option() != 'msvc':
        extra_compile_args = ['-Wno-unused-function',
                              '-Wno-strict-prototypes']
    else:
        extra_compile_args = []
    return [
        Extension(
            'astropy.io.fits.compression',
            [os.path.relpath(x) for x in
             glob(os.path.join(os.path.dirname(__file__), 'src/*.c'))],
            include_dirs=['numpy'],  # Will be replaced with the proper path
            extra_compile_args=extra_compile_args)
    ]
Exemplo n.º 4
0
def get_extensions():
    # 'numpy' will be replaced with the proper path to the numpy includes
    include_dirs = ['numpy']
    library_dirs = []
    libraries = []
    source_files = [os.path.relpath(fname) for fname in
                    glob(os.path.join(os.path.dirname(__file__),
                                      'src', '*.c'))]
    extra_compile_args = []

    if not setup_helpers.use_system_library('cfitsio'):
        if setup_helpers.get_compiler_option() == 'msvc':
            # These come from the CFITSIO vcc makefile
            extra_compile_args = [
                    '/D', '"WIN32"',
                    '/D', '"_WINDOWS"',
                    '/D', '"_MBCS"',
                    '/D', '"_USRDLL"',
                    '/D', '"_CRT_SECURE_NO_DEPRECATE"']
        else:
            # All of these switches are to silence warnings from compiling CFITSIO
            extra_compile_args = ['-Wno-unused-variable', '-Wno-parentheses',
                                  '-Wno-uninitialized', '-Wno-format',
                                  '-Wno-strict-prototypes', '-Wno-unused',
                                  '-Wno-comments', '-Wno-switch']

        cfitsio_path = os.path.join('cextern', 'cfitsio')
        cfitsio_files = glob(os.path.join(cfitsio_path, '*.c'))
        include_dirs.append(cfitsio_path)
        source_files.extend(cfitsio_files)
    else:
        setup_helpers.pkg_config(['cfitsio'], ['cfitsio'], include_dirs,
                                 library_dirs, libraries)

    return [
        Extension(
            'astropy.io.fits.compression',
            source_files,
            include_dirs=include_dirs,
            extra_compile_args=extra_compile_args,
            libraries=libraries,
            library_dirs=library_dirs)
    ]