octoprint: 1.5.3 -> 1.6.1

Hardcode path to pip so octoprint will find it and recognize it cannot
write to its install dir with the /nix/store. This causes less, at least
when looking at the log output, compared to not having pip accessible at
all.

Hardcore path to ffmpeg, because it is not reasonable on a NixOS setup
to not treat this as a dependency. At the same time we hide the related
settings form, so the user cannot overwrite it.
Having the user input a sensible path would require installing ffmpeg
into the environment, not a great solution, so patching it is.
This commit is contained in:
Martin Weinelt 2021-08-09 17:13:12 +02:00
parent 9f99f6f7bf
commit fe6d9366c9
No known key found for this signature in database
GPG key ID: 87C1E9888F856759
3 changed files with 137 additions and 10 deletions

View file

@ -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"
];

View file

@ -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" %}
</form>
-
-<h4>{{ _('Timelapse Recordings') }}</h4>
-
-{% trans %}<p>
- To render the snapshots into timelapse recordings, OctoPrint also needs to
- know the correct <strong>path to FFMPEG</strong>.
-</p>{% endtrans %}
-
-<form class="form-horizontal" data-bind="with: settingsViewModel" onsubmit="return false;">
- {% include "snippets/settings/webcam/ffmpegPath.jinja2" %}
-</form>
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(

View file

@ -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(