Merge pull request #98442 from danieldk/weather-cleanups

This commit is contained in:
Doron Behar 2020-09-22 21:23:16 +03:00 committed by GitHub
commit e9364d1737
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,4 +1,4 @@
{ stdenv, fetchurl, pythonPackages }: { stdenv, fetchurl, pythonPackages, installShellFiles }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
version = "2.4.1"; version = "2.4.1";
@ -9,26 +9,33 @@ stdenv.mkDerivation rec {
sha256 = "0nf680dl7a2vlgavdhj6ljq8a7lkhvr6zghkpzad53vmilxsndys"; sha256 = "0nf680dl7a2vlgavdhj6ljq8a7lkhvr6zghkpzad53vmilxsndys";
}; };
nativeBuildInputs = [ pythonPackages.wrapPython ]; nativeBuildInputs = [
installShellFiles
pythonPackages.wrapPython
];
buildInputs = [ pythonPackages.python ]; dontConfigure = true;
dontBuild = true;
phases = [ "unpackPhase" "installPhase" ];
# Upstream doesn't provide a setup.py or alike, so we follow:
# http://fungi.yuggoth.org/weather/doc/install.rst#id3
installPhase = '' installPhase = ''
site_packages=$out/${pythonPackages.python.sitePackages} site_packages=$out/${pythonPackages.python.sitePackages}
mkdir -p $out/{share/{man,weather-util},bin,etc} $site_packages install -Dt $out/bin -m 755 weather
cp weather $out/bin/ install -Dt $site_packages weather.py
cp weather.py $site_packages/ install -Dt $out/share/weather-util \
chmod +x $out/bin/weather airports overrides.{conf,log} places slist stations \
cp airports overrides.{conf,log} places slist stations zctas zlist zones $out/share/weather-util/ zctas zlist zones
cp weatherrc $out/etc install -Dt $out/etc weatherrc
cp weather.1 weatherrc.5 $out/share/man/
sed -i \ sed -i \
-e "s|/etc|$out/etc|g" \ -e "s|/etc|$out/etc|g" \
-e "s|else: default_setpath = \".:~/.weather|&:$out/share/weather-util|" \ -e "s|else: default_setpath = \".:~/.weather|&:$out/share/weather-util|" \
$site_packages/weather.py $site_packages/weather.py
wrapPythonPrograms wrapPythonPrograms
installManPage weather.1 weatherrc.5
''; '';
meta = with stdenv.lib; { meta = with stdenv.lib; {
@ -36,6 +43,6 @@ stdenv.mkDerivation rec {
description = "Quick access to current weather conditions and forecasts"; description = "Quick access to current weather conditions and forecasts";
license = licenses.isc; license = licenses.isc;
maintainers = [ maintainers.matthiasbeyer ]; maintainers = [ maintainers.matthiasbeyer ];
platforms = platforms.linux ++ platforms.darwin; platforms = platforms.unix;
}; };
} }