diff --git a/pkgs/development/python-modules/astropy-extension-helpers/default.nix b/pkgs/development/python-modules/astropy-extension-helpers/default.nix new file mode 100644 index 000000000000..bd9dca338fcd --- /dev/null +++ b/pkgs/development/python-modules/astropy-extension-helpers/default.nix @@ -0,0 +1,31 @@ +{ lib +, buildPythonPackage +, fetchPypi +, pytestCheckHook +}: + +buildPythonPackage rec { + pname = "extension-helpers"; + version = "0.1"; + format = "pyproject"; + + src = fetchPypi { + inherit pname version; + sha256 = "10iqjzmya2h4sk765dlm1pbqypwlqyh8rw59a5m9i63d3klnz2mc"; + }; + + patches = [ ./permissions.patch ]; + + checkInputs = [ pytestCheckHook ]; + + pythonImportsCheck = [ + "extension_helpers" + ]; + + meta = with lib; { + description = "Utilities for building and installing packages in the Astropy ecosystem"; + homepage = "https://github.com/astropy/extension-helpers"; + license = licenses.bsd3; + maintainers = [ maintainers.rmcgibbo ]; + }; +} diff --git a/pkgs/development/python-modules/astropy-extension-helpers/permissions.patch b/pkgs/development/python-modules/astropy-extension-helpers/permissions.patch new file mode 100644 index 000000000000..cef74b336034 --- /dev/null +++ b/pkgs/development/python-modules/astropy-extension-helpers/permissions.patch @@ -0,0 +1,20 @@ +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) diff --git a/pkgs/development/python-modules/extension-helpers/default.nix b/pkgs/development/python-modules/extension-helpers/default.nix deleted file mode 100644 index 0c23a69a89cd..000000000000 --- a/pkgs/development/python-modules/extension-helpers/default.nix +++ /dev/null @@ -1,41 +0,0 @@ -{ lib -, buildPythonPackage -, fetchPypi -, isPy27 -, pytestCheckHook -, setuptools_scm -}: - -buildPythonPackage rec { - pname = "extension-helpers"; - version = "0.1"; - disabled = isPy27; - - src = fetchPypi { - inherit pname version; - sha256 = "10iqjzmya2h4sk765dlm1pbqypwlqyh8rw59a5m9i63d3klnz2mc"; - }; - - nativeBuildInputs = [ - setuptools_scm - ]; - - propagatedBuildInputs = [ - pytestCheckHook - ]; - - # avoid importing local module - preCheck = '' - cd extension_helpers - ''; - - # assumes setup.py is in pwd - disabledTests = [ "compiler_module" ]; - - meta = with lib; { - description = "Helpers to assist with building packages with compiled C/Cython extensions"; - homepage = "https://github.com/astropy/extension-helpers"; - license = licenses.bsd3; - maintainers = [ ]; - }; -} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 33d255216962..10bb3c528573 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -421,6 +421,8 @@ in { astropy-helpers = callPackage ../development/python-modules/astropy-helpers { }; + astropy-extension-helpers = callPackage ../development/python-modules/astropy-extension-helpers { }; + astroquery = callPackage ../development/python-modules/astroquery { }; asttokens = callPackage ../development/python-modules/asttokens { }; @@ -1997,8 +1999,6 @@ in { exifread = callPackage ../development/python-modules/exifread { }; - extension-helpers = callPackage ../development/python-modules/extension-helpers { }; - extras = callPackage ../development/python-modules/extras { }; eyeD3 = callPackage ../development/python-modules/eyed3 { };