Skip to content

Commit

Permalink
Further cleanup to remove use of astropy-helpers for external libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
astrofrog committed Nov 28, 2019
1 parent fb97087 commit cbf12e1
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 36 deletions.
8 changes: 1 addition & 7 deletions astropy/_erfa/setup_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
import os
import glob

from distutils import log
from distutils.extension import Extension

from extension_helpers import setup_helpers
from extension_helpers.utils import import_file

ERFAPKGDIR = os.path.relpath(os.path.dirname(__file__))
Expand Down Expand Up @@ -37,7 +35,7 @@ def get_extensions():

libraries = []

if setup_helpers.use_system_library('erfa'):
if int(os.environ.get('ASTROPY_USE_SYSTEM_ERFA', 0)) == 1:
libraries.append('erfa')
else:
# get all of the .c files in the cextern/erfa directory
Expand All @@ -55,7 +53,3 @@ def get_extensions():
language="c",)

return [erfa_ext]


def get_external_libraries():
return ['erfa']
18 changes: 7 additions & 11 deletions astropy/io/fits/setup_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@
from glob import glob

from extension_helpers import setup_helpers
from extension_helpers.distutils_helpers import get_distutils_build_option


def _get_compression_extension():

import numpy
cfg = setup_helpers.DistutilsExtensionArgs()
cfg['include_dirs'].append(numpy.get_include())
cfg['sources'].append(os.path.join(os.path.dirname(__file__), 'src',
'compressionmodule.c'))

if not setup_helpers.use_system_library('cfitsio'):
cfg = {}
cfg['include_dirs'] = [numpy.get_include()]
cfg['sources'] = [os.path.join(os.path.dirname(__file__), 'src', 'compressionmodule.c')]

if int(os.environ.get('ASTROPY_USE_SYSTEM_CFITSIO', 0)) == 0:
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
Expand All @@ -33,7 +33,7 @@ def _get_compression_extension():
'-Wno-declaration-after-statement'
])

if not get_distutils_build_option('debug'):
if not int(os.environ.get('ASTROPY_DEBUG', 0)) == 1:
# 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)
Expand Down Expand Up @@ -62,7 +62,3 @@ def _get_compression_extension():

def get_extensions():
return [_get_compression_extension()]


def get_external_libraries():
return ['cfitsio']
6 changes: 1 addition & 5 deletions astropy/utils/xml/setup_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,14 @@
from extension_helpers import setup_helpers


def get_external_libraries():
return ['expat']


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'):
if int(os.environ.get('ASTROPY_USE_SYSTEM_EXPAT', 0)) == 1:
cfg.update(setup_helpers.pkg_config(['expat'], ['expat']))
else:
EXPAT_DIR = 'cextern/expat/lib'
Expand Down
12 changes: 2 additions & 10 deletions astropy/wcs/setup_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,12 @@
import io
from os.path import join
import os.path
import shutil
import sys

from distutils.core import Extension
from distutils.dep_util import newer_group


from extension_helpers.utils import import_file
from extension_helpers import setup_helpers
from extension_helpers.distutils_helpers import get_distutils_build_option

WCSROOT = os.path.relpath(os.path.dirname(__file__))
WCSVERSION = "6.4.0"
Expand Down Expand Up @@ -185,7 +181,7 @@ def get_wcslib_cfg(cfg, wcslib_files, include_paths):
('ASTROPY_WCS_BUILD', None),
('_GNU_SOURCE', None)])

if (not setup_helpers.use_system_library('wcslib') or
if (int(os.environ.get('ASTROPY_USE_SYSTEM_WCSLIB', 0)) == 0 or
sys.platform == 'win32'):
write_wcsconfig_h(include_paths)

Expand Down Expand Up @@ -227,7 +223,7 @@ def get_wcslib_cfg(cfg, wcslib_files, include_paths):

# Squelch a few compilation warnings in WCSLIB
if setup_helpers.get_compiler_option() in ('unix', 'mingw32'):
if not get_distutils_build_option('debug'):
if not int(os.environ.get('ASTROPY_DEBUG', 0)) == 1:
cfg['extra_compile_args'].extend([
'-Wno-strict-prototypes',
'-Wno-unused-function',
Expand Down Expand Up @@ -295,7 +291,3 @@ def get_extensions():
cfg = dict((str(key), val) for key, val in cfg.items())

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


def get_external_libraries():
return ['wcslib']
5 changes: 2 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@ requires = ["setuptools",
"wheel",
"cython",
"jinja2",
"numpy==1.13.1; python_version<'3.7'",
"numpy==1.14.5; python_version>='3.7'",
"extension-helpers @ git+https://github.com/astrofrog/extension-helpers#egg=extension-helpers"]
"oldest-supported-numpy",
"extension-helpers @ git+https://github.com/astropy/astropy-helpers@extension-helpers"]

0 comments on commit cbf12e1

Please sign in to comment.