nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1--- a/devito/arch/compiler.py
2+++ b/devito/arch/compiler.py
3@@ -145,6 +145,14 @@
4
5
6 class Compiler(GCCToolchain):
7+ # codepy >=2025.1 turned GCCToolchain into a frozen dataclass, which
8+ # forbids attribute assignment. Override the frozen __setattr__ /
9+ # __delattr__ so that Compiler (and its subclasses) can keep setting
10+ # attributes imperatively.
11+ def __setattr__(self, name, value):
12+ object.__setattr__(self, name, value)
13+ def __delattr__(self, name):
14+ object.__delattr__(self, name)
15 """
16 Base class for all compiler classes.
17
18@@ -196,7 +204,11 @@
19 else:
20 self._name = maybe_name
21
22- super().__init__(**kwargs)
23+ # codepy >=2025.1: GCCToolchain is a frozen dataclass whose __init__
24+ # requires all fields as positional args. Skip it entirely and
25+ # initialise the fields that Compiler never sets itself.
26+ self.o_ext = '.o'
27+ self.features = set()
28
29 self.__lookup_cmds__()
30 self._cpp = kwargs.get('cpp', self._default_cpp)
31@@ -355,12 +367,12 @@
32 ) from e
33 debug(f"Make <{' '.join(args)}>")
34
35- def _cmdline(self, files, object=False):
36+ def _cmdline(self, files, *, is_object=False):
37 """
38 Sanitize command line to remove all shell string escape such as
39 mpicc/mpicxx would add, e.g., `-Wl\\,-rpath,/path/to/lib`.
40 """
41- cc_line = super()._cmdline(files, object=object)
42+ cc_line = super()._cmdline(files, is_object=is_object)
43 return [s.replace('\\', '') for s in cc_line]
44
45 def jit_compile(self, soname, code):
46@@ -417,9 +429,11 @@
47 # when running the test suite in parallel)
48 with warnings.catch_warnings():
49 warnings.simplefilter('ignore')
50- _, _, _, recompiled = compile_from_string(self, target, code, src_file,
51- cache_dir=cache_dir, debug=debug,
52- sleep_delay=sleep_delay)
53+ # codepy >=2025.1: source_name is now keyword-only.
54+ _, _, _, recompiled = compile_from_string(
55+ self, target, code, source_name=src_file,
56+ cache_dir=cache_dir, debug=debug,
57+ sleep_delay=sleep_delay)
58
59 return recompiled, src_file
60