Merge pull request #129899 from mweinelt/esphome

This commit is contained in:
Sandro 2021-07-12 03:26:41 +02:00 committed by GitHub
commit 22777612fe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 82 additions and 61 deletions

View file

@ -1,30 +1,74 @@
{ stdenv, lib, buildPythonApplication
, ajsonrpc
, bottle
, click
, click-completion
, colorama
{ stdenv, lib, python3
, fetchFromGitHub
, git
, jsondiff
, lockfile
, marshmallow
, pyelftools
, pyserial
, pytest
, requests
, semantic-version
, spdx-license-list-data
, starlette
, tabulate
, tox
, uvicorn
, wsproto
, zeroconf
, version, src
}:
let
args = lib.concatStringsSep " " ((map (e: "--deselect tests/${e}") [
python = python3.override {
packageOverrides = self: super: {
aiofiles = super.aiofiles.overridePythonAttrs (oldAttrs: rec {
version = "0.6.0";
src = oldAttrs.src.override {
inherit version;
sha256 = "e0281b157d3d5d59d803e3f4557dcc9a3dff28a4dd4829a9ff478adae50ca092";
};
});
click = super.click.overridePythonAttrs (oldAttrs: rec {
version = "7.1.2";
src = oldAttrs.src.override {
inherit version;
sha256 = "06kbzd6sjfkqan3miwj9wqyddfxc2b6hi7p5s4dvqjb3gif2bdfj";
};
});
uvicorn = super.uvicorn.overridePythonAttrs (oldAttrs: rec {
version = "0.13.2";
src = fetchFromGitHub {
owner = "encode";
repo = "uvicorn";
rev = version;
sha256 = "04zgmp9z46k72ay6cz7plga6d3w3a6x41anabm7ramp7jdqf6na9";
};
});
};
};
in
with python.pkgs; buildPythonApplication rec {
pname = "platformio";
inherit version src;
propagatedBuildInputs = [
ajsonrpc
bottle
click
click-completion
colorama
git
lockfile
marshmallow
pyelftools
pyserial
requests
semantic-version
starlette
tabulate
uvicorn
wsproto
zeroconf
];
HOME = "/tmp";
checkInputs = [
jsondiff
pytestCheckHook
tox
];
pytestFlagsArray = (map (e: "--deselect tests/${e}") [
"commands/test_ci.py::test_ci_boards"
"commands/test_ci.py::test_ci_build_dir"
"commands/test_ci.py::test_ci_keep_build_dir"
@ -88,44 +132,10 @@ let
"commands/test_update.py"
"test_maintenance.py"
"test_ino2cpp.py"
]));
in buildPythonApplication rec {
pname = "platformio";
inherit version src;
propagatedBuildInputs = [
ajsonrpc
bottle
click
click-completion
colorama
git
lockfile
marshmallow
pyelftools
pyserial
requests
semantic-version
starlette
tabulate
uvicorn
wsproto
zeroconf
]) ++ [
"tests"
];
HOME = "/tmp";
checkInputs = [ pytest tox jsondiff ];
checkPhase = ''
runHook preCheck
py.test -v tests ${args}
runHook postCheck
'';
patches = [
./fix-searchpath.patch
./use-local-spdx-license-list.patch

View file

@ -8,9 +8,13 @@
}:
let
esphome-dashboard = pkgs.callPackage ./dashboard.nix {};
python = python3.override {
packageOverrides = self: super: {
esphome-dashboard = pkgs.callPackage ./dashboard.nix {};
};
};
in
python3.pkgs.buildPythonApplication rec {
with python.pkgs; buildPythonApplication rec {
pname = "esphome";
version = "1.19.4";
@ -49,7 +53,7 @@ python3.pkgs.buildPythonApplication rec {
# They have validation functions like:
# - validate_cryptography_installed
# - validate_pillow_installed
propagatedBuildInputs = with python3.pkgs; [
propagatedBuildInputs = [
click
colorama
cryptography
@ -73,7 +77,7 @@ python3.pkgs.buildPythonApplication rec {
"--set ESPHOME_USE_SUBPROCESS ''"
];
checkInputs = with python3.pkgs; [
checkInputs = [
hypothesis
mock
pytest-asyncio
@ -82,6 +86,13 @@ python3.pkgs.buildPythonApplication rec {
pytestCheckHook
];
disabledTestPaths = [
# requires hypothesis 5.49, we have 6.x
# ImportError: cannot import name 'ip_addresses' from 'hypothesis.provisional'
"tests/unit_tests/test_core.py"
"tests/unit_tests/test_helpers.py"
];
postCheck = ''
$out/bin/esphome --help > /dev/null
'';