diff --git a/pkgs/development/python-modules/dotmap/default.nix b/pkgs/development/python-modules/dotmap/default.nix new file mode 100644 index 00000000000..cb5f032a6f2 --- /dev/null +++ b/pkgs/development/python-modules/dotmap/default.nix @@ -0,0 +1,30 @@ +{ lib +, buildPythonPackage +, fetchPypi +, pytestCheckHook +}: + +buildPythonPackage rec { + pname = "dotmap"; + version = "1.3.23"; + + src = fetchPypi { + inherit pname version; + sha256 = "0hy88kzzb7zhxfr7iyvl6rhmvz02538pbna7zypaard4a88bbbka"; + }; + + checkInputs = [ + pytestCheckHook + ]; + + pytestFlagsArray = [ "dotmap/test.py" ]; + + pythonImportsCheck = [ "dotmap" ]; + + meta = with lib; { + description = "Python for dot-access dictionaries"; + homepage = "https://github.com/drgrib/dotmap"; + license = with licenses; [ mit ]; + maintainers = with maintainers; [ fab ]; + }; +} diff --git a/pkgs/development/python-modules/meshtastic/default.nix b/pkgs/development/python-modules/meshtastic/default.nix new file mode 100644 index 00000000000..c8a9d78e7c1 --- /dev/null +++ b/pkgs/development/python-modules/meshtastic/default.nix @@ -0,0 +1,57 @@ +{ lib +, buildPythonPackage +, dotmap +, fetchPypi +, pexpect +, protobuf +, pygatt +, pypubsub +, pyqrcode +, pyserial +, pythonOlder +, tabulate +, timeago +}: + +buildPythonPackage rec { + pname = "meshtastic"; + version = "1.2.30"; + disabled = pythonOlder "3.6"; + + src = fetchPypi { + inherit pname version; + sha256 = "1kjflc2jwnsgxyr2zx1gyykhak9fsgy6hxaxlggsz5sw9b8rdrby"; + }; + + propagatedBuildInputs = [ + dotmap + pexpect + protobuf + pygatt + pypubsub + pyqrcode + pyserial + tabulate + timeago + ]; + + postPatch = '' + # https://github.com/meshtastic/Meshtastic-python/pull/87 + substituteInPlace setup.py \ + --replace 'with open("README.md", "r") as fh:' "" \ + --replace "long_description = fh.read()" "" \ + --replace "long_description=long_description," 'long_description="",' + ''; + + # Project only provides PyPI releases which don't contain the tests + # https://github.com/meshtastic/Meshtastic-python/issues/86 + doCheck = false; + pythonImportsCheck = [ "meshtastic" ]; + + meta = with lib; { + description = "Python API for talking to Meshtastic devices"; + homepage = "https://meshtastic.github.io/Meshtastic-python/"; + license = with licenses; [ asl20 ]; + maintainers = with maintainers; [ fab ]; + }; +} diff --git a/pkgs/development/python-modules/pygatt/default.nix b/pkgs/development/python-modules/pygatt/default.nix new file mode 100644 index 00000000000..9d596e17236 --- /dev/null +++ b/pkgs/development/python-modules/pygatt/default.nix @@ -0,0 +1,48 @@ +{ lib +, buildPythonPackage +, fetchFromGitHub +, mock +, nose +, pexpect +, pyserial +, pytestCheckHook +, pythonOlder +}: + +buildPythonPackage rec { + pname = "pygatt"; + version = "4.0.5"; + disabled = pythonOlder "3.5"; + + src = fetchFromGitHub { + owner = "peplin"; + repo = pname; + rev = "v${version}"; + sha256 = "1zdfxidiw0l8n498sy0l33n90lz49n25x889cx6jamjr7frlcihd"; + }; + + propagatedBuildInputs = [ + pexpect + pyserial + ]; + + checkInputs = [ + mock + nose + pytestCheckHook + ]; + + postPatch = '' + # Not support for Python < 3.4 + substituteInPlace setup.py --replace "'enum-compat'" "" + ''; + + pythonImportsCheck = [ "pygatt" ]; + + meta = with lib; { + description = "Python wrapper the BGAPI for accessing Bluetooth LE Devices"; + homepage = "https://github.com/peplin/pygatt"; + license = with licenses; [ asl20 mit ]; + maintainers = with maintainers; [ fab ]; + }; +} diff --git a/pkgs/development/python-modules/timeago/default.nix b/pkgs/development/python-modules/timeago/default.nix new file mode 100644 index 00000000000..0c2a688f674 --- /dev/null +++ b/pkgs/development/python-modules/timeago/default.nix @@ -0,0 +1,32 @@ +{ lib +, buildPythonPackage +, fetchFromGitHub +, pytestCheckHook +}: + +buildPythonPackage rec { + pname = "timeago"; + version = "1.0.15"; + + src = fetchFromGitHub { + owner = "hustcc"; + repo = pname; + rev = version; + sha256 = "03vm7c02l4g2d1x33w382i1psk8i3an7xchk69yinha33fjj1cag"; + }; + + checkInputs = [ + pytestCheckHook + ]; + + pytestFlagsArray = [ "test/testcase.py" ]; + + pythonImportsCheck = [ "timeago" ]; + + meta = with lib; { + description = "Python module to format past datetime output"; + homepage = "https://github.com/hustcc/timeago"; + license = with licenses; [ mit ]; + maintainers = with maintainers; [ fab ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index cc390b22213..f5ccde1bc9d 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -2034,6 +2034,8 @@ in { inherit (pkgs) graphviz; }; + dotmap = callPackage ../development/python-modules/dotmap { }; + dparse = callPackage ../development/python-modules/dparse { }; dpath = callPackage ../development/python-modules/dpath { }; @@ -4119,6 +4121,8 @@ in { meshlabxml = callPackage ../development/python-modules/meshlabxml { }; + meshtastic = callPackage ../development/python-modules/meshtastic { }; + meson = toPythonModule ((pkgs.meson.override { python3 = python; }).overrideAttrs (oldAttrs: { # We do not want the setup hook in Python packages because the build is performed differently. setupHook = null; @@ -5549,6 +5553,8 @@ in { pygame_sdl2 = callPackage ../development/python-modules/pygame_sdl2 { }; + pygatt = callPackage ../development/python-modules/pygatt { }; + pygbm = callPackage ../development/python-modules/pygbm { }; pygccxml = callPackage ../development/python-modules/pygccxml { }; @@ -8053,6 +8059,8 @@ in { tilestache = callPackage ../development/python-modules/tilestache { }; + timeago = callPackage ../development/python-modules/timeago { }; + timelib = callPackage ../development/python-modules/timelib { }; timeout-decorator = callPackage ../development/python-modules/timeout-decorator { };