about summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorMartin Weinelt <mweinelt@users.noreply.github.com>2021-04-24 20:22:21 +0200
committerGitHub <noreply@github.com>2021-04-24 20:22:21 +0200
commit0ca4f6b7395ffcfd0153791f9623a4844650b023 (patch)
treed1f08172fa15bab920a104a420ac5dac7233e784 /pkgs
parent1c62c0f37092c101f6289d8975e694398bebfead (diff)
parente1054f07f1c3fae9f8b96cb9d46cf75ddc27216f (diff)
Merge pull request #120550 from fabaff/smhi
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/development/python-modules/smhi-pkg/default.nix47
-rw-r--r--pkgs/servers/home-assistant/component-packages.nix2
-rw-r--r--pkgs/servers/home-assistant/default.nix1
-rw-r--r--pkgs/top-level/python-packages.nix2
4 files changed, 51 insertions, 1 deletions
diff --git a/pkgs/development/python-modules/smhi-pkg/default.nix b/pkgs/development/python-modules/smhi-pkg/default.nix
new file mode 100644
index 0000000000000..3308697cf5498
--- /dev/null
+++ b/pkgs/development/python-modules/smhi-pkg/default.nix
@@ -0,0 +1,47 @@
+{ lib
+, aiohttp
+, buildPythonPackage
+, fetchFromGitHub
+, pytest-asyncio
+, pytestCheckHook
+}:
+
+buildPythonPackage rec {
+  pname = "smhi-pkg";
+  version = "1.0.14";
+
+  src = fetchFromGitHub {
+    owner = "joysoftware";
+    repo = "pypi_smhi";
+    rev = version;
+    sha256 = "186xwrg3hvr0hszq2kxvygd241q2sp11gfk6mwj9z4zqywwfcbn3";
+  };
+
+  propagatedBuildInputs = [
+    aiohttp
+  ];
+
+  checkInputs = [
+    pytest-asyncio
+    pytestCheckHook
+  ];
+
+  disabledTests = [
+    # Disable tests that needs network access
+    "test_smhi_integration_test"
+    "test_smhi_async_integration_test"
+    "test_smhi_async_integration_test_use_session"
+    "test_smhi_async_get_forecast_integration2"
+    "test_async_error_from_api"
+  ];
+
+  pythonImportsCheck = [ "smhi" ];
+
+  meta = with lib; {
+    description = "Python library for accessing SMHI open forecast data";
+    homepage = "https://github.com/joysoftware/pypi_smhi";
+    changelog = "https://github.com/joysoftware/pypi_smhi/releases/tag/${version}";
+    license = with licenses; [ mit ];
+    maintainers = with maintainers; [ fab ];
+  };
+}
diff --git a/pkgs/servers/home-assistant/component-packages.nix b/pkgs/servers/home-assistant/component-packages.nix
index 4f906e4bd5e95..b586eaaf69b6f 100644
--- a/pkgs/servers/home-assistant/component-packages.nix
+++ b/pkgs/servers/home-assistant/component-packages.nix
@@ -760,7 +760,7 @@
     "smartthings" = ps: with ps; [ aiohttp-cors hass-nabucasa ]; # missing inputs: pysmartapp pysmartthings
     "smarttub" = ps: with ps; [ python-smarttub ];
     "smarty" = ps: with ps; [ ]; # missing inputs: pysmarty
-    "smhi" = ps: with ps; [ ]; # missing inputs: smhi-pkg
+    "smhi" = ps: with ps; [ smhi-pkg ];
     "sms" = ps: with ps; [ python-gammu ];
     "smtp" = ps: with ps; [ ];
     "snapcast" = ps: with ps; [ snapcast ];
diff --git a/pkgs/servers/home-assistant/default.nix b/pkgs/servers/home-assistant/default.nix
index 92391cd185e8f..ca447584b5d5e 100644
--- a/pkgs/servers/home-assistant/default.nix
+++ b/pkgs/servers/home-assistant/default.nix
@@ -357,6 +357,7 @@ in with py.pkgs; buildPythonApplication rec {
     "simulated"
     "sleepiq"
     "sma"
+    "smhi"
     "sensor"
     "slack"
     "smarttub"
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index 2943a23be6f9b..4616e1e898b23 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -8003,6 +8003,8 @@ in {
 
   smdebug-rulesconfig = callPackage ../development/python-modules/smdebug-rulesconfig { };
 
+  smhi-pkg = callPackage ../development/python-modules/smhi-pkg { };
+
   smmap2 = throw "smmap2 has been deprecated, use smmap instead."; # added 2020-03-14
 
   smmap = callPackage ../development/python-modules/smmap { };