[3.0] extras: tools: add python 3.13 support to Ninja
Backport a patch from Ninja 1.12 that adds python 3.13 support. This is necessary because current version of Ninja does not work with python 3.13 as pipes module is deprecated.
(cherry picked from commit b8dff064)