Merge pull request #60217 from dotlambda/home-assistant-0.92

home-assistant: 0.91.4 -> 0.92.2
This commit is contained in:
Robert Schütz 2019-05-05 23:31:31 +02:00 committed by GitHub
commit 1ea22b8868
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 202 additions and 1538 deletions

View File

@ -21,32 +21,23 @@ let
availableComponents = cfg.package.availableComponents; availableComponents = cfg.package.availableComponents;
# Given component "parentConfig.platform", returns whether config.parentConfig usedPlatforms = config:
# is a list containing a set with set.platform == "platform". if isAttrs config then
optional (config ? platform) config.platform
++ concatMap usedPlatforms (attrValues config)
else if isList config then
concatMap usedPlatforms config
else [ ];
# Given a component "platform", looks up whether it is used in the config
# as `platform = "platform";`.
# #
# For example, the component sensor.luftdaten is used as follows: # For example, the component mqtt.sensor is used as follows:
# config.sensor = [ { # config.sensor = [ {
# platform = "luftdaten"; # platform = "mqtt";
# ... # ...
# } ]; # } ];
# useComponentPlatform = component: elem component (usedPlatforms cfg.config);
# Beginning with 0.87 Home Assistant is migrating their components to the
# scheme "platform.subComponent", e.g. "hue.light" instead of "light.hue".
# See https://developers.home-assistant.io/blog/2019/02/19/the-great-migration.html.
# Hence, we also check whether we find an entry in the config when interpreting
# the first part of the path as the component.
useComponentPlatform = component:
let
path = splitString "." component;
# old: platform is the last part of path
parentConfig = attrByPath (init path) null cfg.config;
platform = last path;
# new: platform is the first part of the path
parentConfig' = attrByPath (tail path) null cfg.config;
platform' = head path;
in
(isList parentConfig && any (item: item.platform or null == platform) parentConfig)
|| (isList parentConfig' && any (item: item.platform or null == platform') parentConfig');
# Returns whether component is used in config # Returns whether component is used in config
useComponent = component: useComponent = component:

View File

@ -2,11 +2,11 @@
buildPythonPackage rec { buildPythonPackage rec {
pname = "PyChromecast"; pname = "PyChromecast";
version = "3.2.0"; version = "3.2.1";
src = fetchPypi { src = fetchPypi {
inherit pname version; inherit pname version;
sha256 = "0jksh7rb4880kni8iw3hb5q9dm5gi40zmx4r2fwydnpfhadhq5af"; sha256 = "e1e71e30581e1021b6bdd50a80cfcdcfa86d9082171fdd719c5ca6a77b8a9699";
}; };
disabled = !isPy3k; disabled = !isPy3k;

View File

@ -1,17 +1,19 @@
{ stdenv, fetchPypi, buildPythonPackage, unidecode, regex, isPy3k }: { stdenv, fetchPypi, buildPythonPackage, python, text-unidecode }:
buildPythonPackage rec { buildPythonPackage rec {
pname = "python-slugify"; pname = "python-slugify";
version = "2.0.1"; version = "3.0.2";
src = fetchPypi { src = fetchPypi {
inherit pname version; inherit pname version;
sha256 = "d3e034397236020498e677a35e5c05dcc6ba1624b608b9ef7e5fe3090ccbd5a8"; sha256 = "57163ffb345c7e26063435a27add1feae67fa821f1ef4b2f292c25847575d758";
}; };
doCheck = !isPy3k;
# (only) on python3 unittest loader (loadTestsFromModule) fails
propagatedBuildInputs = [ unidecode regex ]; propagatedBuildInputs = [ text-unidecode ];
checkPhase = ''
${python.interpreter} test.py
'';
meta = with stdenv.lib; { meta = with stdenv.lib; {
homepage = https://github.com/un33k/python-slugify; homepage = https://github.com/un33k/python-slugify;

View File

@ -2,11 +2,11 @@
buildPythonPackage rec { buildPythonPackage rec {
pname = "pytz"; pname = "pytz";
version = "2018.9"; version = "2019.1";
src = fetchPypi { src = fetchPypi {
inherit pname version; inherit pname version;
sha256 = "d5f05e487007e29e03409f9398d074e158d920d36eb82eaf66fb1136b0c5374c"; sha256 = "d747dd3d23d77ef44c6a3526e274af6efeb0a6f1afd5a69ba4d5be4098c8e141";
}; };
checkPhase = '' checkPhase = ''

View File

@ -2,11 +2,11 @@
buildPythonPackage rec { buildPythonPackage rec {
pname = "pytzdata"; pname = "pytzdata";
version = "2018.9"; version = "2019.1";
src = fetchPypi { src = fetchPypi {
inherit pname version; inherit pname version;
sha256 = "dddaaf4f1717820a6fdcac94057e03c1a15b3829a44d9eaf19988917977db408"; sha256 = "f0469062f799c66480fcc7eae69a8270dc83f0e6522c0e70db882d6bd708d378";
}; };
# No tests # No tests

View File

@ -24,10 +24,10 @@ let
}); });
jinja2 = super.jinja2.overridePythonAttrs (oldAttrs: rec { jinja2 = super.jinja2.overridePythonAttrs (oldAttrs: rec {
version = "2.10"; version = "2.10.1";
src = oldAttrs.src.override { src = oldAttrs.src.override {
inherit version; inherit version;
sha256 = "f84be1bb0040caca4cea721fcbbbbd61f9be9464ca236387158b0feea01914a4"; sha256 = "065c4f02ebe7f7cf559e49ee5a95fb800a9e4528727aec6f24402a5374c65013";
}; };
}); });
@ -52,11 +52,11 @@ let
in python.pkgs.buildPythonApplication rec { in python.pkgs.buildPythonApplication rec {
pname = "appdaemon"; pname = "appdaemon";
version = "3.0.4"; version = "3.0.5";
src = python.pkgs.fetchPypi { src = python.pkgs.fetchPypi {
inherit pname version; inherit pname version;
sha256 = "e2393b5e0bb34e94e61f5debc95ad74c1c6929635b74bf8ba15c22b40cbdec69"; sha256 = "623897ce08dc2efe24d04380df36e4b7fb35c0e4007e882857d4047f0b60349d";
}; };
propagatedBuildInputs = with python.pkgs; [ propagatedBuildInputs = with python.pkgs; [

File diff suppressed because it is too large Load Diff

View File

@ -28,28 +28,20 @@ let
"10cbf6e27dbce8c30807caf056c8eb50917e0eaafe86347671b57254006c3e69") "10cbf6e27dbce8c30807caf056c8eb50917e0eaafe86347671b57254006c3e69")
(mkOverride "bcrypt" "3.1.6" (mkOverride "bcrypt" "3.1.6"
"44636759d222baa62806bbceb20e96f75a015a6381690d1bc2eda91c01ec02ea") "44636759d222baa62806bbceb20e96f75a015a6381690d1bc2eda91c01ec02ea")
(self: super: { (mkOverride "pyjwt" "1.7.1"
pyjwt = super.pyjwt.overridePythonAttrs (oldAttrs: rec { "8d59a976fb773f3e6a39c85636357c4f0e242707394cadadd9814f5cbaa20e96")
version = "1.6.4"; (mkOverride "cryptography" "2.6.1"
src = oldAttrs.src.override { "26c821cbeb683facb966045e2064303029d572a87ee69ca5a1bf54bf55f93ca6")
inherit version; (mkOverride "cryptography_vectors" "2.6.1" # required by cryptography==2.6.1
sha256 = "4ee413b357d53fd3fb44704577afac88e72e878716116270d722723d65b42176"; "03f38115dccb266dd96538f94067442a877932c2322661bdc5bf2502c76658af")
}; (mkOverride "python-slugify" "3.0.2"
doCheck = false; # https://github.com/jpadilla/pyjwt/issues/382 "57163ffb345c7e26063435a27add1feae67fa821f1ef4b2f292c25847575d758")
});
})
(mkOverride "cryptography" "2.5"
"00c4d7gvsymlaw0r13zrm32dcnarmpayjyrh65yymlmr6mrbcij9")
(mkOverride "cryptography_vectors" "2.5" # required by cryptography==2.5
"15qfl3pnw2f11r0z0zhwl56f6pb60ysav8fxmpnz5p80cfwljdik")
(mkOverride "python-slugify" "1.2.6"
"7723daf30996db26573176bddcdf5fcb98f66dc70df05c9cb29f2c79b8193245")
(mkOverride "pyyaml" "3.13" (mkOverride "pyyaml" "3.13"
"3ef3092145e9b70e3ddd2c7ad59bdd0252a94dfe3949721633e41344de00a6bf") "3ef3092145e9b70e3ddd2c7ad59bdd0252a94dfe3949721633e41344de00a6bf")
(mkOverride "requests" "2.21.0" (mkOverride "requests" "2.21.0"
"502a824f31acdacb3a35b6690b5fbf0bc41d63a24a45c4004352b0242707598e") "502a824f31acdacb3a35b6690b5fbf0bc41d63a24a45c4004352b0242707598e")
(mkOverride "ruamel_yaml" "0.15.89" (mkOverride "ruamel_yaml" "0.15.91"
"86d034aa9e2ab3eacc5f75f5cd6a469a2af533b6d9e60ea92edbba540d21b9b7") "692f03ed24c8c1d9fa9fd4c045f7ba1c26f1e96edb8bfb4d54854ba26bc02319")
(mkOverride "voluptuous" "0.11.5" (mkOverride "voluptuous" "0.11.5"
"567a56286ef82a9d7ae0628c5842f65f516abcb496e74f3f59f1d7b28df314ef") "567a56286ef82a9d7ae0628c5842f65f516abcb496e74f3f59f1d7b28df314ef")
(mkOverride "voluptuous-serialize" "2.1.0" (mkOverride "voluptuous-serialize" "2.1.0"
@ -67,14 +59,13 @@ let
# required by home-assistant-frontend # required by home-assistant-frontend
(self: super: { (self: super: {
user-agents = super.user-agents.overridePythonAttrs (oldAttrs: rec { user-agents = super.user-agents.overridePythonAttrs (oldAttrs: rec {
version = "1.1.0"; version = "2.0.0";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "selwin"; owner = "selwin";
repo = "python-user-agents"; repo = "python-user-agents";
rev = "v${version}"; rev = "v${version}";
sha256 = "14kxd780zhp8718xr1z63xffaj3bvxgr4pldh9sv943m4hvi0gw5"; sha256 = "0ix2yajqdnfj433j50dls90mkmqz8m4fiywxg097zwkkc95wm8s4";
}; };
doCheck = false; # can be dropped for 2.0
}); });
}) })
@ -118,7 +109,7 @@ let
extraBuildInputs = extraPackages py.pkgs; extraBuildInputs = extraPackages py.pkgs;
# Don't forget to run parse-requirements.py after updating # Don't forget to run parse-requirements.py after updating
hassVersion = "0.91.4"; hassVersion = "0.92.2";
in with py.pkgs; buildPythonApplication rec { in with py.pkgs; buildPythonApplication rec {
pname = "homeassistant"; pname = "homeassistant";
@ -133,7 +124,7 @@ in with py.pkgs; buildPythonApplication rec {
owner = "home-assistant"; owner = "home-assistant";
repo = "home-assistant"; repo = "home-assistant";
rev = version; rev = version;
sha256 = "195pif8lz0qxjsannpi39gxphfb6dkj9lkpah0vjw0pgx753sflv"; sha256 = "10kqfj7gi8w0d9jalb4i2w4ifla8jkllymjav74abc4b30y08vmw";
}; };
propagatedBuildInputs = [ propagatedBuildInputs = [
@ -145,16 +136,17 @@ in with py.pkgs; buildPythonApplication rec {
] ++ componentBuildInputs ++ extraBuildInputs; ] ++ componentBuildInputs ++ extraBuildInputs;
checkInputs = [ checkInputs = [
asynctest pytest pytest-aiohttp requests-mock pydispatcher asynctest pytest pytest-aiohttp requests-mock pydispatcher aiohue
]; ];
checkPhase = '' checkPhase = ''
# The components' dependencies are not included, so they cannot be tested # The components' dependencies are not included, so they cannot be tested
py.test --ignore tests/components # test_webhook_create_cloudhook imports hass_nabucasa and is thus excluded
py.test --ignore tests/components -k "not test_webhook_create_cloudhook"
# Some basic components should be tested however # Some basic components should be tested however
py.test \ py.test \
tests/components/{api,config,configurator,demo,discovery,frontend,group,history,history_graph} \ tests/components/{api,config,configurator,demo,discovery,frontend,group,history,history_graph} \
tests/components/{homeassistant,http,introduction,logger,script,shell_command,system_log,websocket_api} tests/components/{homeassistant,http,logger,script,shell_command,system_log,websocket_api}
''; '';
makeWrapperArgs = lib.optional skipPip "--add-flags --skip-pip"; makeWrapperArgs = lib.optional skipPip "--add-flags --skip-pip";

View File

@ -2,11 +2,11 @@
buildPythonPackage rec { buildPythonPackage rec {
pname = "home-assistant-frontend"; pname = "home-assistant-frontend";
version = "20190331.0"; version = "20190427.0";
src = fetchPypi { src = fetchPypi {
inherit pname version; inherit pname version;
sha256 = "2d266a4d3d31af9a50debb99b0e9e9650044698f9157753bec785785057264cf"; sha256 = "eb14e7be0ad591ad4623c67db752bc4eb4f4e43ce60bb0f6d1909e9ad9399d91";
}; };
propagatedBuildInputs = [ user-agents ]; propagatedBuildInputs = [ user-agents ];

View File

@ -1,28 +1,30 @@
#! /usr/bin/env nix-shell #! /usr/bin/env nix-shell
#! nix-shell -i python3 -p "python3.withPackages (ps: with ps; [ aiohttp astral async-timeout attrs certifi jinja2 pyjwt cryptography pip pytz pyyaml requests ruamel_yaml voluptuous python-slugify ])" #! nix-shell -i python3 -p "python3.withPackages (ps: with ps; [ attrs ])
# #
# This script downloads Home Assistant's source tarball. # This script downloads Home Assistant's source tarball.
# Inside the homeassistant/components directory, each component has an associated .py file, # Inside the homeassistant/components directory, each integration has an associated manifest.json,
# specifying required packages and other components it depends on: # specifying required packages and other integrations it depends on:
# #
# REQUIREMENTS = [ 'package==1.2.3' ] # {
# DEPENDENCIES = [ 'component' ] # "requirements": [ "package==1.2.3" ],
# "dependencies": [ "component" ]
# }
# #
# By parsing the files, a dictionary mapping component to requirements and dependencies is created. # By parsing the files, a dictionary mapping integrations to requirements and dependencies is created.
# For all of these requirements and the dependencies' requirements, # For all of these requirements and the dependencies' requirements,
# Nixpkgs' python3Packages are searched for appropriate names. # nixpkgs' python3Packages are searched for appropriate names.
# Then, a Nix attribute set mapping component name to dependencies is created. # Then, a Nix attribute set mapping integration name to dependencies is created.
from urllib.request import urlopen
import tempfile
from io import BytesIO from io import BytesIO
import tarfile
import importlib
import subprocess
import os
import sys
import json import json
import pathlib
import os
import re import re
import subprocess
import sys
import tempfile
import tarfile
from urllib.request import urlopen
COMPONENT_PREFIX = 'homeassistant.components' COMPONENT_PREFIX = 'homeassistant.components'
PKG_SET = 'python3Packages' PKG_SET = 'python3Packages'
@ -43,22 +45,17 @@ def get_version():
def parse_components(version='master'): def parse_components(version='master'):
components = {} components = {}
with tempfile.TemporaryDirectory() as tmp: with tempfile.TemporaryDirectory() as tmp:
with urlopen('https://github.com/home-assistant/home-assistant/archive/{}.tar.gz'.format(version)) as response: with urlopen(f'https://github.com/home-assistant/home-assistant/archive/{version}.tar.gz') as response:
tarfile.open(fileobj=BytesIO(response.read())).extractall(tmp) tarfile.open(fileobj=BytesIO(response.read())).extractall(tmp)
# Use part of a script from the Home Assistant codebase # Use part of a script from the Home Assistant codebase
sys.path.append(tmp + '/home-assistant-{}'.format(version)) sys.path.append(os.path.join(tmp, f'home-assistant-{version}'))
from script.gen_requirements_all import explore_module from script.hassfest.model import Integration
for package in explore_module(COMPONENT_PREFIX, True): integrations = Integration.load_dir(pathlib.Path(
# Remove 'homeassistant.components.' prefix os.path.join(tmp, f'home-assistant-{version}', 'homeassistant/components')
component = package[len(COMPONENT_PREFIX + '.'):] ))
try: for domain in sorted(integrations):
module = importlib.import_module(package) integration = integrations[domain]
components[component] = {} components[domain] = integration.manifest
components[component]['requirements'] = getattr(module, 'REQUIREMENTS', [])
components[component]['dependencies'] = getattr(module, 'DEPENDENCIES', [])
# If there is an ImportError, the imported file is not the main file of the component
except ImportError:
continue
return components return components
# Recursively get the requirements of a component and its dependencies # Recursively get the requirements of a component and its dependencies

View File

@ -17,7 +17,7 @@ buildPythonApplication rec {
prePatch = '' prePatch = ''
substituteInPlace requirements.txt --replace "urllib3<1.24" "urllib3<2.0" \ substituteInPlace requirements.txt --replace "urllib3<1.24" "urllib3<2.0" \
--replace "six==1.11.0" "six<2.0.0" \ --replace "six==1.11.0" "six<2.0.0" \
--replace "python-slugify==1.2.6" "python-slugify<3.0.0" --replace "python-slugify==1.2.6" "python-slugify<4.0.0"
''; '';
# Requires external resources # Requires external resources