From 50abd842785697f8abf9b1e811c09ca43f956d7f Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Fri, 2 Aug 2024 10:30:03 +0800 Subject: [PATCH] msys2: modernize python install script --- msys2/PKGBUILD.common | 18 +++++++----------- msys2/artiq_dependency_packages.nix | 4 ++-- msys2/make_msys2_packages.sh | 3 ++- msys2/msys2_packages.nix | 24 ++++++++++++++++++++++++ 4 files changed, 35 insertions(+), 14 deletions(-) diff --git a/msys2/PKGBUILD.common b/msys2/PKGBUILD.common index 9768adb..cb4cb14 100644 --- a/msys2/PKGBUILD.common +++ b/msys2/PKGBUILD.common @@ -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} -} diff --git a/msys2/artiq_dependency_packages.nix b/msys2/artiq_dependency_packages.nix index 3c39c62..f211c75 100644 --- a/msys2/artiq_dependency_packages.nix +++ b/msys2/artiq_dependency_packages.nix @@ -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 { diff --git a/msys2/make_msys2_packages.sh b/msys2/make_msys2_packages.sh index d7d4c36..ccf61c0 100755 --- a/msys2/make_msys2_packages.sh +++ b/msys2/make_msys2_packages.sh @@ -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 diff --git a/msys2/msys2_packages.nix b/msys2/msys2_packages.nix index 18f147a..7107b21 100644 --- a/msys2/msys2_packages.nix +++ b/msys2/msys2_packages.nix @@ -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"; + }) ]