# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4

PortSystem          1.0

name                py-bootstrap-modules
version             2025-10-11
maintainers         {jmr @jmroot}
categories          python
license             MIT
supported_archs     noarch
platforms           any

description         bootstrap PEP 517 module builds

long_description    This is a set of Python modules that are needed \
                    to do PEP 517 building and wheel installation. \
                    They have to be installed together to enable \
                    bootstrapping, because of circular dependencies.

homepage            https://www.macports.org/

set flit_core_vers 3.12.0
if {$subport eq $name} {
    # Latest that still support python 3.7
    set build_vers  1.1.1
    set importlib_metadata_vers 6.7.0
    set installer_vers 0.7.0
    set packaging_vers 24.0
    set pyproject_hooks_vers 1.2.0
    set setuptools_scm_vers 7.1.0
    set tomli_vers  2.0.1
    set typing_extensions_vers 4.7.1
    set wheel_vers  0.42.0
    set zipp_vers   3.15.0
}
subport py36-bootstrap-modules {
    set build_vers  0.9.0
    set packaging_vers 21.3
    set pep517_vers 0.13.0
    set pyparsing_vers 3.1.2
    set python-install_vers 0.0.3
    set setuptools_scm_vers 6.4.2
    set tomli_vers  1.2.3
    set wheel_vers  0.37.1
}

master_sites    pypi:b/build:build \
                pypi:f/flit_core:flit_core \
                pypi:i/importlib_metadata:importlib_metadata \
                pypi:i/installer:installer \
                pypi:p/packaging:packaging \
                pypi:p/pep517:pep517 \
                pypi:p/pyparsing:pyparsing \
                pypi:p/pyproject_hooks:pyproject_hooks \
                pypi:p/python-install:install \
                pypi:s/setuptools_scm:setuptools_scm \
                pypi:t/tomli:tomli \
                pypi:t/typing_extensions:typing_extensions \
                pypi:w/wheel:wheel \
                pypi:z/zipp:zipp

distfiles       build-${build_vers}.tar.gz:build \
                flit_core-${flit_core_vers}.tar.gz:flit_core \
                packaging-${packaging_vers}.tar.gz:packaging \
                setuptools_scm-${setuptools_scm_vers}.tar.gz:setuptools_scm \
                tomli-${tomli_vers}.tar.gz:tomli \
                wheel-${wheel_vers}.tar.gz:wheel

if {$subport eq $name} {
    distfiles-append    importlib_metadata-${importlib_metadata_vers}.tar.gz:importlib_metadata \
                        installer-${installer_vers}.tar.gz:installer \
                        pyproject_hooks-${pyproject_hooks_vers}.tar.gz:pyproject_hooks \
                        typing_extensions-${typing_extensions_vers}.tar.gz:typing_extensions \
                        zipp-${zipp_vers}.tar.gz:zipp
} elseif {$subport eq "py36-bootstrap-modules"} {
    distfiles-append    pep517-${pep517_vers}.tar.gz:pep517 \
                        pyparsing-${pyparsing_vers}.tar.gz:pyparsing \
                        python-install-${python-install_vers}.tar.gz:install
}

checksums       flit_core-${flit_core_vers}.tar.gz \
                    md5 c538415c1f27bd69cbbbf3cdd5135d39 \
                    rmd160 26a073eff618f9415815667608a8ffe5c33c9a9a \
                    sha256 18f63100d6f94385c6ed57a72073443e1a71a4acb4339491615d0f16d6ff01b2

if {$subport eq $name} {
    checksums-append    build-${build_vers}.tar.gz \
                            md5 2bdd4d058ac29ab599d36ad09a28f0c1 \
                            rmd160 08f20b65fb7c229b9974a9dd176df8248d48c445 \
                            sha256 8eea65bb45b1aac2e734ba2cc8dad3a6d97d97901a395bd0ed3e7b46953d2a31 \
                        importlib_metadata-${importlib_metadata_vers}.tar.gz \
                            md5 6e172200302e694a03358126fe7554cd \
                            rmd160 8c61967b759c5b5a97acba81fe6973f389b47f73 \
                            sha256 1aaf550d4f73e5d6783e7acb77aec43d49da8017410afae93822cc9cca98c4d4 \
                        installer-${installer_vers}.tar.gz \
                            md5 d961d1105c9270049528b1167ed021bc \
                            rmd160 ce7feaab4cab0fe465e6a5fe142bc32dcdd1e938 \
                            sha256 a26d3e3116289bb08216e0d0f7d925fcef0b0194eedfa0c944bcaaa106c4b631 \
                        packaging-${packaging_vers}.tar.gz \
                            md5 8e3bc7b152efc9ffadabddc9f8465b02 \
                            rmd160 1b7def1a451aa6d6f1b5626a8c9c81b3904c0898 \
                            sha256 eb82c5e3e56209074766e6885bb04b8c38a0c015d0a30036ebe7ece34c9989e9 \
                        pyproject_hooks-${pyproject_hooks_vers}.tar.gz \
                            md5 ed3dd1b984339e83e35f676d7169c192 \
                            rmd160 cb4dceff34998e00fff09b829aa125b659571689 \
                            sha256 1e859bd5c40fae9448642dd871adf459e5e2084186e8d2c2a79a824c970da1f8 \
                        setuptools_scm-${setuptools_scm_vers}.tar.gz \
                            md5 158dc741637fb4fa4b955c62bd2c08be \
                            rmd160 b1eb6c49bb96267da40c145264609934da10df8a \
                            sha256 6c508345a771aad7d56ebff0e70628bf2b0ec7573762be9960214730de278f27 \
                        tomli-${tomli_vers}.tar.gz \
                            md5 d4341621d423a7ca6822e23d6d52bb9a \
                            rmd160 08391b8bdece5ba4b13e0e67e0bb3f0a3de9cc55 \
                            sha256 de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f \
                        typing_extensions-${typing_extensions_vers}.tar.gz \
                            md5 06e7fff4b1d51f8dc6f49b16e71de54e \
                            rmd160 d952e5255e5c9dc0203e6fe82f83591e3837b5c9 \
                            sha256 b75ddc264f0ba5615db7ba217daeb99701ad295353c45f9e95963337ceeeffb2 \
                        wheel-${wheel_vers}.tar.gz \
                            md5 802ad6e5f9336fcb1c76b7593f0cd22d \
                            rmd160 25c120a08158cb9c9d642a6a900e49dab44b0c12 \
                            sha256 c45be39f7882c9d34243236f2d63cbd58039e360f85d0913425fbd7ceea617a8 \
                        zipp-${zipp_vers}.tar.gz \
                            md5 6e06bc2894588451a9787b9f22f9b0ba \
                            rmd160 1b019c27f6f26c21b2aa514c5836c9495402a761 \
                            sha256 112929ad649da941c23de50f356a2b5570c954b65150642bccdd66bf194d224b
} elseif {$subport eq "py36-bootstrap-modules"} {
    checksums-append    build-${build_vers}.tar.gz \
                            md5 f2dc1823b0eff7037e19be18e354b2f1 \
                            rmd160 d431de8027e33f1c21dd35b8852defd590ac5198 \
                            sha256 1a07724e891cbd898923145eb7752ee7653674c511378eb9c7691aab1612bc3c \
                        pep517-${pep517_vers}.tar.gz \
                            md5 7fd08b11215256601a8a4940c1ba3d34 \
                            rmd160 b52f92cb3a3d6d8ae6892f8df4c144eb2c698e49 \
                            sha256 ae69927c5c172be1add9203726d4b84cf3ebad1edcd5f71fcdc746e66e829f59 \
                        packaging-${packaging_vers}.tar.gz \
                            md5 e713c1939f294fd729af4a7be40dd141 \
                            rmd160 45ed4b85bf4ef2069e07dd2922849f7edf98363a \
                            sha256 dd47c42927d89ab911e606518907cc2d3a1f38bbd026385970643f9c5b8ecfeb \
                        pyparsing-${pyparsing_vers}.tar.gz \
                            md5 2bfafdb2d02d19ca4a3dfd02a9dbdfa7 \
                            rmd160 582e08deb5f7ef2a4c94544c33c6fbdb3bfa4230 \
                            sha256 a1bac0ce561155ecc3ed78ca94d3c9378656ad4c94c1270de543f621420f94ad \
                        python-install-${python-install_vers}.tar.gz \
                            md5 c591174ae1f14c05ddcc84483381aa7e \
                            rmd160 203ac0ef46cfcfb6e531548a50cc5a05deb9f049 \
                            sha256 926f9e0cb959203629ba6ffdc889f96e1a075c36ca6e7528ba7be96ade189a7d \
                        setuptools_scm-${setuptools_scm_vers}.tar.gz \
                            md5 b4e02bf8e62ed49142ea7b42a68671d7 \
                            rmd160 6876656de603d15079102abf2f9ed18f2937f7db \
                            sha256 6833ac65c6ed9711a4d5d2266f8024cfa07c533a0e55f4c12f6eff280a5a9e30 \
                        tomli-${tomli_vers}.tar.gz \
                            md5 807cc80e6a2697375f431b757994b7c5 \
                            rmd160 cbdb7cfc45e9183147842cd799b5e4bbb0aef34b \
                            sha256 05b6166bff487dc068d322585c7ea4ef78deed501cc124060e0f238e89a9231f \
                        wheel-${wheel_vers}.tar.gz \
                            md5 f490f1399e5903706cb1d4fbed9ecb28 \
                            rmd160 6c4df8aa7c6d59f8b97cf85cce9e362c81b0c523 \
                            sha256 e9a504e793efbca1b8e0e9cb979a249cf4a0a7b5b8c9e8b65a5e39d49529c1c4
}

patch {
    system -W ${workpath}/flit_core-${flit_core_vers} "patch -p0 < ${filespath}/zip-timestamps.patch"
    if {$subport eq "py36-bootstrap-modules"} {
        system -W ${workpath}/python-install-${python-install_vers} "patch -p0 < ${filespath}/patch-install-__init__.py.diff"
        system -W ${workpath}/python-install-${python-install_vers} "patch -p0 < ${filespath}/installer_scripts.py.patch"
    }
}

use_configure   no
build {}
destroot {
    set instdir ${prefix}/share/${subport}
    xinstall -d ${destroot}${instdir}
    copy ${workpath}/build-${build_vers}/src/build \
        ${workpath}/flit_core-${flit_core_vers}/flit_core \
        ${workpath}/setuptools_scm-${setuptools_scm_vers}/src/setuptools_scm \
        ${workpath}/wheel-${wheel_vers}/src/wheel \
        ${destroot}${instdir}
    if {$subport eq $name} {
        copy ${workpath}/importlib_metadata-${importlib_metadata_vers}/importlib_metadata \
            ${workpath}/installer-${installer_vers}/src/installer \
            ${workpath}/packaging-${packaging_vers}/src/packaging \
            ${workpath}/pyproject_hooks-${pyproject_hooks_vers}/src/pyproject_hooks \
            ${workpath}/tomli-${tomli_vers}/src/tomli \
            ${workpath}/typing_extensions-${typing_extensions_vers}/src/typing_extensions.py \
            ${workpath}/zipp-${zipp_vers}/zipp \
            ${destroot}${instdir}
        foreach pkg {build flit_core importlib_metadata installer packaging pyproject_hooks setuptools_scm tomli typing_extensions wheel zipp} {
            set pkgvers [set ${pkg}_vers]
            xinstall -d ${destroot}${instdir}/${pkg}-${pkgvers}.dist-info
            xinstall -m 644 ${workpath}/${pkg}-${pkgvers}/PKG-INFO \
                ${destroot}${instdir}/${pkg}-${pkgvers}.dist-info/METADATA
        }
    } elseif {$subport eq "py36-bootstrap-modules"} {
        copy ${workpath}/build-${build_vers}/src/build.egg-info \
            ${workpath}/packaging-${packaging_vers}/packaging \
            ${workpath}/packaging-${packaging_vers}/packaging.egg-info \
            ${workpath}/pep517-${pep517_vers}/pep517 \
            ${workpath}/pyparsing-${pyparsing_vers}/pyparsing \
            ${workpath}/python-install-${python-install_vers}/install \
            ${workpath}/python-install-${python-install_vers}/python_install.egg-info \
            ${workpath}/setuptools_scm-${setuptools_scm_vers}/src/setuptools_scm.egg-info \
            ${workpath}/tomli-${tomli_vers}/tomli \
            ${workpath}/wheel-${wheel_vers}/src/wheel.egg-info \
            ${destroot}${instdir}
        foreach pkg {flit_core pep517 pyparsing tomli} {
            xinstall -d ${destroot}${instdir}/${pkg}.egg-info
            xinstall -m 644 ${workpath}/${pkg}-[set ${pkg}_vers]/PKG-INFO ${destroot}${instdir}/${pkg}.egg-info/PKG-INFO
        }
    }
}

livecheck.type      none
