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