nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6
7 # build-system
8 setuptools,
9
10 # dependencies
11 filelock,
12 packaging,
13
14 distutils,
15 ncurses,
16 patchelf,
17 dmgbuild,
18
19 # tests
20 ensureNewerSourcesForZipFilesHook,
21 pytest-mock,
22 pytestCheckHook,
23 versionCheckHook,
24 writableTmpDirAsHomeHook,
25}:
26
27buildPythonPackage rec {
28 pname = "cx-freeze";
29 version = "8.5.3";
30 pyproject = true;
31
32 src = fetchFromGitHub {
33 owner = "marcelotduarte";
34 repo = "cx_Freeze";
35 tag = version;
36 hash = "sha256-tV2i0o6D/Cz0ePYgJN+c4VgMkhVhO/2xhPX8vsasFPs=";
37 };
38
39 patches = [
40 # ValueError: '/nix/store/33ajdw6s479bg0ydhk0zqrxi6p989gbl-python3.12-pytest-8.3.5/lib/python3.12/site-packages'
41 # is not in the subpath of '/nix/store/fqm9bqqlmaqqr02qbalm1bazp810qfiw-python3-3.12.9'
42 ./fix-tests-relative-path.patch
43 ];
44
45 postPatch = ''
46 substituteInPlace pyproject.toml \
47 --replace-fail "setuptools>=77.0.3,<=80.4.0" "setuptools>=77.0.3"
48 '';
49
50 build-system = [
51 setuptools
52 ];
53
54 buildInputs = [ ncurses ];
55
56 pythonRelaxDeps = [ "setuptools" ];
57
58 pythonRemoveDeps = [ "patchelf" ];
59
60 dependencies = [
61 distutils
62 filelock
63 packaging
64 setuptools
65 ]
66 ++ lib.optionals stdenv.hostPlatform.isDarwin [
67 dmgbuild
68 ];
69
70 makeWrapperArgs = [
71 "--prefix"
72 "PATH"
73 ":"
74 (lib.makeBinPath [ patchelf ])
75 ];
76
77 pythonImportsCheck = [
78 "cx_Freeze"
79 ];
80
81 nativeCheckInputs = [
82 pytest-mock
83 pytestCheckHook
84 writableTmpDirAsHomeHook
85 versionCheckHook
86 ];
87 versionCheckProgram = "${placeholder "out"}/bin/cxfreeze";
88
89 preCheck = ''
90 rm -rf cx_Freeze
91 '';
92
93 disabledTests = [
94 # Require internet access
95 "test_bdist_appimage_download_appimagetool"
96 "test_bdist_appimage_target_name"
97 "test_bdist_appimage_target_name_and_version"
98 "test_bdist_appimage_target_name_and_version_none"
99
100 # Try to install a module: ValueError: ZIP does not support timestamps before 1980
101 "test___main__"
102 "test_bdist_appimage_simple"
103 "test_bdist_appimage_skip_build"
104 "test_bdist_deb_simple_pyproject"
105 "test_bdist_rpm_simple_pyproject"
106 "test_build"
107 "test_build_constants"
108 "test_build_exe_advanced"
109 "test_build_exe_asmodule"
110 "test_ctypes"
111 "test_cxfreeze"
112 "test_cxfreeze_debug_verbose"
113 "test_cxfreeze_deprecated_behavior"
114 "test_cxfreeze_deprecated_option"
115 "test_cxfreeze_include_path"
116 "test_cxfreeze_target_name_not_isidentifier"
117 "test_excludes"
118 "test_executable_namespace"
119 "test_executable_rename"
120 "test_executables"
121 "test_freezer_zip_filename"
122 "test_install"
123 "test_install_pyproject"
124 "test_multiprocessing"
125 "test_not_found_icon"
126 "test_parser"
127 "test_sqlite"
128 "test_ssl"
129 "test_tz"
130 "test_valid_icon"
131 "test_zip_exclude_packages"
132 "test_zip_include_packages"
133 ]
134 ++ lib.optionals stdenv.hostPlatform.isDarwin [
135 # error: Path /nix/store/xzjghvsg4fhr2vv6h4scihsdrgk4i76w-python3-3.12.9/lib/libpython3.12.dylib
136 # is not a path referenced from DarwinFile
137 "test_bdist_dmg"
138 "test_bdist_dmg_custom_layout"
139 "test_bdist_mac"
140 "test_plist_items"
141
142 # AssertionError: assert names != []
143 "test_freezer_default_bin_includes"
144 ];
145
146 meta = {
147 description = "Set of scripts and modules for freezing Python scripts into executables";
148 homepage = "https://marcelotduarte.github.io/cx_Freeze";
149 changelog = "https://github.com/marcelotduarte/cx_Freeze/releases/tag/${src.tag}";
150 license = lib.licenses.psfl;
151 maintainers = [ ];
152 mainProgram = "cxfreeze";
153 };
154}