Unverified Commit c6dbcc8d authored by Pol Dellaiera's avatar Pol Dellaiera Committed by GitHub
Browse files

python3Packages.cx-freeze: fix build (#502380)

parents c03cb4f0 a793a02f
Loading
Loading
Loading
Loading
+52 −8
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@

  # dependencies
  filelock,
  freeze-core,
  packaging,

  distutils,
@@ -17,7 +18,10 @@
  dmgbuild,

  # tests
  ensureNewerSourcesForZipFilesHook,
  anyio,
  bcrypt,

  python,
  pytest-mock,
  pytestCheckHook,
  versionCheckHook,
@@ -36,15 +40,9 @@ buildPythonPackage rec {
    hash = "sha256-tV2i0o6D/Cz0ePYgJN+c4VgMkhVhO/2xhPX8vsasFPs=";
  };

  patches = [
    # ValueError: '/nix/store/33ajdw6s479bg0ydhk0zqrxi6p989gbl-python3.12-pytest-8.3.5/lib/python3.12/site-packages'
    # is not in the subpath of '/nix/store/fqm9bqqlmaqqr02qbalm1bazp810qfiw-python3-3.12.9'
    ./fix-tests-relative-path.patch
  ];

  postPatch = ''
    substituteInPlace pyproject.toml \
      --replace-fail "setuptools>=77.0.3,<=80.4.0" "setuptools>=77.0.3"
      --replace-fail "setuptools>=78.1.1,<81" "setuptools"
  '';

  build-system = [
@@ -60,6 +58,7 @@ buildPythonPackage rec {
  dependencies = [
    distutils
    filelock
    freeze-core
    packaging
    setuptools
  ]
@@ -84,10 +83,16 @@ buildPythonPackage rec {
    writableTmpDirAsHomeHook
    versionCheckHook
  ];

  versionCheckProgram = "${placeholder "out"}/bin/cxfreeze";

  preCheck = ''
    rm -rf cx_Freeze

    substituteInPlace tests/conftest.py \
      --replace-fail \
        "Path(pytest.__file__).parent.parent.relative_to(prefix).as_posix()" \
        "'python/lib/python${lib.versions.majorMinor python.version}/site-packages/'"
  '';

  disabledTests = [
@@ -96,6 +101,7 @@ buildPythonPackage rec {
    "test_bdist_appimage_target_name"
    "test_bdist_appimage_target_name_and_version"
    "test_bdist_appimage_target_name_and_version_none"
    "test_bdist_appimage_download_runtime"

    # Try to install a module: ValueError: ZIP does not support timestamps before 1980
    "test___main__"
@@ -130,6 +136,44 @@ buildPythonPackage rec {
    "test_valid_icon"
    "test_zip_exclude_packages"
    "test_zip_include_packages"

    # Permission denied .lock
    "test_anyio"
    "test_av"
    "test_argon2"
    "test_bcrypt"
    "test_crypto"
    "test_cryptography"
    "test_multiprocess"
    "test_matplotlib"
    "test_pandas"
    "test_rasterio"
    "test_shapely"
    "test_vtk"
    "test_ortools"
    "test_pillow"
    "test_pyarrow"
    "test_pymupdf"
    "test_pyproj"
    "test_pytz"
    "test_pyzmq"
    "test_qt"
    "test_scipy"
    "test_skimage"
    "test_sklearn"
    "test_setuptools"
    "test_zoneinfo"
    "test_zoneinfo_and_tzdata"
    "test_zeroconf"
    "test_zstd"
    "test_bdist_appimage_implicit_skip_build"
    "test_bdist_deb_simple"
    "test_bdist_deb"
    "test_bdist_rpm_simple"
    "test_bdist_rpm"
    "test_verify_patchelf_older"
    "test_egg_info"
    "test_editable_packages"
  ]
  ++ lib.optionals stdenv.hostPlatform.isDarwin [
    # error: Path /nix/store/xzjghvsg4fhr2vv6h4scihsdrgk4i76w-python3-3.12.9/lib/libpython3.12.dylib
+38 −0
Original line number Diff line number Diff line
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  setuptools,
  filelock,
}:

buildPythonPackage (finalAttrs: {
  pname = "cx-logging";
  version = "3.2.1";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "anthony-tuininga";
    repo = "cx_Logging";
    tag = "v${finalAttrs.version}";
    hash = "sha256-aBLIzjkB0X8jboEQ3CNHLBPX5Mx1IJjmPKvJRqcfozI=";
  };

  postPatch = ''
    substituteInPlace pyproject.toml \
      --replace-fail "setuptools>=70.1,<75" "setuptools"
  '';

  build-system = [ setuptools ];

  dependencies = [ filelock ];

  pythonImportsCheck = [ "cx_Logging" ];

  meta = {
    description = "Python and C interfaces for logging";
    changelog = "https://github.com/anthony-tuininga/cx_Logging/releases/tag/${finalAttrs.src.tag}";
    license = lib.licenses.bsd3;
    maintainers = with lib.maintainers; [ sigmanificient ];
  };
})
+62 −0
Original line number Diff line number Diff line
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,

  # build-system
  setuptools,

  # dependencies
  cx-logging,
  distutils,
  filelock,

  # tests
  pytest-mock,
  pytestCheckHook,
  versionCheckHook,
  writableTmpDirAsHomeHook,
}:

buildPythonPackage (finalAttrs: {
  pname = "freeze-core";
  version = "0.6.1";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "marcelotduarte";
    repo = "freeze-core";
    tag = finalAttrs.version;
    hash = "sha256-88AODiBvIPq51l1rU+mshGknQk+3qoiR7I5mfNfNv50=";
  };

  postPatch = ''
    substituteInPlace pyproject.toml \
      --replace-fail "setuptools~=82.0" "setuptools"
  '';

  build-system = [
    setuptools
    cx-logging
  ];

  dependencies = [
    distutils # needed to compile
    filelock
  ];

  pythonImportsCheck = [
    "freeze_core"
  ];

  nativeCheckInputs = [
    pytestCheckHook
  ];

  meta = {
    description = "Core dependency for cx_Freeze";
    changelog = "https://github.com/marcelotduarte/freeze-core/releases/tag/${finalAttrs.src.tag}";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ sigmanificient ];
  };
})
+4 −0
Original line number Diff line number Diff line
@@ -3452,6 +3452,8 @@ self: super: with self; {
  cx-freeze = callPackage ../development/python-modules/cx-freeze { };
  cx-logging = callPackage ../development/python-modules/cx-logging { };
  cx-oracle = callPackage ../development/python-modules/cx-oracle { };
  cxxfilt = callPackage ../development/python-modules/cxxfilt { };
@@ -5892,6 +5894,8 @@ self: super: with self; {
  freetype-py = callPackage ../development/python-modules/freetype-py { };
  freeze-core = callPackage ../development/python-modules/freeze-core { };
  freezegun = callPackage ../development/python-modules/freezegun { };
  frelatage = callPackage ../development/python-modules/frelatage { };