コード例 #1
0
ファイル: setup_package.py プロジェクト: mariabenitocst/gala
def get_extensions():
    exts = []

    # malloc
    mac_incl_path = "/usr/include/malloc"

    cfg = setup_helpers.DistutilsExtensionArgs()
    cfg['include_dirs'].append('numpy')
    cfg['include_dirs'].append(mac_incl_path)
    cfg['include_dirs'].append('gala/potential')
    cfg['extra_compile_args'].append('--std=gnu99')
    cfg['sources'].append('gala/potential/cpotential.pyx')
    cfg['sources'].append('gala/potential/src/cpotential.c')
    exts.append(Extension('gala.potential.cpotential', **cfg))

    cfg = setup_helpers.DistutilsExtensionArgs()
    cfg['include_dirs'].append('numpy')
    cfg['include_dirs'].append(mac_incl_path)
    cfg['include_dirs'].append('gala/potential')
    cfg['extra_compile_args'].append('--std=gnu99')
    cfg['sources'].append('gala/potential/ccompositepotential.pyx')
    cfg['sources'].append('gala/potential/src/cpotential.c')
    exts.append(Extension('gala.potential.ccompositepotential', **cfg))

    cfg = setup_helpers.DistutilsExtensionArgs()
    cfg['include_dirs'].append('numpy')
    cfg['include_dirs'].append(mac_incl_path)
    cfg['include_dirs'].append('gala/potential')
    cfg['extra_compile_args'].append('--std=gnu99')
    cfg['sources'].append('gala/potential/builtin/cybuiltin.pyx')
    cfg['sources'].append('gala/potential/builtin/src/_cbuiltin.c')
    cfg['sources'].append('gala/potential/src/cpotential.c')
    exts.append(Extension('gala.potential.builtin.cybuiltin', **cfg))

    return exts
コード例 #2
0
ファイル: setup_package.py プロジェクト: mariabenitocst/gala
def get_extensions():
    exts = []

    # malloc
    mac_incl_path = "/usr/include/malloc"

    cfg = setup_helpers.DistutilsExtensionArgs()
    cfg['include_dirs'].append('numpy')
    cfg['include_dirs'].append(mac_incl_path)
    cfg['include_dirs'].append('gala/potential')
    cfg['extra_compile_args'].append('--std=gnu99')
    cfg['sources'].append('gala/integrate/cyintegrators/leapfrog.pyx')
    cfg['sources'].append('gala/potential/src/cpotential.c')
    exts.append(Extension('gala.integrate.cyintegrators.leapfrog', **cfg))

    cfg = setup_helpers.DistutilsExtensionArgs()
    cfg['include_dirs'].append('numpy')
    cfg['include_dirs'].append(mac_incl_path)
    cfg['include_dirs'].append('gala/potential')
    cfg['extra_compile_args'].append('--std=gnu99')
    cfg['sources'].append('gala/potential/src/cpotential.c')
    cfg['sources'].append('gala/integrate/cyintegrators/dop853.pyx')
    cfg['sources'].append('gala/integrate/cyintegrators/dopri/dop853.c')
    exts.append(Extension('gala.integrate.cyintegrators.dop853', **cfg))

    return exts
コード例 #3
0
ファイル: setup_package.py プロジェクト: silky/gala
def get_extensions():
    exts = []

    # malloc
    mac_incl_path = "/usr/include/malloc"

    cfg = setup_helpers.DistutilsExtensionArgs()
    cfg['include_dirs'].append('numpy')
    cfg['include_dirs'].append(mac_incl_path)
    cfg['include_dirs'].append('gala/potential')
    cfg['extra_compile_args'].append('--std=gnu99')
    cfg['sources'].append('gala/potential/frame/cframe.pyx')
    cfg['sources'].append('gala/potential/frame/src/cframe.c')
    exts.append(Extension('gala.potential.frame.cframe', **cfg))

    cfg = setup_helpers.DistutilsExtensionArgs()
    cfg['include_dirs'].append('numpy')
    cfg['include_dirs'].append(mac_incl_path)
    cfg['include_dirs'].append('gala/potential')
    cfg['extra_compile_args'].append('--std=gnu99')
    cfg['sources'].append('gala/potential/frame/builtin/frames.pyx')
    cfg['sources'].append('gala/potential/frame/builtin/builtin_frames.c')
    cfg['sources'].append('gala/potential/frame/src/cframe.c')
    exts.append(Extension('gala.potential.frame.builtin.frames', **cfg))

    return exts
コード例 #4
0
ファイル: setup_package.py プロジェクト: adi3/gala
def get_extensions():
    exts = []

    # malloc
    mac_incl_path = "/usr/include/malloc"

    cfg = setup_helpers.DistutilsExtensionArgs()
    cfg['include_dirs'].append('numpy')
    cfg['include_dirs'].append(mac_incl_path)
    cfg['include_dirs'].append('gala/integrate/cyintegrators')
    cfg['include_dirs'].append('gala/potential')
    cfg['extra_compile_args'].append('--std=gnu99')
    cfg['sources'].append('gala/potential/potential/src/cpotential.c')
    cfg['sources'].append('gala/potential/hamiltonian/src/chamiltonian.c')
    cfg['sources'].append('gala/integrate/cyintegrators/dopri/dop853.c')
    cfg['sources'].append('gala/dynamics/lyapunov/dop853_lyapunov.pyx')
    exts.append(Extension('gala.dynamics.lyapunov.dop853_lyapunov', **cfg))

    cfg = setup_helpers.DistutilsExtensionArgs()
    cfg['include_dirs'].append('numpy')
    cfg['include_dirs'].append(mac_incl_path)
    cfg['include_dirs'].append('gala/potential')
    cfg['sources'].append('gala/dynamics/mockstream/_coord.pyx')
    cfg['extra_compile_args'].append('--std=gnu99')
    exts.append(Extension('gala.dynamics.mockstream._coord', **cfg))

    cfg = setup_helpers.DistutilsExtensionArgs()
    cfg['include_dirs'].append('numpy')
    cfg['include_dirs'].append('gala/integrate/cyintegrators')
    cfg['include_dirs'].append(mac_incl_path)
    cfg['include_dirs'].append('gala/potential')
    cfg['sources'].append('gala/potential/potential/src/cpotential.c')
    cfg['sources'].append('gala/potential/hamiltonian/src/chamiltonian.c')
    cfg['sources'].append('gala/dynamics/mockstream/_mockstream.pyx')
    cfg['sources'].append('gala/integrate/cyintegrators/dopri/dop853.c')
    cfg['extra_compile_args'].append('--std=gnu99')
    exts.append(Extension('gala.dynamics.mockstream._mockstream', **cfg))

    cfg = setup_helpers.DistutilsExtensionArgs()
    cfg['include_dirs'].append('numpy')
    cfg['include_dirs'].append('gala/integrate/cyintegrators')
    cfg['include_dirs'].append(mac_incl_path)
    cfg['include_dirs'].append('gala/potential')
    cfg['sources'].append('gala/potential/potential/src/cpotential.c')
    cfg['sources'].append('gala/potential/hamiltonian/src/chamiltonian.c')
    cfg['sources'].append('gala/integrate/cyintegrators/dopri/dop853.c')
    cfg['sources'].append('gala/dynamics/nbody/_nbody.pyx')
    cfg['extra_compile_args'].append('--std=gnu99')
    exts.append(Extension('gala.dynamics.nbody._nbody', **cfg))

    return exts
コード例 #5
0
ファイル: setup_package.py プロジェクト: mdboom/sphere
def get_extensions():
    ROOT = os.path.relpath(os.path.dirname(__file__))

    cfg = setup_helpers.DistutilsExtensionArgs()
    cfg['include_dirs'].append('numpy')

    sources = [str(os.path.join(ROOT, 'src', 'math_util.c'))]

    if (not setup_helpers.use_system_library('qd') or sys.platform == 'win32'):
        qd_library_path = os.path.join(ROOT, '..', 'cextern', 'qd-library')
        qd_library_c_path = os.path.join(qd_library_path, 'src')
        qd_library_include_path = os.path.join(qd_library_path, 'include')

        qd_sources = [
            'bits.cpp', 'c_dd.cpp', 'dd_real.cpp', 'dd_const.cpp', 'fpu.cpp',
            'util.cpp'
        ]

        sources.extend(
            [str(os.path.join(qd_library_c_path, x)) for x in qd_sources])
        cfg['include_dirs'].extend(
            [qd_library_include_path,
             str(os.path.join(ROOT, 'src'))])
        cfg['libraries'].append('m')
    else:
        cfg.update(setup_helpers.pkg_config([], ['qd', 'm'], 'qd-config'))

    return [Extension(str('spherical_geometry.math_util'), sources, **cfg)]
コード例 #6
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',
                '-Wno-declaration-after-statement'
            ])

        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)]
コード例 #7
0
ファイル: setup_package.py プロジェクト: majkelx/astropy
def get_extensions():
    generate_c_docstrings()

    ######################################################################
    # DISTUTILS SETUP
    cfg = setup_helpers.DistutilsExtensionArgs()

    wcslib_files = [  # List of wcslib files to compile
        'flexed/wcsbth.c',
        'flexed/wcspih.c',
        'flexed/wcsulex.c',
        'flexed/wcsutrn.c',
        'cel.c',
        'dis.c',
        'lin.c',
        'log.c',
        'prj.c',
        'spc.c',
        'sph.c',
        'spx.c',
        'tab.c',
        'wcs.c',
        'wcserr.c',
        'wcsfix.c',
        'wcshdr.c',
        'wcsprintf.c',
        'wcsunits.c',
        'wcsutil.c'
    ]

    wcslib_config_paths = [
        join(WCSROOT, 'include', 'astropy_wcs', 'wcsconfig.h'),
        join(WCSROOT, 'include', 'wcsconfig.h')
    ]

    get_wcslib_cfg(cfg, wcslib_files, wcslib_config_paths)

    cfg['include_dirs'].append(join(WCSROOT, "include"))

    astropy_wcs_files = [  # List of astropy.wcs files to compile
        'distortion.c',
        'distortion_wrap.c',
        'docstrings.c',
        'pipeline.c',
        'pyutil.c',
        'astropy_wcs.c',
        'astropy_wcs_api.c',
        'sip.c',
        'sip_wrap.c',
        'str_list_proxy.c',
        'unit_list_proxy.c',
        'util.c',
        'wcslib_wrap.c',
        'wcslib_tabprm_wrap.c']
    cfg['sources'].extend(join(WCSROOT, 'src', x) for x in astropy_wcs_files)

    cfg['sources'] = [str(x) for x in cfg['sources']]
    cfg = dict((str(key), val) for key, val in cfg.items())

    return [Extension(str('astropy.wcs._wcs'), **cfg)]
コード例 #8
0
ファイル: setup_package.py プロジェクト: sahirsharma/Martian
def get_extensions(build_type='release'):
    XML_DIR = 'astropy/utils/xml/src'

    cfg = setup_helpers.DistutilsExtensionArgs({
        'sources': [join(XML_DIR, "iterparse.c")]
        })

    if setup_helpers.use_system_library('expat'):
        cfg.update(setup_helpers.pkg_config(['expat'], ['expat']))
    else:
        EXPAT_DIR = 'cextern/expat/lib'
        cfg['sources'].extend([
            join(EXPAT_DIR, fn) for fn in
            ["xmlparse.c", "xmlrole.c", "xmltok.c", "xmltok_impl.c"]])
        cfg['include_dirs'].extend([XML_DIR, EXPAT_DIR])
        if sys.platform.startswith('linux'):
            # This is to ensure we only export the Python entry point
            # symbols and the linker won't try to use the system expat in
            # place of ours.
            cfg['extra_link_args'].extend([
                '-Wl,--version-script={0}'.format(
                    join(XML_DIR, 'iterparse.map'))
                ])
        cfg['define_macros'].append(("HAVE_EXPAT_CONFIG_H", 1))
        if sys.byteorder == 'big':
            cfg['define_macros'].append(('BYTEORDER', '4321'))
        else:
            cfg['define_macros'].append(('BYTEORDER', '1234'))
        if sys.platform != 'win32':
            cfg['define_macros'].append(('HAVE_UNISTD_H', None))

    return [Extension("astropy.utils.xml._iterparser", **cfg)]
コード例 #9
0
ファイル: setup_package.py プロジェクト: ArtShp/DataScience
def get_extensions():
    wcslib_files = [  # List of wcslib files to compile
        'prj.c',
        'wcserr.c',
        'wcsprintf.c',
        'wcsutil.c'
    ]

    wcslib_config_paths = [
        join(MODELING_SRC, 'wcsconfig.h')
    ]

    cfg = setup_helpers.DistutilsExtensionArgs()

    wcs_setup_package.get_wcslib_cfg(cfg, wcslib_files, wcslib_config_paths)

    cfg['include_dirs'].append(MODELING_SRC)

    astropy_files = [  # List of astropy.modeling files to compile
        'projections.c'
    ]
    cfg['sources'].extend(join(MODELING_SRC, x) for x in astropy_files)

    cfg['sources'] = [str(x) for x in cfg['sources']]
    cfg = dict((str(key), val) for key, val in cfg.items())

    return [Extension('astropy.modeling._projections', **cfg)]
コード例 #10
0
def get_extensions():
    generate_c_docstrings()

    ######################################################################
    # DISTUTILS SETUP
    cfg = setup_helpers.DistutilsExtensionArgs()

    wcslib_files = [  # List of wcslib files to compile
        'flexed/wcsbth.c', 'flexed/wcspih.c', 'flexed/wcsulex.c',
        'flexed/wcsutrn.c', 'cel.c', 'dis.c', 'lin.c', 'log.c', 'prj.c',
        'spc.c', 'sph.c', 'spx.c', 'tab.c', 'wcs.c', 'wcserr.c', 'wcsfix.c',
        'wcshdr.c', 'wcsprintf.c', 'wcsunits.c', 'wcsutil.c'
    ]

    wcslib_config_paths = [
        join(WCSROOT, 'include', 'astropy_wcs', 'wcsconfig.h'),
        join(WCSROOT, 'include', 'wcsconfig.h')
    ]

    get_wcslib_cfg(cfg, wcslib_files, wcslib_config_paths)

    cfg['include_dirs'].append(join(WCSROOT, "include"))

    astropy_wcs_files = [  # List of astropy.wcs files to compile
        'distortion.c', 'distortion_wrap.c', 'docstrings.c', 'pipeline.c',
        'pyutil.c', 'astropy_wcs.c', 'astropy_wcs_api.c', 'sip.c',
        'sip_wrap.c', 'str_list_proxy.c', 'unit_list_proxy.c', 'util.c',
        'wcslib_wrap.c', 'wcslib_tabprm_wrap.c'
    ]
    cfg['sources'].extend(join(WCSROOT, 'src', x) for x in astropy_wcs_files)

    cfg['sources'] = [str(x) for x in cfg['sources']]
    cfg = dict((str(key), val) for key, val in cfg.items())

    # Copy over header files from WCSLIB into the installed version of Astropy
    # so that other Python packages can write extensions that link to it. We
    # do the copying here then include the data in [options.package_data] in
    # the setup.cfg file

    wcslib_headers = [
        'cel.h',
        'lin.h',
        'prj.h',
        'spc.h',
        'spx.h',
        'tab.h',
        'wcs.h',
        'wcserr.h',
        'wcsmath.h',
        'wcsprintf.h',
    ]

    if not setup_helpers.use_system_library('wcslib'):
        for header in wcslib_headers:
            source = join('cextern', 'wcslib', 'C', header)
            dest = join('astropy', 'wcs', 'include', 'wcslib', header)
            if newer_group([source], dest, 'newer'):
                shutil.copy(source, dest)

    return [Extension('astropy.wcs._wcs', **cfg)]
コード例 #11
0
ファイル: setup_package.py プロジェクト: sherbold/gala
def get_extensions():
    exts = []

    # malloc
    mac_incl_path = "/usr/include/malloc"

    # Some READTHEDOCS hacks - see
    # https://github.com/pyFFTW/pyFFTW/pull/161/files
    # https://github.com/pyFFTW/pyFFTW/pull/162/files
    include_dirs = [path.join(sys.prefix, 'include')]
    library_dirs = [path.join(sys.prefix, 'lib')]

    # all need these:
    include_dirs.extend(['numpy', mac_incl_path, 'gala', 'gala/potential'])

    cfg = setup_helpers.DistutilsExtensionArgs()
    cfg['include_dirs'].extend(include_dirs)
    cfg['library_dirs'].extend(library_dirs)
    cfg['extra_compile_args'].append('--std=gnu99')
    cfg['sources'].append('gala/potential/scf/computecoeff.pyx')
    cfg['sources'].append('gala/potential/scf/src/bfe_helper.c')
    cfg['sources'].append('gala/potential/scf/src/coeff_helper.c')
    exts.append(Extension('gala.potential.scf._computecoeff', **cfg))

    cfg = setup_helpers.DistutilsExtensionArgs()
    cfg['include_dirs'].extend(include_dirs)
    cfg['library_dirs'].extend(library_dirs)
    cfg['extra_compile_args'].append('--std=gnu99')
    cfg['sources'].append('gala/potential/potential/src/cpotential.c')
    cfg['sources'].append(
        'gala/potential/potential/builtin/builtin_potentials.c')
    cfg['sources'].append('gala/potential/scf/bfe.pyx')
    cfg['sources'].append('gala/potential/scf/src/bfe.c')
    cfg['sources'].append('gala/potential/scf/src/bfe_helper.c')
    exts.append(Extension('gala.potential.scf._bfe', **cfg))

    cfg = setup_helpers.DistutilsExtensionArgs()
    cfg['include_dirs'].extend(include_dirs)
    cfg['library_dirs'].extend(library_dirs)
    cfg['extra_compile_args'].append('--std=gnu99')
    cfg['sources'].append('gala/potential/scf/bfe_class.pyx')
    cfg['sources'].append('gala/potential/scf/src/bfe.c')
    cfg['sources'].append('gala/potential/scf/src/bfe_helper.c')
    exts.append(Extension('gala.potential.scf._bfe_class', **cfg))

    return exts
コード例 #12
0
ファイル: setup_package.py プロジェクト: Landau1908/SuperFreq
def get_extensions():
    cfg_naff = setup_helpers.DistutilsExtensionArgs()
    # 'numpy' will be replaced with the proper path to the numpy includes
    cfg_naff['include_dirs'].append('numpy')
    cfg_naff['include_dirs'].append('cextern')
    cfg_naff['sources'].append('superfreq/_naff.pyx')
    cfg_naff['sources'].append('cextern/brent.c')
    cfg_naff['sources'].append('cextern/simpson.c')
    ext_naff = Extension('superfreq._naff', **cfg_naff)

    cfg_simpsgauss = setup_helpers.DistutilsExtensionArgs()
    cfg_simpsgauss['include_dirs'].append('numpy')
    cfg_simpsgauss['include_dirs'].append('cextern')
    cfg_simpsgauss['sources'].append('superfreq/simpsgauss.pyx')
    cfg_simpsgauss['sources'].append('cextern/simpson.c')
    ext_simpsgauss = Extension('superfreq.simpsgauss', **cfg_simpsgauss)

    return [ext_naff, ext_simpsgauss]
コード例 #13
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(glob(os.path.join(os.path.dirname(__file__), 'src', 'ana', '*.c')))
    cfg['extra_compile_args'].extend(['-std=c99', '-O3'])

    e = Extension('sunpy.io._pyana', **cfg)
    return [e]
コード例 #14
0
def get_extensions():
    exts = []

    cfg = setup_helpers.DistutilsExtensionArgs()
    cfg['include_dirs'].append('gala')
    cfg['extra_compile_args'].append('--std=gnu99')
    cfg['sources'].append('gala/cconfig.pyx')
    exts.append(Extension('gala._cconfig', **cfg))

    return exts
コード例 #15
0
def get_extensions():
    generate_c_docstrings()

    cfg = setup_helpers.DistutilsExtensionArgs()
    cfg['include_dirs'].extend(['numpy', os.path.join(LOCALROOT, "include")])
    cfg['sources'] = [
        str(os.path.join(LOCALROOT, 'src', 'synphot_utils.c')),
        str(os.path.join(LOCALROOT, 'src', 'docstrings.c'))
    ]
    cfg = dict((str(key), val) for key, val in six.iteritems(cfg))

    return [Extension(str('synphot.synphot_utils'), **cfg)]
コード例 #16
0
ファイル: setup_package.py プロジェクト: stargaser/astropy
def _get_compression_extension():

    debug = '--debug' in sys.argv

    # 'numpy' will be replaced with the proper path to the numpy includes
    cfg = setup_helpers.DistutilsExtensionArgs()
    cfg['include_dirs'].append('numpy')
    cfg['sources'].append(
        os.path.join(os.path.dirname(__file__), 'src', 'compressionmodule.c'))

    if (int(os.environ.get('ASTROPY_USE_SYSTEM_CFITSIO', 0))
            or int(os.environ.get('ASTROPY_USE_SYSTEM_ALL', 0))):
        cfg.update(setup_helpers.pkg_config(['cfitsio'], ['cfitsio']))
    else:
        if setup_helpers.get_compiler_option() == 'msvc':
            # These come from the CFITSIO vcc makefile, except the last
            # which ensures on windows we do not include unistd.h (in regular
            # compilation of cfitsio, an empty file would be generated)
            cfg['extra_compile_args'].extend([
                '/D', '"WIN32"', '/D', '"_WINDOWS"', '/D', '"_MBCS"', '/D',
                '"_USRDLL"', '/D', '"_CRT_SECURE_NO_DEPRECATE"', '/D',
                '"FF_NO_UNISTD_H"'
            ])
        else:
            cfg['extra_compile_args'].extend(
                ['-Wno-declaration-after-statement'])

            if not debug:
                # these switches are to silence warnings from compiling CFITSIO
                # For full silencing, some are added that only are used in
                # later versions of gcc (versions approximate; see #6474)
                cfg['extra_compile_args'].extend([
                    '-Wno-strict-prototypes',
                    '-Wno-unused',
                    '-Wno-uninitialized',
                    '-Wno-unused-result',  # gcc >~4.8
                    '-Wno-misleading-indentation',  # gcc >~7.2
                    '-Wno-format-overflow',  # gcc >~7.2
                ])

        cfitsio_lib_path = os.path.join('cextern', 'cfitsio', 'lib')
        cfitsio_zlib_path = os.path.join('cextern', 'cfitsio', 'zlib')
        cfitsio_files = glob(os.path.join(cfitsio_lib_path, '*.c'))
        cfitsio_zlib_files = glob(os.path.join(cfitsio_zlib_path, '*.c'))
        cfg['include_dirs'].append(cfitsio_lib_path)
        cfg['include_dirs'].append(cfitsio_zlib_path)
        cfg['sources'].extend(cfitsio_files)
        cfg['sources'].extend(cfitsio_zlib_files)

    return Extension('astropy.io.fits.compression', **cfg)
コード例 #17
0
def get_extensions():
    ulist = platform.uname()
    xpa_dir = os.path.join('cextern', 'xpa')
    debug = get_distutils_build_option('debug')

    # libxpa configurations
    cfg = setup_helpers.DistutilsExtensionArgs()
    cfg['extra_compile_args'].append('-DHAVE_CONFIG_H')

    if 'CFLAGS' not in os.environ and struct.calcsize("P") == 4:
        if ulist[0] == 'Darwin' or ulist[4] == 'x86_64':
            if debug:
                print('adding -m32 to compiler flags ...')
            cflags = '-m32'
            cfg['extra_compile_args'].append(cflags)

    # cfg['extra_compile_args'].extend([# '--enable-shared',
    #                                   '--without-tcl',
    #                                   cflags])

    # import pdb; pdb.set_trace()

    if not setup_helpers.use_system_library('libxpa'):
        if not debug:
            # All of these switches are to silence warnings from compiling
            cfg['extra_compile_args'].extend([
                '-Wno-declaration-after-statement', '-Wno-unused-variable',
                '-Wno-parentheses', '-Wno-uninitialized', '-Wno-format',
                '-Wno-strict-prototypes', '-Wno-unused', '-Wno-comments',
                '-Wno-switch', '-Wno-strict-aliasing', '-Wno-return-type',
                '-Wno-address', '-Wno-unused-result'
            ])

        cfg['include_dirs'].append(xpa_dir)
        sources = [
            'xpa.c', 'xpaio.c', 'command.c', 'acl.c', 'remote.c',
            'clipboard.c', 'port.c', 'tcp.c', 'client.c', 'word.c', 'xalloc.c',
            'find.c', 'xlaunch.c', 'timedconn.c', 'tclloop.c', 'tcl.c'
        ]
        cfg['sources'].extend([os.path.join(xpa_dir, s) for s in sources])
    else:
        cfg.update(setup_helpers.pkg_config(['libxpa'], ['libxpa']))

    libxpa = Extension(libxpa_extension_name, **cfg)

    return [
        libxpa,
    ]
コード例 #18
0
def get_extensions():
    exts = []

    # malloc
    mac_incl_path = "/usr/include/malloc"

    cfg = setup_helpers.DistutilsExtensionArgs()
    cfg['include_dirs'].append('numpy')
    cfg['include_dirs'].append(mac_incl_path)
    cfg['include_dirs'].append('twobody/')
    cfg['extra_compile_args'].append('--std=gnu99')
    cfg['sources'].append('twobody/wrap.pyx')
    cfg['sources'].append('twobody/src/twobody.c')
    exts.append(Extension('twobody.wrap', **cfg))

    return exts
コード例 #19
0
def get_extensions():

    if platform.system() == 'Windows' or sys.version_info.major == 3:
        return list()
    else:
        # 'numpy' will be replaced with the proper path to the numpy includes
        cfg = setup_helpers.DistutilsExtensionArgs()
        cfg['include_dirs'].append('numpy')
        cfg['sources'].extend(
            glob(os.path.join(os.path.dirname(__file__), 'src', 'ana', '*.c')))
        cfg['extra_compile_args'].extend(['-std=c99', '-O3'])
        # Squash some warnings
        cfg['extra_compile_args'].extend([
            '-Wno-unused-but-set-variable', '-Wno-unused-variable',
            '-Wno-unused-result'
        ])

        e = Extension('sunpy.io._pyana', **cfg)
        return [e]
コード例 #20
0
def get_extensions():
    ROOT = os.path.relpath(os.path.dirname(__file__))

    test_source = os.path.join('tests', 'utest_cdrizzle.c')

    cdriz_sources = [
        'cdrizzleapi.c', 'cdrizzleblot.c', 'cdrizzlebox.c', 'cdrizzlemap.c',
        'cdrizzleutil.c', test_source
    ]

    sources = [str(os.path.join(ROOT, 'src', x)) for x in cdriz_sources]

    cfg = setup_helpers.DistutilsExtensionArgs()

    cfg['libraries'].append('m')
    cfg['include_dirs'].append('numpy')
    cfg['include_dirs'].append(str(os.path.join(ROOT, 'src')))

    return [Extension(str('drizzle.cdrizzle'), sources, **cfg)]
コード例 #21
0
ファイル: setup_package.py プロジェクト: danhey/thejoker
def get_extensions():
    exts = []

    from os import path
    try:
        # Get twobody path, or ignore failure -- for egg_info build
        import twobody
        twobody_path = path.dirname(twobody.__file__)
    except ImportError:
        twobody_path = None

    cfg = setup_helpers.DistutilsExtensionArgs()
    cfg['include_dirs'].append('numpy')

    if twobody_path is not None:
        cfg['include_dirs'].append(twobody_path)
        cfg['sources'].append(path.join(twobody_path, 'src/twobody.c'))

    cfg['extra_compile_args'].append('--std=gnu99')
    cfg['sources'].append('thejoker/sampler/fast_likelihood.pyx')
    exts.append(Extension('thejoker.sampler.fast_likelihood', **cfg))

    return exts
コード例 #22
0
ファイル: setup_package.py プロジェクト: ywis/astropy
def get_extensions():
    from astropy.version import debug

    generate_c_docstrings()

    ######################################################################
    # DISTUTILS SETUP
    cfg = setup_helpers.DistutilsExtensionArgs()

    cfg['include_dirs'].extend(['numpy', join(WCSROOT, "include")])
    cfg['define_macros'].extend([('ECHO', None), ('WCSTRIG_MACRO', None),
                                 ('ASTROPY_WCS_BUILD', None),
                                 ('_GNU_SOURCE', None),
                                 ('WCSVERSION', WCSVERSION)])

    if (not setup_helpers.use_system_library('wcslib')
            or sys.platform == 'win32'):
        write_wcsconfig_h()

        wcslib_path = join("cextern", "wcslib")  # Path to wcslib
        wcslib_cpath = join(wcslib_path, "C")  # Path to wcslib source files
        wcslib_files = [  # List of wcslib files to compile
            'flexed/wcsbth.c', 'flexed/wcspih.c', 'flexed/wcsulex.c',
            'flexed/wcsutrn.c', 'cel.c', 'lin.c', 'log.c', 'prj.c', 'spc.c',
            'sph.c', 'spx.c', 'tab.c', 'wcs.c', 'wcserr.c', 'wcsfix.c',
            'wcshdr.c', 'wcsprintf.c', 'wcsunits.c', 'wcsutil.c'
        ]
        cfg['sources'].extend(join(wcslib_cpath, x) for x in wcslib_files)
        cfg['include_dirs'].append(wcslib_cpath)
    else:
        cfg.update(setup_helpers.pkg_config(['wcslib'], ['wcs']))

    astropy_wcs_files = [  # List of astropy.wcs files to compile
        'distortion.c', 'distortion_wrap.c', 'docstrings.c', 'pipeline.c',
        'pyutil.c', 'astropy_wcs.c', 'astropy_wcs_api.c', 'sip.c',
        'sip_wrap.c', 'str_list_proxy.c', 'unit_list_proxy.c', 'util.c',
        'wcslib_wrap.c', 'wcslib_tabprm_wrap.c', 'wcslib_wtbarr_wrap.c'
    ]
    cfg['sources'].extend(join(WCSROOT, 'src', x) for x in astropy_wcs_files)

    if debug:
        cfg['define_macros'].append(('DEBUG', None))
        cfg['undef_macros'].append('NDEBUG')
        if (not sys.platform.startswith('sun')
                and not sys.platform == 'win32'):
            cfg['extra_compile_args'].extend(["-fno-inline", "-O0", "-g"])
    else:
        # Define ECHO as nothing to prevent spurious newlines from
        # printing within the libwcs parser
        cfg['define_macros'].append(('NDEBUG', None))
        cfg['undef_macros'].append('DEBUG')

    if sys.platform == 'win32':
        # These are written into wcsconfig.h, but that file is not
        # used by all parts of wcslib.
        cfg['define_macros'].extend([
            ('YY_NO_UNISTD_H', None),
            ('_CRT_SECURE_NO_WARNINGS', None),
            ('_NO_OLDNAMES', None),  # for mingw32
            ('NO_OLDNAMES', None),  # for mingw64
            ('__STDC__', None)  # for MSVC
        ])

    if sys.platform.startswith('linux'):
        cfg['define_macros'].append(('HAVE_SINCOS', None))

    cfg['sources'] = [str(x) for x in cfg['sources']]

    cfg = dict((str(key), val) for key, val in six.iteritems(cfg))

    return [Extension(str('astropy.wcs._wcs'), **cfg)]