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