Skip to content

Commit

Permalink
Merge pull request #75 from mhvk/update-to-erfa-2.0.0
Browse files Browse the repository at this point in the history
Update to erfa 2.0.0
  • Loading branch information
mhvk authored May 17, 2021
2 parents 1ec11e5 + 8054fae commit 841540e
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 17 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci_workflows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:

- name: Test with oldest supported versions of our dependencies
os: ubuntu-16.04
python: 3.6
python: 3.7
toxenv: test-oldestdeps
toxargs: -v

Expand Down Expand Up @@ -100,4 +100,4 @@ jobs:
source tests/bin/activate
python -m pip install --editable .[test]
(nm -u erfa/ufunc.cpython-*.so | grep eraA2af) || exit 1
python -m pytest
(python -c 'import erfa' 2>&1 | grep -n 'too old') > /dev/null && (echo 'liberfa too old, skipping tests'; exit 0) || python -m pytest
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ __pycache__
# Other generated files
MANIFEST
erfa/core.py
erfa/tests/test_ufunc.py
erfa/_version.py

# Sphinx
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,5 @@ script:
source tests/bin/activate;
pip3 install --no-deps --editable .[test];
(nm -u erfa/ufunc.cpython-*.so | grep eraA2af) || exit 1;
pytest-3;
(python -c 'import erfa' 2>&1 | grep -n 'too old') > /dev/null && (echo 'liberfa too old, skipping tests'; exit 0) || pytest-3;
fi
6 changes: 4 additions & 2 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
1.7.3.1 (unreleased)
====================
2.0.0 (unreleased)
==================

- Bundled liberfa version update to v2.0.0. This includes new functionality,
and hence pyerfa 2.0.0 cannot run with previous versions of liberfa.
- ``erfa.dt_eraLDBODY`` has been corrected to ensure that the 'pv' entry is
now of type ``erfa.dt_pv``, so that cross-assignments with that dtype work
correctly. [gh-74]
Expand Down
14 changes: 7 additions & 7 deletions RELEASING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ environment::
git clean -fxd
tox -e test

It is also wise to check that the new release works with astropy::
It is also wise to check that the new release works with astropy.
We can use the ``tox`` environment we just created, but have to be sure
to leave the package directory::

python3 -m venv astropy_test
source astropy_test/bin/activate
source .tox/test/bin/activate
cd ~ #
pip install astropy[test]
pip install . # Install our newest erfa version in virtual environment
cd astropy_test/lib/python3.9/site-packages/astropy
pytest --remote-data=any
cd -
pytest --pyargs astropy --remote-data=any
cd - # Back to the package directory.
deactivate
git clean -fxd

Expand Down
4 changes: 3 additions & 1 deletion erfa/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# Licensed under a 3-clause BSD style license - see LICENSE.rst

# Import version first, as this gives a more useful error message
# if a system liberfa is too old.
from .version import version as __version__ # noqa
from .core import * # noqa
from .ufunc import (dt_eraASTROM, dt_eraLDBODY, dt_eraLEAPSECOND, # noqa
dt_pv, dt_sign, dt_type, dt_ymdf, dt_hmsf, dt_dmsf)
from .helpers import leap_seconds # noqa
from .version import version as __version__ # noqa
25 changes: 24 additions & 1 deletion erfa/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,30 @@

# Set the version numbers a bit indirectly, so that Sphinx can pick up
# up the docstrings and list the values.
from . import ufunc
try:
from . import ufunc
except ImportError as exc:
# If compiled to use a system liberfa, that library can be too old, and
# miss functions that are available in newer liberfa. If so, we should
# bail since nothing will work, but let's try to give a more informative
# error message.
try:
from ctypes import CDLL, util, c_char_p
liberfa = CDLL(util.find_library('erfa'))
liberfa.eraVersion.restype = c_char_p
erfa_version = liberfa.eraVersion().decode('ascii')
except Exception:
pass
else:
if erfa_version.split(".")[:2] < _version.split(".")[:2]:
raise ImportError(
f"liberfa {erfa_version} too old for PyERFA {_version}. "
"This should only be possible if you are using a system liberfa; "
"try installing using 'pip install pyerfa', with environment variable "
"PYERFA_USE_SYSTEM_LIBERFA unset or 0.") from exc

raise


version = _version
'''Version of the python wrappers.'''
Expand Down
2 changes: 1 addition & 1 deletion liberfa/erfa
Submodule erfa updated 233 files
4 changes: 2 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ requires = numpy
zip_safe = False
tests_require = pytest-doctestplus
setup_requires = setuptools_scm
install_requires = numpy>=1.16
python_requires = >=3.6
install_requires = numpy>=1.17
python_requires = >=3.7

[options.packages.find]
exclude = erfa._dev
Expand Down
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ extras =

commands =
pip freeze
python -c 'import erfa' # To give useful error message if liberfa is too old.
pytest --pyargs erfa {toxinidir}/docs {posargs}

[testenv:build_docs]
Expand Down

0 comments on commit 841540e

Please sign in to comment.