python3Packages.astropy-extension-helpers: init at 0.1

This commit is contained in:
Robert T. McGibbon 2020-12-27 19:15:59 -05:00
parent 182945f285
commit 7ef5a93fe1
4 changed files with 53 additions and 43 deletions

View file

@ -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 ];
};
}

View file

@ -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)

View file

@ -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 = [ ];
};
}

View file

@ -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 { };