Name: shadowfinder Version: 0.7.1 Release: 2%{?dist} Summary: Find the possible locations of a shadow from its length and the time License: MIT URL: https://github.com/bellingcat/ShadowFinder Source0: %{url}/archive/%{version}/ShadowFinder-%{version}.tar.gz # Read the map's coastlines and borders from natural-earth-map-data # instead of downloading them on first use Patch: shadowfinder-0.7.1-system-natural-earth.patch BuildArch: noarch BuildRequires: python3-devel BuildRequires: python3-pytest BuildRequires: natural-earth-map-data-110m # The world map uses the 110m coastlines and borders. Requires: natural-earth-map-data-110m %description ShadowFinder, from Bellingcat, takes the height of an object, the length of its shadow and the date and time a photo was taken, and maps everywhere on Earth where the sun stood at the matching angle. It narrows down where an image could have been taken; it can also start from a known sun altitude. %prep %autosetup -n ShadowFinder-%{version} -p1 # Upstream's caret pins lag Fedora's versions. sed -i -e '/^\[tool.poetry.dependencies\]/,/^$/{/^python /!{s/= "[~^>][^"]*"/= "*"/; s/version = "[~^][^"]*"/version = "*"/}}' \ pyproject.toml # timezonefinder 6.6 dropped its "pytz" extra; pytz is a direct # dependency here anyway. sed -i 's/^timezonefinder = {version = "[^"]*", extras = \["pytz"\]}$/timezonefinder = "*"/' pyproject.toml grep -q '^timezonefinder = "\*"$' pyproject.toml # The CLI reads the precomputed time zone grid from the working directory, # and find_sun's default is misspelled; use the installed copy. sed -i -E '/def generate_timezone_grid/,$!s;grid: str = "time(zone|zene)_grid.json",;grid: str = "%{_datadir}/%{name}/timezone_grid.json",;' \ src/shadowfinder/cli.py test "$(grep -c '%{_datadir}/%{name}/timezone_grid.json' src/shadowfinder/cli.py)" = 2 %generate_buildrequires %pyproject_buildrequires %build %pyproject_wheel %install %pyproject_install # f43's poetry-core does not record License-File (PEP 639). %pyproject_save_files -L shadowfinder install -Dpm 0644 timezone_grid.json %{buildroot}%{_datadir}/%{name}/timezone_grid.json %check %pyproject_check_import export MPLBACKEND=Agg %pytest tests # Draw a map with no network and an empty cartopy cache: this fails if # cartopy tries to download Natural Earth. export XDG_DATA_HOME=$(mktemp -d) %{py3_test_envvars} %{python3} - <<'EOF' import datetime, os from shadowfinder import ShadowFinder sf = ShadowFinder(10, 8, datetime.datetime(2024, 6, 21, 12, 0)) sf.find_shadows() sf.plot_shadows().savefig("map.png") assert os.path.getsize("map.png") > 10000 cache = os.path.join(os.environ["XDG_DATA_HOME"], "cartopy") assert not os.path.exists(cache), os.listdir(cache) EOF %files -f %{pyproject_files} %license LICENSE %doc README.md %{_bindir}/shadowfinder %{_datadir}/%{name}/ %changelog * Sat Oct 31 2026 Morgan Hough - 0.7.1-2 - Draw the map from natural-earth-map-data instead of downloading it * Sat Oct 31 2026 Morgan Hough - 0.7.1-1 - Initial package