diff --git a/pkgs/applications/misc/octoprint/default.nix b/pkgs/applications/misc/octoprint/default.nix index d7393313c151..bc994bf68233 100644 --- a/pkgs/applications/misc/octoprint/default.nix +++ b/pkgs/applications/misc/octoprint/default.nix @@ -2,7 +2,8 @@ , stdenv , lib , fetchFromGitHub -, python3 +, python38 +, substituteAll , nix-update-script # To include additional plugins, pass them here as an overlay. , packageOverrides ? self: super: {} @@ -20,18 +21,51 @@ let ); }; - py = python3.override { + py = python38.override { self = py; packageOverrides = lib.foldr lib.composeExtensions (self: super: {}) ( [ # the following dependencies are non trivial to update since later versions introduce backwards incompatible # changes that might affect plugins, or due to other observed problems + (mkOverride "click" "7.1.2" "d2b5255c7c6349bc1bd1e59e08cd12acbbd63ce649f2588755783aa94dfb6b1a") (mkOverride "flask-babel" "1.0.0" "0gmb165vkwv5v7dxsxa2i3zhafns0fh938m2zdcrv4d8z5l099yn") - (mkOverride "rsa" "4.0" "1a836406405730121ae9823e19c6e806c62bbad73f890574fff50efa4122c487") + (mkOverride "itsdangerous" "1.1.0" "321b033d07f2a4136d3ec762eac9f16a10ccd60f53c0c91af90217ace7ba1f19") + (mkOverride "jinja2" "2.11.3" "a6d58433de0ae800347cab1fa3043cebbabe8baa9d29e668f1c768cb87a333c6") (mkOverride "markdown" "3.1.1" "2e50876bcdd74517e7b71f3e7a76102050edec255b3983403f1a63e7c8a41e7a") + (mkOverride "markupsafe" "1.1.1" "29872e92839765e546828bb7754a68c418d927cd064fd4708fab9fe9c8bb116b") + (mkOverride "sarge" "0.1.5.post0" "1c1ll7pys9vra5cfi8jxlgrgaql6c27l6inpy15aprgqhc4ck36s") (mkOverride "tornado" "5.1.1" "4e5158d97583502a7e2739951553cbd88a72076f152b4b11b64b9a10c4c49409") (mkOverride "unidecode" "0.04.21" "280a6ab88e1f2eb5af79edff450021a0d3f0448952847cd79677e55e58bad051") - (mkOverride "sarge" "0.1.5.post0" "1c1ll7pys9vra5cfi8jxlgrgaql6c27l6inpy15aprgqhc4ck36s") + + # Requires flask<2, cannot mkOverride because tests need to be disabled + ( + self: super: { + flask = super.flask.overridePythonAttrs (oldAttrs: rec { + version = "1.1.2"; + src = oldAttrs.src.override { + inherit version; + sha256 = "4efa1ae2d7c9865af48986de8aeb8504bf32c7f3d6fdc9353d34b21f4b127060"; + }; + doCheck = false; + }); + } + ) + + # Requires werkezug<2, cannot mkOverride because tests need to be disabled + ( + self: super: { + werkzeug = super.werkzeug.overridePythonAttrs (oldAttrs: rec { + version = "1.0.1"; + src = oldAttrs.src.override { + inherit version; + sha256 = "6c80b1e5ad3665290ea39320b91e1be1e0d5f60652b964a3070216de83d2e47c"; + }; + doCheck= false; + }); + } + ) + + # Requires websocket-client <1.0, >=0.57. Cannot do mkOverride b/c differing underscore/hyphen in pypi source name ( @@ -78,13 +112,13 @@ let self: super: { octoprint-filecheck = self.buildPythonPackage rec { pname = "OctoPrint-FileCheck"; - version = "2020.08.07"; + version = "2021.2.23"; src = fetchFromGitHub { owner = "OctoPrint"; repo = "OctoPrint-FileCheck"; rev = version; - sha256 = "05ys05l5x7d2bkg3yqrga6m65v3g5fcnnzbfab7j9w2pzjdapx5b"; + sha256 = "sha256-e/QGEBa9+pjOdrZq3Zc6ifbSMClIyeTOi0Tji0YdVmI="; }; doCheck = false; }; @@ -96,30 +130,50 @@ let self: super: { octoprint-firmwarecheck = self.buildPythonPackage rec { pname = "OctoPrint-FirmwareCheck"; - version = "2020.09.23"; + version = "2021.8.11"; src = fetchFromGitHub { owner = "OctoPrint"; repo = "OctoPrint-FirmwareCheck"; rev = version; - sha256 = "1l1ajhnsc39prgk59mp93h90dgl9gh660cci00z5b5gj2h6dv1d1"; + sha256 = "sha256-WzVjHgjF12iJ642AFaFd86GSU90XyPzKhi1CSreynW4="; }; doCheck = false; }; } ) + ( + self: super: { + octoprint-pisupport = self.buildPythonPackage rec { + pname = "OctoPrint-PiSupport"; + version = "2021.8.2"; + format = "setuptools"; + + src = fetchFromGitHub { + owner = "OctoPrint"; + repo = "OctoPrint-PiSupport"; + rev = version; + sha256 = "07akx61wadxhs0545pqa9gzjnaz9742bq710f8f4zs5x6sacjzbc"; + }; + + # requires octoprint itself during tests + doCheck = false; + }; + } + ) + ( self: super: { octoprint = self.buildPythonPackage rec { pname = "OctoPrint"; - version = "1.5.3"; + version = "1.6.1"; src = fetchFromGitHub { owner = "OctoPrint"; repo = "OctoPrint"; rev = version; - sha256 = "sha256-ZL/P/YIHynPmP8ssZZUKZDJscBsSsCq3UtOHrTVLpec="; + sha256 = "sha256-3b3k9h8H9Spf/P3/pXpCANnSGOgbUw/EWISJbrSoPBM="; }; propagatedBuildInputs = with super; [ @@ -136,6 +190,7 @@ let frozendict future itsdangerous + immutabledict jinja2 markdown markupsafe @@ -143,7 +198,9 @@ let netifaces octoprint-filecheck octoprint-firmwarecheck + octoprint-pisupport pkginfo + pip psutil pylru pyserial @@ -154,6 +211,7 @@ let sarge semantic-version sentry-sdk + setuptools tornado unidecode watchdog @@ -161,13 +219,29 @@ let werkzeug wrapt zeroconf + zipstream-new ] ++ lib.optionals stdenv.isDarwin [ py.pkgs.appdirs ]; checkInputs = with super; [ pytestCheckHook mock ddt ]; + patches = [ + # substitute pip and let it find out, that it can't write anywhere + (substituteAll { + src = ./pip-path.patch; + pip = "${super.pip}/bin/pip"; + }) + + # hardcore path to ffmpeg and hide related settings + (substituteAll { + src = ./ffmpeg-path.patch; + ffmpeg = "${pkgs.ffmpeg}/bin/ffmpeg"; + }) + ]; + postPatch = let ignoreVersionConstraints = [ "emoji" + "immutabledict" "sentry-sdk" "watchdog" ]; diff --git a/pkgs/applications/misc/octoprint/ffmpeg-path.patch b/pkgs/applications/misc/octoprint/ffmpeg-path.patch new file mode 100644 index 000000000000..7ba468ae1a3f --- /dev/null +++ b/pkgs/applications/misc/octoprint/ffmpeg-path.patch @@ -0,0 +1,41 @@ +diff --git a/src/octoprint/plugins/corewizard/templates/corewizard_webcam_wizard.jinja2 b/src/octoprint/plugins/corewizard/templates/corewizard_webcam_wizard.jinja2 +index 79342dcd7..6165a4119 100644 +--- a/src/octoprint/plugins/corewizard/templates/corewizard_webcam_wizard.jinja2 ++++ b/src/octoprint/plugins/corewizard/templates/corewizard_webcam_wizard.jinja2 +@@ -29,14 +29,3 @@ + {% include "snippets/settings/webcam/webcamStreamUrl.jinja2" %} + {% include "snippets/settings/webcam/webcamSnapshotUrl.jinja2" %} + +- +-

{{ _('Timelapse Recordings') }}

+- +-{% trans %}

+- To render the snapshots into timelapse recordings, OctoPrint also needs to +- know the correct path to FFMPEG. +-

{% endtrans %} +- +-
+- {% include "snippets/settings/webcam/ffmpegPath.jinja2" %} +-
+diff --git a/src/octoprint/server/api/settings.py b/src/octoprint/server/api/settings.py +index c3e6cea10..ced2f8fa0 100644 +--- a/src/octoprint/server/api/settings.py ++++ b/src/octoprint/server/api/settings.py +@@ -130,7 +130,7 @@ def getSettings(): + "snapshotUrl": s.get(["webcam", "snapshot"]), + "snapshotTimeout": s.getInt(["webcam", "snapshotTimeout"]), + "snapshotSslValidation": s.getBoolean(["webcam", "snapshotSslValidation"]), +- "ffmpegPath": s.get(["webcam", "ffmpeg"]), ++ "ffmpegPath": "@ffmpeg@", + "ffmpegCommandline": s.get(["webcam", "ffmpegCommandline"]), + "bitrate": s.get(["webcam", "bitrate"]), + "ffmpegThreads": s.get(["webcam", "ffmpegThreads"]), +@@ -548,8 +548,6 @@ def _saveSettings(data): + ["webcam", "snapshotSslValidation"], + data["webcam"]["snapshotSslValidation"], + ) +- if "ffmpegPath" in data["webcam"]: +- s.set(["webcam", "ffmpeg"], data["webcam"]["ffmpegPath"]) + if "ffmpegCommandline" in data["webcam"]: + commandline = data["webcam"]["ffmpegCommandline"] + if not all( diff --git a/pkgs/applications/misc/octoprint/pip-path.patch b/pkgs/applications/misc/octoprint/pip-path.patch new file mode 100644 index 000000000000..9c6b1c74751d --- /dev/null +++ b/pkgs/applications/misc/octoprint/pip-path.patch @@ -0,0 +1,12 @@ +diff --git a/src/octoprint/util/pip.py b/src/octoprint/util/pip.py +index 53500e5d5..39f76c1e5 100644 +--- a/src/octoprint/util/pip.py ++++ b/src/octoprint/util/pip.py +@@ -284,6 +284,7 @@ class PipCaller(CommandlineCaller): + @classmethod + def autodetect_pip(cls): + commands = [ ++ ["@pip@"], + [sys.executable, "-m", "pip"], + [ + os.path.join( diff --git a/pkgs/applications/misc/octoprint/plugins.nix b/pkgs/applications/misc/octoprint/plugins.nix index ae2151383bcf..616596ed9b18 100644 --- a/pkgs/applications/misc/octoprint/plugins.nix +++ b/pkgs/applications/misc/octoprint/plugins.nix @@ -52,13 +52,13 @@ in { bedlevelvisualizer = buildPlugin rec { pname = "BedLevelVisualizer"; - version = "0.1.15"; + version = "1.1.0"; src = fetchFromGitHub { owner = "jneilliii"; repo = "OctoPrint-${pname}"; rev = version; - sha256 = "1bq39fnarnpk8phxfbpx6l4n9anf358z1cgid5r89nadmn2a0cny"; + sha256 = "sha256-SKrhtTGyDuvbDmUCXSx83Y+C83ZzVHA78TwMYwE6tcc="; }; propagatedBuildInputs = with super; [ numpy ]; @@ -73,13 +73,13 @@ in { costestimation = buildPlugin rec { pname = "CostEstimation"; - version = "3.2.0"; + version = "3.3.0"; src = fetchFromGitHub { owner = "OllisGit"; repo = "OctoPrint-${pname}"; rev = version; - sha256 = "1j476jcw7gh8zqqdc5vddwv5wpjns7cd1hhpn7m9fxq3d5bi077w"; + sha256 = "sha256-d7miGMCNJD0siaZb6EnoMZCkKot7vnZjxNZX2TunJcs="; }; meta = with lib; { @@ -92,13 +92,13 @@ in { curaenginelegacy = buildPlugin rec { pname = "CuraEngineLegacy"; - version = "1.1.1"; + version = "1.1.2"; src = fetchFromGitHub { owner = "OctoPrint"; repo = "OctoPrint-${pname}"; rev = version; - sha256 = "1a7pxlmj1a7blkv97sn1k390pbjcxx2860011pbjcdnli74zpvv5"; + sha256 = "sha256-54siSmzgPlnCRpkpZhXU9theNQ3hqL3j+Ip4Ie2w2vA="; }; meta = with lib; { @@ -130,13 +130,13 @@ in { displaylayerprogress = buildPlugin rec { pname = "OctoPrint-DisplayLayerProgress"; - version = "1.24.0"; + version = "1.26.0"; src = fetchFromGitHub { owner = "OllisGit"; repo = pname; rev = version; - sha256 = "1lbivg3rcjzv8zqvp8n8gcaczxdm7gvd5ihjb6jq0fgf958lv59n"; + sha256 = "sha256-hhHc2SPixZCPJzCP8enMMWNYaYbNZAU0lNSx1B0d++4="; }; meta = with lib; { @@ -149,13 +149,13 @@ in { gcodeeditor = buildPlugin rec { pname = "GcodeEditor"; - version = "0.2.9"; + version = "0.2.12"; src = fetchFromGitHub { owner = "ieatacid"; repo = "OctoPrint-${pname}"; rev = version; - sha256 = "1yjj9lmxbzmzrn7gahw9lj7554fphalbjjp8ns0rr9py3rshwxkm"; + sha256 = "sha256-1Sk2ri3DKW8q8VJ/scFjpRsz65Pwt8OEURP1k70aydE="; }; meta = with lib; { @@ -168,13 +168,13 @@ in { marlingcodedocumentation = buildPlugin rec { pname = "MarlinGcodeDocumentation"; - version = "0.11.0"; + version = "0.13.0"; src = fetchFromGitHub { owner = "costas-basdekis"; repo = pname; rev = "v${version}"; - sha256 = "0vx06w9hqwy0k4r8g67y8gdckfdx7wl8ghfx6hmxc1s8fgkghfkc"; + sha256 = "sha256-3ay6iCxZk8QkFM/2Y14VTpPoxr6NXq14BFSHofn3q7I="; }; meta = with lib; { @@ -187,13 +187,13 @@ in { mqtt = buildPlugin rec { pname = "MQTT"; - version = "0.8.7"; + version = "0.8.10"; src = fetchFromGitHub { owner = "OctoPrint"; repo = "OctoPrint-MQTT"; rev = version; - sha256 = "0k82h7wafbcqdvk5wjw4dp9lydwszfj1lf8vvymwbqdn7pf5h0dy"; + sha256 = "sha256-nvEUvN/SdUE1tQkLbxMkZ8xxeUIZiNNirIfWLeH1Kfg="; }; propagatedBuildInputs = with super; [ paho-mqtt ]; @@ -208,25 +208,26 @@ in { printtimegenius = buildPlugin rec { pname = "PrintTimeGenius"; - version = "2.2.6"; + version = "2.2.8"; src = fetchFromGitHub { owner = "eyal0"; repo = "OctoPrint-${pname}"; rev = version; - sha256 = "04zfgd3x3lbriyzwhpqnwdcfdm19fsqgsb7l2ix5d0ssmqxwg2r6"; + sha256 = "sha256-Bbpm7y4flzEbUb6Sgkp6hIIHs455A0IsbmzvZwlkbh0="; }; + propagatedBuildInputs = with super; [ + psutil + sarge + ]; + preConfigure = '' # PrintTimeGenius ships with marlin-calc binaries for multiple architectures rm */analyzers/marlin-calc* sed 's@"{}.{}".format(binary_base_name, machine)@"${pkgs.marlin-calc}/bin/marlin-calc"@' -i */analyzers/analyze_progress.py ''; - patches = [ - ./printtimegenius-logging.patch - ]; - meta = with lib; { description = "Better print time estimation for OctoPrint"; homepage = "https://github.com/eyal0/OctoPrint-PrintTimeGenius"; @@ -237,15 +238,19 @@ in { psucontrol = buildPlugin rec { pname = "PSUControl"; - version = "0.1.9"; + version = "1.0.6"; src = fetchFromGitHub { owner = "kantlivelong"; repo = "OctoPrint-${pname}"; rev = version; - sha256 = "1cn009bdgn6c9ba9an5wfj8z02wi0xcsmbhkqggiqlnqy1fq45ca"; + sha256 = "sha256-S+lPm85+ZEO/3BXYsrxE4FU29EGWzWrSw3y1DLdByrM="; }; + propagatedBuildInputs = with super; [ + python-periphery + ]; + preConfigure = '' # optional; RPi.GPIO is broken on vanilla kernels sed /RPi.GPIO/d -i requirements.txt @@ -261,13 +266,13 @@ in { simpleemergencystop = buildPlugin rec { pname = "SimpleEmergencyStop"; - version = "1.0.3"; + version = "1.0.5"; src = fetchFromGitHub { owner = "Sebclem"; repo = "OctoPrint-${pname}"; rev = version; - sha256 = "0hhh5grmn32abkix1b9fr1d0pcpdi2r066iypcxdxcza9qzwjiyi"; + sha256 = "sha256-MbP3cKa9FPElQ/M8ykYh9kVXl8hNvmGiCHDvjgWvm9k="; }; meta = with lib; { @@ -299,13 +304,13 @@ in { telegram = buildPlugin rec { pname = "Telegram"; - version = "1.6.4"; + version = "1.6.5"; src = fetchFromGitHub { owner = "fabianonline"; repo = "OctoPrint-${pname}"; rev = version; - sha256 = "14d9f9a5m1prcikd7y26qks6c2ls6qq4b97amn24q5a8k5hbgl94"; + sha256 = "sha256-SckJCbPNCflgGYLHFiXy0juCtpvo8YS1BQsFpc1f5rg="; }; propagatedBuildInputs = with super; [ pillow ]; @@ -358,13 +363,13 @@ in { touchui = buildPlugin rec { pname = "TouchUI"; - version = "0.3.16"; + version = "0.3.18"; src = fetchFromGitHub { owner = "BillyBlaze"; repo = "OctoPrint-${pname}"; rev = version; - sha256 = "1jlqjirc4ygl4k7jp93l2h6b18jap3mzz8sf2g61j9w0kgv9l365"; + sha256 = "sha256-PNDCjY7FhfnwK7Nd86el9ZQ00G4uMANH2Sk080iMYXw="; }; meta = with lib; { @@ -377,13 +382,13 @@ in { octoklipper = buildPlugin rec { pname = "OctoKlipper"; - version = "0.3.2"; + version = "0.3.8.3"; src = fetchFromGitHub { owner = "AliceGrey"; repo = "OctoprintKlipperPlugin"; rev = version; - sha256 = "15yg2blbgqp2gdpsqqm8qiiznq5qaq8wss07jimkl0865vrvlz7l"; + sha256 = "sha256-6r5jJDSR0DxlDQ/XWmQgYUgeL1otNNBnwurX7bbcThg="; }; meta = with lib; { @@ -396,13 +401,13 @@ in { octoprint-dashboard = buildPlugin rec { pname = "OctoPrint-Dashboard"; - version = "1.15.2"; + version = "1.18.3"; src = fetchFromGitHub { owner = "StefanCohen"; repo = pname; rev = version; - sha256 = "0p94jwd7kagh3sixhcrqmsgbay4aaf9l1pgyi2b45jym8pvld5n4"; + sha256 = "sha256-hLHT3Uze/6PlOCEICVZ2ieFTyXgcqCvgHOlIIEquujg="; }; meta = with lib; { diff --git a/pkgs/applications/misc/octoprint/printtimegenius-logging.patch b/pkgs/applications/misc/octoprint/printtimegenius-logging.patch deleted file mode 100644 index 66c2e83d62ca..000000000000 --- a/pkgs/applications/misc/octoprint/printtimegenius-logging.patch +++ /dev/null @@ -1,17 +0,0 @@ -diff --git a/setup.py b/setup.py -index 6a6610e..cc45902 100644 ---- a/setup.py -+++ b/setup.py -@@ -35,9 +35,9 @@ plugin_license = "AGPLv3" - # Any additional requirements besides OctoPrint should be listed here - # For now, require the working release, which is only 1.3.9rc1. - plugin_requires = ["OctoPrint>=1.3.9rc1", "psutil", "sarge"] --from sys import version_info --if version_info[0] < 3: -- plugin_requires.append("logging") -+#from sys import version_info -+#if version_info[0] < 3: -+# plugin_requires.append("logging") - - ### -------------------------------------------------------------------------------------------------------------------- - ### More advanced options that you usually shouldn't have to touch follow after this point diff --git a/pkgs/development/python-modules/immutabledict/default.nix b/pkgs/development/python-modules/immutabledict/default.nix new file mode 100644 index 000000000000..54fef8720ca5 --- /dev/null +++ b/pkgs/development/python-modules/immutabledict/default.nix @@ -0,0 +1,45 @@ +{ lib +, buildPythonPackage +, fetchFromGitHub +, poetry-core +, pytestCheckHook +}: + +buildPythonPackage rec { + pname = "immutabledict"; + version = "2.1.0"; + format = "pyproject"; + + src = fetchFromGitHub { + owner = "corenting"; + repo = "immutabledict"; + rev = "v${version}"; + sha256 = "1n71154nfb6vr41iv00xcwkxmwnn1vwzbr3s23bjvlhvmnjb48a8"; + }; + + # https://github.com/corenting/immutabledict/issues/56 + postPatch = '' + substituteInPlace pyproject.toml \ + --replace "poetry.masonry.api" "poetry.core.masonry.api" + ''; + + nativeBuildInputs = [ + poetry-core + ]; + + pythonImportsCheck = [ + "immutabledict" + ]; + + checkInputs = [ + pytestCheckHook + ]; + + meta = with lib; { + description = "A fork of frozendict, an immutable wrapper around dictionaries"; + homepage = "https://github.com/corenting/immutabledict"; + license = licenses.mit; + maintainers = with maintainers; [ hexa ]; + }; +} + diff --git a/pkgs/development/python-modules/zipstream-new/default.nix b/pkgs/development/python-modules/zipstream-new/default.nix new file mode 100644 index 000000000000..3f95fd5d4c61 --- /dev/null +++ b/pkgs/development/python-modules/zipstream-new/default.nix @@ -0,0 +1,39 @@ +{ lib +, buildPythonPackage +, fetchFromGitHub +, nose +}: + +buildPythonPackage rec { + pname = "zipstream-new"; + version = "1.1.8"; + format = "setuptools"; + + src = fetchFromGitHub { + owner = "arjan-s"; + repo = "python-zipstream"; + rev = "v${version}"; + sha256 = "14vhgg8mcjqi8cpzrw8qzbij2fr2a63l2a8fhil21k2r8vzv92cv"; + }; + + pythonImportsCheck = [ + "zipstream" + ]; + + checkInputs = [ + nose + ]; + + checkPhase = '' + runHook preCheck + nosetests + runHook postCheck + ''; + + meta = with lib; { + description = "Like Python's ZipFile module, except it works as a generator that provides the file in many small chunks"; + homepage = "https://github.com/arjan-s/python-zipstream"; + license = licenses.gpl3; + maintainers = with maintainers; [ hexa ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 6c828ee3d430..a8736b7182a5 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -3551,6 +3551,8 @@ in { iminuit = callPackage ../development/python-modules/iminuit { }; + immutabledict = callPackage ../development/python-modules/immutabledict { }; + immutables = callPackage ../development/python-modules/immutables { }; impacket = callPackage ../development/python-modules/impacket { }; @@ -9668,6 +9670,8 @@ in { zipstream = callPackage ../development/python-modules/zipstream { }; + zipstream-new = callPackage ../development/python-modules/zipstream-new { }; + zm-py = callPackage ../development/python-modules/zm-py { }; zodb = callPackage ../development/python-modules/zodb { };