diff options
author | Anderson Torres <torres.anderson.85@protonmail.com> | 2024-03-09 14:30:50 -0300 |
---|---|---|
committer | Anderson Torres <torres.anderson.85@protonmail.com> | 2024-03-09 14:30:50 -0300 |
commit | b325f74ce611c0d626abcd73987cda75e3fcf4c1 (patch) | |
tree | 2e45ea966bf4e4c4d38df7c8b52ef49cb53e8135 /pkgs/applications/graphics | |
parent | f88b0e47f05428a5cdccd5dfc2ac461604aca92e (diff) |
freecad: migrate to by-name
Diffstat (limited to 'pkgs/applications/graphics')
-rw-r--r-- | pkgs/applications/graphics/freecad/0001-NIXOS-don-t-ignore-PYTHONPATH.patch | 61 | ||||
-rw-r--r-- | pkgs/applications/graphics/freecad/default.nix | 196 |
2 files changed, 0 insertions, 257 deletions
diff --git a/pkgs/applications/graphics/freecad/0001-NIXOS-don-t-ignore-PYTHONPATH.patch b/pkgs/applications/graphics/freecad/0001-NIXOS-don-t-ignore-PYTHONPATH.patch deleted file mode 100644 index 27e5fb81b8d07..0000000000000 --- a/pkgs/applications/graphics/freecad/0001-NIXOS-don-t-ignore-PYTHONPATH.patch +++ /dev/null @@ -1,61 +0,0 @@ -From c4f452ef6ae083ed21095313582f6d1bd775cbf3 Mon Sep 17 00:00:00 2001 -From: Andreas Rammhold <andreas@rammhold.de> -Date: Thu, 2 Nov 2023 17:32:07 +0100 -Subject: [PATCH] NIXOS: don't ignore PYTHONPATH - -On NixOS or rather within nixpkgs we provide the runtime Python -packages via the PYTHONPATH environment variable. FreeCAD tries its -best to ignore Python environment variables that are being inherited -from the environment. For Python versions >=3.11 it also tries to -initialize the interpreter config without any environmental data. We -have to initialize the configuration *with* the information from the -environment for our packaging to work. - -Upstream has purposely isolated the environments AFAIK and thus -shouldn't accept this patch (as is). What they might accept (once -support for older Python versions has been dropped) is removing the -PYTHONPATH specific putenv calls. ---- - src/Base/Interpreter.cpp | 2 +- - src/Main/MainGui.cpp | 3 --- - 2 files changed, 1 insertion(+), 4 deletions(-) - -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,9 @@ void initInterpreter(int argc,char *argv[]) - { - PyStatus status; - PyConfig config; - PyConfig_InitIsolatedConfig(&config); -+ config.isolated = 0; -+ config.use_environment = 1; - - status = PyConfig_SetBytesArgv(&config, argc, argv); - if (PyStatus_Exception(status)) { -diff --git a/src/Main/MainGui.cpp b/src/Main/MainGui.cpp -index 48ae847ef4..28813df383 100644 ---- a/src/Main/MainGui.cpp -+++ b/src/Main/MainGui.cpp -@@ -112,17 +112,14 @@ int main( int argc, char ** argv ) - // See https://forum.freecad.org/viewtopic.php?f=18&t=20600 - // See Gui::Application::runApplication() - putenv("LC_NUMERIC=C"); -- putenv("PYTHONPATH="); - #elif defined(FC_OS_MACOSX) - (void)QLocale::system(); -- putenv("PYTHONPATH="); - #elif defined(__MINGW32__) - const char* mingw_prefix = getenv("MINGW_PREFIX"); - const char* py_home = getenv("PYTHONHOME"); - if (!py_home && mingw_prefix) - _putenv_s("PYTHONHOME", mingw_prefix); - #else -- _putenv("PYTHONPATH="); - // https://forum.freecad.org/viewtopic.php?f=4&t=18288 - // https://forum.freecad.org/viewtopic.php?f=3&t=20515 - const char* fc_py_home = getenv("FC_PYTHONHOME"); --- -2.42.0 - diff --git a/pkgs/applications/graphics/freecad/default.nix b/pkgs/applications/graphics/freecad/default.nix deleted file mode 100644 index 436d94bd0f985..0000000000000 --- a/pkgs/applications/graphics/freecad/default.nix +++ /dev/null @@ -1,196 +0,0 @@ -{ lib -, cmake -, coin3d -, doxygen -, eigen -, fetchFromGitHub -, fmt -, freecad # for passthru.tests -, gfortran -, gts -, hdf5 -, libGLU -, libXmu -, libf2c -, libredwg -, libsForQt5 -, libspnav -, medfile -, mpi -, ninja -, ode -, opencascade-occt -, pkg-config -, python3Packages -, runCommand # for passthru.tests -, spaceNavSupport ? stdenv.isLinux -, stdenv -, swig -, vtk -, wrapGAppsHook -, xercesc -, zlib -}: - -let - boost = python3Packages.boost; - inherit (libsForQt5) - qtbase - qttools - qtwebengine - qtx11extras - qtxmlpatterns - soqt - wrapQtAppsHook; - inherit (python3Packages) - gitpython - matplotlib - pivy - ply - pycollada - pyside2 - pyside2-tools - python - pyyaml - scipy - shiboken2; -in -stdenv.mkDerivation (finalAttrs: { - pname = "freecad"; - version = "0.21.2"; - - src = fetchFromGitHub { - owner = "FreeCAD"; - repo = "FreeCAD"; - rev = finalAttrs.version; - hash = "sha256-OX4s9rbGsAhH7tLJkUJYyq2A2vCdkq/73iqYo9adogs="; - }; - - nativeBuildInputs = [ - cmake - ninja - pkg-config - pyside2-tools - gfortran - wrapQtAppsHook - wrapGAppsHook - ]; - - buildInputs = [ - gitpython # for addon manager - boost - coin3d - doxygen - eigen - fmt - gts - hdf5 - libGLU - libXmu - libf2c - matplotlib - medfile - mpi - ode - opencascade-occt - pivy - ply # for openSCAD file support - pycollada - pyside2 - pyside2-tools - python - pyyaml # (at least for) PyrateWorkbench - qtbase - qttools - qtwebengine - qtxmlpatterns - scipy - shiboken2 - soqt - swig - vtk - xercesc - zlib - ] ++ lib.optionals spaceNavSupport [ - libspnav - qtx11extras - ]; - - patches = [ - ./0001-NIXOS-don-t-ignore-PYTHONPATH.patch - ]; - - cmakeFlags = [ - "-Wno-dev" # turns off warnings which otherwise makes it hard to see what is going on - "-DBUILD_FLAT_MESH:BOOL=ON" - "-DBUILD_QT5=ON" - "-DSHIBOKEN_INCLUDE_DIR=${shiboken2}/include" - "-DSHIBOKEN_LIBRARY=Shiboken2::libshiboken" - ("-DPYSIDE_INCLUDE_DIR=${pyside2}/include" - + ";${pyside2}/include/PySide2/QtCore" - + ";${pyside2}/include/PySide2/QtWidgets" - + ";${pyside2}/include/PySide2/QtGui" - ) - "-DPYSIDE_LIBRARY=PySide2::pyside2" - ]; - - # This should work on both x86_64, and i686 linux - preBuild = '' - export NIX_LDFLAGS="-L${gfortran.cc}/lib64 -L${gfortran.cc}/lib $NIX_LDFLAGS"; - ''; - - preConfigure = '' - qtWrapperArgs+=(--prefix PYTHONPATH : "$PYTHONPATH") - ''; - - qtWrapperArgs = [ - "--set COIN_GL_NO_CURRENT_CONTEXT_CHECK 1" - "--prefix PATH : ${libredwg}/bin" - "--set QT_QPA_PLATFORM xcb" - ]; - - postFixup = '' - mv $out/share/doc $out - ln -s $out/bin/FreeCAD $out/bin/freecad - 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"; - longDescription = '' - FreeCAD is an open-source parametric 3D modeler made primarily to design - real-life objects of any size. Parametric modeling allows you to easily - modify your design by going back into your model history and changing its - parameters. - - FreeCAD allows you to sketch geometry constrained 2D shapes and use them - as a base to build other objects. It contains many components to adjust - dimensions or extract design details from 3D models to create high quality - production ready drawings. - - FreeCAD is designed to fit a wide range of uses including product design, - mechanical engineering and architecture. Whether you are a hobbyist, a - programmer, an experienced CAD user, a student or a teacher, you will feel - right at home with FreeCAD. - ''; - license = lib.licenses.lgpl2Plus; - maintainers = with lib.maintainers; [ viric gebner AndersonTorres ]; - platforms = lib.platforms.linux; - }; -}) |