default.nix (1619B)
1 { lib 2 , fetchFromGitHub 3 , python3Packages 4 , click 5 , gnumake 6 , curl 7 , unzip 8 , gzip 9 , gdal 10 }: 11 12 python3Packages.buildPythonApplication rec { 13 pname = "elevation"; 14 version = "1.1.3"; 15 16 src = fetchFromGitHub { 17 owner = "bopen"; 18 repo = pname; 19 rev = version; 20 hash = "sha256-sZStJgToQtWYrBH1BjqxCUwQUT5dcAlyZwnb4aYga+4="; 21 }; 22 23 propagatedBuildInputs = with python3Packages; [ fasteners appdirs click setuptools ]; 24 25 postPatch = '' 26 for f in elevation/datasource.* \ 27 elevation/util.py \ 28 tests/test_*.py; do 29 substituteInPlace $f \ 30 --replace "make " "${lib.getBin gnumake}/bin/make " \ 31 --replace "curl " "${lib.getBin curl}/bin/curl " \ 32 --replace "gunzip " "gunzip.t " \ 33 --replace "unzip " "${lib.getBin unzip}/bin/unzip " \ 34 --replace "gunzip.t " "${lib.getBin gzip}/bin/gunzip " \ 35 --replace "gdal_translate " "${lib.getBin gdal}/bin/gdal_translate " \ 36 --replace "gdalbuildvrt " "${lib.getBin gdal}/bin/gdalbuildvrt " 37 done 38 ''; 39 40 checkInputs = with python3Packages; [ pytestCheckHook pytest-mock ]; 41 42 postInstall = '' 43 install -Dm644 elevation/datasource.mk -t $out/lib/${python3Packages.python.libPrefix}/site-packages/elevation 44 ''; 45 46 doInstallCheck = true; 47 48 installCheckPhase = "$out/bin/eio selfcheck"; 49 50 meta = with lib; { 51 description = "Python script to download global terrain digital elevation models, SRTM 30m DEM and SRTM 90m DEM"; 52 homepage = "http://elevation.bopen.eu/"; 53 license = licenses.asl20; 54 maintainers = [ maintainers.sikmir ]; 55 platforms = platforms.unix; 56 }; 57 }