Unverified Commit 870e7272 authored by Doron Behar's avatar Doron Behar Committed by GitHub
Browse files

Merge pull request #255124 from doronbehar/pkg/astropy

python3.pkgs.astropy: 5.2.1 -> 5.3.3 & more
parents 4c89745a bb63d648
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -94,5 +94,7 @@ buildPythonPackage rec {
    homepage = "https://github.com/asdf-format/asdf";
    license = licenses.bsd3;
    maintainers = with maintainers; [ ];
    # Many tests fail, according to Hydra
    broken = true;
  };
}
+13 −4
Original line number Diff line number Diff line
{ lib
, buildPythonPackage
, fetchPypi
, fetchpatch
, findutils
, pytestCheckHook
, pythonOlder
@@ -11,23 +12,31 @@

buildPythonPackage rec {
  pname = "extension-helpers";
  version = "1.0.0";
  version = "1.1.0";
  format = "pyproject";

  disabled = pythonOlder "3.6";

  src = fetchPypi {
    inherit pname version;
    sha256 = "ca1bfac67c79cf4a7a0c09286ce2a24eec31bf17715818d0726318dd0e5050e6";
    hash = "sha256-SUYMeKP40fjOwXRHn16FrURZSMzEFgM8WqPm3fLFAik=";
  };

  patches = [
    # Not needed to allow this package to build, but meant for it's dependent
    # packages, like astropy. See explanation at:
    # https://github.com/astropy/extension-helpers/pull/59
    (fetchpatch {
      url = "https://github.com/astropy/extension-helpers/commit/796f3e7831298df2d26b6d994b13fd57061a56d1.patch";
      hash = "sha256-NnqK9HQq1hQ66RUJf9gTCuLyA0BVqVtL292mSXJ9860=";
    })
  ];

  nativeBuildInputs = [
    setuptools-scm
    wheel
  ];

  patches = [ ./permissions.patch ];

  nativeCheckInputs = [
    findutils
    pip
+0 −20
Original line number Diff line number Diff line
diff --git a/extension_helpers/_setup_helpers.py b/extension_helpers/_setup_helpers.py
index ec3e547..e2419f7 100644
--- a/extension_helpers/_setup_helpers.py
+++ b/extension_helpers/_setup_helpers.py
@@ -79,8 +79,13 @@ def get_extensions(srcdir='.'):
     if len(ext_modules) > 0:
         main_package_dir = min(packages, key=len)
         src_path = os.path.join(os.path.dirname(__file__), 'src')
-        shutil.copy(os.path.join(src_path, 'compiler.c'),
-                    os.path.join(srcdir, main_package_dir, '_compiler.c'))
+        a = os.path.join(src_path, 'compiler.c')
+        b = os.path.join(srcdir, main_package_dir, '_compiler.c')
+        try:
+            os.unlink(b)
+        except OSError:
+            pass
+        shutil.copy(a, b)
         ext = Extension(main_package_dir + '.compiler_version',
                         [os.path.join(main_package_dir, '_compiler.c')])
         ext_modules.append(ext)
+41 −12
Original line number Diff line number Diff line
{ lib
, fetchPypi
, fetchpatch
, buildPythonPackage
, pythonOlder

@@ -10,6 +11,11 @@
, oldest-supported-numpy
, setuptools-scm
, wheel
# testing
, pytestCheckHook
, pytest-xdist
, pytest-astropy
, python

# runtime
, numpy
@@ -18,21 +24,30 @@
, pyyaml
}:

let
buildPythonPackage rec {
  pname = "astropy";
  version = "5.2.1";
in
buildPythonPackage {
  inherit pname version;
  version = "5.3.3";
  format = "pyproject";

  disabled = pythonOlder "3.8"; # according to setup.cfg

  src = fetchPypi {
    inherit pname version;
    hash = "sha256-9q4noHf46oSQPvp2x5C5hWFzQaAISw0hw5H3o/MyrCM=";
    hash = "sha256-AzDfn116IlQ2fpuM9EJVuhBwsGEjGIxqcu3BgEk/k7s=";
  };
  patches = [
    # Fixes running tests in parallel issue
    # https://github.com/astropy/astropy/issues/15316. Fix from
    # https://github.com/astropy/astropy/pull/15327
    (fetchpatch {
      url = "https://github.com/astropy/astropy/commit/1042c0fb06a992f683bdc1eea2beda0b846ed356.patch";
      hash = "sha256-bApAcGBRrJ94thhByoYvdqw2e6v77+FmTfgmGcE6MMk=";
    })
  ];

  # Relax cython dependency to allow this to build, upstream only doesn't
  # support cython 3 as of writing. See:
  # https://github.com/astropy/astropy/issues/15315
  postPatch = ''
    substituteInPlace pyproject.toml \
      --replace 'cython==' 'cython>='
@@ -54,14 +69,28 @@ buildPythonPackage {
    pyyaml
  ];

  # infinite recursion with pytest-astropy (pytest-astropy-header depends on astropy itself)
  doCheck = false;
  nativeCheckInputs = [
    pytestCheckHook
    pytest-xdist
    pytest-astropy
  ];

  # Not running it inside the build directory. See:
  # https://github.com/astropy/astropy/issues/15316#issuecomment-1722190547
  preCheck = ''
    cd "$out"
    export HOME="$(mktemp -d)"
    export OMP_NUM_THREADS=$(( $NIX_BUILD_CORES / 4 ))
  '';
  pythonImportsCheck = [
    "astropy"
  ];

  meta = with lib; {
  meta = {
    description = "Astronomy/Astrophysics library for Python";
    homepage = "https://www.astropy.org";
    license = licenses.bsd3;
    platforms = platforms.all;
    maintainers = [ maintainers.kentjames ];
    license = lib.licenses.bsd3;
    platforms = lib.platforms.all;
    maintainers = with lib.maintainers; [ kentjames doronbehar ];
  };
}
+2 −0
Original line number Diff line number Diff line
@@ -66,6 +66,8 @@ buildPythonPackage rec {
    description = "Functions and classes to access online data resources";
    homepage = "https://astroquery.readthedocs.io/";
    license = licenses.bsd3;
    # Broken since a certain astropy update, due to API incompatibility
    broken = true;
    maintainers = [ maintainers.smaret ];
  };
}
Loading