diff --git a/pkgs/applications/science/electronics/flatcam/default.nix b/pkgs/applications/science/electronics/flatcam/default.nix index 169130b41010..5332eb291d6f 100644 --- a/pkgs/applications/science/electronics/flatcam/default.nix +++ b/pkgs/applications/science/electronics/flatcam/default.nix @@ -1,91 +1,98 @@ { lib -, stdenv -, python3 -, fetchPypi , fetchFromBitbucket -, fetchpatch -, substituteAll -, geos +, buildPythonApplication +, pyqt5 +, matplotlib +, numpy +, cycler +, python-dateutil +, kiwisolver +, six +, setuptools +, dill +, Rtree +, pyopengl +, vispy +, ortools +, svg-path +, simplejson +, shapely +, freetype-py +, fonttools +, rasterio +, lxml +, ezdxf +, qrcode +, reportlab +, svglib +, gdal +, pyserial +, python3 }: -let - python = python3.override { - packageOverrides = self: super: { - shapely = super.shapely.overridePythonAttrs (old: rec { - version = "1.8.4"; - - src = fetchPypi { - pname = "Shapely"; - inherit version; - hash = "sha256-oZXlHKr6IYKR8suqP+9p/TNTyT7EtlsqRyLEz0DDGYw="; - }; - - # Environment variable used in shapely/_buildcfg.py - GEOS_LIBRARY_PATH = "${geos}/lib/libgeos_c${stdenv.hostPlatform.extensions.sharedLibrary}"; - - patches = [ - # Patch to search form GOES .so/.dylib files in a Nix-aware way - (substituteAll { - src = ./shapely-library-paths.patch; - libgeos_c = GEOS_LIBRARY_PATH; - libc = lib.optionalString (!stdenv.isDarwin) "${stdenv.cc.libc}/lib/libc${stdenv.hostPlatform.extensions.sharedLibrary}.6"; - }) - ]; - - postPatch = '' - substituteInPlace pyproject.toml \ - --replace 'setuptools<64' 'setuptools' - ''; - }); - }; - }; -in -python.pkgs.buildPythonApplication rec { +buildPythonApplication rec { pname = "flatcam"; - version = "8.5"; + version = "unstable-2022-02-02"; src = fetchFromBitbucket { owner = "jpcgt"; repo = pname; - rev = "533afd6a1772857cb633c011b5e0a15b60b1e92e"; # 8.5 with Red Hat packaging. - sha256 = "199kiiml18k34z1zhk2hbhibphmnv0kb11kxiajq52alps0mjb3m"; + rev = "ebf5cb9e3094362c4b0774a54cf119559c02211d"; # beta branch as of 2022-02-02 + hash = "sha256-QKkBPEM+HVYmSZ83b4JRmOmCMp7C3EUqbJKPqUXMiKE="; }; - propagatedBuildInputs = with python.pkgs; [ + format = "other"; + + dontBuild = true; + + propagatedBuildInputs = [ + pyqt5 matplotlib numpy - packaging - pyqt4 - rtree - scipy - setuptools - shapely - simplejson + cycler + python-dateutil + kiwisolver six + setuptools + dill + Rtree + pyopengl + vispy + ortools svg-path + simplejson + shapely + freetype-py + fonttools + rasterio + lxml + ezdxf + qrcode + reportlab + svglib + gdal + pyserial ]; - packaging_fix_pull_request_patch = fetchpatch { - name = "packaging_fix_pull_request.patch"; - url = "https://bitbucket.org/trepetti/flatcam/commits/5591ed889d1f48a5190fe237b562cb932cb5876c/raw"; - sha256 = "19rhjdrf1n1q29cgpcry6pl2kl90zq0d613hhkwdir9bhq5bkknp"; - }; + preInstall = '' + patchShebangs . - patches = [ - packaging_fix_pull_request_patch - ./release.patch - ]; + sed -i "s|/usr/local/bin|$out/bin|" Makefile - postPatch = '' - substituteInPlace setup.py --replace "'shapely>=1.3'" "'shapely>=1.3'," + mkdir -p $out/share/{flatcam,applications} + mkdir -p $out/bin ''; - # Only non-GUI tests can be run deterministically in the Nix build environment. - checkPhase = '' - python -m unittest tests.test_excellon - python -m unittest tests.test_gerber_buffer - python -m unittest tests.test_paint - python -m unittest tests.test_pathconnect + installFlags = [ + "USER_ID=0" + "LOCAL_PATH=/build/source/." + "INSTALL_PATH=${placeholder "out"}/share/flatcam" + "APPS_PATH=${placeholder "out"}/share/applications" + ]; + + postInstall = '' + sed -i "s|python3|${python3.withPackages (_: propagatedBuildInputs)}/bin/python3|" $out/bin/flatcam-beta + mv $out/bin/flatcam{-beta,} ''; meta = with lib; { diff --git a/pkgs/applications/science/electronics/flatcam/release.patch b/pkgs/applications/science/electronics/flatcam/release.patch deleted file mode 100644 index 945228e35bab..000000000000 --- a/pkgs/applications/science/electronics/flatcam/release.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/FlatCAMVersion.py b/FlatCAMVersion.py -index ba9e04a5..2c64d5a6 100644 ---- a/FlatCAMVersion.py -+++ b/FlatCAMVersion.py -@@ -16,7 +16,7 @@ version = { - "number": 8.5, - "date": (2016, 7, 1), # Year, Month, Day - "name": None, -- "release": False, -+ "release": True, - } - - diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 41cb855c79f8..6fb915896572 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -39961,7 +39961,7 @@ with pkgs; diylc = callPackage ../applications/science/electronics/diylc { }; - flatcam = callPackage ../applications/science/electronics/flatcam { }; + flatcam = python3.pkgs.callPackage ../applications/science/electronics/flatcam { }; flopoco = callPackage ../applications/science/electronics/flopoco { };