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