Merge pull request #82392 from FRidh/octoprint

This commit is contained in:
Gabriel Ebner 2020-05-03 12:11:26 +02:00 committed by GitHub
commit e5c8002bd1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 331 additions and 321 deletions

View File

@ -17,9 +17,9 @@ let
cfgUpdate = pkgs.writeText "octoprint-config.yaml" (builtins.toJSON fullConfig); cfgUpdate = pkgs.writeText "octoprint-config.yaml" (builtins.toJSON fullConfig);
pluginsEnv = pkgs.python.buildEnv.override { pluginsEnv = package.python.withPackages (ps: [ps.octoprint] ++ (cfg.plugins ps));
extraLibs = cfg.plugins pkgs.octoprint-plugins;
}; package = pkgs.octoprint;
in in
{ {
@ -106,7 +106,6 @@ in
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
after = [ "network.target" ]; after = [ "network.target" ];
path = [ pluginsEnv ]; path = [ pluginsEnv ];
environment.PYTHONPATH = makeSearchPathOutput "lib" pkgs.python.sitePackages [ pluginsEnv ];
preStart = '' preStart = ''
if [ -e "${cfg.stateDir}/config.yaml" ]; then if [ -e "${cfg.stateDir}/config.yaml" ]; then
@ -119,7 +118,7 @@ in
''; '';
serviceConfig = { serviceConfig = {
ExecStart = "${pkgs.octoprint}/bin/octoprint serve -b ${cfg.stateDir}"; ExecStart = "${pluginsEnv}/bin/octoprint serve -b ${cfg.stateDir}";
User = cfg.user; User = cfg.user;
Group = cfg.group; Group = cfg.group;
}; };

View File

@ -1,5 +1,7 @@
{ stdenv, lib, fetchFromGitHub, python2 }: { pkgs, stdenv, lib, fetchFromGitHub, python3
# To include additional plugins, pass them here as an overlay.
, packageOverrides ? self: super: {}
}:
let let
mkOverride = attrname: version: sha256: mkOverride = attrname: version: sha256:
self: super: { self: super: {
@ -11,17 +13,19 @@ let
}); });
}; };
py = python2.override { py = python3.override {
self = py;
packageOverrides = lib.foldr lib.composeExtensions (self: super: { }) ([ packageOverrides = lib.foldr lib.composeExtensions (self: super: { }) ([
(mkOverride "flask" "0.10.1" "0wrkavjdjndknhp8ya8j850jq7a1cli4g5a93mg8nh1xz2gq50sc") (mkOverride "flask" "0.12.5" "fac2b9d443e49f7e7358a444a3db5950bdd0324674d92ba67f8f1f15f876b14f")
(mkOverride "flask_login" "0.2.11" "1rg3rsjs1gwi2pw6vr9jmhaqm9b3vc9c4hfcsvp4y8agbh7g3mc3") (mkOverride "flaskbabel" "0.12.2" "11jwp8vvq1gnm31qh6ihy2h393hy18yn9yjp569g60r0wj1x2sii")
(mkOverride "tornado" "4.5.3" "02jzd23l4r6fswmwxaica9ldlyc2p6q8dk6dyff7j58fmdzf853d") (mkOverride "tornado" "4.5.3" "02jzd23l4r6fswmwxaica9ldlyc2p6q8dk6dyff7j58fmdzf853d")
(mkOverride "psutil" "5.6.7" "ffad8eb2ac614518bbe3c0b8eb9dffdb3a8d2e3a7d5da51c5b974fb723a5c5aa")
# Octoprint holds back jinja2 to 2.8.1 due to breaking changes. # Octoprint holds back jinja2 to 2.8.1 due to breaking changes.
# This old version does not have updated test config for pytest 4, # This old version does not have updated test config for pytest 4,
# and pypi tarball doesn't contain tests dir anyways. # and pypi tarball doesn't contain tests dir anyways.
(pself: psuper: { (self: super: {
jinja2 = psuper.jinja2.overridePythonAttrs (oldAttrs: rec { jinja2 = super.jinja2.overridePythonAttrs (oldAttrs: rec {
version = "2.8.1"; version = "2.8.1";
src = oldAttrs.src.override { src = oldAttrs.src.override {
inherit version; inherit version;
@ -29,59 +33,43 @@ let
}; };
doCheck = false; doCheck = false;
}); });
httpretty = super.httpretty.overridePythonAttrs (oldAttrs: rec {
doCheck = false;
});
celery = super.celery.overridePythonAttrs (oldAttrs: rec {
doCheck = false;
});
}) })
]); (self: super: {
}; octoprint = self.buildPythonPackage rec {
ignoreVersionConstraints = [
"Click"
"Flask-Assets"
"Flask-Babel"
"Flask-Principal"
"emoji"
"flask"
"future"
"futures"
"monotonic"
"markdown"
"pkginfo"
"psutil"
"pyserial"
"requests"
"rsa"
"sarge"
"scandir"
"semantic_version"
"watchdog"
"websocket-client"
"wrapt"
"sentry-sdk"
"werkzeug" # 0.16 just deprecates some stuff
];
in py.pkgs.buildPythonApplication rec {
pname = "OctoPrint"; pname = "OctoPrint";
version = "1.3.12"; version = "1.4.0";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "foosel"; owner = "foosel";
repo = "OctoPrint"; repo = "OctoPrint";
rev = version; rev = version;
sha256 = "1lmqssgwjyhknjf3x58g7cr0fqz7fs5a3rl07r69wfpch63ranyd"; sha256 = "0387228544v28d69dcdg2zr5gp6qavkfr6dydpjgj5awxv3w25d5";
}; };
propagatedBuildInputs = with py.pkgs; [ propagatedBuildInputs = with super; [
awesome-slugify flask_assets rsa requests pkginfo watchdog awesome-slugify flask flask_assets rsa requests pkginfo watchdog
semantic-version flask_principal werkzeug flaskbabel tornado semantic-version werkzeug flaskbabel tornado
psutil pyserial flask_login netaddr markdown sockjs-tornado psutil pyserial flask_login netaddr markdown
pylru pyyaml sarge feedparser netifaces click websocket_client pylru pyyaml sarge feedparser netifaces click websocket_client
scandir chainmap future futures wrapt monotonic emoji scandir chainmap future wrapt monotonic emoji jinja2
frozendict cachelib sentry-sdk typing filetype frozendict cachelib sentry-sdk filetype markupsafe
] ++ lib.optionals stdenv.isDarwin [ py.pkgs.appdirs ]; ] ++ lib.optionals stdenv.isDarwin [ py.pkgs.appdirs ];
checkInputs = with py.pkgs; [ nose mock ddt ]; checkInputs = with super; [ pytestCheckHook mock ddt ];
postPatch = '' postPatch = let
ignoreVersionConstraints = [
"sentry-sdk"
];
in ''
sed -r -i \ sed -r -i \
${lib.concatStringsSep "\n" (map (e: ${lib.concatStringsSep "\n" (map (e:
''-e 's@${e}[<>=]+.*@${e}",@g' \'' ''-e 's@${e}[<>=]+.*@${e}",@g' \''
@ -89,14 +77,31 @@ in py.pkgs.buildPythonApplication rec {
setup.py setup.py
''; '';
checkPhase = '' dontUseSetuptoolsCheck = true;
HOME=$(mktemp -d) nosetests ${lib.optionalString stdenv.isDarwin "--exclude=test_set_external_modification"}
preCheck = ''
export HOME=$(mktemp -d)
rm pytest.ini
''; '';
disabledTests = [
"test_check_setup" # Why should it be able to call pip?
] ++ lib.optionals stdenv.isDarwin [
"test_set_external_modification"
];
passthru.python = self.python;
meta = with stdenv.lib; { meta = with stdenv.lib; {
homepage = "https://octoprint.org/"; homepage = "https://octoprint.org/";
description = "The snappy web interface for your 3D printer"; description = "The snappy web interface for your 3D printer";
license = licenses.agpl3; license = licenses.agpl3;
maintainers = with maintainers; [ abbradar gebner ]; maintainers = with maintainers; [ abbradar gebner WhittlesJr ];
}; };
} };
})
(import ./plugins.nix {inherit pkgs;})
packageOverrides
]);
};
in with py.pkgs; toPythonApplication octoprint

View File

@ -1,15 +1,17 @@
{ stdenv, fetchgit, fetchFromGitHub, octoprint, python2Packages, marlin-calc }: { pkgs }:
let with pkgs;
buildPlugin = args: python2Packages.buildPythonPackage (args // {
self: super: let
buildPlugin = args: self.buildPythonPackage (args // {
pname = "OctoPrintPlugin-${args.pname}"; pname = "OctoPrintPlugin-${args.pname}";
inherit (args) version; inherit (args) version;
propagatedBuildInputs = (args.propagatedBuildInputs or []) ++ [ octoprint ]; propagatedBuildInputs = (args.propagatedBuildInputs or []) ++ [ super.octoprint ];
# none of the following have tests # none of the following have tests
doCheck = false; doCheck = false;
}); });
in {
self = { inherit buildPlugin;
# Deprecated alias # Deprecated alias
m3d-fio = self.m33-fio; # added 2016-08-13 m3d-fio = self.m33-fio; # added 2016-08-13
@ -56,7 +58,7 @@ let
sha256 = "0y1jnfplcy8mh3szrfbbvngl02j49cbdizglrfsry4fvqg50zjxd"; sha256 = "0y1jnfplcy8mh3szrfbbvngl02j49cbdizglrfsry4fvqg50zjxd";
}; };
propagatedBuildInputs = with python2Packages; [ paho-mqtt ]; propagatedBuildInputs = with super; [ paho-mqtt ];
meta = with stdenv.lib; { meta = with stdenv.lib; {
description = "Publish printer status MQTT"; description = "Publish printer status MQTT";
@ -125,13 +127,13 @@ let
touchui = buildPlugin rec { touchui = buildPlugin rec {
pname = "TouchUI"; pname = "TouchUI";
version = "0.3.13"; version = "0.3.14";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "BillyBlaze"; owner = "BillyBlaze";
repo = "OctoPrint-${pname}"; repo = "OctoPrint-${pname}";
rev = version; rev = version;
sha256 = "0qk12ysabdzy6cna3l4f8v3qcnppppwxxsjx2i0xn1nd0cv6yzwh"; sha256 = "033b9nk3kpnmjw9nggcaxy39hcgfviykcy2cx0j6m411agvmqbzf";
}; };
meta = with stdenv.lib; { meta = with stdenv.lib; {
@ -144,13 +146,13 @@ let
psucontrol = buildPlugin rec { psucontrol = buildPlugin rec {
pname = "PSUControl"; pname = "PSUControl";
version = "0.1.8"; version = "0.1.9";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "kantlivelong"; owner = "kantlivelong";
repo = "OctoPrint-${pname}"; repo = "OctoPrint-${pname}";
rev = version; rev = version;
sha256 = "0aj38d7b7d5pzmzq841pip18cpg18wy2vrxq2nd13875597y54b8"; sha256 = "1cn009bdgn6c9ba9an5wfj8z02wi0xcsmbhkqggiqlnqy1fq45ca";
}; };
preConfigure = '' preConfigure = ''
@ -180,7 +182,7 @@ let
preConfigure = '' preConfigure = ''
# PrintTimeGenius ships with marlin-calc binaries for multiple architectures # PrintTimeGenius ships with marlin-calc binaries for multiple architectures
rm */analyzers/marlin-calc* rm */analyzers/marlin-calc*
sed 's@"{}.{}".format(binary_base_name, machine)@"${marlin-calc}/bin/marlin-calc"@' -i */analyzers/analyze_progress.py sed 's@"{}.{}".format(binary_base_name, machine)@"${pkgs.marlin-calc}/bin/marlin-calc"@' -i */analyzers/analyze_progress.py
''; '';
patches = [ patches = [
@ -226,7 +228,7 @@ let
meta = with stdenv.lib; { meta = with stdenv.lib; {
description = "Edit gcode on OctoPrint"; description = "Edit gcode on OctoPrint";
homepage = "https://github.com/Sebclem/OctoPrint-SimpleEmergencyStop"; homepage = "https://github.com/ieatacid/OctoPrint-GcodeEditor";
license = licenses.agpl3; license = licenses.agpl3;
maintainers = with maintainers; [ WhittlesJr ]; maintainers = with maintainers; [ WhittlesJr ];
}; };
@ -245,11 +247,9 @@ let
meta = with stdenv.lib; { meta = with stdenv.lib; {
description = "A simple plugin that add an emergency stop buton on NavBar of OctoPrint"; description = "A simple plugin that add an emergency stop buton on NavBar of OctoPrint";
homepage = "https://github.com/ieatacid/OctoPrint-GcodeEditor"; homepage = "https://github.com/Sebclem/OctoPrint-SimpleEmergencyStop";
license = licenses.agpl3; license = licenses.agpl3;
maintainers = with maintainers; [ WhittlesJr ]; maintainers = with maintainers; [ WhittlesJr ];
}; };
}; };
}; }
in self

View File

@ -5,6 +5,8 @@
, pytest , pytest
, pytz , pytz
, sqlalchemy , sqlalchemy
, importlib-metadata
, pythonOlder
}: }:
buildPythonPackage rec { buildPythonPackage rec {
@ -23,7 +25,11 @@ buildPythonPackage rec {
--replace "amqp==2.5.1" "amqp~=2.5" --replace "amqp==2.5.1" "amqp~=2.5"
''; '';
propagatedBuildInputs = [ amqp ]; propagatedBuildInputs = [
amqp
] ++ lib.optionals (pythonOlder "3.8") [
importlib-metadata
];
checkInputs = [ pytest case pytz Pyro4 sqlalchemy ]; checkInputs = [ pytest case pytz Pyro4 sqlalchemy ];
# test_redis requires fakeredis, which isn't trivial to package # test_redis requires fakeredis, which isn't trivial to package

View File

@ -21060,7 +21060,7 @@ in
octoprint = callPackage ../applications/misc/octoprint { }; octoprint = callPackage ../applications/misc/octoprint { };
octoprint-plugins = callPackage ../applications/misc/octoprint/plugins.nix { }; octoprint-plugins = throw ''octoprint-plugins are now part of the octoprint.python.pkgs package set.'';
ocrad = callPackage ../applications/graphics/ocrad { }; ocrad = callPackage ../applications/graphics/ocrad { };