Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .mailmap
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@ Derek Frogget <fro22003@byui.edu> <114030121+derekfrogget@users.noreply.github.c
Nikhil Ghosh <nghosh606@gmail.com>
David Wever <dmwever@crimson.ua.edu> <56411717+dmwever@users.noreply.github.com>
Ngô Xuân Minh <xminh.ngo.00@gmail.com>
Nicolas Sanchez <nicolasjpsanchez@gmail.com> <98576999+nicolassanchez02@users.noreply.github.com>
Manas Pradhan <manasmpradhan5@gmail.com> <64654573+manas-maker@users.noreply.github.com>
Jason Lu <lu.gt@163.com> <5738189+lugt@users.noreply.github.com>
4 changes: 2 additions & 2 deletions buildsystem/compilepy.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2015-2022 the openage authors. See copying.md for legal info.
# Copyright 2015-2026 the openage authors. See copying.md for legal info.

"""
Compiles python modules with cpython to pyc/pyo files.
Expand Down Expand Up @@ -96,7 +96,7 @@ def main():
maxwidth = len(str(len(to_compile)))
for idx, (module, outputfile) in enumerate(to_compile):
try:
print(f"[{idx+1:{maxwidth}}/{len(to_compile)}] "
print(f"[{idx + 1}:{maxwidth}/{len(to_compile)}] "
f"Compiling {module} to {outputfile}")
py_compile.compile(module, cfile=outputfile, doraise=True)

Expand Down
11 changes: 10 additions & 1 deletion buildsystem/cythonize.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
#
# Copyright 2015-2025 the openage authors. See copying.md for legal info.
# Copyright 2015-2026 the openage authors. See copying.md for legal info.

"""
Runs Cython on all modules that were listed via add_cython_module.
Expand All @@ -13,6 +13,15 @@
from multiprocessing import cpu_count
from pathlib import Path

# setuptools 60+ ships a distutils shim that re-exports the legacy distutils
# APIs (Extension, etc.). Importing setuptools before Cython registers the
# shim in sys.modules, which is what Cython 3.x's Build.Dependencies needs
# on the first cythonize() call. Without this, the import in Cython's
# 'from distutils.extension import Extension' fails on Python 3.12+ because
# distutils was removed from the stdlib. This is the official recommended
# workaround; see https://github.com/cython/cython/issues/4610
import setuptools # noqa: F401 # pylint: disable=unused-import

from Cython.Build import cythonize


Expand Down
1 change: 1 addition & 0 deletions copying.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ _the openage authors_ are:
| | bytegrrrl | bytegrrrl à proton dawt me |
| Nicolas Sanchez | nicolassanchez02 | nicolasjpsanchez à gmail dawt com |
| Manas Pradhan | manas-maker | manasmpradhan5 à gmail dawt com |
| Jason Lu | jasonlu, lugt | lu.gt à 163 dawt com |

If you're a first-time committer, add yourself to the above list. This is not
just for legal reasons, but also to keep an overview of all those nicknames.
Expand Down
10 changes: 5 additions & 5 deletions etc/gdb_pretty/printers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024-2025 the openage authors. See copying.md for legal info.
# Copyright 2024-2026 the openage authors. See copying.md for legal info.

"""
Pretty printers for GDB.
Expand Down Expand Up @@ -59,8 +59,8 @@ def __call__(self, val: gdb.Value):
return None


pp = PrinterControl('openage')
gdb.printing.register_pretty_printer(None, pp)
OPENAGE_PRINTER = PrinterControl('openage')
gdb.printing.register_pretty_printer(None, OPENAGE_PRINTER)


def printer_typedef(type_name: str):
Expand All @@ -74,7 +74,7 @@ def _register_printer(printer):
"""
Registers the printer with GDB.
"""
pp.add_printer(type_name, printer)
OPENAGE_PRINTER.add_printer(type_name, printer)

return _register_printer

Expand All @@ -90,7 +90,7 @@ def _register_printer(printer):
"""
Registers the printer with GDB.
"""
pp.add_printer_regex(regex, printer)
OPENAGE_PRINTER.add_printer_regex(regex, printer)

return _register_printer

Expand Down
10 changes: 8 additions & 2 deletions etc/pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,14 @@ int-import-graph=

[DESIGN]

# Maximum number of arguments for function / method
max-args=5
# Maximum number of positional arguments for function / method.
# openage's convert subprocessor functions routinely need 6-11 positional
# args (converter_group, line, container_obj_ref, command_id, ranged,
# diff, ...). The codebase already opts out of the sister R0913
# (too-many-arguments) per-function; raising the R0917
# (too-many-positional-arguments) threshold to 12 lets those functions
# through without a refactor that would have no real side benefit.
max-positional-arguments=12

# Argument names that match this expression will be ignored. Default to name
# with leading underscore
Expand Down
7 changes: 7 additions & 0 deletions kevinfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ sanity_check:
configure:
- env: mode=debug compiler=gcc (? if job == "debian" ?)
- env: mode=debug compiler=clang (? if job == "debian-clang" ?)
# Debian trixie's cython3 (3.0.x) and bare Python 3.13 are both
# incompatible with how Cython 3.x reaches into distutils (removed
# from the stdlib in 3.12). Pull a newer Cython (3.1+) and a
# current setuptools (provides the distutils shim Cython 3.x
# needs) via pip before configure. FindCython then picks the
# working Cython and the cythonize step has its shim. Idempotent.
python3 -m pip install --break-system-packages "cython>=3.1.0,<4.0.0" "setuptools>=68"
./configure --mode=${mode} --compiler=${compiler} --ccache --download-nyan
# TODO: once all warnings are gone again, set --flags="-Werror"

Expand Down
4 changes: 3 additions & 1 deletion openage/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,8 @@ def main(argv=None):
multiprocessing.freeze_support()

# openage is complicated and multithreaded; better not use fork.
multiprocessing.set_start_method('spawn')
# force=True: Python >= 3.13 raises if the start method was already
# implicitly fixed (e.g. by freeze_support() calling get_start_method()).
multiprocessing.set_start_method('spawn', force=True)

sys.exit(main())
5 changes: 2 additions & 3 deletions openage/codegen/codegen.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2014-2022 the openage authors. See copying.md for legal info.
# Copyright 2014-2026 the openage authors. See copying.md for legal info.

"""
Utility and driver module for C++ code generation.
Expand Down Expand Up @@ -86,8 +86,7 @@ def get_reads(self) -> None:
Returns an iterable of all path component tuples for files that have
been read.
"""
for parts in self.reads:
yield parts
yield from self.reads

self.reads.clear()

Expand Down
8 changes: 3 additions & 5 deletions openage/codegen/cpp_testlist.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2015-2022 the openage authors. See copying.md for legal info.
# Copyright 2015-2026 the openage authors. See copying.md for legal info.

"""
Generates code for C++ testing, mostly the table to look up symbols from test
Expand Down Expand Up @@ -44,17 +44,15 @@ def gen_prototypes(self):

for namespacename, namespace in sorted(self.namespaces.items()):
yield f"namespace {namespacename} {{\n"
for line in namespace.gen_prototypes():
yield line
yield from namespace.gen_prototypes()
yield f"}} // {namespacename}\n\n"

def get_functionnames(self):
"""
Yields all function names in this namespace,
as well as all subnamespaces.
"""
for name in self.functions:
yield name
yield from self.functions

for namespacename, namespace in sorted(self.namespaces.items()):
for name in namespace.get_functionnames():
Expand Down
Loading