default.nix (1973B)
1 { 2 lib, 3 fetchFromGitHub, 4 python3Packages, 5 click, 6 gnumake, 7 curl, 8 unzip, 9 gzip, 10 gdal, 11 testers, 12 elevation, 13 }: 14 15 python3Packages.buildPythonApplication rec { 16 pname = "elevation"; 17 version = "1.1.3"; 18 pyproject = true; 19 20 src = fetchFromGitHub { 21 owner = "bopen"; 22 repo = "elevation"; 23 tag = version; 24 hash = "sha256-sZStJgToQtWYrBH1BjqxCUwQUT5dcAlyZwnb4aYga+4="; 25 }; 26 27 build-system = with python3Packages; [ setuptools-scm ]; 28 29 SETUPTOOLS_SCM_PRETEND_VERSION = version; 30 31 dependencies = with python3Packages; [ 32 fasteners 33 appdirs 34 click 35 setuptools 36 ]; 37 38 postPatch = '' 39 substituteInPlace pyproject.toml --replace-fail "\"setuptools_scm_git_archive\"," "" 40 substituteInPlace tests/test_datasource.py --replace-fail "/tmp" "./tmp" 41 for f in elevation/datasource.* \ 42 elevation/util.py \ 43 tests/test_*.py; do 44 substituteInPlace $f \ 45 --replace-warn "make " "${lib.getExe gnumake} " \ 46 --replace-warn "curl " "${lib.getExe curl} " \ 47 --replace-warn "gunzip " "gunzip.t " \ 48 --replace-warn "unzip " "${lib.getExe unzip} " \ 49 --replace-warn "gunzip.t " "${lib.getBin gzip}/bin/gunzip " \ 50 --replace-warn "gdal_translate " "${lib.getBin gdal}/bin/gdal_translate " \ 51 --replace-warn "gdalbuildvrt " "${lib.getBin gdal}/bin/gdalbuildvrt " 52 done 53 ''; 54 55 nativeCheckInputs = with python3Packages; [ 56 pytestCheckHook 57 pytest-mock 58 ]; 59 60 postInstall = '' 61 install -Dm644 elevation/datasource.mk -t $out/lib/${python3Packages.python.libPrefix}/site-packages/elevation 62 ''; 63 64 passthru.tests.version = testers.testVersion { package = elevation; }; 65 66 meta = { 67 description = "Python script to download global terrain digital elevation models, SRTM 30m DEM and SRTM 90m DEM"; 68 homepage = "http://elevation.bopen.eu/"; 69 license = lib.licenses.asl20; 70 maintainers = [ lib.maintainers.sikmir ]; 71 mainProgram = "eio"; 72 }; 73 }