Skip to content

Commit

Permalink
Backport of liberfa/pyerfa#39 to bundled _erfa
Browse files Browse the repository at this point in the history
  • Loading branch information
eteq committed Oct 16, 2020
1 parent 60a62a3 commit 0e095f2
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions astropy/_erfa/setup_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import glob

from distutils.extension import Extension
from distutils.dep_util import newer

import numpy
from extension_helpers import import_file
Expand All @@ -24,15 +25,26 @@


def get_extensions():

gen = import_file(os.path.join(ERFAPKGDIR, 'erfa_generator.py'))
gen.main(verbose=False)
gen_files_exist = all(os.path.isfile(fn) for fn in GEN_FILES)
gen_files_outdated = False
if os.path.isdir(ERFA_SRC):
# assume thet 'erfaversion.c' is updated at each release at least
src = os.path.join(ERFA_SRC, 'erfaversion.c')
gen_files_outdated = any(newer(src, fn) for fn in GEN_FILES)
elif not gen_files_exist:
raise RuntimeError(
'Missing "liberfa" source files, unable to generate '
'"erfa/ufunc.c" and "erfa/core.py". '
'Please check your source tree. '
'Maybe "git submodule update" could help.')

if not gen_files_exist or gen_files_outdated:
gen = import_file(os.path.join(ERFAPKGDIR, 'erfa_generator.py'))
gen.main(verbose=False)

sources = [os.path.join(ERFAPKGDIR, fn)
for fn in ("ufunc.c", "pav2pv.c", "pv2pav.c")]

include_dirs = [numpy.get_include()]

libraries = []

if (int(os.environ.get('ASTROPY_USE_SYSTEM_ERFA', 0)) or
Expand Down

0 comments on commit 0e095f2

Please sign in to comment.