Unverified Commit d709e821 authored by Ryan Lahfa's avatar Ryan Lahfa Committed by GitHub
Browse files

Merge pull request #232473 from figsoda/freeze

python310Packages.cx_Freeze: fix build
parents 023dc5dd 2b47cede
Loading
Loading
Loading
Loading
+24 −6
Original line number Diff line number Diff line
{ stdenv, lib, buildPythonPackage, pythonOlder, fetchPypi, ncurses, importlib-metadata }:
{ lib
, buildPythonPackage
, fetchPypi
, pythonOlder
, ncurses
, importlib-metadata
, setuptools
, patchelf
}:

buildPythonPackage rec {
  pname = "cx-freeze";
@@ -15,23 +23,33 @@ buildPythonPackage rec {
  propagatedBuildInputs = [
    importlib-metadata # upstream has this for 3.8 as well
    ncurses
    setuptools
  ];

  # timestamp need to come after 1980 for zipfiles and nix store is set to epoch
  postPatch = ''
    substituteInPlace cx_Freeze/freezer.py --replace "os.stat(module.file).st_mtime" "time.time()"
    # timestamp need to come after 1980 for zipfiles and nix store is set to epoch
    substituteInPlace cx_Freeze/freezer.py --replace "st.st_mtime" "time.time()"

    substituteInPlace setup.cfg \
      --replace "setuptools>=59.0.1,<=60.10.0" "setuptools>=59.0.1"
    sed -i /patchelf/d pyproject.toml
    substituteInPlace pyproject.toml \
      --replace 'setuptools>=61.2,<67' setuptools
  '';

  makeWrapperArgs = [
    "--prefix"
    "PATH"
    ":"
    (lib.makeBinPath [ patchelf ])
  ];

  # fails to find Console even though it exists on python 3.x
  doCheck = false;

  meta = with lib; {
    broken = (stdenv.isLinux && stdenv.isAarch64);
    description = "A set of scripts and modules for freezing Python scripts into executables";
    homepage = "https://marcelotduarte.github.io/cx_Freeze/";
    license = licenses.psfl;
    maintainers = with maintainers; [ ];
    mainProgram = "cxfreeze";
  };
}