def wcs_include(command_obj) : # warning if we somehow get called when not building a c extension command_name = command_obj.get_command_name() if command_name != 'build_ext': log.warn('%s is meant to be used with the build_ext command only; ' 'it is not for use with the %s command.' % (__name__, command_name)) # get information from astropy.wcs from astropy import wcs include_path = wcs.get_include() includes = [os.path.join(include_path, 'astropy_wcs'), os.path.join(include_path, 'wcslib')] for extension in command_obj.extensions: extension.include_dirs.extend(includes)
def wcs_include(command_obj): # warning if we somehow get called when not building a c extension command_name = command_obj.get_command_name() if command_name != 'build_ext': log.warn('%s is meant to be used with the build_ext command only; ' 'it is not for use with the %s command.' % (__name__, command_name)) # get information from astropy.wcs from astropy import wcs include_path = wcs.get_include() includes = [ os.path.join(include_path, 'astropy_wcs'), os.path.join(include_path, 'wcslib') ] for extension in command_obj.extensions: extension.include_dirs.extend(includes)
#!/usr/bin/env python import os.path import sys import numpy from astropy import wcs from glob import glob from setuptools import setup, find_packages, Extension # Setup C module include directories include_dirs = [] numpy_includes = [numpy.get_include()] wcs_includes = [ os.path.join(wcs.get_include(), 'astropy_wcs'), os.path.join(wcs.get_include(), 'wcslib') ] include_dirs.extend(numpy_includes) include_dirs.extend(wcs_includes) # Setup C module macros define_macros = [] # Handle MSVC `wcsset` redefinition if sys.platform == 'win32': define_macros += [('_CRT_SECURE_NO_WARNING', None), ('__STDC__', 1)] setup( use_scm_version=True, setup_requires=["setuptools_scm"],
('YY_NO_UNISTD_H', None), ('_CRT_SECURE_NO_WARNINGS', None), ('_NO_OLDNAMES', None), # for mingw32 ('NO_OLDNAMES', None), # for mingw64 ('__STDC__', None) # for MSVC ] else: define_macros = [] try: numpy_include = np.get_include() except AttributeError: numpy_include = np.get_numpy_include() wcsapi_test_module = Extension( str('wcsapi_test'), include_dirs=[ numpy_include, os.path.join(wcs.get_include(), 'astropy_wcs'), os.path.join(wcs.get_include(), 'wcslib') ], # Use the *full* name to the c file, since we can't change the cwd # during testing sources=[str(os.path.join(os.path.dirname(__file__), 'wcsapi_test.c'))], define_macros=define_macros) setup( name='wcsapi_test', ext_modules=[wcsapi_test_module])
# Licensed under a 3-clause BSD style license - see LICENSE.rst from __future__ import absolute_import, division, print_function, unicode_literals import os if __name__ == "__main__": from astropy import wcs from astropy import setup_helpers from distutils.core import setup, Extension wcsapi_test_module = Extension( str("wcsapi_test"), include_dirs=[ setup_helpers.get_numpy_include_path(), os.path.join(wcs.get_include(), "astropy_wcs"), os.path.join(wcs.get_include(), "wcslib"), ], # Use the *full* name to the c file, since we can't change the cwd # during testing sources=[str(os.path.join(os.path.dirname(__file__), "wcsapi_test.c"))], ) setup(name="wcsapi_test", ext_modules=[wcsapi_test_module])