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