This is a Python version of the existing make_source_archive.sh script. IMO it's easier to read, and it'll also be easier to extend with the necessary functionality for D10598: Fix T86124: Self-hosting external libraries packages.
The number of lines of code is larger than make_source_archive.sh, but it has considerably less invocations of awk ;-) And also the filtering is integrated, instead of forking out to Python to prevent certain files to be included in the tarball.