Skip to content

Commit

Permalink
python3.pkgs.pyerfa: Enable and fix tests & more
Browse files Browse the repository at this point in the history
Use NIX_CFLAGS_COMPILE = "-O2", due to upstream issue. cd "$out" to
avoid circular import issue (discuessed downstream at at
NixOS#255262).
  • Loading branch information
doronbehar authored and digtail committed Sep 25, 2023
1 parent 6ddfc78 commit 9655465
Showing 1 changed file with 30 additions and 3 deletions.
33 changes: 30 additions & 3 deletions pkgs/development/python-modules/pyerfa/default.nix
Original file line number Diff line number Diff line change
@@ -1,27 +1,36 @@
{ lib
, buildPythonPackage
, fetchPypi
, fetchpatch
, jinja2
, oldest-supported-numpy
, setuptools-scm
, wheel
, liberfa
, packaging
, numpy
, pytestCheckHook
, pytest-doctestplus
}:

buildPythonPackage rec {
pname = "pyerfa";
format = "pyproject";
version = "2.0.0.3";

doCheck = false;

src = fetchPypi {
inherit pname version;
hash = "sha256-13+7+lg1DBlMy5nl2TqgXTwrFNWq2LZi2Txq2f/0Hzk=";
};

patches = [
# Sort of helps maybe for https://github.com/liberfa/pyerfa/issues/112
(fetchpatch {
url = "https://github.com/liberfa/pyerfa/commit/4866342b94c5e7344711146f1186a4c3e7534da8.patch";
hash = "sha256-uPFFdLYfRweQdeEApBAw6Ulqh31NTQwwmnaU+x/M+C0=";
})
];

nativeBuildInputs = [
jinja2
oldest-supported-numpy
Expand All @@ -31,14 +40,32 @@ buildPythonPackage rec {
];

propagatedBuildInputs = [
liberfa
numpy
];
buildInputs = [
liberfa
];

preBuild = ''
export PYERFA_USE_SYSTEM_LIBERFA=1
'';

# See https://github.com/liberfa/pyerfa/issues/112#issuecomment-1721197483
NIX_CFLAGS_COMPILE = "-O2";
nativeCheckInputs = [
pytestCheckHook
pytest-doctestplus
];
# Getting circular import errors without this, not clear yet why. This was mentioned to
# upstream at: https://github.com/liberfa/pyerfa/issues/112 and downstream at
# https://github.com/NixOS/nixpkgs/issues/255262
preCheck = ''
cd $out
'';
pythonImportsCheck = [
"erfa"
];

meta = with lib; {
description = "Python bindings for ERFA routines";
longDescription = ''
Expand Down

0 comments on commit 9655465

Please sign in to comment.