diff options
author | Alyssa Ross <hi@alyssa.is> | 2021-02-16 18:32:21 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2021-02-16 18:32:21 +0000 |
commit | 9becdcc5df71b47a5da84ad670e9a7eae9e0c65a (patch) | |
tree | 2ddf0335eb393f89501e3753b50c3f7ab0552d12 /nixpkgs/pkgs/servers/home-assistant | |
parent | 49f2a77ac9abc88c253f68952eda26557fc3b555 (diff) | |
parent | ff96a0fa5635770390b184ae74debea75c3fd534 (diff) | |
download | nixlib-9becdcc5df71b47a5da84ad670e9a7eae9e0c65a.tar nixlib-9becdcc5df71b47a5da84ad670e9a7eae9e0c65a.tar.gz nixlib-9becdcc5df71b47a5da84ad670e9a7eae9e0c65a.tar.bz2 nixlib-9becdcc5df71b47a5da84ad670e9a7eae9e0c65a.tar.lz nixlib-9becdcc5df71b47a5da84ad670e9a7eae9e0c65a.tar.xz nixlib-9becdcc5df71b47a5da84ad670e9a7eae9e0c65a.tar.zst nixlib-9becdcc5df71b47a5da84ad670e9a7eae9e0c65a.zip |
nixpkgs: merge nixos-unstable
Diffstat (limited to 'nixpkgs/pkgs/servers/home-assistant')
4 files changed, 110 insertions, 59 deletions
diff --git a/nixpkgs/pkgs/servers/home-assistant/component-packages.nix b/nixpkgs/pkgs/servers/home-assistant/component-packages.nix index e2a656e85b56..40779f4bc198 100644 --- a/nixpkgs/pkgs/servers/home-assistant/component-packages.nix +++ b/nixpkgs/pkgs/servers/home-assistant/component-packages.nix @@ -2,7 +2,7 @@ # Do not edit! { - version = "2021.1.5"; + version = "2021.2.3"; components = { "abode" = ps: with ps; [ abodepy ]; "accuweather" = ps: with ps; [ accuweather ]; @@ -16,6 +16,7 @@ "agent_dvr" = ps: with ps; [ agent-py ]; "air_quality" = ps: with ps; [ ]; "airly" = ps: with ps; [ airly ]; + "airnow" = ps: with ps; [ pyairnow ]; "airvisual" = ps: with ps; [ pyairvisual ]; "aladdin_connect" = ps: with ps; [ ]; # missing inputs: aladdin_connect "alarm_control_panel" = ps: with ps; [ ]; @@ -61,7 +62,7 @@ "auth" = ps: with ps; [ aiohttp-cors ]; "automation" = ps: with ps; [ aiohttp-cors ]; "avea" = ps: with ps; [ avea ]; - "avion" = ps: with ps; [ ]; # missing inputs: avion + "avion" = ps: with ps; [ avion ]; "awair" = ps: with ps; [ ]; # missing inputs: python_awair "aws" = ps: with ps; [ aiobotocore ]; "axis" = ps: with ps; [ aiohttp-cors axis paho-mqtt ]; @@ -96,7 +97,7 @@ "braviatv" = ps: with ps; [ bravia-tv ]; "broadlink" = ps: with ps; [ broadlink ]; "brother" = ps: with ps; [ brother ]; - "brottsplatskartan" = ps: with ps; [ ]; # missing inputs: brottsplatskartan + "brottsplatskartan" = ps: with ps; [ brottsplatskartan ]; "browser" = ps: with ps; [ ]; "brunt" = ps: with ps; [ ]; # missing inputs: brunt "bsblan" = ps: with ps; [ bsblan ]; @@ -107,7 +108,7 @@ "calendar" = ps: with ps; [ aiohttp-cors ]; "camera" = ps: with ps; [ aiohttp-cors ]; "canary" = ps: with ps; [ ha-ffmpeg ]; # missing inputs: py-canary - "cast" = ps: with ps; [ aiohttp-cors hass-nabucasa mutagen plexapi plexauth plexwebsocket PyChromecast pysonos zeroconf ]; + "cast" = ps: with ps; [ aiohttp-cors hass-nabucasa mutagen plexapi plexauth plexwebsocket PyChromecast zeroconf ]; "cert_expiry" = ps: with ps; [ ]; "channels" = ps: with ps; [ ]; # missing inputs: pychannels "circuit" = ps: with ps; [ ]; # missing inputs: circuit-webhook @@ -153,7 +154,7 @@ "deconz" = ps: with ps; [ ]; # missing inputs: pydeconz "decora" = ps: with ps; [ bluepy ]; # missing inputs: decora "decora_wifi" = ps: with ps; [ ]; # missing inputs: decora_wifi - "default_config" = ps: with ps; [ pynacl aiohttp-cors defusedxml distro emoji hass-nabucasa netdisco pillow sqlalchemy zeroconf ]; + "default_config" = ps: with ps; [ pynacl aiohttp-cors defusedxml distro emoji hass-nabucasa netdisco pillow scapy sqlalchemy zeroconf ]; "delijn" = ps: with ps; [ ]; # missing inputs: pydelijn "deluge" = ps: with ps; [ deluge-client ]; "demo" = ps: with ps; [ aiohttp-cors ]; @@ -166,6 +167,7 @@ "device_tracker" = ps: with ps; [ ]; "devolo_home_control" = ps: with ps; [ aiohttp-cors devolo-home-control-api zeroconf ]; "dexcom" = ps: with ps; [ pydexcom ]; + "dhcp" = ps: with ps; [ scapy ]; "dht" = ps: with ps; [ ]; # missing inputs: Adafruit-DHT "dialogflow" = ps: with ps; [ aiohttp-cors ]; "digital_ocean" = ps: with ps; [ digital-ocean ]; @@ -193,7 +195,7 @@ "dwd_weather_warnings" = ps: with ps; [ ]; # missing inputs: dwdwfsapi "dweet" = ps: with ps; [ ]; # missing inputs: dweepy "dynalite" = ps: with ps; [ ]; # missing inputs: dynalite_devices - "dyson" = ps: with ps; [ aiohttp-cors zeroconf ]; # missing inputs: libpurecool + "dyson" = ps: with ps; [ aiohttp-cors libpurecool zeroconf ]; "eafm" = ps: with ps; [ aioeafm ]; "ebox" = ps: with ps; [ ]; # missing inputs: pyebox "ebusd" = ps: with ps; [ ]; # missing inputs: ebusdpy @@ -202,7 +204,7 @@ "econet" = ps: with ps; [ ]; # missing inputs: pyeconet "ecovacs" = ps: with ps; [ ]; # missing inputs: sucks "eddystone_temperature" = ps: with ps; [ construct ]; # missing inputs: beacontools[scan] - "edimax" = ps: with ps; [ ]; # missing inputs: pyedimax + "edimax" = ps: with ps; [ pyedimax ]; "edl21" = ps: with ps; [ ]; # missing inputs: pysml "ee_brightbox" = ps: with ps; [ ]; # missing inputs: eebrightbox "efergy" = ps: with ps; [ ]; @@ -242,7 +244,7 @@ "familyhub" = ps: with ps; [ ]; # missing inputs: python-family-hub-local "fan" = ps: with ps; [ ]; "fastdotcom" = ps: with ps; [ ]; # missing inputs: fastdotcom - "feedreader" = ps: with ps; [ ]; # missing inputs: feedparser-homeassistant + "feedreader" = ps: with ps; [ feedparser ]; "ffmpeg" = ps: with ps; [ ha-ffmpeg ]; "ffmpeg_motion" = ps: with ps; [ ha-ffmpeg ]; "ffmpeg_noise" = ps: with ps; [ ha-ffmpeg ]; @@ -364,6 +366,7 @@ "huawei_lte" = ps: with ps; [ getmac stringcase url-normalize ]; # missing inputs: huawei-lte-api "huawei_router" = ps: with ps; [ ]; "hue" = ps: with ps; [ aiohue ]; + "huisbaasje" = ps: with ps; [ ]; # missing inputs: huisbaasje-client "humidifier" = ps: with ps; [ ]; "hunterdouglas_powerview" = ps: with ps; [ ]; # missing inputs: aiopvapi "hvv_departures" = ps: with ps; [ ]; # missing inputs: pygti @@ -460,7 +463,7 @@ "luftdaten" = ps: with ps; [ luftdaten ]; "lupusec" = ps: with ps; [ ]; # missing inputs: lupupy "lutron" = ps: with ps; [ pylutron ]; - "lutron_caseta" = ps: with ps; [ ]; # missing inputs: pylutron-caseta + "lutron_caseta" = ps: with ps; [ ]; # missing inputs: aiolip pylutron-caseta "lw12wifi" = ps: with ps; [ ]; # missing inputs: lw12 "lyft" = ps: with ps; [ ]; # missing inputs: lyft_rides "magicseaweed" = ps: with ps; [ ]; # missing inputs: magicseaweed @@ -558,7 +561,7 @@ "nsw_rural_fire_service_feed" = ps: with ps; [ ]; # missing inputs: aio_geojson_nsw_rfs_incidents "nuheat" = ps: with ps; [ ]; # missing inputs: nuheat "nuimo_controller" = ps: with ps; [ ]; # missing inputs: --only-binary=all nuimo - "nuki" = ps: with ps; [ ]; # missing inputs: pynuki + "nuki" = ps: with ps; [ pynuki ]; "numato" = ps: with ps; [ ]; # missing inputs: numato-gpio "number" = ps: with ps; [ ]; "nut" = ps: with ps; [ ]; # missing inputs: pynut2 @@ -573,6 +576,7 @@ "ombi" = ps: with ps; [ ]; # missing inputs: pyombi "omnilogic" = ps: with ps; [ ]; # missing inputs: omnilogic "onboarding" = ps: with ps; [ aiohttp-cors pillow ]; + "ondilo_ico" = ps: with ps; [ aiohttp-cors ]; # missing inputs: ondilo "onewire" = ps: with ps; [ ]; # missing inputs: pi1wire pyownet "onkyo" = ps: with ps; [ onkyo-eiscp ]; "onvif" = ps: with ps; [ ha-ffmpeg zeep ]; # missing inputs: WSDiscovery onvif-zeep-async @@ -588,7 +592,7 @@ "opensensemap" = ps: with ps; [ opensensemap-api ]; "opensky" = ps: with ps; [ ]; "opentherm_gw" = ps: with ps; [ ]; # missing inputs: pyotgw - "openuv" = ps: with ps; [ ]; # missing inputs: pyopenuv + "openuv" = ps: with ps; [ pyopenuv ]; "openweathermap" = ps: with ps; [ pyowm ]; "opnsense" = ps: with ps; [ pyopnsense ]; "opple" = ps: with ps; [ ]; # missing inputs: pyoppleio @@ -599,7 +603,7 @@ "otp" = ps: with ps; [ pyotp ]; "ovo_energy" = ps: with ps; [ ]; # missing inputs: ovoenergy "owntracks" = ps: with ps; [ pynacl aiohttp-cors hass-nabucasa paho-mqtt ]; - "ozw" = ps: with ps; [ aiohttp-cors paho-mqtt ]; # missing inputs: python-openzwave-mqtt[mqtt-client] + "ozw" = ps: with ps; [ aiohttp-cors homeassistant-pyozw paho-mqtt pydispatcher python-openzwave-mqtt ]; "panasonic_bluray" = ps: with ps; [ ]; # missing inputs: panacotta "panasonic_viera" = ps: with ps; [ ]; # missing inputs: panasonic_viera "pandora" = ps: with ps; [ pexpect ]; @@ -620,8 +624,8 @@ "pjlink" = ps: with ps; [ ]; # missing inputs: pypjlink2 "plaato" = ps: with ps; [ aiohttp-cors ]; "plant" = ps: with ps; [ sqlalchemy ]; - "plex" = ps: with ps; [ aiohttp-cors plexapi plexauth plexwebsocket pysonos ]; - "plugwise" = ps: with ps; [ ]; # missing inputs: plugwise + "plex" = ps: with ps; [ aiohttp-cors plexapi plexauth plexwebsocket ]; + "plugwise" = ps: with ps; [ plugwise ]; "plum_lightpad" = ps: with ps; [ ]; # missing inputs: plumlightpad "pocketcasts" = ps: with ps; [ ]; # missing inputs: pycketcasts "point" = ps: with ps; [ aiohttp-cors ]; # missing inputs: pypoint @@ -636,7 +640,6 @@ "proxmoxve" = ps: with ps; [ ]; # missing inputs: proxmoxer "proxy" = ps: with ps; [ pillow ]; "ps4" = ps: with ps; [ ]; # missing inputs: pyps4-2ndscreen - "ptvsd" = ps: with ps; [ ]; # missing inputs: ptvsd "pulseaudio_loopback" = ps: with ps; [ pulsectl ]; "push" = ps: with ps; [ aiohttp-cors ]; "pushbullet" = ps: with ps; [ pushbullet ]; @@ -659,11 +662,11 @@ "rainbird" = ps: with ps; [ ]; # missing inputs: pyrainbird "raincloud" = ps: with ps; [ ]; # missing inputs: raincloudy "rainforest_eagle" = ps: with ps; [ ]; # missing inputs: eagle200_reader uEagle - "rainmachine" = ps: with ps; [ ]; # missing inputs: regenmaschine + "rainmachine" = ps: with ps; [ regenmaschine ]; "random" = ps: with ps; [ ]; "raspihats" = ps: with ps; [ smbus-cffi ]; # missing inputs: raspihats "raspyrfm" = ps: with ps; [ ]; # missing inputs: raspyrfm-client - "recollect_waste" = ps: with ps; [ ]; # missing inputs: aiorecollect + "recollect_waste" = ps: with ps; [ aiorecollect ]; "recorder" = ps: with ps; [ sqlalchemy ]; "recswitch" = ps: with ps; [ ]; # missing inputs: pyrecswitch "reddit" = ps: with ps; [ praw ]; @@ -741,7 +744,7 @@ "slack" = ps: with ps; [ ]; # missing inputs: slackclient "sleepiq" = ps: with ps; [ ]; # missing inputs: sleepyq "slide" = ps: with ps; [ ]; # missing inputs: goslide-api - "sma" = ps: with ps; [ ]; # missing inputs: pysma + "sma" = ps: with ps; [ pysma ]; "smappee" = ps: with ps; [ aiohttp-cors ]; # missing inputs: pysmappee "smart_meter_texas" = ps: with ps; [ ]; # missing inputs: smart-meter-texas "smarthab" = ps: with ps; [ ]; # missing inputs: smarthab @@ -758,13 +761,13 @@ "solaredge" = ps: with ps; [ stringcase ]; # missing inputs: solaredge "solaredge_local" = ps: with ps; [ ]; # missing inputs: solaredge-local "solarlog" = ps: with ps; [ ]; # missing inputs: sunwatcher - "solax" = ps: with ps; [ ]; # missing inputs: solax + "solax" = ps: with ps; [ solax ]; "soma" = ps: with ps; [ pysoma ]; "somfy" = ps: with ps; [ aiohttp-cors ]; # missing inputs: pymfy "somfy_mylink" = ps: with ps; [ ]; # missing inputs: somfy-mylink-synergy "sonarr" = ps: with ps; [ ]; # missing inputs: sonarr "songpal" = ps: with ps; [ ]; # missing inputs: python-songpal - "sonos" = ps: with ps; [ pysonos ]; + "sonos" = ps: with ps; [ aiohttp-cors plexapi plexauth plexwebsocket pysonos ]; "sony_projector" = ps: with ps; [ ]; # missing inputs: pysdcp "soundtouch" = ps: with ps; [ aiohttp-cors libsoundtouch zeroconf ]; "spaceapi" = ps: with ps; [ aiohttp-cors ]; @@ -898,7 +901,7 @@ "verisure" = ps: with ps; [ jsonpath vsure ]; "versasense" = ps: with ps; [ ]; # missing inputs: pyversasense "version" = ps: with ps; [ pyhaversion ]; - "vesync" = ps: with ps; [ ]; # missing inputs: pyvesync + "vesync" = ps: with ps; [ pyvesync ]; "viaggiatreno" = ps: with ps; [ ]; "vicare" = ps: with ps; [ ]; # missing inputs: PyViCare "vilfo" = ps: with ps; [ ]; # missing inputs: vilfo-api-client @@ -941,7 +944,7 @@ "x10" = ps: with ps; [ ]; "xbee" = ps: with ps; [ ]; # missing inputs: xbee-helper "xbox" = ps: with ps; [ aiohttp-cors ]; # missing inputs: xbox-webapi - "xbox_live" = ps: with ps; [ ]; # missing inputs: xboxapi + "xbox_live" = ps: with ps; [ xboxapi ]; "xeoma" = ps: with ps; [ pyxeoma ]; "xfinity" = ps: with ps; [ ]; # missing inputs: xfinity-gateway "xiaomi" = ps: with ps; [ ha-ffmpeg ]; @@ -962,7 +965,7 @@ "zamg" = ps: with ps; [ ]; "zengge" = ps: with ps; [ ]; # missing inputs: zengge "zeroconf" = ps: with ps; [ aiohttp-cors zeroconf ]; - "zerproc" = ps: with ps; [ ]; # missing inputs: pyzerproc + "zerproc" = ps: with ps; [ pyzerproc ]; "zestimate" = ps: with ps; [ xmltodict ]; "zha" = ps: with ps; [ bellows pyserial-asyncio pyserial zha-quirks zigpy-cc zigpy-deconz zigpy-xbee zigpy-zigate zigpy-znp zigpy ]; "zhong_hong" = ps: with ps; [ ]; # missing inputs: zhong_hong_hvac @@ -970,6 +973,7 @@ "zodiac" = ps: with ps; [ ]; "zone" = ps: with ps; [ ]; "zoneminder" = ps: with ps; [ zm-py ]; - "zwave" = ps: with ps; [ homeassistant-pyozw pydispatcher ]; + "zwave" = ps: with ps; [ aiohttp-cors homeassistant-pyozw paho-mqtt pydispatcher python-openzwave-mqtt ]; + "zwave_js" = ps: with ps; [ aiohttp-cors ]; # missing inputs: zwave-js-server-python }; } diff --git a/nixpkgs/pkgs/servers/home-assistant/default.nix b/nixpkgs/pkgs/servers/home-assistant/default.nix index 3a6b5d353209..fae857fda5dc 100644 --- a/nixpkgs/pkgs/servers/home-assistant/default.nix +++ b/nixpkgs/pkgs/servers/home-assistant/default.nix @@ -1,4 +1,4 @@ -{ stdenv, nixosTests, lib, fetchurl, fetchFromGitHub, fetchpatch, python3, protobuf3_6 +{ stdenv, nixosTests, lib, fetchFromGitHub, python3 # Look up dependencies of specified components in component-packages.nix , extraComponents ? [ ] @@ -57,7 +57,7 @@ let extraBuildInputs = extraPackages py.pkgs; # Don't forget to run parse-requirements.py after updating - hassVersion = "2021.1.5"; + hassVersion = "2021.2.3"; in with py.pkgs; buildPythonApplication rec { pname = "homeassistant"; @@ -76,7 +76,7 @@ in with py.pkgs; buildPythonApplication rec { owner = "home-assistant"; repo = "core"; rev = version; - sha256 = "sha256-xi5rHZlhwgEHll3TFlRu7D963tdcQNMmWcoXVjEFLXo="; + sha256 = "0s1jcd94wwvmvzq86w8s9dwfvnmjs9l661z9pc6kwgagggjjgd8c"; }; # leave this in, so users don't have to constantly update their downstream patch handling @@ -84,49 +84,76 @@ in with py.pkgs; buildPythonApplication rec { postPatch = '' substituteInPlace setup.py \ - --replace "aiohttp==3.7.1" "aiohttp>=3.6.3" \ --replace "attrs==19.3.0" "attrs>=19.3.0" \ --replace "bcrypt==3.1.7" "bcrypt>=3.1.7" \ --replace "cryptography==3.2" "cryptography" \ --replace "pip>=8.0.3,<20.3" "pip" \ - --replace "requests==2.25.0" "requests>=2.24.0" \ + --replace "pytz>=2020.5" "pytz>=2020.4" \ + --replace "pyyaml==5.4.1" "pyyaml" \ + --replace "requests==2.25.1" "requests>=2.25.0" \ --replace "ruamel.yaml==0.15.100" "ruamel.yaml>=0.15.100" substituteInPlace tests/test_config.py --replace '"/usr"' '"/build/media"' ''; propagatedBuildInputs = [ - # From setup.py - aiohttp astral async-timeout attrs bcrypt certifi ciso8601 httpx jinja2 - pyjwt cryptography pip python-slugify pytz pyyaml requests ruamel_yaml - setuptools voluptuous voluptuous-serialize yarl - # From default_config. frontend, http, image, mobile_app and recorder components as well as - # the auth.mfa_modules.totp module - aiohttp-cors defusedxml distro emoji hass-frontend pynacl pillow pyotp - pyqrcode sqlalchemy + # Only packages required in setup.py + hass-frontend + aiohttp + astral + async-timeout + attrs + awesomeversion + bcrypt + certifi + ciso8601 + cryptography + hass-frontend + httpx + jinja2 + pip + pyjwt + python-slugify + pytz + pyyaml + requests + ruamel_yaml + voluptuous + voluptuous-serialize + yarl ] ++ componentBuildInputs ++ extraBuildInputs; # upstream only tests on Linux, so do we. doCheck = stdenv.isLinux; checkInputs = [ - asynctest pytestCheckHook pytest-aiohttp pytest_xdist requests-mock hass-nabucasa netdisco pydispatcher - ]; + # test infrastructure + asynctest + pytest-aiohttp + pytest-xdist + pytestCheckHook + requests-mock + # component dependencies + pyotp + ] ++ lib.concatMap (component: getPackages component py.pkgs) componentTests; # We cannot test all components, since they'd introduce lots of dependencies, some of which are unpackaged, # but we should test very common stuff, like what's in `default_config`. + # https://github.com/home-assistant/core/commits/dev/homeassistant/components/default_config/manifest.json componentTests = [ "api" "automation" "config" "configurator" + "counter" "default_config" "demo" + "dhcp" "discovery" "frontend" "group" "history" "homeassistant" "http" + "hue" "input_boolean" "input_datetime" "input_text" @@ -145,42 +172,34 @@ in with py.pkgs; buildPythonApplication rec { "system_health" "system_log" "tag" + "timer" + "webhook" "websocket_api" "zeroconf" "zone" + "zwave" ]; pytestFlagsArray = [ - "-n auto" + # limit amout of runners to reduce race conditions + "-n 2" + # assign tests grouped by file to workers + "--dist loadfile" # don't bulk test all components "--ignore tests/components" - # prone to race conditions due to parallel file access - "--ignore tests/test_config.py" - # tries to import unpackaged dependencies - "--ignore tests/test_loader.py" # pyotp since v2.4.0 complains about the short mock keys, hass pins v2.3.0 "--ignore tests/auth/mfa_modules/test_notify.py" "tests" ] ++ map (component: "tests/components/" + component) componentTests; disabledTests = [ - # AssertionError: merge_log_err.call_count != 0 + # AssertionError: assert 1 == 0 "test_merge" # ModuleNotFoundError: No module named 'pyqwikswitch' "test_merge_id_schema" - # AssertionError: assert 'unknown' == 'not_home' - "test_device_tracker_not_home" - # Racy https://github.com/home-assistant/core/issues/41425 - "test_cached_event_message" - # ValueError: count must be a positive integer (got 0) - "test_media_view" - # AssertionError: len(events) == 1 - "test_error_posted_as_event" # keyring.errors.NoKeyringError: No recommended backend was available. "test_secrets_from_unrelated_fails" "test_secrets_credstash" - # RuntimeError: Event loop is closed - "test_remove_older_logs" ]; preCheck = '' diff --git a/nixpkgs/pkgs/servers/home-assistant/frontend.nix b/nixpkgs/pkgs/servers/home-assistant/frontend.nix index 9606f8645a1d..812f4d096cef 100644 --- a/nixpkgs/pkgs/servers/home-assistant/frontend.nix +++ b/nixpkgs/pkgs/servers/home-assistant/frontend.nix @@ -4,11 +4,11 @@ buildPythonPackage rec { # the frontend version corresponding to a specific home-assistant version can be found here # https://github.com/home-assistant/home-assistant/blob/master/homeassistant/components/frontend/manifest.json pname = "home-assistant-frontend"; - version = "20201229.1"; + version = "20210127.7"; src = fetchPypi { inherit pname version; - sha256 = "sha256-3JMWugAiVDq/NBgX8ft2Bchim2g493jy7wZvvXrX+Ws="; + sha256 = "sha256-N+n1DI1oZ/j+GydH+Du21zTNA6leW4YBri7cAMvAac4="; }; # there is nothing to strip in this package diff --git a/nixpkgs/pkgs/servers/home-assistant/parse-requirements.py b/nixpkgs/pkgs/servers/home-assistant/parse-requirements.py index 55e58d7a017f..eeb117a984e4 100755 --- a/nixpkgs/pkgs/servers/home-assistant/parse-requirements.py +++ b/nixpkgs/pkgs/servers/home-assistant/parse-requirements.py @@ -1,5 +1,5 @@ #! /usr/bin/env nix-shell -#! nix-shell -i python3 -p "python3.withPackages (ps: with ps; [ mypy attrs ]) +#! nix-shell -i python3 -p "python3.withPackages (ps: with ps; [ mypy attrs packaging rich ]) # # This script downloads Home Assistant's source tarball. # Inside the homeassistant/components directory, each integration has an associated manifest.json, @@ -26,6 +26,9 @@ import tempfile from io import BytesIO from typing import Dict, Optional, Set, Any from urllib.request import urlopen +from packaging import version as Version +from rich.console import Console +from rich.table import Table COMPONENT_PREFIX = "homeassistant.components" PKG_SET = "python3Packages" @@ -142,12 +145,20 @@ def name_to_attr_path(req: str, packages: Dict[str, Dict[str, str]]) -> Optional return None +def get_pkg_version(package: str, packages: Dict[str, Dict[str, str]]) -> Optional[str]: + pkg = packages.get(f"{PKG_SET}.{package}", None) + if not pkg: + return None + return pkg["version"] + + def main() -> None: packages = dump_packages() version = get_version() print("Generating component-packages.nix for version {}".format(version)) components = parse_components(version=version) build_inputs = {} + outdated = {} for component in sorted(components.keys()): attr_paths = [] missing_reqs = [] @@ -156,8 +167,14 @@ def main() -> None: # Some requirements are specified by url, e.g. https://example.org/foobar#xyz==1.0.0 # Therefore, if there's a "#" in the line, only take the part after it req = req[req.find("#") + 1 :] - name = req.split("==")[0] + name, required_version = req.split("==", maxsplit=1) attr_path = name_to_attr_path(name, packages) + if our_version := get_pkg_version(name, packages): + if Version.parse(our_version) < Version.parse(required_version): + outdated[name] = { + 'wanted': required_version, + 'current': our_version + } if attr_path is not None: # Add attribute path without "python3Packages." prefix attr_paths.append(attr_path[len(PKG_SET + ".") :]) @@ -189,6 +206,17 @@ def main() -> None: f.write(" };\n") f.write("}\n") + if outdated: + table = Table(title="Outdated dependencies") + table.add_column("Package") + table.add_column("Current") + table.add_column("Wanted") + for package, version in sorted(outdated.items()): + table.add_row(package, version['current'], version['wanted']) + + console = Console() + console.print(table) + if __name__ == "__main__": run_mypy() |