about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMartin Weinelt <mweinelt@users.noreply.github.com>2021-10-07 10:57:50 +0200
committerGitHub <noreply@github.com>2021-10-07 10:57:50 +0200
commit7d6ddf469c82e719b939dda0e6ad7f0f1e79492a (patch)
tree767764e1a7f7ab1ccce46a3f91ca414e63d5ccff
parenta0382501f8086bdd70ed1ef34570e114a5b0073c (diff)
parent589c45e30337d370057700e3e09829347b3b3ecf (diff)
Merge pull request #139736 from fabaff/transportnsw
-rw-r--r--pkgs/development/python-modules/gtfs-realtime-bindings/default.nix36
-rw-r--r--pkgs/development/python-modules/pytransportnsw/default.nix36
-rw-r--r--pkgs/development/python-modules/pytransportnswv2/default.nix38
-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.nix6
6 files changed, 118 insertions, 1 deletions
diff --git a/pkgs/development/python-modules/gtfs-realtime-bindings/default.nix b/pkgs/development/python-modules/gtfs-realtime-bindings/default.nix
new file mode 100644
index 0000000000000..3c76b987a12bb
--- /dev/null
+++ b/pkgs/development/python-modules/gtfs-realtime-bindings/default.nix
@@ -0,0 +1,36 @@
+{ lib
+, buildPythonPackage
+, fetchPypi
+, protobuf
+, pythonOlder
+}:
+
+buildPythonPackage rec {
+  pname = "gtfs-realtime-bindings";
+  version = "0.0.7";
+  format = "setuptools";
+
+  disabled = pythonOlder "3.6";
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "1vav7ah6gpkpi44rk202bwpl345rydg6n9zibzx5p7gcsblcwd45";
+    extension = "zip";
+  };
+
+  propagatedBuildInputs = [
+    protobuf
+  ];
+
+  # Tests are not shipped, only a tarball for Java is present
+  doCheck = false;
+
+  pythonImportsCheck = [ "google.transit" ];
+
+  meta = with lib; {
+    description = "Python bindings generated from the GTFS Realtime protocol buffer spec";
+    homepage = "https://github.com/andystewart999/TransportNSW";
+    license = with licenses; [ asl20 ];
+    maintainers = with maintainers; [ fab ];
+  };
+}
diff --git a/pkgs/development/python-modules/pytransportnsw/default.nix b/pkgs/development/python-modules/pytransportnsw/default.nix
new file mode 100644
index 0000000000000..67c0749df56bd
--- /dev/null
+++ b/pkgs/development/python-modules/pytransportnsw/default.nix
@@ -0,0 +1,36 @@
+{ lib
+, buildPythonPackage
+, fetchPypi
+, pythonOlder
+, requests
+}:
+
+buildPythonPackage rec {
+  pname = "pytransportnsw";
+  version = "0.1.1";
+  format = "setuptools";
+
+  disabled = pythonOlder "3.6";
+
+  src = fetchPypi {
+    pname = "PyTransportNSW";
+    inherit version;
+    sha256 = "00jklgjirmc58hiaqqc2n2rgixvx91bgrd6lv6hv28k51kid10f3";
+  };
+
+  propagatedBuildInputs = [
+    requests
+  ];
+
+  # Project has no tests
+  doCheck = false;
+
+  pythonImportsCheck = [ "TransportNSW" ];
+
+  meta = with lib; {
+    description = "Python module to access Transport NSW information";
+    homepage = "https://github.com/Dav0815/TransportNSW";
+    license = with licenses; [ gpl3Only ];
+    maintainers = with maintainers; [ fab ];
+  };
+}
diff --git a/pkgs/development/python-modules/pytransportnswv2/default.nix b/pkgs/development/python-modules/pytransportnswv2/default.nix
new file mode 100644
index 0000000000000..a2cf2afb7087f
--- /dev/null
+++ b/pkgs/development/python-modules/pytransportnswv2/default.nix
@@ -0,0 +1,38 @@
+{ lib
+, buildPythonPackage
+, fetchPypi
+, pythonOlder
+, gtfs-realtime-bindings
+, requests
+}:
+
+buildPythonPackage rec {
+  pname = "pytransportnswv2";
+  version = "0.2.4";
+  format = "setuptools";
+
+  disabled = pythonOlder "3.6";
+
+  src = fetchPypi {
+    pname = "PyTransportNSWv2";
+    inherit version;
+    sha256 = "129rrqckqgfrwdx0b83dqphcv55cxs5i8jl1ascia7rpzjn109ah";
+  };
+
+  propagatedBuildInputs = [
+    gtfs-realtime-bindings
+    requests
+  ];
+
+  # Project has no tests
+  doCheck = false;
+
+  pythonImportsCheck = [ "TransportNSW" ];
+
+  meta = with lib; {
+    description = "Python module to access Transport NSW information";
+    homepage = "https://github.com/andystewart999/TransportNSW";
+    license = with licenses; [ gpl3Only ];
+    maintainers = with maintainers; [ fab ];
+  };
+}
diff --git a/pkgs/servers/home-assistant/component-packages.nix b/pkgs/servers/home-assistant/component-packages.nix
index be8ad2373930e..e9b203554c64e 100644
--- a/pkgs/servers/home-assistant/component-packages.nix
+++ b/pkgs/servers/home-assistant/component-packages.nix
@@ -900,7 +900,7 @@
     "trafikverket_train" = ps: with ps; [ pytrafikverket ];
     "trafikverket_weatherstation" = ps: with ps; [ pytrafikverket ];
     "transmission" = ps: with ps; [ transmissionrpc ];
-    "transport_nsw" = ps: with ps; [ ]; # missing inputs: PyTransportNSW
+    "transport_nsw" = ps: with ps; [ pytransportnsw ];
     "travisci" = ps: with ps; [ ]; # missing inputs: TravisPy
     "trend" = ps: with ps; [ numpy ];
     "tts" = ps: with ps; [ aiohttp-cors mutagen ];
diff --git a/pkgs/servers/home-assistant/default.nix b/pkgs/servers/home-assistant/default.nix
index add1be9d0be32..970f14bbec22f 100644
--- a/pkgs/servers/home-assistant/default.nix
+++ b/pkgs/servers/home-assistant/default.nix
@@ -649,6 +649,7 @@ in with py.pkgs; buildPythonApplication rec {
     "trace"
     "tradfri"
     "transmission"
+    "transport_nsw"
     "trend"
     "tts"
     "tuya"
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index 83221fcf8a8ee..bb7891e249864 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -3285,6 +3285,8 @@ in {
     gst-plugins-base = pkgs.gst_all_1.gst-plugins-base;
   };
 
+  gtfs-realtime-bindings = callPackage ../development/python-modules/gtfs-realtime-bindings { };
+
   gtimelog = callPackage ../development/python-modules/gtimelog { };
 
   gtts = callPackage ../development/python-modules/gtts { };
@@ -7579,6 +7581,10 @@ in {
 
   pytrafikverket = callPackage ../development/python-modules/pytrafikverket { };
 
+  pytransportnsw = callPackage ../development/python-modules/pytransportnsw { };
+
+  pytransportnswv2 = callPackage ../development/python-modules/pytransportnswv2 { };
+
   pytrends = callPackage ../development/python-modules/pytrends { };
 
   pytricia = callPackage ../development/python-modules/pytricia { };