msys2: modernize python install script

This commit is contained in:
Sebastien Bourdeauducq 2024-08-02 10:30:03 +08:00
parent 9e85187ead
commit 50abd84278
4 changed files with 35 additions and 14 deletions

View File

@ -10,23 +10,19 @@ build() {
export PYTHONPATH=`pwd`/clang64/lib/python3.11/site-packages
chmod +w -R source
cd source
wine-msys2-build python setup.py install --single-version-externally-managed --prefix=../clang64 --record=setuptools-sucks.txt
cd ..
wine-msys2-build python -m build --wheel --skip-dependency-check --no-isolation
}
# setuptools creates this file if it doesn't already exist, which causes conflicts between pacman packages
# see: https://corte.si/posts/code/setuptoolssucks/
rm -f clang64/lib/python3.11/site-packages/easy-install.pth
package() {
cd source
wine-msys2-build python -m installer --destdir="${pkgdir}" dist/*.whl
# patch broken shebangs (Z:/nix/store/...)
for entrypoint in clang64/bin/*-script.py; do
for entrypoint in ${pkgdir}/bin/*-script.py; do
[ -f "$entrypoint" ] || continue
sed -i "1s|#!.*|#!python|" $entrypoint
done
for entrypoint in clang64/bin/*-script.pyw; do
for entrypoint in ${pkgdir}/bin/*-script.pyw; do
[ -f "$entrypoint" ] || continue
sed -i "1s|#!.*|#!pythonw|" $entrypoint
done
}
package() {
cp -R clang64 ${pkgdir}
}

View File

@ -595,9 +595,9 @@
})
(pkgs.fetchurl {
url = "https://mirror.msys2.org/mingw/clang64/mingw-w64-clang-x86_64-python-regex-2024.5.15-1-any.pkg.tar.zst";
url = "https://mirror.msys2.org/mingw/clang64/mingw-w64-clang-x86_64-python-regex-2024.7.24-1-any.pkg.tar.zst";
name = "mingw-w64-clang-x86_64-python-regex";
sha256 = "0abds3p4cbax0qx0vw71ajyjacv5j7hm42qikrij9hj19axzr8an";
sha256 = "12651vpnlimnb2srf5fd7jq0yqr4iyw5gwpwxjrjqp7dmzyhqxwq";
})
(pkgs.fetchurl {

View File

@ -14,7 +14,8 @@ fakeroot pacman --root $MSYS2DIR --config $MSYS2DIR/etc/pacman.conf -Syy
pacman --root $MSYS2DIR --config $MSYS2DIR/etc/pacman.conf \
--cachedir $MSYS2DIR/msys/cache --sync --print-format "%l %n" \
mingw-w64-clang-x86_64-cc mingw-w64-clang-x86_64-python3.11 \
mingw-w64-clang-x86_64-python-numpy mingw-w64-clang-x86_64-python-setuptools > $MSYS2DIR/packages.txt
mingw-w64-clang-x86_64-python-numpy \
mingw-w64-clang-x86_64-python-setuptools mingw-w64-clang-x86_64-python-build mingw-w64-clang-x86_64-python-installer > $MSYS2DIR/packages.txt
cat artiq_dependencies.txt comtools_dependencies.txt pythonparser_dependencies.txt sipyco_dependencies.txt | pacman --root $MSYS2DIR --config $MSYS2DIR/etc/pacman.conf \
--cachedir $MSYS2DIR/msys/cache --sync --print-format "%l %n" - > $MSYS2DIR/artiq_dependency_packages.txt

View File

@ -221,4 +221,28 @@
name = "mingw-w64-clang-x86_64-python-setuptools";
sha256 = "1d2l3bnbmhl0a2an9fpwa83hbsm7szfxjr9vg8df45cnwgpxrxjb";
})
(pkgs.fetchurl {
url = "https://mirror.msys2.org/mingw/clang64/mingw-w64-clang-x86_64-python-packaging-24.1-1-any.pkg.tar.zst";
name = "mingw-w64-clang-x86_64-python-packaging";
sha256 = "103gjfj7lqy3bgmvl12v7y6szwqk02hs3ribiqxavzk8hswsky6a";
})
(pkgs.fetchurl {
url = "https://mirror.msys2.org/mingw/clang64/mingw-w64-clang-x86_64-python-pyproject-hooks-1.1.0-1-any.pkg.tar.zst";
name = "mingw-w64-clang-x86_64-python-pyproject-hooks";
sha256 = "0ksb7pmwh0d1s5ic9srgx2cq01szsg49qm82bw04v2d0820s7df8";
})
(pkgs.fetchurl {
url = "https://mirror.msys2.org/mingw/clang64/mingw-w64-clang-x86_64-python-build-1.2.1-2-any.pkg.tar.zst";
name = "mingw-w64-clang-x86_64-python-build";
sha256 = "1lkwj5hksz68gqcwhxswr5zr748479vrq7j6ini90lpbilhw59vs";
})
(pkgs.fetchurl {
url = "https://mirror.msys2.org/mingw/clang64/mingw-w64-clang-x86_64-python-installer-0.7.0-3-any.pkg.tar.zst";
name = "mingw-w64-clang-x86_64-python-installer";
sha256 = "1xcaxnrzzla909ip7bijsbl0m7ck8bw4sxn2kvl7bhs0ja84sj3q";
})
]