at master 2.9 kB view raw
1{ 2 lib, 3 fetchurl, 4 fetchFromGitHub, 5 buildPythonPackage, 6 python, 7 8 # build-system 9 setuptools, 10 11 # dependencies 12 otb, 13 14 # tests 15 pytestCheckHook, 16 pytest-cov-stub, 17 requests, 18 writableTmpDirAsHomeHook, 19}: 20let 21 # fetch the test data separately or else none of the test will work 22 # https://github.com/orfeotoolbox/pyotb/blob/develop/tests/tests_data.py 23 spotImage = fetchurl { 24 url = "https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb/-/raw/develop/Data/Input/SP67_FR_subset_1.tif"; 25 sha256 = "sha256-MuWY/g7KI+F23lFY/+AX5MLWJlIgHCr5BvFjDHzpWgY="; 26 }; 27 28 pleiadesImage = fetchurl { 29 url = "https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb/-/raw/develop/Data/Baseline/OTB/Images/prTvOrthoRectification_pleiades-1_noDEM.tif"; 30 sha256 = "sha256-1EsGAJdHgBIb/gfbh4Y7yEEmYHb54bSx4fEMKssZ/oA="; 31 }; 32 33 otbWithPy = otb.override { 34 enablePython = true; 35 python3 = python; 36 }; 37in 38buildPythonPackage rec { 39 pname = "pyotb"; 40 version = "2.1.0"; 41 pyproject = true; 42 43 src = fetchFromGitHub { 44 owner = "orfeotoolbox"; 45 repo = "pyotb"; 46 tag = version; 47 hash = "sha256-KomIMVx4jfsTSbGtoml9ON/82sHanOkp/mp1TiUaa2E="; 48 }; 49 50 postPatch = '' 51 substituteInPlace pyotb/helpers.py \ 52 --replace-fail 'OTB_ROOT = os.environ.get("OTB_ROOT")' 'OTB_ROOT = "${otbWithPy}"' \ 53 --replace-fail 'os.environ["GDAL_DATA"] = gdal_data' "" \ 54 --replace-fail 'os.environ["PROJ_LIB"] = proj_lib' "" \ 55 --replace-fail 'os.environ["GDAL_DRIVER_PATH"] = "disable"' "" 56 57 ln -s ${spotImage} $HOME/SP67_FR_subset_1.tif 58 ln -s ${pleiadesImage} $HOME/prTvOrthoRectification_pleiades-1_noDEM.tif 59 60 substituteInPlace tests/tests_data.py \ 61 --replace-fail \ 62 'SPOT_IMG_URL = "https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb/-/raw/develop/Data/Input/SP67_FR_subset_1.tif"' \ 63 "SPOT_IMG_URL = '$HOME/SP67_FR_subset_1.tif'" \ 64 --replace-fail \ 65 'PLEIADES_IMG_URL = "https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb/-/raw/develop/Data/Baseline/OTB/Images/prTvOrthoRectification_pleiades-1_noDEM.tif"' \ 66 "PLEIADES_IMG_URL = '$HOME/prTvOrthoRectification_pleiades-1_noDEM.tif'" 67 ''; 68 69 build-system = [ 70 setuptools 71 ]; 72 73 dependencies = [ otbWithPy ]; 74 75 pythonImportsCheck = [ "pyotb" ]; 76 77 nativeCheckInputs = [ 78 pytestCheckHook 79 pytest-cov-stub 80 requests 81 writableTmpDirAsHomeHook 82 ]; 83 84 disabledTests = [ 85 # test requires network access as inputs needs to be url 86 "test_app_input_vsi" 87 "test_img_metadata" 88 "test_summarize_pipeline_simple" 89 "test_summarize_pipeline_diamond" 90 "test_summarize_strip_output" 91 ]; 92 93 meta = { 94 description = "Python extension of Orfeo Toolbox"; 95 homepage = "https://github.com/orfeotoolbox/pyotb"; 96 changelog = "https://github.com/orfeotoolbox/pyotb/tag/${version}"; 97 license = lib.licenses.asl20; 98 maintainers = with lib.maintainers; [ daspk04 ]; 99 }; 100}