diff options
Diffstat (limited to 'nixpkgs/pkgs/applications/graphics/freecad')
-rw-r--r-- | nixpkgs/pkgs/applications/graphics/freecad/0001-NIXOS-don-t-ignore-PYTHONPATH.patch | 7 | ||||
-rw-r--r-- | nixpkgs/pkgs/applications/graphics/freecad/default.nix | 17 |
2 files changed, 21 insertions, 3 deletions
diff --git a/nixpkgs/pkgs/applications/graphics/freecad/0001-NIXOS-don-t-ignore-PYTHONPATH.patch b/nixpkgs/pkgs/applications/graphics/freecad/0001-NIXOS-don-t-ignore-PYTHONPATH.patch index 371da24680e0..27e5fb81b8d0 100644 --- a/nixpkgs/pkgs/applications/graphics/freecad/0001-NIXOS-don-t-ignore-PYTHONPATH.patch +++ b/nixpkgs/pkgs/applications/graphics/freecad/0001-NIXOS-don-t-ignore-PYTHONPATH.patch @@ -24,12 +24,13 @@ diff --git a/src/Base/Interpreter.cpp b/src/Base/Interpreter.cpp index 52c47168af..9966bd0013 100644 --- a/src/Base/Interpreter.cpp +++ b/src/Base/Interpreter.cpp -@@ -554,7 +554,7 @@ void initInterpreter(int argc,char *argv[]) +@@ -554,7 +554,9 @@ void initInterpreter(int argc,char *argv[]) { PyStatus status; PyConfig config; -- PyConfig_InitIsolatedConfig(&config); -+ PyConfig_InitPythonConfig(&config); + PyConfig_InitIsolatedConfig(&config); ++ config.isolated = 0; ++ config.use_environment = 1; status = PyConfig_SetBytesArgv(&config, argc, argv); if (PyStatus_Exception(status)) { diff --git a/nixpkgs/pkgs/applications/graphics/freecad/default.nix b/nixpkgs/pkgs/applications/graphics/freecad/default.nix index 76b2a38320d8..857365cd66d5 100644 --- a/nixpkgs/pkgs/applications/graphics/freecad/default.nix +++ b/nixpkgs/pkgs/applications/graphics/freecad/default.nix @@ -9,6 +9,7 @@ , boost , coin3d , eigen +, freecad # for passthru.tests , gfortran , gts , hdf5 @@ -35,6 +36,7 @@ , qtwebengine , qtx11extras , qtxmlpatterns +, runCommand # for passthru.tests , scipy , shiboken2 , soqt @@ -147,6 +149,21 @@ stdenv.mkDerivation (finalAttrs: { ln -s $out/bin/FreeCADCmd $out/bin/freecadcmd ''; + passthru.tests = { + # Check that things such as argument parsing still work correctly with + # the above PYTHONPATH patch. Previously the patch used above changed + # the `PyConfig_InitIsolatedConfig` to `PyConfig_InitPythonConfig`, + # which caused the built-in interpreter to attempt (and fail) to doubly + # parse argv. This should catch if that ever regresses and also ensures + # that PYTHONPATH is still respected enough for the FreeCAD console to + # successfully run and check that it was included in `sys.path`. + python-path = runCommand "freecad-test-console" { + nativeBuildInputs = [ freecad ]; + } '' + HOME="$(mktemp -d)" PYTHONPATH="$(pwd)/test" FreeCADCmd --log-file $out -c "if not '$(pwd)/test' in sys.path: sys.exit(1)" </dev/null + ''; + }; + meta = { homepage = "https://www.freecad.org"; description = "General purpose Open Source 3D CAD/MCAD/CAx/CAE/PLM modeler"; |