AIO build errors

On system where everything was working a few months ago, AIO builds started failing with 6.0.1 code. As a sanity check I created a fresh MSYS2 environment on another PC and the same code built, so I started digging into what was different on my older system.

However, when I ran the build for the second time on the new system I discovered that the build failed in the same/similar way on the new system as well, so I suspect some recent changes may be causing an issue. First question for devs is, are you able to run two successful builds in a row in your MSYS2 environment?

The errors I am seeing are:

C:/msys64/mingw64/lib/python3.12/site-packages/setuptools/dist.py:759: SetuptoolsDeprecationWarning: License classifiers are deprecated.
!!

        ********************************************************************************
        Please consider removing the following classifiers in favor of a SPDX license expression:

        License :: OSI Approved :: GNU General Public License v2 (GPLv2)

        See https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license for details.
        ********************************************************************************

!!
  self._finalize_license_expression()
C:/msys64/mingw64/lib/python3.12/site-packages/setuptools/_distutils/cmd.py:90: SetuptoolsDeprecationWarning: setup.py install is deprecated.
!!

        ********************************************************************************
        Please avoid running ``setup.py`` directly.
        Instead, use pypa/build, pypa/installer or other
        standards-based tools.

        See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.
        ********************************************************************************

!!
  self.initialize_options()
sed: -e expression #1, char 47: unknown option to `s'
error: the build_exe directory cannot be cleaned
LicenseData: open failed "..\share\doc\gramps\COPYING"
Usage: LicenseData local_file_that_has_license_text | license_lang_string
Error in macro MUI_PAGEDECLARATION_LICENSE on macroline 17
Error in macro MUI_PAGE_LICENSE on macroline 6
Error in script "grampsaio64.nsi" on line 75 -- aborting creation process

The three errors that may be causing problems are (1) sed, (2) build_exe directory cannot be deleted and (3) the file mingw64/src/grampsaio64.nsi file isn’t valid so the installer isn’t generated.

If I clean the source folder by running git clean -xfd and run the build again, I get slightly different errors towards the end:

warning: no previously-included files matching '*.pyo' found anywhere in distribution
sed: -e expression #1, char 47: unknown option to `s'
Error: invalid script: no sections specified
Error - aborting creation process

The pyo warning is new, sed error is the same, and here the nsi file is empty so makensis fails entirely.

Any help would be appreciated.