0s autopkgtest [17:51:55]: starting date and time: 2024-11-09 17:51:55+0000 0s autopkgtest [17:51:55]: git checkout: 0acbae0a WIP show VirtSubproc stderr in real-time 0s autopkgtest [17:51:55]: host juju-7f2275-prod-proposed-migration-environment-2; command line: /home/ubuntu/autopkgtest/runner/autopkgtest --output-dir /tmp/autopkgtest-work.qfj1wtua/out --timeout-copy=6000 --setup-commands /home/ubuntu/autopkgtest-cloud/worker-config-production/setup-canonical.sh --apt-pocket=proposed=src:setuptools --apt-upgrade scikit-build --timeout-short=300 --timeout-copy=20000 --timeout-build=20000 --env=ADT_TEST_TRIGGERS=setuptools/75.2.0-1 -- ssh -s /home/ubuntu/autopkgtest/ssh-setup/nova -- --flavor autopkgtest-ppc64el --security-groups autopkgtest-juju-7f2275-prod-proposed-migration-environment-2@bos03-ppc64el-12.secgroup --name adt-plucky-ppc64el-scikit-build-20241109-175155-juju-7f2275-prod-proposed-migration-environment-2-69480016-7bc3-4349-b90d-d5cf528e742c --image adt/ubuntu-plucky-ppc64el-server --keyname testbed-juju-7f2275-prod-proposed-migration-environment-2 --net-id=net_prod-proposed-migration-ppc64el -e TERM=linux -e ''"'"'http_proxy=http://squid.internal:3128'"'"'' -e ''"'"'https_proxy=http://squid.internal:3128'"'"'' -e ''"'"'no_proxy=127.0.0.1,127.0.1.1,login.ubuntu.com,localhost,localdomain,novalocal,internal,archive.ubuntu.com,ports.ubuntu.com,security.ubuntu.com,ddebs.ubuntu.com,changelogs.ubuntu.com,keyserver.ubuntu.com,launchpadlibrarian.net,launchpadcontent.net,launchpad.net,10.24.0.0/24,keystone.ps5.canonical.com,objectstorage.prodstack5.canonical.com'"'"'' --mirror=http://ftpmaster.internal/ubuntu/ 118s autopkgtest [17:53:53]: testbed dpkg architecture: ppc64el 118s autopkgtest [17:53:53]: testbed apt version: 2.9.8 118s autopkgtest [17:53:53]: @@@@@@@@@@@@@@@@@@@@ test bed setup 119s Get:1 http://ftpmaster.internal/ubuntu plucky-proposed InRelease [73.9 kB] 119s Get:2 http://ftpmaster.internal/ubuntu plucky-proposed/restricted Sources [7016 B] 119s Get:3 http://ftpmaster.internal/ubuntu plucky-proposed/main Sources [102 kB] 119s Get:4 http://ftpmaster.internal/ubuntu plucky-proposed/universe Sources [977 kB] 119s Get:5 http://ftpmaster.internal/ubuntu plucky-proposed/multiverse Sources [15.3 kB] 119s Get:6 http://ftpmaster.internal/ubuntu plucky-proposed/main ppc64el Packages [124 kB] 119s Get:7 http://ftpmaster.internal/ubuntu plucky-proposed/universe ppc64el Packages [693 kB] 119s Get:8 http://ftpmaster.internal/ubuntu plucky-proposed/multiverse ppc64el Packages [19.6 kB] 120s Fetched 2012 kB in 1s (2008 kB/s) 120s Reading package lists... 122s Reading package lists... 122s Building dependency tree... 122s Reading state information... 123s Calculating upgrade... 123s The following NEW packages will be installed: 123s python3-jaraco.text systemd-cryptsetup 123s The following packages will be upgraded: 123s base-passwd bash-completion libattr1 libblockdev-crypto3 libblockdev-fs3 123s libblockdev-loop3 libblockdev-mdraid3 libblockdev-nvme3 libblockdev-part3 123s libblockdev-swap3 libblockdev-utils3 libblockdev3 libbpf1 libbsd0 123s libbytesize-common libbytesize1 libdrm-common libdrm2 libjson-glib-1.0-0 123s libjson-glib-1.0-common libmaxminddb0 libmnl0 libnghttp2-14 libnspr4 123s libnss-systemd libpam-systemd libpython3.12-minimal libpython3.12-stdlib 123s libpython3.12t64 libsystemd-shared libsystemd0 libudev1 libudisks2-0 123s liburcu8t64 libuv1t64 libx11-6 libx11-data linux-firmware openssh-client 123s openssh-server openssh-sftp-server pci.ids python3-gi python3-idna 123s python3-jsonpatch python3-lazr.restfulclient python3-pkg-resources 123s python3-setuptools python3-urllib3 python3-wadllib python3.12 123s python3.12-gdbm python3.12-minimal systemd systemd-resolved systemd-sysv 123s systemd-timesyncd tzdata udev udisks2 usbutils 123s 61 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. 123s Need to get 561 MB of archives. 123s After this operation, 27.2 MB of additional disk space will be used. 123s Get:1 http://ftpmaster.internal/ubuntu plucky/main ppc64el base-passwd ppc64el 3.6.5 [55.1 kB] 123s Get:2 http://ftpmaster.internal/ubuntu plucky/main ppc64el libpython3.12t64 ppc64el 3.12.7-2 [2565 kB] 123s Get:3 http://ftpmaster.internal/ubuntu plucky/main ppc64el python3.12 ppc64el 3.12.7-2 [661 kB] 123s Get:4 http://ftpmaster.internal/ubuntu plucky/main ppc64el libpython3.12-stdlib ppc64el 3.12.7-2 [2121 kB] 124s Get:5 http://ftpmaster.internal/ubuntu plucky/main ppc64el python3.12-minimal ppc64el 3.12.7-2 [2467 kB] 124s Get:6 http://ftpmaster.internal/ubuntu plucky/main ppc64el libpython3.12-minimal ppc64el 3.12.7-2 [839 kB] 124s Get:7 http://ftpmaster.internal/ubuntu plucky/main ppc64el tzdata all 2024b-1ubuntu2 [274 kB] 124s Get:8 http://ftpmaster.internal/ubuntu plucky/main ppc64el libnss-systemd ppc64el 256.5-2ubuntu4 [215 kB] 124s Get:9 http://ftpmaster.internal/ubuntu plucky/main ppc64el systemd-timesyncd ppc64el 256.5-2ubuntu4 [42.5 kB] 124s Get:10 http://ftpmaster.internal/ubuntu plucky/main ppc64el systemd-resolved ppc64el 256.5-2ubuntu4 [368 kB] 124s Get:11 http://ftpmaster.internal/ubuntu plucky/main ppc64el libsystemd-shared ppc64el 256.5-2ubuntu4 [2503 kB] 124s Get:12 http://ftpmaster.internal/ubuntu plucky/main ppc64el libsystemd0 ppc64el 256.5-2ubuntu4 [565 kB] 124s Get:13 http://ftpmaster.internal/ubuntu plucky/main ppc64el systemd-sysv ppc64el 256.5-2ubuntu4 [11.9 kB] 124s Get:14 http://ftpmaster.internal/ubuntu plucky/main ppc64el libpam-systemd ppc64el 256.5-2ubuntu4 [326 kB] 124s Get:15 http://ftpmaster.internal/ubuntu plucky/main ppc64el systemd ppc64el 256.5-2ubuntu4 [3746 kB] 124s Get:16 http://ftpmaster.internal/ubuntu plucky/main ppc64el udev ppc64el 256.5-2ubuntu4 [2141 kB] 124s Get:17 http://ftpmaster.internal/ubuntu plucky/main ppc64el libudev1 ppc64el 256.5-2ubuntu4 [224 kB] 124s Get:18 http://ftpmaster.internal/ubuntu plucky/main ppc64el openssh-sftp-server ppc64el 1:9.7p1-7ubuntu5 [43.3 kB] 124s Get:19 http://ftpmaster.internal/ubuntu plucky/main ppc64el openssh-server ppc64el 1:9.7p1-7ubuntu5 [629 kB] 124s Get:20 http://ftpmaster.internal/ubuntu plucky/main ppc64el openssh-client ppc64el 1:9.7p1-7ubuntu5 [1105 kB] 124s Get:21 http://ftpmaster.internal/ubuntu plucky/main ppc64el libattr1 ppc64el 1:2.5.2-2 [12.8 kB] 124s Get:22 http://ftpmaster.internal/ubuntu plucky/main ppc64el libbsd0 ppc64el 0.12.2-2 [57.4 kB] 124s Get:23 http://ftpmaster.internal/ubuntu plucky/main ppc64el libbpf1 ppc64el 1:1.4.6-1 [217 kB] 124s Get:24 http://ftpmaster.internal/ubuntu plucky/main ppc64el libmnl0 ppc64el 1.0.5-3 [13.4 kB] 124s Get:25 http://ftpmaster.internal/ubuntu plucky/main ppc64el python3-gi ppc64el 3.50.0-3 [267 kB] 124s Get:26 http://ftpmaster.internal/ubuntu plucky/main ppc64el bash-completion all 1:2.14.0-2 [210 kB] 124s Get:27 http://ftpmaster.internal/ubuntu plucky/main ppc64el libdrm-common all 2.4.123-1 [8436 B] 124s Get:28 http://ftpmaster.internal/ubuntu plucky/main ppc64el libdrm2 ppc64el 2.4.123-1 [49.6 kB] 124s Get:29 http://ftpmaster.internal/ubuntu plucky/main ppc64el libmaxminddb0 ppc64el 1.11.0-1 [21.6 kB] 124s Get:30 http://ftpmaster.internal/ubuntu plucky/main ppc64el libnghttp2-14 ppc64el 1.64.0-1 [89.7 kB] 124s Get:31 http://ftpmaster.internal/ubuntu plucky/main ppc64el liburcu8t64 ppc64el 0.14.1-1 [72.8 kB] 124s Get:32 http://ftpmaster.internal/ubuntu plucky/main ppc64el libuv1t64 ppc64el 1.48.0-7 [115 kB] 124s Get:33 http://ftpmaster.internal/ubuntu plucky/main ppc64el libx11-data all 2:1.8.10-2 [116 kB] 124s Get:34 http://ftpmaster.internal/ubuntu plucky/main ppc64el libx11-6 ppc64el 2:1.8.10-2 [738 kB] 124s Get:35 http://ftpmaster.internal/ubuntu plucky/main ppc64el pci.ids all 0.0~2024.10.24-1 [279 kB] 124s Get:36 http://ftpmaster.internal/ubuntu plucky/main ppc64el python3.12-gdbm ppc64el 3.12.7-2 [30.6 kB] 124s Get:37 http://ftpmaster.internal/ubuntu plucky/main ppc64el usbutils ppc64el 1:018-1 [89.8 kB] 124s Get:38 http://ftpmaster.internal/ubuntu plucky/main ppc64el libblockdev-utils3 ppc64el 3.2.1-1 [20.6 kB] 124s Get:39 http://ftpmaster.internal/ubuntu plucky/main ppc64el libblockdev-crypto3 ppc64el 3.2.1-1 [24.8 kB] 124s Get:40 http://ftpmaster.internal/ubuntu plucky/main ppc64el libblockdev-fs3 ppc64el 3.2.1-1 [40.6 kB] 124s Get:41 http://ftpmaster.internal/ubuntu plucky/main ppc64el libblockdev-loop3 ppc64el 3.2.1-1 [7704 B] 124s Get:42 http://ftpmaster.internal/ubuntu plucky/main ppc64el libbytesize1 ppc64el 2.11-1ubuntu1 [14.8 kB] 124s Get:43 http://ftpmaster.internal/ubuntu plucky/main ppc64el libbytesize-common all 2.11-1ubuntu1 [3584 B] 124s Get:44 http://ftpmaster.internal/ubuntu plucky/main ppc64el libblockdev-mdraid3 ppc64el 3.2.1-1 [14.2 kB] 124s Get:45 http://ftpmaster.internal/ubuntu plucky/main ppc64el libblockdev-nvme3 ppc64el 3.2.1-1 [20.2 kB] 124s Get:46 http://ftpmaster.internal/ubuntu plucky/main ppc64el libblockdev-part3 ppc64el 3.2.1-1 [17.5 kB] 124s Get:47 http://ftpmaster.internal/ubuntu plucky/main ppc64el libblockdev-swap3 ppc64el 3.2.1-1 [8538 B] 124s Get:48 http://ftpmaster.internal/ubuntu plucky/main ppc64el libblockdev3 ppc64el 3.2.1-1 [54.1 kB] 124s Get:49 http://ftpmaster.internal/ubuntu plucky/main ppc64el libjson-glib-1.0-common all 1.10.0+ds-2 [5502 B] 124s Get:50 http://ftpmaster.internal/ubuntu plucky/main ppc64el libjson-glib-1.0-0 ppc64el 1.10.0+ds-2 [75.9 kB] 124s Get:51 http://ftpmaster.internal/ubuntu plucky/main ppc64el libnspr4 ppc64el 2:4.35-1.1ubuntu2 [134 kB] 124s Get:52 http://ftpmaster.internal/ubuntu plucky/main ppc64el udisks2 ppc64el 2.10.1-11ubuntu1 [344 kB] 124s Get:53 http://ftpmaster.internal/ubuntu plucky/main ppc64el libudisks2-0 ppc64el 2.10.1-11ubuntu1 [180 kB] 124s Get:54 http://ftpmaster.internal/ubuntu plucky/main ppc64el linux-firmware ppc64el 20241108.git3bbb13a7-0ubuntu1 [536 MB] 143s Get:55 http://ftpmaster.internal/ubuntu plucky/main ppc64el python3-idna all 3.8-2 [47.0 kB] 143s Get:56 http://ftpmaster.internal/ubuntu plucky/main ppc64el python3-jaraco.text all 4.0.0-1 [11.5 kB] 143s Get:57 http://ftpmaster.internal/ubuntu plucky/main ppc64el python3-jsonpatch all 1.32-4 [12.2 kB] 143s Get:58 http://ftpmaster.internal/ubuntu plucky/main ppc64el python3-wadllib all 2.0.0-1 [36.7 kB] 143s Get:59 http://ftpmaster.internal/ubuntu plucky-proposed/main ppc64el python3-pkg-resources all 75.2.0-1 [134 kB] 143s Get:60 http://ftpmaster.internal/ubuntu plucky-proposed/main ppc64el python3-setuptools all 75.2.0-1 [657 kB] 143s Get:61 http://ftpmaster.internal/ubuntu plucky/main ppc64el python3-lazr.restfulclient all 0.14.6-2 [50.9 kB] 143s Get:62 http://ftpmaster.internal/ubuntu plucky/main ppc64el python3-urllib3 all 2.0.7-2ubuntu0.1 [93.1 kB] 143s Get:63 http://ftpmaster.internal/ubuntu plucky/main ppc64el systemd-cryptsetup ppc64el 256.5-2ubuntu4 [127 kB] 143s Preconfiguring packages ... 144s Fetched 561 MB in 20s (27.9 MB/s) 144s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 73539 files and directories currently installed.) 144s Preparing to unpack .../base-passwd_3.6.5_ppc64el.deb ... 144s Unpacking base-passwd (3.6.5) over (3.6.4) ... 144s Setting up base-passwd (3.6.5) ... 144s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 73540 files and directories currently installed.) 144s Preparing to unpack .../00-libpython3.12t64_3.12.7-2_ppc64el.deb ... 144s Unpacking libpython3.12t64:ppc64el (3.12.7-2) over (3.12.7-1) ... 144s Preparing to unpack .../01-python3.12_3.12.7-2_ppc64el.deb ... 145s Unpacking python3.12 (3.12.7-2) over (3.12.7-1) ... 145s Preparing to unpack .../02-libpython3.12-stdlib_3.12.7-2_ppc64el.deb ... 145s Unpacking libpython3.12-stdlib:ppc64el (3.12.7-2) over (3.12.7-1) ... 145s Preparing to unpack .../03-python3.12-minimal_3.12.7-2_ppc64el.deb ... 145s Unpacking python3.12-minimal (3.12.7-2) over (3.12.7-1) ... 145s Preparing to unpack .../04-libpython3.12-minimal_3.12.7-2_ppc64el.deb ... 145s Unpacking libpython3.12-minimal:ppc64el (3.12.7-2) over (3.12.7-1) ... 145s Preparing to unpack .../05-tzdata_2024b-1ubuntu2_all.deb ... 145s Unpacking tzdata (2024b-1ubuntu2) over (2024a-4ubuntu1) ... 145s Preparing to unpack .../06-libnss-systemd_256.5-2ubuntu4_ppc64el.deb ... 145s Unpacking libnss-systemd:ppc64el (256.5-2ubuntu4) over (256.5-2ubuntu3) ... 145s Preparing to unpack .../07-systemd-timesyncd_256.5-2ubuntu4_ppc64el.deb ... 145s Unpacking systemd-timesyncd (256.5-2ubuntu4) over (256.5-2ubuntu3) ... 145s Preparing to unpack .../08-systemd-resolved_256.5-2ubuntu4_ppc64el.deb ... 145s Unpacking systemd-resolved (256.5-2ubuntu4) over (256.5-2ubuntu3) ... 145s Preparing to unpack .../09-libsystemd-shared_256.5-2ubuntu4_ppc64el.deb ... 145s Unpacking libsystemd-shared:ppc64el (256.5-2ubuntu4) over (256.5-2ubuntu3) ... 146s Preparing to unpack .../10-libsystemd0_256.5-2ubuntu4_ppc64el.deb ... 146s Unpacking libsystemd0:ppc64el (256.5-2ubuntu4) over (256.5-2ubuntu3) ... 146s Setting up libsystemd0:ppc64el (256.5-2ubuntu4) ... 146s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 73539 files and directories currently installed.) 146s Preparing to unpack .../systemd-sysv_256.5-2ubuntu4_ppc64el.deb ... 146s Unpacking systemd-sysv (256.5-2ubuntu4) over (256.5-2ubuntu3) ... 146s Preparing to unpack .../libpam-systemd_256.5-2ubuntu4_ppc64el.deb ... 146s Unpacking libpam-systemd:ppc64el (256.5-2ubuntu4) over (256.5-2ubuntu3) ... 146s Preparing to unpack .../systemd_256.5-2ubuntu4_ppc64el.deb ... 146s Unpacking systemd (256.5-2ubuntu4) over (256.5-2ubuntu3) ... 146s Preparing to unpack .../udev_256.5-2ubuntu4_ppc64el.deb ... 146s Unpacking udev (256.5-2ubuntu4) over (256.5-2ubuntu3) ... 146s Preparing to unpack .../libudev1_256.5-2ubuntu4_ppc64el.deb ... 146s Unpacking libudev1:ppc64el (256.5-2ubuntu4) over (256.5-2ubuntu3) ... 146s Setting up libudev1:ppc64el (256.5-2ubuntu4) ... 147s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 73539 files and directories currently installed.) 147s Preparing to unpack .../openssh-sftp-server_1%3a9.7p1-7ubuntu5_ppc64el.deb ... 147s Unpacking openssh-sftp-server (1:9.7p1-7ubuntu5) over (1:9.7p1-7ubuntu4) ... 147s Preparing to unpack .../openssh-server_1%3a9.7p1-7ubuntu5_ppc64el.deb ... 147s Unpacking openssh-server (1:9.7p1-7ubuntu5) over (1:9.7p1-7ubuntu4) ... 147s Preparing to unpack .../openssh-client_1%3a9.7p1-7ubuntu5_ppc64el.deb ... 147s Unpacking openssh-client (1:9.7p1-7ubuntu5) over (1:9.7p1-7ubuntu4) ... 147s Preparing to unpack .../libattr1_1%3a2.5.2-2_ppc64el.deb ... 147s Unpacking libattr1:ppc64el (1:2.5.2-2) over (1:2.5.2-1build2) ... 147s Setting up libattr1:ppc64el (1:2.5.2-2) ... 147s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 73539 files and directories currently installed.) 147s Preparing to unpack .../libbsd0_0.12.2-2_ppc64el.deb ... 147s Unpacking libbsd0:ppc64el (0.12.2-2) over (0.12.2-1) ... 147s Setting up libbsd0:ppc64el (0.12.2-2) ... 147s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 73539 files and directories currently installed.) 147s Preparing to unpack .../00-libbpf1_1%3a1.4.6-1_ppc64el.deb ... 147s Unpacking libbpf1:ppc64el (1:1.4.6-1) over (1:1.4.5-1) ... 147s Preparing to unpack .../01-libmnl0_1.0.5-3_ppc64el.deb ... 147s Unpacking libmnl0:ppc64el (1.0.5-3) over (1.0.5-2build1) ... 147s Preparing to unpack .../02-python3-gi_3.50.0-3_ppc64el.deb ... 148s Unpacking python3-gi (3.50.0-3) over (3.48.2-1) ... 148s Preparing to unpack .../03-bash-completion_1%3a2.14.0-2_all.deb ... 148s Unpacking bash-completion (1:2.14.0-2) over (1:2.14.0-1) ... 148s Preparing to unpack .../04-libdrm-common_2.4.123-1_all.deb ... 148s Unpacking libdrm-common (2.4.123-1) over (2.4.122-1) ... 148s Preparing to unpack .../05-libdrm2_2.4.123-1_ppc64el.deb ... 148s Unpacking libdrm2:ppc64el (2.4.123-1) over (2.4.122-1) ... 148s Preparing to unpack .../06-libmaxminddb0_1.11.0-1_ppc64el.deb ... 148s Unpacking libmaxminddb0:ppc64el (1.11.0-1) over (1.10.0-1) ... 148s Preparing to unpack .../07-libnghttp2-14_1.64.0-1_ppc64el.deb ... 148s Unpacking libnghttp2-14:ppc64el (1.64.0-1) over (1.62.1-2) ... 148s Preparing to unpack .../08-liburcu8t64_0.14.1-1_ppc64el.deb ... 148s Unpacking liburcu8t64:ppc64el (0.14.1-1) over (0.14.0-4) ... 148s Preparing to unpack .../09-libuv1t64_1.48.0-7_ppc64el.deb ... 148s Unpacking libuv1t64:ppc64el (1.48.0-7) over (1.48.0-5) ... 148s Preparing to unpack .../10-libx11-data_2%3a1.8.10-2_all.deb ... 148s Unpacking libx11-data (2:1.8.10-2) over (2:1.8.7-1build1) ... 148s Preparing to unpack .../11-libx11-6_2%3a1.8.10-2_ppc64el.deb ... 148s Unpacking libx11-6:ppc64el (2:1.8.10-2) over (2:1.8.7-1build1) ... 148s Preparing to unpack .../12-pci.ids_0.0~2024.10.24-1_all.deb ... 148s Unpacking pci.ids (0.0~2024.10.24-1) over (0.0~2024.09.12-1) ... 148s Preparing to unpack .../13-python3.12-gdbm_3.12.7-2_ppc64el.deb ... 148s Unpacking python3.12-gdbm (3.12.7-2) over (3.12.7-1) ... 148s Preparing to unpack .../14-usbutils_1%3a018-1_ppc64el.deb ... 148s Unpacking usbutils (1:018-1) over (1:017-3build1) ... 148s Preparing to unpack .../15-libblockdev-utils3_3.2.1-1_ppc64el.deb ... 148s Unpacking libblockdev-utils3:ppc64el (3.2.1-1) over (3.2.0-2) ... 148s Preparing to unpack .../16-libblockdev-crypto3_3.2.1-1_ppc64el.deb ... 148s Unpacking libblockdev-crypto3:ppc64el (3.2.1-1) over (3.2.0-2) ... 148s Preparing to unpack .../17-libblockdev-fs3_3.2.1-1_ppc64el.deb ... 148s Unpacking libblockdev-fs3:ppc64el (3.2.1-1) over (3.2.0-2) ... 148s Preparing to unpack .../18-libblockdev-loop3_3.2.1-1_ppc64el.deb ... 148s Unpacking libblockdev-loop3:ppc64el (3.2.1-1) over (3.2.0-2) ... 148s Preparing to unpack .../19-libbytesize1_2.11-1ubuntu1_ppc64el.deb ... 148s Unpacking libbytesize1:ppc64el (2.11-1ubuntu1) over (2.10-1ubuntu2) ... 149s Preparing to unpack .../20-libbytesize-common_2.11-1ubuntu1_all.deb ... 149s Unpacking libbytesize-common (2.11-1ubuntu1) over (2.10-1ubuntu2) ... 149s Preparing to unpack .../21-libblockdev-mdraid3_3.2.1-1_ppc64el.deb ... 149s Unpacking libblockdev-mdraid3:ppc64el (3.2.1-1) over (3.2.0-2) ... 149s Preparing to unpack .../22-libblockdev-nvme3_3.2.1-1_ppc64el.deb ... 149s Unpacking libblockdev-nvme3:ppc64el (3.2.1-1) over (3.2.0-2) ... 149s Preparing to unpack .../23-libblockdev-part3_3.2.1-1_ppc64el.deb ... 149s Unpacking libblockdev-part3:ppc64el (3.2.1-1) over (3.2.0-2) ... 149s Preparing to unpack .../24-libblockdev-swap3_3.2.1-1_ppc64el.deb ... 149s Unpacking libblockdev-swap3:ppc64el (3.2.1-1) over (3.2.0-2) ... 149s Preparing to unpack .../25-libblockdev3_3.2.1-1_ppc64el.deb ... 149s Unpacking libblockdev3:ppc64el (3.2.1-1) over (3.2.0-2) ... 149s Preparing to unpack .../26-libjson-glib-1.0-common_1.10.0+ds-2_all.deb ... 149s Unpacking libjson-glib-1.0-common (1.10.0+ds-2) over (1.8.0-2build2) ... 149s Preparing to unpack .../27-libjson-glib-1.0-0_1.10.0+ds-2_ppc64el.deb ... 149s Unpacking libjson-glib-1.0-0:ppc64el (1.10.0+ds-2) over (1.8.0-2build2) ... 149s Preparing to unpack .../28-libnspr4_2%3a4.35-1.1ubuntu2_ppc64el.deb ... 149s Unpacking libnspr4:ppc64el (2:4.35-1.1ubuntu2) over (2:4.35-1.1ubuntu1) ... 149s Preparing to unpack .../29-udisks2_2.10.1-11ubuntu1_ppc64el.deb ... 149s Unpacking udisks2 (2.10.1-11ubuntu1) over (2.10.1-9ubuntu2) ... 149s Preparing to unpack .../30-libudisks2-0_2.10.1-11ubuntu1_ppc64el.deb ... 149s Unpacking libudisks2-0:ppc64el (2.10.1-11ubuntu1) over (2.10.1-9ubuntu2) ... 149s Preparing to unpack .../31-linux-firmware_20241108.git3bbb13a7-0ubuntu1_ppc64el.deb ... 149s Unpacking linux-firmware (20241108.git3bbb13a7-0ubuntu1) over (20240913.gita34e7a5f-0ubuntu2) ... 153s Preparing to unpack .../32-python3-idna_3.8-2_all.deb ... 153s Unpacking python3-idna (3.8-2) over (3.6-2.1) ... 153s Selecting previously unselected package python3-jaraco.text. 153s Preparing to unpack .../33-python3-jaraco.text_4.0.0-1_all.deb ... 153s Unpacking python3-jaraco.text (4.0.0-1) ... 153s Preparing to unpack .../34-python3-jsonpatch_1.32-4_all.deb ... 153s Unpacking python3-jsonpatch (1.32-4) over (1.32-3) ... 153s Preparing to unpack .../35-python3-wadllib_2.0.0-1_all.deb ... 154s Unpacking python3-wadllib (2.0.0-1) over (1.3.6-5) ... 154s Preparing to unpack .../36-python3-pkg-resources_75.2.0-1_all.deb ... 154s Unpacking python3-pkg-resources (75.2.0-1) over (74.1.2-1) ... 154s Preparing to unpack .../37-python3-setuptools_75.2.0-1_all.deb ... 154s Unpacking python3-setuptools (75.2.0-1) over (74.1.2-1) ... 154s Preparing to unpack .../38-python3-lazr.restfulclient_0.14.6-2_all.deb ... 154s Unpacking python3-lazr.restfulclient (0.14.6-2) over (0.14.6-1) ... 154s Preparing to unpack .../39-python3-urllib3_2.0.7-2ubuntu0.1_all.deb ... 154s Unpacking python3-urllib3 (2.0.7-2ubuntu0.1) over (2.0.7-2) ... 154s Selecting previously unselected package systemd-cryptsetup. 154s Preparing to unpack .../40-systemd-cryptsetup_256.5-2ubuntu4_ppc64el.deb ... 154s Unpacking systemd-cryptsetup (256.5-2ubuntu4) ... 154s Setting up python3-pkg-resources (75.2.0-1) ... 155s Setting up liburcu8t64:ppc64el (0.14.1-1) ... 155s Setting up pci.ids (0.0~2024.10.24-1) ... 155s Setting up linux-firmware (20241108.git3bbb13a7-0ubuntu1) ... 155s Setting up openssh-client (1:9.7p1-7ubuntu5) ... 155s Setting up libmaxminddb0:ppc64el (1.11.0-1) ... 155s Setting up python3.12-gdbm (3.12.7-2) ... 155s Setting up python3-jsonpatch (1.32-4) ... 155s Setting up libuv1t64:ppc64el (1.48.0-7) ... 155s Setting up libpython3.12-minimal:ppc64el (3.12.7-2) ... 155s Setting up libnghttp2-14:ppc64el (1.64.0-1) ... 155s Setting up usbutils (1:018-1) ... 155s Setting up tzdata (2024b-1ubuntu2) ... 155s 155s Current default time zone: 'Etc/UTC' 155s Local time is now: Sat Nov 9 17:54:30 UTC 2024. 155s Universal Time is now: Sat Nov 9 17:54:30 UTC 2024. 155s Run 'dpkg-reconfigure tzdata' if you wish to change it. 155s 155s Setting up libx11-data (2:1.8.10-2) ... 155s Setting up libnspr4:ppc64el (2:4.35-1.1ubuntu2) ... 155s Setting up python3-jaraco.text (4.0.0-1) ... 155s Setting up bash-completion (1:2.14.0-2) ... 155s Setting up python3-wadllib (2.0.0-1) ... 155s Setting up python3-gi (3.50.0-3) ... 156s Setting up libbytesize-common (2.11-1ubuntu1) ... 156s Setting up libblockdev-utils3:ppc64el (3.2.1-1) ... 156s Setting up libmnl0:ppc64el (1.0.5-3) ... 156s Setting up python3-idna (3.8-2) ... 156s Setting up libsystemd-shared:ppc64el (256.5-2ubuntu4) ... 156s Setting up python3-urllib3 (2.0.7-2ubuntu0.1) ... 156s Setting up libblockdev-nvme3:ppc64el (3.2.1-1) ... 156s Setting up libblockdev-fs3:ppc64el (3.2.1-1) ... 156s Setting up libx11-6:ppc64el (2:1.8.10-2) ... 156s Setting up libjson-glib-1.0-common (1.10.0+ds-2) ... 156s Setting up libbytesize1:ppc64el (2.11-1ubuntu1) ... 156s Setting up python3-lazr.restfulclient (0.14.6-2) ... 156s Setting up libdrm-common (2.4.123-1) ... 156s Setting up libbpf1:ppc64el (1:1.4.6-1) ... 156s Setting up libudisks2-0:ppc64el (2.10.1-11ubuntu1) ... 156s Setting up python3.12-minimal (3.12.7-2) ... 157s Setting up openssh-sftp-server (1:9.7p1-7ubuntu5) ... 157s Setting up libpython3.12-stdlib:ppc64el (3.12.7-2) ... 157s Setting up libblockdev-mdraid3:ppc64el (3.2.1-1) ... 157s Setting up python3-setuptools (75.2.0-1) ... 158s Setting up openssh-server (1:9.7p1-7ubuntu5) ... 160s Setting up libblockdev-crypto3:ppc64el (3.2.1-1) ... 160s Setting up libblockdev-swap3:ppc64el (3.2.1-1) ... 160s Setting up python3.12 (3.12.7-2) ... 161s Setting up libblockdev-loop3:ppc64el (3.2.1-1) ... 161s Setting up systemd (256.5-2ubuntu4) ... 161s /usr/lib/tmpfiles.d/legacy.conf:13: Duplicate line for path "/run/lock", ignoring. 161s Created symlink '/run/systemd/system/tmp.mount' → '/dev/null'. 162s /usr/lib/tmpfiles.d/legacy.conf:13: Duplicate line for path "/run/lock", ignoring. 162s Setting up libblockdev3:ppc64el (3.2.1-1) ... 162s Setting up libjson-glib-1.0-0:ppc64el (1.10.0+ds-2) ... 162s Setting up libblockdev-part3:ppc64el (3.2.1-1) ... 162s Setting up libpython3.12t64:ppc64el (3.12.7-2) ... 162s Setting up systemd-cryptsetup (256.5-2ubuntu4) ... 162s Setting up systemd-timesyncd (256.5-2ubuntu4) ... 163s systemd-time-wait-sync.service is a disabled or a static unit not running, not starting it. 163s Setting up udev (256.5-2ubuntu4) ... 164s Setting up libdrm2:ppc64el (2.4.123-1) ... 164s Setting up systemd-resolved (256.5-2ubuntu4) ... 165s Setting up udisks2 (2.10.1-11ubuntu1) ... 165s Setting up systemd-sysv (256.5-2ubuntu4) ... 166s Setting up libnss-systemd:ppc64el (256.5-2ubuntu4) ... 166s Setting up libpam-systemd:ppc64el (256.5-2ubuntu4) ... 166s Processing triggers for libc-bin (2.40-1ubuntu3) ... 166s Processing triggers for ufw (0.36.2-8) ... 166s Processing triggers for man-db (2.12.1-3) ... 168s Processing triggers for dbus (1.14.10-4ubuntu5) ... 168s Processing triggers for shared-mime-info (2.4-5) ... 169s Processing triggers for initramfs-tools (0.142ubuntu34) ... 169s update-initramfs: Generating /boot/initrd.img-6.11.0-8-generic 169s W: No lz4 in /usr/bin:/sbin:/bin, using gzip 180s Reading package lists... 180s Building dependency tree... 180s Reading state information... 180s 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 180s Hit:1 http://ftpmaster.internal/ubuntu plucky-proposed InRelease 180s Hit:2 http://ftpmaster.internal/ubuntu plucky InRelease 181s Hit:3 http://ftpmaster.internal/ubuntu plucky-updates InRelease 181s Hit:4 http://ftpmaster.internal/ubuntu plucky-security InRelease 182s Reading package lists... 182s Reading package lists... 182s Building dependency tree... 182s Reading state information... 182s Calculating upgrade... 182s 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 182s Reading package lists... 183s Building dependency tree... 183s Reading state information... 183s 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 183s autopkgtest [17:54:58]: rebooting testbed after setup commands that affected boot 187s autopkgtest-virt-ssh: WARNING: ssh connection failed. Retrying in 3 seconds... 220s autopkgtest-virt-ssh: WARNING: ssh connection failed. Retrying in 3 seconds... 227s autopkgtest [17:55:42]: testbed running kernel: Linux 6.11.0-8-generic #8-Ubuntu SMP Mon Sep 16 13:49:23 UTC 2024 229s autopkgtest [17:55:44]: @@@@@@@@@@@@@@@@@@@@ apt-source scikit-build 233s Get:1 http://ftpmaster.internal/ubuntu plucky/universe scikit-build 0.18.1-1 (dsc) [2733 B] 233s Get:2 http://ftpmaster.internal/ubuntu plucky/universe scikit-build 0.18.1-1 (tar) [273 kB] 233s Get:3 http://ftpmaster.internal/ubuntu plucky/universe scikit-build 0.18.1-1 (diff) [5768 B] 233s gpgv: Signature made Fri Aug 30 01:03:13 2024 UTC 233s gpgv: using RSA key 13796755BBC72BB8ABE2AEB5FA9DEC5DE11C63F1 233s gpgv: issuer "eamanu@debian.org" 233s gpgv: Can't check signature: No public key 233s dpkg-source: warning: cannot verify inline signature for ./scikit-build_0.18.1-1.dsc: no acceptable signature found 233s autopkgtest [17:55:48]: testing package scikit-build version 0.18.1-1 233s autopkgtest [17:55:48]: build not needed 234s autopkgtest [17:55:49]: test testsuite: preparing testbed 235s Reading package lists... 235s Building dependency tree... 235s Reading state information... 235s Starting pkgProblemResolver with broken count: 0 236s Starting 2 pkgProblemResolver with broken count: 0 236s Done 236s The following additional packages will be installed: 236s build-essential cmake cmake-data cpp cpp-14 cpp-14-powerpc64le-linux-gnu 236s cpp-powerpc64le-linux-gnu cython3 fonts-font-awesome fonts-lato g++ g++-14 236s g++-14-powerpc64le-linux-gnu g++-powerpc64le-linux-gnu gcc gcc-14 236s gcc-14-powerpc64le-linux-gnu gcc-powerpc64le-linux-gnu git git-man libasan8 236s libcc1-0 liberror-perl libexpat1-dev libgcc-14-dev libgomp1 libisl23 libitm1 236s libjs-jquery libjs-sphinxdoc libjs-underscore libjsoncpp25 liblsan0 libmpc3 236s libpython3-all-dev libpython3-dev libpython3.12-dev libquadmath0 librhash0 236s libstdc++-14-dev libtsan2 libubsan1 python-skbuild-doc python3-all 236s python3-all-dev python3-build python3-dev python3-distlib python3-filelock 236s python3-iniconfig python3-packaging python3-pip python3-pip-whl 236s python3-platformdirs python3-pluggy python3-pyproject-hooks python3-pytest 236s python3-pytest-mock python3-setuptools-whl python3-skbuild python3-toml 236s python3-virtualenv python3-wheel python3-wheel-whl python3.12-dev 236s sphinx-rtd-theme-common zlib1g-dev 236s Suggested packages: 236s cmake-doc cmake-format elpa-cmake-mode ninja-build cpp-doc gcc-14-locales 236s cpp-14-doc cython-doc gcc-14-doc gcc-multilib manpages-dev autoconf automake 236s libtool flex bison gdb gcc-doc gdb-powerpc64le-linux-gnu git-daemon-run 236s | git-daemon-sysvinit git-doc git-email git-gui gitk gitweb git-cvs 236s git-mediawiki git-svn libstdc++-14-doc python3-venv python-build-doc 236s python-pytest-mock-doc 236s Recommended packages: 236s javascript-common 236s The following NEW packages will be installed: 236s autopkgtest-satdep build-essential cmake cmake-data cpp cpp-14 236s cpp-14-powerpc64le-linux-gnu cpp-powerpc64le-linux-gnu cython3 236s fonts-font-awesome fonts-lato g++ g++-14 g++-14-powerpc64le-linux-gnu 236s g++-powerpc64le-linux-gnu gcc gcc-14 gcc-14-powerpc64le-linux-gnu 236s gcc-powerpc64le-linux-gnu git git-man libasan8 libcc1-0 liberror-perl 236s libexpat1-dev libgcc-14-dev libgomp1 libisl23 libitm1 libjs-jquery 236s libjs-sphinxdoc libjs-underscore libjsoncpp25 liblsan0 libmpc3 236s libpython3-all-dev libpython3-dev libpython3.12-dev libquadmath0 librhash0 236s libstdc++-14-dev libtsan2 libubsan1 python-skbuild-doc python3-all 236s python3-all-dev python3-build python3-dev python3-distlib python3-filelock 236s python3-iniconfig python3-packaging python3-pip python3-pip-whl 236s python3-platformdirs python3-pluggy python3-pyproject-hooks python3-pytest 236s python3-pytest-mock python3-setuptools-whl python3-skbuild python3-toml 236s python3-virtualenv python3-wheel python3-wheel-whl python3.12-dev 236s sphinx-rtd-theme-common zlib1g-dev 236s 0 upgraded, 68 newly installed, 0 to remove and 0 not upgraded. 236s Need to get 101 MB/101 MB of archives. 236s After this operation, 380 MB of additional disk space will be used. 236s Get:1 /tmp/autopkgtest.vUjEXk/1-autopkgtest-satdep.deb autopkgtest-satdep ppc64el 0 [784 B] 236s Get:2 http://ftpmaster.internal/ubuntu plucky/main ppc64el fonts-lato all 2.015-1 [2781 kB] 237s Get:3 http://ftpmaster.internal/ubuntu plucky/main ppc64el libisl23 ppc64el 0.27-1 [882 kB] 237s Get:4 http://ftpmaster.internal/ubuntu plucky/main ppc64el libmpc3 ppc64el 1.3.1-1build2 [62.1 kB] 237s Get:5 http://ftpmaster.internal/ubuntu plucky/main ppc64el cpp-14-powerpc64le-linux-gnu ppc64el 14.2.0-7ubuntu1 [10.5 MB] 237s Get:6 http://ftpmaster.internal/ubuntu plucky/main ppc64el cpp-14 ppc64el 14.2.0-7ubuntu1 [1030 B] 237s Get:7 http://ftpmaster.internal/ubuntu plucky/main ppc64el cpp-powerpc64le-linux-gnu ppc64el 4:14.1.0-2ubuntu1 [5456 B] 237s Get:8 http://ftpmaster.internal/ubuntu plucky/main ppc64el cpp ppc64el 4:14.1.0-2ubuntu1 [22.5 kB] 237s Get:9 http://ftpmaster.internal/ubuntu plucky/main ppc64el libcc1-0 ppc64el 14.2.0-7ubuntu1 [48.1 kB] 237s Get:10 http://ftpmaster.internal/ubuntu plucky/main ppc64el libgomp1 ppc64el 14.2.0-7ubuntu1 [161 kB] 237s Get:11 http://ftpmaster.internal/ubuntu plucky/main ppc64el libitm1 ppc64el 14.2.0-7ubuntu1 [31.9 kB] 237s Get:12 http://ftpmaster.internal/ubuntu plucky/main ppc64el libasan8 ppc64el 14.2.0-7ubuntu1 [2945 kB] 237s Get:13 http://ftpmaster.internal/ubuntu plucky/main ppc64el liblsan0 ppc64el 14.2.0-7ubuntu1 [1322 kB] 237s Get:14 http://ftpmaster.internal/ubuntu plucky/main ppc64el libtsan2 ppc64el 14.2.0-7ubuntu1 [2694 kB] 238s Get:15 http://ftpmaster.internal/ubuntu plucky/main ppc64el libubsan1 ppc64el 14.2.0-7ubuntu1 [1191 kB] 238s Get:16 http://ftpmaster.internal/ubuntu plucky/main ppc64el libquadmath0 ppc64el 14.2.0-7ubuntu1 [158 kB] 238s Get:17 http://ftpmaster.internal/ubuntu plucky/main ppc64el libgcc-14-dev ppc64el 14.2.0-7ubuntu1 [1620 kB] 238s Get:18 http://ftpmaster.internal/ubuntu plucky/main ppc64el gcc-14-powerpc64le-linux-gnu ppc64el 14.2.0-7ubuntu1 [20.6 MB] 239s Get:19 http://ftpmaster.internal/ubuntu plucky/main ppc64el gcc-14 ppc64el 14.2.0-7ubuntu1 [526 kB] 239s Get:20 http://ftpmaster.internal/ubuntu plucky/main ppc64el gcc-powerpc64le-linux-gnu ppc64el 4:14.1.0-2ubuntu1 [1222 B] 239s Get:21 http://ftpmaster.internal/ubuntu plucky/main ppc64el gcc ppc64el 4:14.1.0-2ubuntu1 [5006 B] 239s Get:22 http://ftpmaster.internal/ubuntu plucky/main ppc64el libstdc++-14-dev ppc64el 14.2.0-7ubuntu1 [2672 kB] 239s Get:23 http://ftpmaster.internal/ubuntu plucky/main ppc64el g++-14-powerpc64le-linux-gnu ppc64el 14.2.0-7ubuntu1 [12.0 MB] 239s Get:24 http://ftpmaster.internal/ubuntu plucky/main ppc64el g++-14 ppc64el 14.2.0-7ubuntu1 [19.8 kB] 239s Get:25 http://ftpmaster.internal/ubuntu plucky/main ppc64el g++-powerpc64le-linux-gnu ppc64el 4:14.1.0-2ubuntu1 [968 B] 239s Get:26 http://ftpmaster.internal/ubuntu plucky/main ppc64el g++ ppc64el 4:14.1.0-2ubuntu1 [1090 B] 239s Get:27 http://ftpmaster.internal/ubuntu plucky/main ppc64el build-essential ppc64el 12.10ubuntu1 [4936 B] 239s Get:28 http://ftpmaster.internal/ubuntu plucky/main ppc64el libjsoncpp25 ppc64el 1.9.5-6build1 [89.0 kB] 239s Get:29 http://ftpmaster.internal/ubuntu plucky/main ppc64el librhash0 ppc64el 1.4.3-3build1 [147 kB] 239s Get:30 http://ftpmaster.internal/ubuntu plucky/main ppc64el cmake-data all 3.30.3-1 [2246 kB] 239s Get:31 http://ftpmaster.internal/ubuntu plucky/main ppc64el cmake ppc64el 3.30.3-1 [12.1 MB] 240s Get:32 http://ftpmaster.internal/ubuntu plucky/universe ppc64el cython3 ppc64el 3.0.11+dfsg-1ubuntu1 [2579 kB] 240s Get:33 http://ftpmaster.internal/ubuntu plucky/main ppc64el fonts-font-awesome all 5.0.10+really4.7.0~dfsg-4.1 [516 kB] 240s Get:34 http://ftpmaster.internal/ubuntu plucky/main ppc64el liberror-perl all 0.17029-2 [25.6 kB] 240s Get:35 http://ftpmaster.internal/ubuntu plucky/main ppc64el git-man all 1:2.45.2-1ubuntu1 [1122 kB] 240s Get:36 http://ftpmaster.internal/ubuntu plucky/main ppc64el git ppc64el 1:2.45.2-1ubuntu1 [7130 kB] 240s Get:37 http://ftpmaster.internal/ubuntu plucky/main ppc64el libexpat1-dev ppc64el 2.6.2-2 [149 kB] 240s Get:38 http://ftpmaster.internal/ubuntu plucky/main ppc64el libjs-jquery all 3.6.1+dfsg+~3.5.14-1 [328 kB] 240s Get:39 http://ftpmaster.internal/ubuntu plucky/main ppc64el libjs-underscore all 1.13.4~dfsg+~1.11.4-3 [118 kB] 240s Get:40 http://ftpmaster.internal/ubuntu plucky/main ppc64el libjs-sphinxdoc all 7.4.7-3 [157 kB] 240s Get:41 http://ftpmaster.internal/ubuntu plucky/main ppc64el zlib1g-dev ppc64el 1:1.3.dfsg+really1.3.1-1ubuntu1 [902 kB] 240s Get:42 http://ftpmaster.internal/ubuntu plucky/main ppc64el libpython3.12-dev ppc64el 3.12.7-2 [6139 kB] 241s Get:43 http://ftpmaster.internal/ubuntu plucky/main ppc64el libpython3-dev ppc64el 3.12.6-0ubuntu1 [10.2 kB] 241s Get:44 http://ftpmaster.internal/ubuntu plucky/main ppc64el libpython3-all-dev ppc64el 3.12.6-0ubuntu1 [916 B] 241s Get:45 http://ftpmaster.internal/ubuntu plucky/main ppc64el sphinx-rtd-theme-common all 3.0.1+dfsg-1 [1012 kB] 241s Get:46 http://ftpmaster.internal/ubuntu plucky/universe ppc64el python-skbuild-doc all 0.18.1-1 [136 kB] 241s Get:47 http://ftpmaster.internal/ubuntu plucky/main ppc64el python3-all ppc64el 3.12.6-0ubuntu1 [888 B] 241s Get:48 http://ftpmaster.internal/ubuntu plucky/main ppc64el python3.12-dev ppc64el 3.12.7-2 [505 kB] 241s Get:49 http://ftpmaster.internal/ubuntu plucky/main ppc64el python3-dev ppc64el 3.12.6-0ubuntu1 [26.7 kB] 241s Get:50 http://ftpmaster.internal/ubuntu plucky/main ppc64el python3-all-dev ppc64el 3.12.6-0ubuntu1 [908 B] 241s Get:51 http://ftpmaster.internal/ubuntu plucky/main ppc64el python3-packaging all 24.1-1 [41.4 kB] 241s Get:52 http://ftpmaster.internal/ubuntu plucky/universe ppc64el python3-pyproject-hooks all 1.2.0-1 [10.2 kB] 241s Get:53 http://ftpmaster.internal/ubuntu plucky/universe ppc64el python3-toml all 0.10.2-1 [16.5 kB] 241s Get:54 http://ftpmaster.internal/ubuntu plucky/universe ppc64el python3-wheel all 0.44.0-1 [54.2 kB] 241s Get:55 http://ftpmaster.internal/ubuntu plucky/universe ppc64el python3-build all 1.2.2-1 [31.0 kB] 241s Get:56 http://ftpmaster.internal/ubuntu plucky/universe ppc64el python3-distlib all 0.3.8-1 [318 kB] 241s Get:57 http://ftpmaster.internal/ubuntu plucky/universe ppc64el python3-filelock all 3.15.4-1 [12.8 kB] 241s Get:58 http://ftpmaster.internal/ubuntu plucky/universe ppc64el python3-iniconfig all 1.1.1-2 [6024 B] 241s Get:59 http://ftpmaster.internal/ubuntu plucky/universe ppc64el python3-pip all 24.2+dfsg-1 [1398 kB] 241s Get:60 http://ftpmaster.internal/ubuntu plucky/universe ppc64el python3-pip-whl all 24.2+dfsg-1 [1420 kB] 241s Get:61 http://ftpmaster.internal/ubuntu plucky/main ppc64el python3-platformdirs all 4.2.2-1 [16.6 kB] 241s Get:62 http://ftpmaster.internal/ubuntu plucky/universe ppc64el python3-pluggy all 1.5.0-1 [21.0 kB] 241s Get:63 http://ftpmaster.internal/ubuntu plucky/universe ppc64el python3-pytest all 8.3.2-1 [251 kB] 241s Get:64 http://ftpmaster.internal/ubuntu plucky/universe ppc64el python3-pytest-mock all 3.14.0-1 [11.6 kB] 241s Get:65 http://ftpmaster.internal/ubuntu plucky-proposed/universe ppc64el python3-setuptools-whl all 75.2.0-1 [1158 kB] 241s Get:66 http://ftpmaster.internal/ubuntu plucky/universe ppc64el python3-skbuild all 0.18.1-1 [60.3 kB] 241s Get:67 http://ftpmaster.internal/ubuntu plucky/universe ppc64el python3-wheel-whl all 0.44.0-1 [69.5 kB] 241s Get:68 http://ftpmaster.internal/ubuntu plucky/universe ppc64el python3-virtualenv all 20.26.2+ds-1 [71.6 kB] 242s Fetched 101 MB in 5s (20.7 MB/s) 242s Selecting previously unselected package fonts-lato. 242s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 73786 files and directories currently installed.) 242s Preparing to unpack .../00-fonts-lato_2.015-1_all.deb ... 242s Unpacking fonts-lato (2.015-1) ... 242s Selecting previously unselected package libisl23:ppc64el. 242s Preparing to unpack .../01-libisl23_0.27-1_ppc64el.deb ... 242s Unpacking libisl23:ppc64el (0.27-1) ... 242s Selecting previously unselected package libmpc3:ppc64el. 242s Preparing to unpack .../02-libmpc3_1.3.1-1build2_ppc64el.deb ... 242s Unpacking libmpc3:ppc64el (1.3.1-1build2) ... 242s Selecting previously unselected package cpp-14-powerpc64le-linux-gnu. 242s Preparing to unpack .../03-cpp-14-powerpc64le-linux-gnu_14.2.0-7ubuntu1_ppc64el.deb ... 242s Unpacking cpp-14-powerpc64le-linux-gnu (14.2.0-7ubuntu1) ... 243s Selecting previously unselected package cpp-14. 243s Preparing to unpack .../04-cpp-14_14.2.0-7ubuntu1_ppc64el.deb ... 243s Unpacking cpp-14 (14.2.0-7ubuntu1) ... 243s Selecting previously unselected package cpp-powerpc64le-linux-gnu. 243s Preparing to unpack .../05-cpp-powerpc64le-linux-gnu_4%3a14.1.0-2ubuntu1_ppc64el.deb ... 243s Unpacking cpp-powerpc64le-linux-gnu (4:14.1.0-2ubuntu1) ... 243s Selecting previously unselected package cpp. 243s Preparing to unpack .../06-cpp_4%3a14.1.0-2ubuntu1_ppc64el.deb ... 243s Unpacking cpp (4:14.1.0-2ubuntu1) ... 243s Selecting previously unselected package libcc1-0:ppc64el. 243s Preparing to unpack .../07-libcc1-0_14.2.0-7ubuntu1_ppc64el.deb ... 243s Unpacking libcc1-0:ppc64el (14.2.0-7ubuntu1) ... 243s Selecting previously unselected package libgomp1:ppc64el. 243s Preparing to unpack .../08-libgomp1_14.2.0-7ubuntu1_ppc64el.deb ... 243s Unpacking libgomp1:ppc64el (14.2.0-7ubuntu1) ... 243s Selecting previously unselected package libitm1:ppc64el. 243s Preparing to unpack .../09-libitm1_14.2.0-7ubuntu1_ppc64el.deb ... 243s Unpacking libitm1:ppc64el (14.2.0-7ubuntu1) ... 243s Selecting previously unselected package libasan8:ppc64el. 243s Preparing to unpack .../10-libasan8_14.2.0-7ubuntu1_ppc64el.deb ... 243s Unpacking libasan8:ppc64el (14.2.0-7ubuntu1) ... 243s Selecting previously unselected package liblsan0:ppc64el. 243s Preparing to unpack .../11-liblsan0_14.2.0-7ubuntu1_ppc64el.deb ... 243s Unpacking liblsan0:ppc64el (14.2.0-7ubuntu1) ... 243s Selecting previously unselected package libtsan2:ppc64el. 243s Preparing to unpack .../12-libtsan2_14.2.0-7ubuntu1_ppc64el.deb ... 243s Unpacking libtsan2:ppc64el (14.2.0-7ubuntu1) ... 243s Selecting previously unselected package libubsan1:ppc64el. 243s Preparing to unpack .../13-libubsan1_14.2.0-7ubuntu1_ppc64el.deb ... 243s Unpacking libubsan1:ppc64el (14.2.0-7ubuntu1) ... 243s Selecting previously unselected package libquadmath0:ppc64el. 243s Preparing to unpack .../14-libquadmath0_14.2.0-7ubuntu1_ppc64el.deb ... 243s Unpacking libquadmath0:ppc64el (14.2.0-7ubuntu1) ... 243s Selecting previously unselected package libgcc-14-dev:ppc64el. 243s Preparing to unpack .../15-libgcc-14-dev_14.2.0-7ubuntu1_ppc64el.deb ... 243s Unpacking libgcc-14-dev:ppc64el (14.2.0-7ubuntu1) ... 243s Selecting previously unselected package gcc-14-powerpc64le-linux-gnu. 243s Preparing to unpack .../16-gcc-14-powerpc64le-linux-gnu_14.2.0-7ubuntu1_ppc64el.deb ... 243s Unpacking gcc-14-powerpc64le-linux-gnu (14.2.0-7ubuntu1) ... 244s Selecting previously unselected package gcc-14. 244s Preparing to unpack .../17-gcc-14_14.2.0-7ubuntu1_ppc64el.deb ... 244s Unpacking gcc-14 (14.2.0-7ubuntu1) ... 244s Selecting previously unselected package gcc-powerpc64le-linux-gnu. 244s Preparing to unpack .../18-gcc-powerpc64le-linux-gnu_4%3a14.1.0-2ubuntu1_ppc64el.deb ... 244s Unpacking gcc-powerpc64le-linux-gnu (4:14.1.0-2ubuntu1) ... 244s Selecting previously unselected package gcc. 244s Preparing to unpack .../19-gcc_4%3a14.1.0-2ubuntu1_ppc64el.deb ... 244s Unpacking gcc (4:14.1.0-2ubuntu1) ... 244s Selecting previously unselected package libstdc++-14-dev:ppc64el. 244s Preparing to unpack .../20-libstdc++-14-dev_14.2.0-7ubuntu1_ppc64el.deb ... 244s Unpacking libstdc++-14-dev:ppc64el (14.2.0-7ubuntu1) ... 244s Selecting previously unselected package g++-14-powerpc64le-linux-gnu. 244s Preparing to unpack .../21-g++-14-powerpc64le-linux-gnu_14.2.0-7ubuntu1_ppc64el.deb ... 244s Unpacking g++-14-powerpc64le-linux-gnu (14.2.0-7ubuntu1) ... 245s Selecting previously unselected package g++-14. 245s Preparing to unpack .../22-g++-14_14.2.0-7ubuntu1_ppc64el.deb ... 245s Unpacking g++-14 (14.2.0-7ubuntu1) ... 245s Selecting previously unselected package g++-powerpc64le-linux-gnu. 245s Preparing to unpack .../23-g++-powerpc64le-linux-gnu_4%3a14.1.0-2ubuntu1_ppc64el.deb ... 245s Unpacking g++-powerpc64le-linux-gnu (4:14.1.0-2ubuntu1) ... 245s Selecting previously unselected package g++. 245s Preparing to unpack .../24-g++_4%3a14.1.0-2ubuntu1_ppc64el.deb ... 245s Unpacking g++ (4:14.1.0-2ubuntu1) ... 245s Selecting previously unselected package build-essential. 245s Preparing to unpack .../25-build-essential_12.10ubuntu1_ppc64el.deb ... 245s Unpacking build-essential (12.10ubuntu1) ... 245s Selecting previously unselected package libjsoncpp25:ppc64el. 245s Preparing to unpack .../26-libjsoncpp25_1.9.5-6build1_ppc64el.deb ... 245s Unpacking libjsoncpp25:ppc64el (1.9.5-6build1) ... 245s Selecting previously unselected package librhash0:ppc64el. 245s Preparing to unpack .../27-librhash0_1.4.3-3build1_ppc64el.deb ... 245s Unpacking librhash0:ppc64el (1.4.3-3build1) ... 245s Selecting previously unselected package cmake-data. 245s Preparing to unpack .../28-cmake-data_3.30.3-1_all.deb ... 245s Unpacking cmake-data (3.30.3-1) ... 246s Selecting previously unselected package cmake. 246s Preparing to unpack .../29-cmake_3.30.3-1_ppc64el.deb ... 246s Unpacking cmake (3.30.3-1) ... 246s Selecting previously unselected package cython3. 246s Preparing to unpack .../30-cython3_3.0.11+dfsg-1ubuntu1_ppc64el.deb ... 246s Unpacking cython3 (3.0.11+dfsg-1ubuntu1) ... 246s Selecting previously unselected package fonts-font-awesome. 246s Preparing to unpack .../31-fonts-font-awesome_5.0.10+really4.7.0~dfsg-4.1_all.deb ... 246s Unpacking fonts-font-awesome (5.0.10+really4.7.0~dfsg-4.1) ... 246s Selecting previously unselected package liberror-perl. 246s Preparing to unpack .../32-liberror-perl_0.17029-2_all.deb ... 246s Unpacking liberror-perl (0.17029-2) ... 246s Selecting previously unselected package git-man. 246s Preparing to unpack .../33-git-man_1%3a2.45.2-1ubuntu1_all.deb ... 246s Unpacking git-man (1:2.45.2-1ubuntu1) ... 246s Selecting previously unselected package git. 246s Preparing to unpack .../34-git_1%3a2.45.2-1ubuntu1_ppc64el.deb ... 246s Unpacking git (1:2.45.2-1ubuntu1) ... 247s Selecting previously unselected package libexpat1-dev:ppc64el. 247s Preparing to unpack .../35-libexpat1-dev_2.6.2-2_ppc64el.deb ... 247s Unpacking libexpat1-dev:ppc64el (2.6.2-2) ... 247s Selecting previously unselected package libjs-jquery. 247s Preparing to unpack .../36-libjs-jquery_3.6.1+dfsg+~3.5.14-1_all.deb ... 247s Unpacking libjs-jquery (3.6.1+dfsg+~3.5.14-1) ... 247s Selecting previously unselected package libjs-underscore. 247s Preparing to unpack .../37-libjs-underscore_1.13.4~dfsg+~1.11.4-3_all.deb ... 247s Unpacking libjs-underscore (1.13.4~dfsg+~1.11.4-3) ... 247s Selecting previously unselected package libjs-sphinxdoc. 247s Preparing to unpack .../38-libjs-sphinxdoc_7.4.7-3_all.deb ... 247s Unpacking libjs-sphinxdoc (7.4.7-3) ... 247s Selecting previously unselected package zlib1g-dev:ppc64el. 247s Preparing to unpack .../39-zlib1g-dev_1%3a1.3.dfsg+really1.3.1-1ubuntu1_ppc64el.deb ... 247s Unpacking zlib1g-dev:ppc64el (1:1.3.dfsg+really1.3.1-1ubuntu1) ... 247s Selecting previously unselected package libpython3.12-dev:ppc64el. 247s Preparing to unpack .../40-libpython3.12-dev_3.12.7-2_ppc64el.deb ... 247s Unpacking libpython3.12-dev:ppc64el (3.12.7-2) ... 248s Selecting previously unselected package libpython3-dev:ppc64el. 248s Preparing to unpack .../41-libpython3-dev_3.12.6-0ubuntu1_ppc64el.deb ... 248s Unpacking libpython3-dev:ppc64el (3.12.6-0ubuntu1) ... 248s Selecting previously unselected package libpython3-all-dev:ppc64el. 248s Preparing to unpack .../42-libpython3-all-dev_3.12.6-0ubuntu1_ppc64el.deb ... 248s Unpacking libpython3-all-dev:ppc64el (3.12.6-0ubuntu1) ... 248s Selecting previously unselected package sphinx-rtd-theme-common. 248s Preparing to unpack .../43-sphinx-rtd-theme-common_3.0.1+dfsg-1_all.deb ... 248s Unpacking sphinx-rtd-theme-common (3.0.1+dfsg-1) ... 248s Selecting previously unselected package python-skbuild-doc. 248s Preparing to unpack .../44-python-skbuild-doc_0.18.1-1_all.deb ... 248s Unpacking python-skbuild-doc (0.18.1-1) ... 248s Selecting previously unselected package python3-all. 248s Preparing to unpack .../45-python3-all_3.12.6-0ubuntu1_ppc64el.deb ... 248s Unpacking python3-all (3.12.6-0ubuntu1) ... 248s Selecting previously unselected package python3.12-dev. 248s Preparing to unpack .../46-python3.12-dev_3.12.7-2_ppc64el.deb ... 248s Unpacking python3.12-dev (3.12.7-2) ... 248s Selecting previously unselected package python3-dev. 248s Preparing to unpack .../47-python3-dev_3.12.6-0ubuntu1_ppc64el.deb ... 248s Unpacking python3-dev (3.12.6-0ubuntu1) ... 248s Selecting previously unselected package python3-all-dev. 248s Preparing to unpack .../48-python3-all-dev_3.12.6-0ubuntu1_ppc64el.deb ... 248s Unpacking python3-all-dev (3.12.6-0ubuntu1) ... 248s Selecting previously unselected package python3-packaging. 248s Preparing to unpack .../49-python3-packaging_24.1-1_all.deb ... 248s Unpacking python3-packaging (24.1-1) ... 248s Selecting previously unselected package python3-pyproject-hooks. 248s Preparing to unpack .../50-python3-pyproject-hooks_1.2.0-1_all.deb ... 248s Unpacking python3-pyproject-hooks (1.2.0-1) ... 248s Selecting previously unselected package python3-toml. 248s Preparing to unpack .../51-python3-toml_0.10.2-1_all.deb ... 248s Unpacking python3-toml (0.10.2-1) ... 248s Selecting previously unselected package python3-wheel. 248s Preparing to unpack .../52-python3-wheel_0.44.0-1_all.deb ... 248s Unpacking python3-wheel (0.44.0-1) ... 248s Selecting previously unselected package python3-build. 248s Preparing to unpack .../53-python3-build_1.2.2-1_all.deb ... 248s Unpacking python3-build (1.2.2-1) ... 248s Selecting previously unselected package python3-distlib. 248s Preparing to unpack .../54-python3-distlib_0.3.8-1_all.deb ... 248s Unpacking python3-distlib (0.3.8-1) ... 248s Selecting previously unselected package python3-filelock. 248s Preparing to unpack .../55-python3-filelock_3.15.4-1_all.deb ... 248s Unpacking python3-filelock (3.15.4-1) ... 248s Selecting previously unselected package python3-iniconfig. 248s Preparing to unpack .../56-python3-iniconfig_1.1.1-2_all.deb ... 248s Unpacking python3-iniconfig (1.1.1-2) ... 248s Selecting previously unselected package python3-pip. 248s Preparing to unpack .../57-python3-pip_24.2+dfsg-1_all.deb ... 248s Unpacking python3-pip (24.2+dfsg-1) ... 248s Selecting previously unselected package python3-pip-whl. 248s Preparing to unpack .../58-python3-pip-whl_24.2+dfsg-1_all.deb ... 248s Unpacking python3-pip-whl (24.2+dfsg-1) ... 248s Selecting previously unselected package python3-platformdirs. 248s Preparing to unpack .../59-python3-platformdirs_4.2.2-1_all.deb ... 248s Unpacking python3-platformdirs (4.2.2-1) ... 248s Selecting previously unselected package python3-pluggy. 248s Preparing to unpack .../60-python3-pluggy_1.5.0-1_all.deb ... 248s Unpacking python3-pluggy (1.5.0-1) ... 248s Selecting previously unselected package python3-pytest. 248s Preparing to unpack .../61-python3-pytest_8.3.2-1_all.deb ... 248s Unpacking python3-pytest (8.3.2-1) ... 248s Selecting previously unselected package python3-pytest-mock. 248s Preparing to unpack .../62-python3-pytest-mock_3.14.0-1_all.deb ... 248s Unpacking python3-pytest-mock (3.14.0-1) ... 249s Selecting previously unselected package python3-setuptools-whl. 249s Preparing to unpack .../63-python3-setuptools-whl_75.2.0-1_all.deb ... 249s Unpacking python3-setuptools-whl (75.2.0-1) ... 249s Selecting previously unselected package python3-skbuild. 249s Preparing to unpack .../64-python3-skbuild_0.18.1-1_all.deb ... 249s Unpacking python3-skbuild (0.18.1-1) ... 249s Selecting previously unselected package python3-wheel-whl. 249s Preparing to unpack .../65-python3-wheel-whl_0.44.0-1_all.deb ... 249s Unpacking python3-wheel-whl (0.44.0-1) ... 249s Selecting previously unselected package python3-virtualenv. 249s Preparing to unpack .../66-python3-virtualenv_20.26.2+ds-1_all.deb ... 249s Unpacking python3-virtualenv (20.26.2+ds-1) ... 249s Selecting previously unselected package autopkgtest-satdep. 249s Preparing to unpack .../67-1-autopkgtest-satdep.deb ... 249s Unpacking autopkgtest-satdep (0) ... 249s Setting up python3-iniconfig (1.1.1-2) ... 249s Setting up python3-setuptools-whl (75.2.0-1) ... 249s Setting up python3-filelock (3.15.4-1) ... 249s Setting up fonts-lato (2.015-1) ... 249s Setting up python3-pip-whl (24.2+dfsg-1) ... 249s Setting up python3-all (3.12.6-0ubuntu1) ... 249s Setting up python3-distlib (0.3.8-1) ... 249s Setting up libgomp1:ppc64el (14.2.0-7ubuntu1) ... 249s Setting up python3-wheel (0.44.0-1) ... 250s Setting up python3-platformdirs (4.2.2-1) ... 250s Setting up liberror-perl (0.17029-2) ... 250s Setting up python3-packaging (24.1-1) ... 250s Setting up libexpat1-dev:ppc64el (2.6.2-2) ... 250s Setting up python3-pyproject-hooks (1.2.0-1) ... 250s Setting up libquadmath0:ppc64el (14.2.0-7ubuntu1) ... 250s Setting up libmpc3:ppc64el (1.3.1-1build2) ... 250s Setting up cython3 (3.0.11+dfsg-1ubuntu1) ... 252s Setting up libjsoncpp25:ppc64el (1.9.5-6build1) ... 252s Setting up python3-pip (24.2+dfsg-1) ... 253s Setting up python3-toml (0.10.2-1) ... 254s Setting up python3-pluggy (1.5.0-1) ... 254s Setting up libubsan1:ppc64el (14.2.0-7ubuntu1) ... 254s Setting up zlib1g-dev:ppc64el (1:1.3.dfsg+really1.3.1-1ubuntu1) ... 254s Setting up librhash0:ppc64el (1.4.3-3build1) ... 254s Setting up libasan8:ppc64el (14.2.0-7ubuntu1) ... 254s Setting up git-man (1:2.45.2-1ubuntu1) ... 254s Setting up cmake-data (3.30.3-1) ... 254s Setting up libtsan2:ppc64el (14.2.0-7ubuntu1) ... 254s Setting up libjs-jquery (3.6.1+dfsg+~3.5.14-1) ... 254s Setting up libisl23:ppc64el (0.27-1) ... 254s Setting up python3-build (1.2.2-1) ... 254s Setting up python3-wheel-whl (0.44.0-1) ... 254s Setting up fonts-font-awesome (5.0.10+really4.7.0~dfsg-4.1) ... 254s Setting up sphinx-rtd-theme-common (3.0.1+dfsg-1) ... 254s Setting up libcc1-0:ppc64el (14.2.0-7ubuntu1) ... 254s Setting up liblsan0:ppc64el (14.2.0-7ubuntu1) ... 254s Setting up libitm1:ppc64el (14.2.0-7ubuntu1) ... 254s Setting up libjs-underscore (1.13.4~dfsg+~1.11.4-3) ... 254s Setting up python3-pytest (8.3.2-1) ... 255s Setting up python3-virtualenv (20.26.2+ds-1) ... 255s Setting up libpython3.12-dev:ppc64el (3.12.7-2) ... 255s Setting up python3.12-dev (3.12.7-2) ... 255s Setting up git (1:2.45.2-1ubuntu1) ... 255s Setting up cpp-14-powerpc64le-linux-gnu (14.2.0-7ubuntu1) ... 255s Setting up libjs-sphinxdoc (7.4.7-3) ... 255s Setting up cpp-14 (14.2.0-7ubuntu1) ... 255s Setting up python3-pytest-mock (3.14.0-1) ... 255s Setting up cmake (3.30.3-1) ... 255s Setting up libgcc-14-dev:ppc64el (14.2.0-7ubuntu1) ... 255s Setting up libstdc++-14-dev:ppc64el (14.2.0-7ubuntu1) ... 255s Setting up cpp-powerpc64le-linux-gnu (4:14.1.0-2ubuntu1) ... 255s Setting up gcc-14-powerpc64le-linux-gnu (14.2.0-7ubuntu1) ... 255s Setting up libpython3-dev:ppc64el (3.12.6-0ubuntu1) ... 255s Setting up g++-14-powerpc64le-linux-gnu (14.2.0-7ubuntu1) ... 255s Setting up python-skbuild-doc (0.18.1-1) ... 255s Setting up python3-skbuild (0.18.1-1) ... 255s Setting up gcc-14 (14.2.0-7ubuntu1) ... 255s Setting up gcc-powerpc64le-linux-gnu (4:14.1.0-2ubuntu1) ... 255s Setting up libpython3-all-dev:ppc64el (3.12.6-0ubuntu1) ... 255s Setting up python3-dev (3.12.6-0ubuntu1) ... 255s Setting up cpp (4:14.1.0-2ubuntu1) ... 255s Setting up g++-14 (14.2.0-7ubuntu1) ... 255s Setting up g++-powerpc64le-linux-gnu (4:14.1.0-2ubuntu1) ... 255s Setting up python3-all-dev (3.12.6-0ubuntu1) ... 255s Setting up gcc (4:14.1.0-2ubuntu1) ... 255s Setting up g++ (4:14.1.0-2ubuntu1) ... 255s update-alternatives: using /usr/bin/g++ to provide /usr/bin/c++ (c++) in auto mode 255s Setting up build-essential (12.10ubuntu1) ... 255s Setting up autopkgtest-satdep (0) ... 255s Processing triggers for man-db (2.12.1-3) ... 258s Processing triggers for libc-bin (2.40-1ubuntu3) ... 262s (Reading database ... 81820 files and directories currently installed.) 262s Removing autopkgtest-satdep (0) ... 263s autopkgtest [17:56:18]: test testsuite: [----------------------- 263s + cp -r tests /tmp/autopkgtest.vUjEXk/autopkgtest_tmp 263s + cp pyproject.toml /tmp/autopkgtest.vUjEXk/autopkgtest_tmp 263s + cd /tmp/autopkgtest.vUjEXk/autopkgtest_tmp 263s + py3versions -s 263s + python3.12 -m pytest -W ignore::DeprecationWarning -k not test_hello_sdist and not test_hello_sdist_with_base and not test_sdist_with_symlinks and not test_manifest_in_sdist and not test_generator_cleanup and not test_fortran and not test_pep518_findpython and not test_pep518 and not test_dual_pep518 and not test_hello_develop and not test_install_command and not test_help_commands and not test_test_command and not test_source_distribution and not test_wheel --ignore=tests/test_distribution.py 266s ============================= test session starts ============================== 266s platform linux -- Python 3.12.7+, pytest-8.3.2, pluggy-1.5.0 266s installed packages of interest: build==1.2.2 distro==1.9.0 packaging==24.1 pip==24.2 scikit-build==0.18.1 setuptools==75.2.0 virtualenv==20.26.2 wheel==0.44.0 266s No cmake3 executable found on PATH 266s /usr/bin/cmake: cmake version 3.30.3 266s No ninja executable found on PATH 266s rootdir: /tmp/autopkgtest.vUjEXk/autopkgtest_tmp 266s configfile: pyproject.toml 266s testpaths: tests 266s plugins: mock-3.14.0, typeguard-4.4.1 266s collected 238 items / 17 deselected / 1 skipped / 221 selected 266s 266s tests/test_broken_project.py FFFFFFF [ 3%] 266s tests/test_cmake_target.py F [ 3%] 267s tests/test_cmakelists_not_in_top_level_dir.py FFFF [ 5%] 272s tests/test_cmaker.py ............... [ 12%] 273s tests/test_command_line.py FFFFFFFFFFFFF [ 18%] 273s tests/test_constants.py . [ 18%] 273s tests/test_cython_flags.py F [ 19%] 273s tests/test_filter_manifest.py F [ 19%] 274s tests/test_hello_cpp.py FFFFF [ 21%] 274s tests/test_hello_cython.py FFF [ 23%] 274s tests/test_hello_pure.py FFFF [ 24%] 274s tests/test_include_exclude_data.py FF [ 25%] 275s tests/test_issue284_build_ext_inplace.py F [ 26%] 275s tests/test_issue335_support_cmake_source_dir.py F [ 26%] 275s tests/test_issue342_cmake_osx_args_in_setup.py FFFFFFFFF [ 30%] 275s tests/test_issue352_isolated_environment_support.py F [ 31%] 275s tests/test_issue668_symbol_visibility.py FF [ 32%] 275s tests/test_logging.py .. [ 33%] 275s tests/test_manifest_in.py F [ 33%] 275s tests/test_outside_project_root.py FFF [ 34%] 276s tests/test_platform.py .............s [ 41%] 278s tests/test_setup.py ....FFFFFFFFFFFFFF..........FFFFFFFFFFFFFFFFFFFFFFFF [ 64%] 279s FFFFFFFFFsssFsssFsssFsssFsssFsssFsssFsssFFFFF [ 85%] 280s tests/test_skbuild.py .sFFFssss [ 89%] 280s tests/test_skbuild_variable.py FFF [ 90%] 281s tests/test_utils.py ..................... [100%] 281s 281s =================================== FAILURES =================================== 281s ____________________ test_cmakelists_with_fatalerror_fails _____________________ 281s 281s capfd = <_pytest.capture.CaptureFixture object at 0x709a44779580> 281s 281s def test_cmakelists_with_fatalerror_fails(capfd): 281s with push_dir(): 281s 281s @project_setup_py_test("fail-with-fatal-error-cmakelists", ["build"], disable_languages_test=True) 281s def should_fail(): 281s pass 281s 281s with pytest.raises(SystemExit) as excinfo: 281s > should_fail() 281s 281s capfd = <_pytest.capture.CaptureFixture object at 0x709a44779580> 281s excinfo = 281s should_fail = .should_fail at 0x709a44507c40> 281s 281s tests/test_broken_project.py:31: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s tests/__init__.py:255: in wrapped 281s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 281s disable_languages_test = True 281s fun = .should_fail at 0x709a44507ba0> 281s iargs = () 281s ikwargs = {} 281s ret = False 281s wrapped = .should_fail at 0x709a44507c40> 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-0/should_fail0') 281s setup_args = ['build'], disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-0/should_fail0') 281s setup_args = ['build'] 281s 281s tests/__init__.py:218: AttributeError 281s ----------------------------- Captured stdout call ----------------------------- 281s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-0/should_fail0/.git/ 281s [master (root-commit) a25bd48] Initial commit 281s 2 files changed, 20 insertions(+) 281s create mode 100644 CMakeLists.txt 281s create mode 100644 setup.py 281s ----------------------------- Captured stderr call ----------------------------- 281s hint: Using 'master' as the name for the initial branch. This default branch name 281s hint: is subject to change. To configure the initial branch name to use in all 281s hint: of your new repositories, which will suppress this warning, call: 281s hint: 281s hint: git config --global init.defaultBranch 281s hint: 281s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 281s hint: 'development'. The just-created branch can be renamed via this command: 281s hint: 281s hint: git branch -m 281s ____________________ test_cmakelists_with_syntaxerror_fails ____________________ 281s 281s capfd = <_pytest.capture.CaptureFixture object at 0x709a4453a4e0> 281s 281s def test_cmakelists_with_syntaxerror_fails(capfd): 281s with push_dir(): 281s 281s @project_setup_py_test("fail-with-syntax-error-cmakelists", ["build"], disable_languages_test=True) 281s def should_fail(): 281s pass 281s 281s with pytest.raises(SystemExit) as excinfo: 281s > should_fail() 281s 281s capfd = <_pytest.capture.CaptureFixture object at 0x709a4453a4e0> 281s excinfo = 281s should_fail = .should_fail at 0x709a444b07c0> 281s 281s tests/test_broken_project.py:49: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s tests/__init__.py:255: in wrapped 281s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 281s disable_languages_test = True 281s fun = .should_fail at 0x709a444b0860> 281s iargs = () 281s ikwargs = {} 281s ret = False 281s wrapped = .should_fail at 0x709a444b07c0> 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-1/should_fail0') 281s setup_args = ['build'], disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-1/should_fail0') 281s setup_args = ['build'] 281s 281s tests/__init__.py:218: AttributeError 281s ----------------------------- Captured stdout call ----------------------------- 281s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-1/should_fail0/.git/ 281s [master (root-commit) 2c04f34] Initial commit 281s 2 files changed, 20 insertions(+) 281s create mode 100644 CMakeLists.txt 281s create mode 100644 setup.py 281s ----------------------------- Captured stderr call ----------------------------- 281s hint: Using 'master' as the name for the initial branch. This default branch name 281s hint: is subject to change. To configure the initial branch name to use in all 281s hint: of your new repositories, which will suppress this warning, call: 281s hint: 281s hint: git config --global init.defaultBranch 281s hint: 281s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 281s hint: 'development'. The just-created branch can be renamed via this command: 281s hint: 281s hint: git branch -m 281s ______________________ test_hello_with_compileerror_fails ______________________ 281s 281s capfd = <_pytest.capture.CaptureFixture object at 0x709a4453a0f0> 281s 281s def test_hello_with_compileerror_fails(capfd): 281s with push_dir(): 281s 281s @project_setup_py_test("fail-hello-with-compile-error", ["build"]) 281s def should_fail(): 281s pass 281s 281s with pytest.raises(SystemExit) as excinfo: 281s > should_fail() 281s 281s capfd = <_pytest.capture.CaptureFixture object at 0x709a4453a0f0> 281s excinfo = 281s should_fail = .should_fail at 0x709a444b0cc0> 281s 281s tests/test_broken_project.py:67: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s tests/__init__.py:255: in wrapped 281s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 281s disable_languages_test = False 281s fun = .should_fail at 0x709a444b0900> 281s iargs = () 281s ikwargs = {} 281s ret = False 281s wrapped = .should_fail at 0x709a444b0cc0> 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-2/should_fail0') 281s setup_args = ['build'], disable_languages_test = False 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = False 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-2/should_fail0') 281s setup_args = ['build'] 281s 281s tests/__init__.py:218: AttributeError 281s ----------------------------- Captured stdout call ----------------------------- 281s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-2/should_fail0/.git/ 281s [master (root-commit) 75f0733] Initial commit 281s 6 files changed, 97 insertions(+) 281s create mode 100644 CMakeLists.txt 281s create mode 100644 hello/CMakeLists.txt 281s create mode 100644 hello/__init__.py 281s create mode 100644 hello/__main__.py 281s create mode 100644 hello/_hello.cxx 281s create mode 100644 setup.py 281s ----------------------------- Captured stderr call ----------------------------- 281s hint: Using 'master' as the name for the initial branch. This default branch name 281s hint: is subject to change. To configure the initial branch name to use in all 281s hint: of your new repositories, which will suppress this warning, call: 281s hint: 281s hint: git config --global init.defaultBranch 281s hint: 281s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 281s hint: 'development'. The just-created branch can be renamed via this command: 281s hint: 281s hint: git branch -m 281s ____________________ test_invalid_cmake[CalledProcessError] ____________________ 281s 281s exception = 281s mocker = 281s 281s @pytest.mark.parametrize("exception", [CalledProcessError, OSError]) 281s def test_invalid_cmake(exception, mocker): 281s exceptions = { 281s OSError: OSError("Unknown error"), 281s CalledProcessError: CalledProcessError(1, [CMAKE_DEFAULT_EXECUTABLE, "--version"]), 281s } 281s 281s run_original = run 281s 281s def run_mock(*args, **kwargs): 281s if args[0] == [CMAKE_DEFAULT_EXECUTABLE, "--version"]: 281s raise exceptions[exception] 281s return run_original(*args, **kwargs) 281s 281s mocker.patch("skbuild.cmaker.subprocess.run", new=run_mock) 281s 281s with push_dir(): 281s 281s @project_setup_py_test("hello-no-language", ["build"], disable_languages_test=True) 281s def should_fail(): 281s pass 281s 281s with pytest.raises(SystemExit) as excinfo: 281s > should_fail() 281s 281s exception = 281s exceptions = {: OSError('Unknown error'), : CalledProcessError(1, ['/usr/bin/cmake', '--version'])} 281s excinfo = 281s mocker = 281s run_mock = .run_mock at 0x709a445072e0> 281s run_original = 281s should_fail = .should_fail at 0x709a444b0860> 281s 281s tests/test_broken_project.py:100: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s tests/__init__.py:255: in wrapped 281s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 281s disable_languages_test = True 281s fun = .should_fail at 0x709a444b07c0> 281s iargs = () 281s ikwargs = {} 281s ret = False 281s wrapped = .should_fail at 0x709a444b0860> 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-3/should_fail0') 281s setup_args = ['build'], disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-3/should_fail0') 281s setup_args = ['build'] 281s 281s tests/__init__.py:218: AttributeError 281s ----------------------------- Captured stdout call ----------------------------- 281s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-3/should_fail0/.git/ 281s [master (root-commit) 37bb92a] Initial commit 281s 2 files changed, 16 insertions(+) 281s create mode 100644 CMakeLists.txt 281s create mode 100644 setup.py 281s ----------------------------- Captured stderr call ----------------------------- 281s hint: Using 'master' as the name for the initial branch. This default branch name 281s hint: is subject to change. To configure the initial branch name to use in all 281s hint: of your new repositories, which will suppress this warning, call: 281s hint: 281s hint: git config --global init.defaultBranch 281s hint: 281s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 281s hint: 'development'. The just-created branch can be renamed via this command: 281s hint: 281s hint: git branch -m 281s _________________________ test_invalid_cmake[OSError] __________________________ 281s 281s exception = 281s mocker = 281s 281s @pytest.mark.parametrize("exception", [CalledProcessError, OSError]) 281s def test_invalid_cmake(exception, mocker): 281s exceptions = { 281s OSError: OSError("Unknown error"), 281s CalledProcessError: CalledProcessError(1, [CMAKE_DEFAULT_EXECUTABLE, "--version"]), 281s } 281s 281s run_original = run 281s 281s def run_mock(*args, **kwargs): 281s if args[0] == [CMAKE_DEFAULT_EXECUTABLE, "--version"]: 281s raise exceptions[exception] 281s return run_original(*args, **kwargs) 281s 281s mocker.patch("skbuild.cmaker.subprocess.run", new=run_mock) 281s 281s with push_dir(): 281s 281s @project_setup_py_test("hello-no-language", ["build"], disable_languages_test=True) 281s def should_fail(): 281s pass 281s 281s with pytest.raises(SystemExit) as excinfo: 281s > should_fail() 281s 281s exception = 281s exceptions = {: OSError('Unknown error'), : CalledProcessError(1, ['/usr/bin/cmake', '--version'])} 281s excinfo = 281s mocker = 281s run_mock = .run_mock at 0x709a444b1440> 281s run_original = 281s should_fail = .should_fail at 0x709a444b1760> 281s 281s tests/test_broken_project.py:100: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s tests/__init__.py:255: in wrapped 281s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 281s disable_languages_test = True 281s fun = .should_fail at 0x709a444b1620> 281s iargs = () 281s ikwargs = {} 281s ret = False 281s wrapped = .should_fail at 0x709a444b1760> 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-4/should_fail0') 281s setup_args = ['build'], disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-4/should_fail0') 281s setup_args = ['build'] 281s 281s tests/__init__.py:218: AttributeError 281s ----------------------------- Captured stdout call ----------------------------- 281s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-4/should_fail0/.git/ 281s [master (root-commit) 37bb92a] Initial commit 281s 2 files changed, 16 insertions(+) 281s create mode 100644 CMakeLists.txt 281s create mode 100644 setup.py 281s ----------------------------- Captured stderr call ----------------------------- 281s hint: Using 'master' as the name for the initial branch. This default branch name 281s hint: is subject to change. To configure the initial branch name to use in all 281s hint: of your new repositories, which will suppress this warning, call: 281s hint: 281s hint: git config --global init.defaultBranch 281s hint: 281s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 281s hint: 'development'. The just-created branch can be renamed via this command: 281s hint: 281s hint: git branch -m 281s _________________________ test_first_invalid_generator _________________________ 281s 281s mocker = 281s capfd = <_pytest.capture.CaptureFixture object at 0x709a4453be30> 281s 281s def test_first_invalid_generator(mocker, capfd): 281s platform = get_platform() 281s default_generators = [CMakeGenerator("Invalid")] 281s default_generators.extend(platform.default_generators) 281s mocker.patch.object( 281s type(platform), "default_generators", new_callable=mocker.PropertyMock, return_value=default_generators 281s ) 281s 281s mocker.patch("skbuild.cmaker.get_platform", return_value=platform) 281s 281s with push_dir(), push_env(CMAKE_GENERATOR=None): 281s 281s @project_setup_py_test("hello-no-language", ["build"]) 281s def run_build(): 281s pass 281s 281s > run_build() 281s 281s capfd = <_pytest.capture.CaptureFixture object at 0x709a4453be30> 281s default_generators = [, , ] 281s mocker = 281s platform = 281s run_build = .run_build at 0x709a444b2200> 281s 281s tests/test_broken_project.py:124: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s tests/__init__.py:255: in wrapped 281s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 281s disable_languages_test = False 281s fun = .run_build at 0x709a444b2160> 281s iargs = () 281s ikwargs = {} 281s ret = False 281s wrapped = .run_build at 0x709a444b2200> 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-5/run_build0') 281s setup_args = ['build'], disable_languages_test = False 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = False 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-5/run_build0') 281s setup_args = ['build'] 281s 281s tests/__init__.py:218: AttributeError 281s ----------------------------- Captured stdout call ----------------------------- 281s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-5/run_build0/.git/ 281s [master (root-commit) 37bb92a] Initial commit 281s 2 files changed, 16 insertions(+) 281s create mode 100644 CMakeLists.txt 281s create mode 100644 setup.py 281s ----------------------------- Captured stderr call ----------------------------- 281s hint: Using 'master' as the name for the initial branch. This default branch name 281s hint: is subject to change. To configure the initial branch name to use in all 281s hint: of your new repositories, which will suppress this warning, call: 281s hint: 281s hint: git config --global init.defaultBranch 281s hint: 281s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 281s hint: 'development'. The just-created branch can be renamed via this command: 281s hint: 281s hint: git branch -m 281s ____________________________ test_invalid_generator ____________________________ 281s 281s mocker = 281s capfd = <_pytest.capture.CaptureFixture object at 0x709a44583440> 281s 281s def test_invalid_generator(mocker, capfd): 281s platform = get_platform() 281s mocker.patch.object( 281s type(platform), "default_generators", new_callable=mocker.PropertyMock, return_value=[CMakeGenerator("Invalid")] 281s ) 281s mocker.patch("skbuild.cmaker.get_platform", return_value=platform) 281s 281s with push_dir(), push_env(CMAKE_GENERATOR=None): 281s 281s @project_setup_py_test("hello-no-language", ["build"]) 281s def should_fail(): 281s pass 281s 281s with pytest.raises(SystemExit) as excinfo: 281s > should_fail() 281s 281s capfd = <_pytest.capture.CaptureFixture object at 0x709a44583440> 281s excinfo = 281s mocker = 281s platform = 281s should_fail = .should_fail at 0x709a444b28e0> 281s 281s tests/test_broken_project.py:144: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s tests/__init__.py:255: in wrapped 281s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 281s disable_languages_test = False 281s fun = .should_fail at 0x709a444b2840> 281s iargs = () 281s ikwargs = {} 281s ret = False 281s wrapped = .should_fail at 0x709a444b28e0> 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-6/should_fail0') 281s setup_args = ['build'], disable_languages_test = False 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = False 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-6/should_fail0') 281s setup_args = ['build'] 281s 281s tests/__init__.py:218: AttributeError 281s ----------------------------- Captured stdout call ----------------------------- 281s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-6/should_fail0/.git/ 281s [master (root-commit) 37bb92a] Initial commit 281s 2 files changed, 16 insertions(+) 281s create mode 100644 CMakeLists.txt 281s create mode 100644 setup.py 281s ----------------------------- Captured stderr call ----------------------------- 281s hint: Using 'master' as the name for the initial branch. This default branch name 281s hint: is subject to change. To configure the initial branch name to use in all 281s hint: of your new repositories, which will suppress this warning, call: 281s hint: 281s hint: git config --global init.defaultBranch 281s hint: 281s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 281s hint: 'development'. The just-created branch can be renamed via this command: 281s hint: 281s hint: git branch -m 281s ___________________________ test_cmake_target_build ____________________________ 281s 281s iargs = () 281s ikwargs = {'capsys': <_pytest.capture.CaptureFixture object at 0x709a44581d00>} 281s 281s @functools.wraps(fun) 281s def wrapped(*iargs, **ikwargs): 281s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 281s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 281s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 281s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 281s 281s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 281s 281s disable_languages_test = True 281s fun = 281s iargs = () 281s ikwargs = {'capsys': <_pytest.capture.CaptureFixture object at 0x709a44581d00>} 281s ret = False 281s wrapped = 281s 281s tests/__init__.py:255: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-7/test_cmake_target_build0') 281s setup_args = ['build'], disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-7/test_cmake_target_build0') 281s setup_args = ['build'] 281s 281s tests/__init__.py:218: AttributeError 281s ----------------------------- Captured stdout call ----------------------------- 281s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-7/test_cmake_target_build0/.git/ 281s [master (root-commit) e548dd3] Initial commit 281s 2 files changed, 26 insertions(+) 281s create mode 100644 CMakeLists.txt 281s create mode 100644 setup.py 281s ----------------------------- Captured stderr call ----------------------------- 281s hint: Using 'master' as the name for the initial branch. This default branch name 281s hint: is subject to change. To configure the initial branch name to use in all 281s hint: of your new repositories, which will suppress this warning, call: 281s hint: 281s hint: git config --global init.defaultBranch 281s hint: 281s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 281s hint: 'development'. The just-created branch can be renamed via this command: 281s hint: 281s hint: git branch -m 281s __________________________________ test_build __________________________________ 281s 281s iargs = () 281s ikwargs = {'capsys': <_pytest.capture.CaptureFixture object at 0x709a44581040>} 281s 281s @functools.wraps(fun) 281s def wrapped(*iargs, **ikwargs): 281s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 281s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 281s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 281s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 281s 281s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 281s 281s disable_languages_test = True 281s fun = 281s iargs = () 281s ikwargs = {'capsys': <_pytest.capture.CaptureFixture object at 0x709a44581040>} 281s ret = False 281s wrapped = 281s 281s tests/__init__.py:255: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-8/test_build0') 281s setup_args = ['build'], disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-8/test_build0') 281s setup_args = ['build'] 281s 281s tests/__init__.py:218: AttributeError 281s ----------------------------- Captured stdout call ----------------------------- 281s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-8/test_build0/.git/ 281s [master (root-commit) 8166f14] Initial commit 281s 5 files changed, 94 insertions(+) 281s create mode 100644 hello/CMakeLists.txt 281s create mode 100644 hello/__init__.py 281s create mode 100644 hello/__main__.py 281s create mode 100644 hello/_hello.cxx 281s create mode 100644 setup.py 281s ----------------------------- Captured stderr call ----------------------------- 281s hint: Using 'master' as the name for the initial branch. This default branch name 281s hint: is subject to change. To configure the initial branch name to use in all 281s hint: of your new repositories, which will suppress this warning, call: 281s hint: 281s hint: git config --global init.defaultBranch 281s hint: 281s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 281s hint: 'development'. The just-created branch can be renamed via this command: 281s hint: 281s hint: git branch -m 281s _____________________ test_cmake_source_dir[invalid-True] ______________________ 281s 281s cmake_source_dir = 'invalid', expected_failed = True 281s 281s @pytest.mark.parametrize( 281s ("cmake_source_dir", "expected_failed"), 281s [ 281s ("invalid", True), 281s ("", False), 281s (".", False), 281s ], 281s ) 281s def test_cmake_source_dir(cmake_source_dir, expected_failed): 281s tmp_dir = _tmpdir("test_cmake_source_dir") 281s 281s tmp_dir.join("setup.py").write( 281s textwrap.dedent( 281s f""" 281s from skbuild import setup 281s setup( 281s name="test_cmake_source_dir", 281s version="1.2.3", 281s description="a minimal example package", 281s author='The scikit-build team', 281s license="MIT", 281s cmake_source_dir="{cmake_source_dir}" 281s ) 281s """ 281s ) 281s ) 281s 281s failed = False 281s message = "" 281s try: 281s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 281s 281s cmake_source_dir = 'invalid' 281s expected_failed = True 281s failed = False 281s message = '' 281s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-9/test_cmake_source_dir0') 281s 281s tests/test_cmakelists_not_in_top_level_dir.py:60: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-9/test_cmake_source_dir0') 281s setup_args = ['build'], disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-9/test_cmake_source_dir0') 281s setup_args = ['build'] 281s 281s tests/__init__.py:218: AttributeError 281s ________________________ test_cmake_source_dir[-False] _________________________ 281s 281s cmake_source_dir = '', expected_failed = False 281s 281s @pytest.mark.parametrize( 281s ("cmake_source_dir", "expected_failed"), 281s [ 281s ("invalid", True), 281s ("", False), 281s (".", False), 281s ], 281s ) 281s def test_cmake_source_dir(cmake_source_dir, expected_failed): 281s tmp_dir = _tmpdir("test_cmake_source_dir") 281s 281s tmp_dir.join("setup.py").write( 281s textwrap.dedent( 281s f""" 281s from skbuild import setup 281s setup( 281s name="test_cmake_source_dir", 281s version="1.2.3", 281s description="a minimal example package", 281s author='The scikit-build team', 281s license="MIT", 281s cmake_source_dir="{cmake_source_dir}" 281s ) 281s """ 281s ) 281s ) 281s 281s failed = False 281s message = "" 281s try: 281s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 281s 281s cmake_source_dir = '' 281s expected_failed = False 281s failed = False 281s message = '' 281s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-10/test_cmake_source_dir0') 281s 281s tests/test_cmakelists_not_in_top_level_dir.py:60: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-10/test_cmake_source_dir0') 281s setup_args = ['build'], disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-10/test_cmake_source_dir0') 281s setup_args = ['build'] 281s 281s tests/__init__.py:218: AttributeError 281s ________________________ test_cmake_source_dir[.-False] ________________________ 281s 281s cmake_source_dir = '.', expected_failed = False 281s 281s @pytest.mark.parametrize( 281s ("cmake_source_dir", "expected_failed"), 281s [ 281s ("invalid", True), 281s ("", False), 281s (".", False), 281s ], 281s ) 281s def test_cmake_source_dir(cmake_source_dir, expected_failed): 281s tmp_dir = _tmpdir("test_cmake_source_dir") 281s 281s tmp_dir.join("setup.py").write( 281s textwrap.dedent( 281s f""" 281s from skbuild import setup 281s setup( 281s name="test_cmake_source_dir", 281s version="1.2.3", 281s description="a minimal example package", 281s author='The scikit-build team', 281s license="MIT", 281s cmake_source_dir="{cmake_source_dir}" 281s ) 281s """ 281s ) 281s ) 281s 281s failed = False 281s message = "" 281s try: 281s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 281s 281s cmake_source_dir = '.' 281s expected_failed = False 281s failed = False 281s message = '' 281s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-11/test_cmake_source_dir0') 281s 281s tests/test_cmakelists_not_in_top_level_dir.py:60: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-11/test_cmake_source_dir0') 281s setup_args = ['build'], disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-11/test_cmake_source_dir0') 281s setup_args = ['build'] 281s 281s tests/__init__.py:218: AttributeError 281s __________________________________ test_help ___________________________________ 281s 281s iargs = () 281s ikwargs = {'capsys': <_pytest.capture.CaptureFixture object at 0x709a443ac2f0>} 281s 281s @functools.wraps(fun) 281s def wrapped(*iargs, **ikwargs): 281s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 281s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 281s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 281s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 281s 281s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 281s 281s disable_languages_test = True 281s fun = 281s iargs = () 281s ikwargs = {'capsys': <_pytest.capture.CaptureFixture object at 0x709a443ac2f0>} 281s ret = False 281s wrapped = 281s 281s tests/__init__.py:255: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-22/test_help0') 281s setup_args = ['--help'], disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-22/test_help0') 281s setup_args = ['--help'] 281s 281s tests/__init__.py:218: AttributeError 281s ----------------------------- Captured stdout call ----------------------------- 281s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-22/test_help0/.git/ 281s [master (root-commit) e807eff] Initial commit 281s 2 files changed, 16 insertions(+) 281s create mode 100644 CMakeLists.txt 281s create mode 100644 setup.py 281s ----------------------------- Captured stderr call ----------------------------- 281s hint: Using 'master' as the name for the initial branch. This default branch name 281s hint: is subject to change. To configure the initial branch name to use in all 281s hint: of your new repositories, which will suppress this warning, call: 281s hint: 281s hint: git config --global init.defaultBranch 281s hint: 281s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 281s hint: 'development'. The just-created branch can be renamed via this command: 281s hint: 281s hint: git branch -m 281s ____________________________ test_metadata_display _____________________________ 281s 281s iargs = () 281s ikwargs = {'capsys': <_pytest.capture.CaptureFixture object at 0x709a44579f10>} 281s 281s @functools.wraps(fun) 281s def wrapped(*iargs, **ikwargs): 281s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 281s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 281s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 281s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 281s 281s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 281s 281s disable_languages_test = True 281s fun = 281s iargs = () 281s ikwargs = {'capsys': <_pytest.capture.CaptureFixture object at 0x709a44579f10>} 281s ret = False 281s wrapped = 281s 281s tests/__init__.py:255: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-23/test_metadata_display0') 281s setup_args = ['--author', '--name'], disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-23/test_metadata_display0') 281s setup_args = ['--author', '--name'] 281s 281s tests/__init__.py:218: AttributeError 281s ----------------------------- Captured stdout call ----------------------------- 281s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-23/test_metadata_display0/.git/ 281s [master (root-commit) e807eff] Initial commit 281s 2 files changed, 16 insertions(+) 281s create mode 100644 CMakeLists.txt 281s create mode 100644 setup.py 281s ----------------------------- Captured stderr call ----------------------------- 281s hint: Using 'master' as the name for the initial branch. This default branch name 281s hint: is subject to change. To configure the initial branch name to use in all 281s hint: of your new repositories, which will suppress this warning, call: 281s hint: 281s hint: git config --global init.defaultBranch 281s hint: 281s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 281s hint: 'development'. The just-created branch can be renamed via this command: 281s hint: 281s hint: git branch -m 281s _______________________________ test_no_command ________________________________ 281s 281s def test_no_command(): 281s with push_dir(): 281s 281s @project_setup_py_test("hello-no-language", [], disable_languages_test=True) 281s def run(): 281s pass 281s 281s failed = False 281s try: 281s > run() 281s 281s failed = False 281s run = .run at 0x709a444b2980> 281s 281s tests/test_command_line.py:62: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s tests/__init__.py:255: in wrapped 281s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 281s disable_languages_test = True 281s fun = .run at 0x709a444b2a20> 281s iargs = () 281s ikwargs = {} 281s ret = False 281s wrapped = .run at 0x709a444b2980> 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-24/run0'), setup_args = [] 281s disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-24/run0') 281s setup_args = [] 281s 281s tests/__init__.py:218: AttributeError 281s ----------------------------- Captured stdout call ----------------------------- 281s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-24/run0/.git/ 281s [master (root-commit) e807eff] Initial commit 281s 2 files changed, 16 insertions(+) 281s create mode 100644 CMakeLists.txt 281s create mode 100644 setup.py 281s ----------------------------- Captured stderr call ----------------------------- 281s hint: Using 'master' as the name for the initial branch. This default branch name 281s hint: is subject to change. To configure the initial branch name to use in all 281s hint: of your new repositories, which will suppress this warning, call: 281s hint: 281s hint: git config --global init.defaultBranch 281s hint: 281s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 281s hint: 'development'. The just-created branch can be renamed via this command: 281s hint: 281s hint: git branch -m 281s _____________________________ test_invalid_command _____________________________ 281s 281s def test_invalid_command(): 281s with push_dir(): 281s 281s @project_setup_py_test("hello-no-language", ["unknown"], disable_languages_test=True) 281s def run(): 281s pass 281s 281s failed = False 281s try: 281s > run() 281s 281s failed = False 281s run = .run at 0x709a444b0d60> 281s 281s tests/test_command_line.py:79: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s tests/__init__.py:255: in wrapped 281s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 281s disable_languages_test = True 281s fun = .run at 0x709a444b0c20> 281s iargs = () 281s ikwargs = {} 281s ret = False 281s wrapped = .run at 0x709a444b0d60> 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-25/run0') 281s setup_args = ['unknown'], disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-25/run0') 281s setup_args = ['unknown'] 281s 281s tests/__init__.py:218: AttributeError 281s ----------------------------- Captured stdout call ----------------------------- 281s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-25/run0/.git/ 281s [master (root-commit) e807eff] Initial commit 281s 2 files changed, 16 insertions(+) 281s create mode 100644 CMakeLists.txt 281s create mode 100644 setup.py 281s ----------------------------- Captured stderr call ----------------------------- 281s hint: Using 'master' as the name for the initial branch. This default branch name 281s hint: is subject to change. To configure the initial branch name to use in all 281s hint: of your new repositories, which will suppress this warning, call: 281s hint: 281s hint: git config --global init.defaultBranch 281s hint: 281s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 281s hint: 'development'. The just-created branch can be renamed via this command: 281s hint: 281s hint: git branch -m 281s ___________________________ test_too_many_separators ___________________________ 281s 281s def test_too_many_separators(): 281s with push_dir(): 281s 281s @project_setup_py_test("hello-no-language", ["--"] * 3, disable_languages_test=True) 281s def run(): 281s pass 281s 281s failed = False 281s try: 281s > run() 281s 281s failed = False 281s run = .run at 0x709a444b3560> 281s 281s tests/test_command_line.py:96: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s tests/__init__.py:255: in wrapped 281s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 281s disable_languages_test = True 281s fun = .run at 0x709a444b2c00> 281s iargs = () 281s ikwargs = {} 281s ret = False 281s wrapped = .run at 0x709a444b3560> 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-26/run0') 281s setup_args = ['--', '--', '--'], disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-26/run0') 281s setup_args = ['--', '--', '--'] 281s 281s tests/__init__.py:218: AttributeError 281s ----------------------------- Captured stdout call ----------------------------- 281s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-26/run0/.git/ 281s [master (root-commit) a2867c5] Initial commit 281s 2 files changed, 16 insertions(+) 281s create mode 100644 CMakeLists.txt 281s create mode 100644 setup.py 281s ----------------------------- Captured stderr call ----------------------------- 281s hint: Using 'master' as the name for the initial branch. This default branch name 281s hint: is subject to change. To configure the initial branch name to use in all 281s hint: of your new repositories, which will suppress this warning, call: 281s hint: 281s hint: git config --global init.defaultBranch 281s hint: 281s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 281s hint: 'development'. The just-created branch can be renamed via this command: 281s hint: 281s hint: git branch -m 281s __________________ test_cmake_initial_cache_as_global_option ___________________ 281s 281s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-21/test_cmake_initial_cache_as_gl0') 281s 281s def test_cmake_initial_cache_as_global_option(tmpdir): 281s project = "hello-no-language" 281s prepare_project(project, tmpdir) 281s initialize_git_repo_and_commit(tmpdir, verbose=True) 281s 281s initial_cache = tmpdir.join("initial-cache.txt") 281s initial_cache.write("""set(MY_CMAKE_VARIABLE "1" CACHE BOOL "My cache variable")""") 281s 281s try: 281s > with execute_setup_py(tmpdir, [f"-C{initial_cache}", "build"], disable_languages_test=True): 281s 281s initial_cache = local('/tmp/pytest-of-ubuntu/pytest-21/test_cmake_initial_cache_as_gl0/initial-cache.txt') 281s project = 'hello-no-language' 281s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-21/test_cmake_initial_cache_as_gl0') 281s 281s tests/test_command_line.py:112: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-21/test_cmake_initial_cache_as_gl0') 281s setup_args = ['-C/tmp/pytest-of-ubuntu/pytest-21/test_cmake_initial_cache_as_gl0/initial-cache.txt', 'build'] 281s disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-21/test_cmake_initial_cache_as_gl0') 281s setup_args = ['-C/tmp/pytest-of-ubuntu/pytest-21/test_cmake_initial_cache_as_gl0/initial-cache.txt', 'build'] 281s 281s tests/__init__.py:218: AttributeError 281s ----------------------------- Captured stdout call ----------------------------- 281s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-21/test_cmake_initial_cache_as_gl0/.git/ 281s [master (root-commit) a2867c5] Initial commit 281s 2 files changed, 16 insertions(+) 281s create mode 100644 CMakeLists.txt 281s create mode 100644 setup.py 281s ----------------------------- Captured stderr call ----------------------------- 281s hint: Using 'master' as the name for the initial branch. This default branch name 281s hint: is subject to change. To configure the initial branch name to use in all 281s hint: of your new repositories, which will suppress this warning, call: 281s hint: 281s hint: git config --global init.defaultBranch 281s hint: 281s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 281s hint: 'development'. The just-created branch can be renamed via this command: 281s hint: 281s hint: git branch -m 281s __________________________ test_cmake_executable_arg ___________________________ 281s 281s def test_cmake_executable_arg(): 281s cmake_executable = "/path/to/invalid/cmake" 281s 281s @project_setup_py_test( 281s "hello-no-language", ["--cmake-executable", cmake_executable, "build"], disable_languages_test=True 281s ) 281s def should_fail(): 281s pass 281s 281s failed = False 281s message = "" 281s try: 281s > should_fail() 281s 281s cmake_executable = '/path/to/invalid/cmake' 281s failed = False 281s message = '' 281s should_fail = .should_fail at 0x709a444b2c00> 281s 281s tests/test_command_line.py:134: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s tests/__init__.py:255: in wrapped 281s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 281s disable_languages_test = True 281s fun = .should_fail at 0x709a444b05e0> 281s iargs = () 281s ikwargs = {} 281s ret = False 281s wrapped = .should_fail at 0x709a444b2c00> 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-27/should_fail0') 281s setup_args = ['--cmake-executable', '/path/to/invalid/cmake', 'build'] 281s disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-27/should_fail0') 281s setup_args = ['--cmake-executable', '/path/to/invalid/cmake', 'build'] 281s 281s tests/__init__.py:218: AttributeError 281s ----------------------------- Captured stdout call ----------------------------- 281s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-27/should_fail0/.git/ 281s [master (root-commit) a2867c5] Initial commit 281s 2 files changed, 16 insertions(+) 281s create mode 100644 CMakeLists.txt 281s create mode 100644 setup.py 281s ----------------------------- Captured stderr call ----------------------------- 281s hint: Using 'master' as the name for the initial branch. This default branch name 281s hint: is subject to change. To configure the initial branch name to use in all 281s hint: of your new repositories, which will suppress this warning, call: 281s hint: 281s hint: git config --global init.defaultBranch 281s hint: 281s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 281s hint: 'development'. The just-created branch can be renamed via this command: 281s hint: 281s hint: git branch -m 281s ________________________ test_hide_listing[True-sdist] _________________________ 281s 281s action = 'sdist', hide_listing = True 281s capfd = <_pytest.capture.CaptureFixture object at 0x709a443b24e0> 281s caplog = <_pytest.logging.LogCaptureFixture object at 0x709a443b3050> 281s 281s @pytest.mark.parametrize("action", ["sdist", "bdist_wheel"]) 281s @pytest.mark.parametrize("hide_listing", [True, False]) 281s def test_hide_listing(action, hide_listing, capfd, caplog): 281s cmd = [action] 281s if hide_listing: 281s cmd.insert(0, "--hide-listing") 281s 281s @project_setup_py_test("test-hide-listing", cmd, verbose_git=False, disable_languages_test=True) 281s def run(): 281s pass 281s 281s > run() 281s 281s action = 'sdist' 281s capfd = <_pytest.capture.CaptureFixture object at 0x709a443b24e0> 281s caplog = <_pytest.logging.LogCaptureFixture object at 0x709a443b3050> 281s cmd = ['--hide-listing', 'sdist'] 281s hide_listing = True 281s run = .run at 0x709a444b3240> 281s 281s tests/test_command_line.py:154: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s tests/__init__.py:255: in wrapped 281s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 281s disable_languages_test = True 281s fun = .run at 0x709a444b0d60> 281s iargs = () 281s ikwargs = {} 281s ret = False 281s wrapped = .run at 0x709a444b3240> 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-28/run0') 281s setup_args = ['--hide-listing', 'sdist'], disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-28/run0') 281s setup_args = ['--hide-listing', 'sdist'] 281s 281s tests/__init__.py:218: AttributeError 281s ----------------------------- Captured stderr call ----------------------------- 281s hint: Using 'master' as the name for the initial branch. This default branch name 281s hint: is subject to change. To configure the initial branch name to use in all 281s hint: of your new repositories, which will suppress this warning, call: 281s hint: 281s hint: git config --global init.defaultBranch 281s hint: 281s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 281s hint: 'development'. The just-created branch can be renamed via this command: 281s hint: 281s hint: git branch -m 281s _____________________ test_hide_listing[True-bdist_wheel] ______________________ 281s 281s action = 'bdist_wheel', hide_listing = True 281s capfd = <_pytest.capture.CaptureFixture object at 0x709a4453a360> 281s caplog = <_pytest.logging.LogCaptureFixture object at 0x709a44538290> 281s 281s @pytest.mark.parametrize("action", ["sdist", "bdist_wheel"]) 281s @pytest.mark.parametrize("hide_listing", [True, False]) 281s def test_hide_listing(action, hide_listing, capfd, caplog): 281s cmd = [action] 281s if hide_listing: 281s cmd.insert(0, "--hide-listing") 281s 281s @project_setup_py_test("test-hide-listing", cmd, verbose_git=False, disable_languages_test=True) 281s def run(): 281s pass 281s 281s > run() 281s 281s action = 'bdist_wheel' 281s capfd = <_pytest.capture.CaptureFixture object at 0x709a4453a360> 281s caplog = <_pytest.logging.LogCaptureFixture object at 0x709a44538290> 281s cmd = ['--hide-listing', 'bdist_wheel'] 281s hide_listing = True 281s run = .run at 0x709a444b13a0> 281s 281s tests/test_command_line.py:154: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s tests/__init__.py:255: in wrapped 281s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 281s disable_languages_test = True 281s fun = .run at 0x709a444b2660> 281s iargs = () 281s ikwargs = {} 281s ret = False 281s wrapped = .run at 0x709a444b13a0> 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-29/run0') 281s setup_args = ['--hide-listing', 'bdist_wheel'], disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-29/run0') 281s setup_args = ['--hide-listing', 'bdist_wheel'] 281s 281s tests/__init__.py:218: AttributeError 281s ----------------------------- Captured stderr call ----------------------------- 281s hint: Using 'master' as the name for the initial branch. This default branch name 281s hint: is subject to change. To configure the initial branch name to use in all 281s hint: of your new repositories, which will suppress this warning, call: 281s hint: 281s hint: git config --global init.defaultBranch 281s hint: 281s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 281s hint: 'development'. The just-created branch can be renamed via this command: 281s hint: 281s hint: git branch -m 281s ________________________ test_hide_listing[False-sdist] ________________________ 281s 281s action = 'sdist', hide_listing = False 281s capfd = <_pytest.capture.CaptureFixture object at 0x709a4453b080> 281s caplog = <_pytest.logging.LogCaptureFixture object at 0x709a4460ad20> 281s 281s @pytest.mark.parametrize("action", ["sdist", "bdist_wheel"]) 281s @pytest.mark.parametrize("hide_listing", [True, False]) 281s def test_hide_listing(action, hide_listing, capfd, caplog): 281s cmd = [action] 281s if hide_listing: 281s cmd.insert(0, "--hide-listing") 281s 281s @project_setup_py_test("test-hide-listing", cmd, verbose_git=False, disable_languages_test=True) 281s def run(): 281s pass 281s 281s > run() 281s 281s action = 'sdist' 281s capfd = <_pytest.capture.CaptureFixture object at 0x709a4453b080> 281s caplog = <_pytest.logging.LogCaptureFixture object at 0x709a4460ad20> 281s cmd = ['sdist'] 281s hide_listing = False 281s run = .run at 0x709a44506de0> 281s 281s tests/test_command_line.py:154: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s tests/__init__.py:255: in wrapped 281s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 281s disable_languages_test = True 281s fun = .run at 0x709a444b18a0> 281s iargs = () 281s ikwargs = {} 281s ret = False 281s wrapped = .run at 0x709a44506de0> 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-30/run0') 281s setup_args = ['sdist'], disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-30/run0') 281s setup_args = ['sdist'] 281s 281s tests/__init__.py:218: AttributeError 281s ----------------------------- Captured stderr call ----------------------------- 281s hint: Using 'master' as the name for the initial branch. This default branch name 281s hint: is subject to change. To configure the initial branch name to use in all 281s hint: of your new repositories, which will suppress this warning, call: 281s hint: 281s hint: git config --global init.defaultBranch 281s hint: 281s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 281s hint: 'development'. The just-created branch can be renamed via this command: 281s hint: 281s hint: git branch -m 281s _____________________ test_hide_listing[False-bdist_wheel] _____________________ 281s 281s action = 'bdist_wheel', hide_listing = False 281s capfd = <_pytest.capture.CaptureFixture object at 0x709a44538230> 281s caplog = <_pytest.logging.LogCaptureFixture object at 0x709a4460b470> 281s 281s @pytest.mark.parametrize("action", ["sdist", "bdist_wheel"]) 281s @pytest.mark.parametrize("hide_listing", [True, False]) 281s def test_hide_listing(action, hide_listing, capfd, caplog): 281s cmd = [action] 281s if hide_listing: 281s cmd.insert(0, "--hide-listing") 281s 281s @project_setup_py_test("test-hide-listing", cmd, verbose_git=False, disable_languages_test=True) 281s def run(): 281s pass 281s 281s > run() 281s 281s action = 'bdist_wheel' 281s capfd = <_pytest.capture.CaptureFixture object at 0x709a44538230> 281s caplog = <_pytest.logging.LogCaptureFixture object at 0x709a4460b470> 281s cmd = ['bdist_wheel'] 281s hide_listing = False 281s run = .run at 0x709a444b1da0> 281s 281s tests/test_command_line.py:154: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s tests/__init__.py:255: in wrapped 281s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 281s disable_languages_test = True 281s fun = .run at 0x709a444b1300> 281s iargs = () 281s ikwargs = {} 281s ret = False 281s wrapped = .run at 0x709a444b1da0> 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-31/run0') 281s setup_args = ['bdist_wheel'], disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-31/run0') 281s setup_args = ['bdist_wheel'] 281s 281s tests/__init__.py:218: AttributeError 281s ----------------------------- Captured stderr call ----------------------------- 281s hint: Using 'master' as the name for the initial branch. This default branch name 281s hint: is subject to change. To configure the initial branch name to use in all 281s hint: of your new repositories, which will suppress this warning, call: 281s hint: 281s hint: git config --global init.defaultBranch 281s hint: 281s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 281s hint: 'development'. The just-created branch can be renamed via this command: 281s hint: 281s hint: git branch -m 281s ______________________________ test_run_cmake_arg ______________________________ 281s 281s iargs = () 281s ikwargs = {'capfd': <_pytest.capture.CaptureFixture object at 0x709a443b0530>} 281s 281s @functools.wraps(fun) 281s def wrapped(*iargs, **ikwargs): 281s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 281s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 281s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 281s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 281s 281s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 281s 281s disable_languages_test = True 281s fun = 281s iargs = () 281s ikwargs = {'capfd': <_pytest.capture.CaptureFixture object at 0x709a443b0530>} 281s ret = False 281s wrapped = 281s 281s tests/__init__.py:255: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-32/test_run_cmake_arg0') 281s setup_args = ['--force-cmake', '--help'], disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-32/test_run_cmake_arg0') 281s setup_args = ['--force-cmake', '--help'] 281s 281s tests/__init__.py:218: AttributeError 281s ----------------------------- Captured stdout call ----------------------------- 281s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-32/test_run_cmake_arg0/.git/ 281s [master (root-commit) a2867c5] Initial commit 281s 2 files changed, 16 insertions(+) 281s create mode 100644 CMakeLists.txt 281s create mode 100644 setup.py 281s ----------------------------- Captured stderr call ----------------------------- 281s hint: Using 'master' as the name for the initial branch. This default branch name 281s hint: is subject to change. To configure the initial branch name to use in all 281s hint: of your new repositories, which will suppress this warning, call: 281s hint: 281s hint: git config --global init.defaultBranch 281s hint: 281s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 281s hint: 'development'. The just-created branch can be renamed via this command: 281s hint: 281s hint: git branch -m 281s _____________________________ test_skip_cmake_arg ______________________________ 281s 281s iargs = () 281s ikwargs = {'capfd': <_pytest.capture.CaptureFixture object at 0x709a445e5b80>} 281s 281s @functools.wraps(fun) 281s def wrapped(*iargs, **ikwargs): 281s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 281s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 281s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 281s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 281s 281s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 281s 281s disable_languages_test = True 281s fun = 281s iargs = () 281s ikwargs = {'capfd': <_pytest.capture.CaptureFixture object at 0x709a445e5b80>} 281s ret = False 281s wrapped = 281s 281s tests/__init__.py:255: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-33/test_skip_cmake_arg0') 281s setup_args = ['--skip-cmake', 'build'], disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-33/test_skip_cmake_arg0') 281s setup_args = ['--skip-cmake', 'build'] 281s 281s tests/__init__.py:218: AttributeError 281s ----------------------------- Captured stdout call ----------------------------- 281s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-33/test_skip_cmake_arg0/.git/ 281s [master (root-commit) a2867c5] Initial commit 281s 2 files changed, 16 insertions(+) 281s create mode 100644 CMakeLists.txt 281s create mode 100644 setup.py 281s ----------------------------- Captured stderr call ----------------------------- 281s hint: Using 'master' as the name for the initial branch. This default branch name 281s hint: is subject to change. To configure the initial branch name to use in all 281s hint: of your new repositories, which will suppress this warning, call: 281s hint: 281s hint: git config --global init.defaultBranch 281s hint: 281s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 281s hint: 'development'. The just-created branch can be renamed via this command: 281s hint: 281s hint: git branch -m 281s ___________________________ test_hello_cython_builds ___________________________ 281s 281s iargs = (), ikwargs = {} 281s 281s @functools.wraps(fun) 281s def wrapped(*iargs, **ikwargs): 281s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 281s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 281s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 281s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 281s 281s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 281s 281s disable_languages_test = False 281s fun = 281s iargs = () 281s ikwargs = {} 281s ret = False 281s wrapped = 281s 281s tests/__init__.py:255: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-34/test_hello_cython_builds0') 281s setup_args = ['build'], disable_languages_test = False 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = False 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-34/test_hello_cython_builds0') 281s setup_args = ['build'] 281s 281s tests/__init__.py:218: AttributeError 281s ----------------------------- Captured stdout call ----------------------------- 281s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-34/test_hello_cython_builds0/.git/ 281s [master (root-commit) 023b20f] Initial commit 281s 6 files changed, 40 insertions(+) 281s create mode 100644 CMakeLists.txt 281s create mode 100644 hello/CMakeLists.txt 281s create mode 100644 hello/__init__.py 281s create mode 100644 hello/__main__.py 281s create mode 100644 hello/_hello.pyx 281s create mode 100644 setup.py 281s ----------------------------- Captured stderr call ----------------------------- 281s hint: Using 'master' as the name for the initial branch. This default branch name 281s hint: is subject to change. To configure the initial branch name to use in all 281s hint: of your new repositories, which will suppress this warning, call: 281s hint: 281s hint: git config --global init.defaultBranch 281s hint: 281s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 281s hint: 'development'. The just-created branch can be renamed via this command: 281s hint: 281s hint: git branch -m 281s ___________________________ test_bdist_wheel_command ___________________________ 281s 281s def test_bdist_wheel_command(): 281s project = "test-filter-manifest" 281s 281s expected_content = [ 281s "hello/__init__.py", 281s "hello/swig_mwe.py", 281s "hello/_swig_mwe.pyd", 281s "hello-1.2.3.data/data/bin/hello", 281s ] 281s 281s expected_distribution_name = "hello-1.2.3" 281s 281s tmp_dir = _tmpdir("test_bdist_wheel_command") 281s prepare_project(project, tmp_dir) 281s initialize_git_repo_and_commit(tmp_dir, verbose=True) 281s 281s relative_setup_path = "wrapping/python/" 281s 281s > with execute_setup_py(tmp_dir.join(relative_setup_path), ["bdist_wheel"]): 281s 281s expected_content = ['hello/__init__.py', 'hello/swig_mwe.py', 'hello/_swig_mwe.pyd', 'hello-1.2.3.data/data/bin/hello'] 281s expected_distribution_name = 'hello-1.2.3' 281s project = 'test-filter-manifest' 281s relative_setup_path = 'wrapping/python/' 281s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-35/test_bdist_wheel_command0') 281s 281s tests/test_filter_manifest.py:27: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-35/test_bdist_wheel_command0/wrapping/python') 281s setup_args = ['bdist_wheel'], disable_languages_test = False 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = False 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-35/test_bdist_wheel_command0/wrapping/python') 281s setup_args = ['bdist_wheel'] 281s 281s tests/__init__.py:218: AttributeError 281s ----------------------------- Captured stdout call ----------------------------- 281s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-35/test_bdist_wheel_command0/.git/ 281s [master (root-commit) 33998c0] Initial commit 281s 4 files changed, 59 insertions(+) 281s create mode 100644 CMakeLists.txt 281s create mode 100644 wrapping/python/CMakeLists.txt 281s create mode 100644 wrapping/python/hello/__init__.py 281s create mode 100644 wrapping/python/setup.py 281s ----------------------------- Captured stderr call ----------------------------- 281s hint: Using 'master' as the name for the initial branch. This default branch name 281s hint: is subject to change. To configure the initial branch name to use in all 281s hint: of your new repositories, which will suppress this warning, call: 281s hint: 281s hint: git config --global init.defaultBranch 281s hint: 281s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 281s hint: 'development'. The just-created branch can be renamed via this command: 281s hint: 281s hint: git branch -m 281s ______________________________ test_hello_builds _______________________________ 281s 281s def test_hello_builds(): 281s with push_dir(): 281s 281s @project_setup_py_test("hello-cpp", ["build"], ret=True) 281s def run(): 281s pass 281s 281s # Check that a project can be build twice in a row 281s # See issue scikit-build#120 281s > tmp_dir = run()[0] 281s 281s run = .run at 0x709a444b05e0> 281s 281s tests/test_hello_cpp.py:30: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s tests/__init__.py:255: in wrapped 281s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 281s disable_languages_test = False 281s fun = .run at 0x709a444b2980> 281s iargs = () 281s ikwargs = {} 281s ret = True 281s wrapped = .run at 0x709a444b05e0> 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-36/run0') 281s setup_args = ['build'], disable_languages_test = False 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = False 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-36/run0') 281s setup_args = ['build'] 281s 281s tests/__init__.py:218: AttributeError 281s ----------------------------- Captured stdout call ----------------------------- 281s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-36/run0/.git/ 281s [master (root-commit) 6284268] Initial commit 281s 11 files changed, 115 insertions(+) 281s create mode 100644 CMakeLists.txt 281s create mode 100644 bonjour/__init__.py 281s create mode 100644 bonjour/data/ciel.txt 281s create mode 100644 bonjour/data/soleil.txt 281s create mode 100644 bonjour/data/terre.txt 281s create mode 100644 bonjourModule.py 281s create mode 100644 hello/CMakeLists.txt 281s create mode 100644 hello/__init__.py 281s create mode 100644 hello/__main__.py 281s create mode 100644 hello/_hello.cxx 281s create mode 100644 setup.py 281s ----------------------------- Captured stderr call ----------------------------- 281s hint: Using 'master' as the name for the initial branch. This default branch name 281s hint: is subject to change. To configure the initial branch name to use in all 281s hint: of your new repositories, which will suppress this warning, call: 281s hint: 281s hint: git config --global init.defaultBranch 281s hint: 281s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 281s hint: 'development'. The just-created branch can be renamed via this command: 281s hint: 281s hint: git branch -m 281s _______________________________ test_hello_wheel _______________________________ 281s 281s def test_hello_wheel(): 281s expected_content = [ 281s f"hello/_hello{get_ext_suffix()}", 281s "hello/__init__.py", 281s "hello/__main__.py", 281s "hello/world.py", 281s "helloModule.py", 281s "bonjour/__init__.py", 281s "bonjour/data/ciel.txt", 281s "bonjour/data/soleil.txt", 281s "bonjour/data/terre.txt", 281s "bonjourModule.py", 281s ] 281s 281s expected_distribution_name = "hello-1.2.3" 281s 281s @project_setup_py_test("hello-cpp", ["bdist_wheel"], ret=True) 281s def build_wheel(): 281s whls = glob.glob("dist/*.whl") 281s assert len(whls) == 1 281s check_wheel_content(whls[0], expected_distribution_name, expected_content) 281s os.remove(whls[0]) 281s assert not os.path.exists(whls[0]) 281s 281s assert os.path.exists(os.path.join(CMAKE_BUILD_DIR(), "CMakeCache.txt")) 281s os.remove(os.path.join(CMAKE_BUILD_DIR(), "CMakeCache.txt")) 281s 281s > tmp_dir = build_wheel()[0] 281s 281s build_wheel = .build_wheel at 0x709a4441ce00> 281s expected_content = ['hello/_hello.cpython-312-powerpc64le-linux-gnu.so', 'hello/__init__.py', 'hello/__main__.py', 'hello/world.py', 'helloModule.py', 'bonjour/__init__.py', ...] 281s expected_distribution_name = 'hello-1.2.3' 281s 281s tests/test_hello_cpp.py:93: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s tests/__init__.py:255: in wrapped 281s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 281s disable_languages_test = False 281s fun = .build_wheel at 0x709a4441d300> 281s iargs = () 281s ikwargs = {} 281s ret = True 281s wrapped = .build_wheel at 0x709a4441ce00> 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-37/build_wheel0') 281s setup_args = ['bdist_wheel'], disable_languages_test = False 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = False 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-37/build_wheel0') 281s setup_args = ['bdist_wheel'] 281s 281s tests/__init__.py:218: AttributeError 281s ----------------------------- Captured stdout call ----------------------------- 281s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-37/build_wheel0/.git/ 281s [master (root-commit) 6284268] Initial commit 281s 11 files changed, 115 insertions(+) 281s create mode 100644 CMakeLists.txt 281s create mode 100644 bonjour/__init__.py 281s create mode 100644 bonjour/data/ciel.txt 281s create mode 100644 bonjour/data/soleil.txt 281s create mode 100644 bonjour/data/terre.txt 281s create mode 100644 bonjourModule.py 281s create mode 100644 hello/CMakeLists.txt 281s create mode 100644 hello/__init__.py 281s create mode 100644 hello/__main__.py 281s create mode 100644 hello/_hello.cxx 281s create mode 100644 setup.py 281s ----------------------------- Captured stderr call ----------------------------- 281s hint: Using 'master' as the name for the initial branch. This default branch name 281s hint: is subject to change. To configure the initial branch name to use in all 281s hint: of your new repositories, which will suppress this warning, call: 281s hint: 281s hint: git config --global init.defaultBranch 281s hint: 281s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 281s hint: 'development'. The just-created branch can be renamed via this command: 281s hint: 281s hint: git branch -m 281s ________________________ test_hello_clean[with-dry-run] ________________________ 281s 281s dry_run = True 281s capfd = <_pytest.capture.CaptureFixture object at 0x709a44583650> 281s 281s @pytest.mark.parametrize("dry_run", ["with-dry-run", "without-dry-run"]) 281s def test_hello_clean(dry_run, capfd): 281s with push_dir(): 281s dry_run = dry_run == "with-dry-run" 281s 281s @project_setup_py_test("hello-cpp", ["build"], ret=True) 281s def run_build(): 281s pass 281s 281s > tmp_dir = run_build()[0] 281s 281s capfd = <_pytest.capture.CaptureFixture object at 0x709a44583650> 281s dry_run = True 281s run_build = .run_build at 0x709a4441d8a0> 281s 281s tests/test_hello_cpp.py:114: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s tests/__init__.py:255: in wrapped 281s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 281s disable_languages_test = False 281s fun = .run_build at 0x709a4441c0e0> 281s iargs = () 281s ikwargs = {} 281s ret = True 281s wrapped = .run_build at 0x709a4441d8a0> 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-38/run_build0') 281s setup_args = ['build'], disable_languages_test = False 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = False 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-38/run_build0') 281s setup_args = ['build'] 281s 281s tests/__init__.py:218: AttributeError 281s ----------------------------- Captured stdout call ----------------------------- 281s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-38/run_build0/.git/ 281s [master (root-commit) 6284268] Initial commit 281s 11 files changed, 115 insertions(+) 281s create mode 100644 CMakeLists.txt 281s create mode 100644 bonjour/__init__.py 281s create mode 100644 bonjour/data/ciel.txt 281s create mode 100644 bonjour/data/soleil.txt 281s create mode 100644 bonjour/data/terre.txt 281s create mode 100644 bonjourModule.py 281s create mode 100644 hello/CMakeLists.txt 281s create mode 100644 hello/__init__.py 281s create mode 100644 hello/__main__.py 281s create mode 100644 hello/_hello.cxx 281s create mode 100644 setup.py 281s ----------------------------- Captured stderr call ----------------------------- 281s hint: Using 'master' as the name for the initial branch. This default branch name 281s hint: is subject to change. To configure the initial branch name to use in all 281s hint: of your new repositories, which will suppress this warning, call: 281s hint: 281s hint: git config --global init.defaultBranch 281s hint: 281s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 281s hint: 'development'. The just-created branch can be renamed via this command: 281s hint: 281s hint: git branch -m 281s ______________________ test_hello_clean[without-dry-run] _______________________ 281s 281s dry_run = False 281s capfd = <_pytest.capture.CaptureFixture object at 0x709a443acb60> 281s 281s @pytest.mark.parametrize("dry_run", ["with-dry-run", "without-dry-run"]) 281s def test_hello_clean(dry_run, capfd): 281s with push_dir(): 281s dry_run = dry_run == "with-dry-run" 281s 281s @project_setup_py_test("hello-cpp", ["build"], ret=True) 281s def run_build(): 281s pass 281s 281s > tmp_dir = run_build()[0] 281s 281s capfd = <_pytest.capture.CaptureFixture object at 0x709a443acb60> 281s dry_run = False 281s run_build = .run_build at 0x709a4441dd00> 281s 281s tests/test_hello_cpp.py:114: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s tests/__init__.py:255: in wrapped 281s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 281s disable_languages_test = False 281s fun = .run_build at 0x709a4441db20> 281s iargs = () 281s ikwargs = {} 281s ret = True 281s wrapped = .run_build at 0x709a4441dd00> 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-39/run_build0') 281s setup_args = ['build'], disable_languages_test = False 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = False 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-39/run_build0') 281s setup_args = ['build'] 281s 281s tests/__init__.py:218: AttributeError 281s ----------------------------- Captured stdout call ----------------------------- 281s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-39/run_build0/.git/ 281s [master (root-commit) 54bcc1f] Initial commit 281s 11 files changed, 115 insertions(+) 281s create mode 100644 CMakeLists.txt 281s create mode 100644 bonjour/__init__.py 281s create mode 100644 bonjour/data/ciel.txt 281s create mode 100644 bonjour/data/soleil.txt 281s create mode 100644 bonjour/data/terre.txt 281s create mode 100644 bonjourModule.py 281s create mode 100644 hello/CMakeLists.txt 281s create mode 100644 hello/__init__.py 281s create mode 100644 hello/__main__.py 281s create mode 100644 hello/_hello.cxx 281s create mode 100644 setup.py 281s ----------------------------- Captured stderr call ----------------------------- 281s hint: Using 'master' as the name for the initial branch. This default branch name 281s hint: is subject to change. To configure the initial branch name to use in all 281s hint: of your new repositories, which will suppress this warning, call: 281s hint: 281s hint: git config --global init.defaultBranch 281s hint: 281s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 281s hint: 'development'. The just-created branch can be renamed via this command: 281s hint: 281s hint: git branch -m 281s ______________________________ test_hello_cleans _______________________________ 281s 281s capfd = <_pytest.capture.CaptureFixture object at 0x709a4453a480> 281s caplog = <_pytest.logging.LogCaptureFixture object at 0x709a443b2120> 281s 281s def test_hello_cleans(capfd, caplog): 281s with push_dir(): 281s tmp_dir = _tmpdir("test_hello_cleans") 281s 281s _copy_dir(tmp_dir, os.path.join(SAMPLES_DIR, "hello-cpp")) 281s 281s @project_setup_py_test("hello-cpp", ["build"], tmp_dir=tmp_dir) 281s def run_build(): 281s pass 281s 281s @project_setup_py_test("hello-cpp", ["clean"], tmp_dir=tmp_dir) 281s def run_clean(): 281s pass 281s 281s # Check that a project can be cleaned twice in a row 281s > run_build() 281s 281s capfd = <_pytest.capture.CaptureFixture object at 0x709a4453a480> 281s caplog = <_pytest.logging.LogCaptureFixture object at 0x709a443b2120> 281s run_build = .run_build at 0x709a444b05e0> 281s run_clean = .run_clean at 0x709a4441dda0> 281s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-40/test_hello_cleans0') 281s 281s tests/test_hello_cpp.py:158: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s tests/__init__.py:255: in wrapped 281s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 281s disable_languages_test = False 281s fun = .run_build at 0x709a444b2980> 281s iargs = () 281s ikwargs = {} 281s ret = False 281s wrapped = .run_build at 0x709a444b05e0> 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-40/test_hello_cleans0') 281s setup_args = ['build'], disable_languages_test = False 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = False 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-40/test_hello_cleans0') 281s setup_args = ['build'] 281s 281s tests/__init__.py:218: AttributeError 281s ___________________________ test_hello_cython_builds ___________________________ 281s 281s iargs = (), ikwargs = {} 281s 281s @functools.wraps(fun) 281s def wrapped(*iargs, **ikwargs): 281s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 281s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 281s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 281s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 281s 281s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 281s 281s disable_languages_test = False 281s fun = 281s iargs = () 281s ikwargs = {} 281s ret = False 281s wrapped = 281s 281s tests/__init__.py:255: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-41/test_hello_cython_builds0') 281s setup_args = ['build'], disable_languages_test = False 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = False 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-41/test_hello_cython_builds0') 281s setup_args = ['build'] 281s 281s tests/__init__.py:218: AttributeError 281s ----------------------------- Captured stdout call ----------------------------- 281s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-41/test_hello_cython_builds0/.git/ 281s [master (root-commit) b9483fb] Initial commit 281s 6 files changed, 42 insertions(+) 281s create mode 100644 CMakeLists.txt 281s create mode 100644 hello/CMakeLists.txt 281s create mode 100644 hello/__init__.py 281s create mode 100644 hello/__main__.py 281s create mode 100644 hello/_hello.pyx 281s create mode 100644 setup.py 281s ----------------------------- Captured stderr call ----------------------------- 281s hint: Using 'master' as the name for the initial branch. This default branch name 281s hint: is subject to change. To configure the initial branch name to use in all 281s hint: of your new repositories, which will suppress this warning, call: 281s hint: 281s hint: git config --global init.defaultBranch 281s hint: 281s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 281s hint: 'development'. The just-created branch can be renamed via this command: 281s hint: 281s hint: git branch -m 281s ___________________________ test_hello_cython_sdist ____________________________ 281s 281s iargs = (), ikwargs = {} 281s 281s @functools.wraps(fun) 281s def wrapped(*iargs, **ikwargs): 281s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 281s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 281s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 281s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 281s 281s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 281s 281s disable_languages_test = False 281s fun = 281s iargs = () 281s ikwargs = {} 281s ret = False 281s wrapped = 281s 281s tests/__init__.py:255: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-42/test_hello_cython_sdist0') 281s setup_args = ['sdist'], disable_languages_test = False 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = False 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-42/test_hello_cython_sdist0') 281s setup_args = ['sdist'] 281s 281s tests/__init__.py:218: AttributeError 281s ----------------------------- Captured stdout call ----------------------------- 281s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-42/test_hello_cython_sdist0/.git/ 281s [master (root-commit) b9483fb] Initial commit 281s 6 files changed, 42 insertions(+) 281s create mode 100644 CMakeLists.txt 281s create mode 100644 hello/CMakeLists.txt 281s create mode 100644 hello/__init__.py 281s create mode 100644 hello/__main__.py 281s create mode 100644 hello/_hello.pyx 281s create mode 100644 setup.py 281s ----------------------------- Captured stderr call ----------------------------- 281s hint: Using 'master' as the name for the initial branch. This default branch name 281s hint: is subject to change. To configure the initial branch name to use in all 281s hint: of your new repositories, which will suppress this warning, call: 281s hint: 281s hint: git config --global init.defaultBranch 281s hint: 281s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 281s hint: 'development'. The just-created branch can be renamed via this command: 281s hint: 281s hint: git branch -m 281s ___________________________ test_hello_cython_wheel ____________________________ 281s 281s iargs = (), ikwargs = {} 281s 281s @functools.wraps(fun) 281s def wrapped(*iargs, **ikwargs): 281s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 281s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 281s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 281s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 281s 281s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 281s 281s disable_languages_test = False 281s fun = 281s iargs = () 281s ikwargs = {} 281s ret = False 281s wrapped = 281s 281s tests/__init__.py:255: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-43/test_hello_cython_wheel0') 281s setup_args = ['bdist_wheel'], disable_languages_test = False 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = False 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-43/test_hello_cython_wheel0') 281s setup_args = ['bdist_wheel'] 281s 281s tests/__init__.py:218: AttributeError 281s ----------------------------- Captured stdout call ----------------------------- 281s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-43/test_hello_cython_wheel0/.git/ 281s [master (root-commit) b9483fb] Initial commit 281s 6 files changed, 42 insertions(+) 281s create mode 100644 CMakeLists.txt 281s create mode 100644 hello/CMakeLists.txt 281s create mode 100644 hello/__init__.py 281s create mode 100644 hello/__main__.py 281s create mode 100644 hello/_hello.pyx 281s create mode 100644 setup.py 281s ----------------------------- Captured stderr call ----------------------------- 281s hint: Using 'master' as the name for the initial branch. This default branch name 281s hint: is subject to change. To configure the initial branch name to use in all 281s hint: of your new repositories, which will suppress this warning, call: 281s hint: 281s hint: git config --global init.defaultBranch 281s hint: 281s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 281s hint: 'development'. The just-created branch can be renamed via this command: 281s hint: 281s hint: git branch -m 281s ____________________________ test_hello_pure_builds ____________________________ 281s 281s iargs = () 281s ikwargs = {'capsys': <_pytest.capture.CaptureFixture object at 0x709a44580110>} 281s 281s @functools.wraps(fun) 281s def wrapped(*iargs, **ikwargs): 281s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 281s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 281s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 281s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 281s 281s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 281s 281s disable_languages_test = True 281s fun = 281s iargs = () 281s ikwargs = {'capsys': <_pytest.capture.CaptureFixture object at 0x709a44580110>} 281s ret = False 281s wrapped = 281s 281s tests/__init__.py:255: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-44/test_hello_pure_builds0') 281s setup_args = ['build'], disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-44/test_hello_pure_builds0') 281s setup_args = ['build'] 281s 281s tests/__init__.py:218: AttributeError 281s ----------------------------- Captured stdout call ----------------------------- 281s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-44/test_hello_pure_builds0/.git/ 281s [master (root-commit) 22f5a5d] Initial commit 281s 2 files changed, 12 insertions(+) 281s create mode 100644 hello/__init__.py 281s create mode 100644 setup.py 281s ----------------------------- Captured stderr call ----------------------------- 281s hint: Using 'master' as the name for the initial branch. This default branch name 281s hint: is subject to change. To configure the initial branch name to use in all 281s hint: of your new repositories, which will suppress this warning, call: 281s hint: 281s hint: git config --global init.defaultBranch 281s hint: 281s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 281s hint: 'development'. The just-created branch can be renamed via this command: 281s hint: 281s hint: git branch -m 281s ____________________________ test_hello_pure_sdist _____________________________ 281s 281s iargs = (), ikwargs = {} 281s 281s @functools.wraps(fun) 281s def wrapped(*iargs, **ikwargs): 281s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 281s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 281s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 281s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 281s 281s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 281s 281s disable_languages_test = True 281s fun = 281s iargs = () 281s ikwargs = {} 281s ret = False 281s wrapped = 281s 281s tests/__init__.py:255: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-45/test_hello_pure_sdist0') 281s setup_args = ['sdist'], disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-45/test_hello_pure_sdist0') 281s setup_args = ['sdist'] 281s 281s tests/__init__.py:218: AttributeError 281s ----------------------------- Captured stdout call ----------------------------- 281s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-45/test_hello_pure_sdist0/.git/ 281s [master (root-commit) 22f5a5d] Initial commit 281s 2 files changed, 12 insertions(+) 281s create mode 100644 hello/__init__.py 281s create mode 100644 setup.py 281s ----------------------------- Captured stderr call ----------------------------- 281s hint: Using 'master' as the name for the initial branch. This default branch name 281s hint: is subject to change. To configure the initial branch name to use in all 281s hint: of your new repositories, which will suppress this warning, call: 281s hint: 281s hint: git config --global init.defaultBranch 281s hint: 281s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 281s hint: 'development'. The just-created branch can be renamed via this command: 281s hint: 281s hint: git branch -m 281s ____________________________ test_hello_pure_wheel _____________________________ 281s 281s iargs = (), ikwargs = {} 281s 281s @functools.wraps(fun) 281s def wrapped(*iargs, **ikwargs): 281s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 281s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 281s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 281s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 281s 281s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 281s 281s disable_languages_test = True 281s fun = 281s iargs = () 281s ikwargs = {} 281s ret = False 281s wrapped = 281s 281s tests/__init__.py:255: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-46/test_hello_pure_wheel0') 281s setup_args = ['bdist_wheel'], disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-46/test_hello_pure_wheel0') 281s setup_args = ['bdist_wheel'] 281s 281s tests/__init__.py:218: AttributeError 281s ----------------------------- Captured stdout call ----------------------------- 281s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-46/test_hello_pure_wheel0/.git/ 281s [master (root-commit) 22f5a5d] Initial commit 281s 2 files changed, 12 insertions(+) 281s create mode 100644 hello/__init__.py 281s create mode 100644 setup.py 281s ----------------------------- Captured stderr call ----------------------------- 281s hint: Using 'master' as the name for the initial branch. This default branch name 281s hint: is subject to change. To configure the initial branch name to use in all 281s hint: of your new repositories, which will suppress this warning, call: 281s hint: 281s hint: git config --global init.defaultBranch 281s hint: 281s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 281s hint: 'development'. The just-created branch can be renamed via this command: 281s hint: 281s hint: git branch -m 281s _______________________________ test_hello_clean _______________________________ 281s 281s capfd = <_pytest.capture.CaptureFixture object at 0x709a445381a0> 281s 281s def test_hello_clean(capfd): 281s with push_dir(): 281s 281s @project_setup_py_test("hello-pure", ["build"], disable_languages_test=True, ret=True) 281s def run_build(): 281s pass 281s 281s > tmp_dir = run_build()[0] 281s 281s capfd = <_pytest.capture.CaptureFixture object at 0x709a445381a0> 281s run_build = .run_build at 0x709a4441e980> 281s 281s tests/test_hello_pure.py:65: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s tests/__init__.py:255: in wrapped 281s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 281s disable_languages_test = True 281s fun = .run_build at 0x709a4441dda0> 281s iargs = () 281s ikwargs = {} 281s ret = True 281s wrapped = .run_build at 0x709a4441e980> 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-47/run_build0') 281s setup_args = ['build'], disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-47/run_build0') 281s setup_args = ['build'] 281s 281s tests/__init__.py:218: AttributeError 281s ----------------------------- Captured stdout call ----------------------------- 281s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-47/run_build0/.git/ 281s [master (root-commit) 22f5a5d] Initial commit 281s 2 files changed, 12 insertions(+) 281s create mode 100644 hello/__init__.py 281s create mode 100644 setup.py 281s ----------------------------- Captured stderr call ----------------------------- 281s hint: Using 'master' as the name for the initial branch. This default branch name 281s hint: is subject to change. To configure the initial branch name to use in all 281s hint: of your new repositories, which will suppress this warning, call: 281s hint: 281s hint: git config --global init.defaultBranch 281s hint: 281s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 281s hint: 'development'. The just-created branch can be renamed via this command: 281s hint: 281s hint: git branch -m 281s __________________________ test_include_exclude_data ___________________________ 281s 281s iargs = (), ikwargs = {} 281s 281s @functools.wraps(fun) 281s def wrapped(*iargs, **ikwargs): 281s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 281s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 281s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 281s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 281s 281s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 281s 281s disable_languages_test = False 281s fun = 281s iargs = () 281s ikwargs = {} 281s ret = False 281s wrapped = 281s 281s tests/__init__.py:255: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-48/test_include_exclude_data0') 281s setup_args = ['bdist_wheel'], disable_languages_test = False 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = False 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-48/test_include_exclude_data0') 281s setup_args = ['bdist_wheel'] 281s 281s tests/__init__.py:218: AttributeError 281s ----------------------------- Captured stdout call ----------------------------- 281s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-48/test_include_exclude_data0/.git/ 281s [master (root-commit) f73c55d] Initial commit 281s 15 files changed, 79 insertions(+) 281s create mode 100644 CMakeLists.txt 281s create mode 100644 MANIFEST.in 281s create mode 100644 hello/__init__.py 281s create mode 100644 hello/data/subdata/hello_data1_include_from_manifest.txt 281s create mode 100644 hello/data/subdata/hello_data2_include_from_manifest.txt 281s create mode 100644 hello/data/subdata/hello_data3_include_from_manifest_and_exclude_from_manifest.txt 281s create mode 100644 hello/data/subdata/hello_data4_include_from_manifest_and_exclude_from_setup.txt 281s create mode 100644 hello/hello_include_from_manifest.txt 281s create mode 100644 hello2/__init__.py 281s create mode 100644 hello2/data2/subdata2/hello2_data1_include_from_manifest.txt 281s create mode 100644 hello2/data2/subdata2/hello2_data2_include_from_manifest.txt 281s create mode 100644 hello2/data2/subdata2/hello2_data3_include_from_manifest_and_exclude_from_manifest.txt 281s create mode 100644 hello2/data2/subdata2/hello2_data4_include_from_manifest_and_exclude_from_setup.txt 281s create mode 100644 hello2/hello2_include_from_manifest.txt 281s create mode 100644 setup.py 281s ----------------------------- Captured stderr call ----------------------------- 281s hint: Using 'master' as the name for the initial branch. This default branch name 281s hint: is subject to change. To configure the initial branch name to use in all 281s hint: of your new repositories, which will suppress this warning, call: 281s hint: 281s hint: git config --global init.defaultBranch 281s hint: 281s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 281s hint: 'development'. The just-created branch can be renamed via this command: 281s hint: 281s hint: git branch -m 281s _____________________ test_include_exclude_data_with_base ______________________ 281s 281s iargs = (), ikwargs = {} 281s 281s @functools.wraps(fun) 281s def wrapped(*iargs, **ikwargs): 281s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 281s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 281s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 281s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 281s 281s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 281s 281s disable_languages_test = False 281s fun = 281s iargs = () 281s ikwargs = {} 281s ret = False 281s wrapped = 281s 281s tests/__init__.py:255: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-49/test_include_exclude_data_with0') 281s setup_args = ['bdist_wheel'], disable_languages_test = False 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = False 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-49/test_include_exclude_data_with0') 281s setup_args = ['bdist_wheel'] 281s 281s tests/__init__.py:218: AttributeError 281s ----------------------------- Captured stdout call ----------------------------- 281s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-49/test_include_exclude_data_with0/.git/ 281s [master (root-commit) d7976e7] Initial commit 281s 15 files changed, 80 insertions(+) 281s create mode 100644 CMakeLists.txt 281s create mode 100644 MANIFEST.in 281s create mode 100644 setup.py 281s create mode 100644 src/hello/__init__.py 281s create mode 100644 src/hello/data/subdata/hello_data1_include_from_manifest.txt 281s create mode 100644 src/hello/data/subdata/hello_data2_include_from_manifest.txt 281s create mode 100644 src/hello/data/subdata/hello_data3_include_from_manifest_and_exclude_from_manifest.txt 281s create mode 100644 src/hello/data/subdata/hello_data4_include_from_manifest_and_exclude_from_setup.txt 281s create mode 100644 src/hello/hello_include_from_manifest.txt 281s create mode 100644 src/hello2/__init__.py 281s create mode 100644 src/hello2/data2/subdata2/hello2_data1_include_from_manifest.txt 281s create mode 100644 src/hello2/data2/subdata2/hello2_data2_include_from_manifest.txt 281s create mode 100644 src/hello2/data2/subdata2/hello2_data3_include_from_manifest_and_exclude_from_manifest.txt 281s create mode 100644 src/hello2/data2/subdata2/hello2_data4_include_from_manifest_and_exclude_from_setup.txt 281s create mode 100644 src/hello2/hello2_include_from_manifest.txt 281s ----------------------------- Captured stderr call ----------------------------- 281s hint: Using 'master' as the name for the initial branch. This default branch name 281s hint: is subject to change. To configure the initial branch name to use in all 281s hint: of your new repositories, which will suppress this warning, call: 281s hint: 281s hint: git config --global init.defaultBranch 281s hint: 281s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 281s hint: 'development'. The just-created branch can be renamed via this command: 281s hint: 281s hint: git branch -m 281s ________________________ test_build_ext_inplace_command ________________________ 281s 281s iargs = (), ikwargs = {} 281s 281s @functools.wraps(fun) 281s def wrapped(*iargs, **ikwargs): 281s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 281s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 281s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 281s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 281s 281s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 281s 281s disable_languages_test = True 281s fun = 281s iargs = () 281s ikwargs = {} 281s ret = False 281s wrapped = 281s 281s tests/__init__.py:255: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-50/test_build_ext_inplace_command0') 281s setup_args = ['build_ext', '--inplace'], disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-50/test_build_ext_inplace_command0') 281s setup_args = ['build_ext', '--inplace'] 281s 281s tests/__init__.py:218: AttributeError 281s ----------------------------- Captured stdout call ----------------------------- 281s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-50/test_build_ext_inplace_command0/.git/ 281s [master (root-commit) 3643264] Initial commit 281s 5 files changed, 160 insertions(+) 281s create mode 100644 CMakeLists.txt 281s create mode 100644 hello/__init__.py 281s create mode 100644 hello/_hello_ext.cxx 281s create mode 100644 hello/_hello_sk.cxx 281s create mode 100644 setup.py 281s ----------------------------- Captured stderr call ----------------------------- 281s hint: Using 'master' as the name for the initial branch. This default branch name 281s hint: is subject to change. To configure the initial branch name to use in all 281s hint: of your new repositories, which will suppress this warning, call: 281s hint: 281s hint: git config --global init.defaultBranch 281s hint: 281s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 281s hint: 'development'. The just-created branch can be renamed via this command: 281s hint: 281s hint: git branch -m 281s ___________________________ test_bdist_wheel_command ___________________________ 281s 281s def test_bdist_wheel_command(): 281s project = "issue-335-support-cmake-source-dir" 281s 281s expected_content = [ 281s "hello/__init__.py", 281s "hello/swig_mwe.py", 281s "hello/_swig_mwe.pyd", 281s "hello-1.2.3.data/data/bin/hello", 281s "hello-1.2.3.data/data/lib/static/libbar.a", 281s "hello-1.2.3.data/data/lib/static/libfoo.a", 281s "hello-1.2.3.data/data/include/bar.h", 281s "hello-1.2.3.data/data/include/foo.h", 281s ] 281s 281s expected_distribution_name = "hello-1.2.3" 281s 281s tmp_dir = _tmpdir("test_bdist_wheel_command") 281s prepare_project(project, tmp_dir) 281s initialize_git_repo_and_commit(tmp_dir, verbose=True) 281s 281s relative_setup_path = "wrapping/python/" 281s 281s > with execute_setup_py(tmp_dir.join(relative_setup_path), ["bdist_wheel"]): 281s 281s expected_content = ['hello/__init__.py', 'hello/swig_mwe.py', 'hello/_swig_mwe.pyd', 'hello-1.2.3.data/data/bin/hello', 'hello-1.2.3.data/data/lib/static/libbar.a', 'hello-1.2.3.data/data/lib/static/libfoo.a', ...] 281s expected_distribution_name = 'hello-1.2.3' 281s project = 'issue-335-support-cmake-source-dir' 281s relative_setup_path = 'wrapping/python/' 281s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-51/test_bdist_wheel_command0') 281s 281s tests/test_issue335_support_cmake_source_dir.py:31: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-51/test_bdist_wheel_command0/wrapping/python') 281s setup_args = ['bdist_wheel'], disable_languages_test = False 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = False 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-51/test_bdist_wheel_command0/wrapping/python') 281s setup_args = ['bdist_wheel'] 281s 281s tests/__init__.py:218: AttributeError 281s ----------------------------- Captured stdout call ----------------------------- 281s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-51/test_bdist_wheel_command0/.git/ 281s [master (root-commit) ee32ece] Initial commit 281s 4 files changed, 52 insertions(+) 281s create mode 100644 CMakeLists.txt 281s create mode 100644 wrapping/python/CMakeLists.txt 281s create mode 100644 wrapping/python/hello/__init__.py 281s create mode 100644 wrapping/python/setup.py 281s ----------------------------- Captured stderr call ----------------------------- 281s hint: Using 'master' as the name for the initial branch. This default branch name 281s hint: is subject to change. To configure the initial branch name to use in all 281s hint: of your new repositories, which will suppress this warning, call: 281s hint: 281s hint: git config --global init.defaultBranch 281s hint: 281s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 281s hint: 'development'. The just-created branch can be renamed via this command: 281s hint: 281s hint: git branch -m 281s _ test_cmake_args_keyword_osx_default[None-cli_setup_args0-keyword_cmake_args0-cli_cmake_args0-10.9] _ 281s 281s osx_deployment_target_env_var = None, cli_setup_args = [] 281s keyword_cmake_args = [], cli_cmake_args = [] 281s expected_cmake_osx_deployment_target = '10.9' 281s mocker = 281s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x709a443aea80> 281s 281s @pytest.mark.parametrize( 281s params, 281s [ 281s # default plat_name is 'macosx-10.9-x86_64' 281s ( 281s # osx_deployment_target_env_var 281s None, 281s # cli_setup_args 281s [], 281s # keyword_cmake_args 281s [], 281s # cli_cmake_args 281s [], 281s # expected_cmake_osx_deployment_target 281s "10.9", 281s ), 281s ( 281s # osx_deployment_target_env_var 281s "10.7", 281s # cli_setup_args 281s [], 281s # keyword_cmake_args 281s [], 281s # cli_cmake_args 281s [], 281s # expected_cmake_osx_deployment_target 281s "10.7", 281s ), 281s ( 281s # osx_deployment_target_env_var 281s "10.7", 281s # cli_setup_args 281s ["--plat-name", "macosx-10.9-x86_64"], 281s # keyword_cmake_args 281s [], 281s # cli_cmake_args 281s [], 281s # expected_cmake_osx_deployment_target 281s "10.9", 281s ), 281s ( 281s # osx_deployment_target_env_var 281s None, 281s # cli_setup_args 281s ["--plat-name", "macosx-10.6-x86_64"], 281s # keyword_cmake_args 281s [], 281s # cli_cmake_args 281s [], 281s # expected_cmake_osx_deployment_target 281s "10.6", 281s ), 281s ( 281s # osx_deployment_target_env_var 281s None, 281s # cli_setup_args 281s ["--plat-name", "macosx-10.7-x86_64"], 281s # keyword_cmake_args 281s [], 281s # cli_cmake_args 281s [], 281s # expected_cmake_osx_deployment_target 281s "10.7", 281s ), 281s ( 281s # osx_deployment_target_env_var 281s None, 281s # cli_setup_args 281s [], 281s # keyword_cmake_args 281s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 281s # cli_cmake_args 281s [], 281s # expected_cmake_osx_deployment_target 281s "10.7", 281s ), 281s ( 281s # osx_deployment_target_env_var 281s None, 281s # cli_setup_args 281s ["--plat-name", "macosx-10.12-x86_64"], 281s # keyword_cmake_args 281s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 281s # cli_cmake_args 281s [], 281s # expected_cmake_osx_deployment_target 281s "10.7", 281s ), 281s ( 281s # osx_deployment_target_env_var 281s None, 281s # cli_setup_args 281s [], 281s # keyword_cmake_args 281s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 281s # cli_cmake_args 281s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 281s # expected_cmake_osx_deployment_target 281s "10.8", 281s ), 281s ( 281s # osx_deployment_target_env_var 281s None, 281s # cli_setup_args 281s ["--plat-name", "macosx-10.12-x86_64"], 281s # keyword_cmake_args 281s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 281s # cli_cmake_args 281s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 281s # expected_cmake_osx_deployment_target 281s "10.8", 281s ), 281s ], 281s ) 281s def test_cmake_args_keyword_osx_default( 281s osx_deployment_target_env_var, 281s cli_setup_args, 281s keyword_cmake_args, 281s cli_cmake_args, 281s expected_cmake_osx_deployment_target, 281s mocker, 281s monkeypatch, 281s ): 281s tmp_dir = _tmpdir("cmake_args_keyword_osx_default") 281s 281s tmp_dir.join("setup.py").write( 281s textwrap.dedent( 281s """ 281s from skbuild import setup 281s setup( 281s name="test_cmake_args_keyword_osx_default", 281s version="1.2.3", 281s description="A minimal example package", 281s author="The scikit-build team", 281s license="MIT", 281s cmake_args=[{cmake_args}] 281s ) 281s """.format(cmake_args=",".join([f"'{arg}'" for arg in keyword_cmake_args])) 281s ) 281s ) 281s tmp_dir.join("CMakeLists.txt").write( 281s textwrap.dedent( 281s """ 281s message(FATAL_ERROR "This error message should not be displayed") 281s """ 281s ) 281s ) 281s 281s mock_configure = mocker.patch("skbuild.cmaker.CMaker.configure", side_effect=RuntimeError("exit skbuild")) 281s 281s monkeypatch.setattr(platform, "mac_ver", lambda: ("10.9", None, "x84_64")) 281s monkeypatch.setattr(platform, "machine", lambda: "x86_64") 281s monkeypatch.setattr(sys, "platform", "darwin") 281s 281s with push_env(MACOSX_DEPLOYMENT_TARGET=osx_deployment_target_env_var): 281s monkeypatch.setattr(skbuild.constants, "_SKBUILD_PLAT_NAME", skbuild.constants._default_skbuild_plat_name()) 281s with pytest.raises(RuntimeError, match="exit skbuild"): 281s > with execute_setup_py(tmp_dir, ["build", *cli_setup_args, "--", *cli_cmake_args]): 281s 281s cli_cmake_args = [] 281s cli_setup_args = [] 281s expected_cmake_osx_deployment_target = '10.9' 281s keyword_cmake_args = [] 281s mock_configure = 281s mocker = 281s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x709a443aea80> 281s osx_deployment_target_env_var = None 281s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-52/cmake_args_keyword_osx_default0') 281s 281s tests/test_issue342_cmake_osx_args_in_setup.py:176: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-52/cmake_args_keyword_osx_default0') 281s setup_args = ['build', '--'], disable_languages_test = False 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = False 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-52/cmake_args_keyword_osx_default0') 281s setup_args = ['build', '--'] 281s 281s tests/__init__.py:218: AttributeError 281s _ test_cmake_args_keyword_osx_default[10.7-cli_setup_args1-keyword_cmake_args1-cli_cmake_args1-10.7] _ 281s 281s osx_deployment_target_env_var = '10.7', cli_setup_args = [] 281s keyword_cmake_args = [], cli_cmake_args = [] 281s expected_cmake_osx_deployment_target = '10.7' 281s mocker = 281s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x709a443b8d40> 281s 281s @pytest.mark.parametrize( 281s params, 281s [ 281s # default plat_name is 'macosx-10.9-x86_64' 281s ( 281s # osx_deployment_target_env_var 281s None, 281s # cli_setup_args 281s [], 281s # keyword_cmake_args 281s [], 281s # cli_cmake_args 281s [], 281s # expected_cmake_osx_deployment_target 281s "10.9", 281s ), 281s ( 281s # osx_deployment_target_env_var 281s "10.7", 281s # cli_setup_args 281s [], 281s # keyword_cmake_args 281s [], 281s # cli_cmake_args 281s [], 281s # expected_cmake_osx_deployment_target 281s "10.7", 281s ), 281s ( 281s # osx_deployment_target_env_var 281s "10.7", 281s # cli_setup_args 281s ["--plat-name", "macosx-10.9-x86_64"], 281s # keyword_cmake_args 281s [], 281s # cli_cmake_args 281s [], 281s # expected_cmake_osx_deployment_target 281s "10.9", 281s ), 281s ( 281s # osx_deployment_target_env_var 281s None, 281s # cli_setup_args 281s ["--plat-name", "macosx-10.6-x86_64"], 281s # keyword_cmake_args 281s [], 281s # cli_cmake_args 281s [], 281s # expected_cmake_osx_deployment_target 281s "10.6", 281s ), 281s ( 281s # osx_deployment_target_env_var 281s None, 281s # cli_setup_args 281s ["--plat-name", "macosx-10.7-x86_64"], 281s # keyword_cmake_args 281s [], 281s # cli_cmake_args 281s [], 281s # expected_cmake_osx_deployment_target 281s "10.7", 281s ), 281s ( 281s # osx_deployment_target_env_var 281s None, 281s # cli_setup_args 281s [], 281s # keyword_cmake_args 281s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 281s # cli_cmake_args 281s [], 281s # expected_cmake_osx_deployment_target 281s "10.7", 281s ), 281s ( 281s # osx_deployment_target_env_var 281s None, 281s # cli_setup_args 281s ["--plat-name", "macosx-10.12-x86_64"], 281s # keyword_cmake_args 281s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 281s # cli_cmake_args 281s [], 281s # expected_cmake_osx_deployment_target 281s "10.7", 281s ), 281s ( 281s # osx_deployment_target_env_var 281s None, 281s # cli_setup_args 281s [], 281s # keyword_cmake_args 281s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 281s # cli_cmake_args 281s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 281s # expected_cmake_osx_deployment_target 281s "10.8", 281s ), 281s ( 281s # osx_deployment_target_env_var 281s None, 281s # cli_setup_args 281s ["--plat-name", "macosx-10.12-x86_64"], 281s # keyword_cmake_args 281s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 281s # cli_cmake_args 281s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 281s # expected_cmake_osx_deployment_target 281s "10.8", 281s ), 281s ], 281s ) 281s def test_cmake_args_keyword_osx_default( 281s osx_deployment_target_env_var, 281s cli_setup_args, 281s keyword_cmake_args, 281s cli_cmake_args, 281s expected_cmake_osx_deployment_target, 281s mocker, 281s monkeypatch, 281s ): 281s tmp_dir = _tmpdir("cmake_args_keyword_osx_default") 281s 281s tmp_dir.join("setup.py").write( 281s textwrap.dedent( 281s """ 281s from skbuild import setup 281s setup( 281s name="test_cmake_args_keyword_osx_default", 281s version="1.2.3", 281s description="A minimal example package", 281s author="The scikit-build team", 281s license="MIT", 281s cmake_args=[{cmake_args}] 281s ) 281s """.format(cmake_args=",".join([f"'{arg}'" for arg in keyword_cmake_args])) 281s ) 281s ) 281s tmp_dir.join("CMakeLists.txt").write( 281s textwrap.dedent( 281s """ 281s message(FATAL_ERROR "This error message should not be displayed") 281s """ 281s ) 281s ) 281s 281s mock_configure = mocker.patch("skbuild.cmaker.CMaker.configure", side_effect=RuntimeError("exit skbuild")) 281s 281s monkeypatch.setattr(platform, "mac_ver", lambda: ("10.9", None, "x84_64")) 281s monkeypatch.setattr(platform, "machine", lambda: "x86_64") 281s monkeypatch.setattr(sys, "platform", "darwin") 281s 281s with push_env(MACOSX_DEPLOYMENT_TARGET=osx_deployment_target_env_var): 281s monkeypatch.setattr(skbuild.constants, "_SKBUILD_PLAT_NAME", skbuild.constants._default_skbuild_plat_name()) 281s with pytest.raises(RuntimeError, match="exit skbuild"): 281s > with execute_setup_py(tmp_dir, ["build", *cli_setup_args, "--", *cli_cmake_args]): 281s 281s cli_cmake_args = [] 281s cli_setup_args = [] 281s expected_cmake_osx_deployment_target = '10.7' 281s keyword_cmake_args = [] 281s mock_configure = 281s mocker = 281s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x709a443b8d40> 281s osx_deployment_target_env_var = '10.7' 281s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-53/cmake_args_keyword_osx_default0') 281s 281s tests/test_issue342_cmake_osx_args_in_setup.py:176: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-53/cmake_args_keyword_osx_default0') 281s setup_args = ['build', '--'], disable_languages_test = False 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = False 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-53/cmake_args_keyword_osx_default0') 281s setup_args = ['build', '--'] 281s 281s tests/__init__.py:218: AttributeError 281s _ test_cmake_args_keyword_osx_default[10.7-cli_setup_args2-keyword_cmake_args2-cli_cmake_args2-10.9] _ 281s 281s osx_deployment_target_env_var = '10.7' 281s cli_setup_args = ['--plat-name', 'macosx-10.9-x86_64'], keyword_cmake_args = [] 281s cli_cmake_args = [], expected_cmake_osx_deployment_target = '10.9' 281s mocker = 281s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x709a443bbda0> 281s 281s @pytest.mark.parametrize( 281s params, 281s [ 281s # default plat_name is 'macosx-10.9-x86_64' 281s ( 281s # osx_deployment_target_env_var 281s None, 281s # cli_setup_args 281s [], 281s # keyword_cmake_args 281s [], 281s # cli_cmake_args 281s [], 281s # expected_cmake_osx_deployment_target 281s "10.9", 281s ), 281s ( 281s # osx_deployment_target_env_var 281s "10.7", 281s # cli_setup_args 281s [], 281s # keyword_cmake_args 281s [], 281s # cli_cmake_args 281s [], 281s # expected_cmake_osx_deployment_target 281s "10.7", 281s ), 281s ( 281s # osx_deployment_target_env_var 281s "10.7", 281s # cli_setup_args 281s ["--plat-name", "macosx-10.9-x86_64"], 281s # keyword_cmake_args 281s [], 281s # cli_cmake_args 281s [], 281s # expected_cmake_osx_deployment_target 281s "10.9", 281s ), 281s ( 281s # osx_deployment_target_env_var 281s None, 281s # cli_setup_args 281s ["--plat-name", "macosx-10.6-x86_64"], 281s # keyword_cmake_args 281s [], 281s # cli_cmake_args 281s [], 281s # expected_cmake_osx_deployment_target 281s "10.6", 281s ), 281s ( 281s # osx_deployment_target_env_var 281s None, 281s # cli_setup_args 281s ["--plat-name", "macosx-10.7-x86_64"], 281s # keyword_cmake_args 281s [], 281s # cli_cmake_args 281s [], 281s # expected_cmake_osx_deployment_target 281s "10.7", 281s ), 281s ( 281s # osx_deployment_target_env_var 281s None, 281s # cli_setup_args 281s [], 281s # keyword_cmake_args 281s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 281s # cli_cmake_args 281s [], 281s # expected_cmake_osx_deployment_target 281s "10.7", 281s ), 281s ( 281s # osx_deployment_target_env_var 281s None, 281s # cli_setup_args 281s ["--plat-name", "macosx-10.12-x86_64"], 281s # keyword_cmake_args 281s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 281s # cli_cmake_args 281s [], 281s # expected_cmake_osx_deployment_target 281s "10.7", 281s ), 281s ( 281s # osx_deployment_target_env_var 281s None, 281s # cli_setup_args 281s [], 281s # keyword_cmake_args 281s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 281s # cli_cmake_args 281s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 281s # expected_cmake_osx_deployment_target 281s "10.8", 281s ), 281s ( 281s # osx_deployment_target_env_var 281s None, 281s # cli_setup_args 281s ["--plat-name", "macosx-10.12-x86_64"], 281s # keyword_cmake_args 281s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 281s # cli_cmake_args 281s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 281s # expected_cmake_osx_deployment_target 281s "10.8", 281s ), 281s ], 281s ) 281s def test_cmake_args_keyword_osx_default( 281s osx_deployment_target_env_var, 281s cli_setup_args, 281s keyword_cmake_args, 281s cli_cmake_args, 281s expected_cmake_osx_deployment_target, 281s mocker, 281s monkeypatch, 281s ): 281s tmp_dir = _tmpdir("cmake_args_keyword_osx_default") 281s 281s tmp_dir.join("setup.py").write( 281s textwrap.dedent( 281s """ 281s from skbuild import setup 281s setup( 281s name="test_cmake_args_keyword_osx_default", 281s version="1.2.3", 281s description="A minimal example package", 281s author="The scikit-build team", 281s license="MIT", 281s cmake_args=[{cmake_args}] 281s ) 281s """.format(cmake_args=",".join([f"'{arg}'" for arg in keyword_cmake_args])) 281s ) 281s ) 281s tmp_dir.join("CMakeLists.txt").write( 281s textwrap.dedent( 281s """ 281s message(FATAL_ERROR "This error message should not be displayed") 281s """ 281s ) 281s ) 281s 281s mock_configure = mocker.patch("skbuild.cmaker.CMaker.configure", side_effect=RuntimeError("exit skbuild")) 281s 281s monkeypatch.setattr(platform, "mac_ver", lambda: ("10.9", None, "x84_64")) 281s monkeypatch.setattr(platform, "machine", lambda: "x86_64") 281s monkeypatch.setattr(sys, "platform", "darwin") 281s 281s with push_env(MACOSX_DEPLOYMENT_TARGET=osx_deployment_target_env_var): 281s monkeypatch.setattr(skbuild.constants, "_SKBUILD_PLAT_NAME", skbuild.constants._default_skbuild_plat_name()) 281s with pytest.raises(RuntimeError, match="exit skbuild"): 281s > with execute_setup_py(tmp_dir, ["build", *cli_setup_args, "--", *cli_cmake_args]): 281s 281s cli_cmake_args = [] 281s cli_setup_args = ['--plat-name', 'macosx-10.9-x86_64'] 281s expected_cmake_osx_deployment_target = '10.9' 281s keyword_cmake_args = [] 281s mock_configure = 281s mocker = 281s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x709a443bbda0> 281s osx_deployment_target_env_var = '10.7' 281s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-54/cmake_args_keyword_osx_default0') 281s 281s tests/test_issue342_cmake_osx_args_in_setup.py:176: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-54/cmake_args_keyword_osx_default0') 281s setup_args = ['build', '--plat-name', 'macosx-10.9-x86_64', '--'] 281s disable_languages_test = False 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = False 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-54/cmake_args_keyword_osx_default0') 281s setup_args = ['build', '--plat-name', 'macosx-10.9-x86_64', '--'] 281s 281s tests/__init__.py:218: AttributeError 281s _ test_cmake_args_keyword_osx_default[None-cli_setup_args3-keyword_cmake_args3-cli_cmake_args3-10.6] _ 281s 281s osx_deployment_target_env_var = None 281s cli_setup_args = ['--plat-name', 'macosx-10.6-x86_64'], keyword_cmake_args = [] 281s cli_cmake_args = [], expected_cmake_osx_deployment_target = '10.6' 281s mocker = 281s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x709a443ce900> 281s 281s @pytest.mark.parametrize( 281s params, 281s [ 281s # default plat_name is 'macosx-10.9-x86_64' 281s ( 281s # osx_deployment_target_env_var 281s None, 281s # cli_setup_args 281s [], 281s # keyword_cmake_args 281s [], 281s # cli_cmake_args 281s [], 281s # expected_cmake_osx_deployment_target 281s "10.9", 281s ), 281s ( 281s # osx_deployment_target_env_var 281s "10.7", 281s # cli_setup_args 281s [], 281s # keyword_cmake_args 281s [], 281s # cli_cmake_args 281s [], 281s # expected_cmake_osx_deployment_target 281s "10.7", 281s ), 281s ( 281s # osx_deployment_target_env_var 281s "10.7", 281s # cli_setup_args 281s ["--plat-name", "macosx-10.9-x86_64"], 281s # keyword_cmake_args 281s [], 281s # cli_cmake_args 281s [], 281s # expected_cmake_osx_deployment_target 281s "10.9", 281s ), 281s ( 281s # osx_deployment_target_env_var 281s None, 281s # cli_setup_args 281s ["--plat-name", "macosx-10.6-x86_64"], 281s # keyword_cmake_args 281s [], 281s # cli_cmake_args 281s [], 281s # expected_cmake_osx_deployment_target 281s "10.6", 281s ), 281s ( 281s # osx_deployment_target_env_var 281s None, 281s # cli_setup_args 281s ["--plat-name", "macosx-10.7-x86_64"], 281s # keyword_cmake_args 281s [], 281s # cli_cmake_args 281s [], 281s # expected_cmake_osx_deployment_target 281s "10.7", 281s ), 281s ( 281s # osx_deployment_target_env_var 281s None, 281s # cli_setup_args 281s [], 281s # keyword_cmake_args 281s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 281s # cli_cmake_args 281s [], 281s # expected_cmake_osx_deployment_target 281s "10.7", 281s ), 281s ( 281s # osx_deployment_target_env_var 281s None, 281s # cli_setup_args 281s ["--plat-name", "macosx-10.12-x86_64"], 281s # keyword_cmake_args 281s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 281s # cli_cmake_args 281s [], 281s # expected_cmake_osx_deployment_target 281s "10.7", 281s ), 281s ( 281s # osx_deployment_target_env_var 281s None, 281s # cli_setup_args 281s [], 281s # keyword_cmake_args 281s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 281s # cli_cmake_args 281s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 281s # expected_cmake_osx_deployment_target 281s "10.8", 281s ), 281s ( 281s # osx_deployment_target_env_var 281s None, 281s # cli_setup_args 281s ["--plat-name", "macosx-10.12-x86_64"], 281s # keyword_cmake_args 281s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 281s # cli_cmake_args 281s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 281s # expected_cmake_osx_deployment_target 281s "10.8", 281s ), 281s ], 281s ) 281s def test_cmake_args_keyword_osx_default( 281s osx_deployment_target_env_var, 281s cli_setup_args, 281s keyword_cmake_args, 281s cli_cmake_args, 281s expected_cmake_osx_deployment_target, 281s mocker, 281s monkeypatch, 281s ): 281s tmp_dir = _tmpdir("cmake_args_keyword_osx_default") 281s 281s tmp_dir.join("setup.py").write( 281s textwrap.dedent( 281s """ 281s from skbuild import setup 281s setup( 281s name="test_cmake_args_keyword_osx_default", 281s version="1.2.3", 281s description="A minimal example package", 281s author="The scikit-build team", 281s license="MIT", 281s cmake_args=[{cmake_args}] 281s ) 281s """.format(cmake_args=",".join([f"'{arg}'" for arg in keyword_cmake_args])) 281s ) 281s ) 281s tmp_dir.join("CMakeLists.txt").write( 281s textwrap.dedent( 281s """ 281s message(FATAL_ERROR "This error message should not be displayed") 281s """ 281s ) 281s ) 281s 281s mock_configure = mocker.patch("skbuild.cmaker.CMaker.configure", side_effect=RuntimeError("exit skbuild")) 281s 281s monkeypatch.setattr(platform, "mac_ver", lambda: ("10.9", None, "x84_64")) 281s monkeypatch.setattr(platform, "machine", lambda: "x86_64") 281s monkeypatch.setattr(sys, "platform", "darwin") 281s 281s with push_env(MACOSX_DEPLOYMENT_TARGET=osx_deployment_target_env_var): 281s monkeypatch.setattr(skbuild.constants, "_SKBUILD_PLAT_NAME", skbuild.constants._default_skbuild_plat_name()) 281s with pytest.raises(RuntimeError, match="exit skbuild"): 281s > with execute_setup_py(tmp_dir, ["build", *cli_setup_args, "--", *cli_cmake_args]): 281s 281s cli_cmake_args = [] 281s cli_setup_args = ['--plat-name', 'macosx-10.6-x86_64'] 281s expected_cmake_osx_deployment_target = '10.6' 281s keyword_cmake_args = [] 281s mock_configure = 281s mocker = 281s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x709a443ce900> 281s osx_deployment_target_env_var = None 281s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-55/cmake_args_keyword_osx_default0') 281s 281s tests/test_issue342_cmake_osx_args_in_setup.py:176: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-55/cmake_args_keyword_osx_default0') 281s setup_args = ['build', '--plat-name', 'macosx-10.6-x86_64', '--'] 281s disable_languages_test = False 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = False 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-55/cmake_args_keyword_osx_default0') 281s setup_args = ['build', '--plat-name', 'macosx-10.6-x86_64', '--'] 281s 281s tests/__init__.py:218: AttributeError 281s _ test_cmake_args_keyword_osx_default[None-cli_setup_args4-keyword_cmake_args4-cli_cmake_args4-10.7] _ 281s 281s osx_deployment_target_env_var = None 281s cli_setup_args = ['--plat-name', 'macosx-10.7-x86_64'], keyword_cmake_args = [] 281s cli_cmake_args = [], expected_cmake_osx_deployment_target = '10.7' 281s mocker = 281s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x709a443cd0d0> 281s 281s @pytest.mark.parametrize( 281s params, 281s [ 281s # default plat_name is 'macosx-10.9-x86_64' 281s ( 281s # osx_deployment_target_env_var 281s None, 281s # cli_setup_args 281s [], 281s # keyword_cmake_args 281s [], 281s # cli_cmake_args 281s [], 281s # expected_cmake_osx_deployment_target 281s "10.9", 281s ), 281s ( 281s # osx_deployment_target_env_var 281s "10.7", 281s # cli_setup_args 281s [], 281s # keyword_cmake_args 281s [], 281s # cli_cmake_args 281s [], 281s # expected_cmake_osx_deployment_target 281s "10.7", 281s ), 281s ( 281s # osx_deployment_target_env_var 281s "10.7", 281s # cli_setup_args 281s ["--plat-name", "macosx-10.9-x86_64"], 281s # keyword_cmake_args 281s [], 281s # cli_cmake_args 281s [], 281s # expected_cmake_osx_deployment_target 281s "10.9", 281s ), 281s ( 281s # osx_deployment_target_env_var 281s None, 281s # cli_setup_args 281s ["--plat-name", "macosx-10.6-x86_64"], 281s # keyword_cmake_args 281s [], 281s # cli_cmake_args 281s [], 281s # expected_cmake_osx_deployment_target 281s "10.6", 281s ), 281s ( 281s # osx_deployment_target_env_var 281s None, 281s # cli_setup_args 281s ["--plat-name", "macosx-10.7-x86_64"], 281s # keyword_cmake_args 281s [], 281s # cli_cmake_args 281s [], 281s # expected_cmake_osx_deployment_target 281s "10.7", 281s ), 281s ( 281s # osx_deployment_target_env_var 281s None, 281s # cli_setup_args 281s [], 281s # keyword_cmake_args 281s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 281s # cli_cmake_args 281s [], 281s # expected_cmake_osx_deployment_target 281s "10.7", 281s ), 281s ( 281s # osx_deployment_target_env_var 281s None, 281s # cli_setup_args 281s ["--plat-name", "macosx-10.12-x86_64"], 281s # keyword_cmake_args 281s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 281s # cli_cmake_args 281s [], 281s # expected_cmake_osx_deployment_target 281s "10.7", 281s ), 281s ( 281s # osx_deployment_target_env_var 281s None, 281s # cli_setup_args 281s [], 281s # keyword_cmake_args 281s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 281s # cli_cmake_args 281s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 281s # expected_cmake_osx_deployment_target 281s "10.8", 281s ), 281s ( 281s # osx_deployment_target_env_var 281s None, 281s # cli_setup_args 281s ["--plat-name", "macosx-10.12-x86_64"], 281s # keyword_cmake_args 281s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 281s # cli_cmake_args 281s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 281s # expected_cmake_osx_deployment_target 281s "10.8", 281s ), 281s ], 281s ) 281s def test_cmake_args_keyword_osx_default( 281s osx_deployment_target_env_var, 281s cli_setup_args, 281s keyword_cmake_args, 281s cli_cmake_args, 281s expected_cmake_osx_deployment_target, 281s mocker, 281s monkeypatch, 281s ): 281s tmp_dir = _tmpdir("cmake_args_keyword_osx_default") 281s 281s tmp_dir.join("setup.py").write( 281s textwrap.dedent( 281s """ 281s from skbuild import setup 281s setup( 281s name="test_cmake_args_keyword_osx_default", 281s version="1.2.3", 281s description="A minimal example package", 281s author="The scikit-build team", 281s license="MIT", 281s cmake_args=[{cmake_args}] 281s ) 281s """.format(cmake_args=",".join([f"'{arg}'" for arg in keyword_cmake_args])) 281s ) 281s ) 281s tmp_dir.join("CMakeLists.txt").write( 281s textwrap.dedent( 281s """ 281s message(FATAL_ERROR "This error message should not be displayed") 281s """ 281s ) 281s ) 281s 281s mock_configure = mocker.patch("skbuild.cmaker.CMaker.configure", side_effect=RuntimeError("exit skbuild")) 281s 281s monkeypatch.setattr(platform, "mac_ver", lambda: ("10.9", None, "x84_64")) 281s monkeypatch.setattr(platform, "machine", lambda: "x86_64") 281s monkeypatch.setattr(sys, "platform", "darwin") 281s 281s with push_env(MACOSX_DEPLOYMENT_TARGET=osx_deployment_target_env_var): 281s monkeypatch.setattr(skbuild.constants, "_SKBUILD_PLAT_NAME", skbuild.constants._default_skbuild_plat_name()) 281s with pytest.raises(RuntimeError, match="exit skbuild"): 281s > with execute_setup_py(tmp_dir, ["build", *cli_setup_args, "--", *cli_cmake_args]): 281s 281s cli_cmake_args = [] 281s cli_setup_args = ['--plat-name', 'macosx-10.7-x86_64'] 281s expected_cmake_osx_deployment_target = '10.7' 281s keyword_cmake_args = [] 281s mock_configure = 281s mocker = 281s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x709a443cd0d0> 281s osx_deployment_target_env_var = None 281s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-56/cmake_args_keyword_osx_default0') 281s 281s tests/test_issue342_cmake_osx_args_in_setup.py:176: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-56/cmake_args_keyword_osx_default0') 281s setup_args = ['build', '--plat-name', 'macosx-10.7-x86_64', '--'] 281s disable_languages_test = False 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = False 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-56/cmake_args_keyword_osx_default0') 281s setup_args = ['build', '--plat-name', 'macosx-10.7-x86_64', '--'] 281s 281s tests/__init__.py:218: AttributeError 281s _ test_cmake_args_keyword_osx_default[None-cli_setup_args5-keyword_cmake_args5-cli_cmake_args5-10.7] _ 281s 281s osx_deployment_target_env_var = None, cli_setup_args = [] 281s keyword_cmake_args = ['-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7'] 281s cli_cmake_args = [], expected_cmake_osx_deployment_target = '10.7' 281s mocker = 281s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x709a443c25a0> 281s 281s @pytest.mark.parametrize( 281s params, 281s [ 281s # default plat_name is 'macosx-10.9-x86_64' 281s ( 281s # osx_deployment_target_env_var 281s None, 281s # cli_setup_args 281s [], 281s # keyword_cmake_args 281s [], 281s # cli_cmake_args 281s [], 281s # expected_cmake_osx_deployment_target 281s "10.9", 281s ), 281s ( 281s # osx_deployment_target_env_var 281s "10.7", 281s # cli_setup_args 281s [], 281s # keyword_cmake_args 281s [], 281s # cli_cmake_args 281s [], 281s # expected_cmake_osx_deployment_target 281s "10.7", 281s ), 281s ( 281s # osx_deployment_target_env_var 281s "10.7", 281s # cli_setup_args 281s ["--plat-name", "macosx-10.9-x86_64"], 281s # keyword_cmake_args 281s [], 281s # cli_cmake_args 281s [], 281s # expected_cmake_osx_deployment_target 281s "10.9", 281s ), 281s ( 281s # osx_deployment_target_env_var 281s None, 281s # cli_setup_args 281s ["--plat-name", "macosx-10.6-x86_64"], 281s # keyword_cmake_args 281s [], 281s # cli_cmake_args 281s [], 281s # expected_cmake_osx_deployment_target 281s "10.6", 281s ), 281s ( 281s # osx_deployment_target_env_var 281s None, 281s # cli_setup_args 281s ["--plat-name", "macosx-10.7-x86_64"], 281s # keyword_cmake_args 281s [], 281s # cli_cmake_args 281s [], 281s # expected_cmake_osx_deployment_target 281s "10.7", 281s ), 281s ( 281s # osx_deployment_target_env_var 281s None, 281s # cli_setup_args 281s [], 281s # keyword_cmake_args 281s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 281s # cli_cmake_args 281s [], 281s # expected_cmake_osx_deployment_target 281s "10.7", 281s ), 281s ( 281s # osx_deployment_target_env_var 281s None, 281s # cli_setup_args 281s ["--plat-name", "macosx-10.12-x86_64"], 281s # keyword_cmake_args 281s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 281s # cli_cmake_args 281s [], 281s # expected_cmake_osx_deployment_target 281s "10.7", 281s ), 281s ( 281s # osx_deployment_target_env_var 281s None, 281s # cli_setup_args 281s [], 281s # keyword_cmake_args 281s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 281s # cli_cmake_args 281s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 281s # expected_cmake_osx_deployment_target 281s "10.8", 281s ), 281s ( 281s # osx_deployment_target_env_var 281s None, 281s # cli_setup_args 281s ["--plat-name", "macosx-10.12-x86_64"], 281s # keyword_cmake_args 281s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 281s # cli_cmake_args 281s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 281s # expected_cmake_osx_deployment_target 281s "10.8", 281s ), 281s ], 281s ) 281s def test_cmake_args_keyword_osx_default( 281s osx_deployment_target_env_var, 281s cli_setup_args, 281s keyword_cmake_args, 281s cli_cmake_args, 281s expected_cmake_osx_deployment_target, 281s mocker, 281s monkeypatch, 281s ): 281s tmp_dir = _tmpdir("cmake_args_keyword_osx_default") 281s 281s tmp_dir.join("setup.py").write( 281s textwrap.dedent( 281s """ 281s from skbuild import setup 281s setup( 281s name="test_cmake_args_keyword_osx_default", 281s version="1.2.3", 281s description="A minimal example package", 281s author="The scikit-build team", 281s license="MIT", 281s cmake_args=[{cmake_args}] 281s ) 281s """.format(cmake_args=",".join([f"'{arg}'" for arg in keyword_cmake_args])) 281s ) 281s ) 281s tmp_dir.join("CMakeLists.txt").write( 281s textwrap.dedent( 281s """ 281s message(FATAL_ERROR "This error message should not be displayed") 281s """ 281s ) 281s ) 281s 281s mock_configure = mocker.patch("skbuild.cmaker.CMaker.configure", side_effect=RuntimeError("exit skbuild")) 281s 281s monkeypatch.setattr(platform, "mac_ver", lambda: ("10.9", None, "x84_64")) 281s monkeypatch.setattr(platform, "machine", lambda: "x86_64") 281s monkeypatch.setattr(sys, "platform", "darwin") 281s 281s with push_env(MACOSX_DEPLOYMENT_TARGET=osx_deployment_target_env_var): 281s monkeypatch.setattr(skbuild.constants, "_SKBUILD_PLAT_NAME", skbuild.constants._default_skbuild_plat_name()) 281s with pytest.raises(RuntimeError, match="exit skbuild"): 281s > with execute_setup_py(tmp_dir, ["build", *cli_setup_args, "--", *cli_cmake_args]): 281s 281s cli_cmake_args = [] 281s cli_setup_args = [] 281s expected_cmake_osx_deployment_target = '10.7' 281s keyword_cmake_args = ['-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7'] 281s mock_configure = 281s mocker = 281s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x709a443c25a0> 281s osx_deployment_target_env_var = None 281s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-57/cmake_args_keyword_osx_default0') 281s 281s tests/test_issue342_cmake_osx_args_in_setup.py:176: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-57/cmake_args_keyword_osx_default0') 281s setup_args = ['build', '--'], disable_languages_test = False 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = False 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-57/cmake_args_keyword_osx_default0') 281s setup_args = ['build', '--'] 281s 281s tests/__init__.py:218: AttributeError 281s _ test_cmake_args_keyword_osx_default[None-cli_setup_args6-keyword_cmake_args6-cli_cmake_args6-10.7] _ 281s 281s osx_deployment_target_env_var = None 281s cli_setup_args = ['--plat-name', 'macosx-10.12-x86_64'] 281s keyword_cmake_args = ['-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7'] 281s cli_cmake_args = [], expected_cmake_osx_deployment_target = '10.7' 281s mocker = 281s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x709a443bad80> 281s 281s @pytest.mark.parametrize( 281s params, 281s [ 281s # default plat_name is 'macosx-10.9-x86_64' 281s ( 281s # osx_deployment_target_env_var 281s None, 281s # cli_setup_args 281s [], 281s # keyword_cmake_args 281s [], 281s # cli_cmake_args 281s [], 281s # expected_cmake_osx_deployment_target 281s "10.9", 281s ), 281s ( 281s # osx_deployment_target_env_var 281s "10.7", 281s # cli_setup_args 281s [], 281s # keyword_cmake_args 281s [], 281s # cli_cmake_args 281s [], 281s # expected_cmake_osx_deployment_target 281s "10.7", 281s ), 281s ( 281s # osx_deployment_target_env_var 281s "10.7", 281s # cli_setup_args 281s ["--plat-name", "macosx-10.9-x86_64"], 281s # keyword_cmake_args 281s [], 281s # cli_cmake_args 281s [], 281s # expected_cmake_osx_deployment_target 281s "10.9", 281s ), 281s ( 281s # osx_deployment_target_env_var 281s None, 281s # cli_setup_args 281s ["--plat-name", "macosx-10.6-x86_64"], 281s # keyword_cmake_args 281s [], 281s # cli_cmake_args 281s [], 281s # expected_cmake_osx_deployment_target 281s "10.6", 281s ), 281s ( 281s # osx_deployment_target_env_var 281s None, 281s # cli_setup_args 281s ["--plat-name", "macosx-10.7-x86_64"], 281s # keyword_cmake_args 281s [], 281s # cli_cmake_args 281s [], 281s # expected_cmake_osx_deployment_target 281s "10.7", 281s ), 281s ( 281s # osx_deployment_target_env_var 281s None, 281s # cli_setup_args 281s [], 281s # keyword_cmake_args 281s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 281s # cli_cmake_args 281s [], 281s # expected_cmake_osx_deployment_target 281s "10.7", 281s ), 281s ( 281s # osx_deployment_target_env_var 281s None, 281s # cli_setup_args 281s ["--plat-name", "macosx-10.12-x86_64"], 281s # keyword_cmake_args 281s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 281s # cli_cmake_args 281s [], 281s # expected_cmake_osx_deployment_target 281s "10.7", 281s ), 281s ( 281s # osx_deployment_target_env_var 281s None, 281s # cli_setup_args 281s [], 281s # keyword_cmake_args 281s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 281s # cli_cmake_args 281s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 281s # expected_cmake_osx_deployment_target 281s "10.8", 281s ), 281s ( 281s # osx_deployment_target_env_var 281s None, 281s # cli_setup_args 281s ["--plat-name", "macosx-10.12-x86_64"], 281s # keyword_cmake_args 281s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 281s # cli_cmake_args 281s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 281s # expected_cmake_osx_deployment_target 281s "10.8", 281s ), 281s ], 281s ) 281s def test_cmake_args_keyword_osx_default( 281s osx_deployment_target_env_var, 281s cli_setup_args, 281s keyword_cmake_args, 281s cli_cmake_args, 281s expected_cmake_osx_deployment_target, 281s mocker, 281s monkeypatch, 281s ): 281s tmp_dir = _tmpdir("cmake_args_keyword_osx_default") 281s 281s tmp_dir.join("setup.py").write( 281s textwrap.dedent( 281s """ 281s from skbuild import setup 281s setup( 281s name="test_cmake_args_keyword_osx_default", 281s version="1.2.3", 281s description="A minimal example package", 281s author="The scikit-build team", 281s license="MIT", 281s cmake_args=[{cmake_args}] 281s ) 281s """.format(cmake_args=",".join([f"'{arg}'" for arg in keyword_cmake_args])) 281s ) 281s ) 281s tmp_dir.join("CMakeLists.txt").write( 281s textwrap.dedent( 281s """ 281s message(FATAL_ERROR "This error message should not be displayed") 281s """ 281s ) 281s ) 281s 281s mock_configure = mocker.patch("skbuild.cmaker.CMaker.configure", side_effect=RuntimeError("exit skbuild")) 281s 281s monkeypatch.setattr(platform, "mac_ver", lambda: ("10.9", None, "x84_64")) 281s monkeypatch.setattr(platform, "machine", lambda: "x86_64") 281s monkeypatch.setattr(sys, "platform", "darwin") 281s 281s with push_env(MACOSX_DEPLOYMENT_TARGET=osx_deployment_target_env_var): 281s monkeypatch.setattr(skbuild.constants, "_SKBUILD_PLAT_NAME", skbuild.constants._default_skbuild_plat_name()) 281s with pytest.raises(RuntimeError, match="exit skbuild"): 281s > with execute_setup_py(tmp_dir, ["build", *cli_setup_args, "--", *cli_cmake_args]): 281s 281s cli_cmake_args = [] 281s cli_setup_args = ['--plat-name', 'macosx-10.12-x86_64'] 281s expected_cmake_osx_deployment_target = '10.7' 281s keyword_cmake_args = ['-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7'] 281s mock_configure = 281s mocker = 281s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x709a443bad80> 281s osx_deployment_target_env_var = None 281s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-58/cmake_args_keyword_osx_default0') 281s 281s tests/test_issue342_cmake_osx_args_in_setup.py:176: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-58/cmake_args_keyword_osx_default0') 281s setup_args = ['build', '--plat-name', 'macosx-10.12-x86_64', '--'] 281s disable_languages_test = False 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = False 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-58/cmake_args_keyword_osx_default0') 281s setup_args = ['build', '--plat-name', 'macosx-10.12-x86_64', '--'] 281s 281s tests/__init__.py:218: AttributeError 281s _ test_cmake_args_keyword_osx_default[None-cli_setup_args7-keyword_cmake_args7-cli_cmake_args7-10.8] _ 281s 281s osx_deployment_target_env_var = None, cli_setup_args = [] 281s keyword_cmake_args = ['-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7'] 281s cli_cmake_args = ['-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8'] 281s expected_cmake_osx_deployment_target = '10.8' 281s mocker = 281s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x709a44435130> 281s 281s @pytest.mark.parametrize( 281s params, 281s [ 281s # default plat_name is 'macosx-10.9-x86_64' 281s ( 281s # osx_deployment_target_env_var 281s None, 281s # cli_setup_args 281s [], 281s # keyword_cmake_args 281s [], 281s # cli_cmake_args 281s [], 281s # expected_cmake_osx_deployment_target 281s "10.9", 281s ), 281s ( 281s # osx_deployment_target_env_var 281s "10.7", 281s # cli_setup_args 281s [], 281s # keyword_cmake_args 281s [], 281s # cli_cmake_args 281s [], 281s # expected_cmake_osx_deployment_target 281s "10.7", 281s ), 281s ( 281s # osx_deployment_target_env_var 281s "10.7", 281s # cli_setup_args 281s ["--plat-name", "macosx-10.9-x86_64"], 281s # keyword_cmake_args 281s [], 281s # cli_cmake_args 281s [], 281s # expected_cmake_osx_deployment_target 281s "10.9", 281s ), 281s ( 281s # osx_deployment_target_env_var 281s None, 281s # cli_setup_args 281s ["--plat-name", "macosx-10.6-x86_64"], 281s # keyword_cmake_args 281s [], 281s # cli_cmake_args 281s [], 281s # expected_cmake_osx_deployment_target 281s "10.6", 281s ), 281s ( 281s # osx_deployment_target_env_var 281s None, 281s # cli_setup_args 281s ["--plat-name", "macosx-10.7-x86_64"], 281s # keyword_cmake_args 281s [], 281s # cli_cmake_args 281s [], 281s # expected_cmake_osx_deployment_target 281s "10.7", 281s ), 281s ( 281s # osx_deployment_target_env_var 281s None, 281s # cli_setup_args 281s [], 281s # keyword_cmake_args 281s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 281s # cli_cmake_args 281s [], 281s # expected_cmake_osx_deployment_target 281s "10.7", 281s ), 281s ( 281s # osx_deployment_target_env_var 281s None, 281s # cli_setup_args 281s ["--plat-name", "macosx-10.12-x86_64"], 281s # keyword_cmake_args 281s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 281s # cli_cmake_args 281s [], 281s # expected_cmake_osx_deployment_target 281s "10.7", 281s ), 281s ( 281s # osx_deployment_target_env_var 281s None, 281s # cli_setup_args 281s [], 281s # keyword_cmake_args 281s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 281s # cli_cmake_args 281s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 281s # expected_cmake_osx_deployment_target 281s "10.8", 281s ), 281s ( 281s # osx_deployment_target_env_var 281s None, 281s # cli_setup_args 281s ["--plat-name", "macosx-10.12-x86_64"], 281s # keyword_cmake_args 281s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 281s # cli_cmake_args 281s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 281s # expected_cmake_osx_deployment_target 281s "10.8", 281s ), 281s ], 281s ) 281s def test_cmake_args_keyword_osx_default( 281s osx_deployment_target_env_var, 281s cli_setup_args, 281s keyword_cmake_args, 281s cli_cmake_args, 281s expected_cmake_osx_deployment_target, 281s mocker, 281s monkeypatch, 281s ): 281s tmp_dir = _tmpdir("cmake_args_keyword_osx_default") 281s 281s tmp_dir.join("setup.py").write( 281s textwrap.dedent( 281s """ 281s from skbuild import setup 281s setup( 281s name="test_cmake_args_keyword_osx_default", 281s version="1.2.3", 281s description="A minimal example package", 281s author="The scikit-build team", 281s license="MIT", 281s cmake_args=[{cmake_args}] 281s ) 281s """.format(cmake_args=",".join([f"'{arg}'" for arg in keyword_cmake_args])) 281s ) 281s ) 281s tmp_dir.join("CMakeLists.txt").write( 281s textwrap.dedent( 281s """ 281s message(FATAL_ERROR "This error message should not be displayed") 281s """ 281s ) 281s ) 281s 281s mock_configure = mocker.patch("skbuild.cmaker.CMaker.configure", side_effect=RuntimeError("exit skbuild")) 281s 281s monkeypatch.setattr(platform, "mac_ver", lambda: ("10.9", None, "x84_64")) 281s monkeypatch.setattr(platform, "machine", lambda: "x86_64") 281s monkeypatch.setattr(sys, "platform", "darwin") 281s 281s with push_env(MACOSX_DEPLOYMENT_TARGET=osx_deployment_target_env_var): 281s monkeypatch.setattr(skbuild.constants, "_SKBUILD_PLAT_NAME", skbuild.constants._default_skbuild_plat_name()) 281s with pytest.raises(RuntimeError, match="exit skbuild"): 281s > with execute_setup_py(tmp_dir, ["build", *cli_setup_args, "--", *cli_cmake_args]): 281s 281s cli_cmake_args = ['-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8'] 281s cli_setup_args = [] 281s expected_cmake_osx_deployment_target = '10.8' 281s keyword_cmake_args = ['-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7'] 281s mock_configure = 281s mocker = 281s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x709a44435130> 281s osx_deployment_target_env_var = None 281s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-59/cmake_args_keyword_osx_default0') 281s 281s tests/test_issue342_cmake_osx_args_in_setup.py:176: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-59/cmake_args_keyword_osx_default0') 281s setup_args = ['build', '--', '-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8'] 281s disable_languages_test = False 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = False 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-59/cmake_args_keyword_osx_default0') 281s setup_args = ['build', '--', '-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8'] 281s 281s tests/__init__.py:218: AttributeError 281s _ test_cmake_args_keyword_osx_default[None-cli_setup_args8-keyword_cmake_args8-cli_cmake_args8-10.8] _ 281s 281s osx_deployment_target_env_var = None 281s cli_setup_args = ['--plat-name', 'macosx-10.12-x86_64'] 281s keyword_cmake_args = ['-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7'] 281s cli_cmake_args = ['-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8'] 281s expected_cmake_osx_deployment_target = '10.8' 281s mocker = 281s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x709a443aff50> 281s 281s @pytest.mark.parametrize( 281s params, 281s [ 281s # default plat_name is 'macosx-10.9-x86_64' 281s ( 281s # osx_deployment_target_env_var 281s None, 281s # cli_setup_args 281s [], 281s # keyword_cmake_args 281s [], 281s # cli_cmake_args 281s [], 281s # expected_cmake_osx_deployment_target 281s "10.9", 281s ), 281s ( 281s # osx_deployment_target_env_var 281s "10.7", 281s # cli_setup_args 281s [], 281s # keyword_cmake_args 281s [], 281s # cli_cmake_args 281s [], 281s # expected_cmake_osx_deployment_target 281s "10.7", 281s ), 281s ( 281s # osx_deployment_target_env_var 281s "10.7", 281s # cli_setup_args 281s ["--plat-name", "macosx-10.9-x86_64"], 281s # keyword_cmake_args 281s [], 281s # cli_cmake_args 281s [], 281s # expected_cmake_osx_deployment_target 281s "10.9", 281s ), 281s ( 281s # osx_deployment_target_env_var 281s None, 281s # cli_setup_args 281s ["--plat-name", "macosx-10.6-x86_64"], 281s # keyword_cmake_args 281s [], 281s # cli_cmake_args 281s [], 281s # expected_cmake_osx_deployment_target 281s "10.6", 281s ), 281s ( 281s # osx_deployment_target_env_var 281s None, 281s # cli_setup_args 281s ["--plat-name", "macosx-10.7-x86_64"], 281s # keyword_cmake_args 281s [], 281s # cli_cmake_args 281s [], 281s # expected_cmake_osx_deployment_target 281s "10.7", 281s ), 281s ( 281s # osx_deployment_target_env_var 281s None, 281s # cli_setup_args 281s [], 281s # keyword_cmake_args 281s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 281s # cli_cmake_args 281s [], 281s # expected_cmake_osx_deployment_target 281s "10.7", 281s ), 281s ( 281s # osx_deployment_target_env_var 281s None, 281s # cli_setup_args 281s ["--plat-name", "macosx-10.12-x86_64"], 281s # keyword_cmake_args 281s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 281s # cli_cmake_args 281s [], 281s # expected_cmake_osx_deployment_target 281s "10.7", 281s ), 281s ( 281s # osx_deployment_target_env_var 281s None, 281s # cli_setup_args 281s [], 281s # keyword_cmake_args 281s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 281s # cli_cmake_args 281s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 281s # expected_cmake_osx_deployment_target 281s "10.8", 281s ), 281s ( 281s # osx_deployment_target_env_var 281s None, 281s # cli_setup_args 281s ["--plat-name", "macosx-10.12-x86_64"], 281s # keyword_cmake_args 281s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 281s # cli_cmake_args 281s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 281s # expected_cmake_osx_deployment_target 281s "10.8", 281s ), 281s ], 281s ) 281s def test_cmake_args_keyword_osx_default( 281s osx_deployment_target_env_var, 281s cli_setup_args, 281s keyword_cmake_args, 281s cli_cmake_args, 281s expected_cmake_osx_deployment_target, 281s mocker, 281s monkeypatch, 281s ): 281s tmp_dir = _tmpdir("cmake_args_keyword_osx_default") 281s 281s tmp_dir.join("setup.py").write( 281s textwrap.dedent( 281s """ 281s from skbuild import setup 281s setup( 281s name="test_cmake_args_keyword_osx_default", 281s version="1.2.3", 281s description="A minimal example package", 281s author="The scikit-build team", 281s license="MIT", 281s cmake_args=[{cmake_args}] 281s ) 281s """.format(cmake_args=",".join([f"'{arg}'" for arg in keyword_cmake_args])) 281s ) 281s ) 281s tmp_dir.join("CMakeLists.txt").write( 281s textwrap.dedent( 281s """ 281s message(FATAL_ERROR "This error message should not be displayed") 281s """ 281s ) 281s ) 281s 281s mock_configure = mocker.patch("skbuild.cmaker.CMaker.configure", side_effect=RuntimeError("exit skbuild")) 281s 281s monkeypatch.setattr(platform, "mac_ver", lambda: ("10.9", None, "x84_64")) 281s monkeypatch.setattr(platform, "machine", lambda: "x86_64") 281s monkeypatch.setattr(sys, "platform", "darwin") 281s 281s with push_env(MACOSX_DEPLOYMENT_TARGET=osx_deployment_target_env_var): 281s monkeypatch.setattr(skbuild.constants, "_SKBUILD_PLAT_NAME", skbuild.constants._default_skbuild_plat_name()) 281s with pytest.raises(RuntimeError, match="exit skbuild"): 281s > with execute_setup_py(tmp_dir, ["build", *cli_setup_args, "--", *cli_cmake_args]): 281s 281s cli_cmake_args = ['-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8'] 281s cli_setup_args = ['--plat-name', 'macosx-10.12-x86_64'] 281s expected_cmake_osx_deployment_target = '10.8' 281s keyword_cmake_args = ['-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7'] 281s mock_configure = 281s mocker = 281s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x709a443aff50> 281s osx_deployment_target_env_var = None 281s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-60/cmake_args_keyword_osx_default0') 281s 281s tests/test_issue342_cmake_osx_args_in_setup.py:176: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-60/cmake_args_keyword_osx_default0') 281s setup_args = ['build', '--plat-name', 'macosx-10.12-x86_64', '--', '-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8'] 281s disable_languages_test = False 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = False 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-60/cmake_args_keyword_osx_default0') 281s setup_args = ['build', '--plat-name', 'macosx-10.12-x86_64', '--', '-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8'] 281s 281s tests/__init__.py:218: AttributeError 281s ____________________ test_isolated_env_trigger_reconfigure _____________________ 281s 281s mocker = 281s 281s def test_isolated_env_trigger_reconfigure(mocker): 281s tmp_dir = _tmpdir("isolated_env_trigger_reconfigure") 281s 281s tmp_dir.join("setup.py").write( 281s textwrap.dedent( 281s """ 281s from skbuild import setup 281s setup( 281s name="test_isolated_env_trigger_reconfigure", 281s version="1.2.3", 281s description="A minimal example package", 281s author="The scikit-build team", 281s license="MIT", 281s ) 281s """ 281s ) 281s ) 281s tmp_dir.join("CMakeLists.txt").write( 281s textwrap.dedent( 281s """ 281s message(FATAL_ERROR "This error message should not be displayed") 281s """ 281s ) 281s ) 281s 281s # 281s # mock configure 281s # 281s def fake_configure(*args, **kwargs): 281s # Simulate a successful configuration creating a CMakeCache.txt 281s tmp_dir.ensure(CMAKE_BUILD_DIR(), dir=1).join("CMakeCache.txt").write( 281s textwrap.dedent( 281s """ 281s //Name of generator. 281s CMAKE_GENERATOR:INTERNAL=Ninja 281s """ 281s ) 281s ) 281s 281s # Skip real configuration creating the CMakeCache.txt expected by 281s # "skbuild.setuptools_wrap._load_cmake_spec()" function 281s mocker.patch("skbuild.cmaker.CMaker.configure", new=fake_configure) 281s 281s # 281s # mock _save_cmake_spec 281s # 281s _save_cmake_spec_original = skbuild.setuptools_wrap._save_cmake_spec 281s 281s exit_after_saving_cmake_spec = "exit skbuild saving cmake spec" 281s 281s def _save_cmake_spec_mock(args): 281s _save_cmake_spec_original(args) 281s raise RuntimeError(exit_after_saving_cmake_spec) 281s 281s mocker.patch("skbuild.setuptools_wrap._save_cmake_spec", new=_save_cmake_spec_mock) 281s 281s # 281s # mock make 281s # 281s exit_before_running_cmake = "exit skbuild running make" 281s mocker.patch("skbuild.cmaker.CMaker.make", side_effect=RuntimeError(exit_before_running_cmake)) 281s 281s # first build: "configure" and "_save_cmake_spec" are expected to be called 281s with pytest.raises(RuntimeError, match=exit_after_saving_cmake_spec): 281s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 281s 281s _save_cmake_spec_mock = ._save_cmake_spec_mock at 0x709a44480e00> 281s _save_cmake_spec_original = 281s exit_after_saving_cmake_spec = 'exit skbuild saving cmake spec' 281s exit_before_running_cmake = 'exit skbuild running make' 281s fake_configure = .fake_configure at 0x709a444807c0> 281s mocker = 281s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-61/isolated_env_trigger_reconfigu0') 281s 281s tests/test_issue352_isolated_environment_support.py:78: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-61/isolated_env_trigger_reconfigu0') 281s setup_args = ['build'], disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-61/isolated_env_trigger_reconfigu0') 281s setup_args = ['build'] 281s 281s tests/__init__.py:218: AttributeError 281s __________________________ test_symbol_visibility[ON] __________________________ 281s 281s skip_override = 'ON' 281s 281s @pytest.mark.skipif( 281s platform.system().lower() not in ["linux"], reason="Executable and Linkable Format (ELF) is specific to Linux" 281s ) 281s @pytest.mark.parametrize("skip_override", ["ON", "OFF"]) 281s def test_symbol_visibility(skip_override): 281s with push_dir(): 281s tmp_dir = _tmpdir("test_issue668_symbol_visibility") 281s project = "issue-668-symbol-visibility" 281s prepare_project(project, tmp_dir) 281s initialize_git_repo_and_commit(tmp_dir, verbose=True) 281s 281s > with execute_setup_py( 281s tmp_dir, ["build", f"-DSKBUILD_GNU_SKIP_LOCAL_SYMBOL_EXPORT_OVERRIDE:BOOL={skip_override}"] 281s ): 281s 281s project = 'issue-668-symbol-visibility' 281s skip_override = 'ON' 281s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-62/test_issue668_symbol_visibilit0') 281s 281s tests/test_issue668_symbol_visibility.py:32: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-62/test_issue668_symbol_visibilit0') 281s setup_args = ['build', '-DSKBUILD_GNU_SKIP_LOCAL_SYMBOL_EXPORT_OVERRIDE:BOOL=ON'] 281s disable_languages_test = False 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = False 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-62/test_issue668_symbol_visibilit0') 281s setup_args = ['build', '-DSKBUILD_GNU_SKIP_LOCAL_SYMBOL_EXPORT_OVERRIDE:BOOL=ON'] 281s 281s tests/__init__.py:218: AttributeError 281s ----------------------------- Captured stdout call ----------------------------- 281s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-62/test_issue668_symbol_visibilit0/.git/ 281s [master (root-commit) 5f625cf] Initial commit 281s 5 files changed, 121 insertions(+) 281s create mode 100644 CMakeLists.txt 281s create mode 100644 hello/__init__.py 281s create mode 100644 hello/_hello.cxx 281s create mode 100644 pyproject.toml 281s create mode 100644 setup.py 281s ----------------------------- Captured stderr call ----------------------------- 281s hint: Using 'master' as the name for the initial branch. This default branch name 281s hint: is subject to change. To configure the initial branch name to use in all 281s hint: of your new repositories, which will suppress this warning, call: 281s hint: 281s hint: git config --global init.defaultBranch 281s hint: 281s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 281s hint: 'development'. The just-created branch can be renamed via this command: 281s hint: 281s hint: git branch -m 281s _________________________ test_symbol_visibility[OFF] __________________________ 281s 281s skip_override = 'OFF' 281s 281s @pytest.mark.skipif( 281s platform.system().lower() not in ["linux"], reason="Executable and Linkable Format (ELF) is specific to Linux" 281s ) 281s @pytest.mark.parametrize("skip_override", ["ON", "OFF"]) 281s def test_symbol_visibility(skip_override): 281s with push_dir(): 281s tmp_dir = _tmpdir("test_issue668_symbol_visibility") 281s project = "issue-668-symbol-visibility" 281s prepare_project(project, tmp_dir) 281s initialize_git_repo_and_commit(tmp_dir, verbose=True) 281s 281s > with execute_setup_py( 281s tmp_dir, ["build", f"-DSKBUILD_GNU_SKIP_LOCAL_SYMBOL_EXPORT_OVERRIDE:BOOL={skip_override}"] 281s ): 281s 281s project = 'issue-668-symbol-visibility' 281s skip_override = 'OFF' 281s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-63/test_issue668_symbol_visibilit0') 281s 281s tests/test_issue668_symbol_visibility.py:32: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-63/test_issue668_symbol_visibilit0') 281s setup_args = ['build', '-DSKBUILD_GNU_SKIP_LOCAL_SYMBOL_EXPORT_OVERRIDE:BOOL=OFF'] 281s disable_languages_test = False 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = False 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-63/test_issue668_symbol_visibilit0') 281s setup_args = ['build', '-DSKBUILD_GNU_SKIP_LOCAL_SYMBOL_EXPORT_OVERRIDE:BOOL=OFF'] 281s 281s tests/__init__.py:218: AttributeError 281s ----------------------------- Captured stdout call ----------------------------- 281s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-63/test_issue668_symbol_visibilit0/.git/ 281s [master (root-commit) 5f625cf] Initial commit 281s 5 files changed, 121 insertions(+) 281s create mode 100644 CMakeLists.txt 281s create mode 100644 hello/__init__.py 281s create mode 100644 hello/_hello.cxx 281s create mode 100644 pyproject.toml 281s create mode 100644 setup.py 281s ----------------------------- Captured stderr call ----------------------------- 281s hint: Using 'master' as the name for the initial branch. This default branch name 281s hint: is subject to change. To configure the initial branch name to use in all 281s hint: of your new repositories, which will suppress this warning, call: 281s hint: 281s hint: git config --global init.defaultBranch 281s hint: 281s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 281s hint: 'development'. The just-created branch can be renamed via this command: 281s hint: 281s hint: git branch -m 281s ____________________________ test_manifest_in_wheel ____________________________ 281s 281s iargs = (), ikwargs = {} 281s 281s @functools.wraps(fun) 281s def wrapped(*iargs, **ikwargs): 281s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 281s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 281s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 281s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 281s 281s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 281s 281s disable_languages_test = True 281s fun = 281s iargs = () 281s ikwargs = {} 281s ret = False 281s wrapped = 281s 281s tests/__init__.py:255: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-64/test_manifest_in_wheel0') 281s setup_args = ['bdist_wheel'], disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-64/test_manifest_in_wheel0') 281s setup_args = ['bdist_wheel'] 281s 281s tests/__init__.py:218: AttributeError 281s ----------------------------- Captured stdout call ----------------------------- 281s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-64/test_manifest_in_wheel0/.git/ 281s [master (root-commit) 84cd30f] Initial commit 281s 4 files changed, 14 insertions(+) 281s create mode 100644 MANIFEST.in 281s create mode 100644 hello/__init__.py 281s create mode 100644 not_included.txt 281s create mode 100644 setup.py 281s ----------------------------- Captured stderr call ----------------------------- 281s hint: Using 'master' as the name for the initial branch. This default branch name 281s hint: is subject to change. To configure the initial branch name to use in all 281s hint: of your new repositories, which will suppress this warning, call: 281s hint: 281s hint: git config --global init.defaultBranch 281s hint: 281s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 281s hint: 'development'. The just-created branch can be renamed via this command: 281s hint: 281s hint: git branch -m 281s ____________________ test_outside_project_root_fails[None] _____________________ 281s 281s option = None 281s 281s @pytest.mark.parametrize("option", [None, "-DINSTALL_FILE:BOOL=1", "-DINSTALL_PROJECT:BOOL=1"]) 281s def test_outside_project_root_fails(option): 281s with push_dir(): 281s expected_failure = False 281s 281s cmd = ["install"] 281s if option is not None: 281s expected_failure = True 281s cmd.extend(["--", option]) 281s 281s @project_setup_py_test("fail-outside-project-root", cmd, disable_languages_test=True) 281s def should_fail(): 281s pass 281s 281s failed = False 281s msg = "" 281s try: 281s > should_fail() 281s 281s cmd = ['install'] 281s expected_failure = False 281s failed = False 281s msg = '' 281s option = None 281s should_fail = .should_fail at 0x709a44481260> 281s 281s tests/test_outside_project_root.py:36: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s tests/__init__.py:255: in wrapped 281s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 281s disable_languages_test = True 281s fun = .should_fail at 0x709a44481080> 281s iargs = () 281s ikwargs = {} 281s ret = False 281s wrapped = .should_fail at 0x709a44481260> 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-65/should_fail0') 281s setup_args = ['install'], disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-65/should_fail0') 281s setup_args = ['install'] 281s 281s tests/__init__.py:218: AttributeError 281s ----------------------------- Captured stdout call ----------------------------- 281s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-65/should_fail0/.git/ 281s [master (root-commit) dc5f821] Initial commit 281s 4 files changed, 51 insertions(+) 281s create mode 100644 CMakeLists.txt 281s create mode 100644 dummy 281s create mode 100644 other_project/CMakeLists.txt 281s create mode 100644 setup.py 281s ----------------------------- Captured stderr call ----------------------------- 281s hint: Using 'master' as the name for the initial branch. This default branch name 281s hint: is subject to change. To configure the initial branch name to use in all 281s hint: of your new repositories, which will suppress this warning, call: 281s hint: 281s hint: git config --global init.defaultBranch 281s hint: 281s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 281s hint: 'development'. The just-created branch can be renamed via this command: 281s hint: 281s hint: git branch -m 281s ____________ test_outside_project_root_fails[-DINSTALL_FILE:BOOL=1] ____________ 281s 281s option = '-DINSTALL_FILE:BOOL=1' 281s 281s @pytest.mark.parametrize("option", [None, "-DINSTALL_FILE:BOOL=1", "-DINSTALL_PROJECT:BOOL=1"]) 281s def test_outside_project_root_fails(option): 281s with push_dir(): 281s expected_failure = False 281s 281s cmd = ["install"] 281s if option is not None: 281s expected_failure = True 281s cmd.extend(["--", option]) 281s 281s @project_setup_py_test("fail-outside-project-root", cmd, disable_languages_test=True) 281s def should_fail(): 281s pass 281s 281s failed = False 281s msg = "" 281s try: 281s > should_fail() 281s 281s cmd = ['install', '--', '-DINSTALL_FILE:BOOL=1'] 281s expected_failure = True 281s failed = False 281s msg = '' 281s option = '-DINSTALL_FILE:BOOL=1' 281s should_fail = .should_fail at 0x709a444809a0> 281s 281s tests/test_outside_project_root.py:36: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s tests/__init__.py:255: in wrapped 281s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 281s disable_languages_test = True 281s fun = .should_fail at 0x709a44481120> 281s iargs = () 281s ikwargs = {} 281s ret = False 281s wrapped = .should_fail at 0x709a444809a0> 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-66/should_fail0') 281s setup_args = ['install', '--', '-DINSTALL_FILE:BOOL=1'] 281s disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-66/should_fail0') 281s setup_args = ['install', '--', '-DINSTALL_FILE:BOOL=1'] 281s 281s tests/__init__.py:218: AttributeError 281s ----------------------------- Captured stdout call ----------------------------- 281s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-66/should_fail0/.git/ 281s [master (root-commit) dc5f821] Initial commit 281s 4 files changed, 51 insertions(+) 281s create mode 100644 CMakeLists.txt 281s create mode 100644 dummy 281s create mode 100644 other_project/CMakeLists.txt 281s create mode 100644 setup.py 281s ----------------------------- Captured stderr call ----------------------------- 281s hint: Using 'master' as the name for the initial branch. This default branch name 281s hint: is subject to change. To configure the initial branch name to use in all 281s hint: of your new repositories, which will suppress this warning, call: 281s hint: 281s hint: git config --global init.defaultBranch 281s hint: 281s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 281s hint: 'development'. The just-created branch can be renamed via this command: 281s hint: 281s hint: git branch -m 281s __________ test_outside_project_root_fails[-DINSTALL_PROJECT:BOOL=1] ___________ 281s 281s option = '-DINSTALL_PROJECT:BOOL=1' 281s 281s @pytest.mark.parametrize("option", [None, "-DINSTALL_FILE:BOOL=1", "-DINSTALL_PROJECT:BOOL=1"]) 281s def test_outside_project_root_fails(option): 281s with push_dir(): 281s expected_failure = False 281s 281s cmd = ["install"] 281s if option is not None: 281s expected_failure = True 281s cmd.extend(["--", option]) 281s 281s @project_setup_py_test("fail-outside-project-root", cmd, disable_languages_test=True) 281s def should_fail(): 281s pass 281s 281s failed = False 281s msg = "" 281s try: 281s > should_fail() 281s 281s cmd = ['install', '--', '-DINSTALL_PROJECT:BOOL=1'] 281s expected_failure = True 281s failed = False 281s msg = '' 281s option = '-DINSTALL_PROJECT:BOOL=1' 281s should_fail = .should_fail at 0x709a44482160> 281s 281s tests/test_outside_project_root.py:36: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s tests/__init__.py:255: in wrapped 281s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 281s disable_languages_test = True 281s fun = .should_fail at 0x709a44481f80> 281s iargs = () 281s ikwargs = {} 281s ret = False 281s wrapped = .should_fail at 0x709a44482160> 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-67/should_fail0') 281s setup_args = ['install', '--', '-DINSTALL_PROJECT:BOOL=1'] 281s disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-67/should_fail0') 281s setup_args = ['install', '--', '-DINSTALL_PROJECT:BOOL=1'] 281s 281s tests/__init__.py:218: AttributeError 281s ----------------------------- Captured stdout call ----------------------------- 281s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-67/should_fail0/.git/ 281s [master (root-commit) dc5f821] Initial commit 281s 4 files changed, 51 insertions(+) 281s create mode 100644 CMakeLists.txt 281s create mode 100644 dummy 281s create mode 100644 other_project/CMakeLists.txt 281s create mode 100644 setup.py 281s ----------------------------- Captured stderr call ----------------------------- 281s hint: Using 'master' as the name for the initial branch. This default branch name 281s hint: is subject to change. To configure the initial branch name to use in all 281s hint: of your new repositories, which will suppress this warning, call: 281s hint: 281s hint: git config --global init.defaultBranch 281s hint: 281s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 281s hint: 'development'. The just-created branch can be renamed via this command: 281s hint: 281s hint: git branch -m 281s _____________________ test_cmake_args_keyword[cmake_args0] _____________________ 281s 281s cmake_args = [] 281s capfd = <_pytest.capture.CaptureFixture object at 0x709a44657290> 281s 281s @pytest.mark.parametrize("cmake_args", [[], ["--", "-DVAR:STRING=43", "-DVAR_WITH_SPACE:STRING=Ciao Mondo"]]) 281s def test_cmake_args_keyword(cmake_args, capfd): 281s tmp_dir = _tmpdir("cmake_args_keyword") 281s 281s tmp_dir.join("setup.py").write( 281s textwrap.dedent( 281s """ 281s from skbuild import setup 281s setup( 281s name="test_cmake_args_keyword", 281s version="1.2.3", 281s description="a minimal example package", 281s author='The scikit-build team', 281s license="MIT", 281s cmake_args=[ 281s "-DVAR:STRING=42", 281s "-DVAR_WITH_SPACE:STRING=Hello World" 281s ] 281s 281s ) 281s """ 281s ) 281s ) 281s tmp_dir.join("CMakeLists.txt").write( 281s textwrap.dedent( 281s """ 281s cmake_minimum_required(VERSION 3.5.0) 281s project(test NONE) 281s message(STATUS "VAR[${VAR}]") 281s message(STATUS "VAR_WITH_SPACE[${VAR_WITH_SPACE}]") 281s install(CODE "execute_process( 281s COMMAND \\${CMAKE_COMMAND} -E sleep 0)") 281s """ 281s ) 281s ) 281s 281s > with execute_setup_py(tmp_dir, ["build", *cmake_args], disable_languages_test=True): 281s 281s capfd = <_pytest.capture.CaptureFixture object at 0x709a44657290> 281s cmake_args = [] 281s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-68/cmake_args_keyword0') 281s 281s tests/test_setup.py:127: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-68/cmake_args_keyword0') 281s setup_args = ['build'], disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-68/cmake_args_keyword0') 281s setup_args = ['build'] 281s 281s tests/__init__.py:218: AttributeError 281s _____________________ test_cmake_args_keyword[cmake_args1] _____________________ 281s 281s cmake_args = ['--', '-DVAR:STRING=43', '-DVAR_WITH_SPACE:STRING=Ciao Mondo'] 281s capfd = <_pytest.capture.CaptureFixture object at 0x709a44375e50> 281s 281s @pytest.mark.parametrize("cmake_args", [[], ["--", "-DVAR:STRING=43", "-DVAR_WITH_SPACE:STRING=Ciao Mondo"]]) 281s def test_cmake_args_keyword(cmake_args, capfd): 281s tmp_dir = _tmpdir("cmake_args_keyword") 281s 281s tmp_dir.join("setup.py").write( 281s textwrap.dedent( 281s """ 281s from skbuild import setup 281s setup( 281s name="test_cmake_args_keyword", 281s version="1.2.3", 281s description="a minimal example package", 281s author='The scikit-build team', 281s license="MIT", 281s cmake_args=[ 281s "-DVAR:STRING=42", 281s "-DVAR_WITH_SPACE:STRING=Hello World" 281s ] 281s 281s ) 281s """ 281s ) 281s ) 281s tmp_dir.join("CMakeLists.txt").write( 281s textwrap.dedent( 281s """ 281s cmake_minimum_required(VERSION 3.5.0) 281s project(test NONE) 281s message(STATUS "VAR[${VAR}]") 281s message(STATUS "VAR_WITH_SPACE[${VAR_WITH_SPACE}]") 281s install(CODE "execute_process( 281s COMMAND \\${CMAKE_COMMAND} -E sleep 0)") 281s """ 281s ) 281s ) 281s 281s > with execute_setup_py(tmp_dir, ["build", *cmake_args], disable_languages_test=True): 281s 281s capfd = <_pytest.capture.CaptureFixture object at 0x709a44375e50> 281s cmake_args = ['--', '-DVAR:STRING=43', '-DVAR_WITH_SPACE:STRING=Ciao Mondo'] 281s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-69/cmake_args_keyword0') 281s 281s tests/test_setup.py:127: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-69/cmake_args_keyword0') 281s setup_args = ['build', '--', '-DVAR:STRING=43', '-DVAR_WITH_SPACE:STRING=Ciao Mondo'] 281s disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-69/cmake_args_keyword0') 281s setup_args = ['build', '--', '-DVAR:STRING=43', '-DVAR_WITH_SPACE:STRING=Ciao Mondo'] 281s 281s tests/__init__.py:218: AttributeError 281s ________________ test_cmake_install_dir_keyword[None-True-str] _________________ 281s 281s cmake_install_dir = None, expected_failed = True 281s error_code_type = 281s capsys = <_pytest.capture.CaptureFixture object at 0x709a44435700> 281s caplog = <_pytest.logging.LogCaptureFixture object at 0x709a4474efc0> 281s 281s @pytest.mark.parametrize( 281s ("cmake_install_dir", "expected_failed", "error_code_type"), 281s [ 281s (None, True, str), 281s ("", True, str), 281s (str(py.path.local.get_temproot().join("scikit-build")), True, SKBuildError), 281s ("banana", False, str), 281s ], 281s ) 281s def test_cmake_install_dir_keyword(cmake_install_dir, expected_failed, error_code_type, capsys, caplog): 281s # ------------------------------------------------------------------------- 281s # "SOURCE" tree layout: 281s # 281s # ROOT/ 281s # 281s # CMakeLists.txt 281s # setup.py 281s # 281s # apple/ 281s # __init__.py 281s # 281s # ------------------------------------------------------------------------- 281s # "BINARY" distribution layout 281s # 281s # ROOT/ 281s # 281s # apple/ 281s # __init__.py 281s # 281s 281s tmp_dir = _tmpdir("cmake_install_dir_keyword") 281s 281s setup_kwarg = "" 281s if cmake_install_dir is not None: 281s setup_kwarg = f"cmake_install_dir={str(cmake_install_dir)!r}" 281s 281s tmp_dir.join("setup.py").write( 281s textwrap.dedent( 281s f""" 281s from skbuild import setup 281s setup( 281s name="test_cmake_install_dir", 281s version="1.2.3", 281s description="a package testing use of cmake_install_dir", 281s author='The scikit-build team', 281s license="MIT", 281s packages=['apple', 'banana'], 281s {setup_kwarg} 281s ) 281s """ 281s ) 281s ) 281s 281s # Install location purposely set to "." so that we can test 281s # usage of "cmake_install_dir" skbuild.setup keyword. 281s tmp_dir.join("CMakeLists.txt").write( 281s textwrap.dedent( 281s """ 281s cmake_minimum_required(VERSION 3.5.0) 281s project(banana NONE) 281s file(WRITE "${CMAKE_BINARY_DIR}/__init__.py" "") 281s install(FILES "${CMAKE_BINARY_DIR}/__init__.py" DESTINATION ".") 281s """ 281s ) 281s ) 281s 281s tmp_dir.ensure("apple", "__init__.py") 281s 281s failed = False 281s message = "" 281s try: 281s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 281s 281s caplog = <_pytest.logging.LogCaptureFixture object at 0x709a4474efc0> 281s capsys = <_pytest.capture.CaptureFixture object at 0x709a44435700> 281s cmake_install_dir = None 281s error_code_type = 281s expected_failed = True 281s failed = False 281s message = '' 281s setup_kwarg = '' 281s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-70/cmake_install_dir_keyword0') 281s 281s tests/test_setup.py:211: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-70/cmake_install_dir_keyword0') 281s setup_args = ['build'], disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-70/cmake_install_dir_keyword0') 281s setup_args = ['build'] 281s 281s tests/__init__.py:218: AttributeError 281s __________________ test_cmake_install_dir_keyword[-True-str] ___________________ 281s 281s cmake_install_dir = '', expected_failed = True, error_code_type = 281s capsys = <_pytest.capture.CaptureFixture object at 0x709a443753d0> 281s caplog = <_pytest.logging.LogCaptureFixture object at 0x709a44375850> 281s 281s @pytest.mark.parametrize( 281s ("cmake_install_dir", "expected_failed", "error_code_type"), 281s [ 281s (None, True, str), 281s ("", True, str), 281s (str(py.path.local.get_temproot().join("scikit-build")), True, SKBuildError), 281s ("banana", False, str), 281s ], 281s ) 281s def test_cmake_install_dir_keyword(cmake_install_dir, expected_failed, error_code_type, capsys, caplog): 281s # ------------------------------------------------------------------------- 281s # "SOURCE" tree layout: 281s # 281s # ROOT/ 281s # 281s # CMakeLists.txt 281s # setup.py 281s # 281s # apple/ 281s # __init__.py 281s # 281s # ------------------------------------------------------------------------- 281s # "BINARY" distribution layout 281s # 281s # ROOT/ 281s # 281s # apple/ 281s # __init__.py 281s # 281s 281s tmp_dir = _tmpdir("cmake_install_dir_keyword") 281s 281s setup_kwarg = "" 281s if cmake_install_dir is not None: 281s setup_kwarg = f"cmake_install_dir={str(cmake_install_dir)!r}" 281s 281s tmp_dir.join("setup.py").write( 281s textwrap.dedent( 281s f""" 281s from skbuild import setup 281s setup( 281s name="test_cmake_install_dir", 281s version="1.2.3", 281s description="a package testing use of cmake_install_dir", 281s author='The scikit-build team', 281s license="MIT", 281s packages=['apple', 'banana'], 281s {setup_kwarg} 281s ) 281s """ 281s ) 281s ) 281s 281s # Install location purposely set to "." so that we can test 281s # usage of "cmake_install_dir" skbuild.setup keyword. 281s tmp_dir.join("CMakeLists.txt").write( 281s textwrap.dedent( 281s """ 281s cmake_minimum_required(VERSION 3.5.0) 281s project(banana NONE) 281s file(WRITE "${CMAKE_BINARY_DIR}/__init__.py" "") 281s install(FILES "${CMAKE_BINARY_DIR}/__init__.py" DESTINATION ".") 281s """ 281s ) 281s ) 281s 281s tmp_dir.ensure("apple", "__init__.py") 281s 281s failed = False 281s message = "" 281s try: 281s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 281s 281s caplog = <_pytest.logging.LogCaptureFixture object at 0x709a44375850> 281s capsys = <_pytest.capture.CaptureFixture object at 0x709a443753d0> 281s cmake_install_dir = '' 281s error_code_type = 281s expected_failed = True 281s failed = False 281s message = '' 281s setup_kwarg = "cmake_install_dir=''" 281s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-71/cmake_install_dir_keyword0') 281s 281s tests/test_setup.py:211: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-71/cmake_install_dir_keyword0') 281s setup_args = ['build'], disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-71/cmake_install_dir_keyword0') 281s setup_args = ['build'] 281s 281s tests/__init__.py:218: AttributeError 281s _____ test_cmake_install_dir_keyword[/tmp/scikit-build-True-SKBuildError] ______ 281s 281s cmake_install_dir = '/tmp/scikit-build', expected_failed = True 281s error_code_type = 281s capsys = <_pytest.capture.CaptureFixture object at 0x709a443758b0> 281s caplog = <_pytest.logging.LogCaptureFixture object at 0x709a44377d40> 281s 281s @pytest.mark.parametrize( 281s ("cmake_install_dir", "expected_failed", "error_code_type"), 281s [ 281s (None, True, str), 281s ("", True, str), 281s (str(py.path.local.get_temproot().join("scikit-build")), True, SKBuildError), 281s ("banana", False, str), 281s ], 281s ) 281s def test_cmake_install_dir_keyword(cmake_install_dir, expected_failed, error_code_type, capsys, caplog): 281s # ------------------------------------------------------------------------- 281s # "SOURCE" tree layout: 281s # 281s # ROOT/ 281s # 281s # CMakeLists.txt 281s # setup.py 281s # 281s # apple/ 281s # __init__.py 281s # 281s # ------------------------------------------------------------------------- 281s # "BINARY" distribution layout 281s # 281s # ROOT/ 281s # 281s # apple/ 281s # __init__.py 281s # 281s 281s tmp_dir = _tmpdir("cmake_install_dir_keyword") 281s 281s setup_kwarg = "" 281s if cmake_install_dir is not None: 281s setup_kwarg = f"cmake_install_dir={str(cmake_install_dir)!r}" 281s 281s tmp_dir.join("setup.py").write( 281s textwrap.dedent( 281s f""" 281s from skbuild import setup 281s setup( 281s name="test_cmake_install_dir", 281s version="1.2.3", 281s description="a package testing use of cmake_install_dir", 281s author='The scikit-build team', 281s license="MIT", 281s packages=['apple', 'banana'], 281s {setup_kwarg} 281s ) 281s """ 281s ) 281s ) 281s 281s # Install location purposely set to "." so that we can test 281s # usage of "cmake_install_dir" skbuild.setup keyword. 281s tmp_dir.join("CMakeLists.txt").write( 281s textwrap.dedent( 281s """ 281s cmake_minimum_required(VERSION 3.5.0) 281s project(banana NONE) 281s file(WRITE "${CMAKE_BINARY_DIR}/__init__.py" "") 281s install(FILES "${CMAKE_BINARY_DIR}/__init__.py" DESTINATION ".") 281s """ 281s ) 281s ) 281s 281s tmp_dir.ensure("apple", "__init__.py") 281s 281s failed = False 281s message = "" 281s try: 281s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 281s 281s caplog = <_pytest.logging.LogCaptureFixture object at 0x709a44377d40> 281s capsys = <_pytest.capture.CaptureFixture object at 0x709a443758b0> 281s cmake_install_dir = '/tmp/scikit-build' 281s error_code_type = 281s expected_failed = True 281s failed = False 281s message = '' 281s setup_kwarg = "cmake_install_dir='/tmp/scikit-build'" 281s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-72/cmake_install_dir_keyword0') 281s 281s tests/test_setup.py:211: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-72/cmake_install_dir_keyword0') 281s setup_args = ['build'], disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-72/cmake_install_dir_keyword0') 281s setup_args = ['build'] 281s 281s tests/__init__.py:218: AttributeError 281s _______________ test_cmake_install_dir_keyword[banana-False-str] _______________ 281s 281s cmake_install_dir = 'banana', expected_failed = False 281s error_code_type = 281s capsys = <_pytest.capture.CaptureFixture object at 0x709a44436fc0> 281s caplog = <_pytest.logging.LogCaptureFixture object at 0x709a44434560> 281s 281s @pytest.mark.parametrize( 281s ("cmake_install_dir", "expected_failed", "error_code_type"), 281s [ 281s (None, True, str), 281s ("", True, str), 281s (str(py.path.local.get_temproot().join("scikit-build")), True, SKBuildError), 281s ("banana", False, str), 281s ], 281s ) 281s def test_cmake_install_dir_keyword(cmake_install_dir, expected_failed, error_code_type, capsys, caplog): 281s # ------------------------------------------------------------------------- 281s # "SOURCE" tree layout: 281s # 281s # ROOT/ 281s # 281s # CMakeLists.txt 281s # setup.py 281s # 281s # apple/ 281s # __init__.py 281s # 281s # ------------------------------------------------------------------------- 281s # "BINARY" distribution layout 281s # 281s # ROOT/ 281s # 281s # apple/ 281s # __init__.py 281s # 281s 281s tmp_dir = _tmpdir("cmake_install_dir_keyword") 281s 281s setup_kwarg = "" 281s if cmake_install_dir is not None: 281s setup_kwarg = f"cmake_install_dir={str(cmake_install_dir)!r}" 281s 281s tmp_dir.join("setup.py").write( 281s textwrap.dedent( 281s f""" 281s from skbuild import setup 281s setup( 281s name="test_cmake_install_dir", 281s version="1.2.3", 281s description="a package testing use of cmake_install_dir", 281s author='The scikit-build team', 281s license="MIT", 281s packages=['apple', 'banana'], 281s {setup_kwarg} 281s ) 281s """ 281s ) 281s ) 281s 281s # Install location purposely set to "." so that we can test 281s # usage of "cmake_install_dir" skbuild.setup keyword. 281s tmp_dir.join("CMakeLists.txt").write( 281s textwrap.dedent( 281s """ 281s cmake_minimum_required(VERSION 3.5.0) 281s project(banana NONE) 281s file(WRITE "${CMAKE_BINARY_DIR}/__init__.py" "") 281s install(FILES "${CMAKE_BINARY_DIR}/__init__.py" DESTINATION ".") 281s """ 281s ) 281s ) 281s 281s tmp_dir.ensure("apple", "__init__.py") 281s 281s failed = False 281s message = "" 281s try: 281s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 281s 281s caplog = <_pytest.logging.LogCaptureFixture object at 0x709a44434560> 281s capsys = <_pytest.capture.CaptureFixture object at 0x709a44436fc0> 281s cmake_install_dir = 'banana' 281s error_code_type = 281s expected_failed = False 281s failed = False 281s message = '' 281s setup_kwarg = "cmake_install_dir='banana'" 281s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-73/cmake_install_dir_keyword0') 281s 281s tests/test_setup.py:211: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-73/cmake_install_dir_keyword0') 281s setup_args = ['build'], disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-73/cmake_install_dir_keyword0') 281s setup_args = ['build'] 281s 281s tests/__init__.py:218: AttributeError 281s _____________________ test_cmake_with_sdist_keyword[True] ______________________ 281s 281s cmake_with_sdist = True 281s capfd = <_pytest.capture.CaptureFixture object at 0x709a444373e0> 281s 281s @pytest.mark.parametrize("cmake_with_sdist", [True, False]) 281s def test_cmake_with_sdist_keyword(cmake_with_sdist, capfd): 281s tmp_dir = _tmpdir("cmake_with_sdist") 281s 281s tmp_dir.join("setup.py").write( 281s textwrap.dedent( 281s f""" 281s from skbuild import setup 281s setup( 281s name="cmake_with_sdist_keyword", 281s version="1.2.3", 281s description="a minimal example package", 281s author='The scikit-build team', 281s license="MIT", 281s cmake_with_sdist={cmake_with_sdist} 281s ) 281s """ 281s ) 281s ) 281s tmp_dir.join("CMakeLists.txt").write( 281s textwrap.dedent( 281s """ 281s cmake_minimum_required(VERSION 3.5.0) 281s project(test NONE) 281s install(CODE "execute_process( 281s COMMAND \\${CMAKE_COMMAND} -E sleep 0)") 281s """ 281s ) 281s ) 281s 281s initialize_git_repo_and_commit(tmp_dir) 281s 281s > with execute_setup_py(tmp_dir, ["sdist"], disable_languages_test=True): 281s 281s capfd = <_pytest.capture.CaptureFixture object at 0x709a444373e0> 281s cmake_with_sdist = True 281s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-74/cmake_with_sdist0') 281s 281s tests/test_setup.py:267: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-74/cmake_with_sdist0') 281s setup_args = ['sdist'], disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-74/cmake_with_sdist0') 281s setup_args = ['sdist'] 281s 281s tests/__init__.py:218: AttributeError 281s ----------------------------- Captured stdout call ----------------------------- 281s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-74/cmake_with_sdist0/.git/ 281s [master (root-commit) a213a23] Initial commit 281s 2 files changed, 15 insertions(+) 281s create mode 100644 CMakeLists.txt 281s create mode 100644 setup.py 281s ----------------------------- Captured stderr call ----------------------------- 281s hint: Using 'master' as the name for the initial branch. This default branch name 281s hint: is subject to change. To configure the initial branch name to use in all 281s hint: of your new repositories, which will suppress this warning, call: 281s hint: 281s hint: git config --global init.defaultBranch 281s hint: 281s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 281s hint: 'development'. The just-created branch can be renamed via this command: 281s hint: 281s hint: git branch -m 281s _____________________ test_cmake_with_sdist_keyword[False] _____________________ 281s 281s cmake_with_sdist = False 281s capfd = <_pytest.capture.CaptureFixture object at 0x709a44377da0> 281s 281s @pytest.mark.parametrize("cmake_with_sdist", [True, False]) 281s def test_cmake_with_sdist_keyword(cmake_with_sdist, capfd): 281s tmp_dir = _tmpdir("cmake_with_sdist") 281s 281s tmp_dir.join("setup.py").write( 281s textwrap.dedent( 281s f""" 281s from skbuild import setup 281s setup( 281s name="cmake_with_sdist_keyword", 281s version="1.2.3", 281s description="a minimal example package", 281s author='The scikit-build team', 281s license="MIT", 281s cmake_with_sdist={cmake_with_sdist} 281s ) 281s """ 281s ) 281s ) 281s tmp_dir.join("CMakeLists.txt").write( 281s textwrap.dedent( 281s """ 281s cmake_minimum_required(VERSION 3.5.0) 281s project(test NONE) 281s install(CODE "execute_process( 281s COMMAND \\${CMAKE_COMMAND} -E sleep 0)") 281s """ 281s ) 281s ) 281s 281s initialize_git_repo_and_commit(tmp_dir) 281s 281s > with execute_setup_py(tmp_dir, ["sdist"], disable_languages_test=True): 281s 281s capfd = <_pytest.capture.CaptureFixture object at 0x709a44377da0> 281s cmake_with_sdist = False 281s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-75/cmake_with_sdist0') 281s 281s tests/test_setup.py:267: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-75/cmake_with_sdist0') 281s setup_args = ['sdist'], disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-75/cmake_with_sdist0') 281s setup_args = ['sdist'] 281s 281s tests/__init__.py:218: AttributeError 281s ----------------------------- Captured stdout call ----------------------------- 281s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-75/cmake_with_sdist0/.git/ 281s [master (root-commit) 649bea0] Initial commit 281s 2 files changed, 15 insertions(+) 281s create mode 100644 CMakeLists.txt 281s create mode 100644 setup.py 281s ----------------------------- Captured stderr call ----------------------------- 281s hint: Using 'master' as the name for the initial branch. This default branch name 281s hint: is subject to change. To configure the initial branch name to use in all 281s hint: of your new repositories, which will suppress this warning, call: 281s hint: 281s hint: git config --global init.defaultBranch 281s hint: 281s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 281s hint: 'development'. The just-created branch can be renamed via this command: 281s hint: 281s hint: git branch -m 281s _________________ test_cmake_minimum_required_version_keyword __________________ 281s 281s def test_cmake_minimum_required_version_keyword(): 281s tmp_dir = _tmpdir("cmake_minimum_required_version") 281s 281s tmp_dir.join("setup.py").write( 281s textwrap.dedent( 281s """ 281s from skbuild import setup 281s setup( 281s name="cmake_with_sdist_keyword", 281s version="1.2.3", 281s description="a minimal example package", 281s author='The scikit-build team', 281s license="MIT", 281s cmake_minimum_required_version='99.98.97' 281s ) 281s """ 281s ) 281s ) 281s tmp_dir.join("CMakeLists.txt").write( 281s textwrap.dedent( 281s """ 281s cmake_minimum_required(VERSION 3.5.0) 281s project(test NONE) 281s install(CODE "execute_process( 281s COMMAND \\${CMAKE_COMMAND} -E sleep 0)") 281s """ 281s ) 281s ) 281s 281s try: 281s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 281s 281s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-76/cmake_minimum_required_version0') 281s 281s tests/test_setup.py:308: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-76/cmake_minimum_required_version0') 281s setup_args = ['build'], disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-76/cmake_minimum_required_version0') 281s setup_args = ['build'] 281s 281s tests/__init__.py:218: AttributeError 281s __________________ test_setup_requires_keyword_include_cmake ___________________ 281s 281s mocker = 281s capsys = <_pytest.capture.CaptureFixture object at 0x709a444377a0> 281s 281s @pytest.mark.deprecated() 281s @pytest.mark.filterwarnings("ignore:setuptools.installer is deprecated:Warning") 281s @pytest.mark.skipif( 281s os.environ.get("CONDA_BUILD", "0") == "1", 281s reason="running tests expecting network connection in Conda is not possible. " 281s "See https://github.com/conda/conda/issues/508", 281s ) 281s @pytest.mark.skipif(not is_site_reachable("https://pypi.org/simple/cmake/"), reason="pypi.org website not reachable") 281s @pytest.mark.xfail( 281s sys.platform.startswith("cygwin"), strict=False, reason="Cygwin needs a release of scikit-build first" 281s ) 281s def test_setup_requires_keyword_include_cmake(mocker, capsys): 281s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 281s 281s tmp_dir = _tmpdir("setup_requires_keyword_include_cmake") 281s 281s setup_requires = ["cmake>=3.10"] 281s 281s tmp_dir.join("setup.py").write( 281s textwrap.dedent( 281s """ 281s from skbuild import setup 281s setup( 281s name="cmake_with_sdist_keyword", 281s version="1.2.3", 281s description="a minimal example package", 281s author='The scikit-build team', 281s license="MIT", 281s setup_requires=[{setup_requires}] 281s ) 281s """.format(setup_requires=",".join([f"'{package}'" for package in setup_requires])) 281s ) 281s ) 281s tmp_dir.join("CMakeLists.txt").write( 281s textwrap.dedent( 281s """ 281s cmake_minimum_required(VERSION 3.5.0) 281s project(test NONE) 281s install(CODE "execute_process( 281s COMMAND \\${CMAKE_COMMAND} -E sleep 0)") 281s """ 281s ) 281s ) 281s 281s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 281s 281s capsys = <_pytest.capture.CaptureFixture object at 0x709a444377a0> 281s mock_setup = 281s mocker = 281s setup_requires = ['cmake>=3.10'] 281s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-77/setup_requires_keyword_include0') 281s 281s tests/test_setup.py:363: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-77/setup_requires_keyword_include0') 281s setup_args = ['build'], disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-77/setup_requires_keyword_include0') 281s setup_args = ['build'] 281s 281s tests/__init__.py:218: AttributeError 281s __________________________ test_script_keyword[pure] ___________________________ 281s 281s distribution_type = 'pure' 281s capsys = <_pytest.capture.CaptureFixture object at 0x709a443b3ce0> 281s caplog = <_pytest.logging.LogCaptureFixture object at 0x709a44539940> 281s 281s @pytest.mark.parametrize("distribution_type", ["pure", "skbuild"]) 281s def test_script_keyword(distribution_type, capsys, caplog): 281s # ------------------------------------------------------------------------- 281s # 281s # "SOURCE" tree layout for "pure" distribution: 281s # 281s # ROOT/ 281s # setup.py 281s # foo.py 281s # bar.py 281s # 281s # "SOURCE" tree layout for "pure" distribution: 281s # 281s # ROOT/ 281s # setup.py 281s # CMakeLists.txt 281s # 281s # ------------------------------------------------------------------------- 281s # "BINARY" distribution layout is identical for both 281s # 281s # ROOT/ 281s # foo.py 281s # bar.py 281s # 281s 281s tmp_dir = _tmpdir("script_keyword") 281s 281s tmp_dir.join("setup.py").write( 281s textwrap.dedent( 281s """ 281s from skbuild import setup 281s setup( 281s name="test_script_keyword", 281s version="1.2.3", 281s description="a package testing use of script keyword", 281s author='The scikit-build team', 281s license="MIT", 281s scripts=['foo.py', 'bar.py'], 281s packages=[], 281s ) 281s """ 281s ) 281s ) 281s 281s if distribution_type == "skbuild": 281s tmp_dir.join("CMakeLists.txt").write( 281s textwrap.dedent( 281s """ 281s cmake_minimum_required(VERSION 3.5.0) 281s project(foo NONE) 281s file(WRITE "${CMAKE_BINARY_DIR}/foo.py" "# foo.py") 281s file(WRITE "${CMAKE_BINARY_DIR}/bar.py" "# bar.py") 281s install( 281s FILES 281s "${CMAKE_BINARY_DIR}/foo.py" 281s "${CMAKE_BINARY_DIR}/bar.py" 281s DESTINATION "." 281s ) 281s """ 281s ) 281s ) 281s 281s messages = [ 281s f"copying {CMAKE_INSTALL_DIR()}/{module}.py -> {SKBUILD_DIR()}/setuptools/scripts-" 281s for module in ["foo", "bar"] 281s ] 281s 281s elif distribution_type == "pure": 281s tmp_dir.join("foo.py").write("# foo.py") 281s tmp_dir.join("bar.py").write("# bar.py") 281s 281s messages = [f"copying {module}.py -> {SKBUILD_DIR()}/setuptools/scripts-" for module in ["foo", "bar"]] 281s 281s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 281s 281s caplog = <_pytest.logging.LogCaptureFixture object at 0x709a44539940> 281s capsys = <_pytest.capture.CaptureFixture object at 0x709a443b3ce0> 281s distribution_type = 'pure' 281s messages = ['copying foo.py -> _skbuild/linux-ppc64le-3.12/setuptools/scripts-', 'copying bar.py -> _skbuild/linux-ppc64le-3.12/setuptools/scripts-'] 281s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-78/script_keyword0') 281s 281s tests/test_setup.py:448: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-78/script_keyword0') 281s setup_args = ['build'], disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-78/script_keyword0') 281s setup_args = ['build'] 281s 281s tests/__init__.py:218: AttributeError 281s _________________________ test_script_keyword[skbuild] _________________________ 281s 281s distribution_type = 'skbuild' 281s capsys = <_pytest.capture.CaptureFixture object at 0x709a44580e00> 281s caplog = <_pytest.logging.LogCaptureFixture object at 0x709a44581310> 281s 281s @pytest.mark.parametrize("distribution_type", ["pure", "skbuild"]) 281s def test_script_keyword(distribution_type, capsys, caplog): 281s # ------------------------------------------------------------------------- 281s # 281s # "SOURCE" tree layout for "pure" distribution: 281s # 281s # ROOT/ 281s # setup.py 281s # foo.py 281s # bar.py 281s # 281s # "SOURCE" tree layout for "pure" distribution: 281s # 281s # ROOT/ 281s # setup.py 281s # CMakeLists.txt 281s # 281s # ------------------------------------------------------------------------- 281s # "BINARY" distribution layout is identical for both 281s # 281s # ROOT/ 281s # foo.py 281s # bar.py 281s # 281s 281s tmp_dir = _tmpdir("script_keyword") 281s 281s tmp_dir.join("setup.py").write( 281s textwrap.dedent( 281s """ 281s from skbuild import setup 281s setup( 281s name="test_script_keyword", 281s version="1.2.3", 281s description="a package testing use of script keyword", 281s author='The scikit-build team', 281s license="MIT", 281s scripts=['foo.py', 'bar.py'], 281s packages=[], 281s ) 281s """ 281s ) 281s ) 281s 281s if distribution_type == "skbuild": 281s tmp_dir.join("CMakeLists.txt").write( 281s textwrap.dedent( 281s """ 281s cmake_minimum_required(VERSION 3.5.0) 281s project(foo NONE) 281s file(WRITE "${CMAKE_BINARY_DIR}/foo.py" "# foo.py") 281s file(WRITE "${CMAKE_BINARY_DIR}/bar.py" "# bar.py") 281s install( 281s FILES 281s "${CMAKE_BINARY_DIR}/foo.py" 281s "${CMAKE_BINARY_DIR}/bar.py" 281s DESTINATION "." 281s ) 281s """ 281s ) 281s ) 281s 281s messages = [ 281s f"copying {CMAKE_INSTALL_DIR()}/{module}.py -> {SKBUILD_DIR()}/setuptools/scripts-" 281s for module in ["foo", "bar"] 281s ] 281s 281s elif distribution_type == "pure": 281s tmp_dir.join("foo.py").write("# foo.py") 281s tmp_dir.join("bar.py").write("# bar.py") 281s 281s messages = [f"copying {module}.py -> {SKBUILD_DIR()}/setuptools/scripts-" for module in ["foo", "bar"]] 281s 281s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 281s 281s caplog = <_pytest.logging.LogCaptureFixture object at 0x709a44581310> 281s capsys = <_pytest.capture.CaptureFixture object at 0x709a44580e00> 281s distribution_type = 'skbuild' 281s messages = ['copying _skbuild/linux-ppc64le-3.12/cmake-install/foo.py -> _skbuild/linux-ppc64le-3.12/setuptools/scripts-', 'copying _skbuild/linux-ppc64le-3.12/cmake-install/bar.py -> _skbuild/linux-ppc64le-3.12/setuptools/scripts-'] 281s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-79/script_keyword0') 281s 281s tests/test_setup.py:448: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-79/script_keyword0') 281s setup_args = ['build'], disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-79/script_keyword0') 281s setup_args = ['build'] 281s 281s tests/__init__.py:218: AttributeError 281s ________________________ test_py_modules_keyword[pure] _________________________ 281s 281s distribution_type = 'pure' 281s capsys = <_pytest.capture.CaptureFixture object at 0x709a44580920> 281s caplog = <_pytest.logging.LogCaptureFixture object at 0x709a44579ca0> 281s 281s @pytest.mark.parametrize("distribution_type", ["pure", "skbuild"]) 281s def test_py_modules_keyword(distribution_type, capsys, caplog): 281s # ------------------------------------------------------------------------- 281s # 281s # "SOURCE" tree layout for "pure" distribution: 281s # 281s # ROOT/ 281s # setup.py 281s # foo.py 281s # bar.py 281s # 281s # "SOURCE" tree layout for "skbuild" distribution: 281s # 281s # ROOT/ 281s # setup.py 281s # CMakeLists.txt 281s # 281s # ------------------------------------------------------------------------- 281s # "BINARY" distribution layout is identical for both 281s # 281s # ROOT/ 281s # foo.py 281s # bar.py 281s # 281s 281s tmp_dir = _tmpdir("py_modules_keyword") 281s 281s tmp_dir.join("setup.py").write( 281s textwrap.dedent( 281s """ 281s from skbuild import setup 281s setup( 281s name="test_py_modules_keyword", 281s version="1.2.3", 281s description="a package testing use of py_modules keyword", 281s author='The scikit-build team', 281s license="MIT", 281s py_modules=['foo', 'bar'] 281s ) 281s """ 281s ) 281s ) 281s 281s if distribution_type == "skbuild": 281s tmp_dir.join("CMakeLists.txt").write( 281s textwrap.dedent( 281s """ 281s cmake_minimum_required(VERSION 3.5.0) 281s project(foobar NONE) 281s file(WRITE "${CMAKE_BINARY_DIR}/foo.py" "# foo.py") 281s file(WRITE "${CMAKE_BINARY_DIR}/bar.py" "# bar.py") 281s install( 281s FILES 281s "${CMAKE_BINARY_DIR}/foo.py" 281s "${CMAKE_BINARY_DIR}/bar.py" 281s DESTINATION "." 281s ) 281s """ 281s ) 281s ) 281s 281s messages = [ 281s f"copying {CMAKE_INSTALL_DIR()}/{module}.py -> {SKBUILD_DIR()}/setuptools/lib" for module in ["foo", "bar"] 281s ] 281s 281s elif distribution_type == "pure": 281s tmp_dir.join("foo.py").write("# foo.py") 281s tmp_dir.join("bar.py").write("# bar.py") 281s 281s messages = [f"copying {module}.py -> {SKBUILD_DIR()}/setuptools/lib" for module in ["foo", "bar"]] 281s 281s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 281s 281s caplog = <_pytest.logging.LogCaptureFixture object at 0x709a44579ca0> 281s capsys = <_pytest.capture.CaptureFixture object at 0x709a44580920> 281s distribution_type = 'pure' 281s messages = ['copying foo.py -> _skbuild/linux-ppc64le-3.12/setuptools/lib', 'copying bar.py -> _skbuild/linux-ppc64le-3.12/setuptools/lib'] 281s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-80/py_modules_keyword0') 281s 281s tests/test_setup.py:528: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-80/py_modules_keyword0') 281s setup_args = ['build'], disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-80/py_modules_keyword0') 281s setup_args = ['build'] 281s 281s tests/__init__.py:218: AttributeError 281s _______________________ test_py_modules_keyword[skbuild] _______________________ 281s 281s distribution_type = 'skbuild' 281s capsys = <_pytest.capture.CaptureFixture object at 0x709a44436fc0> 281s caplog = <_pytest.logging.LogCaptureFixture object at 0x709a44437dd0> 281s 281s @pytest.mark.parametrize("distribution_type", ["pure", "skbuild"]) 281s def test_py_modules_keyword(distribution_type, capsys, caplog): 281s # ------------------------------------------------------------------------- 281s # 281s # "SOURCE" tree layout for "pure" distribution: 281s # 281s # ROOT/ 281s # setup.py 281s # foo.py 281s # bar.py 281s # 281s # "SOURCE" tree layout for "skbuild" distribution: 281s # 281s # ROOT/ 281s # setup.py 281s # CMakeLists.txt 281s # 281s # ------------------------------------------------------------------------- 281s # "BINARY" distribution layout is identical for both 281s # 281s # ROOT/ 281s # foo.py 281s # bar.py 281s # 281s 281s tmp_dir = _tmpdir("py_modules_keyword") 281s 281s tmp_dir.join("setup.py").write( 281s textwrap.dedent( 281s """ 281s from skbuild import setup 281s setup( 281s name="test_py_modules_keyword", 281s version="1.2.3", 281s description="a package testing use of py_modules keyword", 281s author='The scikit-build team', 281s license="MIT", 281s py_modules=['foo', 'bar'] 281s ) 281s """ 281s ) 281s ) 281s 281s if distribution_type == "skbuild": 281s tmp_dir.join("CMakeLists.txt").write( 281s textwrap.dedent( 281s """ 281s cmake_minimum_required(VERSION 3.5.0) 281s project(foobar NONE) 281s file(WRITE "${CMAKE_BINARY_DIR}/foo.py" "# foo.py") 281s file(WRITE "${CMAKE_BINARY_DIR}/bar.py" "# bar.py") 281s install( 281s FILES 281s "${CMAKE_BINARY_DIR}/foo.py" 281s "${CMAKE_BINARY_DIR}/bar.py" 281s DESTINATION "." 281s ) 281s """ 281s ) 281s ) 281s 281s messages = [ 281s f"copying {CMAKE_INSTALL_DIR()}/{module}.py -> {SKBUILD_DIR()}/setuptools/lib" for module in ["foo", "bar"] 281s ] 281s 281s elif distribution_type == "pure": 281s tmp_dir.join("foo.py").write("# foo.py") 281s tmp_dir.join("bar.py").write("# bar.py") 281s 281s messages = [f"copying {module}.py -> {SKBUILD_DIR()}/setuptools/lib" for module in ["foo", "bar"]] 281s 281s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 281s 281s caplog = <_pytest.logging.LogCaptureFixture object at 0x709a44437dd0> 281s capsys = <_pytest.capture.CaptureFixture object at 0x709a44436fc0> 281s distribution_type = 'skbuild' 281s messages = ['copying _skbuild/linux-ppc64le-3.12/cmake-install/foo.py -> _skbuild/linux-ppc64le-3.12/setuptools/lib', 'copying _skbuild/linux-ppc64le-3.12/cmake-install/bar.py -> _skbuild/linux-ppc64le-3.12/setuptools/lib'] 281s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-81/py_modules_keyword0') 281s 281s tests/test_setup.py:528: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-81/py_modules_keyword0') 281s setup_args = ['build'], disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-81/py_modules_keyword0') 281s setup_args = ['build'] 281s 281s tests/__init__.py:218: AttributeError 281s ________________________ test_setup_inputs[0-0-0-0-0-0] ________________________ 281s 281s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 0 281s has_pure_package = 0, has_pure_module = 0, with_package_base = 0 281s mocker = 281s 281s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 281s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 281s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 281s @pytest.mark.parametrize("has_pure_package", [0, 1]) 281s @pytest.mark.parametrize("has_pure_module", [0, 1]) 281s @pytest.mark.parametrize("with_package_base", [0, 1]) 281s def test_setup_inputs( 281s has_cmake_package, 281s has_cmake_module, 281s has_hybrid_package, 281s has_pure_package, 281s has_pure_module, 281s with_package_base, 281s mocker, 281s ): 281s """This test that a project can have a package with some modules 281s installed using setup.py and some other modules installed using CMake. 281s """ 281s 281s tmp_dir = _tmpdir("test_setup_inputs") 281s 281s package_base = "to/the/base" if with_package_base else "" 281s package_base_dir = package_base + "/" if package_base else "" 281s cmake_source_dir = package_base 281s 281s if cmake_source_dir and (has_cmake_package or has_cmake_module): 281s pytest.skip( 281s "unsupported configuration: " 281s "python package fully generated by CMake does *NOT* work. " 281s "At least __init__.py should be in the project source tree" 281s ) 281s 281s # ------------------------------------------------------------------------- 281s # Here is the "SOURCE" tree layout: 281s # 281s # ROOT/ 281s # 281s # setup.py 281s # 281s # [/] 281s # 281s # pureModule.py 281s # 281s # pure/ 281s # __init__.py 281s # pure.py 281s # 281s # data/ 281s # pure.dat 281s # 281s # [/] 281s # 281s # hybrid/ 281s # CMakeLists.txt 281s # __init__.py 281s # hybrid_pure.dat 281s # hybrid_pure.py 281s # 281s # data/ 281s # hybrid_data_pure.dat 281s # 281s # hybrid_2/ 281s # __init__.py 281s # hybrid_2_pure.py 281s # 281s # hybrid_2_pure/ 281s # __init__.py 281s # hybrid_2_pure_1.py 281s # hybrid_2_pure_2.py 281s # 281s # 281s # ------------------------------------------------------------------------- 281s # and here is the "BINARY" distribution layout: 281s # 281s # The comment "CMake" or "Setuptools" indicates which tool is responsible 281s # for placing the file in the tree used to create the binary distribution. 281s # 281s # ROOT/ 281s # 281s # cmakeModule.py # CMake 281s # 281s # cmake/ 281s # __init__.py # CMake 281s # cmake.py # CMake 281s # 281s # hybrid/ 281s # hybrid_cmake.dat # CMake 281s # hybrid_cmake.py # CMake 281s # hybrid_pure.dat # Setuptools 281s # hybrid_pure.py # Setuptools 281s # 281s # data/ 281s # hybrid_data_pure.dat # CMake or Setuptools 281s # hybrid_data_cmake.dat # CMake *NO TEST* 281s # 281s # hybrid_2/ 281s # __init__.py # CMake or Setuptools 281s # hybrid_2_pure.py # CMake or Setuptools 281s # hybrid_2_cmake.py # CMake 281s # 281s # hybrid_2_pure/ 281s # __init__.py # CMake or Setuptools 281s # hybrid_2_pure_1.py # CMake or Setuptools 281s # hybrid_2_pure_2.py # CMake or Setuptools 281s # 281s # pureModule.py # Setuptools 281s # 281s # pure/ 281s # __init__.py # Setuptools 281s # pure.py # Setuptools 281s # 281s # data/ 281s # pure.dat # Setuptools 281s 281s tmp_dir.join("setup.py").write( 281s textwrap.dedent( 281s """ 281s from skbuild import setup 281s #from setuptools import setup 281s setup( 281s name="test_hybrid_project", 281s version="1.2.3", 281s description=("an hybrid package mixing files installed by both " 281s "CMake and setuptools"), 281s author='The scikit-build team', 281s license="MIT", 281s cmake_source_dir='{cmake_source_dir}', 281s cmake_install_dir='{cmake_install_dir}', 281s # Arbitrary order of packages 281s packages=[ 281s {p_off} 'pure', 281s {h_off} 'hybrid.hybrid_2', 281s {h_off} 'hybrid', 281s {c_off} 'cmake', 281s {p_off} 'hybrid.hybrid_2_pure', 281s ], 281s py_modules=[ 281s {pm_off} '{package_base}pureModule', 281s {cm_off} '{package_base}cmakeModule', 281s ], 281s package_data={{ 281s {p_off} 'pure': ['data/pure.dat'], 281s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 281s }}, 281s # Arbitrary order of package_dir 281s package_dir = {{ 281s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 281s {p_off} 'pure': '{package_base}pure', 281s {h_off} 'hybrid': '{package_base}hybrid', 281s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 281s {c_off} 'cmake': '{package_base}cmake', 281s }} 281s ) 281s """.format( 281s cmake_source_dir=cmake_source_dir, 281s cmake_install_dir=package_base, 281s package_base=package_base_dir, 281s c_off="" if has_cmake_package else "#", 281s cm_off="" if has_cmake_module else "#", 281s h_off="" if has_hybrid_package else "#", 281s p_off="" if has_pure_package else "#", 281s pm_off="" if has_pure_module else "#", 281s ) 281s ) 281s ) 281s 281s src_dir = tmp_dir.ensure(package_base, dir=1) 281s 281s src_dir.join("CMakeLists.txt").write( 281s textwrap.dedent( 281s """ 281s cmake_minimum_required(VERSION 3.5.0) 281s project(hybrid NONE) 281s set(build_dir ${{CMAKE_BINARY_DIR}}) 281s 281s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 281s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 281s {c_off} install( 281s {c_off} FILES 281s {c_off} ${{build_dir}}/__init__.py 281s {c_off} ${{build_dir}}/cmake.py 281s {c_off} DESTINATION cmake 281s {c_off} ) 281s 281s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 281s {cm_off} install( 281s {cm_off} FILES ${{build_dir}}/cmakeModule.py 281s {cm_off} DESTINATION .) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 281s {h_off} DESTINATION hybrid) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 281s {h_off} DESTINATION hybrid) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 281s {h_off} DESTINATION hybrid/data) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 281s {h_off} DESTINATION hybrid/hybrid_2) 281s 281s install(CODE "message(STATUS \\\"Installation complete\\\")") 281s """.format( 281s c_off="" if has_cmake_package else "#", 281s cm_off="" if has_cmake_module else "#", 281s h_off="" if has_hybrid_package else "#", 281s ) 281s ) 281s ) 281s 281s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 281s path_types: Sequence[str] 281s try: 281s path_types = next( 281s iter( 281s zip( 281s *filter( 281s lambda i: i[1], 281s [ 281s ("c", has_cmake_package), 281s ("cm", has_cmake_module), 281s ("h", has_hybrid_package), 281s ("p", has_pure_package), 281s ("pm", has_pure_module), 281s ], 281s ) 281s ) 281s ) 281s ) 281s except StopIteration: 281s path_types = [] 281s 281s def select_paths(annotated_paths): 281s """Return a filtered list paths considering ``path_types``. 281s 281s `annotated_paths`` is list of tuple ``(type, path)`` where type 281s is either `c`, 'cm', `h`, `p` or 'pm'. 281s 281s """ 281s return filter(lambda i: i[0] in path_types, annotated_paths) 281s 281s # Commented paths are the one expected to be installed by CMake. For 281s # this reason, corresponding files should NOT be created in the source 281s # tree. 281s for _type, path in select_paths( 281s [ 281s # ('c', 'cmake/__init__.py'), 281s # ('c', 'cmake/cmake.py'), 281s # ('cm', 'cmakeModule.py'), 281s ("h", "hybrid/__init__.py"), 281s # ('h', 'hybrid/hybrid_cmake.dat'), 281s # ('h', 'hybrid/hybrid_cmake.py'), 281s ("h", "hybrid/hybrid_pure.dat"), 281s ("h", "hybrid/hybrid_pure.py"), 281s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 281s ("h", "hybrid/data/hybrid_data_pure.dat"), 281s ("h", "hybrid/hybrid_2/__init__.py"), 281s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 281s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 281s ("p", "hybrid/hybrid_2_pure/__init__.py"), 281s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 281s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 281s ("pm", "pureModule.py"), 281s ("p", "pure/__init__.py"), 281s ("p", "pure/pure.py"), 281s ("p", "pure/data/pure.dat"), 281s ] 281s ): 281s assert _type in {"p", "pm", "h"} 281s root = package_base if _type in {"p", "pm"} else cmake_source_dir 281s tmp_dir.ensure(os.path.join(root, path)) 281s 281s # Do not call the real setup function. Instead, replace it with 281s # a MagicMock allowing to check with which arguments it was invoked. 281s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 281s 281s # Convenience print function 281s def _pprint(desc, value=None): 281s print( 281s "-----------------\n" 281s f"{desc}:\n" 281s "\n" 281s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 281s ) 281s 281s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 281s 281s _pprint = ._pprint at 0x709a44384040> 281s cmake_source_dir = '' 281s has_cmake_module = 0 281s has_cmake_package = 0 281s has_hybrid_package = 0 281s has_pure_module = 0 281s has_pure_package = 0 281s mock_setup = 281s mocker = 281s package_base = '' 281s package_base_dir = '' 281s path_types = [] 281s select_paths = .select_paths at 0x709a445b2f20> 281s src_dir = local('/tmp/pytest-of-ubuntu/pytest-82/test_setup_inputs0') 281s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-82/test_setup_inputs0') 281s with_package_base = 0 281s 281s tests/test_setup.py:849: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-82/test_setup_inputs0') 281s setup_args = ['build'], disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-82/test_setup_inputs0') 281s setup_args = ['build'] 281s 281s tests/__init__.py:218: AttributeError 281s ________________________ test_setup_inputs[0-0-0-0-0-1] ________________________ 281s 281s has_cmake_package = 1, has_cmake_module = 0, has_hybrid_package = 0 281s has_pure_package = 0, has_pure_module = 0, with_package_base = 0 281s mocker = 281s 281s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 281s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 281s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 281s @pytest.mark.parametrize("has_pure_package", [0, 1]) 281s @pytest.mark.parametrize("has_pure_module", [0, 1]) 281s @pytest.mark.parametrize("with_package_base", [0, 1]) 281s def test_setup_inputs( 281s has_cmake_package, 281s has_cmake_module, 281s has_hybrid_package, 281s has_pure_package, 281s has_pure_module, 281s with_package_base, 281s mocker, 281s ): 281s """This test that a project can have a package with some modules 281s installed using setup.py and some other modules installed using CMake. 281s """ 281s 281s tmp_dir = _tmpdir("test_setup_inputs") 281s 281s package_base = "to/the/base" if with_package_base else "" 281s package_base_dir = package_base + "/" if package_base else "" 281s cmake_source_dir = package_base 281s 281s if cmake_source_dir and (has_cmake_package or has_cmake_module): 281s pytest.skip( 281s "unsupported configuration: " 281s "python package fully generated by CMake does *NOT* work. " 281s "At least __init__.py should be in the project source tree" 281s ) 281s 281s # ------------------------------------------------------------------------- 281s # Here is the "SOURCE" tree layout: 281s # 281s # ROOT/ 281s # 281s # setup.py 281s # 281s # [/] 281s # 281s # pureModule.py 281s # 281s # pure/ 281s # __init__.py 281s # pure.py 281s # 281s # data/ 281s # pure.dat 281s # 281s # [/] 281s # 281s # hybrid/ 281s # CMakeLists.txt 281s # __init__.py 281s # hybrid_pure.dat 281s # hybrid_pure.py 281s # 281s # data/ 281s # hybrid_data_pure.dat 281s # 281s # hybrid_2/ 281s # __init__.py 281s # hybrid_2_pure.py 281s # 281s # hybrid_2_pure/ 281s # __init__.py 281s # hybrid_2_pure_1.py 281s # hybrid_2_pure_2.py 281s # 281s # 281s # ------------------------------------------------------------------------- 281s # and here is the "BINARY" distribution layout: 281s # 281s # The comment "CMake" or "Setuptools" indicates which tool is responsible 281s # for placing the file in the tree used to create the binary distribution. 281s # 281s # ROOT/ 281s # 281s # cmakeModule.py # CMake 281s # 281s # cmake/ 281s # __init__.py # CMake 281s # cmake.py # CMake 281s # 281s # hybrid/ 281s # hybrid_cmake.dat # CMake 281s # hybrid_cmake.py # CMake 281s # hybrid_pure.dat # Setuptools 281s # hybrid_pure.py # Setuptools 281s # 281s # data/ 281s # hybrid_data_pure.dat # CMake or Setuptools 281s # hybrid_data_cmake.dat # CMake *NO TEST* 281s # 281s # hybrid_2/ 281s # __init__.py # CMake or Setuptools 281s # hybrid_2_pure.py # CMake or Setuptools 281s # hybrid_2_cmake.py # CMake 281s # 281s # hybrid_2_pure/ 281s # __init__.py # CMake or Setuptools 281s # hybrid_2_pure_1.py # CMake or Setuptools 281s # hybrid_2_pure_2.py # CMake or Setuptools 281s # 281s # pureModule.py # Setuptools 281s # 281s # pure/ 281s # __init__.py # Setuptools 281s # pure.py # Setuptools 281s # 281s # data/ 281s # pure.dat # Setuptools 281s 281s tmp_dir.join("setup.py").write( 281s textwrap.dedent( 281s """ 281s from skbuild import setup 281s #from setuptools import setup 281s setup( 281s name="test_hybrid_project", 281s version="1.2.3", 281s description=("an hybrid package mixing files installed by both " 281s "CMake and setuptools"), 281s author='The scikit-build team', 281s license="MIT", 281s cmake_source_dir='{cmake_source_dir}', 281s cmake_install_dir='{cmake_install_dir}', 281s # Arbitrary order of packages 281s packages=[ 281s {p_off} 'pure', 281s {h_off} 'hybrid.hybrid_2', 281s {h_off} 'hybrid', 281s {c_off} 'cmake', 281s {p_off} 'hybrid.hybrid_2_pure', 281s ], 281s py_modules=[ 281s {pm_off} '{package_base}pureModule', 281s {cm_off} '{package_base}cmakeModule', 281s ], 281s package_data={{ 281s {p_off} 'pure': ['data/pure.dat'], 281s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 281s }}, 281s # Arbitrary order of package_dir 281s package_dir = {{ 281s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 281s {p_off} 'pure': '{package_base}pure', 281s {h_off} 'hybrid': '{package_base}hybrid', 281s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 281s {c_off} 'cmake': '{package_base}cmake', 281s }} 281s ) 281s """.format( 281s cmake_source_dir=cmake_source_dir, 281s cmake_install_dir=package_base, 281s package_base=package_base_dir, 281s c_off="" if has_cmake_package else "#", 281s cm_off="" if has_cmake_module else "#", 281s h_off="" if has_hybrid_package else "#", 281s p_off="" if has_pure_package else "#", 281s pm_off="" if has_pure_module else "#", 281s ) 281s ) 281s ) 281s 281s src_dir = tmp_dir.ensure(package_base, dir=1) 281s 281s src_dir.join("CMakeLists.txt").write( 281s textwrap.dedent( 281s """ 281s cmake_minimum_required(VERSION 3.5.0) 281s project(hybrid NONE) 281s set(build_dir ${{CMAKE_BINARY_DIR}}) 281s 281s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 281s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 281s {c_off} install( 281s {c_off} FILES 281s {c_off} ${{build_dir}}/__init__.py 281s {c_off} ${{build_dir}}/cmake.py 281s {c_off} DESTINATION cmake 281s {c_off} ) 281s 281s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 281s {cm_off} install( 281s {cm_off} FILES ${{build_dir}}/cmakeModule.py 281s {cm_off} DESTINATION .) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 281s {h_off} DESTINATION hybrid) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 281s {h_off} DESTINATION hybrid) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 281s {h_off} DESTINATION hybrid/data) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 281s {h_off} DESTINATION hybrid/hybrid_2) 281s 281s install(CODE "message(STATUS \\\"Installation complete\\\")") 281s """.format( 281s c_off="" if has_cmake_package else "#", 281s cm_off="" if has_cmake_module else "#", 281s h_off="" if has_hybrid_package else "#", 281s ) 281s ) 281s ) 281s 281s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 281s path_types: Sequence[str] 281s try: 281s path_types = next( 281s iter( 281s zip( 281s *filter( 281s lambda i: i[1], 281s [ 281s ("c", has_cmake_package), 281s ("cm", has_cmake_module), 281s ("h", has_hybrid_package), 281s ("p", has_pure_package), 281s ("pm", has_pure_module), 281s ], 281s ) 281s ) 281s ) 281s ) 281s except StopIteration: 281s path_types = [] 281s 281s def select_paths(annotated_paths): 281s """Return a filtered list paths considering ``path_types``. 281s 281s `annotated_paths`` is list of tuple ``(type, path)`` where type 281s is either `c`, 'cm', `h`, `p` or 'pm'. 281s 281s """ 281s return filter(lambda i: i[0] in path_types, annotated_paths) 281s 281s # Commented paths are the one expected to be installed by CMake. For 281s # this reason, corresponding files should NOT be created in the source 281s # tree. 281s for _type, path in select_paths( 281s [ 281s # ('c', 'cmake/__init__.py'), 281s # ('c', 'cmake/cmake.py'), 281s # ('cm', 'cmakeModule.py'), 281s ("h", "hybrid/__init__.py"), 281s # ('h', 'hybrid/hybrid_cmake.dat'), 281s # ('h', 'hybrid/hybrid_cmake.py'), 281s ("h", "hybrid/hybrid_pure.dat"), 281s ("h", "hybrid/hybrid_pure.py"), 281s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 281s ("h", "hybrid/data/hybrid_data_pure.dat"), 281s ("h", "hybrid/hybrid_2/__init__.py"), 281s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 281s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 281s ("p", "hybrid/hybrid_2_pure/__init__.py"), 281s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 281s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 281s ("pm", "pureModule.py"), 281s ("p", "pure/__init__.py"), 281s ("p", "pure/pure.py"), 281s ("p", "pure/data/pure.dat"), 281s ] 281s ): 281s assert _type in {"p", "pm", "h"} 281s root = package_base if _type in {"p", "pm"} else cmake_source_dir 281s tmp_dir.ensure(os.path.join(root, path)) 281s 281s # Do not call the real setup function. Instead, replace it with 281s # a MagicMock allowing to check with which arguments it was invoked. 281s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 281s 281s # Convenience print function 281s def _pprint(desc, value=None): 281s print( 281s "-----------------\n" 281s f"{desc}:\n" 281s "\n" 281s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 281s ) 281s 281s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 281s 281s _pprint = ._pprint at 0x709a444816c0> 281s cmake_source_dir = '' 281s has_cmake_module = 0 281s has_cmake_package = 1 281s has_hybrid_package = 0 281s has_pure_module = 0 281s has_pure_package = 0 281s mock_setup = 281s mocker = 281s package_base = '' 281s package_base_dir = '' 281s path_types = ('c',) 281s select_paths = .select_paths at 0x709a4441f380> 281s src_dir = local('/tmp/pytest-of-ubuntu/pytest-83/test_setup_inputs0') 281s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-83/test_setup_inputs0') 281s with_package_base = 0 281s 281s tests/test_setup.py:849: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-83/test_setup_inputs0') 281s setup_args = ['build'], disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-83/test_setup_inputs0') 281s setup_args = ['build'] 281s 281s tests/__init__.py:218: AttributeError 281s ________________________ test_setup_inputs[0-0-0-0-1-0] ________________________ 281s 281s has_cmake_package = 0, has_cmake_module = 1, has_hybrid_package = 0 281s has_pure_package = 0, has_pure_module = 0, with_package_base = 0 281s mocker = 281s 281s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 281s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 281s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 281s @pytest.mark.parametrize("has_pure_package", [0, 1]) 281s @pytest.mark.parametrize("has_pure_module", [0, 1]) 281s @pytest.mark.parametrize("with_package_base", [0, 1]) 281s def test_setup_inputs( 281s has_cmake_package, 281s has_cmake_module, 281s has_hybrid_package, 281s has_pure_package, 281s has_pure_module, 281s with_package_base, 281s mocker, 281s ): 281s """This test that a project can have a package with some modules 281s installed using setup.py and some other modules installed using CMake. 281s """ 281s 281s tmp_dir = _tmpdir("test_setup_inputs") 281s 281s package_base = "to/the/base" if with_package_base else "" 281s package_base_dir = package_base + "/" if package_base else "" 281s cmake_source_dir = package_base 281s 281s if cmake_source_dir and (has_cmake_package or has_cmake_module): 281s pytest.skip( 281s "unsupported configuration: " 281s "python package fully generated by CMake does *NOT* work. " 281s "At least __init__.py should be in the project source tree" 281s ) 281s 281s # ------------------------------------------------------------------------- 281s # Here is the "SOURCE" tree layout: 281s # 281s # ROOT/ 281s # 281s # setup.py 281s # 281s # [/] 281s # 281s # pureModule.py 281s # 281s # pure/ 281s # __init__.py 281s # pure.py 281s # 281s # data/ 281s # pure.dat 281s # 281s # [/] 281s # 281s # hybrid/ 281s # CMakeLists.txt 281s # __init__.py 281s # hybrid_pure.dat 281s # hybrid_pure.py 281s # 281s # data/ 281s # hybrid_data_pure.dat 281s # 281s # hybrid_2/ 281s # __init__.py 281s # hybrid_2_pure.py 281s # 281s # hybrid_2_pure/ 281s # __init__.py 281s # hybrid_2_pure_1.py 281s # hybrid_2_pure_2.py 281s # 281s # 281s # ------------------------------------------------------------------------- 281s # and here is the "BINARY" distribution layout: 281s # 281s # The comment "CMake" or "Setuptools" indicates which tool is responsible 281s # for placing the file in the tree used to create the binary distribution. 281s # 281s # ROOT/ 281s # 281s # cmakeModule.py # CMake 281s # 281s # cmake/ 281s # __init__.py # CMake 281s # cmake.py # CMake 281s # 281s # hybrid/ 281s # hybrid_cmake.dat # CMake 281s # hybrid_cmake.py # CMake 281s # hybrid_pure.dat # Setuptools 281s # hybrid_pure.py # Setuptools 281s # 281s # data/ 281s # hybrid_data_pure.dat # CMake or Setuptools 281s # hybrid_data_cmake.dat # CMake *NO TEST* 281s # 281s # hybrid_2/ 281s # __init__.py # CMake or Setuptools 281s # hybrid_2_pure.py # CMake or Setuptools 281s # hybrid_2_cmake.py # CMake 281s # 281s # hybrid_2_pure/ 281s # __init__.py # CMake or Setuptools 281s # hybrid_2_pure_1.py # CMake or Setuptools 281s # hybrid_2_pure_2.py # CMake or Setuptools 281s # 281s # pureModule.py # Setuptools 281s # 281s # pure/ 281s # __init__.py # Setuptools 281s # pure.py # Setuptools 281s # 281s # data/ 281s # pure.dat # Setuptools 281s 281s tmp_dir.join("setup.py").write( 281s textwrap.dedent( 281s """ 281s from skbuild import setup 281s #from setuptools import setup 281s setup( 281s name="test_hybrid_project", 281s version="1.2.3", 281s description=("an hybrid package mixing files installed by both " 281s "CMake and setuptools"), 281s author='The scikit-build team', 281s license="MIT", 281s cmake_source_dir='{cmake_source_dir}', 281s cmake_install_dir='{cmake_install_dir}', 281s # Arbitrary order of packages 281s packages=[ 281s {p_off} 'pure', 281s {h_off} 'hybrid.hybrid_2', 281s {h_off} 'hybrid', 281s {c_off} 'cmake', 281s {p_off} 'hybrid.hybrid_2_pure', 281s ], 281s py_modules=[ 281s {pm_off} '{package_base}pureModule', 281s {cm_off} '{package_base}cmakeModule', 281s ], 281s package_data={{ 281s {p_off} 'pure': ['data/pure.dat'], 281s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 281s }}, 281s # Arbitrary order of package_dir 281s package_dir = {{ 281s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 281s {p_off} 'pure': '{package_base}pure', 281s {h_off} 'hybrid': '{package_base}hybrid', 281s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 281s {c_off} 'cmake': '{package_base}cmake', 281s }} 281s ) 281s """.format( 281s cmake_source_dir=cmake_source_dir, 281s cmake_install_dir=package_base, 281s package_base=package_base_dir, 281s c_off="" if has_cmake_package else "#", 281s cm_off="" if has_cmake_module else "#", 281s h_off="" if has_hybrid_package else "#", 281s p_off="" if has_pure_package else "#", 281s pm_off="" if has_pure_module else "#", 281s ) 281s ) 281s ) 281s 281s src_dir = tmp_dir.ensure(package_base, dir=1) 281s 281s src_dir.join("CMakeLists.txt").write( 281s textwrap.dedent( 281s """ 281s cmake_minimum_required(VERSION 3.5.0) 281s project(hybrid NONE) 281s set(build_dir ${{CMAKE_BINARY_DIR}}) 281s 281s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 281s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 281s {c_off} install( 281s {c_off} FILES 281s {c_off} ${{build_dir}}/__init__.py 281s {c_off} ${{build_dir}}/cmake.py 281s {c_off} DESTINATION cmake 281s {c_off} ) 281s 281s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 281s {cm_off} install( 281s {cm_off} FILES ${{build_dir}}/cmakeModule.py 281s {cm_off} DESTINATION .) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 281s {h_off} DESTINATION hybrid) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 281s {h_off} DESTINATION hybrid) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 281s {h_off} DESTINATION hybrid/data) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 281s {h_off} DESTINATION hybrid/hybrid_2) 281s 281s install(CODE "message(STATUS \\\"Installation complete\\\")") 281s """.format( 281s c_off="" if has_cmake_package else "#", 281s cm_off="" if has_cmake_module else "#", 281s h_off="" if has_hybrid_package else "#", 281s ) 281s ) 281s ) 281s 281s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 281s path_types: Sequence[str] 281s try: 281s path_types = next( 281s iter( 281s zip( 281s *filter( 281s lambda i: i[1], 281s [ 281s ("c", has_cmake_package), 281s ("cm", has_cmake_module), 281s ("h", has_hybrid_package), 281s ("p", has_pure_package), 281s ("pm", has_pure_module), 281s ], 281s ) 281s ) 281s ) 281s ) 281s except StopIteration: 281s path_types = [] 281s 281s def select_paths(annotated_paths): 281s """Return a filtered list paths considering ``path_types``. 281s 281s `annotated_paths`` is list of tuple ``(type, path)`` where type 281s is either `c`, 'cm', `h`, `p` or 'pm'. 281s 281s """ 281s return filter(lambda i: i[0] in path_types, annotated_paths) 281s 281s # Commented paths are the one expected to be installed by CMake. For 281s # this reason, corresponding files should NOT be created in the source 281s # tree. 281s for _type, path in select_paths( 281s [ 281s # ('c', 'cmake/__init__.py'), 281s # ('c', 'cmake/cmake.py'), 281s # ('cm', 'cmakeModule.py'), 281s ("h", "hybrid/__init__.py"), 281s # ('h', 'hybrid/hybrid_cmake.dat'), 281s # ('h', 'hybrid/hybrid_cmake.py'), 281s ("h", "hybrid/hybrid_pure.dat"), 281s ("h", "hybrid/hybrid_pure.py"), 281s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 281s ("h", "hybrid/data/hybrid_data_pure.dat"), 281s ("h", "hybrid/hybrid_2/__init__.py"), 281s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 281s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 281s ("p", "hybrid/hybrid_2_pure/__init__.py"), 281s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 281s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 281s ("pm", "pureModule.py"), 281s ("p", "pure/__init__.py"), 281s ("p", "pure/pure.py"), 281s ("p", "pure/data/pure.dat"), 281s ] 281s ): 281s assert _type in {"p", "pm", "h"} 281s root = package_base if _type in {"p", "pm"} else cmake_source_dir 281s tmp_dir.ensure(os.path.join(root, path)) 281s 281s # Do not call the real setup function. Instead, replace it with 281s # a MagicMock allowing to check with which arguments it was invoked. 281s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 281s 281s # Convenience print function 281s def _pprint(desc, value=None): 281s print( 281s "-----------------\n" 281s f"{desc}:\n" 281s "\n" 281s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 281s ) 281s 281s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 281s 281s _pprint = ._pprint at 0x709a44384cc0> 281s cmake_source_dir = '' 281s has_cmake_module = 1 281s has_cmake_package = 0 281s has_hybrid_package = 0 281s has_pure_module = 0 281s has_pure_package = 0 281s mock_setup = 281s mocker = 281s package_base = '' 281s package_base_dir = '' 281s path_types = ('cm',) 281s select_paths = .select_paths at 0x709a44483420> 281s src_dir = local('/tmp/pytest-of-ubuntu/pytest-84/test_setup_inputs0') 281s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-84/test_setup_inputs0') 281s with_package_base = 0 281s 281s tests/test_setup.py:849: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-84/test_setup_inputs0') 281s setup_args = ['build'], disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-84/test_setup_inputs0') 281s setup_args = ['build'] 281s 281s tests/__init__.py:218: AttributeError 281s ________________________ test_setup_inputs[0-0-0-0-1-1] ________________________ 281s 281s has_cmake_package = 1, has_cmake_module = 1, has_hybrid_package = 0 281s has_pure_package = 0, has_pure_module = 0, with_package_base = 0 281s mocker = 281s 281s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 281s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 281s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 281s @pytest.mark.parametrize("has_pure_package", [0, 1]) 281s @pytest.mark.parametrize("has_pure_module", [0, 1]) 281s @pytest.mark.parametrize("with_package_base", [0, 1]) 281s def test_setup_inputs( 281s has_cmake_package, 281s has_cmake_module, 281s has_hybrid_package, 281s has_pure_package, 281s has_pure_module, 281s with_package_base, 281s mocker, 281s ): 281s """This test that a project can have a package with some modules 281s installed using setup.py and some other modules installed using CMake. 281s """ 281s 281s tmp_dir = _tmpdir("test_setup_inputs") 281s 281s package_base = "to/the/base" if with_package_base else "" 281s package_base_dir = package_base + "/" if package_base else "" 281s cmake_source_dir = package_base 281s 281s if cmake_source_dir and (has_cmake_package or has_cmake_module): 281s pytest.skip( 281s "unsupported configuration: " 281s "python package fully generated by CMake does *NOT* work. " 281s "At least __init__.py should be in the project source tree" 281s ) 281s 281s # ------------------------------------------------------------------------- 281s # Here is the "SOURCE" tree layout: 281s # 281s # ROOT/ 281s # 281s # setup.py 281s # 281s # [/] 281s # 281s # pureModule.py 281s # 281s # pure/ 281s # __init__.py 281s # pure.py 281s # 281s # data/ 281s # pure.dat 281s # 281s # [/] 281s # 281s # hybrid/ 281s # CMakeLists.txt 281s # __init__.py 281s # hybrid_pure.dat 281s # hybrid_pure.py 281s # 281s # data/ 281s # hybrid_data_pure.dat 281s # 281s # hybrid_2/ 281s # __init__.py 281s # hybrid_2_pure.py 281s # 281s # hybrid_2_pure/ 281s # __init__.py 281s # hybrid_2_pure_1.py 281s # hybrid_2_pure_2.py 281s # 281s # 281s # ------------------------------------------------------------------------- 281s # and here is the "BINARY" distribution layout: 281s # 281s # The comment "CMake" or "Setuptools" indicates which tool is responsible 281s # for placing the file in the tree used to create the binary distribution. 281s # 281s # ROOT/ 281s # 281s # cmakeModule.py # CMake 281s # 281s # cmake/ 281s # __init__.py # CMake 281s # cmake.py # CMake 281s # 281s # hybrid/ 281s # hybrid_cmake.dat # CMake 281s # hybrid_cmake.py # CMake 281s # hybrid_pure.dat # Setuptools 281s # hybrid_pure.py # Setuptools 281s # 281s # data/ 281s # hybrid_data_pure.dat # CMake or Setuptools 281s # hybrid_data_cmake.dat # CMake *NO TEST* 281s # 281s # hybrid_2/ 281s # __init__.py # CMake or Setuptools 281s # hybrid_2_pure.py # CMake or Setuptools 281s # hybrid_2_cmake.py # CMake 281s # 281s # hybrid_2_pure/ 281s # __init__.py # CMake or Setuptools 281s # hybrid_2_pure_1.py # CMake or Setuptools 281s # hybrid_2_pure_2.py # CMake or Setuptools 281s # 281s # pureModule.py # Setuptools 281s # 281s # pure/ 281s # __init__.py # Setuptools 281s # pure.py # Setuptools 281s # 281s # data/ 281s # pure.dat # Setuptools 281s 281s tmp_dir.join("setup.py").write( 281s textwrap.dedent( 281s """ 281s from skbuild import setup 281s #from setuptools import setup 281s setup( 281s name="test_hybrid_project", 281s version="1.2.3", 281s description=("an hybrid package mixing files installed by both " 281s "CMake and setuptools"), 281s author='The scikit-build team', 281s license="MIT", 281s cmake_source_dir='{cmake_source_dir}', 281s cmake_install_dir='{cmake_install_dir}', 281s # Arbitrary order of packages 281s packages=[ 281s {p_off} 'pure', 281s {h_off} 'hybrid.hybrid_2', 281s {h_off} 'hybrid', 281s {c_off} 'cmake', 281s {p_off} 'hybrid.hybrid_2_pure', 281s ], 281s py_modules=[ 281s {pm_off} '{package_base}pureModule', 281s {cm_off} '{package_base}cmakeModule', 281s ], 281s package_data={{ 281s {p_off} 'pure': ['data/pure.dat'], 281s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 281s }}, 281s # Arbitrary order of package_dir 281s package_dir = {{ 281s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 281s {p_off} 'pure': '{package_base}pure', 281s {h_off} 'hybrid': '{package_base}hybrid', 281s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 281s {c_off} 'cmake': '{package_base}cmake', 281s }} 281s ) 281s """.format( 281s cmake_source_dir=cmake_source_dir, 281s cmake_install_dir=package_base, 281s package_base=package_base_dir, 281s c_off="" if has_cmake_package else "#", 281s cm_off="" if has_cmake_module else "#", 281s h_off="" if has_hybrid_package else "#", 281s p_off="" if has_pure_package else "#", 281s pm_off="" if has_pure_module else "#", 281s ) 281s ) 281s ) 281s 281s src_dir = tmp_dir.ensure(package_base, dir=1) 281s 281s src_dir.join("CMakeLists.txt").write( 281s textwrap.dedent( 281s """ 281s cmake_minimum_required(VERSION 3.5.0) 281s project(hybrid NONE) 281s set(build_dir ${{CMAKE_BINARY_DIR}}) 281s 281s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 281s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 281s {c_off} install( 281s {c_off} FILES 281s {c_off} ${{build_dir}}/__init__.py 281s {c_off} ${{build_dir}}/cmake.py 281s {c_off} DESTINATION cmake 281s {c_off} ) 281s 281s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 281s {cm_off} install( 281s {cm_off} FILES ${{build_dir}}/cmakeModule.py 281s {cm_off} DESTINATION .) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 281s {h_off} DESTINATION hybrid) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 281s {h_off} DESTINATION hybrid) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 281s {h_off} DESTINATION hybrid/data) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 281s {h_off} DESTINATION hybrid/hybrid_2) 281s 281s install(CODE "message(STATUS \\\"Installation complete\\\")") 281s """.format( 281s c_off="" if has_cmake_package else "#", 281s cm_off="" if has_cmake_module else "#", 281s h_off="" if has_hybrid_package else "#", 281s ) 281s ) 281s ) 281s 281s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 281s path_types: Sequence[str] 281s try: 281s path_types = next( 281s iter( 281s zip( 281s *filter( 281s lambda i: i[1], 281s [ 281s ("c", has_cmake_package), 281s ("cm", has_cmake_module), 281s ("h", has_hybrid_package), 281s ("p", has_pure_package), 281s ("pm", has_pure_module), 281s ], 281s ) 281s ) 281s ) 281s ) 281s except StopIteration: 281s path_types = [] 281s 281s def select_paths(annotated_paths): 281s """Return a filtered list paths considering ``path_types``. 281s 281s `annotated_paths`` is list of tuple ``(type, path)`` where type 281s is either `c`, 'cm', `h`, `p` or 'pm'. 281s 281s """ 281s return filter(lambda i: i[0] in path_types, annotated_paths) 281s 281s # Commented paths are the one expected to be installed by CMake. For 281s # this reason, corresponding files should NOT be created in the source 281s # tree. 281s for _type, path in select_paths( 281s [ 281s # ('c', 'cmake/__init__.py'), 281s # ('c', 'cmake/cmake.py'), 281s # ('cm', 'cmakeModule.py'), 281s ("h", "hybrid/__init__.py"), 281s # ('h', 'hybrid/hybrid_cmake.dat'), 281s # ('h', 'hybrid/hybrid_cmake.py'), 281s ("h", "hybrid/hybrid_pure.dat"), 281s ("h", "hybrid/hybrid_pure.py"), 281s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 281s ("h", "hybrid/data/hybrid_data_pure.dat"), 281s ("h", "hybrid/hybrid_2/__init__.py"), 281s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 281s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 281s ("p", "hybrid/hybrid_2_pure/__init__.py"), 281s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 281s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 281s ("pm", "pureModule.py"), 281s ("p", "pure/__init__.py"), 281s ("p", "pure/pure.py"), 281s ("p", "pure/data/pure.dat"), 281s ] 281s ): 281s assert _type in {"p", "pm", "h"} 281s root = package_base if _type in {"p", "pm"} else cmake_source_dir 281s tmp_dir.ensure(os.path.join(root, path)) 281s 281s # Do not call the real setup function. Instead, replace it with 281s # a MagicMock allowing to check with which arguments it was invoked. 281s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 281s 281s # Convenience print function 281s def _pprint(desc, value=None): 281s print( 281s "-----------------\n" 281s f"{desc}:\n" 281s "\n" 281s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 281s ) 281s 281s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 281s 281s _pprint = ._pprint at 0x709a44384d60> 281s cmake_source_dir = '' 281s has_cmake_module = 1 281s has_cmake_package = 1 281s has_hybrid_package = 0 281s has_pure_module = 0 281s has_pure_package = 0 281s mock_setup = 281s mocker = 281s package_base = '' 281s package_base_dir = '' 281s path_types = ('c', 'cm') 281s select_paths = .select_paths at 0x709a44385440> 281s src_dir = local('/tmp/pytest-of-ubuntu/pytest-85/test_setup_inputs0') 281s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-85/test_setup_inputs0') 281s with_package_base = 0 281s 281s tests/test_setup.py:849: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-85/test_setup_inputs0') 281s setup_args = ['build'], disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-85/test_setup_inputs0') 281s setup_args = ['build'] 281s 281s tests/__init__.py:218: AttributeError 281s ________________________ test_setup_inputs[0-0-0-1-0-0] ________________________ 281s 281s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 1 281s has_pure_package = 0, has_pure_module = 0, with_package_base = 0 281s mocker = 281s 281s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 281s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 281s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 281s @pytest.mark.parametrize("has_pure_package", [0, 1]) 281s @pytest.mark.parametrize("has_pure_module", [0, 1]) 281s @pytest.mark.parametrize("with_package_base", [0, 1]) 281s def test_setup_inputs( 281s has_cmake_package, 281s has_cmake_module, 281s has_hybrid_package, 281s has_pure_package, 281s has_pure_module, 281s with_package_base, 281s mocker, 281s ): 281s """This test that a project can have a package with some modules 281s installed using setup.py and some other modules installed using CMake. 281s """ 281s 281s tmp_dir = _tmpdir("test_setup_inputs") 281s 281s package_base = "to/the/base" if with_package_base else "" 281s package_base_dir = package_base + "/" if package_base else "" 281s cmake_source_dir = package_base 281s 281s if cmake_source_dir and (has_cmake_package or has_cmake_module): 281s pytest.skip( 281s "unsupported configuration: " 281s "python package fully generated by CMake does *NOT* work. " 281s "At least __init__.py should be in the project source tree" 281s ) 281s 281s # ------------------------------------------------------------------------- 281s # Here is the "SOURCE" tree layout: 281s # 281s # ROOT/ 281s # 281s # setup.py 281s # 281s # [/] 281s # 281s # pureModule.py 281s # 281s # pure/ 281s # __init__.py 281s # pure.py 281s # 281s # data/ 281s # pure.dat 281s # 281s # [/] 281s # 281s # hybrid/ 281s # CMakeLists.txt 281s # __init__.py 281s # hybrid_pure.dat 281s # hybrid_pure.py 281s # 281s # data/ 281s # hybrid_data_pure.dat 281s # 281s # hybrid_2/ 281s # __init__.py 281s # hybrid_2_pure.py 281s # 281s # hybrid_2_pure/ 281s # __init__.py 281s # hybrid_2_pure_1.py 281s # hybrid_2_pure_2.py 281s # 281s # 281s # ------------------------------------------------------------------------- 281s # and here is the "BINARY" distribution layout: 281s # 281s # The comment "CMake" or "Setuptools" indicates which tool is responsible 281s # for placing the file in the tree used to create the binary distribution. 281s # 281s # ROOT/ 281s # 281s # cmakeModule.py # CMake 281s # 281s # cmake/ 281s # __init__.py # CMake 281s # cmake.py # CMake 281s # 281s # hybrid/ 281s # hybrid_cmake.dat # CMake 281s # hybrid_cmake.py # CMake 281s # hybrid_pure.dat # Setuptools 281s # hybrid_pure.py # Setuptools 281s # 281s # data/ 281s # hybrid_data_pure.dat # CMake or Setuptools 281s # hybrid_data_cmake.dat # CMake *NO TEST* 281s # 281s # hybrid_2/ 281s # __init__.py # CMake or Setuptools 281s # hybrid_2_pure.py # CMake or Setuptools 281s # hybrid_2_cmake.py # CMake 281s # 281s # hybrid_2_pure/ 281s # __init__.py # CMake or Setuptools 281s # hybrid_2_pure_1.py # CMake or Setuptools 281s # hybrid_2_pure_2.py # CMake or Setuptools 281s # 281s # pureModule.py # Setuptools 281s # 281s # pure/ 281s # __init__.py # Setuptools 281s # pure.py # Setuptools 281s # 281s # data/ 281s # pure.dat # Setuptools 281s 281s tmp_dir.join("setup.py").write( 281s textwrap.dedent( 281s """ 281s from skbuild import setup 281s #from setuptools import setup 281s setup( 281s name="test_hybrid_project", 281s version="1.2.3", 281s description=("an hybrid package mixing files installed by both " 281s "CMake and setuptools"), 281s author='The scikit-build team', 281s license="MIT", 281s cmake_source_dir='{cmake_source_dir}', 281s cmake_install_dir='{cmake_install_dir}', 281s # Arbitrary order of packages 281s packages=[ 281s {p_off} 'pure', 281s {h_off} 'hybrid.hybrid_2', 281s {h_off} 'hybrid', 281s {c_off} 'cmake', 281s {p_off} 'hybrid.hybrid_2_pure', 281s ], 281s py_modules=[ 281s {pm_off} '{package_base}pureModule', 281s {cm_off} '{package_base}cmakeModule', 281s ], 281s package_data={{ 281s {p_off} 'pure': ['data/pure.dat'], 281s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 281s }}, 281s # Arbitrary order of package_dir 281s package_dir = {{ 281s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 281s {p_off} 'pure': '{package_base}pure', 281s {h_off} 'hybrid': '{package_base}hybrid', 281s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 281s {c_off} 'cmake': '{package_base}cmake', 281s }} 281s ) 281s """.format( 281s cmake_source_dir=cmake_source_dir, 281s cmake_install_dir=package_base, 281s package_base=package_base_dir, 281s c_off="" if has_cmake_package else "#", 281s cm_off="" if has_cmake_module else "#", 281s h_off="" if has_hybrid_package else "#", 281s p_off="" if has_pure_package else "#", 281s pm_off="" if has_pure_module else "#", 281s ) 281s ) 281s ) 281s 281s src_dir = tmp_dir.ensure(package_base, dir=1) 281s 281s src_dir.join("CMakeLists.txt").write( 281s textwrap.dedent( 281s """ 281s cmake_minimum_required(VERSION 3.5.0) 281s project(hybrid NONE) 281s set(build_dir ${{CMAKE_BINARY_DIR}}) 281s 281s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 281s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 281s {c_off} install( 281s {c_off} FILES 281s {c_off} ${{build_dir}}/__init__.py 281s {c_off} ${{build_dir}}/cmake.py 281s {c_off} DESTINATION cmake 281s {c_off} ) 281s 281s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 281s {cm_off} install( 281s {cm_off} FILES ${{build_dir}}/cmakeModule.py 281s {cm_off} DESTINATION .) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 281s {h_off} DESTINATION hybrid) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 281s {h_off} DESTINATION hybrid) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 281s {h_off} DESTINATION hybrid/data) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 281s {h_off} DESTINATION hybrid/hybrid_2) 281s 281s install(CODE "message(STATUS \\\"Installation complete\\\")") 281s """.format( 281s c_off="" if has_cmake_package else "#", 281s cm_off="" if has_cmake_module else "#", 281s h_off="" if has_hybrid_package else "#", 281s ) 281s ) 281s ) 281s 281s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 281s path_types: Sequence[str] 281s try: 281s path_types = next( 281s iter( 281s zip( 281s *filter( 281s lambda i: i[1], 281s [ 281s ("c", has_cmake_package), 281s ("cm", has_cmake_module), 281s ("h", has_hybrid_package), 281s ("p", has_pure_package), 281s ("pm", has_pure_module), 281s ], 281s ) 281s ) 281s ) 281s ) 281s except StopIteration: 281s path_types = [] 281s 281s def select_paths(annotated_paths): 281s """Return a filtered list paths considering ``path_types``. 281s 281s `annotated_paths`` is list of tuple ``(type, path)`` where type 281s is either `c`, 'cm', `h`, `p` or 'pm'. 281s 281s """ 281s return filter(lambda i: i[0] in path_types, annotated_paths) 281s 281s # Commented paths are the one expected to be installed by CMake. For 281s # this reason, corresponding files should NOT be created in the source 281s # tree. 281s for _type, path in select_paths( 281s [ 281s # ('c', 'cmake/__init__.py'), 281s # ('c', 'cmake/cmake.py'), 281s # ('cm', 'cmakeModule.py'), 281s ("h", "hybrid/__init__.py"), 281s # ('h', 'hybrid/hybrid_cmake.dat'), 281s # ('h', 'hybrid/hybrid_cmake.py'), 281s ("h", "hybrid/hybrid_pure.dat"), 281s ("h", "hybrid/hybrid_pure.py"), 281s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 281s ("h", "hybrid/data/hybrid_data_pure.dat"), 281s ("h", "hybrid/hybrid_2/__init__.py"), 281s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 281s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 281s ("p", "hybrid/hybrid_2_pure/__init__.py"), 281s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 281s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 281s ("pm", "pureModule.py"), 281s ("p", "pure/__init__.py"), 281s ("p", "pure/pure.py"), 281s ("p", "pure/data/pure.dat"), 281s ] 281s ): 281s assert _type in {"p", "pm", "h"} 281s root = package_base if _type in {"p", "pm"} else cmake_source_dir 281s tmp_dir.ensure(os.path.join(root, path)) 281s 281s # Do not call the real setup function. Instead, replace it with 281s # a MagicMock allowing to check with which arguments it was invoked. 281s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 281s 281s # Convenience print function 281s def _pprint(desc, value=None): 281s print( 281s "-----------------\n" 281s f"{desc}:\n" 281s "\n" 281s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 281s ) 281s 281s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 281s 281s _pprint = ._pprint at 0x709a44385800> 281s _type = 'h' 281s cmake_source_dir = '' 281s has_cmake_module = 0 281s has_cmake_package = 0 281s has_hybrid_package = 1 281s has_pure_module = 0 281s has_pure_package = 0 281s mock_setup = 281s mocker = 281s package_base = '' 281s package_base_dir = '' 281s path = 'hybrid/hybrid_2/hybrid_2_pure.py' 281s path_types = ('h',) 281s root = '' 281s select_paths = .select_paths at 0x709a44384ae0> 281s src_dir = local('/tmp/pytest-of-ubuntu/pytest-86/test_setup_inputs0') 281s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-86/test_setup_inputs0') 281s with_package_base = 0 281s 281s tests/test_setup.py:849: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-86/test_setup_inputs0') 281s setup_args = ['build'], disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-86/test_setup_inputs0') 281s setup_args = ['build'] 281s 281s tests/__init__.py:218: AttributeError 281s ________________________ test_setup_inputs[0-0-0-1-0-1] ________________________ 281s 281s has_cmake_package = 1, has_cmake_module = 0, has_hybrid_package = 1 281s has_pure_package = 0, has_pure_module = 0, with_package_base = 0 281s mocker = 281s 281s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 281s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 281s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 281s @pytest.mark.parametrize("has_pure_package", [0, 1]) 281s @pytest.mark.parametrize("has_pure_module", [0, 1]) 281s @pytest.mark.parametrize("with_package_base", [0, 1]) 281s def test_setup_inputs( 281s has_cmake_package, 281s has_cmake_module, 281s has_hybrid_package, 281s has_pure_package, 281s has_pure_module, 281s with_package_base, 281s mocker, 281s ): 281s """This test that a project can have a package with some modules 281s installed using setup.py and some other modules installed using CMake. 281s """ 281s 281s tmp_dir = _tmpdir("test_setup_inputs") 281s 281s package_base = "to/the/base" if with_package_base else "" 281s package_base_dir = package_base + "/" if package_base else "" 281s cmake_source_dir = package_base 281s 281s if cmake_source_dir and (has_cmake_package or has_cmake_module): 281s pytest.skip( 281s "unsupported configuration: " 281s "python package fully generated by CMake does *NOT* work. " 281s "At least __init__.py should be in the project source tree" 281s ) 281s 281s # ------------------------------------------------------------------------- 281s # Here is the "SOURCE" tree layout: 281s # 281s # ROOT/ 281s # 281s # setup.py 281s # 281s # [/] 281s # 281s # pureModule.py 281s # 281s # pure/ 281s # __init__.py 281s # pure.py 281s # 281s # data/ 281s # pure.dat 281s # 281s # [/] 281s # 281s # hybrid/ 281s # CMakeLists.txt 281s # __init__.py 281s # hybrid_pure.dat 281s # hybrid_pure.py 281s # 281s # data/ 281s # hybrid_data_pure.dat 281s # 281s # hybrid_2/ 281s # __init__.py 281s # hybrid_2_pure.py 281s # 281s # hybrid_2_pure/ 281s # __init__.py 281s # hybrid_2_pure_1.py 281s # hybrid_2_pure_2.py 281s # 281s # 281s # ------------------------------------------------------------------------- 281s # and here is the "BINARY" distribution layout: 281s # 281s # The comment "CMake" or "Setuptools" indicates which tool is responsible 281s # for placing the file in the tree used to create the binary distribution. 281s # 281s # ROOT/ 281s # 281s # cmakeModule.py # CMake 281s # 281s # cmake/ 281s # __init__.py # CMake 281s # cmake.py # CMake 281s # 281s # hybrid/ 281s # hybrid_cmake.dat # CMake 281s # hybrid_cmake.py # CMake 281s # hybrid_pure.dat # Setuptools 281s # hybrid_pure.py # Setuptools 281s # 281s # data/ 281s # hybrid_data_pure.dat # CMake or Setuptools 281s # hybrid_data_cmake.dat # CMake *NO TEST* 281s # 281s # hybrid_2/ 281s # __init__.py # CMake or Setuptools 281s # hybrid_2_pure.py # CMake or Setuptools 281s # hybrid_2_cmake.py # CMake 281s # 281s # hybrid_2_pure/ 281s # __init__.py # CMake or Setuptools 281s # hybrid_2_pure_1.py # CMake or Setuptools 281s # hybrid_2_pure_2.py # CMake or Setuptools 281s # 281s # pureModule.py # Setuptools 281s # 281s # pure/ 281s # __init__.py # Setuptools 281s # pure.py # Setuptools 281s # 281s # data/ 281s # pure.dat # Setuptools 281s 281s tmp_dir.join("setup.py").write( 281s textwrap.dedent( 281s """ 281s from skbuild import setup 281s #from setuptools import setup 281s setup( 281s name="test_hybrid_project", 281s version="1.2.3", 281s description=("an hybrid package mixing files installed by both " 281s "CMake and setuptools"), 281s author='The scikit-build team', 281s license="MIT", 281s cmake_source_dir='{cmake_source_dir}', 281s cmake_install_dir='{cmake_install_dir}', 281s # Arbitrary order of packages 281s packages=[ 281s {p_off} 'pure', 281s {h_off} 'hybrid.hybrid_2', 281s {h_off} 'hybrid', 281s {c_off} 'cmake', 281s {p_off} 'hybrid.hybrid_2_pure', 281s ], 281s py_modules=[ 281s {pm_off} '{package_base}pureModule', 281s {cm_off} '{package_base}cmakeModule', 281s ], 281s package_data={{ 281s {p_off} 'pure': ['data/pure.dat'], 281s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 281s }}, 281s # Arbitrary order of package_dir 281s package_dir = {{ 281s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 281s {p_off} 'pure': '{package_base}pure', 281s {h_off} 'hybrid': '{package_base}hybrid', 281s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 281s {c_off} 'cmake': '{package_base}cmake', 281s }} 281s ) 281s """.format( 281s cmake_source_dir=cmake_source_dir, 281s cmake_install_dir=package_base, 281s package_base=package_base_dir, 281s c_off="" if has_cmake_package else "#", 281s cm_off="" if has_cmake_module else "#", 281s h_off="" if has_hybrid_package else "#", 281s p_off="" if has_pure_package else "#", 281s pm_off="" if has_pure_module else "#", 281s ) 281s ) 281s ) 281s 281s src_dir = tmp_dir.ensure(package_base, dir=1) 281s 281s src_dir.join("CMakeLists.txt").write( 281s textwrap.dedent( 281s """ 281s cmake_minimum_required(VERSION 3.5.0) 281s project(hybrid NONE) 281s set(build_dir ${{CMAKE_BINARY_DIR}}) 281s 281s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 281s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 281s {c_off} install( 281s {c_off} FILES 281s {c_off} ${{build_dir}}/__init__.py 281s {c_off} ${{build_dir}}/cmake.py 281s {c_off} DESTINATION cmake 281s {c_off} ) 281s 281s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 281s {cm_off} install( 281s {cm_off} FILES ${{build_dir}}/cmakeModule.py 281s {cm_off} DESTINATION .) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 281s {h_off} DESTINATION hybrid) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 281s {h_off} DESTINATION hybrid) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 281s {h_off} DESTINATION hybrid/data) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 281s {h_off} DESTINATION hybrid/hybrid_2) 281s 281s install(CODE "message(STATUS \\\"Installation complete\\\")") 281s """.format( 281s c_off="" if has_cmake_package else "#", 281s cm_off="" if has_cmake_module else "#", 281s h_off="" if has_hybrid_package else "#", 281s ) 281s ) 281s ) 281s 281s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 281s path_types: Sequence[str] 281s try: 281s path_types = next( 281s iter( 281s zip( 281s *filter( 281s lambda i: i[1], 281s [ 281s ("c", has_cmake_package), 281s ("cm", has_cmake_module), 281s ("h", has_hybrid_package), 281s ("p", has_pure_package), 281s ("pm", has_pure_module), 281s ], 281s ) 281s ) 281s ) 281s ) 281s except StopIteration: 281s path_types = [] 281s 281s def select_paths(annotated_paths): 281s """Return a filtered list paths considering ``path_types``. 281s 281s `annotated_paths`` is list of tuple ``(type, path)`` where type 281s is either `c`, 'cm', `h`, `p` or 'pm'. 281s 281s """ 281s return filter(lambda i: i[0] in path_types, annotated_paths) 281s 281s # Commented paths are the one expected to be installed by CMake. For 281s # this reason, corresponding files should NOT be created in the source 281s # tree. 281s for _type, path in select_paths( 281s [ 281s # ('c', 'cmake/__init__.py'), 281s # ('c', 'cmake/cmake.py'), 281s # ('cm', 'cmakeModule.py'), 281s ("h", "hybrid/__init__.py"), 281s # ('h', 'hybrid/hybrid_cmake.dat'), 281s # ('h', 'hybrid/hybrid_cmake.py'), 281s ("h", "hybrid/hybrid_pure.dat"), 281s ("h", "hybrid/hybrid_pure.py"), 281s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 281s ("h", "hybrid/data/hybrid_data_pure.dat"), 281s ("h", "hybrid/hybrid_2/__init__.py"), 281s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 281s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 281s ("p", "hybrid/hybrid_2_pure/__init__.py"), 281s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 281s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 281s ("pm", "pureModule.py"), 281s ("p", "pure/__init__.py"), 281s ("p", "pure/pure.py"), 281s ("p", "pure/data/pure.dat"), 281s ] 281s ): 281s assert _type in {"p", "pm", "h"} 281s root = package_base if _type in {"p", "pm"} else cmake_source_dir 281s tmp_dir.ensure(os.path.join(root, path)) 281s 281s # Do not call the real setup function. Instead, replace it with 281s # a MagicMock allowing to check with which arguments it was invoked. 281s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 281s 281s # Convenience print function 281s def _pprint(desc, value=None): 281s print( 281s "-----------------\n" 281s f"{desc}:\n" 281s "\n" 281s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 281s ) 281s 281s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 281s 281s _pprint = ._pprint at 0x709a444816c0> 281s _type = 'h' 281s cmake_source_dir = '' 281s has_cmake_module = 0 281s has_cmake_package = 1 281s has_hybrid_package = 1 281s has_pure_module = 0 281s has_pure_package = 0 281s mock_setup = 281s mocker = 281s package_base = '' 281s package_base_dir = '' 281s path = 'hybrid/hybrid_2/hybrid_2_pure.py' 281s path_types = ('c', 'h') 281s root = '' 281s select_paths = .select_paths at 0x709a444807c0> 281s src_dir = local('/tmp/pytest-of-ubuntu/pytest-87/test_setup_inputs0') 281s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-87/test_setup_inputs0') 281s with_package_base = 0 281s 281s tests/test_setup.py:849: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-87/test_setup_inputs0') 281s setup_args = ['build'], disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-87/test_setup_inputs0') 281s setup_args = ['build'] 281s 281s tests/__init__.py:218: AttributeError 281s ________________________ test_setup_inputs[0-0-0-1-1-0] ________________________ 281s 281s has_cmake_package = 0, has_cmake_module = 1, has_hybrid_package = 1 281s has_pure_package = 0, has_pure_module = 0, with_package_base = 0 281s mocker = 281s 281s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 281s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 281s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 281s @pytest.mark.parametrize("has_pure_package", [0, 1]) 281s @pytest.mark.parametrize("has_pure_module", [0, 1]) 281s @pytest.mark.parametrize("with_package_base", [0, 1]) 281s def test_setup_inputs( 281s has_cmake_package, 281s has_cmake_module, 281s has_hybrid_package, 281s has_pure_package, 281s has_pure_module, 281s with_package_base, 281s mocker, 281s ): 281s """This test that a project can have a package with some modules 281s installed using setup.py and some other modules installed using CMake. 281s """ 281s 281s tmp_dir = _tmpdir("test_setup_inputs") 281s 281s package_base = "to/the/base" if with_package_base else "" 281s package_base_dir = package_base + "/" if package_base else "" 281s cmake_source_dir = package_base 281s 281s if cmake_source_dir and (has_cmake_package or has_cmake_module): 281s pytest.skip( 281s "unsupported configuration: " 281s "python package fully generated by CMake does *NOT* work. " 281s "At least __init__.py should be in the project source tree" 281s ) 281s 281s # ------------------------------------------------------------------------- 281s # Here is the "SOURCE" tree layout: 281s # 281s # ROOT/ 281s # 281s # setup.py 281s # 281s # [/] 281s # 281s # pureModule.py 281s # 281s # pure/ 281s # __init__.py 281s # pure.py 281s # 281s # data/ 281s # pure.dat 281s # 281s # [/] 281s # 281s # hybrid/ 281s # CMakeLists.txt 281s # __init__.py 281s # hybrid_pure.dat 281s # hybrid_pure.py 281s # 281s # data/ 281s # hybrid_data_pure.dat 281s # 281s # hybrid_2/ 281s # __init__.py 281s # hybrid_2_pure.py 281s # 281s # hybrid_2_pure/ 281s # __init__.py 281s # hybrid_2_pure_1.py 281s # hybrid_2_pure_2.py 281s # 281s # 281s # ------------------------------------------------------------------------- 281s # and here is the "BINARY" distribution layout: 281s # 281s # The comment "CMake" or "Setuptools" indicates which tool is responsible 281s # for placing the file in the tree used to create the binary distribution. 281s # 281s # ROOT/ 281s # 281s # cmakeModule.py # CMake 281s # 281s # cmake/ 281s # __init__.py # CMake 281s # cmake.py # CMake 281s # 281s # hybrid/ 281s # hybrid_cmake.dat # CMake 281s # hybrid_cmake.py # CMake 281s # hybrid_pure.dat # Setuptools 281s # hybrid_pure.py # Setuptools 281s # 281s # data/ 281s # hybrid_data_pure.dat # CMake or Setuptools 281s # hybrid_data_cmake.dat # CMake *NO TEST* 281s # 281s # hybrid_2/ 281s # __init__.py # CMake or Setuptools 281s # hybrid_2_pure.py # CMake or Setuptools 281s # hybrid_2_cmake.py # CMake 281s # 281s # hybrid_2_pure/ 281s # __init__.py # CMake or Setuptools 281s # hybrid_2_pure_1.py # CMake or Setuptools 281s # hybrid_2_pure_2.py # CMake or Setuptools 281s # 281s # pureModule.py # Setuptools 281s # 281s # pure/ 281s # __init__.py # Setuptools 281s # pure.py # Setuptools 281s # 281s # data/ 281s # pure.dat # Setuptools 281s 281s tmp_dir.join("setup.py").write( 281s textwrap.dedent( 281s """ 281s from skbuild import setup 281s #from setuptools import setup 281s setup( 281s name="test_hybrid_project", 281s version="1.2.3", 281s description=("an hybrid package mixing files installed by both " 281s "CMake and setuptools"), 281s author='The scikit-build team', 281s license="MIT", 281s cmake_source_dir='{cmake_source_dir}', 281s cmake_install_dir='{cmake_install_dir}', 281s # Arbitrary order of packages 281s packages=[ 281s {p_off} 'pure', 281s {h_off} 'hybrid.hybrid_2', 281s {h_off} 'hybrid', 281s {c_off} 'cmake', 281s {p_off} 'hybrid.hybrid_2_pure', 281s ], 281s py_modules=[ 281s {pm_off} '{package_base}pureModule', 281s {cm_off} '{package_base}cmakeModule', 281s ], 281s package_data={{ 281s {p_off} 'pure': ['data/pure.dat'], 281s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 281s }}, 281s # Arbitrary order of package_dir 281s package_dir = {{ 281s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 281s {p_off} 'pure': '{package_base}pure', 281s {h_off} 'hybrid': '{package_base}hybrid', 281s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 281s {c_off} 'cmake': '{package_base}cmake', 281s }} 281s ) 281s """.format( 281s cmake_source_dir=cmake_source_dir, 281s cmake_install_dir=package_base, 281s package_base=package_base_dir, 281s c_off="" if has_cmake_package else "#", 281s cm_off="" if has_cmake_module else "#", 281s h_off="" if has_hybrid_package else "#", 281s p_off="" if has_pure_package else "#", 281s pm_off="" if has_pure_module else "#", 281s ) 281s ) 281s ) 281s 281s src_dir = tmp_dir.ensure(package_base, dir=1) 281s 281s src_dir.join("CMakeLists.txt").write( 281s textwrap.dedent( 281s """ 281s cmake_minimum_required(VERSION 3.5.0) 281s project(hybrid NONE) 281s set(build_dir ${{CMAKE_BINARY_DIR}}) 281s 281s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 281s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 281s {c_off} install( 281s {c_off} FILES 281s {c_off} ${{build_dir}}/__init__.py 281s {c_off} ${{build_dir}}/cmake.py 281s {c_off} DESTINATION cmake 281s {c_off} ) 281s 281s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 281s {cm_off} install( 281s {cm_off} FILES ${{build_dir}}/cmakeModule.py 281s {cm_off} DESTINATION .) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 281s {h_off} DESTINATION hybrid) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 281s {h_off} DESTINATION hybrid) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 281s {h_off} DESTINATION hybrid/data) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 281s {h_off} DESTINATION hybrid/hybrid_2) 281s 281s install(CODE "message(STATUS \\\"Installation complete\\\")") 281s """.format( 281s c_off="" if has_cmake_package else "#", 281s cm_off="" if has_cmake_module else "#", 281s h_off="" if has_hybrid_package else "#", 281s ) 281s ) 281s ) 281s 281s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 281s path_types: Sequence[str] 281s try: 281s path_types = next( 281s iter( 281s zip( 281s *filter( 281s lambda i: i[1], 281s [ 281s ("c", has_cmake_package), 281s ("cm", has_cmake_module), 281s ("h", has_hybrid_package), 281s ("p", has_pure_package), 281s ("pm", has_pure_module), 281s ], 281s ) 281s ) 281s ) 281s ) 281s except StopIteration: 281s path_types = [] 281s 281s def select_paths(annotated_paths): 281s """Return a filtered list paths considering ``path_types``. 281s 281s `annotated_paths`` is list of tuple ``(type, path)`` where type 281s is either `c`, 'cm', `h`, `p` or 'pm'. 281s 281s """ 281s return filter(lambda i: i[0] in path_types, annotated_paths) 281s 281s # Commented paths are the one expected to be installed by CMake. For 281s # this reason, corresponding files should NOT be created in the source 281s # tree. 281s for _type, path in select_paths( 281s [ 281s # ('c', 'cmake/__init__.py'), 281s # ('c', 'cmake/cmake.py'), 281s # ('cm', 'cmakeModule.py'), 281s ("h", "hybrid/__init__.py"), 281s # ('h', 'hybrid/hybrid_cmake.dat'), 281s # ('h', 'hybrid/hybrid_cmake.py'), 281s ("h", "hybrid/hybrid_pure.dat"), 281s ("h", "hybrid/hybrid_pure.py"), 281s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 281s ("h", "hybrid/data/hybrid_data_pure.dat"), 281s ("h", "hybrid/hybrid_2/__init__.py"), 281s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 281s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 281s ("p", "hybrid/hybrid_2_pure/__init__.py"), 281s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 281s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 281s ("pm", "pureModule.py"), 281s ("p", "pure/__init__.py"), 281s ("p", "pure/pure.py"), 281s ("p", "pure/data/pure.dat"), 281s ] 281s ): 281s assert _type in {"p", "pm", "h"} 281s root = package_base if _type in {"p", "pm"} else cmake_source_dir 281s tmp_dir.ensure(os.path.join(root, path)) 281s 281s # Do not call the real setup function. Instead, replace it with 281s # a MagicMock allowing to check with which arguments it was invoked. 281s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 281s 281s # Convenience print function 281s def _pprint(desc, value=None): 281s print( 281s "-----------------\n" 281s f"{desc}:\n" 281s "\n" 281s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 281s ) 281s 281s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 281s 281s _pprint = ._pprint at 0x709a44386480> 281s _type = 'h' 281s cmake_source_dir = '' 281s has_cmake_module = 1 281s has_cmake_package = 0 281s has_hybrid_package = 1 281s has_pure_module = 0 281s has_pure_package = 0 281s mock_setup = 281s mocker = 281s package_base = '' 281s package_base_dir = '' 281s path = 'hybrid/hybrid_2/hybrid_2_pure.py' 281s path_types = ('cm', 'h') 281s root = '' 281s select_paths = .select_paths at 0x709a443860c0> 281s src_dir = local('/tmp/pytest-of-ubuntu/pytest-88/test_setup_inputs0') 281s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-88/test_setup_inputs0') 281s with_package_base = 0 281s 281s tests/test_setup.py:849: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-88/test_setup_inputs0') 281s setup_args = ['build'], disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-88/test_setup_inputs0') 281s setup_args = ['build'] 281s 281s tests/__init__.py:218: AttributeError 281s ________________________ test_setup_inputs[0-0-0-1-1-1] ________________________ 281s 281s has_cmake_package = 1, has_cmake_module = 1, has_hybrid_package = 1 281s has_pure_package = 0, has_pure_module = 0, with_package_base = 0 281s mocker = 281s 281s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 281s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 281s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 281s @pytest.mark.parametrize("has_pure_package", [0, 1]) 281s @pytest.mark.parametrize("has_pure_module", [0, 1]) 281s @pytest.mark.parametrize("with_package_base", [0, 1]) 281s def test_setup_inputs( 281s has_cmake_package, 281s has_cmake_module, 281s has_hybrid_package, 281s has_pure_package, 281s has_pure_module, 281s with_package_base, 281s mocker, 281s ): 281s """This test that a project can have a package with some modules 281s installed using setup.py and some other modules installed using CMake. 281s """ 281s 281s tmp_dir = _tmpdir("test_setup_inputs") 281s 281s package_base = "to/the/base" if with_package_base else "" 281s package_base_dir = package_base + "/" if package_base else "" 281s cmake_source_dir = package_base 281s 281s if cmake_source_dir and (has_cmake_package or has_cmake_module): 281s pytest.skip( 281s "unsupported configuration: " 281s "python package fully generated by CMake does *NOT* work. " 281s "At least __init__.py should be in the project source tree" 281s ) 281s 281s # ------------------------------------------------------------------------- 281s # Here is the "SOURCE" tree layout: 281s # 281s # ROOT/ 281s # 281s # setup.py 281s # 281s # [/] 281s # 281s # pureModule.py 281s # 281s # pure/ 281s # __init__.py 281s # pure.py 281s # 281s # data/ 281s # pure.dat 281s # 281s # [/] 281s # 281s # hybrid/ 281s # CMakeLists.txt 281s # __init__.py 281s # hybrid_pure.dat 281s # hybrid_pure.py 281s # 281s # data/ 281s # hybrid_data_pure.dat 281s # 281s # hybrid_2/ 281s # __init__.py 281s # hybrid_2_pure.py 281s # 281s # hybrid_2_pure/ 281s # __init__.py 281s # hybrid_2_pure_1.py 281s # hybrid_2_pure_2.py 281s # 281s # 281s # ------------------------------------------------------------------------- 281s # and here is the "BINARY" distribution layout: 281s # 281s # The comment "CMake" or "Setuptools" indicates which tool is responsible 281s # for placing the file in the tree used to create the binary distribution. 281s # 281s # ROOT/ 281s # 281s # cmakeModule.py # CMake 281s # 281s # cmake/ 281s # __init__.py # CMake 281s # cmake.py # CMake 281s # 281s # hybrid/ 281s # hybrid_cmake.dat # CMake 281s # hybrid_cmake.py # CMake 281s # hybrid_pure.dat # Setuptools 281s # hybrid_pure.py # Setuptools 281s # 281s # data/ 281s # hybrid_data_pure.dat # CMake or Setuptools 281s # hybrid_data_cmake.dat # CMake *NO TEST* 281s # 281s # hybrid_2/ 281s # __init__.py # CMake or Setuptools 281s # hybrid_2_pure.py # CMake or Setuptools 281s # hybrid_2_cmake.py # CMake 281s # 281s # hybrid_2_pure/ 281s # __init__.py # CMake or Setuptools 281s # hybrid_2_pure_1.py # CMake or Setuptools 281s # hybrid_2_pure_2.py # CMake or Setuptools 281s # 281s # pureModule.py # Setuptools 281s # 281s # pure/ 281s # __init__.py # Setuptools 281s # pure.py # Setuptools 281s # 281s # data/ 281s # pure.dat # Setuptools 281s 281s tmp_dir.join("setup.py").write( 281s textwrap.dedent( 281s """ 281s from skbuild import setup 281s #from setuptools import setup 281s setup( 281s name="test_hybrid_project", 281s version="1.2.3", 281s description=("an hybrid package mixing files installed by both " 281s "CMake and setuptools"), 281s author='The scikit-build team', 281s license="MIT", 281s cmake_source_dir='{cmake_source_dir}', 281s cmake_install_dir='{cmake_install_dir}', 281s # Arbitrary order of packages 281s packages=[ 281s {p_off} 'pure', 281s {h_off} 'hybrid.hybrid_2', 281s {h_off} 'hybrid', 281s {c_off} 'cmake', 281s {p_off} 'hybrid.hybrid_2_pure', 281s ], 281s py_modules=[ 281s {pm_off} '{package_base}pureModule', 281s {cm_off} '{package_base}cmakeModule', 281s ], 281s package_data={{ 281s {p_off} 'pure': ['data/pure.dat'], 281s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 281s }}, 281s # Arbitrary order of package_dir 281s package_dir = {{ 281s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 281s {p_off} 'pure': '{package_base}pure', 281s {h_off} 'hybrid': '{package_base}hybrid', 281s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 281s {c_off} 'cmake': '{package_base}cmake', 281s }} 281s ) 281s """.format( 281s cmake_source_dir=cmake_source_dir, 281s cmake_install_dir=package_base, 281s package_base=package_base_dir, 281s c_off="" if has_cmake_package else "#", 281s cm_off="" if has_cmake_module else "#", 281s h_off="" if has_hybrid_package else "#", 281s p_off="" if has_pure_package else "#", 281s pm_off="" if has_pure_module else "#", 281s ) 281s ) 281s ) 281s 281s src_dir = tmp_dir.ensure(package_base, dir=1) 281s 281s src_dir.join("CMakeLists.txt").write( 281s textwrap.dedent( 281s """ 281s cmake_minimum_required(VERSION 3.5.0) 281s project(hybrid NONE) 281s set(build_dir ${{CMAKE_BINARY_DIR}}) 281s 281s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 281s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 281s {c_off} install( 281s {c_off} FILES 281s {c_off} ${{build_dir}}/__init__.py 281s {c_off} ${{build_dir}}/cmake.py 281s {c_off} DESTINATION cmake 281s {c_off} ) 281s 281s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 281s {cm_off} install( 281s {cm_off} FILES ${{build_dir}}/cmakeModule.py 281s {cm_off} DESTINATION .) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 281s {h_off} DESTINATION hybrid) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 281s {h_off} DESTINATION hybrid) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 281s {h_off} DESTINATION hybrid/data) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 281s {h_off} DESTINATION hybrid/hybrid_2) 281s 281s install(CODE "message(STATUS \\\"Installation complete\\\")") 281s """.format( 281s c_off="" if has_cmake_package else "#", 281s cm_off="" if has_cmake_module else "#", 281s h_off="" if has_hybrid_package else "#", 281s ) 281s ) 281s ) 281s 281s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 281s path_types: Sequence[str] 281s try: 281s path_types = next( 281s iter( 281s zip( 281s *filter( 281s lambda i: i[1], 281s [ 281s ("c", has_cmake_package), 281s ("cm", has_cmake_module), 281s ("h", has_hybrid_package), 281s ("p", has_pure_package), 281s ("pm", has_pure_module), 281s ], 281s ) 281s ) 281s ) 281s ) 281s except StopIteration: 281s path_types = [] 281s 281s def select_paths(annotated_paths): 281s """Return a filtered list paths considering ``path_types``. 281s 281s `annotated_paths`` is list of tuple ``(type, path)`` where type 281s is either `c`, 'cm', `h`, `p` or 'pm'. 281s 281s """ 281s return filter(lambda i: i[0] in path_types, annotated_paths) 281s 281s # Commented paths are the one expected to be installed by CMake. For 281s # this reason, corresponding files should NOT be created in the source 281s # tree. 281s for _type, path in select_paths( 281s [ 281s # ('c', 'cmake/__init__.py'), 281s # ('c', 'cmake/cmake.py'), 281s # ('cm', 'cmakeModule.py'), 281s ("h", "hybrid/__init__.py"), 281s # ('h', 'hybrid/hybrid_cmake.dat'), 281s # ('h', 'hybrid/hybrid_cmake.py'), 281s ("h", "hybrid/hybrid_pure.dat"), 281s ("h", "hybrid/hybrid_pure.py"), 281s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 281s ("h", "hybrid/data/hybrid_data_pure.dat"), 281s ("h", "hybrid/hybrid_2/__init__.py"), 281s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 281s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 281s ("p", "hybrid/hybrid_2_pure/__init__.py"), 281s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 281s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 281s ("pm", "pureModule.py"), 281s ("p", "pure/__init__.py"), 281s ("p", "pure/pure.py"), 281s ("p", "pure/data/pure.dat"), 281s ] 281s ): 281s assert _type in {"p", "pm", "h"} 281s root = package_base if _type in {"p", "pm"} else cmake_source_dir 281s tmp_dir.ensure(os.path.join(root, path)) 281s 281s # Do not call the real setup function. Instead, replace it with 281s # a MagicMock allowing to check with which arguments it was invoked. 281s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 281s 281s # Convenience print function 281s def _pprint(desc, value=None): 281s print( 281s "-----------------\n" 281s f"{desc}:\n" 281s "\n" 281s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 281s ) 281s 281s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 281s 281s _pprint = ._pprint at 0x709a44384360> 281s _type = 'h' 281s cmake_source_dir = '' 281s has_cmake_module = 1 281s has_cmake_package = 1 281s has_hybrid_package = 1 281s has_pure_module = 0 281s has_pure_package = 0 281s mock_setup = 281s mocker = 281s package_base = '' 281s package_base_dir = '' 281s path = 'hybrid/hybrid_2/hybrid_2_pure.py' 281s path_types = ('c', 'cm', 'h') 281s root = '' 281s select_paths = .select_paths at 0x709a44385d00> 281s src_dir = local('/tmp/pytest-of-ubuntu/pytest-89/test_setup_inputs0') 281s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-89/test_setup_inputs0') 281s with_package_base = 0 281s 281s tests/test_setup.py:849: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-89/test_setup_inputs0') 281s setup_args = ['build'], disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-89/test_setup_inputs0') 281s setup_args = ['build'] 281s 281s tests/__init__.py:218: AttributeError 281s ________________________ test_setup_inputs[0-0-1-0-0-0] ________________________ 281s 281s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 0 281s has_pure_package = 1, has_pure_module = 0, with_package_base = 0 281s mocker = 281s 281s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 281s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 281s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 281s @pytest.mark.parametrize("has_pure_package", [0, 1]) 281s @pytest.mark.parametrize("has_pure_module", [0, 1]) 281s @pytest.mark.parametrize("with_package_base", [0, 1]) 281s def test_setup_inputs( 281s has_cmake_package, 281s has_cmake_module, 281s has_hybrid_package, 281s has_pure_package, 281s has_pure_module, 281s with_package_base, 281s mocker, 281s ): 281s """This test that a project can have a package with some modules 281s installed using setup.py and some other modules installed using CMake. 281s """ 281s 281s tmp_dir = _tmpdir("test_setup_inputs") 281s 281s package_base = "to/the/base" if with_package_base else "" 281s package_base_dir = package_base + "/" if package_base else "" 281s cmake_source_dir = package_base 281s 281s if cmake_source_dir and (has_cmake_package or has_cmake_module): 281s pytest.skip( 281s "unsupported configuration: " 281s "python package fully generated by CMake does *NOT* work. " 281s "At least __init__.py should be in the project source tree" 281s ) 281s 281s # ------------------------------------------------------------------------- 281s # Here is the "SOURCE" tree layout: 281s # 281s # ROOT/ 281s # 281s # setup.py 281s # 281s # [/] 281s # 281s # pureModule.py 281s # 281s # pure/ 281s # __init__.py 281s # pure.py 281s # 281s # data/ 281s # pure.dat 281s # 281s # [/] 281s # 281s # hybrid/ 281s # CMakeLists.txt 281s # __init__.py 281s # hybrid_pure.dat 281s # hybrid_pure.py 281s # 281s # data/ 281s # hybrid_data_pure.dat 281s # 281s # hybrid_2/ 281s # __init__.py 281s # hybrid_2_pure.py 281s # 281s # hybrid_2_pure/ 281s # __init__.py 281s # hybrid_2_pure_1.py 281s # hybrid_2_pure_2.py 281s # 281s # 281s # ------------------------------------------------------------------------- 281s # and here is the "BINARY" distribution layout: 281s # 281s # The comment "CMake" or "Setuptools" indicates which tool is responsible 281s # for placing the file in the tree used to create the binary distribution. 281s # 281s # ROOT/ 281s # 281s # cmakeModule.py # CMake 281s # 281s # cmake/ 281s # __init__.py # CMake 281s # cmake.py # CMake 281s # 281s # hybrid/ 281s # hybrid_cmake.dat # CMake 281s # hybrid_cmake.py # CMake 281s # hybrid_pure.dat # Setuptools 281s # hybrid_pure.py # Setuptools 281s # 281s # data/ 281s # hybrid_data_pure.dat # CMake or Setuptools 281s # hybrid_data_cmake.dat # CMake *NO TEST* 281s # 281s # hybrid_2/ 281s # __init__.py # CMake or Setuptools 281s # hybrid_2_pure.py # CMake or Setuptools 281s # hybrid_2_cmake.py # CMake 281s # 281s # hybrid_2_pure/ 281s # __init__.py # CMake or Setuptools 281s # hybrid_2_pure_1.py # CMake or Setuptools 281s # hybrid_2_pure_2.py # CMake or Setuptools 281s # 281s # pureModule.py # Setuptools 281s # 281s # pure/ 281s # __init__.py # Setuptools 281s # pure.py # Setuptools 281s # 281s # data/ 281s # pure.dat # Setuptools 281s 281s tmp_dir.join("setup.py").write( 281s textwrap.dedent( 281s """ 281s from skbuild import setup 281s #from setuptools import setup 281s setup( 281s name="test_hybrid_project", 281s version="1.2.3", 281s description=("an hybrid package mixing files installed by both " 281s "CMake and setuptools"), 281s author='The scikit-build team', 281s license="MIT", 281s cmake_source_dir='{cmake_source_dir}', 281s cmake_install_dir='{cmake_install_dir}', 281s # Arbitrary order of packages 281s packages=[ 281s {p_off} 'pure', 281s {h_off} 'hybrid.hybrid_2', 281s {h_off} 'hybrid', 281s {c_off} 'cmake', 281s {p_off} 'hybrid.hybrid_2_pure', 281s ], 281s py_modules=[ 281s {pm_off} '{package_base}pureModule', 281s {cm_off} '{package_base}cmakeModule', 281s ], 281s package_data={{ 281s {p_off} 'pure': ['data/pure.dat'], 281s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 281s }}, 281s # Arbitrary order of package_dir 281s package_dir = {{ 281s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 281s {p_off} 'pure': '{package_base}pure', 281s {h_off} 'hybrid': '{package_base}hybrid', 281s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 281s {c_off} 'cmake': '{package_base}cmake', 281s }} 281s ) 281s """.format( 281s cmake_source_dir=cmake_source_dir, 281s cmake_install_dir=package_base, 281s package_base=package_base_dir, 281s c_off="" if has_cmake_package else "#", 281s cm_off="" if has_cmake_module else "#", 281s h_off="" if has_hybrid_package else "#", 281s p_off="" if has_pure_package else "#", 281s pm_off="" if has_pure_module else "#", 281s ) 281s ) 281s ) 281s 281s src_dir = tmp_dir.ensure(package_base, dir=1) 281s 281s src_dir.join("CMakeLists.txt").write( 281s textwrap.dedent( 281s """ 281s cmake_minimum_required(VERSION 3.5.0) 281s project(hybrid NONE) 281s set(build_dir ${{CMAKE_BINARY_DIR}}) 281s 281s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 281s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 281s {c_off} install( 281s {c_off} FILES 281s {c_off} ${{build_dir}}/__init__.py 281s {c_off} ${{build_dir}}/cmake.py 281s {c_off} DESTINATION cmake 281s {c_off} ) 281s 281s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 281s {cm_off} install( 281s {cm_off} FILES ${{build_dir}}/cmakeModule.py 281s {cm_off} DESTINATION .) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 281s {h_off} DESTINATION hybrid) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 281s {h_off} DESTINATION hybrid) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 281s {h_off} DESTINATION hybrid/data) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 281s {h_off} DESTINATION hybrid/hybrid_2) 281s 281s install(CODE "message(STATUS \\\"Installation complete\\\")") 281s """.format( 281s c_off="" if has_cmake_package else "#", 281s cm_off="" if has_cmake_module else "#", 281s h_off="" if has_hybrid_package else "#", 281s ) 281s ) 281s ) 281s 281s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 281s path_types: Sequence[str] 281s try: 281s path_types = next( 281s iter( 281s zip( 281s *filter( 281s lambda i: i[1], 281s [ 281s ("c", has_cmake_package), 281s ("cm", has_cmake_module), 281s ("h", has_hybrid_package), 281s ("p", has_pure_package), 281s ("pm", has_pure_module), 281s ], 281s ) 281s ) 281s ) 281s ) 281s except StopIteration: 281s path_types = [] 281s 281s def select_paths(annotated_paths): 281s """Return a filtered list paths considering ``path_types``. 281s 281s `annotated_paths`` is list of tuple ``(type, path)`` where type 281s is either `c`, 'cm', `h`, `p` or 'pm'. 281s 281s """ 281s return filter(lambda i: i[0] in path_types, annotated_paths) 281s 281s # Commented paths are the one expected to be installed by CMake. For 281s # this reason, corresponding files should NOT be created in the source 281s # tree. 281s for _type, path in select_paths( 281s [ 281s # ('c', 'cmake/__init__.py'), 281s # ('c', 'cmake/cmake.py'), 281s # ('cm', 'cmakeModule.py'), 281s ("h", "hybrid/__init__.py"), 281s # ('h', 'hybrid/hybrid_cmake.dat'), 281s # ('h', 'hybrid/hybrid_cmake.py'), 281s ("h", "hybrid/hybrid_pure.dat"), 281s ("h", "hybrid/hybrid_pure.py"), 281s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 281s ("h", "hybrid/data/hybrid_data_pure.dat"), 281s ("h", "hybrid/hybrid_2/__init__.py"), 281s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 281s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 281s ("p", "hybrid/hybrid_2_pure/__init__.py"), 281s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 281s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 281s ("pm", "pureModule.py"), 281s ("p", "pure/__init__.py"), 281s ("p", "pure/pure.py"), 281s ("p", "pure/data/pure.dat"), 281s ] 281s ): 281s assert _type in {"p", "pm", "h"} 281s root = package_base if _type in {"p", "pm"} else cmake_source_dir 281s tmp_dir.ensure(os.path.join(root, path)) 281s 281s # Do not call the real setup function. Instead, replace it with 281s # a MagicMock allowing to check with which arguments it was invoked. 281s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 281s 281s # Convenience print function 281s def _pprint(desc, value=None): 281s print( 281s "-----------------\n" 281s f"{desc}:\n" 281s "\n" 281s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 281s ) 281s 281s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 281s 281s _pprint = ._pprint at 0x709a44384ea0> 281s _type = 'p' 281s cmake_source_dir = '' 281s has_cmake_module = 0 281s has_cmake_package = 0 281s has_hybrid_package = 0 281s has_pure_module = 0 281s has_pure_package = 1 281s mock_setup = 281s mocker = 281s package_base = '' 281s package_base_dir = '' 281s path = 'pure/data/pure.dat' 281s path_types = ('p',) 281s root = '' 281s select_paths = .select_paths at 0x709a44385620> 281s src_dir = local('/tmp/pytest-of-ubuntu/pytest-90/test_setup_inputs0') 281s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-90/test_setup_inputs0') 281s with_package_base = 0 281s 281s tests/test_setup.py:849: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-90/test_setup_inputs0') 281s setup_args = ['build'], disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-90/test_setup_inputs0') 281s setup_args = ['build'] 281s 281s tests/__init__.py:218: AttributeError 281s ________________________ test_setup_inputs[0-0-1-0-0-1] ________________________ 281s 281s has_cmake_package = 1, has_cmake_module = 0, has_hybrid_package = 0 281s has_pure_package = 1, has_pure_module = 0, with_package_base = 0 281s mocker = 281s 281s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 281s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 281s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 281s @pytest.mark.parametrize("has_pure_package", [0, 1]) 281s @pytest.mark.parametrize("has_pure_module", [0, 1]) 281s @pytest.mark.parametrize("with_package_base", [0, 1]) 281s def test_setup_inputs( 281s has_cmake_package, 281s has_cmake_module, 281s has_hybrid_package, 281s has_pure_package, 281s has_pure_module, 281s with_package_base, 281s mocker, 281s ): 281s """This test that a project can have a package with some modules 281s installed using setup.py and some other modules installed using CMake. 281s """ 281s 281s tmp_dir = _tmpdir("test_setup_inputs") 281s 281s package_base = "to/the/base" if with_package_base else "" 281s package_base_dir = package_base + "/" if package_base else "" 281s cmake_source_dir = package_base 281s 281s if cmake_source_dir and (has_cmake_package or has_cmake_module): 281s pytest.skip( 281s "unsupported configuration: " 281s "python package fully generated by CMake does *NOT* work. " 281s "At least __init__.py should be in the project source tree" 281s ) 281s 281s # ------------------------------------------------------------------------- 281s # Here is the "SOURCE" tree layout: 281s # 281s # ROOT/ 281s # 281s # setup.py 281s # 281s # [/] 281s # 281s # pureModule.py 281s # 281s # pure/ 281s # __init__.py 281s # pure.py 281s # 281s # data/ 281s # pure.dat 281s # 281s # [/] 281s # 281s # hybrid/ 281s # CMakeLists.txt 281s # __init__.py 281s # hybrid_pure.dat 281s # hybrid_pure.py 281s # 281s # data/ 281s # hybrid_data_pure.dat 281s # 281s # hybrid_2/ 281s # __init__.py 281s # hybrid_2_pure.py 281s # 281s # hybrid_2_pure/ 281s # __init__.py 281s # hybrid_2_pure_1.py 281s # hybrid_2_pure_2.py 281s # 281s # 281s # ------------------------------------------------------------------------- 281s # and here is the "BINARY" distribution layout: 281s # 281s # The comment "CMake" or "Setuptools" indicates which tool is responsible 281s # for placing the file in the tree used to create the binary distribution. 281s # 281s # ROOT/ 281s # 281s # cmakeModule.py # CMake 281s # 281s # cmake/ 281s # __init__.py # CMake 281s # cmake.py # CMake 281s # 281s # hybrid/ 281s # hybrid_cmake.dat # CMake 281s # hybrid_cmake.py # CMake 281s # hybrid_pure.dat # Setuptools 281s # hybrid_pure.py # Setuptools 281s # 281s # data/ 281s # hybrid_data_pure.dat # CMake or Setuptools 281s # hybrid_data_cmake.dat # CMake *NO TEST* 281s # 281s # hybrid_2/ 281s # __init__.py # CMake or Setuptools 281s # hybrid_2_pure.py # CMake or Setuptools 281s # hybrid_2_cmake.py # CMake 281s # 281s # hybrid_2_pure/ 281s # __init__.py # CMake or Setuptools 281s # hybrid_2_pure_1.py # CMake or Setuptools 281s # hybrid_2_pure_2.py # CMake or Setuptools 281s # 281s # pureModule.py # Setuptools 281s # 281s # pure/ 281s # __init__.py # Setuptools 281s # pure.py # Setuptools 281s # 281s # data/ 281s # pure.dat # Setuptools 281s 281s tmp_dir.join("setup.py").write( 281s textwrap.dedent( 281s """ 281s from skbuild import setup 281s #from setuptools import setup 281s setup( 281s name="test_hybrid_project", 281s version="1.2.3", 281s description=("an hybrid package mixing files installed by both " 281s "CMake and setuptools"), 281s author='The scikit-build team', 281s license="MIT", 281s cmake_source_dir='{cmake_source_dir}', 281s cmake_install_dir='{cmake_install_dir}', 281s # Arbitrary order of packages 281s packages=[ 281s {p_off} 'pure', 281s {h_off} 'hybrid.hybrid_2', 281s {h_off} 'hybrid', 281s {c_off} 'cmake', 281s {p_off} 'hybrid.hybrid_2_pure', 281s ], 281s py_modules=[ 281s {pm_off} '{package_base}pureModule', 281s {cm_off} '{package_base}cmakeModule', 281s ], 281s package_data={{ 281s {p_off} 'pure': ['data/pure.dat'], 281s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 281s }}, 281s # Arbitrary order of package_dir 281s package_dir = {{ 281s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 281s {p_off} 'pure': '{package_base}pure', 281s {h_off} 'hybrid': '{package_base}hybrid', 281s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 281s {c_off} 'cmake': '{package_base}cmake', 281s }} 281s ) 281s """.format( 281s cmake_source_dir=cmake_source_dir, 281s cmake_install_dir=package_base, 281s package_base=package_base_dir, 281s c_off="" if has_cmake_package else "#", 281s cm_off="" if has_cmake_module else "#", 281s h_off="" if has_hybrid_package else "#", 281s p_off="" if has_pure_package else "#", 281s pm_off="" if has_pure_module else "#", 281s ) 281s ) 281s ) 281s 281s src_dir = tmp_dir.ensure(package_base, dir=1) 281s 281s src_dir.join("CMakeLists.txt").write( 281s textwrap.dedent( 281s """ 281s cmake_minimum_required(VERSION 3.5.0) 281s project(hybrid NONE) 281s set(build_dir ${{CMAKE_BINARY_DIR}}) 281s 281s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 281s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 281s {c_off} install( 281s {c_off} FILES 281s {c_off} ${{build_dir}}/__init__.py 281s {c_off} ${{build_dir}}/cmake.py 281s {c_off} DESTINATION cmake 281s {c_off} ) 281s 281s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 281s {cm_off} install( 281s {cm_off} FILES ${{build_dir}}/cmakeModule.py 281s {cm_off} DESTINATION .) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 281s {h_off} DESTINATION hybrid) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 281s {h_off} DESTINATION hybrid) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 281s {h_off} DESTINATION hybrid/data) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 281s {h_off} DESTINATION hybrid/hybrid_2) 281s 281s install(CODE "message(STATUS \\\"Installation complete\\\")") 281s """.format( 281s c_off="" if has_cmake_package else "#", 281s cm_off="" if has_cmake_module else "#", 281s h_off="" if has_hybrid_package else "#", 281s ) 281s ) 281s ) 281s 281s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 281s path_types: Sequence[str] 281s try: 281s path_types = next( 281s iter( 281s zip( 281s *filter( 281s lambda i: i[1], 281s [ 281s ("c", has_cmake_package), 281s ("cm", has_cmake_module), 281s ("h", has_hybrid_package), 281s ("p", has_pure_package), 281s ("pm", has_pure_module), 281s ], 281s ) 281s ) 281s ) 281s ) 281s except StopIteration: 281s path_types = [] 281s 281s def select_paths(annotated_paths): 281s """Return a filtered list paths considering ``path_types``. 281s 281s `annotated_paths`` is list of tuple ``(type, path)`` where type 281s is either `c`, 'cm', `h`, `p` or 'pm'. 281s 281s """ 281s return filter(lambda i: i[0] in path_types, annotated_paths) 281s 281s # Commented paths are the one expected to be installed by CMake. For 281s # this reason, corresponding files should NOT be created in the source 281s # tree. 281s for _type, path in select_paths( 281s [ 281s # ('c', 'cmake/__init__.py'), 281s # ('c', 'cmake/cmake.py'), 281s # ('cm', 'cmakeModule.py'), 281s ("h", "hybrid/__init__.py"), 281s # ('h', 'hybrid/hybrid_cmake.dat'), 281s # ('h', 'hybrid/hybrid_cmake.py'), 281s ("h", "hybrid/hybrid_pure.dat"), 281s ("h", "hybrid/hybrid_pure.py"), 281s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 281s ("h", "hybrid/data/hybrid_data_pure.dat"), 281s ("h", "hybrid/hybrid_2/__init__.py"), 281s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 281s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 281s ("p", "hybrid/hybrid_2_pure/__init__.py"), 281s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 281s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 281s ("pm", "pureModule.py"), 281s ("p", "pure/__init__.py"), 281s ("p", "pure/pure.py"), 281s ("p", "pure/data/pure.dat"), 281s ] 281s ): 281s assert _type in {"p", "pm", "h"} 281s root = package_base if _type in {"p", "pm"} else cmake_source_dir 281s tmp_dir.ensure(os.path.join(root, path)) 281s 281s # Do not call the real setup function. Instead, replace it with 281s # a MagicMock allowing to check with which arguments it was invoked. 281s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 281s 281s # Convenience print function 281s def _pprint(desc, value=None): 281s print( 281s "-----------------\n" 281s f"{desc}:\n" 281s "\n" 281s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 281s ) 281s 281s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 281s 281s _pprint = ._pprint at 0x709a44483420> 281s _type = 'p' 281s cmake_source_dir = '' 281s has_cmake_module = 0 281s has_cmake_package = 1 281s has_hybrid_package = 0 281s has_pure_module = 0 281s has_pure_package = 1 281s mock_setup = 281s mocker = 281s package_base = '' 281s package_base_dir = '' 281s path = 'pure/data/pure.dat' 281s path_types = ('c', 'p') 281s root = '' 281s select_paths = .select_paths at 0x709a4441de40> 281s src_dir = local('/tmp/pytest-of-ubuntu/pytest-91/test_setup_inputs0') 281s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-91/test_setup_inputs0') 281s with_package_base = 0 281s 281s tests/test_setup.py:849: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-91/test_setup_inputs0') 281s setup_args = ['build'], disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-91/test_setup_inputs0') 281s setup_args = ['build'] 281s 281s tests/__init__.py:218: AttributeError 281s ________________________ test_setup_inputs[0-0-1-0-1-0] ________________________ 281s 281s has_cmake_package = 0, has_cmake_module = 1, has_hybrid_package = 0 281s has_pure_package = 1, has_pure_module = 0, with_package_base = 0 281s mocker = 281s 281s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 281s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 281s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 281s @pytest.mark.parametrize("has_pure_package", [0, 1]) 281s @pytest.mark.parametrize("has_pure_module", [0, 1]) 281s @pytest.mark.parametrize("with_package_base", [0, 1]) 281s def test_setup_inputs( 281s has_cmake_package, 281s has_cmake_module, 281s has_hybrid_package, 281s has_pure_package, 281s has_pure_module, 281s with_package_base, 281s mocker, 281s ): 281s """This test that a project can have a package with some modules 281s installed using setup.py and some other modules installed using CMake. 281s """ 281s 281s tmp_dir = _tmpdir("test_setup_inputs") 281s 281s package_base = "to/the/base" if with_package_base else "" 281s package_base_dir = package_base + "/" if package_base else "" 281s cmake_source_dir = package_base 281s 281s if cmake_source_dir and (has_cmake_package or has_cmake_module): 281s pytest.skip( 281s "unsupported configuration: " 281s "python package fully generated by CMake does *NOT* work. " 281s "At least __init__.py should be in the project source tree" 281s ) 281s 281s # ------------------------------------------------------------------------- 281s # Here is the "SOURCE" tree layout: 281s # 281s # ROOT/ 281s # 281s # setup.py 281s # 281s # [/] 281s # 281s # pureModule.py 281s # 281s # pure/ 281s # __init__.py 281s # pure.py 281s # 281s # data/ 281s # pure.dat 281s # 281s # [/] 281s # 281s # hybrid/ 281s # CMakeLists.txt 281s # __init__.py 281s # hybrid_pure.dat 281s # hybrid_pure.py 281s # 281s # data/ 281s # hybrid_data_pure.dat 281s # 281s # hybrid_2/ 281s # __init__.py 281s # hybrid_2_pure.py 281s # 281s # hybrid_2_pure/ 281s # __init__.py 281s # hybrid_2_pure_1.py 281s # hybrid_2_pure_2.py 281s # 281s # 281s # ------------------------------------------------------------------------- 281s # and here is the "BINARY" distribution layout: 281s # 281s # The comment "CMake" or "Setuptools" indicates which tool is responsible 281s # for placing the file in the tree used to create the binary distribution. 281s # 281s # ROOT/ 281s # 281s # cmakeModule.py # CMake 281s # 281s # cmake/ 281s # __init__.py # CMake 281s # cmake.py # CMake 281s # 281s # hybrid/ 281s # hybrid_cmake.dat # CMake 281s # hybrid_cmake.py # CMake 281s # hybrid_pure.dat # Setuptools 281s # hybrid_pure.py # Setuptools 281s # 281s # data/ 281s # hybrid_data_pure.dat # CMake or Setuptools 281s # hybrid_data_cmake.dat # CMake *NO TEST* 281s # 281s # hybrid_2/ 281s # __init__.py # CMake or Setuptools 281s # hybrid_2_pure.py # CMake or Setuptools 281s # hybrid_2_cmake.py # CMake 281s # 281s # hybrid_2_pure/ 281s # __init__.py # CMake or Setuptools 281s # hybrid_2_pure_1.py # CMake or Setuptools 281s # hybrid_2_pure_2.py # CMake or Setuptools 281s # 281s # pureModule.py # Setuptools 281s # 281s # pure/ 281s # __init__.py # Setuptools 281s # pure.py # Setuptools 281s # 281s # data/ 281s # pure.dat # Setuptools 281s 281s tmp_dir.join("setup.py").write( 281s textwrap.dedent( 281s """ 281s from skbuild import setup 281s #from setuptools import setup 281s setup( 281s name="test_hybrid_project", 281s version="1.2.3", 281s description=("an hybrid package mixing files installed by both " 281s "CMake and setuptools"), 281s author='The scikit-build team', 281s license="MIT", 281s cmake_source_dir='{cmake_source_dir}', 281s cmake_install_dir='{cmake_install_dir}', 281s # Arbitrary order of packages 281s packages=[ 281s {p_off} 'pure', 281s {h_off} 'hybrid.hybrid_2', 281s {h_off} 'hybrid', 281s {c_off} 'cmake', 281s {p_off} 'hybrid.hybrid_2_pure', 281s ], 281s py_modules=[ 281s {pm_off} '{package_base}pureModule', 281s {cm_off} '{package_base}cmakeModule', 281s ], 281s package_data={{ 281s {p_off} 'pure': ['data/pure.dat'], 281s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 281s }}, 281s # Arbitrary order of package_dir 281s package_dir = {{ 281s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 281s {p_off} 'pure': '{package_base}pure', 281s {h_off} 'hybrid': '{package_base}hybrid', 281s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 281s {c_off} 'cmake': '{package_base}cmake', 281s }} 281s ) 281s """.format( 281s cmake_source_dir=cmake_source_dir, 281s cmake_install_dir=package_base, 281s package_base=package_base_dir, 281s c_off="" if has_cmake_package else "#", 281s cm_off="" if has_cmake_module else "#", 281s h_off="" if has_hybrid_package else "#", 281s p_off="" if has_pure_package else "#", 281s pm_off="" if has_pure_module else "#", 281s ) 281s ) 281s ) 281s 281s src_dir = tmp_dir.ensure(package_base, dir=1) 281s 281s src_dir.join("CMakeLists.txt").write( 281s textwrap.dedent( 281s """ 281s cmake_minimum_required(VERSION 3.5.0) 281s project(hybrid NONE) 281s set(build_dir ${{CMAKE_BINARY_DIR}}) 281s 281s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 281s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 281s {c_off} install( 281s {c_off} FILES 281s {c_off} ${{build_dir}}/__init__.py 281s {c_off} ${{build_dir}}/cmake.py 281s {c_off} DESTINATION cmake 281s {c_off} ) 281s 281s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 281s {cm_off} install( 281s {cm_off} FILES ${{build_dir}}/cmakeModule.py 281s {cm_off} DESTINATION .) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 281s {h_off} DESTINATION hybrid) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 281s {h_off} DESTINATION hybrid) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 281s {h_off} DESTINATION hybrid/data) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 281s {h_off} DESTINATION hybrid/hybrid_2) 281s 281s install(CODE "message(STATUS \\\"Installation complete\\\")") 281s """.format( 281s c_off="" if has_cmake_package else "#", 281s cm_off="" if has_cmake_module else "#", 281s h_off="" if has_hybrid_package else "#", 281s ) 281s ) 281s ) 281s 281s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 281s path_types: Sequence[str] 281s try: 281s path_types = next( 281s iter( 281s zip( 281s *filter( 281s lambda i: i[1], 281s [ 281s ("c", has_cmake_package), 281s ("cm", has_cmake_module), 281s ("h", has_hybrid_package), 281s ("p", has_pure_package), 281s ("pm", has_pure_module), 281s ], 281s ) 281s ) 281s ) 281s ) 281s except StopIteration: 281s path_types = [] 281s 281s def select_paths(annotated_paths): 281s """Return a filtered list paths considering ``path_types``. 281s 281s `annotated_paths`` is list of tuple ``(type, path)`` where type 281s is either `c`, 'cm', `h`, `p` or 'pm'. 281s 281s """ 281s return filter(lambda i: i[0] in path_types, annotated_paths) 281s 281s # Commented paths are the one expected to be installed by CMake. For 281s # this reason, corresponding files should NOT be created in the source 281s # tree. 281s for _type, path in select_paths( 281s [ 281s # ('c', 'cmake/__init__.py'), 281s # ('c', 'cmake/cmake.py'), 281s # ('cm', 'cmakeModule.py'), 281s ("h", "hybrid/__init__.py"), 281s # ('h', 'hybrid/hybrid_cmake.dat'), 281s # ('h', 'hybrid/hybrid_cmake.py'), 281s ("h", "hybrid/hybrid_pure.dat"), 281s ("h", "hybrid/hybrid_pure.py"), 281s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 281s ("h", "hybrid/data/hybrid_data_pure.dat"), 281s ("h", "hybrid/hybrid_2/__init__.py"), 281s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 281s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 281s ("p", "hybrid/hybrid_2_pure/__init__.py"), 281s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 281s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 281s ("pm", "pureModule.py"), 281s ("p", "pure/__init__.py"), 281s ("p", "pure/pure.py"), 281s ("p", "pure/data/pure.dat"), 281s ] 281s ): 281s assert _type in {"p", "pm", "h"} 281s root = package_base if _type in {"p", "pm"} else cmake_source_dir 281s tmp_dir.ensure(os.path.join(root, path)) 281s 281s # Do not call the real setup function. Instead, replace it with 281s # a MagicMock allowing to check with which arguments it was invoked. 281s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 281s 281s # Convenience print function 281s def _pprint(desc, value=None): 281s print( 281s "-----------------\n" 281s f"{desc}:\n" 281s "\n" 281s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 281s ) 281s 281s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 281s 281s _pprint = ._pprint at 0x709a443865c0> 281s _type = 'p' 281s cmake_source_dir = '' 281s has_cmake_module = 1 281s has_cmake_package = 0 281s has_hybrid_package = 0 281s has_pure_module = 0 281s has_pure_package = 1 281s mock_setup = 281s mocker = 281s package_base = '' 281s package_base_dir = '' 281s path = 'pure/data/pure.dat' 281s path_types = ('cm', 'p') 281s root = '' 281s select_paths = .select_paths at 0x709a44386de0> 281s src_dir = local('/tmp/pytest-of-ubuntu/pytest-92/test_setup_inputs0') 281s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-92/test_setup_inputs0') 281s with_package_base = 0 281s 281s tests/test_setup.py:849: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-92/test_setup_inputs0') 281s setup_args = ['build'], disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-92/test_setup_inputs0') 281s setup_args = ['build'] 281s 281s tests/__init__.py:218: AttributeError 281s ________________________ test_setup_inputs[0-0-1-0-1-1] ________________________ 281s 281s has_cmake_package = 1, has_cmake_module = 1, has_hybrid_package = 0 281s has_pure_package = 1, has_pure_module = 0, with_package_base = 0 281s mocker = 281s 281s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 281s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 281s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 281s @pytest.mark.parametrize("has_pure_package", [0, 1]) 281s @pytest.mark.parametrize("has_pure_module", [0, 1]) 281s @pytest.mark.parametrize("with_package_base", [0, 1]) 281s def test_setup_inputs( 281s has_cmake_package, 281s has_cmake_module, 281s has_hybrid_package, 281s has_pure_package, 281s has_pure_module, 281s with_package_base, 281s mocker, 281s ): 281s """This test that a project can have a package with some modules 281s installed using setup.py and some other modules installed using CMake. 281s """ 281s 281s tmp_dir = _tmpdir("test_setup_inputs") 281s 281s package_base = "to/the/base" if with_package_base else "" 281s package_base_dir = package_base + "/" if package_base else "" 281s cmake_source_dir = package_base 281s 281s if cmake_source_dir and (has_cmake_package or has_cmake_module): 281s pytest.skip( 281s "unsupported configuration: " 281s "python package fully generated by CMake does *NOT* work. " 281s "At least __init__.py should be in the project source tree" 281s ) 281s 281s # ------------------------------------------------------------------------- 281s # Here is the "SOURCE" tree layout: 281s # 281s # ROOT/ 281s # 281s # setup.py 281s # 281s # [/] 281s # 281s # pureModule.py 281s # 281s # pure/ 281s # __init__.py 281s # pure.py 281s # 281s # data/ 281s # pure.dat 281s # 281s # [/] 281s # 281s # hybrid/ 281s # CMakeLists.txt 281s # __init__.py 281s # hybrid_pure.dat 281s # hybrid_pure.py 281s # 281s # data/ 281s # hybrid_data_pure.dat 281s # 281s # hybrid_2/ 281s # __init__.py 281s # hybrid_2_pure.py 281s # 281s # hybrid_2_pure/ 281s # __init__.py 281s # hybrid_2_pure_1.py 281s # hybrid_2_pure_2.py 281s # 281s # 281s # ------------------------------------------------------------------------- 281s # and here is the "BINARY" distribution layout: 281s # 281s # The comment "CMake" or "Setuptools" indicates which tool is responsible 281s # for placing the file in the tree used to create the binary distribution. 281s # 281s # ROOT/ 281s # 281s # cmakeModule.py # CMake 281s # 281s # cmake/ 281s # __init__.py # CMake 281s # cmake.py # CMake 281s # 281s # hybrid/ 281s # hybrid_cmake.dat # CMake 281s # hybrid_cmake.py # CMake 281s # hybrid_pure.dat # Setuptools 281s # hybrid_pure.py # Setuptools 281s # 281s # data/ 281s # hybrid_data_pure.dat # CMake or Setuptools 281s # hybrid_data_cmake.dat # CMake *NO TEST* 281s # 281s # hybrid_2/ 281s # __init__.py # CMake or Setuptools 281s # hybrid_2_pure.py # CMake or Setuptools 281s # hybrid_2_cmake.py # CMake 281s # 281s # hybrid_2_pure/ 281s # __init__.py # CMake or Setuptools 281s # hybrid_2_pure_1.py # CMake or Setuptools 281s # hybrid_2_pure_2.py # CMake or Setuptools 281s # 281s # pureModule.py # Setuptools 281s # 281s # pure/ 281s # __init__.py # Setuptools 281s # pure.py # Setuptools 281s # 281s # data/ 281s # pure.dat # Setuptools 281s 281s tmp_dir.join("setup.py").write( 281s textwrap.dedent( 281s """ 281s from skbuild import setup 281s #from setuptools import setup 281s setup( 281s name="test_hybrid_project", 281s version="1.2.3", 281s description=("an hybrid package mixing files installed by both " 281s "CMake and setuptools"), 281s author='The scikit-build team', 281s license="MIT", 281s cmake_source_dir='{cmake_source_dir}', 281s cmake_install_dir='{cmake_install_dir}', 281s # Arbitrary order of packages 281s packages=[ 281s {p_off} 'pure', 281s {h_off} 'hybrid.hybrid_2', 281s {h_off} 'hybrid', 281s {c_off} 'cmake', 281s {p_off} 'hybrid.hybrid_2_pure', 281s ], 281s py_modules=[ 281s {pm_off} '{package_base}pureModule', 281s {cm_off} '{package_base}cmakeModule', 281s ], 281s package_data={{ 281s {p_off} 'pure': ['data/pure.dat'], 281s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 281s }}, 281s # Arbitrary order of package_dir 281s package_dir = {{ 281s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 281s {p_off} 'pure': '{package_base}pure', 281s {h_off} 'hybrid': '{package_base}hybrid', 281s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 281s {c_off} 'cmake': '{package_base}cmake', 281s }} 281s ) 281s """.format( 281s cmake_source_dir=cmake_source_dir, 281s cmake_install_dir=package_base, 281s package_base=package_base_dir, 281s c_off="" if has_cmake_package else "#", 281s cm_off="" if has_cmake_module else "#", 281s h_off="" if has_hybrid_package else "#", 281s p_off="" if has_pure_package else "#", 281s pm_off="" if has_pure_module else "#", 281s ) 281s ) 281s ) 281s 281s src_dir = tmp_dir.ensure(package_base, dir=1) 281s 281s src_dir.join("CMakeLists.txt").write( 281s textwrap.dedent( 281s """ 281s cmake_minimum_required(VERSION 3.5.0) 281s project(hybrid NONE) 281s set(build_dir ${{CMAKE_BINARY_DIR}}) 281s 281s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 281s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 281s {c_off} install( 281s {c_off} FILES 281s {c_off} ${{build_dir}}/__init__.py 281s {c_off} ${{build_dir}}/cmake.py 281s {c_off} DESTINATION cmake 281s {c_off} ) 281s 281s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 281s {cm_off} install( 281s {cm_off} FILES ${{build_dir}}/cmakeModule.py 281s {cm_off} DESTINATION .) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 281s {h_off} DESTINATION hybrid) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 281s {h_off} DESTINATION hybrid) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 281s {h_off} DESTINATION hybrid/data) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 281s {h_off} DESTINATION hybrid/hybrid_2) 281s 281s install(CODE "message(STATUS \\\"Installation complete\\\")") 281s """.format( 281s c_off="" if has_cmake_package else "#", 281s cm_off="" if has_cmake_module else "#", 281s h_off="" if has_hybrid_package else "#", 281s ) 281s ) 281s ) 281s 281s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 281s path_types: Sequence[str] 281s try: 281s path_types = next( 281s iter( 281s zip( 281s *filter( 281s lambda i: i[1], 281s [ 281s ("c", has_cmake_package), 281s ("cm", has_cmake_module), 281s ("h", has_hybrid_package), 281s ("p", has_pure_package), 281s ("pm", has_pure_module), 281s ], 281s ) 281s ) 281s ) 281s ) 281s except StopIteration: 281s path_types = [] 281s 281s def select_paths(annotated_paths): 281s """Return a filtered list paths considering ``path_types``. 281s 281s `annotated_paths`` is list of tuple ``(type, path)`` where type 281s is either `c`, 'cm', `h`, `p` or 'pm'. 281s 281s """ 281s return filter(lambda i: i[0] in path_types, annotated_paths) 281s 281s # Commented paths are the one expected to be installed by CMake. For 281s # this reason, corresponding files should NOT be created in the source 281s # tree. 281s for _type, path in select_paths( 281s [ 281s # ('c', 'cmake/__init__.py'), 281s # ('c', 'cmake/cmake.py'), 281s # ('cm', 'cmakeModule.py'), 281s ("h", "hybrid/__init__.py"), 281s # ('h', 'hybrid/hybrid_cmake.dat'), 281s # ('h', 'hybrid/hybrid_cmake.py'), 281s ("h", "hybrid/hybrid_pure.dat"), 281s ("h", "hybrid/hybrid_pure.py"), 281s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 281s ("h", "hybrid/data/hybrid_data_pure.dat"), 281s ("h", "hybrid/hybrid_2/__init__.py"), 281s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 281s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 281s ("p", "hybrid/hybrid_2_pure/__init__.py"), 281s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 281s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 281s ("pm", "pureModule.py"), 281s ("p", "pure/__init__.py"), 281s ("p", "pure/pure.py"), 281s ("p", "pure/data/pure.dat"), 281s ] 281s ): 281s assert _type in {"p", "pm", "h"} 281s root = package_base if _type in {"p", "pm"} else cmake_source_dir 281s tmp_dir.ensure(os.path.join(root, path)) 281s 281s # Do not call the real setup function. Instead, replace it with 281s # a MagicMock allowing to check with which arguments it was invoked. 281s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 281s 281s # Convenience print function 281s def _pprint(desc, value=None): 281s print( 281s "-----------------\n" 281s f"{desc}:\n" 281s "\n" 281s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 281s ) 281s 281s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 281s 281s _pprint = ._pprint at 0x709a44386b60> 281s _type = 'p' 281s cmake_source_dir = '' 281s has_cmake_module = 1 281s has_cmake_package = 1 281s has_hybrid_package = 0 281s has_pure_module = 0 281s has_pure_package = 1 281s mock_setup = 281s mocker = 281s package_base = '' 281s package_base_dir = '' 281s path = 'pure/data/pure.dat' 281s path_types = ('c', 'cm', 'p') 281s root = '' 281s select_paths = .select_paths at 0x709a44386980> 281s src_dir = local('/tmp/pytest-of-ubuntu/pytest-93/test_setup_inputs0') 281s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-93/test_setup_inputs0') 281s with_package_base = 0 281s 281s tests/test_setup.py:849: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-93/test_setup_inputs0') 281s setup_args = ['build'], disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-93/test_setup_inputs0') 281s setup_args = ['build'] 281s 281s tests/__init__.py:218: AttributeError 281s ________________________ test_setup_inputs[0-0-1-1-0-0] ________________________ 281s 281s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 1 281s has_pure_package = 1, has_pure_module = 0, with_package_base = 0 281s mocker = 281s 281s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 281s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 281s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 281s @pytest.mark.parametrize("has_pure_package", [0, 1]) 281s @pytest.mark.parametrize("has_pure_module", [0, 1]) 281s @pytest.mark.parametrize("with_package_base", [0, 1]) 281s def test_setup_inputs( 281s has_cmake_package, 281s has_cmake_module, 281s has_hybrid_package, 281s has_pure_package, 281s has_pure_module, 281s with_package_base, 281s mocker, 281s ): 281s """This test that a project can have a package with some modules 281s installed using setup.py and some other modules installed using CMake. 281s """ 281s 281s tmp_dir = _tmpdir("test_setup_inputs") 281s 281s package_base = "to/the/base" if with_package_base else "" 281s package_base_dir = package_base + "/" if package_base else "" 281s cmake_source_dir = package_base 281s 281s if cmake_source_dir and (has_cmake_package or has_cmake_module): 281s pytest.skip( 281s "unsupported configuration: " 281s "python package fully generated by CMake does *NOT* work. " 281s "At least __init__.py should be in the project source tree" 281s ) 281s 281s # ------------------------------------------------------------------------- 281s # Here is the "SOURCE" tree layout: 281s # 281s # ROOT/ 281s # 281s # setup.py 281s # 281s # [/] 281s # 281s # pureModule.py 281s # 281s # pure/ 281s # __init__.py 281s # pure.py 281s # 281s # data/ 281s # pure.dat 281s # 281s # [/] 281s # 281s # hybrid/ 281s # CMakeLists.txt 281s # __init__.py 281s # hybrid_pure.dat 281s # hybrid_pure.py 281s # 281s # data/ 281s # hybrid_data_pure.dat 281s # 281s # hybrid_2/ 281s # __init__.py 281s # hybrid_2_pure.py 281s # 281s # hybrid_2_pure/ 281s # __init__.py 281s # hybrid_2_pure_1.py 281s # hybrid_2_pure_2.py 281s # 281s # 281s # ------------------------------------------------------------------------- 281s # and here is the "BINARY" distribution layout: 281s # 281s # The comment "CMake" or "Setuptools" indicates which tool is responsible 281s # for placing the file in the tree used to create the binary distribution. 281s # 281s # ROOT/ 281s # 281s # cmakeModule.py # CMake 281s # 281s # cmake/ 281s # __init__.py # CMake 281s # cmake.py # CMake 281s # 281s # hybrid/ 281s # hybrid_cmake.dat # CMake 281s # hybrid_cmake.py # CMake 281s # hybrid_pure.dat # Setuptools 281s # hybrid_pure.py # Setuptools 281s # 281s # data/ 281s # hybrid_data_pure.dat # CMake or Setuptools 281s # hybrid_data_cmake.dat # CMake *NO TEST* 281s # 281s # hybrid_2/ 281s # __init__.py # CMake or Setuptools 281s # hybrid_2_pure.py # CMake or Setuptools 281s # hybrid_2_cmake.py # CMake 281s # 281s # hybrid_2_pure/ 281s # __init__.py # CMake or Setuptools 281s # hybrid_2_pure_1.py # CMake or Setuptools 281s # hybrid_2_pure_2.py # CMake or Setuptools 281s # 281s # pureModule.py # Setuptools 281s # 281s # pure/ 281s # __init__.py # Setuptools 281s # pure.py # Setuptools 281s # 281s # data/ 281s # pure.dat # Setuptools 281s 281s tmp_dir.join("setup.py").write( 281s textwrap.dedent( 281s """ 281s from skbuild import setup 281s #from setuptools import setup 281s setup( 281s name="test_hybrid_project", 281s version="1.2.3", 281s description=("an hybrid package mixing files installed by both " 281s "CMake and setuptools"), 281s author='The scikit-build team', 281s license="MIT", 281s cmake_source_dir='{cmake_source_dir}', 281s cmake_install_dir='{cmake_install_dir}', 281s # Arbitrary order of packages 281s packages=[ 281s {p_off} 'pure', 281s {h_off} 'hybrid.hybrid_2', 281s {h_off} 'hybrid', 281s {c_off} 'cmake', 281s {p_off} 'hybrid.hybrid_2_pure', 281s ], 281s py_modules=[ 281s {pm_off} '{package_base}pureModule', 281s {cm_off} '{package_base}cmakeModule', 281s ], 281s package_data={{ 281s {p_off} 'pure': ['data/pure.dat'], 281s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 281s }}, 281s # Arbitrary order of package_dir 281s package_dir = {{ 281s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 281s {p_off} 'pure': '{package_base}pure', 281s {h_off} 'hybrid': '{package_base}hybrid', 281s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 281s {c_off} 'cmake': '{package_base}cmake', 281s }} 281s ) 281s """.format( 281s cmake_source_dir=cmake_source_dir, 281s cmake_install_dir=package_base, 281s package_base=package_base_dir, 281s c_off="" if has_cmake_package else "#", 281s cm_off="" if has_cmake_module else "#", 281s h_off="" if has_hybrid_package else "#", 281s p_off="" if has_pure_package else "#", 281s pm_off="" if has_pure_module else "#", 281s ) 281s ) 281s ) 281s 281s src_dir = tmp_dir.ensure(package_base, dir=1) 281s 281s src_dir.join("CMakeLists.txt").write( 281s textwrap.dedent( 281s """ 281s cmake_minimum_required(VERSION 3.5.0) 281s project(hybrid NONE) 281s set(build_dir ${{CMAKE_BINARY_DIR}}) 281s 281s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 281s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 281s {c_off} install( 281s {c_off} FILES 281s {c_off} ${{build_dir}}/__init__.py 281s {c_off} ${{build_dir}}/cmake.py 281s {c_off} DESTINATION cmake 281s {c_off} ) 281s 281s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 281s {cm_off} install( 281s {cm_off} FILES ${{build_dir}}/cmakeModule.py 281s {cm_off} DESTINATION .) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 281s {h_off} DESTINATION hybrid) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 281s {h_off} DESTINATION hybrid) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 281s {h_off} DESTINATION hybrid/data) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 281s {h_off} DESTINATION hybrid/hybrid_2) 281s 281s install(CODE "message(STATUS \\\"Installation complete\\\")") 281s """.format( 281s c_off="" if has_cmake_package else "#", 281s cm_off="" if has_cmake_module else "#", 281s h_off="" if has_hybrid_package else "#", 281s ) 281s ) 281s ) 281s 281s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 281s path_types: Sequence[str] 281s try: 281s path_types = next( 281s iter( 281s zip( 281s *filter( 281s lambda i: i[1], 281s [ 281s ("c", has_cmake_package), 281s ("cm", has_cmake_module), 281s ("h", has_hybrid_package), 281s ("p", has_pure_package), 281s ("pm", has_pure_module), 281s ], 281s ) 281s ) 281s ) 281s ) 281s except StopIteration: 281s path_types = [] 281s 281s def select_paths(annotated_paths): 281s """Return a filtered list paths considering ``path_types``. 281s 281s `annotated_paths`` is list of tuple ``(type, path)`` where type 281s is either `c`, 'cm', `h`, `p` or 'pm'. 281s 281s """ 281s return filter(lambda i: i[0] in path_types, annotated_paths) 281s 281s # Commented paths are the one expected to be installed by CMake. For 281s # this reason, corresponding files should NOT be created in the source 281s # tree. 281s for _type, path in select_paths( 281s [ 281s # ('c', 'cmake/__init__.py'), 281s # ('c', 'cmake/cmake.py'), 281s # ('cm', 'cmakeModule.py'), 281s ("h", "hybrid/__init__.py"), 281s # ('h', 'hybrid/hybrid_cmake.dat'), 281s # ('h', 'hybrid/hybrid_cmake.py'), 281s ("h", "hybrid/hybrid_pure.dat"), 281s ("h", "hybrid/hybrid_pure.py"), 281s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 281s ("h", "hybrid/data/hybrid_data_pure.dat"), 281s ("h", "hybrid/hybrid_2/__init__.py"), 281s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 281s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 281s ("p", "hybrid/hybrid_2_pure/__init__.py"), 281s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 281s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 281s ("pm", "pureModule.py"), 281s ("p", "pure/__init__.py"), 281s ("p", "pure/pure.py"), 281s ("p", "pure/data/pure.dat"), 281s ] 281s ): 281s assert _type in {"p", "pm", "h"} 281s root = package_base if _type in {"p", "pm"} else cmake_source_dir 281s tmp_dir.ensure(os.path.join(root, path)) 281s 281s # Do not call the real setup function. Instead, replace it with 281s # a MagicMock allowing to check with which arguments it was invoked. 281s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 281s 281s # Convenience print function 281s def _pprint(desc, value=None): 281s print( 281s "-----------------\n" 281s f"{desc}:\n" 281s "\n" 281s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 281s ) 281s 281s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 281s 281s _pprint = ._pprint at 0x709a443856c0> 281s _type = 'p' 281s cmake_source_dir = '' 281s has_cmake_module = 0 281s has_cmake_package = 0 281s has_hybrid_package = 1 281s has_pure_module = 0 281s has_pure_package = 1 281s mock_setup = 281s mocker = 281s package_base = '' 281s package_base_dir = '' 281s path = 'pure/data/pure.dat' 281s path_types = ('h', 'p') 281s root = '' 281s select_paths = .select_paths at 0x709a44385d00> 281s src_dir = local('/tmp/pytest-of-ubuntu/pytest-94/test_setup_inputs0') 281s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-94/test_setup_inputs0') 281s with_package_base = 0 281s 281s tests/test_setup.py:849: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-94/test_setup_inputs0') 281s setup_args = ['build'], disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-94/test_setup_inputs0') 281s setup_args = ['build'] 281s 281s tests/__init__.py:218: AttributeError 281s ________________________ test_setup_inputs[0-0-1-1-0-1] ________________________ 281s 281s has_cmake_package = 1, has_cmake_module = 0, has_hybrid_package = 1 281s has_pure_package = 1, has_pure_module = 0, with_package_base = 0 281s mocker = 281s 281s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 281s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 281s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 281s @pytest.mark.parametrize("has_pure_package", [0, 1]) 281s @pytest.mark.parametrize("has_pure_module", [0, 1]) 281s @pytest.mark.parametrize("with_package_base", [0, 1]) 281s def test_setup_inputs( 281s has_cmake_package, 281s has_cmake_module, 281s has_hybrid_package, 281s has_pure_package, 281s has_pure_module, 281s with_package_base, 281s mocker, 281s ): 281s """This test that a project can have a package with some modules 281s installed using setup.py and some other modules installed using CMake. 281s """ 281s 281s tmp_dir = _tmpdir("test_setup_inputs") 281s 281s package_base = "to/the/base" if with_package_base else "" 281s package_base_dir = package_base + "/" if package_base else "" 281s cmake_source_dir = package_base 281s 281s if cmake_source_dir and (has_cmake_package or has_cmake_module): 281s pytest.skip( 281s "unsupported configuration: " 281s "python package fully generated by CMake does *NOT* work. " 281s "At least __init__.py should be in the project source tree" 281s ) 281s 281s # ------------------------------------------------------------------------- 281s # Here is the "SOURCE" tree layout: 281s # 281s # ROOT/ 281s # 281s # setup.py 281s # 281s # [/] 281s # 281s # pureModule.py 281s # 281s # pure/ 281s # __init__.py 281s # pure.py 281s # 281s # data/ 281s # pure.dat 281s # 281s # [/] 281s # 281s # hybrid/ 281s # CMakeLists.txt 281s # __init__.py 281s # hybrid_pure.dat 281s # hybrid_pure.py 281s # 281s # data/ 281s # hybrid_data_pure.dat 281s # 281s # hybrid_2/ 281s # __init__.py 281s # hybrid_2_pure.py 281s # 281s # hybrid_2_pure/ 281s # __init__.py 281s # hybrid_2_pure_1.py 281s # hybrid_2_pure_2.py 281s # 281s # 281s # ------------------------------------------------------------------------- 281s # and here is the "BINARY" distribution layout: 281s # 281s # The comment "CMake" or "Setuptools" indicates which tool is responsible 281s # for placing the file in the tree used to create the binary distribution. 281s # 281s # ROOT/ 281s # 281s # cmakeModule.py # CMake 281s # 281s # cmake/ 281s # __init__.py # CMake 281s # cmake.py # CMake 281s # 281s # hybrid/ 281s # hybrid_cmake.dat # CMake 281s # hybrid_cmake.py # CMake 281s # hybrid_pure.dat # Setuptools 281s # hybrid_pure.py # Setuptools 281s # 281s # data/ 281s # hybrid_data_pure.dat # CMake or Setuptools 281s # hybrid_data_cmake.dat # CMake *NO TEST* 281s # 281s # hybrid_2/ 281s # __init__.py # CMake or Setuptools 281s # hybrid_2_pure.py # CMake or Setuptools 281s # hybrid_2_cmake.py # CMake 281s # 281s # hybrid_2_pure/ 281s # __init__.py # CMake or Setuptools 281s # hybrid_2_pure_1.py # CMake or Setuptools 281s # hybrid_2_pure_2.py # CMake or Setuptools 281s # 281s # pureModule.py # Setuptools 281s # 281s # pure/ 281s # __init__.py # Setuptools 281s # pure.py # Setuptools 281s # 281s # data/ 281s # pure.dat # Setuptools 281s 281s tmp_dir.join("setup.py").write( 281s textwrap.dedent( 281s """ 281s from skbuild import setup 281s #from setuptools import setup 281s setup( 281s name="test_hybrid_project", 281s version="1.2.3", 281s description=("an hybrid package mixing files installed by both " 281s "CMake and setuptools"), 281s author='The scikit-build team', 281s license="MIT", 281s cmake_source_dir='{cmake_source_dir}', 281s cmake_install_dir='{cmake_install_dir}', 281s # Arbitrary order of packages 281s packages=[ 281s {p_off} 'pure', 281s {h_off} 'hybrid.hybrid_2', 281s {h_off} 'hybrid', 281s {c_off} 'cmake', 281s {p_off} 'hybrid.hybrid_2_pure', 281s ], 281s py_modules=[ 281s {pm_off} '{package_base}pureModule', 281s {cm_off} '{package_base}cmakeModule', 281s ], 281s package_data={{ 281s {p_off} 'pure': ['data/pure.dat'], 281s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 281s }}, 281s # Arbitrary order of package_dir 281s package_dir = {{ 281s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 281s {p_off} 'pure': '{package_base}pure', 281s {h_off} 'hybrid': '{package_base}hybrid', 281s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 281s {c_off} 'cmake': '{package_base}cmake', 281s }} 281s ) 281s """.format( 281s cmake_source_dir=cmake_source_dir, 281s cmake_install_dir=package_base, 281s package_base=package_base_dir, 281s c_off="" if has_cmake_package else "#", 281s cm_off="" if has_cmake_module else "#", 281s h_off="" if has_hybrid_package else "#", 281s p_off="" if has_pure_package else "#", 281s pm_off="" if has_pure_module else "#", 281s ) 281s ) 281s ) 281s 281s src_dir = tmp_dir.ensure(package_base, dir=1) 281s 281s src_dir.join("CMakeLists.txt").write( 281s textwrap.dedent( 281s """ 281s cmake_minimum_required(VERSION 3.5.0) 281s project(hybrid NONE) 281s set(build_dir ${{CMAKE_BINARY_DIR}}) 281s 281s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 281s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 281s {c_off} install( 281s {c_off} FILES 281s {c_off} ${{build_dir}}/__init__.py 281s {c_off} ${{build_dir}}/cmake.py 281s {c_off} DESTINATION cmake 281s {c_off} ) 281s 281s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 281s {cm_off} install( 281s {cm_off} FILES ${{build_dir}}/cmakeModule.py 281s {cm_off} DESTINATION .) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 281s {h_off} DESTINATION hybrid) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 281s {h_off} DESTINATION hybrid) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 281s {h_off} DESTINATION hybrid/data) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 281s {h_off} DESTINATION hybrid/hybrid_2) 281s 281s install(CODE "message(STATUS \\\"Installation complete\\\")") 281s """.format( 281s c_off="" if has_cmake_package else "#", 281s cm_off="" if has_cmake_module else "#", 281s h_off="" if has_hybrid_package else "#", 281s ) 281s ) 281s ) 281s 281s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 281s path_types: Sequence[str] 281s try: 281s path_types = next( 281s iter( 281s zip( 281s *filter( 281s lambda i: i[1], 281s [ 281s ("c", has_cmake_package), 281s ("cm", has_cmake_module), 281s ("h", has_hybrid_package), 281s ("p", has_pure_package), 281s ("pm", has_pure_module), 281s ], 281s ) 281s ) 281s ) 281s ) 281s except StopIteration: 281s path_types = [] 281s 281s def select_paths(annotated_paths): 281s """Return a filtered list paths considering ``path_types``. 281s 281s `annotated_paths`` is list of tuple ``(type, path)`` where type 281s is either `c`, 'cm', `h`, `p` or 'pm'. 281s 281s """ 281s return filter(lambda i: i[0] in path_types, annotated_paths) 281s 281s # Commented paths are the one expected to be installed by CMake. For 281s # this reason, corresponding files should NOT be created in the source 281s # tree. 281s for _type, path in select_paths( 281s [ 281s # ('c', 'cmake/__init__.py'), 281s # ('c', 'cmake/cmake.py'), 281s # ('cm', 'cmakeModule.py'), 281s ("h", "hybrid/__init__.py"), 281s # ('h', 'hybrid/hybrid_cmake.dat'), 281s # ('h', 'hybrid/hybrid_cmake.py'), 281s ("h", "hybrid/hybrid_pure.dat"), 281s ("h", "hybrid/hybrid_pure.py"), 281s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 281s ("h", "hybrid/data/hybrid_data_pure.dat"), 281s ("h", "hybrid/hybrid_2/__init__.py"), 281s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 281s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 281s ("p", "hybrid/hybrid_2_pure/__init__.py"), 281s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 281s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 281s ("pm", "pureModule.py"), 281s ("p", "pure/__init__.py"), 281s ("p", "pure/pure.py"), 281s ("p", "pure/data/pure.dat"), 281s ] 281s ): 281s assert _type in {"p", "pm", "h"} 281s root = package_base if _type in {"p", "pm"} else cmake_source_dir 281s tmp_dir.ensure(os.path.join(root, path)) 281s 281s # Do not call the real setup function. Instead, replace it with 281s # a MagicMock allowing to check with which arguments it was invoked. 281s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 281s 281s # Convenience print function 281s def _pprint(desc, value=None): 281s print( 281s "-----------------\n" 281s f"{desc}:\n" 281s "\n" 281s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 281s ) 281s 281s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 281s 281s _pprint = ._pprint at 0x709a44387740> 281s _type = 'p' 281s cmake_source_dir = '' 281s has_cmake_module = 0 281s has_cmake_package = 1 281s has_hybrid_package = 1 281s has_pure_module = 0 281s has_pure_package = 1 281s mock_setup = 281s mocker = 281s package_base = '' 281s package_base_dir = '' 281s path = 'pure/data/pure.dat' 281s path_types = ('c', 'h', 'p') 281s root = '' 281s select_paths = .select_paths at 0x709a44481e40> 281s src_dir = local('/tmp/pytest-of-ubuntu/pytest-95/test_setup_inputs0') 281s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-95/test_setup_inputs0') 281s with_package_base = 0 281s 281s tests/test_setup.py:849: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-95/test_setup_inputs0') 281s setup_args = ['build'], disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-95/test_setup_inputs0') 281s setup_args = ['build'] 281s 281s tests/__init__.py:218: AttributeError 281s ________________________ test_setup_inputs[0-0-1-1-1-0] ________________________ 281s 281s has_cmake_package = 0, has_cmake_module = 1, has_hybrid_package = 1 281s has_pure_package = 1, has_pure_module = 0, with_package_base = 0 281s mocker = 281s 281s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 281s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 281s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 281s @pytest.mark.parametrize("has_pure_package", [0, 1]) 281s @pytest.mark.parametrize("has_pure_module", [0, 1]) 281s @pytest.mark.parametrize("with_package_base", [0, 1]) 281s def test_setup_inputs( 281s has_cmake_package, 281s has_cmake_module, 281s has_hybrid_package, 281s has_pure_package, 281s has_pure_module, 281s with_package_base, 281s mocker, 281s ): 281s """This test that a project can have a package with some modules 281s installed using setup.py and some other modules installed using CMake. 281s """ 281s 281s tmp_dir = _tmpdir("test_setup_inputs") 281s 281s package_base = "to/the/base" if with_package_base else "" 281s package_base_dir = package_base + "/" if package_base else "" 281s cmake_source_dir = package_base 281s 281s if cmake_source_dir and (has_cmake_package or has_cmake_module): 281s pytest.skip( 281s "unsupported configuration: " 281s "python package fully generated by CMake does *NOT* work. " 281s "At least __init__.py should be in the project source tree" 281s ) 281s 281s # ------------------------------------------------------------------------- 281s # Here is the "SOURCE" tree layout: 281s # 281s # ROOT/ 281s # 281s # setup.py 281s # 281s # [/] 281s # 281s # pureModule.py 281s # 281s # pure/ 281s # __init__.py 281s # pure.py 281s # 281s # data/ 281s # pure.dat 281s # 281s # [/] 281s # 281s # hybrid/ 281s # CMakeLists.txt 281s # __init__.py 281s # hybrid_pure.dat 281s # hybrid_pure.py 281s # 281s # data/ 281s # hybrid_data_pure.dat 281s # 281s # hybrid_2/ 281s # __init__.py 281s # hybrid_2_pure.py 281s # 281s # hybrid_2_pure/ 281s # __init__.py 281s # hybrid_2_pure_1.py 281s # hybrid_2_pure_2.py 281s # 281s # 281s # ------------------------------------------------------------------------- 281s # and here is the "BINARY" distribution layout: 281s # 281s # The comment "CMake" or "Setuptools" indicates which tool is responsible 281s # for placing the file in the tree used to create the binary distribution. 281s # 281s # ROOT/ 281s # 281s # cmakeModule.py # CMake 281s # 281s # cmake/ 281s # __init__.py # CMake 281s # cmake.py # CMake 281s # 281s # hybrid/ 281s # hybrid_cmake.dat # CMake 281s # hybrid_cmake.py # CMake 281s # hybrid_pure.dat # Setuptools 281s # hybrid_pure.py # Setuptools 281s # 281s # data/ 281s # hybrid_data_pure.dat # CMake or Setuptools 281s # hybrid_data_cmake.dat # CMake *NO TEST* 281s # 281s # hybrid_2/ 281s # __init__.py # CMake or Setuptools 281s # hybrid_2_pure.py # CMake or Setuptools 281s # hybrid_2_cmake.py # CMake 281s # 281s # hybrid_2_pure/ 281s # __init__.py # CMake or Setuptools 281s # hybrid_2_pure_1.py # CMake or Setuptools 281s # hybrid_2_pure_2.py # CMake or Setuptools 281s # 281s # pureModule.py # Setuptools 281s # 281s # pure/ 281s # __init__.py # Setuptools 281s # pure.py # Setuptools 281s # 281s # data/ 281s # pure.dat # Setuptools 281s 281s tmp_dir.join("setup.py").write( 281s textwrap.dedent( 281s """ 281s from skbuild import setup 281s #from setuptools import setup 281s setup( 281s name="test_hybrid_project", 281s version="1.2.3", 281s description=("an hybrid package mixing files installed by both " 281s "CMake and setuptools"), 281s author='The scikit-build team', 281s license="MIT", 281s cmake_source_dir='{cmake_source_dir}', 281s cmake_install_dir='{cmake_install_dir}', 281s # Arbitrary order of packages 281s packages=[ 281s {p_off} 'pure', 281s {h_off} 'hybrid.hybrid_2', 281s {h_off} 'hybrid', 281s {c_off} 'cmake', 281s {p_off} 'hybrid.hybrid_2_pure', 281s ], 281s py_modules=[ 281s {pm_off} '{package_base}pureModule', 281s {cm_off} '{package_base}cmakeModule', 281s ], 281s package_data={{ 281s {p_off} 'pure': ['data/pure.dat'], 281s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 281s }}, 281s # Arbitrary order of package_dir 281s package_dir = {{ 281s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 281s {p_off} 'pure': '{package_base}pure', 281s {h_off} 'hybrid': '{package_base}hybrid', 281s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 281s {c_off} 'cmake': '{package_base}cmake', 281s }} 281s ) 281s """.format( 281s cmake_source_dir=cmake_source_dir, 281s cmake_install_dir=package_base, 281s package_base=package_base_dir, 281s c_off="" if has_cmake_package else "#", 281s cm_off="" if has_cmake_module else "#", 281s h_off="" if has_hybrid_package else "#", 281s p_off="" if has_pure_package else "#", 281s pm_off="" if has_pure_module else "#", 281s ) 281s ) 281s ) 281s 281s src_dir = tmp_dir.ensure(package_base, dir=1) 281s 281s src_dir.join("CMakeLists.txt").write( 281s textwrap.dedent( 281s """ 281s cmake_minimum_required(VERSION 3.5.0) 281s project(hybrid NONE) 281s set(build_dir ${{CMAKE_BINARY_DIR}}) 281s 281s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 281s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 281s {c_off} install( 281s {c_off} FILES 281s {c_off} ${{build_dir}}/__init__.py 281s {c_off} ${{build_dir}}/cmake.py 281s {c_off} DESTINATION cmake 281s {c_off} ) 281s 281s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 281s {cm_off} install( 281s {cm_off} FILES ${{build_dir}}/cmakeModule.py 281s {cm_off} DESTINATION .) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 281s {h_off} DESTINATION hybrid) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 281s {h_off} DESTINATION hybrid) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 281s {h_off} DESTINATION hybrid/data) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 281s {h_off} DESTINATION hybrid/hybrid_2) 281s 281s install(CODE "message(STATUS \\\"Installation complete\\\")") 281s """.format( 281s c_off="" if has_cmake_package else "#", 281s cm_off="" if has_cmake_module else "#", 281s h_off="" if has_hybrid_package else "#", 281s ) 281s ) 281s ) 281s 281s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 281s path_types: Sequence[str] 281s try: 281s path_types = next( 281s iter( 281s zip( 281s *filter( 281s lambda i: i[1], 281s [ 281s ("c", has_cmake_package), 281s ("cm", has_cmake_module), 281s ("h", has_hybrid_package), 281s ("p", has_pure_package), 281s ("pm", has_pure_module), 281s ], 281s ) 281s ) 281s ) 281s ) 281s except StopIteration: 281s path_types = [] 281s 281s def select_paths(annotated_paths): 281s """Return a filtered list paths considering ``path_types``. 281s 281s `annotated_paths`` is list of tuple ``(type, path)`` where type 281s is either `c`, 'cm', `h`, `p` or 'pm'. 281s 281s """ 281s return filter(lambda i: i[0] in path_types, annotated_paths) 281s 281s # Commented paths are the one expected to be installed by CMake. For 281s # this reason, corresponding files should NOT be created in the source 281s # tree. 281s for _type, path in select_paths( 281s [ 281s # ('c', 'cmake/__init__.py'), 281s # ('c', 'cmake/cmake.py'), 281s # ('cm', 'cmakeModule.py'), 281s ("h", "hybrid/__init__.py"), 281s # ('h', 'hybrid/hybrid_cmake.dat'), 281s # ('h', 'hybrid/hybrid_cmake.py'), 281s ("h", "hybrid/hybrid_pure.dat"), 281s ("h", "hybrid/hybrid_pure.py"), 281s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 281s ("h", "hybrid/data/hybrid_data_pure.dat"), 281s ("h", "hybrid/hybrid_2/__init__.py"), 281s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 281s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 281s ("p", "hybrid/hybrid_2_pure/__init__.py"), 281s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 281s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 281s ("pm", "pureModule.py"), 281s ("p", "pure/__init__.py"), 281s ("p", "pure/pure.py"), 281s ("p", "pure/data/pure.dat"), 281s ] 281s ): 281s assert _type in {"p", "pm", "h"} 281s root = package_base if _type in {"p", "pm"} else cmake_source_dir 281s tmp_dir.ensure(os.path.join(root, path)) 281s 281s # Do not call the real setup function. Instead, replace it with 281s # a MagicMock allowing to check with which arguments it was invoked. 281s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 281s 281s # Convenience print function 281s def _pprint(desc, value=None): 281s print( 281s "-----------------\n" 281s f"{desc}:\n" 281s "\n" 281s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 281s ) 281s 281s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 281s 281s _pprint = ._pprint at 0x709a44385c60> 281s _type = 'p' 281s cmake_source_dir = '' 281s has_cmake_module = 1 281s has_cmake_package = 0 281s has_hybrid_package = 1 281s has_pure_module = 0 281s has_pure_package = 1 281s mock_setup = 281s mocker = 281s package_base = '' 281s package_base_dir = '' 281s path = 'pure/data/pure.dat' 281s path_types = ('cm', 'h', 'p') 281s root = '' 281s select_paths = .select_paths at 0x709a44386f20> 281s src_dir = local('/tmp/pytest-of-ubuntu/pytest-96/test_setup_inputs0') 281s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-96/test_setup_inputs0') 281s with_package_base = 0 281s 281s tests/test_setup.py:849: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-96/test_setup_inputs0') 281s setup_args = ['build'], disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-96/test_setup_inputs0') 281s setup_args = ['build'] 281s 281s tests/__init__.py:218: AttributeError 281s ________________________ test_setup_inputs[0-0-1-1-1-1] ________________________ 281s 281s has_cmake_package = 1, has_cmake_module = 1, has_hybrid_package = 1 281s has_pure_package = 1, has_pure_module = 0, with_package_base = 0 281s mocker = 281s 281s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 281s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 281s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 281s @pytest.mark.parametrize("has_pure_package", [0, 1]) 281s @pytest.mark.parametrize("has_pure_module", [0, 1]) 281s @pytest.mark.parametrize("with_package_base", [0, 1]) 281s def test_setup_inputs( 281s has_cmake_package, 281s has_cmake_module, 281s has_hybrid_package, 281s has_pure_package, 281s has_pure_module, 281s with_package_base, 281s mocker, 281s ): 281s """This test that a project can have a package with some modules 281s installed using setup.py and some other modules installed using CMake. 281s """ 281s 281s tmp_dir = _tmpdir("test_setup_inputs") 281s 281s package_base = "to/the/base" if with_package_base else "" 281s package_base_dir = package_base + "/" if package_base else "" 281s cmake_source_dir = package_base 281s 281s if cmake_source_dir and (has_cmake_package or has_cmake_module): 281s pytest.skip( 281s "unsupported configuration: " 281s "python package fully generated by CMake does *NOT* work. " 281s "At least __init__.py should be in the project source tree" 281s ) 281s 281s # ------------------------------------------------------------------------- 281s # Here is the "SOURCE" tree layout: 281s # 281s # ROOT/ 281s # 281s # setup.py 281s # 281s # [/] 281s # 281s # pureModule.py 281s # 281s # pure/ 281s # __init__.py 281s # pure.py 281s # 281s # data/ 281s # pure.dat 281s # 281s # [/] 281s # 281s # hybrid/ 281s # CMakeLists.txt 281s # __init__.py 281s # hybrid_pure.dat 281s # hybrid_pure.py 281s # 281s # data/ 281s # hybrid_data_pure.dat 281s # 281s # hybrid_2/ 281s # __init__.py 281s # hybrid_2_pure.py 281s # 281s # hybrid_2_pure/ 281s # __init__.py 281s # hybrid_2_pure_1.py 281s # hybrid_2_pure_2.py 281s # 281s # 281s # ------------------------------------------------------------------------- 281s # and here is the "BINARY" distribution layout: 281s # 281s # The comment "CMake" or "Setuptools" indicates which tool is responsible 281s # for placing the file in the tree used to create the binary distribution. 281s # 281s # ROOT/ 281s # 281s # cmakeModule.py # CMake 281s # 281s # cmake/ 281s # __init__.py # CMake 281s # cmake.py # CMake 281s # 281s # hybrid/ 281s # hybrid_cmake.dat # CMake 281s # hybrid_cmake.py # CMake 281s # hybrid_pure.dat # Setuptools 281s # hybrid_pure.py # Setuptools 281s # 281s # data/ 281s # hybrid_data_pure.dat # CMake or Setuptools 281s # hybrid_data_cmake.dat # CMake *NO TEST* 281s # 281s # hybrid_2/ 281s # __init__.py # CMake or Setuptools 281s # hybrid_2_pure.py # CMake or Setuptools 281s # hybrid_2_cmake.py # CMake 281s # 281s # hybrid_2_pure/ 281s # __init__.py # CMake or Setuptools 281s # hybrid_2_pure_1.py # CMake or Setuptools 281s # hybrid_2_pure_2.py # CMake or Setuptools 281s # 281s # pureModule.py # Setuptools 281s # 281s # pure/ 281s # __init__.py # Setuptools 281s # pure.py # Setuptools 281s # 281s # data/ 281s # pure.dat # Setuptools 281s 281s tmp_dir.join("setup.py").write( 281s textwrap.dedent( 281s """ 281s from skbuild import setup 281s #from setuptools import setup 281s setup( 281s name="test_hybrid_project", 281s version="1.2.3", 281s description=("an hybrid package mixing files installed by both " 281s "CMake and setuptools"), 281s author='The scikit-build team', 281s license="MIT", 281s cmake_source_dir='{cmake_source_dir}', 281s cmake_install_dir='{cmake_install_dir}', 281s # Arbitrary order of packages 281s packages=[ 281s {p_off} 'pure', 281s {h_off} 'hybrid.hybrid_2', 281s {h_off} 'hybrid', 281s {c_off} 'cmake', 281s {p_off} 'hybrid.hybrid_2_pure', 281s ], 281s py_modules=[ 281s {pm_off} '{package_base}pureModule', 281s {cm_off} '{package_base}cmakeModule', 281s ], 281s package_data={{ 281s {p_off} 'pure': ['data/pure.dat'], 281s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 281s }}, 281s # Arbitrary order of package_dir 281s package_dir = {{ 281s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 281s {p_off} 'pure': '{package_base}pure', 281s {h_off} 'hybrid': '{package_base}hybrid', 281s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 281s {c_off} 'cmake': '{package_base}cmake', 281s }} 281s ) 281s """.format( 281s cmake_source_dir=cmake_source_dir, 281s cmake_install_dir=package_base, 281s package_base=package_base_dir, 281s c_off="" if has_cmake_package else "#", 281s cm_off="" if has_cmake_module else "#", 281s h_off="" if has_hybrid_package else "#", 281s p_off="" if has_pure_package else "#", 281s pm_off="" if has_pure_module else "#", 281s ) 281s ) 281s ) 281s 281s src_dir = tmp_dir.ensure(package_base, dir=1) 281s 281s src_dir.join("CMakeLists.txt").write( 281s textwrap.dedent( 281s """ 281s cmake_minimum_required(VERSION 3.5.0) 281s project(hybrid NONE) 281s set(build_dir ${{CMAKE_BINARY_DIR}}) 281s 281s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 281s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 281s {c_off} install( 281s {c_off} FILES 281s {c_off} ${{build_dir}}/__init__.py 281s {c_off} ${{build_dir}}/cmake.py 281s {c_off} DESTINATION cmake 281s {c_off} ) 281s 281s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 281s {cm_off} install( 281s {cm_off} FILES ${{build_dir}}/cmakeModule.py 281s {cm_off} DESTINATION .) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 281s {h_off} DESTINATION hybrid) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 281s {h_off} DESTINATION hybrid) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 281s {h_off} DESTINATION hybrid/data) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 281s {h_off} DESTINATION hybrid/hybrid_2) 281s 281s install(CODE "message(STATUS \\\"Installation complete\\\")") 281s """.format( 281s c_off="" if has_cmake_package else "#", 281s cm_off="" if has_cmake_module else "#", 281s h_off="" if has_hybrid_package else "#", 281s ) 281s ) 281s ) 281s 281s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 281s path_types: Sequence[str] 281s try: 281s path_types = next( 281s iter( 281s zip( 281s *filter( 281s lambda i: i[1], 281s [ 281s ("c", has_cmake_package), 281s ("cm", has_cmake_module), 281s ("h", has_hybrid_package), 281s ("p", has_pure_package), 281s ("pm", has_pure_module), 281s ], 281s ) 281s ) 281s ) 281s ) 281s except StopIteration: 281s path_types = [] 281s 281s def select_paths(annotated_paths): 281s """Return a filtered list paths considering ``path_types``. 281s 281s `annotated_paths`` is list of tuple ``(type, path)`` where type 281s is either `c`, 'cm', `h`, `p` or 'pm'. 281s 281s """ 281s return filter(lambda i: i[0] in path_types, annotated_paths) 281s 281s # Commented paths are the one expected to be installed by CMake. For 281s # this reason, corresponding files should NOT be created in the source 281s # tree. 281s for _type, path in select_paths( 281s [ 281s # ('c', 'cmake/__init__.py'), 281s # ('c', 'cmake/cmake.py'), 281s # ('cm', 'cmakeModule.py'), 281s ("h", "hybrid/__init__.py"), 281s # ('h', 'hybrid/hybrid_cmake.dat'), 281s # ('h', 'hybrid/hybrid_cmake.py'), 281s ("h", "hybrid/hybrid_pure.dat"), 281s ("h", "hybrid/hybrid_pure.py"), 281s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 281s ("h", "hybrid/data/hybrid_data_pure.dat"), 281s ("h", "hybrid/hybrid_2/__init__.py"), 281s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 281s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 281s ("p", "hybrid/hybrid_2_pure/__init__.py"), 281s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 281s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 281s ("pm", "pureModule.py"), 281s ("p", "pure/__init__.py"), 281s ("p", "pure/pure.py"), 281s ("p", "pure/data/pure.dat"), 281s ] 281s ): 281s assert _type in {"p", "pm", "h"} 281s root = package_base if _type in {"p", "pm"} else cmake_source_dir 281s tmp_dir.ensure(os.path.join(root, path)) 281s 281s # Do not call the real setup function. Instead, replace it with 281s # a MagicMock allowing to check with which arguments it was invoked. 281s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 281s 281s # Convenience print function 281s def _pprint(desc, value=None): 281s print( 281s "-----------------\n" 281s f"{desc}:\n" 281s "\n" 281s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 281s ) 281s 281s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 281s 281s _pprint = ._pprint at 0x709a44384360> 281s _type = 'p' 281s cmake_source_dir = '' 281s has_cmake_module = 1 281s has_cmake_package = 1 281s has_hybrid_package = 1 281s has_pure_module = 0 281s has_pure_package = 1 281s mock_setup = 281s mocker = 281s package_base = '' 281s package_base_dir = '' 281s path = 'pure/data/pure.dat' 281s path_types = ('c', 'cm', 'h', 'p') 281s root = '' 281s select_paths = .select_paths at 0x709a443874c0> 281s src_dir = local('/tmp/pytest-of-ubuntu/pytest-97/test_setup_inputs0') 281s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-97/test_setup_inputs0') 281s with_package_base = 0 281s 281s tests/test_setup.py:849: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-97/test_setup_inputs0') 281s setup_args = ['build'], disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-97/test_setup_inputs0') 281s setup_args = ['build'] 281s 281s tests/__init__.py:218: AttributeError 281s ________________________ test_setup_inputs[0-1-0-0-0-0] ________________________ 281s 281s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 0 281s has_pure_package = 0, has_pure_module = 1, with_package_base = 0 281s mocker = 281s 281s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 281s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 281s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 281s @pytest.mark.parametrize("has_pure_package", [0, 1]) 281s @pytest.mark.parametrize("has_pure_module", [0, 1]) 281s @pytest.mark.parametrize("with_package_base", [0, 1]) 281s def test_setup_inputs( 281s has_cmake_package, 281s has_cmake_module, 281s has_hybrid_package, 281s has_pure_package, 281s has_pure_module, 281s with_package_base, 281s mocker, 281s ): 281s """This test that a project can have a package with some modules 281s installed using setup.py and some other modules installed using CMake. 281s """ 281s 281s tmp_dir = _tmpdir("test_setup_inputs") 281s 281s package_base = "to/the/base" if with_package_base else "" 281s package_base_dir = package_base + "/" if package_base else "" 281s cmake_source_dir = package_base 281s 281s if cmake_source_dir and (has_cmake_package or has_cmake_module): 281s pytest.skip( 281s "unsupported configuration: " 281s "python package fully generated by CMake does *NOT* work. " 281s "At least __init__.py should be in the project source tree" 281s ) 281s 281s # ------------------------------------------------------------------------- 281s # Here is the "SOURCE" tree layout: 281s # 281s # ROOT/ 281s # 281s # setup.py 281s # 281s # [/] 281s # 281s # pureModule.py 281s # 281s # pure/ 281s # __init__.py 281s # pure.py 281s # 281s # data/ 281s # pure.dat 281s # 281s # [/] 281s # 281s # hybrid/ 281s # CMakeLists.txt 281s # __init__.py 281s # hybrid_pure.dat 281s # hybrid_pure.py 281s # 281s # data/ 281s # hybrid_data_pure.dat 281s # 281s # hybrid_2/ 281s # __init__.py 281s # hybrid_2_pure.py 281s # 281s # hybrid_2_pure/ 281s # __init__.py 281s # hybrid_2_pure_1.py 281s # hybrid_2_pure_2.py 281s # 281s # 281s # ------------------------------------------------------------------------- 281s # and here is the "BINARY" distribution layout: 281s # 281s # The comment "CMake" or "Setuptools" indicates which tool is responsible 281s # for placing the file in the tree used to create the binary distribution. 281s # 281s # ROOT/ 281s # 281s # cmakeModule.py # CMake 281s # 281s # cmake/ 281s # __init__.py # CMake 281s # cmake.py # CMake 281s # 281s # hybrid/ 281s # hybrid_cmake.dat # CMake 281s # hybrid_cmake.py # CMake 281s # hybrid_pure.dat # Setuptools 281s # hybrid_pure.py # Setuptools 281s # 281s # data/ 281s # hybrid_data_pure.dat # CMake or Setuptools 281s # hybrid_data_cmake.dat # CMake *NO TEST* 281s # 281s # hybrid_2/ 281s # __init__.py # CMake or Setuptools 281s # hybrid_2_pure.py # CMake or Setuptools 281s # hybrid_2_cmake.py # CMake 281s # 281s # hybrid_2_pure/ 281s # __init__.py # CMake or Setuptools 281s # hybrid_2_pure_1.py # CMake or Setuptools 281s # hybrid_2_pure_2.py # CMake or Setuptools 281s # 281s # pureModule.py # Setuptools 281s # 281s # pure/ 281s # __init__.py # Setuptools 281s # pure.py # Setuptools 281s # 281s # data/ 281s # pure.dat # Setuptools 281s 281s tmp_dir.join("setup.py").write( 281s textwrap.dedent( 281s """ 281s from skbuild import setup 281s #from setuptools import setup 281s setup( 281s name="test_hybrid_project", 281s version="1.2.3", 281s description=("an hybrid package mixing files installed by both " 281s "CMake and setuptools"), 281s author='The scikit-build team', 281s license="MIT", 281s cmake_source_dir='{cmake_source_dir}', 281s cmake_install_dir='{cmake_install_dir}', 281s # Arbitrary order of packages 281s packages=[ 281s {p_off} 'pure', 281s {h_off} 'hybrid.hybrid_2', 281s {h_off} 'hybrid', 281s {c_off} 'cmake', 281s {p_off} 'hybrid.hybrid_2_pure', 281s ], 281s py_modules=[ 281s {pm_off} '{package_base}pureModule', 281s {cm_off} '{package_base}cmakeModule', 281s ], 281s package_data={{ 281s {p_off} 'pure': ['data/pure.dat'], 281s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 281s }}, 281s # Arbitrary order of package_dir 281s package_dir = {{ 281s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 281s {p_off} 'pure': '{package_base}pure', 281s {h_off} 'hybrid': '{package_base}hybrid', 281s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 281s {c_off} 'cmake': '{package_base}cmake', 281s }} 281s ) 281s """.format( 281s cmake_source_dir=cmake_source_dir, 281s cmake_install_dir=package_base, 281s package_base=package_base_dir, 281s c_off="" if has_cmake_package else "#", 281s cm_off="" if has_cmake_module else "#", 281s h_off="" if has_hybrid_package else "#", 281s p_off="" if has_pure_package else "#", 281s pm_off="" if has_pure_module else "#", 281s ) 281s ) 281s ) 281s 281s src_dir = tmp_dir.ensure(package_base, dir=1) 281s 281s src_dir.join("CMakeLists.txt").write( 281s textwrap.dedent( 281s """ 281s cmake_minimum_required(VERSION 3.5.0) 281s project(hybrid NONE) 281s set(build_dir ${{CMAKE_BINARY_DIR}}) 281s 281s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 281s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 281s {c_off} install( 281s {c_off} FILES 281s {c_off} ${{build_dir}}/__init__.py 281s {c_off} ${{build_dir}}/cmake.py 281s {c_off} DESTINATION cmake 281s {c_off} ) 281s 281s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 281s {cm_off} install( 281s {cm_off} FILES ${{build_dir}}/cmakeModule.py 281s {cm_off} DESTINATION .) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 281s {h_off} DESTINATION hybrid) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 281s {h_off} DESTINATION hybrid) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 281s {h_off} DESTINATION hybrid/data) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 281s {h_off} DESTINATION hybrid/hybrid_2) 281s 281s install(CODE "message(STATUS \\\"Installation complete\\\")") 281s """.format( 281s c_off="" if has_cmake_package else "#", 281s cm_off="" if has_cmake_module else "#", 281s h_off="" if has_hybrid_package else "#", 281s ) 281s ) 281s ) 281s 281s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 281s path_types: Sequence[str] 281s try: 281s path_types = next( 281s iter( 281s zip( 281s *filter( 281s lambda i: i[1], 281s [ 281s ("c", has_cmake_package), 281s ("cm", has_cmake_module), 281s ("h", has_hybrid_package), 281s ("p", has_pure_package), 281s ("pm", has_pure_module), 281s ], 281s ) 281s ) 281s ) 281s ) 281s except StopIteration: 281s path_types = [] 281s 281s def select_paths(annotated_paths): 281s """Return a filtered list paths considering ``path_types``. 281s 281s `annotated_paths`` is list of tuple ``(type, path)`` where type 281s is either `c`, 'cm', `h`, `p` or 'pm'. 281s 281s """ 281s return filter(lambda i: i[0] in path_types, annotated_paths) 281s 281s # Commented paths are the one expected to be installed by CMake. For 281s # this reason, corresponding files should NOT be created in the source 281s # tree. 281s for _type, path in select_paths( 281s [ 281s # ('c', 'cmake/__init__.py'), 281s # ('c', 'cmake/cmake.py'), 281s # ('cm', 'cmakeModule.py'), 281s ("h", "hybrid/__init__.py"), 281s # ('h', 'hybrid/hybrid_cmake.dat'), 281s # ('h', 'hybrid/hybrid_cmake.py'), 281s ("h", "hybrid/hybrid_pure.dat"), 281s ("h", "hybrid/hybrid_pure.py"), 281s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 281s ("h", "hybrid/data/hybrid_data_pure.dat"), 281s ("h", "hybrid/hybrid_2/__init__.py"), 281s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 281s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 281s ("p", "hybrid/hybrid_2_pure/__init__.py"), 281s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 281s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 281s ("pm", "pureModule.py"), 281s ("p", "pure/__init__.py"), 281s ("p", "pure/pure.py"), 281s ("p", "pure/data/pure.dat"), 281s ] 281s ): 281s assert _type in {"p", "pm", "h"} 281s root = package_base if _type in {"p", "pm"} else cmake_source_dir 281s tmp_dir.ensure(os.path.join(root, path)) 281s 281s # Do not call the real setup function. Instead, replace it with 281s # a MagicMock allowing to check with which arguments it was invoked. 281s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 281s 281s # Convenience print function 281s def _pprint(desc, value=None): 281s print( 281s "-----------------\n" 281s f"{desc}:\n" 281s "\n" 281s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 281s ) 281s 281s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 281s 281s _pprint = ._pprint at 0x709a44386de0> 281s _type = 'pm' 281s cmake_source_dir = '' 281s has_cmake_module = 0 281s has_cmake_package = 0 281s has_hybrid_package = 0 281s has_pure_module = 1 281s has_pure_package = 0 281s mock_setup = 281s mocker = 281s package_base = '' 281s package_base_dir = '' 281s path = 'pureModule.py' 281s path_types = ('pm',) 281s root = '' 281s select_paths = .select_paths at 0x709a443868e0> 281s src_dir = local('/tmp/pytest-of-ubuntu/pytest-98/test_setup_inputs0') 281s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-98/test_setup_inputs0') 281s with_package_base = 0 281s 281s tests/test_setup.py:849: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-98/test_setup_inputs0') 281s setup_args = ['build'], disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-98/test_setup_inputs0') 281s setup_args = ['build'] 281s 281s tests/__init__.py:218: AttributeError 281s ________________________ test_setup_inputs[0-1-0-0-0-1] ________________________ 281s 281s has_cmake_package = 1, has_cmake_module = 0, has_hybrid_package = 0 281s has_pure_package = 0, has_pure_module = 1, with_package_base = 0 281s mocker = 281s 281s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 281s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 281s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 281s @pytest.mark.parametrize("has_pure_package", [0, 1]) 281s @pytest.mark.parametrize("has_pure_module", [0, 1]) 281s @pytest.mark.parametrize("with_package_base", [0, 1]) 281s def test_setup_inputs( 281s has_cmake_package, 281s has_cmake_module, 281s has_hybrid_package, 281s has_pure_package, 281s has_pure_module, 281s with_package_base, 281s mocker, 281s ): 281s """This test that a project can have a package with some modules 281s installed using setup.py and some other modules installed using CMake. 281s """ 281s 281s tmp_dir = _tmpdir("test_setup_inputs") 281s 281s package_base = "to/the/base" if with_package_base else "" 281s package_base_dir = package_base + "/" if package_base else "" 281s cmake_source_dir = package_base 281s 281s if cmake_source_dir and (has_cmake_package or has_cmake_module): 281s pytest.skip( 281s "unsupported configuration: " 281s "python package fully generated by CMake does *NOT* work. " 281s "At least __init__.py should be in the project source tree" 281s ) 281s 281s # ------------------------------------------------------------------------- 281s # Here is the "SOURCE" tree layout: 281s # 281s # ROOT/ 281s # 281s # setup.py 281s # 281s # [/] 281s # 281s # pureModule.py 281s # 281s # pure/ 281s # __init__.py 281s # pure.py 281s # 281s # data/ 281s # pure.dat 281s # 281s # [/] 281s # 281s # hybrid/ 281s # CMakeLists.txt 281s # __init__.py 281s # hybrid_pure.dat 281s # hybrid_pure.py 281s # 281s # data/ 281s # hybrid_data_pure.dat 281s # 281s # hybrid_2/ 281s # __init__.py 281s # hybrid_2_pure.py 281s # 281s # hybrid_2_pure/ 281s # __init__.py 281s # hybrid_2_pure_1.py 281s # hybrid_2_pure_2.py 281s # 281s # 281s # ------------------------------------------------------------------------- 281s # and here is the "BINARY" distribution layout: 281s # 281s # The comment "CMake" or "Setuptools" indicates which tool is responsible 281s # for placing the file in the tree used to create the binary distribution. 281s # 281s # ROOT/ 281s # 281s # cmakeModule.py # CMake 281s # 281s # cmake/ 281s # __init__.py # CMake 281s # cmake.py # CMake 281s # 281s # hybrid/ 281s # hybrid_cmake.dat # CMake 281s # hybrid_cmake.py # CMake 281s # hybrid_pure.dat # Setuptools 281s # hybrid_pure.py # Setuptools 281s # 281s # data/ 281s # hybrid_data_pure.dat # CMake or Setuptools 281s # hybrid_data_cmake.dat # CMake *NO TEST* 281s # 281s # hybrid_2/ 281s # __init__.py # CMake or Setuptools 281s # hybrid_2_pure.py # CMake or Setuptools 281s # hybrid_2_cmake.py # CMake 281s # 281s # hybrid_2_pure/ 281s # __init__.py # CMake or Setuptools 281s # hybrid_2_pure_1.py # CMake or Setuptools 281s # hybrid_2_pure_2.py # CMake or Setuptools 281s # 281s # pureModule.py # Setuptools 281s # 281s # pure/ 281s # __init__.py # Setuptools 281s # pure.py # Setuptools 281s # 281s # data/ 281s # pure.dat # Setuptools 281s 281s tmp_dir.join("setup.py").write( 281s textwrap.dedent( 281s """ 281s from skbuild import setup 281s #from setuptools import setup 281s setup( 281s name="test_hybrid_project", 281s version="1.2.3", 281s description=("an hybrid package mixing files installed by both " 281s "CMake and setuptools"), 281s author='The scikit-build team', 281s license="MIT", 281s cmake_source_dir='{cmake_source_dir}', 281s cmake_install_dir='{cmake_install_dir}', 281s # Arbitrary order of packages 281s packages=[ 281s {p_off} 'pure', 281s {h_off} 'hybrid.hybrid_2', 281s {h_off} 'hybrid', 281s {c_off} 'cmake', 281s {p_off} 'hybrid.hybrid_2_pure', 281s ], 281s py_modules=[ 281s {pm_off} '{package_base}pureModule', 281s {cm_off} '{package_base}cmakeModule', 281s ], 281s package_data={{ 281s {p_off} 'pure': ['data/pure.dat'], 281s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 281s }}, 281s # Arbitrary order of package_dir 281s package_dir = {{ 281s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 281s {p_off} 'pure': '{package_base}pure', 281s {h_off} 'hybrid': '{package_base}hybrid', 281s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 281s {c_off} 'cmake': '{package_base}cmake', 281s }} 281s ) 281s """.format( 281s cmake_source_dir=cmake_source_dir, 281s cmake_install_dir=package_base, 281s package_base=package_base_dir, 281s c_off="" if has_cmake_package else "#", 281s cm_off="" if has_cmake_module else "#", 281s h_off="" if has_hybrid_package else "#", 281s p_off="" if has_pure_package else "#", 281s pm_off="" if has_pure_module else "#", 281s ) 281s ) 281s ) 281s 281s src_dir = tmp_dir.ensure(package_base, dir=1) 281s 281s src_dir.join("CMakeLists.txt").write( 281s textwrap.dedent( 281s """ 281s cmake_minimum_required(VERSION 3.5.0) 281s project(hybrid NONE) 281s set(build_dir ${{CMAKE_BINARY_DIR}}) 281s 281s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 281s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 281s {c_off} install( 281s {c_off} FILES 281s {c_off} ${{build_dir}}/__init__.py 281s {c_off} ${{build_dir}}/cmake.py 281s {c_off} DESTINATION cmake 281s {c_off} ) 281s 281s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 281s {cm_off} install( 281s {cm_off} FILES ${{build_dir}}/cmakeModule.py 281s {cm_off} DESTINATION .) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 281s {h_off} DESTINATION hybrid) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 281s {h_off} DESTINATION hybrid) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 281s {h_off} DESTINATION hybrid/data) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 281s {h_off} DESTINATION hybrid/hybrid_2) 281s 281s install(CODE "message(STATUS \\\"Installation complete\\\")") 281s """.format( 281s c_off="" if has_cmake_package else "#", 281s cm_off="" if has_cmake_module else "#", 281s h_off="" if has_hybrid_package else "#", 281s ) 281s ) 281s ) 281s 281s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 281s path_types: Sequence[str] 281s try: 281s path_types = next( 281s iter( 281s zip( 281s *filter( 281s lambda i: i[1], 281s [ 281s ("c", has_cmake_package), 281s ("cm", has_cmake_module), 281s ("h", has_hybrid_package), 281s ("p", has_pure_package), 281s ("pm", has_pure_module), 281s ], 281s ) 281s ) 281s ) 281s ) 281s except StopIteration: 281s path_types = [] 281s 281s def select_paths(annotated_paths): 281s """Return a filtered list paths considering ``path_types``. 281s 281s `annotated_paths`` is list of tuple ``(type, path)`` where type 281s is either `c`, 'cm', `h`, `p` or 'pm'. 281s 281s """ 281s return filter(lambda i: i[0] in path_types, annotated_paths) 281s 281s # Commented paths are the one expected to be installed by CMake. For 281s # this reason, corresponding files should NOT be created in the source 281s # tree. 281s for _type, path in select_paths( 281s [ 281s # ('c', 'cmake/__init__.py'), 281s # ('c', 'cmake/cmake.py'), 281s # ('cm', 'cmakeModule.py'), 281s ("h", "hybrid/__init__.py"), 281s # ('h', 'hybrid/hybrid_cmake.dat'), 281s # ('h', 'hybrid/hybrid_cmake.py'), 281s ("h", "hybrid/hybrid_pure.dat"), 281s ("h", "hybrid/hybrid_pure.py"), 281s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 281s ("h", "hybrid/data/hybrid_data_pure.dat"), 281s ("h", "hybrid/hybrid_2/__init__.py"), 281s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 281s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 281s ("p", "hybrid/hybrid_2_pure/__init__.py"), 281s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 281s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 281s ("pm", "pureModule.py"), 281s ("p", "pure/__init__.py"), 281s ("p", "pure/pure.py"), 281s ("p", "pure/data/pure.dat"), 281s ] 281s ): 281s assert _type in {"p", "pm", "h"} 281s root = package_base if _type in {"p", "pm"} else cmake_source_dir 281s tmp_dir.ensure(os.path.join(root, path)) 281s 281s # Do not call the real setup function. Instead, replace it with 281s # a MagicMock allowing to check with which arguments it was invoked. 281s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 281s 281s # Convenience print function 281s def _pprint(desc, value=None): 281s print( 281s "-----------------\n" 281s f"{desc}:\n" 281s "\n" 281s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 281s ) 281s 281s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 281s 281s _pprint = ._pprint at 0x709a44387240> 281s _type = 'pm' 281s cmake_source_dir = '' 281s has_cmake_module = 0 281s has_cmake_package = 1 281s has_hybrid_package = 0 281s has_pure_module = 1 281s has_pure_package = 0 281s mock_setup = 281s mocker = 281s package_base = '' 281s package_base_dir = '' 281s path = 'pureModule.py' 281s path_types = ('c', 'pm') 281s root = '' 281s select_paths = .select_paths at 0x709a44481e40> 281s src_dir = local('/tmp/pytest-of-ubuntu/pytest-99/test_setup_inputs0') 281s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-99/test_setup_inputs0') 281s with_package_base = 0 281s 281s tests/test_setup.py:849: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-99/test_setup_inputs0') 281s setup_args = ['build'], disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-99/test_setup_inputs0') 281s setup_args = ['build'] 281s 281s tests/__init__.py:218: AttributeError 281s ________________________ test_setup_inputs[0-1-0-0-1-0] ________________________ 281s 281s has_cmake_package = 0, has_cmake_module = 1, has_hybrid_package = 0 281s has_pure_package = 0, has_pure_module = 1, with_package_base = 0 281s mocker = 281s 281s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 281s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 281s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 281s @pytest.mark.parametrize("has_pure_package", [0, 1]) 281s @pytest.mark.parametrize("has_pure_module", [0, 1]) 281s @pytest.mark.parametrize("with_package_base", [0, 1]) 281s def test_setup_inputs( 281s has_cmake_package, 281s has_cmake_module, 281s has_hybrid_package, 281s has_pure_package, 281s has_pure_module, 281s with_package_base, 281s mocker, 281s ): 281s """This test that a project can have a package with some modules 281s installed using setup.py and some other modules installed using CMake. 281s """ 281s 281s tmp_dir = _tmpdir("test_setup_inputs") 281s 281s package_base = "to/the/base" if with_package_base else "" 281s package_base_dir = package_base + "/" if package_base else "" 281s cmake_source_dir = package_base 281s 281s if cmake_source_dir and (has_cmake_package or has_cmake_module): 281s pytest.skip( 281s "unsupported configuration: " 281s "python package fully generated by CMake does *NOT* work. " 281s "At least __init__.py should be in the project source tree" 281s ) 281s 281s # ------------------------------------------------------------------------- 281s # Here is the "SOURCE" tree layout: 281s # 281s # ROOT/ 281s # 281s # setup.py 281s # 281s # [/] 281s # 281s # pureModule.py 281s # 281s # pure/ 281s # __init__.py 281s # pure.py 281s # 281s # data/ 281s # pure.dat 281s # 281s # [/] 281s # 281s # hybrid/ 281s # CMakeLists.txt 281s # __init__.py 281s # hybrid_pure.dat 281s # hybrid_pure.py 281s # 281s # data/ 281s # hybrid_data_pure.dat 281s # 281s # hybrid_2/ 281s # __init__.py 281s # hybrid_2_pure.py 281s # 281s # hybrid_2_pure/ 281s # __init__.py 281s # hybrid_2_pure_1.py 281s # hybrid_2_pure_2.py 281s # 281s # 281s # ------------------------------------------------------------------------- 281s # and here is the "BINARY" distribution layout: 281s # 281s # The comment "CMake" or "Setuptools" indicates which tool is responsible 281s # for placing the file in the tree used to create the binary distribution. 281s # 281s # ROOT/ 281s # 281s # cmakeModule.py # CMake 281s # 281s # cmake/ 281s # __init__.py # CMake 281s # cmake.py # CMake 281s # 281s # hybrid/ 281s # hybrid_cmake.dat # CMake 281s # hybrid_cmake.py # CMake 281s # hybrid_pure.dat # Setuptools 281s # hybrid_pure.py # Setuptools 281s # 281s # data/ 281s # hybrid_data_pure.dat # CMake or Setuptools 281s # hybrid_data_cmake.dat # CMake *NO TEST* 281s # 281s # hybrid_2/ 281s # __init__.py # CMake or Setuptools 281s # hybrid_2_pure.py # CMake or Setuptools 281s # hybrid_2_cmake.py # CMake 281s # 281s # hybrid_2_pure/ 281s # __init__.py # CMake or Setuptools 281s # hybrid_2_pure_1.py # CMake or Setuptools 281s # hybrid_2_pure_2.py # CMake or Setuptools 281s # 281s # pureModule.py # Setuptools 281s # 281s # pure/ 281s # __init__.py # Setuptools 281s # pure.py # Setuptools 281s # 281s # data/ 281s # pure.dat # Setuptools 281s 281s tmp_dir.join("setup.py").write( 281s textwrap.dedent( 281s """ 281s from skbuild import setup 281s #from setuptools import setup 281s setup( 281s name="test_hybrid_project", 281s version="1.2.3", 281s description=("an hybrid package mixing files installed by both " 281s "CMake and setuptools"), 281s author='The scikit-build team', 281s license="MIT", 281s cmake_source_dir='{cmake_source_dir}', 281s cmake_install_dir='{cmake_install_dir}', 281s # Arbitrary order of packages 281s packages=[ 281s {p_off} 'pure', 281s {h_off} 'hybrid.hybrid_2', 281s {h_off} 'hybrid', 281s {c_off} 'cmake', 281s {p_off} 'hybrid.hybrid_2_pure', 281s ], 281s py_modules=[ 281s {pm_off} '{package_base}pureModule', 281s {cm_off} '{package_base}cmakeModule', 281s ], 281s package_data={{ 281s {p_off} 'pure': ['data/pure.dat'], 281s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 281s }}, 281s # Arbitrary order of package_dir 281s package_dir = {{ 281s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 281s {p_off} 'pure': '{package_base}pure', 281s {h_off} 'hybrid': '{package_base}hybrid', 281s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 281s {c_off} 'cmake': '{package_base}cmake', 281s }} 281s ) 281s """.format( 281s cmake_source_dir=cmake_source_dir, 281s cmake_install_dir=package_base, 281s package_base=package_base_dir, 281s c_off="" if has_cmake_package else "#", 281s cm_off="" if has_cmake_module else "#", 281s h_off="" if has_hybrid_package else "#", 281s p_off="" if has_pure_package else "#", 281s pm_off="" if has_pure_module else "#", 281s ) 281s ) 281s ) 281s 281s src_dir = tmp_dir.ensure(package_base, dir=1) 281s 281s src_dir.join("CMakeLists.txt").write( 281s textwrap.dedent( 281s """ 281s cmake_minimum_required(VERSION 3.5.0) 281s project(hybrid NONE) 281s set(build_dir ${{CMAKE_BINARY_DIR}}) 281s 281s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 281s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 281s {c_off} install( 281s {c_off} FILES 281s {c_off} ${{build_dir}}/__init__.py 281s {c_off} ${{build_dir}}/cmake.py 281s {c_off} DESTINATION cmake 281s {c_off} ) 281s 281s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 281s {cm_off} install( 281s {cm_off} FILES ${{build_dir}}/cmakeModule.py 281s {cm_off} DESTINATION .) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 281s {h_off} DESTINATION hybrid) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 281s {h_off} DESTINATION hybrid) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 281s {h_off} DESTINATION hybrid/data) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 281s {h_off} DESTINATION hybrid/hybrid_2) 281s 281s install(CODE "message(STATUS \\\"Installation complete\\\")") 281s """.format( 281s c_off="" if has_cmake_package else "#", 281s cm_off="" if has_cmake_module else "#", 281s h_off="" if has_hybrid_package else "#", 281s ) 281s ) 281s ) 281s 281s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 281s path_types: Sequence[str] 281s try: 281s path_types = next( 281s iter( 281s zip( 281s *filter( 281s lambda i: i[1], 281s [ 281s ("c", has_cmake_package), 281s ("cm", has_cmake_module), 281s ("h", has_hybrid_package), 281s ("p", has_pure_package), 281s ("pm", has_pure_module), 281s ], 281s ) 281s ) 281s ) 281s ) 281s except StopIteration: 281s path_types = [] 281s 281s def select_paths(annotated_paths): 281s """Return a filtered list paths considering ``path_types``. 281s 281s `annotated_paths`` is list of tuple ``(type, path)`` where type 281s is either `c`, 'cm', `h`, `p` or 'pm'. 281s 281s """ 281s return filter(lambda i: i[0] in path_types, annotated_paths) 281s 281s # Commented paths are the one expected to be installed by CMake. For 281s # this reason, corresponding files should NOT be created in the source 281s # tree. 281s for _type, path in select_paths( 281s [ 281s # ('c', 'cmake/__init__.py'), 281s # ('c', 'cmake/cmake.py'), 281s # ('cm', 'cmakeModule.py'), 281s ("h", "hybrid/__init__.py"), 281s # ('h', 'hybrid/hybrid_cmake.dat'), 281s # ('h', 'hybrid/hybrid_cmake.py'), 281s ("h", "hybrid/hybrid_pure.dat"), 281s ("h", "hybrid/hybrid_pure.py"), 281s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 281s ("h", "hybrid/data/hybrid_data_pure.dat"), 281s ("h", "hybrid/hybrid_2/__init__.py"), 281s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 281s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 281s ("p", "hybrid/hybrid_2_pure/__init__.py"), 281s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 281s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 281s ("pm", "pureModule.py"), 281s ("p", "pure/__init__.py"), 281s ("p", "pure/pure.py"), 281s ("p", "pure/data/pure.dat"), 281s ] 281s ): 281s assert _type in {"p", "pm", "h"} 281s root = package_base if _type in {"p", "pm"} else cmake_source_dir 281s tmp_dir.ensure(os.path.join(root, path)) 281s 281s # Do not call the real setup function. Instead, replace it with 281s # a MagicMock allowing to check with which arguments it was invoked. 281s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 281s 281s # Convenience print function 281s def _pprint(desc, value=None): 281s print( 281s "-----------------\n" 281s f"{desc}:\n" 281s "\n" 281s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 281s ) 281s 281s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 281s 281s _pprint = ._pprint at 0x709a44387ce0> 281s _type = 'pm' 281s cmake_source_dir = '' 281s has_cmake_module = 1 281s has_cmake_package = 0 281s has_hybrid_package = 0 281s has_pure_module = 1 281s has_pure_package = 0 281s mock_setup = 281s mocker = 281s package_base = '' 281s package_base_dir = '' 281s path = 'pureModule.py' 281s path_types = ('cm', 'pm') 281s root = '' 281s select_paths = .select_paths at 0x709a44387a60> 281s src_dir = local('/tmp/pytest-of-ubuntu/pytest-100/test_setup_inputs0') 281s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-100/test_setup_inputs0') 281s with_package_base = 0 281s 281s tests/test_setup.py:849: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-100/test_setup_inputs0') 281s setup_args = ['build'], disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-100/test_setup_inputs0') 281s setup_args = ['build'] 281s 281s tests/__init__.py:218: AttributeError 281s ________________________ test_setup_inputs[0-1-0-0-1-1] ________________________ 281s 281s has_cmake_package = 1, has_cmake_module = 1, has_hybrid_package = 0 281s has_pure_package = 0, has_pure_module = 1, with_package_base = 0 281s mocker = 281s 281s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 281s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 281s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 281s @pytest.mark.parametrize("has_pure_package", [0, 1]) 281s @pytest.mark.parametrize("has_pure_module", [0, 1]) 281s @pytest.mark.parametrize("with_package_base", [0, 1]) 281s def test_setup_inputs( 281s has_cmake_package, 281s has_cmake_module, 281s has_hybrid_package, 281s has_pure_package, 281s has_pure_module, 281s with_package_base, 281s mocker, 281s ): 281s """This test that a project can have a package with some modules 281s installed using setup.py and some other modules installed using CMake. 281s """ 281s 281s tmp_dir = _tmpdir("test_setup_inputs") 281s 281s package_base = "to/the/base" if with_package_base else "" 281s package_base_dir = package_base + "/" if package_base else "" 281s cmake_source_dir = package_base 281s 281s if cmake_source_dir and (has_cmake_package or has_cmake_module): 281s pytest.skip( 281s "unsupported configuration: " 281s "python package fully generated by CMake does *NOT* work. " 281s "At least __init__.py should be in the project source tree" 281s ) 281s 281s # ------------------------------------------------------------------------- 281s # Here is the "SOURCE" tree layout: 281s # 281s # ROOT/ 281s # 281s # setup.py 281s # 281s # [/] 281s # 281s # pureModule.py 281s # 281s # pure/ 281s # __init__.py 281s # pure.py 281s # 281s # data/ 281s # pure.dat 281s # 281s # [/] 281s # 281s # hybrid/ 281s # CMakeLists.txt 281s # __init__.py 281s # hybrid_pure.dat 281s # hybrid_pure.py 281s # 281s # data/ 281s # hybrid_data_pure.dat 281s # 281s # hybrid_2/ 281s # __init__.py 281s # hybrid_2_pure.py 281s # 281s # hybrid_2_pure/ 281s # __init__.py 281s # hybrid_2_pure_1.py 281s # hybrid_2_pure_2.py 281s # 281s # 281s # ------------------------------------------------------------------------- 281s # and here is the "BINARY" distribution layout: 281s # 281s # The comment "CMake" or "Setuptools" indicates which tool is responsible 281s # for placing the file in the tree used to create the binary distribution. 281s # 281s # ROOT/ 281s # 281s # cmakeModule.py # CMake 281s # 281s # cmake/ 281s # __init__.py # CMake 281s # cmake.py # CMake 281s # 281s # hybrid/ 281s # hybrid_cmake.dat # CMake 281s # hybrid_cmake.py # CMake 281s # hybrid_pure.dat # Setuptools 281s # hybrid_pure.py # Setuptools 281s # 281s # data/ 281s # hybrid_data_pure.dat # CMake or Setuptools 281s # hybrid_data_cmake.dat # CMake *NO TEST* 281s # 281s # hybrid_2/ 281s # __init__.py # CMake or Setuptools 281s # hybrid_2_pure.py # CMake or Setuptools 281s # hybrid_2_cmake.py # CMake 281s # 281s # hybrid_2_pure/ 281s # __init__.py # CMake or Setuptools 281s # hybrid_2_pure_1.py # CMake or Setuptools 281s # hybrid_2_pure_2.py # CMake or Setuptools 281s # 281s # pureModule.py # Setuptools 281s # 281s # pure/ 281s # __init__.py # Setuptools 281s # pure.py # Setuptools 281s # 281s # data/ 281s # pure.dat # Setuptools 281s 281s tmp_dir.join("setup.py").write( 281s textwrap.dedent( 281s """ 281s from skbuild import setup 281s #from setuptools import setup 281s setup( 281s name="test_hybrid_project", 281s version="1.2.3", 281s description=("an hybrid package mixing files installed by both " 281s "CMake and setuptools"), 281s author='The scikit-build team', 281s license="MIT", 281s cmake_source_dir='{cmake_source_dir}', 281s cmake_install_dir='{cmake_install_dir}', 281s # Arbitrary order of packages 281s packages=[ 281s {p_off} 'pure', 281s {h_off} 'hybrid.hybrid_2', 281s {h_off} 'hybrid', 281s {c_off} 'cmake', 281s {p_off} 'hybrid.hybrid_2_pure', 281s ], 281s py_modules=[ 281s {pm_off} '{package_base}pureModule', 281s {cm_off} '{package_base}cmakeModule', 281s ], 281s package_data={{ 281s {p_off} 'pure': ['data/pure.dat'], 281s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 281s }}, 281s # Arbitrary order of package_dir 281s package_dir = {{ 281s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 281s {p_off} 'pure': '{package_base}pure', 281s {h_off} 'hybrid': '{package_base}hybrid', 281s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 281s {c_off} 'cmake': '{package_base}cmake', 281s }} 281s ) 281s """.format( 281s cmake_source_dir=cmake_source_dir, 281s cmake_install_dir=package_base, 281s package_base=package_base_dir, 281s c_off="" if has_cmake_package else "#", 281s cm_off="" if has_cmake_module else "#", 281s h_off="" if has_hybrid_package else "#", 281s p_off="" if has_pure_package else "#", 281s pm_off="" if has_pure_module else "#", 281s ) 281s ) 281s ) 281s 281s src_dir = tmp_dir.ensure(package_base, dir=1) 281s 281s src_dir.join("CMakeLists.txt").write( 281s textwrap.dedent( 281s """ 281s cmake_minimum_required(VERSION 3.5.0) 281s project(hybrid NONE) 281s set(build_dir ${{CMAKE_BINARY_DIR}}) 281s 281s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 281s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 281s {c_off} install( 281s {c_off} FILES 281s {c_off} ${{build_dir}}/__init__.py 281s {c_off} ${{build_dir}}/cmake.py 281s {c_off} DESTINATION cmake 281s {c_off} ) 281s 281s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 281s {cm_off} install( 281s {cm_off} FILES ${{build_dir}}/cmakeModule.py 281s {cm_off} DESTINATION .) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 281s {h_off} DESTINATION hybrid) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 281s {h_off} DESTINATION hybrid) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 281s {h_off} DESTINATION hybrid/data) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 281s {h_off} DESTINATION hybrid/hybrid_2) 281s 281s install(CODE "message(STATUS \\\"Installation complete\\\")") 281s """.format( 281s c_off="" if has_cmake_package else "#", 281s cm_off="" if has_cmake_module else "#", 281s h_off="" if has_hybrid_package else "#", 281s ) 281s ) 281s ) 281s 281s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 281s path_types: Sequence[str] 281s try: 281s path_types = next( 281s iter( 281s zip( 281s *filter( 281s lambda i: i[1], 281s [ 281s ("c", has_cmake_package), 281s ("cm", has_cmake_module), 281s ("h", has_hybrid_package), 281s ("p", has_pure_package), 281s ("pm", has_pure_module), 281s ], 281s ) 281s ) 281s ) 281s ) 281s except StopIteration: 281s path_types = [] 281s 281s def select_paths(annotated_paths): 281s """Return a filtered list paths considering ``path_types``. 281s 281s `annotated_paths`` is list of tuple ``(type, path)`` where type 281s is either `c`, 'cm', `h`, `p` or 'pm'. 281s 281s """ 281s return filter(lambda i: i[0] in path_types, annotated_paths) 281s 281s # Commented paths are the one expected to be installed by CMake. For 281s # this reason, corresponding files should NOT be created in the source 281s # tree. 281s for _type, path in select_paths( 281s [ 281s # ('c', 'cmake/__init__.py'), 281s # ('c', 'cmake/cmake.py'), 281s # ('cm', 'cmakeModule.py'), 281s ("h", "hybrid/__init__.py"), 281s # ('h', 'hybrid/hybrid_cmake.dat'), 281s # ('h', 'hybrid/hybrid_cmake.py'), 281s ("h", "hybrid/hybrid_pure.dat"), 281s ("h", "hybrid/hybrid_pure.py"), 281s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 281s ("h", "hybrid/data/hybrid_data_pure.dat"), 281s ("h", "hybrid/hybrid_2/__init__.py"), 281s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 281s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 281s ("p", "hybrid/hybrid_2_pure/__init__.py"), 281s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 281s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 281s ("pm", "pureModule.py"), 281s ("p", "pure/__init__.py"), 281s ("p", "pure/pure.py"), 281s ("p", "pure/data/pure.dat"), 281s ] 281s ): 281s assert _type in {"p", "pm", "h"} 281s root = package_base if _type in {"p", "pm"} else cmake_source_dir 281s tmp_dir.ensure(os.path.join(root, path)) 281s 281s # Do not call the real setup function. Instead, replace it with 281s # a MagicMock allowing to check with which arguments it was invoked. 281s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 281s 281s # Convenience print function 281s def _pprint(desc, value=None): 281s print( 281s "-----------------\n" 281s f"{desc}:\n" 281s "\n" 281s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 281s ) 281s 281s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 281s 281s _pprint = ._pprint at 0x709a443877e0> 281s _type = 'pm' 281s cmake_source_dir = '' 281s has_cmake_module = 1 281s has_cmake_package = 1 281s has_hybrid_package = 0 281s has_pure_module = 1 281s has_pure_package = 0 281s mock_setup = 281s mocker = 281s package_base = '' 281s package_base_dir = '' 281s path = 'pureModule.py' 281s path_types = ('c', 'cm', 'pm') 281s root = '' 281s select_paths = .select_paths at 0x709a44386520> 281s src_dir = local('/tmp/pytest-of-ubuntu/pytest-101/test_setup_inputs0') 281s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-101/test_setup_inputs0') 281s with_package_base = 0 281s 281s tests/test_setup.py:849: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-101/test_setup_inputs0') 281s setup_args = ['build'], disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-101/test_setup_inputs0') 281s setup_args = ['build'] 281s 281s tests/__init__.py:218: AttributeError 281s ________________________ test_setup_inputs[0-1-0-1-0-0] ________________________ 281s 281s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 1 281s has_pure_package = 0, has_pure_module = 1, with_package_base = 0 281s mocker = 281s 281s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 281s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 281s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 281s @pytest.mark.parametrize("has_pure_package", [0, 1]) 281s @pytest.mark.parametrize("has_pure_module", [0, 1]) 281s @pytest.mark.parametrize("with_package_base", [0, 1]) 281s def test_setup_inputs( 281s has_cmake_package, 281s has_cmake_module, 281s has_hybrid_package, 281s has_pure_package, 281s has_pure_module, 281s with_package_base, 281s mocker, 281s ): 281s """This test that a project can have a package with some modules 281s installed using setup.py and some other modules installed using CMake. 281s """ 281s 281s tmp_dir = _tmpdir("test_setup_inputs") 281s 281s package_base = "to/the/base" if with_package_base else "" 281s package_base_dir = package_base + "/" if package_base else "" 281s cmake_source_dir = package_base 281s 281s if cmake_source_dir and (has_cmake_package or has_cmake_module): 281s pytest.skip( 281s "unsupported configuration: " 281s "python package fully generated by CMake does *NOT* work. " 281s "At least __init__.py should be in the project source tree" 281s ) 281s 281s # ------------------------------------------------------------------------- 281s # Here is the "SOURCE" tree layout: 281s # 281s # ROOT/ 281s # 281s # setup.py 281s # 281s # [/] 281s # 281s # pureModule.py 281s # 281s # pure/ 281s # __init__.py 281s # pure.py 281s # 281s # data/ 281s # pure.dat 281s # 281s # [/] 281s # 281s # hybrid/ 281s # CMakeLists.txt 281s # __init__.py 281s # hybrid_pure.dat 281s # hybrid_pure.py 281s # 281s # data/ 281s # hybrid_data_pure.dat 281s # 281s # hybrid_2/ 281s # __init__.py 281s # hybrid_2_pure.py 281s # 281s # hybrid_2_pure/ 281s # __init__.py 281s # hybrid_2_pure_1.py 281s # hybrid_2_pure_2.py 281s # 281s # 281s # ------------------------------------------------------------------------- 281s # and here is the "BINARY" distribution layout: 281s # 281s # The comment "CMake" or "Setuptools" indicates which tool is responsible 281s # for placing the file in the tree used to create the binary distribution. 281s # 281s # ROOT/ 281s # 281s # cmakeModule.py # CMake 281s # 281s # cmake/ 281s # __init__.py # CMake 281s # cmake.py # CMake 281s # 281s # hybrid/ 281s # hybrid_cmake.dat # CMake 281s # hybrid_cmake.py # CMake 281s # hybrid_pure.dat # Setuptools 281s # hybrid_pure.py # Setuptools 281s # 281s # data/ 281s # hybrid_data_pure.dat # CMake or Setuptools 281s # hybrid_data_cmake.dat # CMake *NO TEST* 281s # 281s # hybrid_2/ 281s # __init__.py # CMake or Setuptools 281s # hybrid_2_pure.py # CMake or Setuptools 281s # hybrid_2_cmake.py # CMake 281s # 281s # hybrid_2_pure/ 281s # __init__.py # CMake or Setuptools 281s # hybrid_2_pure_1.py # CMake or Setuptools 281s # hybrid_2_pure_2.py # CMake or Setuptools 281s # 281s # pureModule.py # Setuptools 281s # 281s # pure/ 281s # __init__.py # Setuptools 281s # pure.py # Setuptools 281s # 281s # data/ 281s # pure.dat # Setuptools 281s 281s tmp_dir.join("setup.py").write( 281s textwrap.dedent( 281s """ 281s from skbuild import setup 281s #from setuptools import setup 281s setup( 281s name="test_hybrid_project", 281s version="1.2.3", 281s description=("an hybrid package mixing files installed by both " 281s "CMake and setuptools"), 281s author='The scikit-build team', 281s license="MIT", 281s cmake_source_dir='{cmake_source_dir}', 281s cmake_install_dir='{cmake_install_dir}', 281s # Arbitrary order of packages 281s packages=[ 281s {p_off} 'pure', 281s {h_off} 'hybrid.hybrid_2', 281s {h_off} 'hybrid', 281s {c_off} 'cmake', 281s {p_off} 'hybrid.hybrid_2_pure', 281s ], 281s py_modules=[ 281s {pm_off} '{package_base}pureModule', 281s {cm_off} '{package_base}cmakeModule', 281s ], 281s package_data={{ 281s {p_off} 'pure': ['data/pure.dat'], 281s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 281s }}, 281s # Arbitrary order of package_dir 281s package_dir = {{ 281s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 281s {p_off} 'pure': '{package_base}pure', 281s {h_off} 'hybrid': '{package_base}hybrid', 281s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 281s {c_off} 'cmake': '{package_base}cmake', 281s }} 281s ) 281s """.format( 281s cmake_source_dir=cmake_source_dir, 281s cmake_install_dir=package_base, 281s package_base=package_base_dir, 281s c_off="" if has_cmake_package else "#", 281s cm_off="" if has_cmake_module else "#", 281s h_off="" if has_hybrid_package else "#", 281s p_off="" if has_pure_package else "#", 281s pm_off="" if has_pure_module else "#", 281s ) 281s ) 281s ) 281s 281s src_dir = tmp_dir.ensure(package_base, dir=1) 281s 281s src_dir.join("CMakeLists.txt").write( 281s textwrap.dedent( 281s """ 281s cmake_minimum_required(VERSION 3.5.0) 281s project(hybrid NONE) 281s set(build_dir ${{CMAKE_BINARY_DIR}}) 281s 281s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 281s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 281s {c_off} install( 281s {c_off} FILES 281s {c_off} ${{build_dir}}/__init__.py 281s {c_off} ${{build_dir}}/cmake.py 281s {c_off} DESTINATION cmake 281s {c_off} ) 281s 281s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 281s {cm_off} install( 281s {cm_off} FILES ${{build_dir}}/cmakeModule.py 281s {cm_off} DESTINATION .) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 281s {h_off} DESTINATION hybrid) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 281s {h_off} DESTINATION hybrid) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 281s {h_off} DESTINATION hybrid/data) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 281s {h_off} DESTINATION hybrid/hybrid_2) 281s 281s install(CODE "message(STATUS \\\"Installation complete\\\")") 281s """.format( 281s c_off="" if has_cmake_package else "#", 281s cm_off="" if has_cmake_module else "#", 281s h_off="" if has_hybrid_package else "#", 281s ) 281s ) 281s ) 281s 281s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 281s path_types: Sequence[str] 281s try: 281s path_types = next( 281s iter( 281s zip( 281s *filter( 281s lambda i: i[1], 281s [ 281s ("c", has_cmake_package), 281s ("cm", has_cmake_module), 281s ("h", has_hybrid_package), 281s ("p", has_pure_package), 281s ("pm", has_pure_module), 281s ], 281s ) 281s ) 281s ) 281s ) 281s except StopIteration: 281s path_types = [] 281s 281s def select_paths(annotated_paths): 281s """Return a filtered list paths considering ``path_types``. 281s 281s `annotated_paths`` is list of tuple ``(type, path)`` where type 281s is either `c`, 'cm', `h`, `p` or 'pm'. 281s 281s """ 281s return filter(lambda i: i[0] in path_types, annotated_paths) 281s 281s # Commented paths are the one expected to be installed by CMake. For 281s # this reason, corresponding files should NOT be created in the source 281s # tree. 281s for _type, path in select_paths( 281s [ 281s # ('c', 'cmake/__init__.py'), 281s # ('c', 'cmake/cmake.py'), 281s # ('cm', 'cmakeModule.py'), 281s ("h", "hybrid/__init__.py"), 281s # ('h', 'hybrid/hybrid_cmake.dat'), 281s # ('h', 'hybrid/hybrid_cmake.py'), 281s ("h", "hybrid/hybrid_pure.dat"), 281s ("h", "hybrid/hybrid_pure.py"), 281s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 281s ("h", "hybrid/data/hybrid_data_pure.dat"), 281s ("h", "hybrid/hybrid_2/__init__.py"), 281s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 281s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 281s ("p", "hybrid/hybrid_2_pure/__init__.py"), 281s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 281s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 281s ("pm", "pureModule.py"), 281s ("p", "pure/__init__.py"), 281s ("p", "pure/pure.py"), 281s ("p", "pure/data/pure.dat"), 281s ] 281s ): 281s assert _type in {"p", "pm", "h"} 281s root = package_base if _type in {"p", "pm"} else cmake_source_dir 281s tmp_dir.ensure(os.path.join(root, path)) 281s 281s # Do not call the real setup function. Instead, replace it with 281s # a MagicMock allowing to check with which arguments it was invoked. 281s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 281s 281s # Convenience print function 281s def _pprint(desc, value=None): 281s print( 281s "-----------------\n" 281s f"{desc}:\n" 281s "\n" 281s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 281s ) 281s 281s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 281s 281s _pprint = ._pprint at 0x709a4420c040> 281s _type = 'pm' 281s cmake_source_dir = '' 281s has_cmake_module = 0 281s has_cmake_package = 0 281s has_hybrid_package = 1 281s has_pure_module = 1 281s has_pure_package = 0 281s mock_setup = 281s mocker = 281s package_base = '' 281s package_base_dir = '' 281s path = 'pureModule.py' 281s path_types = ('h', 'pm') 281s root = '' 281s select_paths = .select_paths at 0x709a44387100> 281s src_dir = local('/tmp/pytest-of-ubuntu/pytest-102/test_setup_inputs0') 281s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-102/test_setup_inputs0') 281s with_package_base = 0 281s 281s tests/test_setup.py:849: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-102/test_setup_inputs0') 281s setup_args = ['build'], disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-102/test_setup_inputs0') 281s setup_args = ['build'] 281s 281s tests/__init__.py:218: AttributeError 281s ________________________ test_setup_inputs[0-1-0-1-0-1] ________________________ 281s 281s has_cmake_package = 1, has_cmake_module = 0, has_hybrid_package = 1 281s has_pure_package = 0, has_pure_module = 1, with_package_base = 0 281s mocker = 281s 281s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 281s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 281s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 281s @pytest.mark.parametrize("has_pure_package", [0, 1]) 281s @pytest.mark.parametrize("has_pure_module", [0, 1]) 281s @pytest.mark.parametrize("with_package_base", [0, 1]) 281s def test_setup_inputs( 281s has_cmake_package, 281s has_cmake_module, 281s has_hybrid_package, 281s has_pure_package, 281s has_pure_module, 281s with_package_base, 281s mocker, 281s ): 281s """This test that a project can have a package with some modules 281s installed using setup.py and some other modules installed using CMake. 281s """ 281s 281s tmp_dir = _tmpdir("test_setup_inputs") 281s 281s package_base = "to/the/base" if with_package_base else "" 281s package_base_dir = package_base + "/" if package_base else "" 281s cmake_source_dir = package_base 281s 281s if cmake_source_dir and (has_cmake_package or has_cmake_module): 281s pytest.skip( 281s "unsupported configuration: " 281s "python package fully generated by CMake does *NOT* work. " 281s "At least __init__.py should be in the project source tree" 281s ) 281s 281s # ------------------------------------------------------------------------- 281s # Here is the "SOURCE" tree layout: 281s # 281s # ROOT/ 281s # 281s # setup.py 281s # 281s # [/] 281s # 281s # pureModule.py 281s # 281s # pure/ 281s # __init__.py 281s # pure.py 281s # 281s # data/ 281s # pure.dat 281s # 281s # [/] 281s # 281s # hybrid/ 281s # CMakeLists.txt 281s # __init__.py 281s # hybrid_pure.dat 281s # hybrid_pure.py 281s # 281s # data/ 281s # hybrid_data_pure.dat 281s # 281s # hybrid_2/ 281s # __init__.py 281s # hybrid_2_pure.py 281s # 281s # hybrid_2_pure/ 281s # __init__.py 281s # hybrid_2_pure_1.py 281s # hybrid_2_pure_2.py 281s # 281s # 281s # ------------------------------------------------------------------------- 281s # and here is the "BINARY" distribution layout: 281s # 281s # The comment "CMake" or "Setuptools" indicates which tool is responsible 281s # for placing the file in the tree used to create the binary distribution. 281s # 281s # ROOT/ 281s # 281s # cmakeModule.py # CMake 281s # 281s # cmake/ 281s # __init__.py # CMake 281s # cmake.py # CMake 281s # 281s # hybrid/ 281s # hybrid_cmake.dat # CMake 281s # hybrid_cmake.py # CMake 281s # hybrid_pure.dat # Setuptools 281s # hybrid_pure.py # Setuptools 281s # 281s # data/ 281s # hybrid_data_pure.dat # CMake or Setuptools 281s # hybrid_data_cmake.dat # CMake *NO TEST* 281s # 281s # hybrid_2/ 281s # __init__.py # CMake or Setuptools 281s # hybrid_2_pure.py # CMake or Setuptools 281s # hybrid_2_cmake.py # CMake 281s # 281s # hybrid_2_pure/ 281s # __init__.py # CMake or Setuptools 281s # hybrid_2_pure_1.py # CMake or Setuptools 281s # hybrid_2_pure_2.py # CMake or Setuptools 281s # 281s # pureModule.py # Setuptools 281s # 281s # pure/ 281s # __init__.py # Setuptools 281s # pure.py # Setuptools 281s # 281s # data/ 281s # pure.dat # Setuptools 281s 281s tmp_dir.join("setup.py").write( 281s textwrap.dedent( 281s """ 281s from skbuild import setup 281s #from setuptools import setup 281s setup( 281s name="test_hybrid_project", 281s version="1.2.3", 281s description=("an hybrid package mixing files installed by both " 281s "CMake and setuptools"), 281s author='The scikit-build team', 281s license="MIT", 281s cmake_source_dir='{cmake_source_dir}', 281s cmake_install_dir='{cmake_install_dir}', 281s # Arbitrary order of packages 281s packages=[ 281s {p_off} 'pure', 281s {h_off} 'hybrid.hybrid_2', 281s {h_off} 'hybrid', 281s {c_off} 'cmake', 281s {p_off} 'hybrid.hybrid_2_pure', 281s ], 281s py_modules=[ 281s {pm_off} '{package_base}pureModule', 281s {cm_off} '{package_base}cmakeModule', 281s ], 281s package_data={{ 281s {p_off} 'pure': ['data/pure.dat'], 281s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 281s }}, 281s # Arbitrary order of package_dir 281s package_dir = {{ 281s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 281s {p_off} 'pure': '{package_base}pure', 281s {h_off} 'hybrid': '{package_base}hybrid', 281s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 281s {c_off} 'cmake': '{package_base}cmake', 281s }} 281s ) 281s """.format( 281s cmake_source_dir=cmake_source_dir, 281s cmake_install_dir=package_base, 281s package_base=package_base_dir, 281s c_off="" if has_cmake_package else "#", 281s cm_off="" if has_cmake_module else "#", 281s h_off="" if has_hybrid_package else "#", 281s p_off="" if has_pure_package else "#", 281s pm_off="" if has_pure_module else "#", 281s ) 281s ) 281s ) 281s 281s src_dir = tmp_dir.ensure(package_base, dir=1) 281s 281s src_dir.join("CMakeLists.txt").write( 281s textwrap.dedent( 281s """ 281s cmake_minimum_required(VERSION 3.5.0) 281s project(hybrid NONE) 281s set(build_dir ${{CMAKE_BINARY_DIR}}) 281s 281s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 281s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 281s {c_off} install( 281s {c_off} FILES 281s {c_off} ${{build_dir}}/__init__.py 281s {c_off} ${{build_dir}}/cmake.py 281s {c_off} DESTINATION cmake 281s {c_off} ) 281s 281s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 281s {cm_off} install( 281s {cm_off} FILES ${{build_dir}}/cmakeModule.py 281s {cm_off} DESTINATION .) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 281s {h_off} DESTINATION hybrid) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 281s {h_off} DESTINATION hybrid) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 281s {h_off} DESTINATION hybrid/data) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 281s {h_off} DESTINATION hybrid/hybrid_2) 281s 281s install(CODE "message(STATUS \\\"Installation complete\\\")") 281s """.format( 281s c_off="" if has_cmake_package else "#", 281s cm_off="" if has_cmake_module else "#", 281s h_off="" if has_hybrid_package else "#", 281s ) 281s ) 281s ) 281s 281s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 281s path_types: Sequence[str] 281s try: 281s path_types = next( 281s iter( 281s zip( 281s *filter( 281s lambda i: i[1], 281s [ 281s ("c", has_cmake_package), 281s ("cm", has_cmake_module), 281s ("h", has_hybrid_package), 281s ("p", has_pure_package), 281s ("pm", has_pure_module), 281s ], 281s ) 281s ) 281s ) 281s ) 281s except StopIteration: 281s path_types = [] 281s 281s def select_paths(annotated_paths): 281s """Return a filtered list paths considering ``path_types``. 281s 281s `annotated_paths`` is list of tuple ``(type, path)`` where type 281s is either `c`, 'cm', `h`, `p` or 'pm'. 281s 281s """ 281s return filter(lambda i: i[0] in path_types, annotated_paths) 281s 281s # Commented paths are the one expected to be installed by CMake. For 281s # this reason, corresponding files should NOT be created in the source 281s # tree. 281s for _type, path in select_paths( 281s [ 281s # ('c', 'cmake/__init__.py'), 281s # ('c', 'cmake/cmake.py'), 281s # ('cm', 'cmakeModule.py'), 281s ("h", "hybrid/__init__.py"), 281s # ('h', 'hybrid/hybrid_cmake.dat'), 281s # ('h', 'hybrid/hybrid_cmake.py'), 281s ("h", "hybrid/hybrid_pure.dat"), 281s ("h", "hybrid/hybrid_pure.py"), 281s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 281s ("h", "hybrid/data/hybrid_data_pure.dat"), 281s ("h", "hybrid/hybrid_2/__init__.py"), 281s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 281s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 281s ("p", "hybrid/hybrid_2_pure/__init__.py"), 281s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 281s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 281s ("pm", "pureModule.py"), 281s ("p", "pure/__init__.py"), 281s ("p", "pure/pure.py"), 281s ("p", "pure/data/pure.dat"), 281s ] 281s ): 281s assert _type in {"p", "pm", "h"} 281s root = package_base if _type in {"p", "pm"} else cmake_source_dir 281s tmp_dir.ensure(os.path.join(root, path)) 281s 281s # Do not call the real setup function. Instead, replace it with 281s # a MagicMock allowing to check with which arguments it was invoked. 281s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 281s 281s # Convenience print function 281s def _pprint(desc, value=None): 281s print( 281s "-----------------\n" 281s f"{desc}:\n" 281s "\n" 281s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 281s ) 281s 281s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 281s 281s _pprint = ._pprint at 0x709a443877e0> 281s _type = 'pm' 281s cmake_source_dir = '' 281s has_cmake_module = 0 281s has_cmake_package = 1 281s has_hybrid_package = 1 281s has_pure_module = 1 281s has_pure_package = 0 281s mock_setup = 281s mocker = 281s package_base = '' 281s package_base_dir = '' 281s path = 'pureModule.py' 281s path_types = ('c', 'h', 'pm') 281s root = '' 281s select_paths = .select_paths at 0x709a44386d40> 281s src_dir = local('/tmp/pytest-of-ubuntu/pytest-103/test_setup_inputs0') 281s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-103/test_setup_inputs0') 281s with_package_base = 0 281s 281s tests/test_setup.py:849: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-103/test_setup_inputs0') 281s setup_args = ['build'], disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-103/test_setup_inputs0') 281s setup_args = ['build'] 281s 281s tests/__init__.py:218: AttributeError 281s ________________________ test_setup_inputs[0-1-0-1-1-0] ________________________ 281s 281s has_cmake_package = 0, has_cmake_module = 1, has_hybrid_package = 1 281s has_pure_package = 0, has_pure_module = 1, with_package_base = 0 281s mocker = 281s 281s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 281s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 281s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 281s @pytest.mark.parametrize("has_pure_package", [0, 1]) 281s @pytest.mark.parametrize("has_pure_module", [0, 1]) 281s @pytest.mark.parametrize("with_package_base", [0, 1]) 281s def test_setup_inputs( 281s has_cmake_package, 281s has_cmake_module, 281s has_hybrid_package, 281s has_pure_package, 281s has_pure_module, 281s with_package_base, 281s mocker, 281s ): 281s """This test that a project can have a package with some modules 281s installed using setup.py and some other modules installed using CMake. 281s """ 281s 281s tmp_dir = _tmpdir("test_setup_inputs") 281s 281s package_base = "to/the/base" if with_package_base else "" 281s package_base_dir = package_base + "/" if package_base else "" 281s cmake_source_dir = package_base 281s 281s if cmake_source_dir and (has_cmake_package or has_cmake_module): 281s pytest.skip( 281s "unsupported configuration: " 281s "python package fully generated by CMake does *NOT* work. " 281s "At least __init__.py should be in the project source tree" 281s ) 281s 281s # ------------------------------------------------------------------------- 281s # Here is the "SOURCE" tree layout: 281s # 281s # ROOT/ 281s # 281s # setup.py 281s # 281s # [/] 281s # 281s # pureModule.py 281s # 281s # pure/ 281s # __init__.py 281s # pure.py 281s # 281s # data/ 281s # pure.dat 281s # 281s # [/] 281s # 281s # hybrid/ 281s # CMakeLists.txt 281s # __init__.py 281s # hybrid_pure.dat 281s # hybrid_pure.py 281s # 281s # data/ 281s # hybrid_data_pure.dat 281s # 281s # hybrid_2/ 281s # __init__.py 281s # hybrid_2_pure.py 281s # 281s # hybrid_2_pure/ 281s # __init__.py 281s # hybrid_2_pure_1.py 281s # hybrid_2_pure_2.py 281s # 281s # 281s # ------------------------------------------------------------------------- 281s # and here is the "BINARY" distribution layout: 281s # 281s # The comment "CMake" or "Setuptools" indicates which tool is responsible 281s # for placing the file in the tree used to create the binary distribution. 281s # 281s # ROOT/ 281s # 281s # cmakeModule.py # CMake 281s # 281s # cmake/ 281s # __init__.py # CMake 281s # cmake.py # CMake 281s # 281s # hybrid/ 281s # hybrid_cmake.dat # CMake 281s # hybrid_cmake.py # CMake 281s # hybrid_pure.dat # Setuptools 281s # hybrid_pure.py # Setuptools 281s # 281s # data/ 281s # hybrid_data_pure.dat # CMake or Setuptools 281s # hybrid_data_cmake.dat # CMake *NO TEST* 281s # 281s # hybrid_2/ 281s # __init__.py # CMake or Setuptools 281s # hybrid_2_pure.py # CMake or Setuptools 281s # hybrid_2_cmake.py # CMake 281s # 281s # hybrid_2_pure/ 281s # __init__.py # CMake or Setuptools 281s # hybrid_2_pure_1.py # CMake or Setuptools 281s # hybrid_2_pure_2.py # CMake or Setuptools 281s # 281s # pureModule.py # Setuptools 281s # 281s # pure/ 281s # __init__.py # Setuptools 281s # pure.py # Setuptools 281s # 281s # data/ 281s # pure.dat # Setuptools 281s 281s tmp_dir.join("setup.py").write( 281s textwrap.dedent( 281s """ 281s from skbuild import setup 281s #from setuptools import setup 281s setup( 281s name="test_hybrid_project", 281s version="1.2.3", 281s description=("an hybrid package mixing files installed by both " 281s "CMake and setuptools"), 281s author='The scikit-build team', 281s license="MIT", 281s cmake_source_dir='{cmake_source_dir}', 281s cmake_install_dir='{cmake_install_dir}', 281s # Arbitrary order of packages 281s packages=[ 281s {p_off} 'pure', 281s {h_off} 'hybrid.hybrid_2', 281s {h_off} 'hybrid', 281s {c_off} 'cmake', 281s {p_off} 'hybrid.hybrid_2_pure', 281s ], 281s py_modules=[ 281s {pm_off} '{package_base}pureModule', 281s {cm_off} '{package_base}cmakeModule', 281s ], 281s package_data={{ 281s {p_off} 'pure': ['data/pure.dat'], 281s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 281s }}, 281s # Arbitrary order of package_dir 281s package_dir = {{ 281s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 281s {p_off} 'pure': '{package_base}pure', 281s {h_off} 'hybrid': '{package_base}hybrid', 281s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 281s {c_off} 'cmake': '{package_base}cmake', 281s }} 281s ) 281s """.format( 281s cmake_source_dir=cmake_source_dir, 281s cmake_install_dir=package_base, 281s package_base=package_base_dir, 281s c_off="" if has_cmake_package else "#", 281s cm_off="" if has_cmake_module else "#", 281s h_off="" if has_hybrid_package else "#", 281s p_off="" if has_pure_package else "#", 281s pm_off="" if has_pure_module else "#", 281s ) 281s ) 281s ) 281s 281s src_dir = tmp_dir.ensure(package_base, dir=1) 281s 281s src_dir.join("CMakeLists.txt").write( 281s textwrap.dedent( 281s """ 281s cmake_minimum_required(VERSION 3.5.0) 281s project(hybrid NONE) 281s set(build_dir ${{CMAKE_BINARY_DIR}}) 281s 281s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 281s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 281s {c_off} install( 281s {c_off} FILES 281s {c_off} ${{build_dir}}/__init__.py 281s {c_off} ${{build_dir}}/cmake.py 281s {c_off} DESTINATION cmake 281s {c_off} ) 281s 281s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 281s {cm_off} install( 281s {cm_off} FILES ${{build_dir}}/cmakeModule.py 281s {cm_off} DESTINATION .) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 281s {h_off} DESTINATION hybrid) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 281s {h_off} DESTINATION hybrid) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 281s {h_off} DESTINATION hybrid/data) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 281s {h_off} DESTINATION hybrid/hybrid_2) 281s 281s install(CODE "message(STATUS \\\"Installation complete\\\")") 281s """.format( 281s c_off="" if has_cmake_package else "#", 281s cm_off="" if has_cmake_module else "#", 281s h_off="" if has_hybrid_package else "#", 281s ) 281s ) 281s ) 281s 281s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 281s path_types: Sequence[str] 281s try: 281s path_types = next( 281s iter( 281s zip( 281s *filter( 281s lambda i: i[1], 281s [ 281s ("c", has_cmake_package), 281s ("cm", has_cmake_module), 281s ("h", has_hybrid_package), 281s ("p", has_pure_package), 281s ("pm", has_pure_module), 281s ], 281s ) 281s ) 281s ) 281s ) 281s except StopIteration: 281s path_types = [] 281s 281s def select_paths(annotated_paths): 281s """Return a filtered list paths considering ``path_types``. 281s 281s `annotated_paths`` is list of tuple ``(type, path)`` where type 281s is either `c`, 'cm', `h`, `p` or 'pm'. 281s 281s """ 281s return filter(lambda i: i[0] in path_types, annotated_paths) 281s 281s # Commented paths are the one expected to be installed by CMake. For 281s # this reason, corresponding files should NOT be created in the source 281s # tree. 281s for _type, path in select_paths( 281s [ 281s # ('c', 'cmake/__init__.py'), 281s # ('c', 'cmake/cmake.py'), 281s # ('cm', 'cmakeModule.py'), 281s ("h", "hybrid/__init__.py"), 281s # ('h', 'hybrid/hybrid_cmake.dat'), 281s # ('h', 'hybrid/hybrid_cmake.py'), 281s ("h", "hybrid/hybrid_pure.dat"), 281s ("h", "hybrid/hybrid_pure.py"), 281s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 281s ("h", "hybrid/data/hybrid_data_pure.dat"), 281s ("h", "hybrid/hybrid_2/__init__.py"), 281s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 281s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 281s ("p", "hybrid/hybrid_2_pure/__init__.py"), 281s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 281s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 281s ("pm", "pureModule.py"), 281s ("p", "pure/__init__.py"), 281s ("p", "pure/pure.py"), 281s ("p", "pure/data/pure.dat"), 281s ] 281s ): 281s assert _type in {"p", "pm", "h"} 281s root = package_base if _type in {"p", "pm"} else cmake_source_dir 281s tmp_dir.ensure(os.path.join(root, path)) 281s 281s # Do not call the real setup function. Instead, replace it with 281s # a MagicMock allowing to check with which arguments it was invoked. 281s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 281s 281s # Convenience print function 281s def _pprint(desc, value=None): 281s print( 281s "-----------------\n" 281s f"{desc}:\n" 281s "\n" 281s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 281s ) 281s 281s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 281s 281s _pprint = ._pprint at 0x709a44384360> 281s _type = 'pm' 281s cmake_source_dir = '' 281s has_cmake_module = 1 281s has_cmake_package = 0 281s has_hybrid_package = 1 281s has_pure_module = 1 281s has_pure_package = 0 281s mock_setup = 281s mocker = 281s package_base = '' 281s package_base_dir = '' 281s path = 'pureModule.py' 281s path_types = ('cm', 'h', 'pm') 281s root = '' 281s select_paths = .select_paths at 0x709a44387ec0> 281s src_dir = local('/tmp/pytest-of-ubuntu/pytest-104/test_setup_inputs0') 281s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-104/test_setup_inputs0') 281s with_package_base = 0 281s 281s tests/test_setup.py:849: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-104/test_setup_inputs0') 281s setup_args = ['build'], disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-104/test_setup_inputs0') 281s setup_args = ['build'] 281s 281s tests/__init__.py:218: AttributeError 281s ________________________ test_setup_inputs[0-1-0-1-1-1] ________________________ 281s 281s has_cmake_package = 1, has_cmake_module = 1, has_hybrid_package = 1 281s has_pure_package = 0, has_pure_module = 1, with_package_base = 0 281s mocker = 281s 281s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 281s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 281s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 281s @pytest.mark.parametrize("has_pure_package", [0, 1]) 281s @pytest.mark.parametrize("has_pure_module", [0, 1]) 281s @pytest.mark.parametrize("with_package_base", [0, 1]) 281s def test_setup_inputs( 281s has_cmake_package, 281s has_cmake_module, 281s has_hybrid_package, 281s has_pure_package, 281s has_pure_module, 281s with_package_base, 281s mocker, 281s ): 281s """This test that a project can have a package with some modules 281s installed using setup.py and some other modules installed using CMake. 281s """ 281s 281s tmp_dir = _tmpdir("test_setup_inputs") 281s 281s package_base = "to/the/base" if with_package_base else "" 281s package_base_dir = package_base + "/" if package_base else "" 281s cmake_source_dir = package_base 281s 281s if cmake_source_dir and (has_cmake_package or has_cmake_module): 281s pytest.skip( 281s "unsupported configuration: " 281s "python package fully generated by CMake does *NOT* work. " 281s "At least __init__.py should be in the project source tree" 281s ) 281s 281s # ------------------------------------------------------------------------- 281s # Here is the "SOURCE" tree layout: 281s # 281s # ROOT/ 281s # 281s # setup.py 281s # 281s # [/] 281s # 281s # pureModule.py 281s # 281s # pure/ 281s # __init__.py 281s # pure.py 281s # 281s # data/ 281s # pure.dat 281s # 281s # [/] 281s # 281s # hybrid/ 281s # CMakeLists.txt 281s # __init__.py 281s # hybrid_pure.dat 281s # hybrid_pure.py 281s # 281s # data/ 281s # hybrid_data_pure.dat 281s # 281s # hybrid_2/ 281s # __init__.py 281s # hybrid_2_pure.py 281s # 281s # hybrid_2_pure/ 281s # __init__.py 281s # hybrid_2_pure_1.py 281s # hybrid_2_pure_2.py 281s # 281s # 281s # ------------------------------------------------------------------------- 281s # and here is the "BINARY" distribution layout: 281s # 281s # The comment "CMake" or "Setuptools" indicates which tool is responsible 281s # for placing the file in the tree used to create the binary distribution. 281s # 281s # ROOT/ 281s # 281s # cmakeModule.py # CMake 281s # 281s # cmake/ 281s # __init__.py # CMake 281s # cmake.py # CMake 281s # 281s # hybrid/ 281s # hybrid_cmake.dat # CMake 281s # hybrid_cmake.py # CMake 281s # hybrid_pure.dat # Setuptools 281s # hybrid_pure.py # Setuptools 281s # 281s # data/ 281s # hybrid_data_pure.dat # CMake or Setuptools 281s # hybrid_data_cmake.dat # CMake *NO TEST* 281s # 281s # hybrid_2/ 281s # __init__.py # CMake or Setuptools 281s # hybrid_2_pure.py # CMake or Setuptools 281s # hybrid_2_cmake.py # CMake 281s # 281s # hybrid_2_pure/ 281s # __init__.py # CMake or Setuptools 281s # hybrid_2_pure_1.py # CMake or Setuptools 281s # hybrid_2_pure_2.py # CMake or Setuptools 281s # 281s # pureModule.py # Setuptools 281s # 281s # pure/ 281s # __init__.py # Setuptools 281s # pure.py # Setuptools 281s # 281s # data/ 281s # pure.dat # Setuptools 281s 281s tmp_dir.join("setup.py").write( 281s textwrap.dedent( 281s """ 281s from skbuild import setup 281s #from setuptools import setup 281s setup( 281s name="test_hybrid_project", 281s version="1.2.3", 281s description=("an hybrid package mixing files installed by both " 281s "CMake and setuptools"), 281s author='The scikit-build team', 281s license="MIT", 281s cmake_source_dir='{cmake_source_dir}', 281s cmake_install_dir='{cmake_install_dir}', 281s # Arbitrary order of packages 281s packages=[ 281s {p_off} 'pure', 281s {h_off} 'hybrid.hybrid_2', 281s {h_off} 'hybrid', 281s {c_off} 'cmake', 281s {p_off} 'hybrid.hybrid_2_pure', 281s ], 281s py_modules=[ 281s {pm_off} '{package_base}pureModule', 281s {cm_off} '{package_base}cmakeModule', 281s ], 281s package_data={{ 281s {p_off} 'pure': ['data/pure.dat'], 281s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 281s }}, 281s # Arbitrary order of package_dir 281s package_dir = {{ 281s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 281s {p_off} 'pure': '{package_base}pure', 281s {h_off} 'hybrid': '{package_base}hybrid', 281s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 281s {c_off} 'cmake': '{package_base}cmake', 281s }} 281s ) 281s """.format( 281s cmake_source_dir=cmake_source_dir, 281s cmake_install_dir=package_base, 281s package_base=package_base_dir, 281s c_off="" if has_cmake_package else "#", 281s cm_off="" if has_cmake_module else "#", 281s h_off="" if has_hybrid_package else "#", 281s p_off="" if has_pure_package else "#", 281s pm_off="" if has_pure_module else "#", 281s ) 281s ) 281s ) 281s 281s src_dir = tmp_dir.ensure(package_base, dir=1) 281s 281s src_dir.join("CMakeLists.txt").write( 281s textwrap.dedent( 281s """ 281s cmake_minimum_required(VERSION 3.5.0) 281s project(hybrid NONE) 281s set(build_dir ${{CMAKE_BINARY_DIR}}) 281s 281s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 281s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 281s {c_off} install( 281s {c_off} FILES 281s {c_off} ${{build_dir}}/__init__.py 281s {c_off} ${{build_dir}}/cmake.py 281s {c_off} DESTINATION cmake 281s {c_off} ) 281s 281s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 281s {cm_off} install( 281s {cm_off} FILES ${{build_dir}}/cmakeModule.py 281s {cm_off} DESTINATION .) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 281s {h_off} DESTINATION hybrid) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 281s {h_off} DESTINATION hybrid) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 281s {h_off} DESTINATION hybrid/data) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 281s {h_off} DESTINATION hybrid/hybrid_2) 281s 281s install(CODE "message(STATUS \\\"Installation complete\\\")") 281s """.format( 281s c_off="" if has_cmake_package else "#", 281s cm_off="" if has_cmake_module else "#", 281s h_off="" if has_hybrid_package else "#", 281s ) 281s ) 281s ) 281s 281s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 281s path_types: Sequence[str] 281s try: 281s path_types = next( 281s iter( 281s zip( 281s *filter( 281s lambda i: i[1], 281s [ 281s ("c", has_cmake_package), 281s ("cm", has_cmake_module), 281s ("h", has_hybrid_package), 281s ("p", has_pure_package), 281s ("pm", has_pure_module), 281s ], 281s ) 281s ) 281s ) 281s ) 281s except StopIteration: 281s path_types = [] 281s 281s def select_paths(annotated_paths): 281s """Return a filtered list paths considering ``path_types``. 281s 281s `annotated_paths`` is list of tuple ``(type, path)`` where type 281s is either `c`, 'cm', `h`, `p` or 'pm'. 281s 281s """ 281s return filter(lambda i: i[0] in path_types, annotated_paths) 281s 281s # Commented paths are the one expected to be installed by CMake. For 281s # this reason, corresponding files should NOT be created in the source 281s # tree. 281s for _type, path in select_paths( 281s [ 281s # ('c', 'cmake/__init__.py'), 281s # ('c', 'cmake/cmake.py'), 281s # ('cm', 'cmakeModule.py'), 281s ("h", "hybrid/__init__.py"), 281s # ('h', 'hybrid/hybrid_cmake.dat'), 281s # ('h', 'hybrid/hybrid_cmake.py'), 281s ("h", "hybrid/hybrid_pure.dat"), 281s ("h", "hybrid/hybrid_pure.py"), 281s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 281s ("h", "hybrid/data/hybrid_data_pure.dat"), 281s ("h", "hybrid/hybrid_2/__init__.py"), 281s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 281s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 281s ("p", "hybrid/hybrid_2_pure/__init__.py"), 281s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 281s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 281s ("pm", "pureModule.py"), 281s ("p", "pure/__init__.py"), 281s ("p", "pure/pure.py"), 281s ("p", "pure/data/pure.dat"), 281s ] 281s ): 281s assert _type in {"p", "pm", "h"} 281s root = package_base if _type in {"p", "pm"} else cmake_source_dir 281s tmp_dir.ensure(os.path.join(root, path)) 281s 281s # Do not call the real setup function. Instead, replace it with 281s # a MagicMock allowing to check with which arguments it was invoked. 281s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 281s 281s # Convenience print function 281s def _pprint(desc, value=None): 281s print( 281s "-----------------\n" 281s f"{desc}:\n" 281s "\n" 281s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 281s ) 281s 281s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 281s 281s _pprint = ._pprint at 0x709a4420c220> 281s _type = 'pm' 281s cmake_source_dir = '' 281s has_cmake_module = 1 281s has_cmake_package = 1 281s has_hybrid_package = 1 281s has_pure_module = 1 281s has_pure_package = 0 281s mock_setup = 281s mocker = 281s package_base = '' 281s package_base_dir = '' 281s path = 'pureModule.py' 281s path_types = ('c', 'cm', 'h', 'pm') 281s root = '' 281s select_paths = .select_paths at 0x709a443867a0> 281s src_dir = local('/tmp/pytest-of-ubuntu/pytest-105/test_setup_inputs0') 281s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-105/test_setup_inputs0') 281s with_package_base = 0 281s 281s tests/test_setup.py:849: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-105/test_setup_inputs0') 281s setup_args = ['build'], disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-105/test_setup_inputs0') 281s setup_args = ['build'] 281s 281s tests/__init__.py:218: AttributeError 281s ________________________ test_setup_inputs[0-1-1-0-0-0] ________________________ 281s 281s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 0 281s has_pure_package = 1, has_pure_module = 1, with_package_base = 0 281s mocker = 281s 281s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 281s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 281s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 281s @pytest.mark.parametrize("has_pure_package", [0, 1]) 281s @pytest.mark.parametrize("has_pure_module", [0, 1]) 281s @pytest.mark.parametrize("with_package_base", [0, 1]) 281s def test_setup_inputs( 281s has_cmake_package, 281s has_cmake_module, 281s has_hybrid_package, 281s has_pure_package, 281s has_pure_module, 281s with_package_base, 281s mocker, 281s ): 281s """This test that a project can have a package with some modules 281s installed using setup.py and some other modules installed using CMake. 281s """ 281s 281s tmp_dir = _tmpdir("test_setup_inputs") 281s 281s package_base = "to/the/base" if with_package_base else "" 281s package_base_dir = package_base + "/" if package_base else "" 281s cmake_source_dir = package_base 281s 281s if cmake_source_dir and (has_cmake_package or has_cmake_module): 281s pytest.skip( 281s "unsupported configuration: " 281s "python package fully generated by CMake does *NOT* work. " 281s "At least __init__.py should be in the project source tree" 281s ) 281s 281s # ------------------------------------------------------------------------- 281s # Here is the "SOURCE" tree layout: 281s # 281s # ROOT/ 281s # 281s # setup.py 281s # 281s # [/] 281s # 281s # pureModule.py 281s # 281s # pure/ 281s # __init__.py 281s # pure.py 281s # 281s # data/ 281s # pure.dat 281s # 281s # [/] 281s # 281s # hybrid/ 281s # CMakeLists.txt 281s # __init__.py 281s # hybrid_pure.dat 281s # hybrid_pure.py 281s # 281s # data/ 281s # hybrid_data_pure.dat 281s # 281s # hybrid_2/ 281s # __init__.py 281s # hybrid_2_pure.py 281s # 281s # hybrid_2_pure/ 281s # __init__.py 281s # hybrid_2_pure_1.py 281s # hybrid_2_pure_2.py 281s # 281s # 281s # ------------------------------------------------------------------------- 281s # and here is the "BINARY" distribution layout: 281s # 281s # The comment "CMake" or "Setuptools" indicates which tool is responsible 281s # for placing the file in the tree used to create the binary distribution. 281s # 281s # ROOT/ 281s # 281s # cmakeModule.py # CMake 281s # 281s # cmake/ 281s # __init__.py # CMake 281s # cmake.py # CMake 281s # 281s # hybrid/ 281s # hybrid_cmake.dat # CMake 281s # hybrid_cmake.py # CMake 281s # hybrid_pure.dat # Setuptools 281s # hybrid_pure.py # Setuptools 281s # 281s # data/ 281s # hybrid_data_pure.dat # CMake or Setuptools 281s # hybrid_data_cmake.dat # CMake *NO TEST* 281s # 281s # hybrid_2/ 281s # __init__.py # CMake or Setuptools 281s # hybrid_2_pure.py # CMake or Setuptools 281s # hybrid_2_cmake.py # CMake 281s # 281s # hybrid_2_pure/ 281s # __init__.py # CMake or Setuptools 281s # hybrid_2_pure_1.py # CMake or Setuptools 281s # hybrid_2_pure_2.py # CMake or Setuptools 281s # 281s # pureModule.py # Setuptools 281s # 281s # pure/ 281s # __init__.py # Setuptools 281s # pure.py # Setuptools 281s # 281s # data/ 281s # pure.dat # Setuptools 281s 281s tmp_dir.join("setup.py").write( 281s textwrap.dedent( 281s """ 281s from skbuild import setup 281s #from setuptools import setup 281s setup( 281s name="test_hybrid_project", 281s version="1.2.3", 281s description=("an hybrid package mixing files installed by both " 281s "CMake and setuptools"), 281s author='The scikit-build team', 281s license="MIT", 281s cmake_source_dir='{cmake_source_dir}', 281s cmake_install_dir='{cmake_install_dir}', 281s # Arbitrary order of packages 281s packages=[ 281s {p_off} 'pure', 281s {h_off} 'hybrid.hybrid_2', 281s {h_off} 'hybrid', 281s {c_off} 'cmake', 281s {p_off} 'hybrid.hybrid_2_pure', 281s ], 281s py_modules=[ 281s {pm_off} '{package_base}pureModule', 281s {cm_off} '{package_base}cmakeModule', 281s ], 281s package_data={{ 281s {p_off} 'pure': ['data/pure.dat'], 281s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 281s }}, 281s # Arbitrary order of package_dir 281s package_dir = {{ 281s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 281s {p_off} 'pure': '{package_base}pure', 281s {h_off} 'hybrid': '{package_base}hybrid', 281s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 281s {c_off} 'cmake': '{package_base}cmake', 281s }} 281s ) 281s """.format( 281s cmake_source_dir=cmake_source_dir, 281s cmake_install_dir=package_base, 281s package_base=package_base_dir, 281s c_off="" if has_cmake_package else "#", 281s cm_off="" if has_cmake_module else "#", 281s h_off="" if has_hybrid_package else "#", 281s p_off="" if has_pure_package else "#", 281s pm_off="" if has_pure_module else "#", 281s ) 281s ) 281s ) 281s 281s src_dir = tmp_dir.ensure(package_base, dir=1) 281s 281s src_dir.join("CMakeLists.txt").write( 281s textwrap.dedent( 281s """ 281s cmake_minimum_required(VERSION 3.5.0) 281s project(hybrid NONE) 281s set(build_dir ${{CMAKE_BINARY_DIR}}) 281s 281s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 281s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 281s {c_off} install( 281s {c_off} FILES 281s {c_off} ${{build_dir}}/__init__.py 281s {c_off} ${{build_dir}}/cmake.py 281s {c_off} DESTINATION cmake 281s {c_off} ) 281s 281s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 281s {cm_off} install( 281s {cm_off} FILES ${{build_dir}}/cmakeModule.py 281s {cm_off} DESTINATION .) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 281s {h_off} DESTINATION hybrid) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 281s {h_off} DESTINATION hybrid) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 281s {h_off} DESTINATION hybrid/data) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 281s {h_off} DESTINATION hybrid/hybrid_2) 281s 281s install(CODE "message(STATUS \\\"Installation complete\\\")") 281s """.format( 281s c_off="" if has_cmake_package else "#", 281s cm_off="" if has_cmake_module else "#", 281s h_off="" if has_hybrid_package else "#", 281s ) 281s ) 281s ) 281s 281s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 281s path_types: Sequence[str] 281s try: 281s path_types = next( 281s iter( 281s zip( 281s *filter( 281s lambda i: i[1], 281s [ 281s ("c", has_cmake_package), 281s ("cm", has_cmake_module), 281s ("h", has_hybrid_package), 281s ("p", has_pure_package), 281s ("pm", has_pure_module), 281s ], 281s ) 281s ) 281s ) 281s ) 281s except StopIteration: 281s path_types = [] 281s 281s def select_paths(annotated_paths): 281s """Return a filtered list paths considering ``path_types``. 281s 281s `annotated_paths`` is list of tuple ``(type, path)`` where type 281s is either `c`, 'cm', `h`, `p` or 'pm'. 281s 281s """ 281s return filter(lambda i: i[0] in path_types, annotated_paths) 281s 281s # Commented paths are the one expected to be installed by CMake. For 281s # this reason, corresponding files should NOT be created in the source 281s # tree. 281s for _type, path in select_paths( 281s [ 281s # ('c', 'cmake/__init__.py'), 281s # ('c', 'cmake/cmake.py'), 281s # ('cm', 'cmakeModule.py'), 281s ("h", "hybrid/__init__.py"), 281s # ('h', 'hybrid/hybrid_cmake.dat'), 281s # ('h', 'hybrid/hybrid_cmake.py'), 281s ("h", "hybrid/hybrid_pure.dat"), 281s ("h", "hybrid/hybrid_pure.py"), 281s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 281s ("h", "hybrid/data/hybrid_data_pure.dat"), 281s ("h", "hybrid/hybrid_2/__init__.py"), 281s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 281s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 281s ("p", "hybrid/hybrid_2_pure/__init__.py"), 281s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 281s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 281s ("pm", "pureModule.py"), 281s ("p", "pure/__init__.py"), 281s ("p", "pure/pure.py"), 281s ("p", "pure/data/pure.dat"), 281s ] 281s ): 281s assert _type in {"p", "pm", "h"} 281s root = package_base if _type in {"p", "pm"} else cmake_source_dir 281s tmp_dir.ensure(os.path.join(root, path)) 281s 281s # Do not call the real setup function. Instead, replace it with 281s # a MagicMock allowing to check with which arguments it was invoked. 281s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 281s 281s # Convenience print function 281s def _pprint(desc, value=None): 281s print( 281s "-----------------\n" 281s f"{desc}:\n" 281s "\n" 281s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 281s ) 281s 281s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 281s 281s _pprint = ._pprint at 0x709a4420c540> 281s _type = 'p' 281s cmake_source_dir = '' 281s has_cmake_module = 0 281s has_cmake_package = 0 281s has_hybrid_package = 0 281s has_pure_module = 1 281s has_pure_package = 1 281s mock_setup = 281s mocker = 281s package_base = '' 281s package_base_dir = '' 281s path = 'pure/data/pure.dat' 281s path_types = ('p', 'pm') 281s root = '' 281s select_paths = .select_paths at 0x709a4420c400> 281s src_dir = local('/tmp/pytest-of-ubuntu/pytest-106/test_setup_inputs0') 281s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-106/test_setup_inputs0') 281s with_package_base = 0 281s 281s tests/test_setup.py:849: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-106/test_setup_inputs0') 281s setup_args = ['build'], disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-106/test_setup_inputs0') 281s setup_args = ['build'] 281s 281s tests/__init__.py:218: AttributeError 281s ________________________ test_setup_inputs[0-1-1-0-0-1] ________________________ 281s 281s has_cmake_package = 1, has_cmake_module = 0, has_hybrid_package = 0 281s has_pure_package = 1, has_pure_module = 1, with_package_base = 0 281s mocker = 281s 281s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 281s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 281s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 281s @pytest.mark.parametrize("has_pure_package", [0, 1]) 281s @pytest.mark.parametrize("has_pure_module", [0, 1]) 281s @pytest.mark.parametrize("with_package_base", [0, 1]) 281s def test_setup_inputs( 281s has_cmake_package, 281s has_cmake_module, 281s has_hybrid_package, 281s has_pure_package, 281s has_pure_module, 281s with_package_base, 281s mocker, 281s ): 281s """This test that a project can have a package with some modules 281s installed using setup.py and some other modules installed using CMake. 281s """ 281s 281s tmp_dir = _tmpdir("test_setup_inputs") 281s 281s package_base = "to/the/base" if with_package_base else "" 281s package_base_dir = package_base + "/" if package_base else "" 281s cmake_source_dir = package_base 281s 281s if cmake_source_dir and (has_cmake_package or has_cmake_module): 281s pytest.skip( 281s "unsupported configuration: " 281s "python package fully generated by CMake does *NOT* work. " 281s "At least __init__.py should be in the project source tree" 281s ) 281s 281s # ------------------------------------------------------------------------- 281s # Here is the "SOURCE" tree layout: 281s # 281s # ROOT/ 281s # 281s # setup.py 281s # 281s # [/] 281s # 281s # pureModule.py 281s # 281s # pure/ 281s # __init__.py 281s # pure.py 281s # 281s # data/ 281s # pure.dat 281s # 281s # [/] 281s # 281s # hybrid/ 281s # CMakeLists.txt 281s # __init__.py 281s # hybrid_pure.dat 281s # hybrid_pure.py 281s # 281s # data/ 281s # hybrid_data_pure.dat 281s # 281s # hybrid_2/ 281s # __init__.py 281s # hybrid_2_pure.py 281s # 281s # hybrid_2_pure/ 281s # __init__.py 281s # hybrid_2_pure_1.py 281s # hybrid_2_pure_2.py 281s # 281s # 281s # ------------------------------------------------------------------------- 281s # and here is the "BINARY" distribution layout: 281s # 281s # The comment "CMake" or "Setuptools" indicates which tool is responsible 281s # for placing the file in the tree used to create the binary distribution. 281s # 281s # ROOT/ 281s # 281s # cmakeModule.py # CMake 281s # 281s # cmake/ 281s # __init__.py # CMake 281s # cmake.py # CMake 281s # 281s # hybrid/ 281s # hybrid_cmake.dat # CMake 281s # hybrid_cmake.py # CMake 281s # hybrid_pure.dat # Setuptools 281s # hybrid_pure.py # Setuptools 281s # 281s # data/ 281s # hybrid_data_pure.dat # CMake or Setuptools 281s # hybrid_data_cmake.dat # CMake *NO TEST* 281s # 281s # hybrid_2/ 281s # __init__.py # CMake or Setuptools 281s # hybrid_2_pure.py # CMake or Setuptools 281s # hybrid_2_cmake.py # CMake 281s # 281s # hybrid_2_pure/ 281s # __init__.py # CMake or Setuptools 281s # hybrid_2_pure_1.py # CMake or Setuptools 281s # hybrid_2_pure_2.py # CMake or Setuptools 281s # 281s # pureModule.py # Setuptools 281s # 281s # pure/ 281s # __init__.py # Setuptools 281s # pure.py # Setuptools 281s # 281s # data/ 281s # pure.dat # Setuptools 281s 281s tmp_dir.join("setup.py").write( 281s textwrap.dedent( 281s """ 281s from skbuild import setup 281s #from setuptools import setup 281s setup( 281s name="test_hybrid_project", 281s version="1.2.3", 281s description=("an hybrid package mixing files installed by both " 281s "CMake and setuptools"), 281s author='The scikit-build team', 281s license="MIT", 281s cmake_source_dir='{cmake_source_dir}', 281s cmake_install_dir='{cmake_install_dir}', 281s # Arbitrary order of packages 281s packages=[ 281s {p_off} 'pure', 281s {h_off} 'hybrid.hybrid_2', 281s {h_off} 'hybrid', 281s {c_off} 'cmake', 281s {p_off} 'hybrid.hybrid_2_pure', 281s ], 281s py_modules=[ 281s {pm_off} '{package_base}pureModule', 281s {cm_off} '{package_base}cmakeModule', 281s ], 281s package_data={{ 281s {p_off} 'pure': ['data/pure.dat'], 281s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 281s }}, 281s # Arbitrary order of package_dir 281s package_dir = {{ 281s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 281s {p_off} 'pure': '{package_base}pure', 281s {h_off} 'hybrid': '{package_base}hybrid', 281s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 281s {c_off} 'cmake': '{package_base}cmake', 281s }} 281s ) 281s """.format( 281s cmake_source_dir=cmake_source_dir, 281s cmake_install_dir=package_base, 281s package_base=package_base_dir, 281s c_off="" if has_cmake_package else "#", 281s cm_off="" if has_cmake_module else "#", 281s h_off="" if has_hybrid_package else "#", 281s p_off="" if has_pure_package else "#", 281s pm_off="" if has_pure_module else "#", 281s ) 281s ) 281s ) 281s 281s src_dir = tmp_dir.ensure(package_base, dir=1) 281s 281s src_dir.join("CMakeLists.txt").write( 281s textwrap.dedent( 281s """ 281s cmake_minimum_required(VERSION 3.5.0) 281s project(hybrid NONE) 281s set(build_dir ${{CMAKE_BINARY_DIR}}) 281s 281s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 281s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 281s {c_off} install( 281s {c_off} FILES 281s {c_off} ${{build_dir}}/__init__.py 281s {c_off} ${{build_dir}}/cmake.py 281s {c_off} DESTINATION cmake 281s {c_off} ) 281s 281s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 281s {cm_off} install( 281s {cm_off} FILES ${{build_dir}}/cmakeModule.py 281s {cm_off} DESTINATION .) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 281s {h_off} DESTINATION hybrid) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 281s {h_off} DESTINATION hybrid) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 281s {h_off} DESTINATION hybrid/data) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 281s {h_off} DESTINATION hybrid/hybrid_2) 281s 281s install(CODE "message(STATUS \\\"Installation complete\\\")") 281s """.format( 281s c_off="" if has_cmake_package else "#", 281s cm_off="" if has_cmake_module else "#", 281s h_off="" if has_hybrid_package else "#", 281s ) 281s ) 281s ) 281s 281s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 281s path_types: Sequence[str] 281s try: 281s path_types = next( 281s iter( 281s zip( 281s *filter( 281s lambda i: i[1], 281s [ 281s ("c", has_cmake_package), 281s ("cm", has_cmake_module), 281s ("h", has_hybrid_package), 281s ("p", has_pure_package), 281s ("pm", has_pure_module), 281s ], 281s ) 281s ) 281s ) 281s ) 281s except StopIteration: 281s path_types = [] 281s 281s def select_paths(annotated_paths): 281s """Return a filtered list paths considering ``path_types``. 281s 281s `annotated_paths`` is list of tuple ``(type, path)`` where type 281s is either `c`, 'cm', `h`, `p` or 'pm'. 281s 281s """ 281s return filter(lambda i: i[0] in path_types, annotated_paths) 281s 281s # Commented paths are the one expected to be installed by CMake. For 281s # this reason, corresponding files should NOT be created in the source 281s # tree. 281s for _type, path in select_paths( 281s [ 281s # ('c', 'cmake/__init__.py'), 281s # ('c', 'cmake/cmake.py'), 281s # ('cm', 'cmakeModule.py'), 281s ("h", "hybrid/__init__.py"), 281s # ('h', 'hybrid/hybrid_cmake.dat'), 281s # ('h', 'hybrid/hybrid_cmake.py'), 281s ("h", "hybrid/hybrid_pure.dat"), 281s ("h", "hybrid/hybrid_pure.py"), 281s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 281s ("h", "hybrid/data/hybrid_data_pure.dat"), 281s ("h", "hybrid/hybrid_2/__init__.py"), 281s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 281s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 281s ("p", "hybrid/hybrid_2_pure/__init__.py"), 281s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 281s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 281s ("pm", "pureModule.py"), 281s ("p", "pure/__init__.py"), 281s ("p", "pure/pure.py"), 281s ("p", "pure/data/pure.dat"), 281s ] 281s ): 281s assert _type in {"p", "pm", "h"} 281s root = package_base if _type in {"p", "pm"} else cmake_source_dir 281s tmp_dir.ensure(os.path.join(root, path)) 281s 281s # Do not call the real setup function. Instead, replace it with 281s # a MagicMock allowing to check with which arguments it was invoked. 281s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 281s 281s # Convenience print function 281s def _pprint(desc, value=None): 281s print( 281s "-----------------\n" 281s f"{desc}:\n" 281s "\n" 281s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 281s ) 281s 281s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 281s 281s _pprint = ._pprint at 0x709a44384360> 281s _type = 'p' 281s cmake_source_dir = '' 281s has_cmake_module = 0 281s has_cmake_package = 1 281s has_hybrid_package = 0 281s has_pure_module = 1 281s has_pure_package = 1 281s mock_setup = 281s mocker = 281s package_base = '' 281s package_base_dir = '' 281s path = 'pure/data/pure.dat' 281s path_types = ('c', 'p', 'pm') 281s root = '' 281s select_paths = .select_paths at 0x709a443867a0> 281s src_dir = local('/tmp/pytest-of-ubuntu/pytest-107/test_setup_inputs0') 281s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-107/test_setup_inputs0') 281s with_package_base = 0 281s 281s tests/test_setup.py:849: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-107/test_setup_inputs0') 281s setup_args = ['build'], disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-107/test_setup_inputs0') 281s setup_args = ['build'] 281s 281s tests/__init__.py:218: AttributeError 281s ________________________ test_setup_inputs[0-1-1-0-1-0] ________________________ 281s 281s has_cmake_package = 0, has_cmake_module = 1, has_hybrid_package = 0 281s has_pure_package = 1, has_pure_module = 1, with_package_base = 0 281s mocker = 281s 281s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 281s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 281s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 281s @pytest.mark.parametrize("has_pure_package", [0, 1]) 281s @pytest.mark.parametrize("has_pure_module", [0, 1]) 281s @pytest.mark.parametrize("with_package_base", [0, 1]) 281s def test_setup_inputs( 281s has_cmake_package, 281s has_cmake_module, 281s has_hybrid_package, 281s has_pure_package, 281s has_pure_module, 281s with_package_base, 281s mocker, 281s ): 281s """This test that a project can have a package with some modules 281s installed using setup.py and some other modules installed using CMake. 281s """ 281s 281s tmp_dir = _tmpdir("test_setup_inputs") 281s 281s package_base = "to/the/base" if with_package_base else "" 281s package_base_dir = package_base + "/" if package_base else "" 281s cmake_source_dir = package_base 281s 281s if cmake_source_dir and (has_cmake_package or has_cmake_module): 281s pytest.skip( 281s "unsupported configuration: " 281s "python package fully generated by CMake does *NOT* work. " 281s "At least __init__.py should be in the project source tree" 281s ) 281s 281s # ------------------------------------------------------------------------- 281s # Here is the "SOURCE" tree layout: 281s # 281s # ROOT/ 281s # 281s # setup.py 281s # 281s # [/] 281s # 281s # pureModule.py 281s # 281s # pure/ 281s # __init__.py 281s # pure.py 281s # 281s # data/ 281s # pure.dat 281s # 281s # [/] 281s # 281s # hybrid/ 281s # CMakeLists.txt 281s # __init__.py 281s # hybrid_pure.dat 281s # hybrid_pure.py 281s # 281s # data/ 281s # hybrid_data_pure.dat 281s # 281s # hybrid_2/ 281s # __init__.py 281s # hybrid_2_pure.py 281s # 281s # hybrid_2_pure/ 281s # __init__.py 281s # hybrid_2_pure_1.py 281s # hybrid_2_pure_2.py 281s # 281s # 281s # ------------------------------------------------------------------------- 281s # and here is the "BINARY" distribution layout: 281s # 281s # The comment "CMake" or "Setuptools" indicates which tool is responsible 281s # for placing the file in the tree used to create the binary distribution. 281s # 281s # ROOT/ 281s # 281s # cmakeModule.py # CMake 281s # 281s # cmake/ 281s # __init__.py # CMake 281s # cmake.py # CMake 281s # 281s # hybrid/ 281s # hybrid_cmake.dat # CMake 281s # hybrid_cmake.py # CMake 281s # hybrid_pure.dat # Setuptools 281s # hybrid_pure.py # Setuptools 281s # 281s # data/ 281s # hybrid_data_pure.dat # CMake or Setuptools 281s # hybrid_data_cmake.dat # CMake *NO TEST* 281s # 281s # hybrid_2/ 281s # __init__.py # CMake or Setuptools 281s # hybrid_2_pure.py # CMake or Setuptools 281s # hybrid_2_cmake.py # CMake 281s # 281s # hybrid_2_pure/ 281s # __init__.py # CMake or Setuptools 281s # hybrid_2_pure_1.py # CMake or Setuptools 281s # hybrid_2_pure_2.py # CMake or Setuptools 281s # 281s # pureModule.py # Setuptools 281s # 281s # pure/ 281s # __init__.py # Setuptools 281s # pure.py # Setuptools 281s # 281s # data/ 281s # pure.dat # Setuptools 281s 281s tmp_dir.join("setup.py").write( 281s textwrap.dedent( 281s """ 281s from skbuild import setup 281s #from setuptools import setup 281s setup( 281s name="test_hybrid_project", 281s version="1.2.3", 281s description=("an hybrid package mixing files installed by both " 281s "CMake and setuptools"), 281s author='The scikit-build team', 281s license="MIT", 281s cmake_source_dir='{cmake_source_dir}', 281s cmake_install_dir='{cmake_install_dir}', 281s # Arbitrary order of packages 281s packages=[ 281s {p_off} 'pure', 281s {h_off} 'hybrid.hybrid_2', 281s {h_off} 'hybrid', 281s {c_off} 'cmake', 281s {p_off} 'hybrid.hybrid_2_pure', 281s ], 281s py_modules=[ 281s {pm_off} '{package_base}pureModule', 281s {cm_off} '{package_base}cmakeModule', 281s ], 281s package_data={{ 281s {p_off} 'pure': ['data/pure.dat'], 281s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 281s }}, 281s # Arbitrary order of package_dir 281s package_dir = {{ 281s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 281s {p_off} 'pure': '{package_base}pure', 281s {h_off} 'hybrid': '{package_base}hybrid', 281s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 281s {c_off} 'cmake': '{package_base}cmake', 281s }} 281s ) 281s """.format( 281s cmake_source_dir=cmake_source_dir, 281s cmake_install_dir=package_base, 281s package_base=package_base_dir, 281s c_off="" if has_cmake_package else "#", 281s cm_off="" if has_cmake_module else "#", 281s h_off="" if has_hybrid_package else "#", 281s p_off="" if has_pure_package else "#", 281s pm_off="" if has_pure_module else "#", 281s ) 281s ) 281s ) 281s 281s src_dir = tmp_dir.ensure(package_base, dir=1) 281s 281s src_dir.join("CMakeLists.txt").write( 281s textwrap.dedent( 281s """ 281s cmake_minimum_required(VERSION 3.5.0) 281s project(hybrid NONE) 281s set(build_dir ${{CMAKE_BINARY_DIR}}) 281s 281s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 281s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 281s {c_off} install( 281s {c_off} FILES 281s {c_off} ${{build_dir}}/__init__.py 281s {c_off} ${{build_dir}}/cmake.py 281s {c_off} DESTINATION cmake 281s {c_off} ) 281s 281s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 281s {cm_off} install( 281s {cm_off} FILES ${{build_dir}}/cmakeModule.py 281s {cm_off} DESTINATION .) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 281s {h_off} DESTINATION hybrid) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 281s {h_off} DESTINATION hybrid) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 281s {h_off} DESTINATION hybrid/data) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 281s {h_off} DESTINATION hybrid/hybrid_2) 281s 281s install(CODE "message(STATUS \\\"Installation complete\\\")") 281s """.format( 281s c_off="" if has_cmake_package else "#", 281s cm_off="" if has_cmake_module else "#", 281s h_off="" if has_hybrid_package else "#", 281s ) 281s ) 281s ) 281s 281s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 281s path_types: Sequence[str] 281s try: 281s path_types = next( 281s iter( 281s zip( 281s *filter( 281s lambda i: i[1], 281s [ 281s ("c", has_cmake_package), 281s ("cm", has_cmake_module), 281s ("h", has_hybrid_package), 281s ("p", has_pure_package), 281s ("pm", has_pure_module), 281s ], 281s ) 281s ) 281s ) 281s ) 281s except StopIteration: 281s path_types = [] 281s 281s def select_paths(annotated_paths): 281s """Return a filtered list paths considering ``path_types``. 281s 281s `annotated_paths`` is list of tuple ``(type, path)`` where type 281s is either `c`, 'cm', `h`, `p` or 'pm'. 281s 281s """ 281s return filter(lambda i: i[0] in path_types, annotated_paths) 281s 281s # Commented paths are the one expected to be installed by CMake. For 281s # this reason, corresponding files should NOT be created in the source 281s # tree. 281s for _type, path in select_paths( 281s [ 281s # ('c', 'cmake/__init__.py'), 281s # ('c', 'cmake/cmake.py'), 281s # ('cm', 'cmakeModule.py'), 281s ("h", "hybrid/__init__.py"), 281s # ('h', 'hybrid/hybrid_cmake.dat'), 281s # ('h', 'hybrid/hybrid_cmake.py'), 281s ("h", "hybrid/hybrid_pure.dat"), 281s ("h", "hybrid/hybrid_pure.py"), 281s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 281s ("h", "hybrid/data/hybrid_data_pure.dat"), 281s ("h", "hybrid/hybrid_2/__init__.py"), 281s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 281s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 281s ("p", "hybrid/hybrid_2_pure/__init__.py"), 281s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 281s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 281s ("pm", "pureModule.py"), 281s ("p", "pure/__init__.py"), 281s ("p", "pure/pure.py"), 281s ("p", "pure/data/pure.dat"), 281s ] 281s ): 281s assert _type in {"p", "pm", "h"} 281s root = package_base if _type in {"p", "pm"} else cmake_source_dir 281s tmp_dir.ensure(os.path.join(root, path)) 281s 281s # Do not call the real setup function. Instead, replace it with 281s # a MagicMock allowing to check with which arguments it was invoked. 281s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 281s 281s # Convenience print function 281s def _pprint(desc, value=None): 281s print( 281s "-----------------\n" 281s f"{desc}:\n" 281s "\n" 281s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 281s ) 281s 281s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 281s 281s _pprint = ._pprint at 0x709a44481e40> 281s _type = 'p' 281s cmake_source_dir = '' 281s has_cmake_module = 1 281s has_cmake_package = 0 281s has_hybrid_package = 0 281s has_pure_module = 1 281s has_pure_package = 1 281s mock_setup = 281s mocker = 281s package_base = '' 281s package_base_dir = '' 281s path = 'pure/data/pure.dat' 281s path_types = ('cm', 'p', 'pm') 281s root = '' 281s select_paths = .select_paths at 0x709a44386520> 281s src_dir = local('/tmp/pytest-of-ubuntu/pytest-108/test_setup_inputs0') 281s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-108/test_setup_inputs0') 281s with_package_base = 0 281s 281s tests/test_setup.py:849: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-108/test_setup_inputs0') 281s setup_args = ['build'], disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-108/test_setup_inputs0') 281s setup_args = ['build'] 281s 281s tests/__init__.py:218: AttributeError 281s ________________________ test_setup_inputs[0-1-1-0-1-1] ________________________ 281s 281s has_cmake_package = 1, has_cmake_module = 1, has_hybrid_package = 0 281s has_pure_package = 1, has_pure_module = 1, with_package_base = 0 281s mocker = 281s 281s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 281s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 281s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 281s @pytest.mark.parametrize("has_pure_package", [0, 1]) 281s @pytest.mark.parametrize("has_pure_module", [0, 1]) 281s @pytest.mark.parametrize("with_package_base", [0, 1]) 281s def test_setup_inputs( 281s has_cmake_package, 281s has_cmake_module, 281s has_hybrid_package, 281s has_pure_package, 281s has_pure_module, 281s with_package_base, 281s mocker, 281s ): 281s """This test that a project can have a package with some modules 281s installed using setup.py and some other modules installed using CMake. 281s """ 281s 281s tmp_dir = _tmpdir("test_setup_inputs") 281s 281s package_base = "to/the/base" if with_package_base else "" 281s package_base_dir = package_base + "/" if package_base else "" 281s cmake_source_dir = package_base 281s 281s if cmake_source_dir and (has_cmake_package or has_cmake_module): 281s pytest.skip( 281s "unsupported configuration: " 281s "python package fully generated by CMake does *NOT* work. " 281s "At least __init__.py should be in the project source tree" 281s ) 281s 281s # ------------------------------------------------------------------------- 281s # Here is the "SOURCE" tree layout: 281s # 281s # ROOT/ 281s # 281s # setup.py 281s # 281s # [/] 281s # 281s # pureModule.py 281s # 281s # pure/ 281s # __init__.py 281s # pure.py 281s # 281s # data/ 281s # pure.dat 281s # 281s # [/] 281s # 281s # hybrid/ 281s # CMakeLists.txt 281s # __init__.py 281s # hybrid_pure.dat 281s # hybrid_pure.py 281s # 281s # data/ 281s # hybrid_data_pure.dat 281s # 281s # hybrid_2/ 281s # __init__.py 281s # hybrid_2_pure.py 281s # 281s # hybrid_2_pure/ 281s # __init__.py 281s # hybrid_2_pure_1.py 281s # hybrid_2_pure_2.py 281s # 281s # 281s # ------------------------------------------------------------------------- 281s # and here is the "BINARY" distribution layout: 281s # 281s # The comment "CMake" or "Setuptools" indicates which tool is responsible 281s # for placing the file in the tree used to create the binary distribution. 281s # 281s # ROOT/ 281s # 281s # cmakeModule.py # CMake 281s # 281s # cmake/ 281s # __init__.py # CMake 281s # cmake.py # CMake 281s # 281s # hybrid/ 281s # hybrid_cmake.dat # CMake 281s # hybrid_cmake.py # CMake 281s # hybrid_pure.dat # Setuptools 281s # hybrid_pure.py # Setuptools 281s # 281s # data/ 281s # hybrid_data_pure.dat # CMake or Setuptools 281s # hybrid_data_cmake.dat # CMake *NO TEST* 281s # 281s # hybrid_2/ 281s # __init__.py # CMake or Setuptools 281s # hybrid_2_pure.py # CMake or Setuptools 281s # hybrid_2_cmake.py # CMake 281s # 281s # hybrid_2_pure/ 281s # __init__.py # CMake or Setuptools 281s # hybrid_2_pure_1.py # CMake or Setuptools 281s # hybrid_2_pure_2.py # CMake or Setuptools 281s # 281s # pureModule.py # Setuptools 281s # 281s # pure/ 281s # __init__.py # Setuptools 281s # pure.py # Setuptools 281s # 281s # data/ 281s # pure.dat # Setuptools 281s 281s tmp_dir.join("setup.py").write( 281s textwrap.dedent( 281s """ 281s from skbuild import setup 281s #from setuptools import setup 281s setup( 281s name="test_hybrid_project", 281s version="1.2.3", 281s description=("an hybrid package mixing files installed by both " 281s "CMake and setuptools"), 281s author='The scikit-build team', 281s license="MIT", 281s cmake_source_dir='{cmake_source_dir}', 281s cmake_install_dir='{cmake_install_dir}', 281s # Arbitrary order of packages 281s packages=[ 281s {p_off} 'pure', 281s {h_off} 'hybrid.hybrid_2', 281s {h_off} 'hybrid', 281s {c_off} 'cmake', 281s {p_off} 'hybrid.hybrid_2_pure', 281s ], 281s py_modules=[ 281s {pm_off} '{package_base}pureModule', 281s {cm_off} '{package_base}cmakeModule', 281s ], 281s package_data={{ 281s {p_off} 'pure': ['data/pure.dat'], 281s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 281s }}, 281s # Arbitrary order of package_dir 281s package_dir = {{ 281s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 281s {p_off} 'pure': '{package_base}pure', 281s {h_off} 'hybrid': '{package_base}hybrid', 281s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 281s {c_off} 'cmake': '{package_base}cmake', 281s }} 281s ) 281s """.format( 281s cmake_source_dir=cmake_source_dir, 281s cmake_install_dir=package_base, 281s package_base=package_base_dir, 281s c_off="" if has_cmake_package else "#", 281s cm_off="" if has_cmake_module else "#", 281s h_off="" if has_hybrid_package else "#", 281s p_off="" if has_pure_package else "#", 281s pm_off="" if has_pure_module else "#", 281s ) 281s ) 281s ) 281s 281s src_dir = tmp_dir.ensure(package_base, dir=1) 281s 281s src_dir.join("CMakeLists.txt").write( 281s textwrap.dedent( 281s """ 281s cmake_minimum_required(VERSION 3.5.0) 281s project(hybrid NONE) 281s set(build_dir ${{CMAKE_BINARY_DIR}}) 281s 281s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 281s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 281s {c_off} install( 281s {c_off} FILES 281s {c_off} ${{build_dir}}/__init__.py 281s {c_off} ${{build_dir}}/cmake.py 281s {c_off} DESTINATION cmake 281s {c_off} ) 281s 281s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 281s {cm_off} install( 281s {cm_off} FILES ${{build_dir}}/cmakeModule.py 281s {cm_off} DESTINATION .) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 281s {h_off} DESTINATION hybrid) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 281s {h_off} DESTINATION hybrid) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 281s {h_off} DESTINATION hybrid/data) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 281s {h_off} DESTINATION hybrid/hybrid_2) 281s 281s install(CODE "message(STATUS \\\"Installation complete\\\")") 281s """.format( 281s c_off="" if has_cmake_package else "#", 281s cm_off="" if has_cmake_module else "#", 281s h_off="" if has_hybrid_package else "#", 281s ) 281s ) 281s ) 281s 281s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 281s path_types: Sequence[str] 281s try: 281s path_types = next( 281s iter( 281s zip( 281s *filter( 281s lambda i: i[1], 281s [ 281s ("c", has_cmake_package), 281s ("cm", has_cmake_module), 281s ("h", has_hybrid_package), 281s ("p", has_pure_package), 281s ("pm", has_pure_module), 281s ], 281s ) 281s ) 281s ) 281s ) 281s except StopIteration: 281s path_types = [] 281s 281s def select_paths(annotated_paths): 281s """Return a filtered list paths considering ``path_types``. 281s 281s `annotated_paths`` is list of tuple ``(type, path)`` where type 281s is either `c`, 'cm', `h`, `p` or 'pm'. 281s 281s """ 281s return filter(lambda i: i[0] in path_types, annotated_paths) 281s 281s # Commented paths are the one expected to be installed by CMake. For 281s # this reason, corresponding files should NOT be created in the source 281s # tree. 281s for _type, path in select_paths( 281s [ 281s # ('c', 'cmake/__init__.py'), 281s # ('c', 'cmake/cmake.py'), 281s # ('cm', 'cmakeModule.py'), 281s ("h", "hybrid/__init__.py"), 281s # ('h', 'hybrid/hybrid_cmake.dat'), 281s # ('h', 'hybrid/hybrid_cmake.py'), 281s ("h", "hybrid/hybrid_pure.dat"), 281s ("h", "hybrid/hybrid_pure.py"), 281s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 281s ("h", "hybrid/data/hybrid_data_pure.dat"), 281s ("h", "hybrid/hybrid_2/__init__.py"), 281s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 281s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 281s ("p", "hybrid/hybrid_2_pure/__init__.py"), 281s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 281s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 281s ("pm", "pureModule.py"), 281s ("p", "pure/__init__.py"), 281s ("p", "pure/pure.py"), 281s ("p", "pure/data/pure.dat"), 281s ] 281s ): 281s assert _type in {"p", "pm", "h"} 281s root = package_base if _type in {"p", "pm"} else cmake_source_dir 281s tmp_dir.ensure(os.path.join(root, path)) 281s 281s # Do not call the real setup function. Instead, replace it with 281s # a MagicMock allowing to check with which arguments it was invoked. 281s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 281s 281s # Convenience print function 281s def _pprint(desc, value=None): 281s print( 281s "-----------------\n" 281s f"{desc}:\n" 281s "\n" 281s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 281s ) 281s 281s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 281s 281s _pprint = ._pprint at 0x709a4420c5e0> 281s _type = 'p' 281s cmake_source_dir = '' 281s has_cmake_module = 1 281s has_cmake_package = 1 281s has_hybrid_package = 0 281s has_pure_module = 1 281s has_pure_package = 1 281s mock_setup = 281s mocker = 281s package_base = '' 281s package_base_dir = '' 281s path = 'pure/data/pure.dat' 281s path_types = ('c', 'cm', 'p', 'pm') 281s root = '' 281s select_paths = .select_paths at 0x709a4420c4a0> 281s src_dir = local('/tmp/pytest-of-ubuntu/pytest-109/test_setup_inputs0') 281s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-109/test_setup_inputs0') 281s with_package_base = 0 281s 281s tests/test_setup.py:849: 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s /usr/lib/python3.12/contextlib.py:137: in __enter__ 281s return next(self.gen) 281s self = 281s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 281s 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-109/test_setup_inputs0') 281s setup_args = ['build'], disable_languages_test = True 281s 281s @contextmanager 281s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 281s """Context manager executing ``setup.py`` with the given arguments. 281s 281s It yields after changing the current working directory 281s to ``project_dir``. 281s """ 281s 281s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 281s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 281s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 281s 281s disable_languages_test = True 281s project_dir = local('/tmp/pytest-of-ubuntu/pytest-109/test_setup_inputs0') 281s setup_args = ['build'] 281s 281s tests/__init__.py:218: AttributeError 281s ________________________ test_setup_inputs[0-1-1-1-0-0] ________________________ 281s 281s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 1 281s has_pure_package = 1, has_pure_module = 1, with_package_base = 0 281s mocker = 281s 281s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 281s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 281s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 281s @pytest.mark.parametrize("has_pure_package", [0, 1]) 281s @pytest.mark.parametrize("has_pure_module", [0, 1]) 281s @pytest.mark.parametrize("with_package_base", [0, 1]) 281s def test_setup_inputs( 281s has_cmake_package, 281s has_cmake_module, 281s has_hybrid_package, 281s has_pure_package, 281s has_pure_module, 281s with_package_base, 281s mocker, 281s ): 281s """This test that a project can have a package with some modules 281s installed using setup.py and some other modules installed using CMake. 281s """ 281s 281s tmp_dir = _tmpdir("test_setup_inputs") 281s 281s package_base = "to/the/base" if with_package_base else "" 281s package_base_dir = package_base + "/" if package_base else "" 281s cmake_source_dir = package_base 281s 281s if cmake_source_dir and (has_cmake_package or has_cmake_module): 281s pytest.skip( 281s "unsupported configuration: " 281s "python package fully generated by CMake does *NOT* work. " 281s "At least __init__.py should be in the project source tree" 281s ) 281s 281s # ------------------------------------------------------------------------- 281s # Here is the "SOURCE" tree layout: 281s # 281s # ROOT/ 281s # 281s # setup.py 281s # 281s # [/] 281s # 281s # pureModule.py 281s # 281s # pure/ 281s # __init__.py 281s # pure.py 281s # 281s # data/ 281s # pure.dat 281s # 281s # [/] 281s # 281s # hybrid/ 281s # CMakeLists.txt 281s # __init__.py 281s # hybrid_pure.dat 281s # hybrid_pure.py 281s # 281s # data/ 281s # hybrid_data_pure.dat 281s # 281s # hybrid_2/ 281s # __init__.py 281s # hybrid_2_pure.py 281s # 281s # hybrid_2_pure/ 281s # __init__.py 281s # hybrid_2_pure_1.py 281s # hybrid_2_pure_2.py 281s # 281s # 281s # ------------------------------------------------------------------------- 281s # and here is the "BINARY" distribution layout: 281s # 281s # The comment "CMake" or "Setuptools" indicates which tool is responsible 281s # for placing the file in the tree used to create the binary distribution. 281s # 281s # ROOT/ 281s # 281s # cmakeModule.py # CMake 281s # 281s # cmake/ 281s # __init__.py # CMake 281s # cmake.py # CMake 281s # 281s # hybrid/ 281s # hybrid_cmake.dat # CMake 281s # hybrid_cmake.py # CMake 281s # hybrid_pure.dat # Setuptools 281s # hybrid_pure.py # Setuptools 281s # 281s # data/ 281s # hybrid_data_pure.dat # CMake or Setuptools 281s # hybrid_data_cmake.dat # CMake *NO TEST* 281s # 281s # hybrid_2/ 281s # __init__.py # CMake or Setuptools 281s # hybrid_2_pure.py # CMake or Setuptools 281s # hybrid_2_cmake.py # CMake 281s # 281s # hybrid_2_pure/ 281s # __init__.py # CMake or Setuptools 281s # hybrid_2_pure_1.py # CMake or Setuptools 281s # hybrid_2_pure_2.py # CMake or Setuptools 281s # 281s # pureModule.py # Setuptools 281s # 281s # pure/ 281s # __init__.py # Setuptools 281s # pure.py # Setuptools 281s # 281s # data/ 281s # pure.dat # Setuptools 281s 281s tmp_dir.join("setup.py").write( 281s textwrap.dedent( 281s """ 281s from skbuild import setup 281s #from setuptools import setup 281s setup( 281s name="test_hybrid_project", 281s version="1.2.3", 281s description=("an hybrid package mixing files installed by both " 281s "CMake and setuptools"), 281s author='The scikit-build team', 281s license="MIT", 281s cmake_source_dir='{cmake_source_dir}', 281s cmake_install_dir='{cmake_install_dir}', 281s # Arbitrary order of packages 281s packages=[ 281s {p_off} 'pure', 281s {h_off} 'hybrid.hybrid_2', 281s {h_off} 'hybrid', 281s {c_off} 'cmake', 281s {p_off} 'hybrid.hybrid_2_pure', 281s ], 281s py_modules=[ 281s {pm_off} '{package_base}pureModule', 281s {cm_off} '{package_base}cmakeModule', 281s ], 281s package_data={{ 281s {p_off} 'pure': ['data/pure.dat'], 281s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 281s }}, 281s # Arbitrary order of package_dir 281s package_dir = {{ 281s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 281s {p_off} 'pure': '{package_base}pure', 281s {h_off} 'hybrid': '{package_base}hybrid', 281s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 281s {c_off} 'cmake': '{package_base}cmake', 281s }} 281s ) 281s """.format( 281s cmake_source_dir=cmake_source_dir, 281s cmake_install_dir=package_base, 281s package_base=package_base_dir, 281s c_off="" if has_cmake_package else "#", 281s cm_off="" if has_cmake_module else "#", 281s h_off="" if has_hybrid_package else "#", 281s p_off="" if has_pure_package else "#", 281s pm_off="" if has_pure_module else "#", 281s ) 281s ) 281s ) 281s 281s src_dir = tmp_dir.ensure(package_base, dir=1) 281s 281s src_dir.join("CMakeLists.txt").write( 281s textwrap.dedent( 281s """ 281s cmake_minimum_required(VERSION 3.5.0) 281s project(hybrid NONE) 281s set(build_dir ${{CMAKE_BINARY_DIR}}) 281s 281s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 281s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 281s {c_off} install( 281s {c_off} FILES 281s {c_off} ${{build_dir}}/__init__.py 281s {c_off} ${{build_dir}}/cmake.py 281s {c_off} DESTINATION cmake 281s {c_off} ) 281s 281s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 281s {cm_off} install( 281s {cm_off} FILES ${{build_dir}}/cmakeModule.py 281s {cm_off} DESTINATION .) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 281s {h_off} DESTINATION hybrid) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 281s {h_off} DESTINATION hybrid) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 281s {h_off} DESTINATION hybrid/data) 281s 281s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 281s {h_off} install( 281s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 281s {h_off} DESTINATION hybrid/hybrid_2) 281s 281s install(CODE "message(STATUS \\\"Installation complete\\\")") 281s """.format( 281s c_off="" if has_cmake_package else "#", 281s cm_off="" if has_cmake_module else "#", 281s h_off="" if has_hybrid_package else "#", 281s ) 281s ) 281s ) 281s 281s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 281s path_types: Sequence[str] 281s try: 281s path_types = next( 281s iter( 281s zip( 281s *filter( 281s lambda i: i[1], 281s [ 281s ("c", has_cmake_package), 281s ("cm", has_cmake_module), 281s ("h", has_hybrid_package), 281s ("p", has_pure_package), 281s ("pm", has_pure_module), 281s ], 281s ) 281s ) 281s ) 281s ) 281s except StopIteration: 281s path_types = [] 281s 281s def select_paths(annotated_paths): 281s """Return a filtered list paths considering ``path_types``. 281s 281s `annotated_paths`` is list of tuple ``(type, path)`` where type 281s is either `c`, 'cm', `h`, `p` or 'pm'. 281s 281s """ 281s return filter(lambda i: i[0] in path_types, annotated_paths) 281s 281s # Commented paths are the one expected to be installed by CMake. For 281s # this reason, corresponding files should NOT be created in the source 281s # tree. 281s for _type, path in select_paths( 281s [ 281s # ('c', 'cmake/__init__.py'), 281s # ('c', 'cmake/cmake.py'), 281s # ('cm', 'cmakeModule.py'), 281s ("h", "hybrid/__init__.py"), 281s # ('h', 'hybrid/hybrid_cmake.dat'), 281s # ('h', 'hybrid/hybrid_cmake.py'), 281s ("h", "hybrid/hybrid_pure.dat"), 281s ("h", "hybrid/hybrid_pure.py"), 281s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 281s ("h", "hybrid/data/hybrid_data_pure.dat"), 281s ("h", "hybrid/hybrid_2/__init__.py"), 281s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 281s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 281s ("p", "hybrid/hybrid_2_pure/__init__.py"), 282s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 282s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 282s ("pm", "pureModule.py"), 282s ("p", "pure/__init__.py"), 282s ("p", "pure/pure.py"), 282s ("p", "pure/data/pure.dat"), 282s ] 282s ): 282s assert _type in {"p", "pm", "h"} 282s root = package_base if _type in {"p", "pm"} else cmake_source_dir 282s tmp_dir.ensure(os.path.join(root, path)) 282s 282s # Do not call the real setup function. Instead, replace it with 282s # a MagicMock allowing to check with which arguments it was invoked. 282s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 282s 282s # Convenience print function 282s def _pprint(desc, value=None): 282s print( 282s "-----------------\n" 282s f"{desc}:\n" 282s "\n" 282s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 282s ) 282s 282s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 282s 282s _pprint = ._pprint at 0x709a4420d1c0> 282s _type = 'p' 282s cmake_source_dir = '' 282s has_cmake_module = 0 282s has_cmake_package = 0 282s has_hybrid_package = 1 282s has_pure_module = 1 282s has_pure_package = 1 282s mock_setup = 282s mocker = 282s package_base = '' 282s package_base_dir = '' 282s path = 'pure/data/pure.dat' 282s path_types = ('h', 'p', 'pm') 282s root = '' 282s select_paths = .select_paths at 0x709a4420cfe0> 282s src_dir = local('/tmp/pytest-of-ubuntu/pytest-110/test_setup_inputs0') 282s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-110/test_setup_inputs0') 282s with_package_base = 0 282s 282s tests/test_setup.py:849: 282s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 282s /usr/lib/python3.12/contextlib.py:137: in __enter__ 282s return next(self.gen) 282s self = 282s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 282s 282s project_dir = local('/tmp/pytest-of-ubuntu/pytest-110/test_setup_inputs0') 282s setup_args = ['build'], disable_languages_test = True 282s 282s @contextmanager 282s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 282s """Context manager executing ``setup.py`` with the given arguments. 282s 282s It yields after changing the current working directory 282s to ``project_dir``. 282s """ 282s 282s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 282s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 282s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 282s 282s disable_languages_test = True 282s project_dir = local('/tmp/pytest-of-ubuntu/pytest-110/test_setup_inputs0') 282s setup_args = ['build'] 282s 282s tests/__init__.py:218: AttributeError 282s ________________________ test_setup_inputs[0-1-1-1-0-1] ________________________ 282s 282s has_cmake_package = 1, has_cmake_module = 0, has_hybrid_package = 1 282s has_pure_package = 1, has_pure_module = 1, with_package_base = 0 282s mocker = 282s 282s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 282s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 282s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 282s @pytest.mark.parametrize("has_pure_package", [0, 1]) 282s @pytest.mark.parametrize("has_pure_module", [0, 1]) 282s @pytest.mark.parametrize("with_package_base", [0, 1]) 282s def test_setup_inputs( 282s has_cmake_package, 282s has_cmake_module, 282s has_hybrid_package, 282s has_pure_package, 282s has_pure_module, 282s with_package_base, 282s mocker, 282s ): 282s """This test that a project can have a package with some modules 282s installed using setup.py and some other modules installed using CMake. 282s """ 282s 282s tmp_dir = _tmpdir("test_setup_inputs") 282s 282s package_base = "to/the/base" if with_package_base else "" 282s package_base_dir = package_base + "/" if package_base else "" 282s cmake_source_dir = package_base 282s 282s if cmake_source_dir and (has_cmake_package or has_cmake_module): 282s pytest.skip( 282s "unsupported configuration: " 282s "python package fully generated by CMake does *NOT* work. " 282s "At least __init__.py should be in the project source tree" 282s ) 282s 282s # ------------------------------------------------------------------------- 282s # Here is the "SOURCE" tree layout: 282s # 282s # ROOT/ 282s # 282s # setup.py 282s # 282s # [/] 282s # 282s # pureModule.py 282s # 282s # pure/ 282s # __init__.py 282s # pure.py 282s # 282s # data/ 282s # pure.dat 282s # 282s # [/] 282s # 282s # hybrid/ 282s # CMakeLists.txt 282s # __init__.py 282s # hybrid_pure.dat 282s # hybrid_pure.py 282s # 282s # data/ 282s # hybrid_data_pure.dat 282s # 282s # hybrid_2/ 282s # __init__.py 282s # hybrid_2_pure.py 282s # 282s # hybrid_2_pure/ 282s # __init__.py 282s # hybrid_2_pure_1.py 282s # hybrid_2_pure_2.py 282s # 282s # 282s # ------------------------------------------------------------------------- 282s # and here is the "BINARY" distribution layout: 282s # 282s # The comment "CMake" or "Setuptools" indicates which tool is responsible 282s # for placing the file in the tree used to create the binary distribution. 282s # 282s # ROOT/ 282s # 282s # cmakeModule.py # CMake 282s # 282s # cmake/ 282s # __init__.py # CMake 282s # cmake.py # CMake 282s # 282s # hybrid/ 282s # hybrid_cmake.dat # CMake 282s # hybrid_cmake.py # CMake 282s # hybrid_pure.dat # Setuptools 282s # hybrid_pure.py # Setuptools 282s # 282s # data/ 282s # hybrid_data_pure.dat # CMake or Setuptools 282s # hybrid_data_cmake.dat # CMake *NO TEST* 282s # 282s # hybrid_2/ 282s # __init__.py # CMake or Setuptools 282s # hybrid_2_pure.py # CMake or Setuptools 282s # hybrid_2_cmake.py # CMake 282s # 282s # hybrid_2_pure/ 282s # __init__.py # CMake or Setuptools 282s # hybrid_2_pure_1.py # CMake or Setuptools 282s # hybrid_2_pure_2.py # CMake or Setuptools 282s # 282s # pureModule.py # Setuptools 282s # 282s # pure/ 282s # __init__.py # Setuptools 282s # pure.py # Setuptools 282s # 282s # data/ 282s # pure.dat # Setuptools 282s 282s tmp_dir.join("setup.py").write( 282s textwrap.dedent( 282s """ 282s from skbuild import setup 282s #from setuptools import setup 282s setup( 282s name="test_hybrid_project", 282s version="1.2.3", 282s description=("an hybrid package mixing files installed by both " 282s "CMake and setuptools"), 282s author='The scikit-build team', 282s license="MIT", 282s cmake_source_dir='{cmake_source_dir}', 282s cmake_install_dir='{cmake_install_dir}', 282s # Arbitrary order of packages 282s packages=[ 282s {p_off} 'pure', 282s {h_off} 'hybrid.hybrid_2', 282s {h_off} 'hybrid', 282s {c_off} 'cmake', 282s {p_off} 'hybrid.hybrid_2_pure', 282s ], 282s py_modules=[ 282s {pm_off} '{package_base}pureModule', 282s {cm_off} '{package_base}cmakeModule', 282s ], 282s package_data={{ 282s {p_off} 'pure': ['data/pure.dat'], 282s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 282s }}, 282s # Arbitrary order of package_dir 282s package_dir = {{ 282s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 282s {p_off} 'pure': '{package_base}pure', 282s {h_off} 'hybrid': '{package_base}hybrid', 282s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 282s {c_off} 'cmake': '{package_base}cmake', 282s }} 282s ) 282s """.format( 282s cmake_source_dir=cmake_source_dir, 282s cmake_install_dir=package_base, 282s package_base=package_base_dir, 282s c_off="" if has_cmake_package else "#", 282s cm_off="" if has_cmake_module else "#", 282s h_off="" if has_hybrid_package else "#", 282s p_off="" if has_pure_package else "#", 282s pm_off="" if has_pure_module else "#", 282s ) 282s ) 282s ) 282s 282s src_dir = tmp_dir.ensure(package_base, dir=1) 282s 282s src_dir.join("CMakeLists.txt").write( 282s textwrap.dedent( 282s """ 282s cmake_minimum_required(VERSION 3.5.0) 282s project(hybrid NONE) 282s set(build_dir ${{CMAKE_BINARY_DIR}}) 282s 282s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 282s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 282s {c_off} install( 282s {c_off} FILES 282s {c_off} ${{build_dir}}/__init__.py 282s {c_off} ${{build_dir}}/cmake.py 282s {c_off} DESTINATION cmake 282s {c_off} ) 282s 282s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 282s {cm_off} install( 282s {cm_off} FILES ${{build_dir}}/cmakeModule.py 282s {cm_off} DESTINATION .) 282s 282s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 282s {h_off} install( 282s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 282s {h_off} DESTINATION hybrid) 282s 282s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 282s {h_off} install( 282s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 282s {h_off} DESTINATION hybrid) 282s 282s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 282s {h_off} install( 282s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 282s {h_off} DESTINATION hybrid/data) 282s 282s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 282s {h_off} install( 282s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 282s {h_off} DESTINATION hybrid/hybrid_2) 282s 282s install(CODE "message(STATUS \\\"Installation complete\\\")") 282s """.format( 282s c_off="" if has_cmake_package else "#", 282s cm_off="" if has_cmake_module else "#", 282s h_off="" if has_hybrid_package else "#", 282s ) 282s ) 282s ) 282s 282s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 282s path_types: Sequence[str] 282s try: 282s path_types = next( 282s iter( 282s zip( 282s *filter( 282s lambda i: i[1], 282s [ 282s ("c", has_cmake_package), 282s ("cm", has_cmake_module), 282s ("h", has_hybrid_package), 282s ("p", has_pure_package), 282s ("pm", has_pure_module), 282s ], 282s ) 282s ) 282s ) 282s ) 282s except StopIteration: 282s path_types = [] 282s 282s def select_paths(annotated_paths): 282s """Return a filtered list paths considering ``path_types``. 282s 282s `annotated_paths`` is list of tuple ``(type, path)`` where type 282s is either `c`, 'cm', `h`, `p` or 'pm'. 282s 282s """ 282s return filter(lambda i: i[0] in path_types, annotated_paths) 282s 282s # Commented paths are the one expected to be installed by CMake. For 282s # this reason, corresponding files should NOT be created in the source 282s # tree. 282s for _type, path in select_paths( 282s [ 282s # ('c', 'cmake/__init__.py'), 282s # ('c', 'cmake/cmake.py'), 282s # ('cm', 'cmakeModule.py'), 282s ("h", "hybrid/__init__.py"), 282s # ('h', 'hybrid/hybrid_cmake.dat'), 282s # ('h', 'hybrid/hybrid_cmake.py'), 282s ("h", "hybrid/hybrid_pure.dat"), 282s ("h", "hybrid/hybrid_pure.py"), 282s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 282s ("h", "hybrid/data/hybrid_data_pure.dat"), 282s ("h", "hybrid/hybrid_2/__init__.py"), 282s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 282s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 282s ("p", "hybrid/hybrid_2_pure/__init__.py"), 282s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 282s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 282s ("pm", "pureModule.py"), 282s ("p", "pure/__init__.py"), 282s ("p", "pure/pure.py"), 282s ("p", "pure/data/pure.dat"), 282s ] 282s ): 282s assert _type in {"p", "pm", "h"} 282s root = package_base if _type in {"p", "pm"} else cmake_source_dir 282s tmp_dir.ensure(os.path.join(root, path)) 282s 282s # Do not call the real setup function. Instead, replace it with 282s # a MagicMock allowing to check with which arguments it was invoked. 282s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 282s 282s # Convenience print function 282s def _pprint(desc, value=None): 282s print( 282s "-----------------\n" 282s f"{desc}:\n" 282s "\n" 282s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 282s ) 282s 282s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 282s 282s _pprint = ._pprint at 0x709a44387ec0> 282s _type = 'p' 282s cmake_source_dir = '' 282s has_cmake_module = 0 282s has_cmake_package = 1 282s has_hybrid_package = 1 282s has_pure_module = 1 282s has_pure_package = 1 282s mock_setup = 282s mocker = 282s package_base = '' 282s package_base_dir = '' 282s path = 'pure/data/pure.dat' 282s path_types = ('c', 'h', 'p', 'pm') 282s root = '' 282s select_paths = .select_paths at 0x709a44387740> 282s src_dir = local('/tmp/pytest-of-ubuntu/pytest-111/test_setup_inputs0') 282s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-111/test_setup_inputs0') 282s with_package_base = 0 282s 282s tests/test_setup.py:849: 282s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 282s /usr/lib/python3.12/contextlib.py:137: in __enter__ 282s return next(self.gen) 282s self = 282s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 282s 282s project_dir = local('/tmp/pytest-of-ubuntu/pytest-111/test_setup_inputs0') 282s setup_args = ['build'], disable_languages_test = True 282s 282s @contextmanager 282s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 282s """Context manager executing ``setup.py`` with the given arguments. 282s 282s It yields after changing the current working directory 282s to ``project_dir``. 282s """ 282s 282s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 282s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 282s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 282s 282s disable_languages_test = True 282s project_dir = local('/tmp/pytest-of-ubuntu/pytest-111/test_setup_inputs0') 282s setup_args = ['build'] 282s 282s tests/__init__.py:218: AttributeError 282s ________________________ test_setup_inputs[0-1-1-1-1-0] ________________________ 282s 282s has_cmake_package = 0, has_cmake_module = 1, has_hybrid_package = 1 282s has_pure_package = 1, has_pure_module = 1, with_package_base = 0 282s mocker = 282s 282s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 282s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 282s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 282s @pytest.mark.parametrize("has_pure_package", [0, 1]) 282s @pytest.mark.parametrize("has_pure_module", [0, 1]) 282s @pytest.mark.parametrize("with_package_base", [0, 1]) 282s def test_setup_inputs( 282s has_cmake_package, 282s has_cmake_module, 282s has_hybrid_package, 282s has_pure_package, 282s has_pure_module, 282s with_package_base, 282s mocker, 282s ): 282s """This test that a project can have a package with some modules 282s installed using setup.py and some other modules installed using CMake. 282s """ 282s 282s tmp_dir = _tmpdir("test_setup_inputs") 282s 282s package_base = "to/the/base" if with_package_base else "" 282s package_base_dir = package_base + "/" if package_base else "" 282s cmake_source_dir = package_base 282s 282s if cmake_source_dir and (has_cmake_package or has_cmake_module): 282s pytest.skip( 282s "unsupported configuration: " 282s "python package fully generated by CMake does *NOT* work. " 282s "At least __init__.py should be in the project source tree" 282s ) 282s 282s # ------------------------------------------------------------------------- 282s # Here is the "SOURCE" tree layout: 282s # 282s # ROOT/ 282s # 282s # setup.py 282s # 282s # [/] 282s # 282s # pureModule.py 282s # 282s # pure/ 282s # __init__.py 282s # pure.py 282s # 282s # data/ 282s # pure.dat 282s # 282s # [/] 282s # 282s # hybrid/ 282s # CMakeLists.txt 282s # __init__.py 282s # hybrid_pure.dat 282s # hybrid_pure.py 282s # 282s # data/ 282s # hybrid_data_pure.dat 282s # 282s # hybrid_2/ 282s # __init__.py 282s # hybrid_2_pure.py 282s # 282s # hybrid_2_pure/ 282s # __init__.py 282s # hybrid_2_pure_1.py 282s # hybrid_2_pure_2.py 282s # 282s # 282s # ------------------------------------------------------------------------- 282s # and here is the "BINARY" distribution layout: 282s # 282s # The comment "CMake" or "Setuptools" indicates which tool is responsible 282s # for placing the file in the tree used to create the binary distribution. 282s # 282s # ROOT/ 282s # 282s # cmakeModule.py # CMake 282s # 282s # cmake/ 282s # __init__.py # CMake 282s # cmake.py # CMake 282s # 282s # hybrid/ 282s # hybrid_cmake.dat # CMake 282s # hybrid_cmake.py # CMake 282s # hybrid_pure.dat # Setuptools 282s # hybrid_pure.py # Setuptools 282s # 282s # data/ 282s # hybrid_data_pure.dat # CMake or Setuptools 282s # hybrid_data_cmake.dat # CMake *NO TEST* 282s # 282s # hybrid_2/ 282s # __init__.py # CMake or Setuptools 282s # hybrid_2_pure.py # CMake or Setuptools 282s # hybrid_2_cmake.py # CMake 282s # 282s # hybrid_2_pure/ 282s # __init__.py # CMake or Setuptools 282s # hybrid_2_pure_1.py # CMake or Setuptools 282s # hybrid_2_pure_2.py # CMake or Setuptools 282s # 282s # pureModule.py # Setuptools 282s # 282s # pure/ 282s # __init__.py # Setuptools 282s # pure.py # Setuptools 282s # 282s # data/ 282s # pure.dat # Setuptools 282s 282s tmp_dir.join("setup.py").write( 282s textwrap.dedent( 282s """ 282s from skbuild import setup 282s #from setuptools import setup 282s setup( 282s name="test_hybrid_project", 282s version="1.2.3", 282s description=("an hybrid package mixing files installed by both " 282s "CMake and setuptools"), 282s author='The scikit-build team', 282s license="MIT", 282s cmake_source_dir='{cmake_source_dir}', 282s cmake_install_dir='{cmake_install_dir}', 282s # Arbitrary order of packages 282s packages=[ 282s {p_off} 'pure', 282s {h_off} 'hybrid.hybrid_2', 282s {h_off} 'hybrid', 282s {c_off} 'cmake', 282s {p_off} 'hybrid.hybrid_2_pure', 282s ], 282s py_modules=[ 282s {pm_off} '{package_base}pureModule', 282s {cm_off} '{package_base}cmakeModule', 282s ], 282s package_data={{ 282s {p_off} 'pure': ['data/pure.dat'], 282s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 282s }}, 282s # Arbitrary order of package_dir 282s package_dir = {{ 282s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 282s {p_off} 'pure': '{package_base}pure', 282s {h_off} 'hybrid': '{package_base}hybrid', 282s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 282s {c_off} 'cmake': '{package_base}cmake', 282s }} 282s ) 282s """.format( 282s cmake_source_dir=cmake_source_dir, 282s cmake_install_dir=package_base, 282s package_base=package_base_dir, 282s c_off="" if has_cmake_package else "#", 282s cm_off="" if has_cmake_module else "#", 282s h_off="" if has_hybrid_package else "#", 282s p_off="" if has_pure_package else "#", 282s pm_off="" if has_pure_module else "#", 282s ) 282s ) 282s ) 282s 282s src_dir = tmp_dir.ensure(package_base, dir=1) 282s 282s src_dir.join("CMakeLists.txt").write( 282s textwrap.dedent( 282s """ 282s cmake_minimum_required(VERSION 3.5.0) 282s project(hybrid NONE) 282s set(build_dir ${{CMAKE_BINARY_DIR}}) 282s 282s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 282s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 282s {c_off} install( 282s {c_off} FILES 282s {c_off} ${{build_dir}}/__init__.py 282s {c_off} ${{build_dir}}/cmake.py 282s {c_off} DESTINATION cmake 282s {c_off} ) 282s 282s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 282s {cm_off} install( 282s {cm_off} FILES ${{build_dir}}/cmakeModule.py 282s {cm_off} DESTINATION .) 282s 282s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 282s {h_off} install( 282s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 282s {h_off} DESTINATION hybrid) 282s 282s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 282s {h_off} install( 282s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 282s {h_off} DESTINATION hybrid) 282s 282s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 282s {h_off} install( 282s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 282s {h_off} DESTINATION hybrid/data) 282s 282s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 282s {h_off} install( 282s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 282s {h_off} DESTINATION hybrid/hybrid_2) 282s 282s install(CODE "message(STATUS \\\"Installation complete\\\")") 282s """.format( 282s c_off="" if has_cmake_package else "#", 282s cm_off="" if has_cmake_module else "#", 282s h_off="" if has_hybrid_package else "#", 282s ) 282s ) 282s ) 282s 282s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 282s path_types: Sequence[str] 282s try: 282s path_types = next( 282s iter( 282s zip( 282s *filter( 282s lambda i: i[1], 282s [ 282s ("c", has_cmake_package), 282s ("cm", has_cmake_module), 282s ("h", has_hybrid_package), 282s ("p", has_pure_package), 282s ("pm", has_pure_module), 282s ], 282s ) 282s ) 282s ) 282s ) 282s except StopIteration: 282s path_types = [] 282s 282s def select_paths(annotated_paths): 282s """Return a filtered list paths considering ``path_types``. 282s 282s `annotated_paths`` is list of tuple ``(type, path)`` where type 282s is either `c`, 'cm', `h`, `p` or 'pm'. 282s 282s """ 282s return filter(lambda i: i[0] in path_types, annotated_paths) 282s 282s # Commented paths are the one expected to be installed by CMake. For 282s # this reason, corresponding files should NOT be created in the source 282s # tree. 282s for _type, path in select_paths( 282s [ 282s # ('c', 'cmake/__init__.py'), 282s # ('c', 'cmake/cmake.py'), 282s # ('cm', 'cmakeModule.py'), 282s ("h", "hybrid/__init__.py"), 282s # ('h', 'hybrid/hybrid_cmake.dat'), 282s # ('h', 'hybrid/hybrid_cmake.py'), 282s ("h", "hybrid/hybrid_pure.dat"), 282s ("h", "hybrid/hybrid_pure.py"), 282s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 282s ("h", "hybrid/data/hybrid_data_pure.dat"), 282s ("h", "hybrid/hybrid_2/__init__.py"), 282s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 282s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 282s ("p", "hybrid/hybrid_2_pure/__init__.py"), 282s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 282s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 282s ("pm", "pureModule.py"), 282s ("p", "pure/__init__.py"), 282s ("p", "pure/pure.py"), 282s ("p", "pure/data/pure.dat"), 282s ] 282s ): 282s assert _type in {"p", "pm", "h"} 282s root = package_base if _type in {"p", "pm"} else cmake_source_dir 282s tmp_dir.ensure(os.path.join(root, path)) 282s 282s # Do not call the real setup function. Instead, replace it with 282s # a MagicMock allowing to check with which arguments it was invoked. 282s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 282s 282s # Convenience print function 282s def _pprint(desc, value=None): 282s print( 282s "-----------------\n" 282s f"{desc}:\n" 282s "\n" 282s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 282s ) 282s 282s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 282s 282s _pprint = ._pprint at 0x709a4420d080> 282s _type = 'p' 282s cmake_source_dir = '' 282s has_cmake_module = 1 282s has_cmake_package = 0 282s has_hybrid_package = 1 282s has_pure_module = 1 282s has_pure_package = 1 282s mock_setup = 282s mocker = 282s package_base = '' 282s package_base_dir = '' 282s path = 'pure/data/pure.dat' 282s path_types = ('cm', 'h', 'p', 'pm') 282s root = '' 282s select_paths = .select_paths at 0x709a4420d8a0> 282s src_dir = local('/tmp/pytest-of-ubuntu/pytest-112/test_setup_inputs0') 282s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-112/test_setup_inputs0') 282s with_package_base = 0 282s 282s tests/test_setup.py:849: 282s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 282s /usr/lib/python3.12/contextlib.py:137: in __enter__ 282s return next(self.gen) 282s self = 282s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 282s 282s project_dir = local('/tmp/pytest-of-ubuntu/pytest-112/test_setup_inputs0') 282s setup_args = ['build'], disable_languages_test = True 282s 282s @contextmanager 282s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 282s """Context manager executing ``setup.py`` with the given arguments. 282s 282s It yields after changing the current working directory 282s to ``project_dir``. 282s """ 282s 282s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 282s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 282s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 282s 282s disable_languages_test = True 282s project_dir = local('/tmp/pytest-of-ubuntu/pytest-112/test_setup_inputs0') 282s setup_args = ['build'] 282s 282s tests/__init__.py:218: AttributeError 282s ________________________ test_setup_inputs[0-1-1-1-1-1] ________________________ 282s 282s has_cmake_package = 1, has_cmake_module = 1, has_hybrid_package = 1 282s has_pure_package = 1, has_pure_module = 1, with_package_base = 0 282s mocker = 282s 282s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 282s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 282s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 282s @pytest.mark.parametrize("has_pure_package", [0, 1]) 282s @pytest.mark.parametrize("has_pure_module", [0, 1]) 282s @pytest.mark.parametrize("with_package_base", [0, 1]) 282s def test_setup_inputs( 282s has_cmake_package, 282s has_cmake_module, 282s has_hybrid_package, 282s has_pure_package, 282s has_pure_module, 282s with_package_base, 282s mocker, 282s ): 282s """This test that a project can have a package with some modules 282s installed using setup.py and some other modules installed using CMake. 282s """ 282s 282s tmp_dir = _tmpdir("test_setup_inputs") 282s 282s package_base = "to/the/base" if with_package_base else "" 282s package_base_dir = package_base + "/" if package_base else "" 282s cmake_source_dir = package_base 282s 282s if cmake_source_dir and (has_cmake_package or has_cmake_module): 282s pytest.skip( 282s "unsupported configuration: " 282s "python package fully generated by CMake does *NOT* work. " 282s "At least __init__.py should be in the project source tree" 282s ) 282s 282s # ------------------------------------------------------------------------- 282s # Here is the "SOURCE" tree layout: 282s # 282s # ROOT/ 282s # 282s # setup.py 282s # 282s # [/] 282s # 282s # pureModule.py 282s # 282s # pure/ 282s # __init__.py 282s # pure.py 282s # 282s # data/ 282s # pure.dat 282s # 282s # [/] 282s # 282s # hybrid/ 282s # CMakeLists.txt 282s # __init__.py 282s # hybrid_pure.dat 282s # hybrid_pure.py 282s # 282s # data/ 282s # hybrid_data_pure.dat 282s # 282s # hybrid_2/ 282s # __init__.py 282s # hybrid_2_pure.py 282s # 282s # hybrid_2_pure/ 282s # __init__.py 282s # hybrid_2_pure_1.py 282s # hybrid_2_pure_2.py 282s # 282s # 282s # ------------------------------------------------------------------------- 282s # and here is the "BINARY" distribution layout: 282s # 282s # The comment "CMake" or "Setuptools" indicates which tool is responsible 282s # for placing the file in the tree used to create the binary distribution. 282s # 282s # ROOT/ 282s # 282s # cmakeModule.py # CMake 282s # 282s # cmake/ 282s # __init__.py # CMake 282s # cmake.py # CMake 282s # 282s # hybrid/ 282s # hybrid_cmake.dat # CMake 282s # hybrid_cmake.py # CMake 282s # hybrid_pure.dat # Setuptools 282s # hybrid_pure.py # Setuptools 282s # 282s # data/ 282s # hybrid_data_pure.dat # CMake or Setuptools 282s # hybrid_data_cmake.dat # CMake *NO TEST* 282s # 282s # hybrid_2/ 282s # __init__.py # CMake or Setuptools 282s # hybrid_2_pure.py # CMake or Setuptools 282s # hybrid_2_cmake.py # CMake 282s # 282s # hybrid_2_pure/ 282s # __init__.py # CMake or Setuptools 282s # hybrid_2_pure_1.py # CMake or Setuptools 282s # hybrid_2_pure_2.py # CMake or Setuptools 282s # 282s # pureModule.py # Setuptools 282s # 282s # pure/ 282s # __init__.py # Setuptools 282s # pure.py # Setuptools 282s # 282s # data/ 282s # pure.dat # Setuptools 282s 282s tmp_dir.join("setup.py").write( 282s textwrap.dedent( 282s """ 282s from skbuild import setup 282s #from setuptools import setup 282s setup( 282s name="test_hybrid_project", 282s version="1.2.3", 282s description=("an hybrid package mixing files installed by both " 282s "CMake and setuptools"), 282s author='The scikit-build team', 282s license="MIT", 282s cmake_source_dir='{cmake_source_dir}', 282s cmake_install_dir='{cmake_install_dir}', 282s # Arbitrary order of packages 282s packages=[ 282s {p_off} 'pure', 282s {h_off} 'hybrid.hybrid_2', 282s {h_off} 'hybrid', 282s {c_off} 'cmake', 282s {p_off} 'hybrid.hybrid_2_pure', 282s ], 282s py_modules=[ 282s {pm_off} '{package_base}pureModule', 282s {cm_off} '{package_base}cmakeModule', 282s ], 282s package_data={{ 282s {p_off} 'pure': ['data/pure.dat'], 282s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 282s }}, 282s # Arbitrary order of package_dir 282s package_dir = {{ 282s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 282s {p_off} 'pure': '{package_base}pure', 282s {h_off} 'hybrid': '{package_base}hybrid', 282s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 282s {c_off} 'cmake': '{package_base}cmake', 282s }} 282s ) 282s """.format( 282s cmake_source_dir=cmake_source_dir, 282s cmake_install_dir=package_base, 282s package_base=package_base_dir, 282s c_off="" if has_cmake_package else "#", 282s cm_off="" if has_cmake_module else "#", 282s h_off="" if has_hybrid_package else "#", 282s p_off="" if has_pure_package else "#", 282s pm_off="" if has_pure_module else "#", 282s ) 282s ) 282s ) 282s 282s src_dir = tmp_dir.ensure(package_base, dir=1) 282s 282s src_dir.join("CMakeLists.txt").write( 282s textwrap.dedent( 282s """ 282s cmake_minimum_required(VERSION 3.5.0) 282s project(hybrid NONE) 282s set(build_dir ${{CMAKE_BINARY_DIR}}) 282s 282s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 282s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 282s {c_off} install( 282s {c_off} FILES 282s {c_off} ${{build_dir}}/__init__.py 282s {c_off} ${{build_dir}}/cmake.py 282s {c_off} DESTINATION cmake 282s {c_off} ) 282s 282s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 282s {cm_off} install( 282s {cm_off} FILES ${{build_dir}}/cmakeModule.py 282s {cm_off} DESTINATION .) 282s 282s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 282s {h_off} install( 282s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 282s {h_off} DESTINATION hybrid) 282s 282s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 282s {h_off} install( 282s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 282s {h_off} DESTINATION hybrid) 282s 282s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 282s {h_off} install( 282s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 282s {h_off} DESTINATION hybrid/data) 282s 282s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 282s {h_off} install( 282s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 282s {h_off} DESTINATION hybrid/hybrid_2) 282s 282s install(CODE "message(STATUS \\\"Installation complete\\\")") 282s """.format( 282s c_off="" if has_cmake_package else "#", 282s cm_off="" if has_cmake_module else "#", 282s h_off="" if has_hybrid_package else "#", 282s ) 282s ) 282s ) 282s 282s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 282s path_types: Sequence[str] 282s try: 282s path_types = next( 282s iter( 282s zip( 282s *filter( 282s lambda i: i[1], 282s [ 282s ("c", has_cmake_package), 282s ("cm", has_cmake_module), 282s ("h", has_hybrid_package), 282s ("p", has_pure_package), 282s ("pm", has_pure_module), 282s ], 282s ) 282s ) 282s ) 282s ) 282s except StopIteration: 282s path_types = [] 282s 282s def select_paths(annotated_paths): 282s """Return a filtered list paths considering ``path_types``. 282s 282s `annotated_paths`` is list of tuple ``(type, path)`` where type 282s is either `c`, 'cm', `h`, `p` or 'pm'. 282s 282s """ 282s return filter(lambda i: i[0] in path_types, annotated_paths) 282s 282s # Commented paths are the one expected to be installed by CMake. For 282s # this reason, corresponding files should NOT be created in the source 282s # tree. 282s for _type, path in select_paths( 282s [ 282s # ('c', 'cmake/__init__.py'), 282s # ('c', 'cmake/cmake.py'), 282s # ('cm', 'cmakeModule.py'), 282s ("h", "hybrid/__init__.py"), 282s # ('h', 'hybrid/hybrid_cmake.dat'), 282s # ('h', 'hybrid/hybrid_cmake.py'), 282s ("h", "hybrid/hybrid_pure.dat"), 282s ("h", "hybrid/hybrid_pure.py"), 282s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 282s ("h", "hybrid/data/hybrid_data_pure.dat"), 282s ("h", "hybrid/hybrid_2/__init__.py"), 282s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 282s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 282s ("p", "hybrid/hybrid_2_pure/__init__.py"), 282s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 282s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 282s ("pm", "pureModule.py"), 282s ("p", "pure/__init__.py"), 282s ("p", "pure/pure.py"), 282s ("p", "pure/data/pure.dat"), 282s ] 282s ): 282s assert _type in {"p", "pm", "h"} 282s root = package_base if _type in {"p", "pm"} else cmake_source_dir 282s tmp_dir.ensure(os.path.join(root, path)) 282s 282s # Do not call the real setup function. Instead, replace it with 282s # a MagicMock allowing to check with which arguments it was invoked. 282s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 282s 282s # Convenience print function 282s def _pprint(desc, value=None): 282s print( 282s "-----------------\n" 282s f"{desc}:\n" 282s "\n" 282s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 282s ) 282s 282s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 282s 282s _pprint = ._pprint at 0x709a4420d800> 282s _type = 'p' 282s cmake_source_dir = '' 282s has_cmake_module = 1 282s has_cmake_package = 1 282s has_hybrid_package = 1 282s has_pure_module = 1 282s has_pure_package = 1 282s mock_setup = 282s mocker = 282s package_base = '' 282s package_base_dir = '' 282s path = 'pure/data/pure.dat' 282s path_types = ('c', 'cm', 'h', 'p', 'pm') 282s root = '' 282s select_paths = .select_paths at 0x709a4420d4e0> 282s src_dir = local('/tmp/pytest-of-ubuntu/pytest-113/test_setup_inputs0') 282s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-113/test_setup_inputs0') 282s with_package_base = 0 282s 282s tests/test_setup.py:849: 282s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 282s /usr/lib/python3.12/contextlib.py:137: in __enter__ 282s return next(self.gen) 282s self = 282s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 282s 282s project_dir = local('/tmp/pytest-of-ubuntu/pytest-113/test_setup_inputs0') 282s setup_args = ['build'], disable_languages_test = True 282s 282s @contextmanager 282s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 282s """Context manager executing ``setup.py`` with the given arguments. 282s 282s It yields after changing the current working directory 282s to ``project_dir``. 282s """ 282s 282s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 282s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 282s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 282s 282s disable_languages_test = True 282s project_dir = local('/tmp/pytest-of-ubuntu/pytest-113/test_setup_inputs0') 282s setup_args = ['build'] 282s 282s tests/__init__.py:218: AttributeError 282s ________________________ test_setup_inputs[1-0-0-0-0-0] ________________________ 282s 282s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 0 282s has_pure_package = 0, has_pure_module = 0, with_package_base = 1 282s mocker = 282s 282s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 282s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 282s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 282s @pytest.mark.parametrize("has_pure_package", [0, 1]) 282s @pytest.mark.parametrize("has_pure_module", [0, 1]) 282s @pytest.mark.parametrize("with_package_base", [0, 1]) 282s def test_setup_inputs( 282s has_cmake_package, 282s has_cmake_module, 282s has_hybrid_package, 282s has_pure_package, 282s has_pure_module, 282s with_package_base, 282s mocker, 282s ): 282s """This test that a project can have a package with some modules 282s installed using setup.py and some other modules installed using CMake. 282s """ 282s 282s tmp_dir = _tmpdir("test_setup_inputs") 282s 282s package_base = "to/the/base" if with_package_base else "" 282s package_base_dir = package_base + "/" if package_base else "" 282s cmake_source_dir = package_base 282s 282s if cmake_source_dir and (has_cmake_package or has_cmake_module): 282s pytest.skip( 282s "unsupported configuration: " 282s "python package fully generated by CMake does *NOT* work. " 282s "At least __init__.py should be in the project source tree" 282s ) 282s 282s # ------------------------------------------------------------------------- 282s # Here is the "SOURCE" tree layout: 282s # 282s # ROOT/ 282s # 282s # setup.py 282s # 282s # [/] 282s # 282s # pureModule.py 282s # 282s # pure/ 282s # __init__.py 282s # pure.py 282s # 282s # data/ 282s # pure.dat 282s # 282s # [/] 282s # 282s # hybrid/ 282s # CMakeLists.txt 282s # __init__.py 282s # hybrid_pure.dat 282s # hybrid_pure.py 282s # 282s # data/ 282s # hybrid_data_pure.dat 282s # 282s # hybrid_2/ 282s # __init__.py 282s # hybrid_2_pure.py 282s # 282s # hybrid_2_pure/ 282s # __init__.py 282s # hybrid_2_pure_1.py 282s # hybrid_2_pure_2.py 282s # 282s # 282s # ------------------------------------------------------------------------- 282s # and here is the "BINARY" distribution layout: 282s # 282s # The comment "CMake" or "Setuptools" indicates which tool is responsible 282s # for placing the file in the tree used to create the binary distribution. 282s # 282s # ROOT/ 282s # 282s # cmakeModule.py # CMake 282s # 282s # cmake/ 282s # __init__.py # CMake 282s # cmake.py # CMake 282s # 282s # hybrid/ 282s # hybrid_cmake.dat # CMake 282s # hybrid_cmake.py # CMake 282s # hybrid_pure.dat # Setuptools 282s # hybrid_pure.py # Setuptools 282s # 282s # data/ 282s # hybrid_data_pure.dat # CMake or Setuptools 282s # hybrid_data_cmake.dat # CMake *NO TEST* 282s # 282s # hybrid_2/ 282s # __init__.py # CMake or Setuptools 282s # hybrid_2_pure.py # CMake or Setuptools 282s # hybrid_2_cmake.py # CMake 282s # 282s # hybrid_2_pure/ 282s # __init__.py # CMake or Setuptools 282s # hybrid_2_pure_1.py # CMake or Setuptools 282s # hybrid_2_pure_2.py # CMake or Setuptools 282s # 282s # pureModule.py # Setuptools 282s # 282s # pure/ 282s # __init__.py # Setuptools 282s # pure.py # Setuptools 282s # 282s # data/ 282s # pure.dat # Setuptools 282s 282s tmp_dir.join("setup.py").write( 282s textwrap.dedent( 282s """ 282s from skbuild import setup 282s #from setuptools import setup 282s setup( 282s name="test_hybrid_project", 282s version="1.2.3", 282s description=("an hybrid package mixing files installed by both " 282s "CMake and setuptools"), 282s author='The scikit-build team', 282s license="MIT", 282s cmake_source_dir='{cmake_source_dir}', 282s cmake_install_dir='{cmake_install_dir}', 282s # Arbitrary order of packages 282s packages=[ 282s {p_off} 'pure', 282s {h_off} 'hybrid.hybrid_2', 282s {h_off} 'hybrid', 282s {c_off} 'cmake', 282s {p_off} 'hybrid.hybrid_2_pure', 282s ], 282s py_modules=[ 282s {pm_off} '{package_base}pureModule', 282s {cm_off} '{package_base}cmakeModule', 282s ], 282s package_data={{ 282s {p_off} 'pure': ['data/pure.dat'], 282s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 282s }}, 282s # Arbitrary order of package_dir 282s package_dir = {{ 282s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 282s {p_off} 'pure': '{package_base}pure', 282s {h_off} 'hybrid': '{package_base}hybrid', 282s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 282s {c_off} 'cmake': '{package_base}cmake', 282s }} 282s ) 282s """.format( 282s cmake_source_dir=cmake_source_dir, 282s cmake_install_dir=package_base, 282s package_base=package_base_dir, 282s c_off="" if has_cmake_package else "#", 282s cm_off="" if has_cmake_module else "#", 282s h_off="" if has_hybrid_package else "#", 282s p_off="" if has_pure_package else "#", 282s pm_off="" if has_pure_module else "#", 282s ) 282s ) 282s ) 282s 282s src_dir = tmp_dir.ensure(package_base, dir=1) 282s 282s src_dir.join("CMakeLists.txt").write( 282s textwrap.dedent( 282s """ 282s cmake_minimum_required(VERSION 3.5.0) 282s project(hybrid NONE) 282s set(build_dir ${{CMAKE_BINARY_DIR}}) 282s 282s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 282s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 282s {c_off} install( 282s {c_off} FILES 282s {c_off} ${{build_dir}}/__init__.py 282s {c_off} ${{build_dir}}/cmake.py 282s {c_off} DESTINATION cmake 282s {c_off} ) 282s 282s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 282s {cm_off} install( 282s {cm_off} FILES ${{build_dir}}/cmakeModule.py 282s {cm_off} DESTINATION .) 282s 282s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 282s {h_off} install( 282s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 282s {h_off} DESTINATION hybrid) 282s 282s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 282s {h_off} install( 282s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 282s {h_off} DESTINATION hybrid) 282s 282s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 282s {h_off} install( 282s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 282s {h_off} DESTINATION hybrid/data) 282s 282s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 282s {h_off} install( 282s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 282s {h_off} DESTINATION hybrid/hybrid_2) 282s 282s install(CODE "message(STATUS \\\"Installation complete\\\")") 282s """.format( 282s c_off="" if has_cmake_package else "#", 282s cm_off="" if has_cmake_module else "#", 282s h_off="" if has_hybrid_package else "#", 282s ) 282s ) 282s ) 282s 282s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 282s path_types: Sequence[str] 282s try: 282s path_types = next( 282s iter( 282s zip( 282s *filter( 282s lambda i: i[1], 282s [ 282s ("c", has_cmake_package), 282s ("cm", has_cmake_module), 282s ("h", has_hybrid_package), 282s ("p", has_pure_package), 282s ("pm", has_pure_module), 282s ], 282s ) 282s ) 282s ) 282s ) 282s except StopIteration: 282s path_types = [] 282s 282s def select_paths(annotated_paths): 282s """Return a filtered list paths considering ``path_types``. 282s 282s `annotated_paths`` is list of tuple ``(type, path)`` where type 282s is either `c`, 'cm', `h`, `p` or 'pm'. 282s 282s """ 282s return filter(lambda i: i[0] in path_types, annotated_paths) 282s 282s # Commented paths are the one expected to be installed by CMake. For 282s # this reason, corresponding files should NOT be created in the source 282s # tree. 282s for _type, path in select_paths( 282s [ 282s # ('c', 'cmake/__init__.py'), 282s # ('c', 'cmake/cmake.py'), 282s # ('cm', 'cmakeModule.py'), 282s ("h", "hybrid/__init__.py"), 282s # ('h', 'hybrid/hybrid_cmake.dat'), 282s # ('h', 'hybrid/hybrid_cmake.py'), 282s ("h", "hybrid/hybrid_pure.dat"), 282s ("h", "hybrid/hybrid_pure.py"), 282s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 282s ("h", "hybrid/data/hybrid_data_pure.dat"), 282s ("h", "hybrid/hybrid_2/__init__.py"), 282s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 282s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 282s ("p", "hybrid/hybrid_2_pure/__init__.py"), 282s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 282s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 282s ("pm", "pureModule.py"), 282s ("p", "pure/__init__.py"), 282s ("p", "pure/pure.py"), 282s ("p", "pure/data/pure.dat"), 282s ] 282s ): 282s assert _type in {"p", "pm", "h"} 282s root = package_base if _type in {"p", "pm"} else cmake_source_dir 282s tmp_dir.ensure(os.path.join(root, path)) 282s 282s # Do not call the real setup function. Instead, replace it with 282s # a MagicMock allowing to check with which arguments it was invoked. 282s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 282s 282s # Convenience print function 282s def _pprint(desc, value=None): 282s print( 282s "-----------------\n" 282s f"{desc}:\n" 282s "\n" 282s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 282s ) 282s 282s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 282s 282s _pprint = ._pprint at 0x709a4420c5e0> 282s cmake_source_dir = 'to/the/base' 282s has_cmake_module = 0 282s has_cmake_package = 0 282s has_hybrid_package = 0 282s has_pure_module = 0 282s has_pure_package = 0 282s mock_setup = 282s mocker = 282s package_base = 'to/the/base' 282s package_base_dir = 'to/the/base/' 282s path_types = [] 282s select_paths = .select_paths at 0x709a4420cf40> 282s src_dir = local('/tmp/pytest-of-ubuntu/pytest-114/test_setup_inputs0/to/the/base') 282s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-114/test_setup_inputs0') 282s with_package_base = 1 282s 282s tests/test_setup.py:849: 282s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 282s /usr/lib/python3.12/contextlib.py:137: in __enter__ 282s return next(self.gen) 282s self = 282s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 282s 282s project_dir = local('/tmp/pytest-of-ubuntu/pytest-114/test_setup_inputs0') 282s setup_args = ['build'], disable_languages_test = True 282s 282s @contextmanager 282s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 282s """Context manager executing ``setup.py`` with the given arguments. 282s 282s It yields after changing the current working directory 282s to ``project_dir``. 282s """ 282s 282s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 282s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 282s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 282s 282s disable_languages_test = True 282s project_dir = local('/tmp/pytest-of-ubuntu/pytest-114/test_setup_inputs0') 282s setup_args = ['build'] 282s 282s tests/__init__.py:218: AttributeError 282s ________________________ test_setup_inputs[1-0-0-1-0-0] ________________________ 282s 282s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 1 282s has_pure_package = 0, has_pure_module = 0, with_package_base = 1 282s mocker = 282s 282s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 282s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 282s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 282s @pytest.mark.parametrize("has_pure_package", [0, 1]) 282s @pytest.mark.parametrize("has_pure_module", [0, 1]) 282s @pytest.mark.parametrize("with_package_base", [0, 1]) 282s def test_setup_inputs( 282s has_cmake_package, 282s has_cmake_module, 282s has_hybrid_package, 282s has_pure_package, 282s has_pure_module, 282s with_package_base, 282s mocker, 282s ): 282s """This test that a project can have a package with some modules 282s installed using setup.py and some other modules installed using CMake. 282s """ 282s 282s tmp_dir = _tmpdir("test_setup_inputs") 282s 282s package_base = "to/the/base" if with_package_base else "" 282s package_base_dir = package_base + "/" if package_base else "" 282s cmake_source_dir = package_base 282s 282s if cmake_source_dir and (has_cmake_package or has_cmake_module): 282s pytest.skip( 282s "unsupported configuration: " 282s "python package fully generated by CMake does *NOT* work. " 282s "At least __init__.py should be in the project source tree" 282s ) 282s 282s # ------------------------------------------------------------------------- 282s # Here is the "SOURCE" tree layout: 282s # 282s # ROOT/ 282s # 282s # setup.py 282s # 282s # [/] 282s # 282s # pureModule.py 282s # 282s # pure/ 282s # __init__.py 282s # pure.py 282s # 282s # data/ 282s # pure.dat 282s # 282s # [/] 282s # 282s # hybrid/ 282s # CMakeLists.txt 282s # __init__.py 282s # hybrid_pure.dat 282s # hybrid_pure.py 282s # 282s # data/ 282s # hybrid_data_pure.dat 282s # 282s # hybrid_2/ 282s # __init__.py 282s # hybrid_2_pure.py 282s # 282s # hybrid_2_pure/ 282s # __init__.py 282s # hybrid_2_pure_1.py 282s # hybrid_2_pure_2.py 282s # 282s # 282s # ------------------------------------------------------------------------- 282s # and here is the "BINARY" distribution layout: 282s # 282s # The comment "CMake" or "Setuptools" indicates which tool is responsible 282s # for placing the file in the tree used to create the binary distribution. 282s # 282s # ROOT/ 282s # 282s # cmakeModule.py # CMake 282s # 282s # cmake/ 282s # __init__.py # CMake 282s # cmake.py # CMake 282s # 282s # hybrid/ 282s # hybrid_cmake.dat # CMake 282s # hybrid_cmake.py # CMake 282s # hybrid_pure.dat # Setuptools 282s # hybrid_pure.py # Setuptools 282s # 282s # data/ 282s # hybrid_data_pure.dat # CMake or Setuptools 282s # hybrid_data_cmake.dat # CMake *NO TEST* 282s # 282s # hybrid_2/ 282s # __init__.py # CMake or Setuptools 282s # hybrid_2_pure.py # CMake or Setuptools 282s # hybrid_2_cmake.py # CMake 282s # 282s # hybrid_2_pure/ 282s # __init__.py # CMake or Setuptools 282s # hybrid_2_pure_1.py # CMake or Setuptools 282s # hybrid_2_pure_2.py # CMake or Setuptools 282s # 282s # pureModule.py # Setuptools 282s # 282s # pure/ 282s # __init__.py # Setuptools 282s # pure.py # Setuptools 282s # 282s # data/ 282s # pure.dat # Setuptools 282s 282s tmp_dir.join("setup.py").write( 282s textwrap.dedent( 282s """ 282s from skbuild import setup 282s #from setuptools import setup 282s setup( 282s name="test_hybrid_project", 282s version="1.2.3", 282s description=("an hybrid package mixing files installed by both " 282s "CMake and setuptools"), 282s author='The scikit-build team', 282s license="MIT", 282s cmake_source_dir='{cmake_source_dir}', 282s cmake_install_dir='{cmake_install_dir}', 282s # Arbitrary order of packages 282s packages=[ 282s {p_off} 'pure', 282s {h_off} 'hybrid.hybrid_2', 282s {h_off} 'hybrid', 282s {c_off} 'cmake', 282s {p_off} 'hybrid.hybrid_2_pure', 282s ], 282s py_modules=[ 282s {pm_off} '{package_base}pureModule', 282s {cm_off} '{package_base}cmakeModule', 282s ], 282s package_data={{ 282s {p_off} 'pure': ['data/pure.dat'], 282s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 282s }}, 282s # Arbitrary order of package_dir 282s package_dir = {{ 282s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 282s {p_off} 'pure': '{package_base}pure', 282s {h_off} 'hybrid': '{package_base}hybrid', 282s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 282s {c_off} 'cmake': '{package_base}cmake', 282s }} 282s ) 282s """.format( 282s cmake_source_dir=cmake_source_dir, 282s cmake_install_dir=package_base, 282s package_base=package_base_dir, 282s c_off="" if has_cmake_package else "#", 282s cm_off="" if has_cmake_module else "#", 282s h_off="" if has_hybrid_package else "#", 282s p_off="" if has_pure_package else "#", 282s pm_off="" if has_pure_module else "#", 282s ) 282s ) 282s ) 282s 282s src_dir = tmp_dir.ensure(package_base, dir=1) 282s 282s src_dir.join("CMakeLists.txt").write( 282s textwrap.dedent( 282s """ 282s cmake_minimum_required(VERSION 3.5.0) 282s project(hybrid NONE) 282s set(build_dir ${{CMAKE_BINARY_DIR}}) 282s 282s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 282s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 282s {c_off} install( 282s {c_off} FILES 282s {c_off} ${{build_dir}}/__init__.py 282s {c_off} ${{build_dir}}/cmake.py 282s {c_off} DESTINATION cmake 282s {c_off} ) 282s 282s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 282s {cm_off} install( 282s {cm_off} FILES ${{build_dir}}/cmakeModule.py 282s {cm_off} DESTINATION .) 282s 282s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 282s {h_off} install( 282s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 282s {h_off} DESTINATION hybrid) 282s 282s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 282s {h_off} install( 282s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 282s {h_off} DESTINATION hybrid) 282s 282s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 282s {h_off} install( 282s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 282s {h_off} DESTINATION hybrid/data) 282s 282s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 282s {h_off} install( 282s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 282s {h_off} DESTINATION hybrid/hybrid_2) 282s 282s install(CODE "message(STATUS \\\"Installation complete\\\")") 282s """.format( 282s c_off="" if has_cmake_package else "#", 282s cm_off="" if has_cmake_module else "#", 282s h_off="" if has_hybrid_package else "#", 282s ) 282s ) 282s ) 282s 282s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 282s path_types: Sequence[str] 282s try: 282s path_types = next( 282s iter( 282s zip( 282s *filter( 282s lambda i: i[1], 282s [ 282s ("c", has_cmake_package), 282s ("cm", has_cmake_module), 282s ("h", has_hybrid_package), 282s ("p", has_pure_package), 282s ("pm", has_pure_module), 282s ], 282s ) 282s ) 282s ) 282s ) 282s except StopIteration: 282s path_types = [] 282s 282s def select_paths(annotated_paths): 282s """Return a filtered list paths considering ``path_types``. 282s 282s `annotated_paths`` is list of tuple ``(type, path)`` where type 282s is either `c`, 'cm', `h`, `p` or 'pm'. 282s 282s """ 282s return filter(lambda i: i[0] in path_types, annotated_paths) 282s 282s # Commented paths are the one expected to be installed by CMake. For 282s # this reason, corresponding files should NOT be created in the source 282s # tree. 282s for _type, path in select_paths( 282s [ 282s # ('c', 'cmake/__init__.py'), 282s # ('c', 'cmake/cmake.py'), 282s # ('cm', 'cmakeModule.py'), 282s ("h", "hybrid/__init__.py"), 282s # ('h', 'hybrid/hybrid_cmake.dat'), 282s # ('h', 'hybrid/hybrid_cmake.py'), 282s ("h", "hybrid/hybrid_pure.dat"), 282s ("h", "hybrid/hybrid_pure.py"), 282s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 282s ("h", "hybrid/data/hybrid_data_pure.dat"), 282s ("h", "hybrid/hybrid_2/__init__.py"), 282s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 282s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 282s ("p", "hybrid/hybrid_2_pure/__init__.py"), 282s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 282s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 282s ("pm", "pureModule.py"), 282s ("p", "pure/__init__.py"), 282s ("p", "pure/pure.py"), 282s ("p", "pure/data/pure.dat"), 282s ] 282s ): 282s assert _type in {"p", "pm", "h"} 282s root = package_base if _type in {"p", "pm"} else cmake_source_dir 282s tmp_dir.ensure(os.path.join(root, path)) 282s 282s # Do not call the real setup function. Instead, replace it with 282s # a MagicMock allowing to check with which arguments it was invoked. 282s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 282s 282s # Convenience print function 282s def _pprint(desc, value=None): 282s print( 282s "-----------------\n" 282s f"{desc}:\n" 282s "\n" 282s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 282s ) 282s 282s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 282s 282s _pprint = ._pprint at 0x709a44481e40> 282s _type = 'h' 282s cmake_source_dir = 'to/the/base' 282s has_cmake_module = 0 282s has_cmake_package = 0 282s has_hybrid_package = 1 282s has_pure_module = 0 282s has_pure_package = 0 282s mock_setup = 282s mocker = 282s package_base = 'to/the/base' 282s package_base_dir = 'to/the/base/' 282s path = 'hybrid/hybrid_2/hybrid_2_pure.py' 282s path_types = ('h',) 282s root = 'to/the/base' 282s select_paths = .select_paths at 0x709a44386020> 282s src_dir = local('/tmp/pytest-of-ubuntu/pytest-118/test_setup_inputs0/to/the/base') 282s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-118/test_setup_inputs0') 282s with_package_base = 1 282s 282s tests/test_setup.py:849: 282s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 282s /usr/lib/python3.12/contextlib.py:137: in __enter__ 282s return next(self.gen) 282s self = 282s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 282s 282s project_dir = local('/tmp/pytest-of-ubuntu/pytest-118/test_setup_inputs0') 282s setup_args = ['build'], disable_languages_test = True 282s 282s @contextmanager 282s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 282s """Context manager executing ``setup.py`` with the given arguments. 282s 282s It yields after changing the current working directory 282s to ``project_dir``. 282s """ 282s 282s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 282s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 282s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 282s 282s disable_languages_test = True 282s project_dir = local('/tmp/pytest-of-ubuntu/pytest-118/test_setup_inputs0') 282s setup_args = ['build'] 282s 282s tests/__init__.py:218: AttributeError 282s ________________________ test_setup_inputs[1-0-1-0-0-0] ________________________ 282s 282s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 0 282s has_pure_package = 1, has_pure_module = 0, with_package_base = 1 282s mocker = 282s 282s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 282s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 282s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 282s @pytest.mark.parametrize("has_pure_package", [0, 1]) 282s @pytest.mark.parametrize("has_pure_module", [0, 1]) 282s @pytest.mark.parametrize("with_package_base", [0, 1]) 282s def test_setup_inputs( 282s has_cmake_package, 282s has_cmake_module, 282s has_hybrid_package, 282s has_pure_package, 282s has_pure_module, 282s with_package_base, 282s mocker, 282s ): 282s """This test that a project can have a package with some modules 282s installed using setup.py and some other modules installed using CMake. 282s """ 282s 282s tmp_dir = _tmpdir("test_setup_inputs") 282s 282s package_base = "to/the/base" if with_package_base else "" 282s package_base_dir = package_base + "/" if package_base else "" 282s cmake_source_dir = package_base 282s 282s if cmake_source_dir and (has_cmake_package or has_cmake_module): 282s pytest.skip( 282s "unsupported configuration: " 282s "python package fully generated by CMake does *NOT* work. " 282s "At least __init__.py should be in the project source tree" 282s ) 282s 282s # ------------------------------------------------------------------------- 282s # Here is the "SOURCE" tree layout: 282s # 282s # ROOT/ 282s # 282s # setup.py 282s # 282s # [/] 282s # 282s # pureModule.py 282s # 282s # pure/ 282s # __init__.py 282s # pure.py 282s # 282s # data/ 282s # pure.dat 282s # 282s # [/] 282s # 282s # hybrid/ 282s # CMakeLists.txt 282s # __init__.py 282s # hybrid_pure.dat 282s # hybrid_pure.py 282s # 282s # data/ 282s # hybrid_data_pure.dat 282s # 282s # hybrid_2/ 282s # __init__.py 282s # hybrid_2_pure.py 282s # 282s # hybrid_2_pure/ 282s # __init__.py 282s # hybrid_2_pure_1.py 282s # hybrid_2_pure_2.py 282s # 282s # 282s # ------------------------------------------------------------------------- 282s # and here is the "BINARY" distribution layout: 282s # 282s # The comment "CMake" or "Setuptools" indicates which tool is responsible 282s # for placing the file in the tree used to create the binary distribution. 282s # 282s # ROOT/ 282s # 282s # cmakeModule.py # CMake 282s # 282s # cmake/ 282s # __init__.py # CMake 282s # cmake.py # CMake 282s # 282s # hybrid/ 282s # hybrid_cmake.dat # CMake 282s # hybrid_cmake.py # CMake 282s # hybrid_pure.dat # Setuptools 282s # hybrid_pure.py # Setuptools 282s # 282s # data/ 282s # hybrid_data_pure.dat # CMake or Setuptools 282s # hybrid_data_cmake.dat # CMake *NO TEST* 282s # 282s # hybrid_2/ 282s # __init__.py # CMake or Setuptools 282s # hybrid_2_pure.py # CMake or Setuptools 282s # hybrid_2_cmake.py # CMake 282s # 282s # hybrid_2_pure/ 282s # __init__.py # CMake or Setuptools 282s # hybrid_2_pure_1.py # CMake or Setuptools 282s # hybrid_2_pure_2.py # CMake or Setuptools 282s # 282s # pureModule.py # Setuptools 282s # 282s # pure/ 282s # __init__.py # Setuptools 282s # pure.py # Setuptools 282s # 282s # data/ 282s # pure.dat # Setuptools 282s 282s tmp_dir.join("setup.py").write( 282s textwrap.dedent( 282s """ 282s from skbuild import setup 282s #from setuptools import setup 282s setup( 282s name="test_hybrid_project", 282s version="1.2.3", 282s description=("an hybrid package mixing files installed by both " 282s "CMake and setuptools"), 282s author='The scikit-build team', 282s license="MIT", 282s cmake_source_dir='{cmake_source_dir}', 282s cmake_install_dir='{cmake_install_dir}', 282s # Arbitrary order of packages 282s packages=[ 282s {p_off} 'pure', 282s {h_off} 'hybrid.hybrid_2', 282s {h_off} 'hybrid', 282s {c_off} 'cmake', 282s {p_off} 'hybrid.hybrid_2_pure', 282s ], 282s py_modules=[ 282s {pm_off} '{package_base}pureModule', 282s {cm_off} '{package_base}cmakeModule', 282s ], 282s package_data={{ 282s {p_off} 'pure': ['data/pure.dat'], 282s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 282s }}, 282s # Arbitrary order of package_dir 282s package_dir = {{ 282s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 282s {p_off} 'pure': '{package_base}pure', 282s {h_off} 'hybrid': '{package_base}hybrid', 282s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 282s {c_off} 'cmake': '{package_base}cmake', 282s }} 282s ) 282s """.format( 282s cmake_source_dir=cmake_source_dir, 282s cmake_install_dir=package_base, 282s package_base=package_base_dir, 282s c_off="" if has_cmake_package else "#", 282s cm_off="" if has_cmake_module else "#", 282s h_off="" if has_hybrid_package else "#", 282s p_off="" if has_pure_package else "#", 282s pm_off="" if has_pure_module else "#", 282s ) 282s ) 282s ) 282s 282s src_dir = tmp_dir.ensure(package_base, dir=1) 282s 282s src_dir.join("CMakeLists.txt").write( 282s textwrap.dedent( 282s """ 282s cmake_minimum_required(VERSION 3.5.0) 282s project(hybrid NONE) 282s set(build_dir ${{CMAKE_BINARY_DIR}}) 282s 282s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 282s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 282s {c_off} install( 282s {c_off} FILES 282s {c_off} ${{build_dir}}/__init__.py 282s {c_off} ${{build_dir}}/cmake.py 282s {c_off} DESTINATION cmake 282s {c_off} ) 282s 282s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 282s {cm_off} install( 282s {cm_off} FILES ${{build_dir}}/cmakeModule.py 282s {cm_off} DESTINATION .) 282s 282s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 282s {h_off} install( 282s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 282s {h_off} DESTINATION hybrid) 282s 282s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 282s {h_off} install( 282s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 282s {h_off} DESTINATION hybrid) 282s 282s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 282s {h_off} install( 282s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 282s {h_off} DESTINATION hybrid/data) 282s 282s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 282s {h_off} install( 282s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 282s {h_off} DESTINATION hybrid/hybrid_2) 282s 282s install(CODE "message(STATUS \\\"Installation complete\\\")") 282s """.format( 282s c_off="" if has_cmake_package else "#", 282s cm_off="" if has_cmake_module else "#", 282s h_off="" if has_hybrid_package else "#", 282s ) 282s ) 282s ) 282s 282s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 282s path_types: Sequence[str] 282s try: 282s path_types = next( 282s iter( 282s zip( 282s *filter( 282s lambda i: i[1], 282s [ 282s ("c", has_cmake_package), 282s ("cm", has_cmake_module), 282s ("h", has_hybrid_package), 282s ("p", has_pure_package), 282s ("pm", has_pure_module), 282s ], 282s ) 282s ) 282s ) 282s ) 282s except StopIteration: 282s path_types = [] 282s 282s def select_paths(annotated_paths): 282s """Return a filtered list paths considering ``path_types``. 282s 282s `annotated_paths`` is list of tuple ``(type, path)`` where type 282s is either `c`, 'cm', `h`, `p` or 'pm'. 282s 282s """ 282s return filter(lambda i: i[0] in path_types, annotated_paths) 282s 282s # Commented paths are the one expected to be installed by CMake. For 282s # this reason, corresponding files should NOT be created in the source 282s # tree. 282s for _type, path in select_paths( 282s [ 282s # ('c', 'cmake/__init__.py'), 282s # ('c', 'cmake/cmake.py'), 282s # ('cm', 'cmakeModule.py'), 282s ("h", "hybrid/__init__.py"), 282s # ('h', 'hybrid/hybrid_cmake.dat'), 282s # ('h', 'hybrid/hybrid_cmake.py'), 282s ("h", "hybrid/hybrid_pure.dat"), 282s ("h", "hybrid/hybrid_pure.py"), 282s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 282s ("h", "hybrid/data/hybrid_data_pure.dat"), 282s ("h", "hybrid/hybrid_2/__init__.py"), 282s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 282s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 282s ("p", "hybrid/hybrid_2_pure/__init__.py"), 282s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 282s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 282s ("pm", "pureModule.py"), 282s ("p", "pure/__init__.py"), 282s ("p", "pure/pure.py"), 282s ("p", "pure/data/pure.dat"), 282s ] 282s ): 282s assert _type in {"p", "pm", "h"} 282s root = package_base if _type in {"p", "pm"} else cmake_source_dir 282s tmp_dir.ensure(os.path.join(root, path)) 282s 282s # Do not call the real setup function. Instead, replace it with 282s # a MagicMock allowing to check with which arguments it was invoked. 282s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 282s 282s # Convenience print function 282s def _pprint(desc, value=None): 282s print( 282s "-----------------\n" 282s f"{desc}:\n" 282s "\n" 282s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 282s ) 282s 282s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 282s 282s _pprint = ._pprint at 0x709a443849a0> 282s _type = 'p' 282s cmake_source_dir = 'to/the/base' 282s has_cmake_module = 0 282s has_cmake_package = 0 282s has_hybrid_package = 0 282s has_pure_module = 0 282s has_pure_package = 1 282s mock_setup = 282s mocker = 282s package_base = 'to/the/base' 282s package_base_dir = 'to/the/base/' 282s path = 'pure/data/pure.dat' 282s path_types = ('p',) 282s root = 'to/the/base' 282s select_paths = .select_paths at 0x709a44385620> 282s src_dir = local('/tmp/pytest-of-ubuntu/pytest-122/test_setup_inputs0/to/the/base') 282s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-122/test_setup_inputs0') 282s with_package_base = 1 282s 282s tests/test_setup.py:849: 282s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 282s /usr/lib/python3.12/contextlib.py:137: in __enter__ 282s return next(self.gen) 282s self = 282s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 282s 282s project_dir = local('/tmp/pytest-of-ubuntu/pytest-122/test_setup_inputs0') 282s setup_args = ['build'], disable_languages_test = True 282s 282s @contextmanager 282s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 282s """Context manager executing ``setup.py`` with the given arguments. 282s 282s It yields after changing the current working directory 282s to ``project_dir``. 282s """ 282s 282s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 282s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 282s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 282s 282s disable_languages_test = True 282s project_dir = local('/tmp/pytest-of-ubuntu/pytest-122/test_setup_inputs0') 282s setup_args = ['build'] 282s 282s tests/__init__.py:218: AttributeError 282s ________________________ test_setup_inputs[1-0-1-1-0-0] ________________________ 282s 282s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 1 282s has_pure_package = 1, has_pure_module = 0, with_package_base = 1 282s mocker = 282s 282s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 282s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 282s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 282s @pytest.mark.parametrize("has_pure_package", [0, 1]) 282s @pytest.mark.parametrize("has_pure_module", [0, 1]) 282s @pytest.mark.parametrize("with_package_base", [0, 1]) 282s def test_setup_inputs( 282s has_cmake_package, 282s has_cmake_module, 282s has_hybrid_package, 282s has_pure_package, 282s has_pure_module, 282s with_package_base, 282s mocker, 282s ): 282s """This test that a project can have a package with some modules 282s installed using setup.py and some other modules installed using CMake. 282s """ 282s 282s tmp_dir = _tmpdir("test_setup_inputs") 282s 282s package_base = "to/the/base" if with_package_base else "" 282s package_base_dir = package_base + "/" if package_base else "" 282s cmake_source_dir = package_base 282s 282s if cmake_source_dir and (has_cmake_package or has_cmake_module): 282s pytest.skip( 282s "unsupported configuration: " 282s "python package fully generated by CMake does *NOT* work. " 282s "At least __init__.py should be in the project source tree" 282s ) 282s 282s # ------------------------------------------------------------------------- 282s # Here is the "SOURCE" tree layout: 282s # 282s # ROOT/ 282s # 282s # setup.py 282s # 282s # [/] 282s # 282s # pureModule.py 282s # 282s # pure/ 282s # __init__.py 282s # pure.py 282s # 282s # data/ 282s # pure.dat 282s # 282s # [/] 282s # 282s # hybrid/ 282s # CMakeLists.txt 282s # __init__.py 282s # hybrid_pure.dat 282s # hybrid_pure.py 282s # 282s # data/ 282s # hybrid_data_pure.dat 282s # 282s # hybrid_2/ 282s # __init__.py 282s # hybrid_2_pure.py 282s # 282s # hybrid_2_pure/ 282s # __init__.py 282s # hybrid_2_pure_1.py 282s # hybrid_2_pure_2.py 282s # 282s # 282s # ------------------------------------------------------------------------- 282s # and here is the "BINARY" distribution layout: 282s # 282s # The comment "CMake" or "Setuptools" indicates which tool is responsible 282s # for placing the file in the tree used to create the binary distribution. 282s # 282s # ROOT/ 282s # 282s # cmakeModule.py # CMake 282s # 282s # cmake/ 282s # __init__.py # CMake 282s # cmake.py # CMake 282s # 282s # hybrid/ 282s # hybrid_cmake.dat # CMake 282s # hybrid_cmake.py # CMake 282s # hybrid_pure.dat # Setuptools 282s # hybrid_pure.py # Setuptools 282s # 282s # data/ 282s # hybrid_data_pure.dat # CMake or Setuptools 282s # hybrid_data_cmake.dat # CMake *NO TEST* 282s # 282s # hybrid_2/ 282s # __init__.py # CMake or Setuptools 282s # hybrid_2_pure.py # CMake or Setuptools 282s # hybrid_2_cmake.py # CMake 282s # 282s # hybrid_2_pure/ 282s # __init__.py # CMake or Setuptools 282s # hybrid_2_pure_1.py # CMake or Setuptools 282s # hybrid_2_pure_2.py # CMake or Setuptools 282s # 282s # pureModule.py # Setuptools 282s # 282s # pure/ 282s # __init__.py # Setuptools 282s # pure.py # Setuptools 282s # 282s # data/ 282s # pure.dat # Setuptools 282s 282s tmp_dir.join("setup.py").write( 282s textwrap.dedent( 282s """ 282s from skbuild import setup 282s #from setuptools import setup 282s setup( 282s name="test_hybrid_project", 282s version="1.2.3", 282s description=("an hybrid package mixing files installed by both " 282s "CMake and setuptools"), 282s author='The scikit-build team', 282s license="MIT", 282s cmake_source_dir='{cmake_source_dir}', 282s cmake_install_dir='{cmake_install_dir}', 282s # Arbitrary order of packages 282s packages=[ 282s {p_off} 'pure', 282s {h_off} 'hybrid.hybrid_2', 282s {h_off} 'hybrid', 282s {c_off} 'cmake', 282s {p_off} 'hybrid.hybrid_2_pure', 282s ], 282s py_modules=[ 282s {pm_off} '{package_base}pureModule', 282s {cm_off} '{package_base}cmakeModule', 282s ], 282s package_data={{ 282s {p_off} 'pure': ['data/pure.dat'], 282s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 282s }}, 282s # Arbitrary order of package_dir 282s package_dir = {{ 282s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 282s {p_off} 'pure': '{package_base}pure', 282s {h_off} 'hybrid': '{package_base}hybrid', 282s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 282s {c_off} 'cmake': '{package_base}cmake', 282s }} 282s ) 282s """.format( 282s cmake_source_dir=cmake_source_dir, 282s cmake_install_dir=package_base, 282s package_base=package_base_dir, 282s c_off="" if has_cmake_package else "#", 282s cm_off="" if has_cmake_module else "#", 282s h_off="" if has_hybrid_package else "#", 282s p_off="" if has_pure_package else "#", 282s pm_off="" if has_pure_module else "#", 282s ) 282s ) 282s ) 282s 282s src_dir = tmp_dir.ensure(package_base, dir=1) 282s 282s src_dir.join("CMakeLists.txt").write( 282s textwrap.dedent( 282s """ 282s cmake_minimum_required(VERSION 3.5.0) 282s project(hybrid NONE) 282s set(build_dir ${{CMAKE_BINARY_DIR}}) 282s 282s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 282s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 282s {c_off} install( 282s {c_off} FILES 282s {c_off} ${{build_dir}}/__init__.py 282s {c_off} ${{build_dir}}/cmake.py 282s {c_off} DESTINATION cmake 282s {c_off} ) 282s 282s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 282s {cm_off} install( 282s {cm_off} FILES ${{build_dir}}/cmakeModule.py 282s {cm_off} DESTINATION .) 282s 282s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 282s {h_off} install( 282s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 282s {h_off} DESTINATION hybrid) 282s 282s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 282s {h_off} install( 282s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 282s {h_off} DESTINATION hybrid) 282s 282s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 282s {h_off} install( 282s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 282s {h_off} DESTINATION hybrid/data) 282s 282s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 282s {h_off} install( 282s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 282s {h_off} DESTINATION hybrid/hybrid_2) 282s 282s install(CODE "message(STATUS \\\"Installation complete\\\")") 282s """.format( 282s c_off="" if has_cmake_package else "#", 282s cm_off="" if has_cmake_module else "#", 282s h_off="" if has_hybrid_package else "#", 282s ) 282s ) 282s ) 282s 282s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 282s path_types: Sequence[str] 282s try: 282s path_types = next( 282s iter( 282s zip( 282s *filter( 282s lambda i: i[1], 282s [ 282s ("c", has_cmake_package), 282s ("cm", has_cmake_module), 282s ("h", has_hybrid_package), 282s ("p", has_pure_package), 282s ("pm", has_pure_module), 282s ], 282s ) 282s ) 282s ) 282s ) 282s except StopIteration: 282s path_types = [] 282s 282s def select_paths(annotated_paths): 282s """Return a filtered list paths considering ``path_types``. 282s 282s `annotated_paths`` is list of tuple ``(type, path)`` where type 282s is either `c`, 'cm', `h`, `p` or 'pm'. 282s 282s """ 282s return filter(lambda i: i[0] in path_types, annotated_paths) 282s 282s # Commented paths are the one expected to be installed by CMake. For 282s # this reason, corresponding files should NOT be created in the source 282s # tree. 282s for _type, path in select_paths( 282s [ 282s # ('c', 'cmake/__init__.py'), 282s # ('c', 'cmake/cmake.py'), 282s # ('cm', 'cmakeModule.py'), 282s ("h", "hybrid/__init__.py"), 282s # ('h', 'hybrid/hybrid_cmake.dat'), 282s # ('h', 'hybrid/hybrid_cmake.py'), 282s ("h", "hybrid/hybrid_pure.dat"), 282s ("h", "hybrid/hybrid_pure.py"), 282s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 282s ("h", "hybrid/data/hybrid_data_pure.dat"), 282s ("h", "hybrid/hybrid_2/__init__.py"), 282s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 282s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 282s ("p", "hybrid/hybrid_2_pure/__init__.py"), 282s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 282s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 282s ("pm", "pureModule.py"), 282s ("p", "pure/__init__.py"), 282s ("p", "pure/pure.py"), 282s ("p", "pure/data/pure.dat"), 282s ] 282s ): 282s assert _type in {"p", "pm", "h"} 282s root = package_base if _type in {"p", "pm"} else cmake_source_dir 282s tmp_dir.ensure(os.path.join(root, path)) 282s 282s # Do not call the real setup function. Instead, replace it with 282s # a MagicMock allowing to check with which arguments it was invoked. 282s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 282s 282s # Convenience print function 282s def _pprint(desc, value=None): 282s print( 282s "-----------------\n" 282s f"{desc}:\n" 282s "\n" 282s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 282s ) 282s 282s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 282s 282s _pprint = ._pprint at 0x709a44386520> 282s _type = 'p' 282s cmake_source_dir = 'to/the/base' 282s has_cmake_module = 0 282s has_cmake_package = 0 282s has_hybrid_package = 1 282s has_pure_module = 0 282s has_pure_package = 1 282s mock_setup = 282s mocker = 282s package_base = 'to/the/base' 282s package_base_dir = 'to/the/base/' 282s path = 'pure/data/pure.dat' 282s path_types = ('h', 'p') 282s root = 'to/the/base' 282s select_paths = .select_paths at 0x709a443867a0> 282s src_dir = local('/tmp/pytest-of-ubuntu/pytest-126/test_setup_inputs0/to/the/base') 282s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-126/test_setup_inputs0') 282s with_package_base = 1 282s 282s tests/test_setup.py:849: 282s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 282s /usr/lib/python3.12/contextlib.py:137: in __enter__ 282s return next(self.gen) 282s self = 282s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 282s 282s project_dir = local('/tmp/pytest-of-ubuntu/pytest-126/test_setup_inputs0') 282s setup_args = ['build'], disable_languages_test = True 282s 282s @contextmanager 282s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 282s """Context manager executing ``setup.py`` with the given arguments. 282s 282s It yields after changing the current working directory 282s to ``project_dir``. 282s """ 282s 282s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 282s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 282s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 282s 282s disable_languages_test = True 282s project_dir = local('/tmp/pytest-of-ubuntu/pytest-126/test_setup_inputs0') 282s setup_args = ['build'] 282s 282s tests/__init__.py:218: AttributeError 282s ________________________ test_setup_inputs[1-1-0-0-0-0] ________________________ 282s 282s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 0 282s has_pure_package = 0, has_pure_module = 1, with_package_base = 1 282s mocker = 282s 282s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 282s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 282s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 282s @pytest.mark.parametrize("has_pure_package", [0, 1]) 282s @pytest.mark.parametrize("has_pure_module", [0, 1]) 282s @pytest.mark.parametrize("with_package_base", [0, 1]) 282s def test_setup_inputs( 282s has_cmake_package, 282s has_cmake_module, 282s has_hybrid_package, 282s has_pure_package, 282s has_pure_module, 282s with_package_base, 282s mocker, 282s ): 282s """This test that a project can have a package with some modules 282s installed using setup.py and some other modules installed using CMake. 282s """ 282s 282s tmp_dir = _tmpdir("test_setup_inputs") 282s 282s package_base = "to/the/base" if with_package_base else "" 282s package_base_dir = package_base + "/" if package_base else "" 282s cmake_source_dir = package_base 282s 282s if cmake_source_dir and (has_cmake_package or has_cmake_module): 282s pytest.skip( 282s "unsupported configuration: " 282s "python package fully generated by CMake does *NOT* work. " 282s "At least __init__.py should be in the project source tree" 282s ) 282s 282s # ------------------------------------------------------------------------- 282s # Here is the "SOURCE" tree layout: 282s # 282s # ROOT/ 282s # 282s # setup.py 282s # 282s # [/] 282s # 282s # pureModule.py 282s # 282s # pure/ 282s # __init__.py 282s # pure.py 282s # 282s # data/ 282s # pure.dat 282s # 282s # [/] 282s # 282s # hybrid/ 282s # CMakeLists.txt 282s # __init__.py 282s # hybrid_pure.dat 282s # hybrid_pure.py 282s # 282s # data/ 282s # hybrid_data_pure.dat 282s # 282s # hybrid_2/ 282s # __init__.py 282s # hybrid_2_pure.py 282s # 282s # hybrid_2_pure/ 282s # __init__.py 282s # hybrid_2_pure_1.py 282s # hybrid_2_pure_2.py 282s # 282s # 282s # ------------------------------------------------------------------------- 282s # and here is the "BINARY" distribution layout: 282s # 282s # The comment "CMake" or "Setuptools" indicates which tool is responsible 282s # for placing the file in the tree used to create the binary distribution. 282s # 282s # ROOT/ 282s # 282s # cmakeModule.py # CMake 282s # 282s # cmake/ 282s # __init__.py # CMake 282s # cmake.py # CMake 282s # 282s # hybrid/ 282s # hybrid_cmake.dat # CMake 282s # hybrid_cmake.py # CMake 282s # hybrid_pure.dat # Setuptools 282s # hybrid_pure.py # Setuptools 282s # 282s # data/ 282s # hybrid_data_pure.dat # CMake or Setuptools 282s # hybrid_data_cmake.dat # CMake *NO TEST* 282s # 282s # hybrid_2/ 282s # __init__.py # CMake or Setuptools 282s # hybrid_2_pure.py # CMake or Setuptools 282s # hybrid_2_cmake.py # CMake 282s # 282s # hybrid_2_pure/ 282s # __init__.py # CMake or Setuptools 282s # hybrid_2_pure_1.py # CMake or Setuptools 282s # hybrid_2_pure_2.py # CMake or Setuptools 282s # 282s # pureModule.py # Setuptools 282s # 282s # pure/ 282s # __init__.py # Setuptools 282s # pure.py # Setuptools 282s # 282s # data/ 282s # pure.dat # Setuptools 282s 282s tmp_dir.join("setup.py").write( 282s textwrap.dedent( 282s """ 282s from skbuild import setup 282s #from setuptools import setup 282s setup( 282s name="test_hybrid_project", 282s version="1.2.3", 282s description=("an hybrid package mixing files installed by both " 282s "CMake and setuptools"), 282s author='The scikit-build team', 282s license="MIT", 282s cmake_source_dir='{cmake_source_dir}', 282s cmake_install_dir='{cmake_install_dir}', 282s # Arbitrary order of packages 282s packages=[ 282s {p_off} 'pure', 282s {h_off} 'hybrid.hybrid_2', 282s {h_off} 'hybrid', 282s {c_off} 'cmake', 282s {p_off} 'hybrid.hybrid_2_pure', 282s ], 282s py_modules=[ 282s {pm_off} '{package_base}pureModule', 282s {cm_off} '{package_base}cmakeModule', 282s ], 282s package_data={{ 282s {p_off} 'pure': ['data/pure.dat'], 282s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 282s }}, 282s # Arbitrary order of package_dir 282s package_dir = {{ 282s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 282s {p_off} 'pure': '{package_base}pure', 282s {h_off} 'hybrid': '{package_base}hybrid', 282s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 282s {c_off} 'cmake': '{package_base}cmake', 282s }} 282s ) 282s """.format( 282s cmake_source_dir=cmake_source_dir, 282s cmake_install_dir=package_base, 282s package_base=package_base_dir, 282s c_off="" if has_cmake_package else "#", 282s cm_off="" if has_cmake_module else "#", 282s h_off="" if has_hybrid_package else "#", 282s p_off="" if has_pure_package else "#", 282s pm_off="" if has_pure_module else "#", 282s ) 282s ) 282s ) 282s 282s src_dir = tmp_dir.ensure(package_base, dir=1) 282s 282s src_dir.join("CMakeLists.txt").write( 282s textwrap.dedent( 282s """ 282s cmake_minimum_required(VERSION 3.5.0) 282s project(hybrid NONE) 282s set(build_dir ${{CMAKE_BINARY_DIR}}) 282s 282s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 282s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 282s {c_off} install( 282s {c_off} FILES 282s {c_off} ${{build_dir}}/__init__.py 282s {c_off} ${{build_dir}}/cmake.py 282s {c_off} DESTINATION cmake 282s {c_off} ) 282s 282s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 282s {cm_off} install( 282s {cm_off} FILES ${{build_dir}}/cmakeModule.py 282s {cm_off} DESTINATION .) 282s 282s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 282s {h_off} install( 282s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 282s {h_off} DESTINATION hybrid) 282s 282s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 282s {h_off} install( 282s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 282s {h_off} DESTINATION hybrid) 282s 282s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 282s {h_off} install( 282s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 282s {h_off} DESTINATION hybrid/data) 282s 282s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 282s {h_off} install( 282s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 282s {h_off} DESTINATION hybrid/hybrid_2) 282s 282s install(CODE "message(STATUS \\\"Installation complete\\\")") 282s """.format( 282s c_off="" if has_cmake_package else "#", 282s cm_off="" if has_cmake_module else "#", 282s h_off="" if has_hybrid_package else "#", 282s ) 282s ) 282s ) 282s 282s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 282s path_types: Sequence[str] 282s try: 282s path_types = next( 282s iter( 282s zip( 282s *filter( 282s lambda i: i[1], 282s [ 282s ("c", has_cmake_package), 282s ("cm", has_cmake_module), 282s ("h", has_hybrid_package), 282s ("p", has_pure_package), 282s ("pm", has_pure_module), 282s ], 282s ) 282s ) 282s ) 282s ) 282s except StopIteration: 282s path_types = [] 282s 282s def select_paths(annotated_paths): 282s """Return a filtered list paths considering ``path_types``. 282s 282s `annotated_paths`` is list of tuple ``(type, path)`` where type 282s is either `c`, 'cm', `h`, `p` or 'pm'. 282s 282s """ 282s return filter(lambda i: i[0] in path_types, annotated_paths) 282s 282s # Commented paths are the one expected to be installed by CMake. For 282s # this reason, corresponding files should NOT be created in the source 282s # tree. 282s for _type, path in select_paths( 282s [ 282s # ('c', 'cmake/__init__.py'), 282s # ('c', 'cmake/cmake.py'), 282s # ('cm', 'cmakeModule.py'), 282s ("h", "hybrid/__init__.py"), 282s # ('h', 'hybrid/hybrid_cmake.dat'), 282s # ('h', 'hybrid/hybrid_cmake.py'), 282s ("h", "hybrid/hybrid_pure.dat"), 282s ("h", "hybrid/hybrid_pure.py"), 282s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 282s ("h", "hybrid/data/hybrid_data_pure.dat"), 282s ("h", "hybrid/hybrid_2/__init__.py"), 282s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 282s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 282s ("p", "hybrid/hybrid_2_pure/__init__.py"), 282s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 282s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 282s ("pm", "pureModule.py"), 282s ("p", "pure/__init__.py"), 282s ("p", "pure/pure.py"), 282s ("p", "pure/data/pure.dat"), 282s ] 282s ): 282s assert _type in {"p", "pm", "h"} 282s root = package_base if _type in {"p", "pm"} else cmake_source_dir 282s tmp_dir.ensure(os.path.join(root, path)) 282s 282s # Do not call the real setup function. Instead, replace it with 282s # a MagicMock allowing to check with which arguments it was invoked. 282s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 282s 282s # Convenience print function 282s def _pprint(desc, value=None): 282s print( 282s "-----------------\n" 282s f"{desc}:\n" 282s "\n" 282s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 282s ) 282s 282s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 282s 282s _pprint = ._pprint at 0x709a44386d40> 282s _type = 'pm' 282s cmake_source_dir = 'to/the/base' 282s has_cmake_module = 0 282s has_cmake_package = 0 282s has_hybrid_package = 0 282s has_pure_module = 1 282s has_pure_package = 0 282s mock_setup = 282s mocker = 282s package_base = 'to/the/base' 282s package_base_dir = 'to/the/base/' 282s path = 'pureModule.py' 282s path_types = ('pm',) 282s root = 'to/the/base' 282s select_paths = .select_paths at 0x709a44384a40> 282s src_dir = local('/tmp/pytest-of-ubuntu/pytest-130/test_setup_inputs0/to/the/base') 282s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-130/test_setup_inputs0') 282s with_package_base = 1 282s 282s tests/test_setup.py:849: 282s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 282s /usr/lib/python3.12/contextlib.py:137: in __enter__ 282s return next(self.gen) 282s self = 282s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 282s 282s project_dir = local('/tmp/pytest-of-ubuntu/pytest-130/test_setup_inputs0') 282s setup_args = ['build'], disable_languages_test = True 282s 282s @contextmanager 282s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 282s """Context manager executing ``setup.py`` with the given arguments. 282s 282s It yields after changing the current working directory 282s to ``project_dir``. 282s """ 282s 282s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 282s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 282s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 282s 282s disable_languages_test = True 282s project_dir = local('/tmp/pytest-of-ubuntu/pytest-130/test_setup_inputs0') 282s setup_args = ['build'] 282s 282s tests/__init__.py:218: AttributeError 282s ________________________ test_setup_inputs[1-1-0-1-0-0] ________________________ 282s 282s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 1 282s has_pure_package = 0, has_pure_module = 1, with_package_base = 1 282s mocker = 282s 282s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 282s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 282s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 282s @pytest.mark.parametrize("has_pure_package", [0, 1]) 282s @pytest.mark.parametrize("has_pure_module", [0, 1]) 282s @pytest.mark.parametrize("with_package_base", [0, 1]) 282s def test_setup_inputs( 282s has_cmake_package, 282s has_cmake_module, 282s has_hybrid_package, 282s has_pure_package, 282s has_pure_module, 282s with_package_base, 282s mocker, 282s ): 282s """This test that a project can have a package with some modules 282s installed using setup.py and some other modules installed using CMake. 282s """ 282s 282s tmp_dir = _tmpdir("test_setup_inputs") 282s 282s package_base = "to/the/base" if with_package_base else "" 282s package_base_dir = package_base + "/" if package_base else "" 282s cmake_source_dir = package_base 282s 282s if cmake_source_dir and (has_cmake_package or has_cmake_module): 282s pytest.skip( 282s "unsupported configuration: " 282s "python package fully generated by CMake does *NOT* work. " 282s "At least __init__.py should be in the project source tree" 282s ) 282s 282s # ------------------------------------------------------------------------- 282s # Here is the "SOURCE" tree layout: 282s # 282s # ROOT/ 282s # 282s # setup.py 282s # 282s # [/] 282s # 282s # pureModule.py 282s # 282s # pure/ 282s # __init__.py 282s # pure.py 282s # 282s # data/ 282s # pure.dat 282s # 282s # [/] 282s # 282s # hybrid/ 282s # CMakeLists.txt 282s # __init__.py 282s # hybrid_pure.dat 282s # hybrid_pure.py 282s # 282s # data/ 282s # hybrid_data_pure.dat 282s # 282s # hybrid_2/ 282s # __init__.py 282s # hybrid_2_pure.py 282s # 282s # hybrid_2_pure/ 282s # __init__.py 282s # hybrid_2_pure_1.py 282s # hybrid_2_pure_2.py 282s # 282s # 282s # ------------------------------------------------------------------------- 282s # and here is the "BINARY" distribution layout: 282s # 282s # The comment "CMake" or "Setuptools" indicates which tool is responsible 282s # for placing the file in the tree used to create the binary distribution. 282s # 282s # ROOT/ 282s # 282s # cmakeModule.py # CMake 282s # 282s # cmake/ 282s # __init__.py # CMake 282s # cmake.py # CMake 282s # 282s # hybrid/ 282s # hybrid_cmake.dat # CMake 282s # hybrid_cmake.py # CMake 282s # hybrid_pure.dat # Setuptools 282s # hybrid_pure.py # Setuptools 282s # 282s # data/ 282s # hybrid_data_pure.dat # CMake or Setuptools 282s # hybrid_data_cmake.dat # CMake *NO TEST* 282s # 282s # hybrid_2/ 282s # __init__.py # CMake or Setuptools 282s # hybrid_2_pure.py # CMake or Setuptools 282s # hybrid_2_cmake.py # CMake 282s # 282s # hybrid_2_pure/ 282s # __init__.py # CMake or Setuptools 282s # hybrid_2_pure_1.py # CMake or Setuptools 282s # hybrid_2_pure_2.py # CMake or Setuptools 282s # 282s # pureModule.py # Setuptools 282s # 282s # pure/ 282s # __init__.py # Setuptools 282s # pure.py # Setuptools 282s # 282s # data/ 282s # pure.dat # Setuptools 282s 282s tmp_dir.join("setup.py").write( 282s textwrap.dedent( 282s """ 282s from skbuild import setup 282s #from setuptools import setup 282s setup( 282s name="test_hybrid_project", 282s version="1.2.3", 282s description=("an hybrid package mixing files installed by both " 282s "CMake and setuptools"), 282s author='The scikit-build team', 282s license="MIT", 282s cmake_source_dir='{cmake_source_dir}', 282s cmake_install_dir='{cmake_install_dir}', 282s # Arbitrary order of packages 282s packages=[ 282s {p_off} 'pure', 282s {h_off} 'hybrid.hybrid_2', 282s {h_off} 'hybrid', 282s {c_off} 'cmake', 282s {p_off} 'hybrid.hybrid_2_pure', 282s ], 282s py_modules=[ 282s {pm_off} '{package_base}pureModule', 282s {cm_off} '{package_base}cmakeModule', 282s ], 282s package_data={{ 282s {p_off} 'pure': ['data/pure.dat'], 282s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 282s }}, 282s # Arbitrary order of package_dir 282s package_dir = {{ 282s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 282s {p_off} 'pure': '{package_base}pure', 282s {h_off} 'hybrid': '{package_base}hybrid', 282s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 282s {c_off} 'cmake': '{package_base}cmake', 282s }} 282s ) 282s """.format( 282s cmake_source_dir=cmake_source_dir, 282s cmake_install_dir=package_base, 282s package_base=package_base_dir, 282s c_off="" if has_cmake_package else "#", 282s cm_off="" if has_cmake_module else "#", 282s h_off="" if has_hybrid_package else "#", 282s p_off="" if has_pure_package else "#", 282s pm_off="" if has_pure_module else "#", 282s ) 282s ) 282s ) 282s 282s src_dir = tmp_dir.ensure(package_base, dir=1) 282s 282s src_dir.join("CMakeLists.txt").write( 282s textwrap.dedent( 282s """ 282s cmake_minimum_required(VERSION 3.5.0) 282s project(hybrid NONE) 282s set(build_dir ${{CMAKE_BINARY_DIR}}) 282s 282s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 282s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 282s {c_off} install( 282s {c_off} FILES 282s {c_off} ${{build_dir}}/__init__.py 282s {c_off} ${{build_dir}}/cmake.py 282s {c_off} DESTINATION cmake 282s {c_off} ) 282s 282s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 282s {cm_off} install( 282s {cm_off} FILES ${{build_dir}}/cmakeModule.py 282s {cm_off} DESTINATION .) 282s 282s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 282s {h_off} install( 282s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 282s {h_off} DESTINATION hybrid) 282s 282s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 282s {h_off} install( 282s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 282s {h_off} DESTINATION hybrid) 282s 282s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 282s {h_off} install( 282s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 282s {h_off} DESTINATION hybrid/data) 282s 282s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 282s {h_off} install( 282s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 282s {h_off} DESTINATION hybrid/hybrid_2) 282s 282s install(CODE "message(STATUS \\\"Installation complete\\\")") 282s """.format( 282s c_off="" if has_cmake_package else "#", 282s cm_off="" if has_cmake_module else "#", 282s h_off="" if has_hybrid_package else "#", 282s ) 282s ) 282s ) 282s 282s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 282s path_types: Sequence[str] 282s try: 282s path_types = next( 282s iter( 282s zip( 282s *filter( 282s lambda i: i[1], 282s [ 282s ("c", has_cmake_package), 282s ("cm", has_cmake_module), 282s ("h", has_hybrid_package), 282s ("p", has_pure_package), 282s ("pm", has_pure_module), 282s ], 282s ) 282s ) 282s ) 282s ) 282s except StopIteration: 282s path_types = [] 282s 282s def select_paths(annotated_paths): 282s """Return a filtered list paths considering ``path_types``. 282s 282s `annotated_paths`` is list of tuple ``(type, path)`` where type 282s is either `c`, 'cm', `h`, `p` or 'pm'. 282s 282s """ 282s return filter(lambda i: i[0] in path_types, annotated_paths) 282s 282s # Commented paths are the one expected to be installed by CMake. For 282s # this reason, corresponding files should NOT be created in the source 282s # tree. 282s for _type, path in select_paths( 282s [ 282s # ('c', 'cmake/__init__.py'), 282s # ('c', 'cmake/cmake.py'), 282s # ('cm', 'cmakeModule.py'), 282s ("h", "hybrid/__init__.py"), 282s # ('h', 'hybrid/hybrid_cmake.dat'), 282s # ('h', 'hybrid/hybrid_cmake.py'), 282s ("h", "hybrid/hybrid_pure.dat"), 282s ("h", "hybrid/hybrid_pure.py"), 282s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 282s ("h", "hybrid/data/hybrid_data_pure.dat"), 282s ("h", "hybrid/hybrid_2/__init__.py"), 282s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 282s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 282s ("p", "hybrid/hybrid_2_pure/__init__.py"), 282s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 282s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 282s ("pm", "pureModule.py"), 282s ("p", "pure/__init__.py"), 282s ("p", "pure/pure.py"), 282s ("p", "pure/data/pure.dat"), 282s ] 282s ): 282s assert _type in {"p", "pm", "h"} 282s root = package_base if _type in {"p", "pm"} else cmake_source_dir 282s tmp_dir.ensure(os.path.join(root, path)) 282s 282s # Do not call the real setup function. Instead, replace it with 282s # a MagicMock allowing to check with which arguments it was invoked. 282s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 282s 282s # Convenience print function 282s def _pprint(desc, value=None): 282s print( 282s "-----------------\n" 282s f"{desc}:\n" 282s "\n" 282s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 282s ) 282s 282s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 282s 282s _pprint = ._pprint at 0x709a4420c860> 282s _type = 'pm' 282s cmake_source_dir = 'to/the/base' 282s has_cmake_module = 0 282s has_cmake_package = 0 282s has_hybrid_package = 1 282s has_pure_module = 1 282s has_pure_package = 0 282s mock_setup = 282s mocker = 282s package_base = 'to/the/base' 282s package_base_dir = 'to/the/base/' 282s path = 'pureModule.py' 282s path_types = ('h', 'pm') 282s root = 'to/the/base' 282s select_paths = .select_paths at 0x709a4420ccc0> 282s src_dir = local('/tmp/pytest-of-ubuntu/pytest-134/test_setup_inputs0/to/the/base') 282s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-134/test_setup_inputs0') 282s with_package_base = 1 282s 282s tests/test_setup.py:849: 282s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 282s /usr/lib/python3.12/contextlib.py:137: in __enter__ 282s return next(self.gen) 282s self = 282s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 282s 282s project_dir = local('/tmp/pytest-of-ubuntu/pytest-134/test_setup_inputs0') 282s setup_args = ['build'], disable_languages_test = True 282s 282s @contextmanager 282s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 282s """Context manager executing ``setup.py`` with the given arguments. 282s 282s It yields after changing the current working directory 282s to ``project_dir``. 282s """ 282s 282s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 282s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 282s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 282s 282s disable_languages_test = True 282s project_dir = local('/tmp/pytest-of-ubuntu/pytest-134/test_setup_inputs0') 282s setup_args = ['build'] 282s 282s tests/__init__.py:218: AttributeError 282s ________________________ test_setup_inputs[1-1-1-0-0-0] ________________________ 282s 282s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 0 282s has_pure_package = 1, has_pure_module = 1, with_package_base = 1 282s mocker = 282s 282s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 282s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 282s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 282s @pytest.mark.parametrize("has_pure_package", [0, 1]) 282s @pytest.mark.parametrize("has_pure_module", [0, 1]) 282s @pytest.mark.parametrize("with_package_base", [0, 1]) 282s def test_setup_inputs( 282s has_cmake_package, 282s has_cmake_module, 282s has_hybrid_package, 282s has_pure_package, 282s has_pure_module, 282s with_package_base, 282s mocker, 282s ): 282s """This test that a project can have a package with some modules 282s installed using setup.py and some other modules installed using CMake. 282s """ 282s 282s tmp_dir = _tmpdir("test_setup_inputs") 282s 282s package_base = "to/the/base" if with_package_base else "" 282s package_base_dir = package_base + "/" if package_base else "" 282s cmake_source_dir = package_base 282s 282s if cmake_source_dir and (has_cmake_package or has_cmake_module): 282s pytest.skip( 282s "unsupported configuration: " 282s "python package fully generated by CMake does *NOT* work. " 282s "At least __init__.py should be in the project source tree" 282s ) 282s 282s # ------------------------------------------------------------------------- 282s # Here is the "SOURCE" tree layout: 282s # 282s # ROOT/ 282s # 282s # setup.py 282s # 282s # [/] 282s # 282s # pureModule.py 282s # 282s # pure/ 282s # __init__.py 282s # pure.py 282s # 282s # data/ 282s # pure.dat 282s # 282s # [/] 282s # 282s # hybrid/ 282s # CMakeLists.txt 282s # __init__.py 282s # hybrid_pure.dat 282s # hybrid_pure.py 282s # 282s # data/ 282s # hybrid_data_pure.dat 282s # 282s # hybrid_2/ 282s # __init__.py 282s # hybrid_2_pure.py 282s # 282s # hybrid_2_pure/ 282s # __init__.py 282s # hybrid_2_pure_1.py 282s # hybrid_2_pure_2.py 282s # 282s # 282s # ------------------------------------------------------------------------- 282s # and here is the "BINARY" distribution layout: 282s # 282s # The comment "CMake" or "Setuptools" indicates which tool is responsible 282s # for placing the file in the tree used to create the binary distribution. 282s # 282s # ROOT/ 282s # 282s # cmakeModule.py # CMake 282s # 282s # cmake/ 282s # __init__.py # CMake 282s # cmake.py # CMake 282s # 282s # hybrid/ 282s # hybrid_cmake.dat # CMake 282s # hybrid_cmake.py # CMake 282s # hybrid_pure.dat # Setuptools 282s # hybrid_pure.py # Setuptools 282s # 282s # data/ 282s # hybrid_data_pure.dat # CMake or Setuptools 282s # hybrid_data_cmake.dat # CMake *NO TEST* 282s # 282s # hybrid_2/ 282s # __init__.py # CMake or Setuptools 282s # hybrid_2_pure.py # CMake or Setuptools 282s # hybrid_2_cmake.py # CMake 282s # 282s # hybrid_2_pure/ 282s # __init__.py # CMake or Setuptools 282s # hybrid_2_pure_1.py # CMake or Setuptools 282s # hybrid_2_pure_2.py # CMake or Setuptools 282s # 282s # pureModule.py # Setuptools 282s # 282s # pure/ 282s # __init__.py # Setuptools 282s # pure.py # Setuptools 282s # 282s # data/ 282s # pure.dat # Setuptools 282s 282s tmp_dir.join("setup.py").write( 282s textwrap.dedent( 282s """ 282s from skbuild import setup 282s #from setuptools import setup 282s setup( 282s name="test_hybrid_project", 282s version="1.2.3", 282s description=("an hybrid package mixing files installed by both " 282s "CMake and setuptools"), 282s author='The scikit-build team', 282s license="MIT", 282s cmake_source_dir='{cmake_source_dir}', 282s cmake_install_dir='{cmake_install_dir}', 282s # Arbitrary order of packages 282s packages=[ 282s {p_off} 'pure', 282s {h_off} 'hybrid.hybrid_2', 282s {h_off} 'hybrid', 282s {c_off} 'cmake', 282s {p_off} 'hybrid.hybrid_2_pure', 282s ], 282s py_modules=[ 282s {pm_off} '{package_base}pureModule', 282s {cm_off} '{package_base}cmakeModule', 282s ], 282s package_data={{ 282s {p_off} 'pure': ['data/pure.dat'], 282s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 282s }}, 282s # Arbitrary order of package_dir 282s package_dir = {{ 282s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 282s {p_off} 'pure': '{package_base}pure', 282s {h_off} 'hybrid': '{package_base}hybrid', 282s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 282s {c_off} 'cmake': '{package_base}cmake', 282s }} 282s ) 282s """.format( 282s cmake_source_dir=cmake_source_dir, 282s cmake_install_dir=package_base, 282s package_base=package_base_dir, 282s c_off="" if has_cmake_package else "#", 282s cm_off="" if has_cmake_module else "#", 282s h_off="" if has_hybrid_package else "#", 282s p_off="" if has_pure_package else "#", 282s pm_off="" if has_pure_module else "#", 282s ) 282s ) 282s ) 282s 282s src_dir = tmp_dir.ensure(package_base, dir=1) 282s 282s src_dir.join("CMakeLists.txt").write( 282s textwrap.dedent( 282s """ 282s cmake_minimum_required(VERSION 3.5.0) 282s project(hybrid NONE) 282s set(build_dir ${{CMAKE_BINARY_DIR}}) 282s 282s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 282s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 282s {c_off} install( 282s {c_off} FILES 282s {c_off} ${{build_dir}}/__init__.py 282s {c_off} ${{build_dir}}/cmake.py 282s {c_off} DESTINATION cmake 282s {c_off} ) 282s 282s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 282s {cm_off} install( 282s {cm_off} FILES ${{build_dir}}/cmakeModule.py 282s {cm_off} DESTINATION .) 282s 282s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 282s {h_off} install( 282s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 282s {h_off} DESTINATION hybrid) 282s 282s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 282s {h_off} install( 282s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 282s {h_off} DESTINATION hybrid) 282s 282s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 282s {h_off} install( 282s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 282s {h_off} DESTINATION hybrid/data) 282s 282s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 282s {h_off} install( 282s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 282s {h_off} DESTINATION hybrid/hybrid_2) 282s 282s install(CODE "message(STATUS \\\"Installation complete\\\")") 282s """.format( 282s c_off="" if has_cmake_package else "#", 282s cm_off="" if has_cmake_module else "#", 282s h_off="" if has_hybrid_package else "#", 282s ) 282s ) 282s ) 282s 282s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 282s path_types: Sequence[str] 282s try: 282s path_types = next( 282s iter( 282s zip( 282s *filter( 282s lambda i: i[1], 282s [ 282s ("c", has_cmake_package), 282s ("cm", has_cmake_module), 282s ("h", has_hybrid_package), 282s ("p", has_pure_package), 282s ("pm", has_pure_module), 282s ], 282s ) 282s ) 282s ) 282s ) 282s except StopIteration: 282s path_types = [] 282s 282s def select_paths(annotated_paths): 282s """Return a filtered list paths considering ``path_types``. 282s 282s `annotated_paths`` is list of tuple ``(type, path)`` where type 282s is either `c`, 'cm', `h`, `p` or 'pm'. 282s 282s """ 282s return filter(lambda i: i[0] in path_types, annotated_paths) 282s 282s # Commented paths are the one expected to be installed by CMake. For 282s # this reason, corresponding files should NOT be created in the source 282s # tree. 282s for _type, path in select_paths( 282s [ 282s # ('c', 'cmake/__init__.py'), 282s # ('c', 'cmake/cmake.py'), 282s # ('cm', 'cmakeModule.py'), 282s ("h", "hybrid/__init__.py"), 282s # ('h', 'hybrid/hybrid_cmake.dat'), 282s # ('h', 'hybrid/hybrid_cmake.py'), 282s ("h", "hybrid/hybrid_pure.dat"), 282s ("h", "hybrid/hybrid_pure.py"), 282s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 282s ("h", "hybrid/data/hybrid_data_pure.dat"), 282s ("h", "hybrid/hybrid_2/__init__.py"), 282s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 282s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 282s ("p", "hybrid/hybrid_2_pure/__init__.py"), 282s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 282s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 282s ("pm", "pureModule.py"), 282s ("p", "pure/__init__.py"), 282s ("p", "pure/pure.py"), 282s ("p", "pure/data/pure.dat"), 282s ] 282s ): 282s assert _type in {"p", "pm", "h"} 282s root = package_base if _type in {"p", "pm"} else cmake_source_dir 282s tmp_dir.ensure(os.path.join(root, path)) 282s 282s # Do not call the real setup function. Instead, replace it with 282s # a MagicMock allowing to check with which arguments it was invoked. 282s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 282s 282s # Convenience print function 282s def _pprint(desc, value=None): 282s print( 282s "-----------------\n" 282s f"{desc}:\n" 282s "\n" 282s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 282s ) 282s 282s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 282s 282s _pprint = ._pprint at 0x709a4420e480> 282s _type = 'p' 282s cmake_source_dir = 'to/the/base' 282s has_cmake_module = 0 282s has_cmake_package = 0 282s has_hybrid_package = 0 282s has_pure_module = 1 282s has_pure_package = 1 282s mock_setup = 282s mocker = 282s package_base = 'to/the/base' 282s package_base_dir = 'to/the/base/' 282s path = 'pure/data/pure.dat' 282s path_types = ('p', 'pm') 282s root = 'to/the/base' 282s select_paths = .select_paths at 0x709a4420e200> 282s src_dir = local('/tmp/pytest-of-ubuntu/pytest-138/test_setup_inputs0/to/the/base') 282s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-138/test_setup_inputs0') 282s with_package_base = 1 282s 282s tests/test_setup.py:849: 282s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 282s /usr/lib/python3.12/contextlib.py:137: in __enter__ 282s return next(self.gen) 282s self = 282s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 282s 282s project_dir = local('/tmp/pytest-of-ubuntu/pytest-138/test_setup_inputs0') 282s setup_args = ['build'], disable_languages_test = True 282s 282s @contextmanager 282s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 282s """Context manager executing ``setup.py`` with the given arguments. 282s 282s It yields after changing the current working directory 282s to ``project_dir``. 282s """ 282s 282s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 282s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 282s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 282s 282s disable_languages_test = True 282s project_dir = local('/tmp/pytest-of-ubuntu/pytest-138/test_setup_inputs0') 282s setup_args = ['build'] 282s 282s tests/__init__.py:218: AttributeError 282s ________________________ test_setup_inputs[1-1-1-1-0-0] ________________________ 282s 282s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 1 282s has_pure_package = 1, has_pure_module = 1, with_package_base = 1 282s mocker = 282s 282s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 282s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 282s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 282s @pytest.mark.parametrize("has_pure_package", [0, 1]) 282s @pytest.mark.parametrize("has_pure_module", [0, 1]) 282s @pytest.mark.parametrize("with_package_base", [0, 1]) 282s def test_setup_inputs( 282s has_cmake_package, 282s has_cmake_module, 282s has_hybrid_package, 282s has_pure_package, 282s has_pure_module, 282s with_package_base, 282s mocker, 282s ): 282s """This test that a project can have a package with some modules 282s installed using setup.py and some other modules installed using CMake. 282s """ 282s 282s tmp_dir = _tmpdir("test_setup_inputs") 282s 282s package_base = "to/the/base" if with_package_base else "" 282s package_base_dir = package_base + "/" if package_base else "" 282s cmake_source_dir = package_base 282s 282s if cmake_source_dir and (has_cmake_package or has_cmake_module): 282s pytest.skip( 282s "unsupported configuration: " 282s "python package fully generated by CMake does *NOT* work. " 282s "At least __init__.py should be in the project source tree" 282s ) 282s 282s # ------------------------------------------------------------------------- 282s # Here is the "SOURCE" tree layout: 282s # 282s # ROOT/ 282s # 282s # setup.py 282s # 282s # [/] 282s # 282s # pureModule.py 282s # 282s # pure/ 282s # __init__.py 282s # pure.py 282s # 282s # data/ 282s # pure.dat 282s # 282s # [/] 282s # 282s # hybrid/ 282s # CMakeLists.txt 282s # __init__.py 282s # hybrid_pure.dat 282s # hybrid_pure.py 282s # 282s # data/ 282s # hybrid_data_pure.dat 282s # 282s # hybrid_2/ 282s # __init__.py 282s # hybrid_2_pure.py 282s # 282s # hybrid_2_pure/ 282s # __init__.py 282s # hybrid_2_pure_1.py 282s # hybrid_2_pure_2.py 282s # 282s # 282s # ------------------------------------------------------------------------- 282s # and here is the "BINARY" distribution layout: 282s # 282s # The comment "CMake" or "Setuptools" indicates which tool is responsible 282s # for placing the file in the tree used to create the binary distribution. 282s # 282s # ROOT/ 282s # 282s # cmakeModule.py # CMake 282s # 282s # cmake/ 282s # __init__.py # CMake 282s # cmake.py # CMake 282s # 282s # hybrid/ 282s # hybrid_cmake.dat # CMake 282s # hybrid_cmake.py # CMake 282s # hybrid_pure.dat # Setuptools 282s # hybrid_pure.py # Setuptools 282s # 282s # data/ 282s # hybrid_data_pure.dat # CMake or Setuptools 282s # hybrid_data_cmake.dat # CMake *NO TEST* 282s # 282s # hybrid_2/ 282s # __init__.py # CMake or Setuptools 282s # hybrid_2_pure.py # CMake or Setuptools 282s # hybrid_2_cmake.py # CMake 282s # 282s # hybrid_2_pure/ 282s # __init__.py # CMake or Setuptools 282s # hybrid_2_pure_1.py # CMake or Setuptools 282s # hybrid_2_pure_2.py # CMake or Setuptools 282s # 282s # pureModule.py # Setuptools 282s # 282s # pure/ 282s # __init__.py # Setuptools 282s # pure.py # Setuptools 282s # 282s # data/ 282s # pure.dat # Setuptools 282s 282s tmp_dir.join("setup.py").write( 282s textwrap.dedent( 282s """ 282s from skbuild import setup 282s #from setuptools import setup 282s setup( 282s name="test_hybrid_project", 282s version="1.2.3", 282s description=("an hybrid package mixing files installed by both " 282s "CMake and setuptools"), 282s author='The scikit-build team', 282s license="MIT", 282s cmake_source_dir='{cmake_source_dir}', 282s cmake_install_dir='{cmake_install_dir}', 282s # Arbitrary order of packages 282s packages=[ 282s {p_off} 'pure', 282s {h_off} 'hybrid.hybrid_2', 282s {h_off} 'hybrid', 282s {c_off} 'cmake', 282s {p_off} 'hybrid.hybrid_2_pure', 282s ], 282s py_modules=[ 282s {pm_off} '{package_base}pureModule', 282s {cm_off} '{package_base}cmakeModule', 282s ], 282s package_data={{ 282s {p_off} 'pure': ['data/pure.dat'], 282s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 282s }}, 282s # Arbitrary order of package_dir 282s package_dir = {{ 282s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 282s {p_off} 'pure': '{package_base}pure', 282s {h_off} 'hybrid': '{package_base}hybrid', 282s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 282s {c_off} 'cmake': '{package_base}cmake', 282s }} 282s ) 282s """.format( 282s cmake_source_dir=cmake_source_dir, 282s cmake_install_dir=package_base, 282s package_base=package_base_dir, 282s c_off="" if has_cmake_package else "#", 282s cm_off="" if has_cmake_module else "#", 282s h_off="" if has_hybrid_package else "#", 282s p_off="" if has_pure_package else "#", 282s pm_off="" if has_pure_module else "#", 282s ) 282s ) 282s ) 282s 282s src_dir = tmp_dir.ensure(package_base, dir=1) 282s 282s src_dir.join("CMakeLists.txt").write( 282s textwrap.dedent( 282s """ 282s cmake_minimum_required(VERSION 3.5.0) 282s project(hybrid NONE) 282s set(build_dir ${{CMAKE_BINARY_DIR}}) 282s 282s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 282s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 282s {c_off} install( 282s {c_off} FILES 282s {c_off} ${{build_dir}}/__init__.py 282s {c_off} ${{build_dir}}/cmake.py 282s {c_off} DESTINATION cmake 282s {c_off} ) 282s 282s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 282s {cm_off} install( 282s {cm_off} FILES ${{build_dir}}/cmakeModule.py 282s {cm_off} DESTINATION .) 282s 282s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 282s {h_off} install( 282s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 282s {h_off} DESTINATION hybrid) 282s 282s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 282s {h_off} install( 282s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 282s {h_off} DESTINATION hybrid) 282s 282s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 282s {h_off} install( 282s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 282s {h_off} DESTINATION hybrid/data) 282s 282s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 282s {h_off} install( 282s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 282s {h_off} DESTINATION hybrid/hybrid_2) 282s 282s install(CODE "message(STATUS \\\"Installation complete\\\")") 282s """.format( 282s c_off="" if has_cmake_package else "#", 282s cm_off="" if has_cmake_module else "#", 282s h_off="" if has_hybrid_package else "#", 282s ) 282s ) 282s ) 282s 282s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 282s path_types: Sequence[str] 282s try: 282s path_types = next( 282s iter( 282s zip( 282s *filter( 282s lambda i: i[1], 282s [ 282s ("c", has_cmake_package), 282s ("cm", has_cmake_module), 282s ("h", has_hybrid_package), 282s ("p", has_pure_package), 282s ("pm", has_pure_module), 282s ], 282s ) 282s ) 282s ) 282s ) 282s except StopIteration: 282s path_types = [] 282s 282s def select_paths(annotated_paths): 282s """Return a filtered list paths considering ``path_types``. 282s 282s `annotated_paths`` is list of tuple ``(type, path)`` where type 282s is either `c`, 'cm', `h`, `p` or 'pm'. 282s 282s """ 282s return filter(lambda i: i[0] in path_types, annotated_paths) 282s 282s # Commented paths are the one expected to be installed by CMake. For 282s # this reason, corresponding files should NOT be created in the source 282s # tree. 282s for _type, path in select_paths( 282s [ 282s # ('c', 'cmake/__init__.py'), 282s # ('c', 'cmake/cmake.py'), 282s # ('cm', 'cmakeModule.py'), 282s ("h", "hybrid/__init__.py"), 282s # ('h', 'hybrid/hybrid_cmake.dat'), 282s # ('h', 'hybrid/hybrid_cmake.py'), 282s ("h", "hybrid/hybrid_pure.dat"), 282s ("h", "hybrid/hybrid_pure.py"), 282s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 282s ("h", "hybrid/data/hybrid_data_pure.dat"), 282s ("h", "hybrid/hybrid_2/__init__.py"), 282s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 282s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 282s ("p", "hybrid/hybrid_2_pure/__init__.py"), 282s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 282s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 282s ("pm", "pureModule.py"), 282s ("p", "pure/__init__.py"), 282s ("p", "pure/pure.py"), 282s ("p", "pure/data/pure.dat"), 282s ] 282s ): 282s assert _type in {"p", "pm", "h"} 282s root = package_base if _type in {"p", "pm"} else cmake_source_dir 282s tmp_dir.ensure(os.path.join(root, path)) 282s 282s # Do not call the real setup function. Instead, replace it with 282s # a MagicMock allowing to check with which arguments it was invoked. 282s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 282s 282s # Convenience print function 282s def _pprint(desc, value=None): 282s print( 282s "-----------------\n" 282s f"{desc}:\n" 282s "\n" 282s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 282s ) 282s 282s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 282s 282s _pprint = ._pprint at 0x709a4420c400> 282s _type = 'p' 282s cmake_source_dir = 'to/the/base' 282s has_cmake_module = 0 282s has_cmake_package = 0 282s has_hybrid_package = 1 282s has_pure_module = 1 282s has_pure_package = 1 282s mock_setup = 282s mocker = 282s package_base = 'to/the/base' 282s package_base_dir = 'to/the/base/' 282s path = 'pure/data/pure.dat' 282s path_types = ('h', 'p', 'pm') 282s root = 'to/the/base' 282s select_paths = .select_paths at 0x709a4420dda0> 282s src_dir = local('/tmp/pytest-of-ubuntu/pytest-142/test_setup_inputs0/to/the/base') 282s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-142/test_setup_inputs0') 282s with_package_base = 1 282s 282s tests/test_setup.py:849: 282s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 282s /usr/lib/python3.12/contextlib.py:137: in __enter__ 282s return next(self.gen) 282s self = 282s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 282s 282s project_dir = local('/tmp/pytest-of-ubuntu/pytest-142/test_setup_inputs0') 282s setup_args = ['build'], disable_languages_test = True 282s 282s @contextmanager 282s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 282s """Context manager executing ``setup.py`` with the given arguments. 282s 282s It yields after changing the current working directory 282s to ``project_dir``. 282s """ 282s 282s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 282s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 282s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 282s 282s disable_languages_test = True 282s project_dir = local('/tmp/pytest-of-ubuntu/pytest-142/test_setup_inputs0') 282s setup_args = ['build'] 282s 282s tests/__init__.py:218: AttributeError 282s ___________________ test_cmake_install_into_pure_package[0] ____________________ 282s 282s with_cmake_source_dir = 0 282s capsys = <_pytest.capture.CaptureFixture object at 0x709a442f0200> 282s caplog = <_pytest.logging.LogCaptureFixture object at 0x709a443af170> 282s 282s @pytest.mark.parametrize("with_cmake_source_dir", [0, 1]) 282s def test_cmake_install_into_pure_package(with_cmake_source_dir, capsys, caplog): 282s # ------------------------------------------------------------------------- 282s # "SOURCE" tree layout: 282s # 282s # (1) with_cmake_source_dir == 0 282s # 282s # ROOT/ 282s # 282s # CMakeLists.txt 282s # setup.py 282s # 282s # fruits/ 282s # __init__.py 282s # 282s # 282s # (2) with_cmake_source_dir == 1 282s # 282s # ROOT/ 282s # 282s # setup.py 282s # 282s # fruits/ 282s # __init__.py 282s # 282s # src/ 282s # 282s # CMakeLists.txt 282s # 282s # ------------------------------------------------------------------------- 282s # "BINARY" distribution layout: 282s # 282s # ROOT/ 282s # 282s # fruits/ 282s # 282s # __init__.py 282s # apple.py 282s # banana.py 282s # 282s # data/ 282s # 282s # apple.dat 282s # banana.dat 282s # 282s 282s tmp_dir = _tmpdir("cmake_install_into_pure_package") 282s 282s cmake_source_dir = "src" if with_cmake_source_dir else "" 282s 282s tmp_dir.join("setup.py").write( 282s textwrap.dedent( 282s f""" 282s from skbuild import setup 282s setup( 282s name="test_py_modules_keyword", 282s version="1.2.3", 282s description="a package testing use of py_modules keyword", 282s author='The scikit-build team', 282s license="MIT", 282s packages=['fruits'], 282s cmake_install_dir='fruits', 282s cmake_source_dir='{cmake_source_dir}', 282s ) 282s """ 282s ) 282s ) 282s 282s cmake_src_dir = tmp_dir.ensure(cmake_source_dir, dir=1) 282s cmake_src_dir.join("CMakeLists.txt").write( 282s textwrap.dedent( 282s """ 282s cmake_minimum_required(VERSION 3.5.0) 282s project(test NONE) 282s file(WRITE "${CMAKE_BINARY_DIR}/apple.py" "# apple.py") 282s file(WRITE "${CMAKE_BINARY_DIR}/banana.py" "# banana.py") 282s install( 282s FILES 282s "${CMAKE_BINARY_DIR}/apple.py" 282s "${CMAKE_BINARY_DIR}/banana.py" 282s DESTINATION "." 282s ) 282s file(WRITE "${CMAKE_BINARY_DIR}/apple.dat" "# apple.dat") 282s file(WRITE "${CMAKE_BINARY_DIR}/banana.dat" "# banana.dat") 282s install( 282s FILES 282s "${CMAKE_BINARY_DIR}/apple.dat" 282s "${CMAKE_BINARY_DIR}/banana.dat" 282s DESTINATION "data" 282s ) 282s """ 282s ) 282s ) 282s 282s tmp_dir.ensure("fruits/__init__.py") 282s 282s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 282s 282s caplog = <_pytest.logging.LogCaptureFixture object at 0x709a443af170> 282s capsys = <_pytest.capture.CaptureFixture object at 0x709a442f0200> 282s cmake_source_dir = '' 282s cmake_src_dir = local('/tmp/pytest-of-ubuntu/pytest-146/cmake_install_into_pure_packag0') 282s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-146/cmake_install_into_pure_packag0') 282s with_cmake_source_dir = 0 282s 282s tests/test_setup.py:1031: 282s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 282s /usr/lib/python3.12/contextlib.py:137: in __enter__ 282s return next(self.gen) 282s self = 282s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 282s 282s project_dir = local('/tmp/pytest-of-ubuntu/pytest-146/cmake_install_into_pure_packag0') 282s setup_args = ['build'], disable_languages_test = True 282s 282s @contextmanager 282s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 282s """Context manager executing ``setup.py`` with the given arguments. 282s 282s It yields after changing the current working directory 282s to ``project_dir``. 282s """ 282s 282s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 282s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 282s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 282s 282s disable_languages_test = True 282s project_dir = local('/tmp/pytest-of-ubuntu/pytest-146/cmake_install_into_pure_packag0') 282s setup_args = ['build'] 282s 282s tests/__init__.py:218: AttributeError 282s ___________________ test_cmake_install_into_pure_package[1] ____________________ 282s 282s with_cmake_source_dir = 1 282s capsys = <_pytest.capture.CaptureFixture object at 0x709a44365670> 282s caplog = <_pytest.logging.LogCaptureFixture object at 0x709a442f21e0> 282s 282s @pytest.mark.parametrize("with_cmake_source_dir", [0, 1]) 282s def test_cmake_install_into_pure_package(with_cmake_source_dir, capsys, caplog): 282s # ------------------------------------------------------------------------- 282s # "SOURCE" tree layout: 282s # 282s # (1) with_cmake_source_dir == 0 282s # 282s # ROOT/ 282s # 282s # CMakeLists.txt 282s # setup.py 282s # 282s # fruits/ 282s # __init__.py 282s # 282s # 282s # (2) with_cmake_source_dir == 1 282s # 282s # ROOT/ 282s # 282s # setup.py 282s # 282s # fruits/ 282s # __init__.py 282s # 282s # src/ 282s # 282s # CMakeLists.txt 282s # 282s # ------------------------------------------------------------------------- 282s # "BINARY" distribution layout: 282s # 282s # ROOT/ 282s # 282s # fruits/ 282s # 282s # __init__.py 282s # apple.py 282s # banana.py 282s # 282s # data/ 282s # 282s # apple.dat 282s # banana.dat 282s # 282s 282s tmp_dir = _tmpdir("cmake_install_into_pure_package") 282s 282s cmake_source_dir = "src" if with_cmake_source_dir else "" 282s 282s tmp_dir.join("setup.py").write( 282s textwrap.dedent( 282s f""" 282s from skbuild import setup 282s setup( 282s name="test_py_modules_keyword", 282s version="1.2.3", 282s description="a package testing use of py_modules keyword", 282s author='The scikit-build team', 282s license="MIT", 282s packages=['fruits'], 282s cmake_install_dir='fruits', 282s cmake_source_dir='{cmake_source_dir}', 282s ) 282s """ 282s ) 282s ) 282s 282s cmake_src_dir = tmp_dir.ensure(cmake_source_dir, dir=1) 282s cmake_src_dir.join("CMakeLists.txt").write( 282s textwrap.dedent( 282s """ 282s cmake_minimum_required(VERSION 3.5.0) 282s project(test NONE) 282s file(WRITE "${CMAKE_BINARY_DIR}/apple.py" "# apple.py") 282s file(WRITE "${CMAKE_BINARY_DIR}/banana.py" "# banana.py") 282s install( 282s FILES 282s "${CMAKE_BINARY_DIR}/apple.py" 282s "${CMAKE_BINARY_DIR}/banana.py" 282s DESTINATION "." 282s ) 282s file(WRITE "${CMAKE_BINARY_DIR}/apple.dat" "# apple.dat") 282s file(WRITE "${CMAKE_BINARY_DIR}/banana.dat" "# banana.dat") 282s install( 282s FILES 282s "${CMAKE_BINARY_DIR}/apple.dat" 282s "${CMAKE_BINARY_DIR}/banana.dat" 282s DESTINATION "data" 282s ) 282s """ 282s ) 282s ) 282s 282s tmp_dir.ensure("fruits/__init__.py") 282s 282s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 282s 282s caplog = <_pytest.logging.LogCaptureFixture object at 0x709a442f21e0> 282s capsys = <_pytest.capture.CaptureFixture object at 0x709a44365670> 282s cmake_source_dir = 'src' 282s cmake_src_dir = local('/tmp/pytest-of-ubuntu/pytest-147/cmake_install_into_pure_packag0/src') 282s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-147/cmake_install_into_pure_packag0') 282s with_cmake_source_dir = 1 282s 282s tests/test_setup.py:1031: 282s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 282s /usr/lib/python3.12/contextlib.py:137: in __enter__ 282s return next(self.gen) 282s self = 282s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 282s 282s project_dir = local('/tmp/pytest-of-ubuntu/pytest-147/cmake_install_into_pure_packag0') 282s setup_args = ['build'], disable_languages_test = True 282s 282s @contextmanager 282s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 282s """Context manager executing ``setup.py`` with the given arguments. 282s 282s It yields after changing the current working directory 282s to ``project_dir``. 282s """ 282s 282s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 282s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 282s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 282s 282s disable_languages_test = True 282s project_dir = local('/tmp/pytest-of-ubuntu/pytest-147/cmake_install_into_pure_packag0') 282s setup_args = ['build'] 282s 282s tests/__init__.py:218: AttributeError 282s _________________________ test_zip_safe_default[None] __________________________ 282s 282s zip_safe = None 282s mocker = 282s 282s @pytest.mark.parametrize("zip_safe", [None, False, True]) 282s def test_zip_safe_default(zip_safe, mocker): 282s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 282s 282s tmp_dir = _tmpdir("zip_safe_default") 282s 282s setup_kwarg = "" 282s if zip_safe is not None: 282s setup_kwarg = f"zip_safe={zip_safe}" 282s 282s tmp_dir.join("setup.py").write( 282s textwrap.dedent( 282s f""" 282s from skbuild import setup 282s setup( 282s name="zip_safe_default", 282s version="1.2.3", 282s description="a minimal example package", 282s author='The scikit-build team', 282s license="MIT", 282s {setup_kwarg} 282s ) 282s """ 282s ) 282s ) 282s tmp_dir.join("CMakeLists.txt").write( 282s textwrap.dedent( 282s """ 282s cmake_minimum_required(VERSION 3.5.0) 282s project(test NONE) 282s install(CODE "execute_process( 282s COMMAND \\${CMAKE_COMMAND} -E sleep 0)") 282s """ 282s ) 282s ) 282s 282s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 282s 282s mock_setup = 282s mocker = 282s setup_kwarg = '' 282s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-148/zip_safe_default0') 282s zip_safe = None 282s 282s tests/test_setup.py:1087: 282s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 282s /usr/lib/python3.12/contextlib.py:137: in __enter__ 282s return next(self.gen) 282s self = 282s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 282s 282s project_dir = local('/tmp/pytest-of-ubuntu/pytest-148/zip_safe_default0') 282s setup_args = ['build'], disable_languages_test = True 282s 282s @contextmanager 282s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 282s """Context manager executing ``setup.py`` with the given arguments. 282s 282s It yields after changing the current working directory 282s to ``project_dir``. 282s """ 282s 282s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 282s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 282s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 282s 282s disable_languages_test = True 282s project_dir = local('/tmp/pytest-of-ubuntu/pytest-148/zip_safe_default0') 282s setup_args = ['build'] 282s 282s tests/__init__.py:218: AttributeError 282s _________________________ test_zip_safe_default[False] _________________________ 282s 282s zip_safe = False 282s mocker = 282s 282s @pytest.mark.parametrize("zip_safe", [None, False, True]) 282s def test_zip_safe_default(zip_safe, mocker): 282s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 282s 282s tmp_dir = _tmpdir("zip_safe_default") 282s 282s setup_kwarg = "" 282s if zip_safe is not None: 282s setup_kwarg = f"zip_safe={zip_safe}" 282s 282s tmp_dir.join("setup.py").write( 282s textwrap.dedent( 282s f""" 282s from skbuild import setup 282s setup( 282s name="zip_safe_default", 282s version="1.2.3", 282s description="a minimal example package", 282s author='The scikit-build team', 282s license="MIT", 282s {setup_kwarg} 282s ) 282s """ 282s ) 282s ) 282s tmp_dir.join("CMakeLists.txt").write( 282s textwrap.dedent( 282s """ 282s cmake_minimum_required(VERSION 3.5.0) 282s project(test NONE) 282s install(CODE "execute_process( 282s COMMAND \\${CMAKE_COMMAND} -E sleep 0)") 282s """ 282s ) 282s ) 282s 282s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 282s 282s mock_setup = 282s mocker = 282s setup_kwarg = 'zip_safe=False' 282s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-149/zip_safe_default0') 282s zip_safe = False 282s 282s tests/test_setup.py:1087: 282s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 282s /usr/lib/python3.12/contextlib.py:137: in __enter__ 282s return next(self.gen) 282s self = 282s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 282s 282s project_dir = local('/tmp/pytest-of-ubuntu/pytest-149/zip_safe_default0') 282s setup_args = ['build'], disable_languages_test = True 282s 282s @contextmanager 282s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 282s """Context manager executing ``setup.py`` with the given arguments. 282s 282s It yields after changing the current working directory 282s to ``project_dir``. 282s """ 282s 282s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 282s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 282s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 282s 282s disable_languages_test = True 282s project_dir = local('/tmp/pytest-of-ubuntu/pytest-149/zip_safe_default0') 282s setup_args = ['build'] 282s 282s tests/__init__.py:218: AttributeError 282s _________________________ test_zip_safe_default[True] __________________________ 282s 282s zip_safe = True 282s mocker = 282s 282s @pytest.mark.parametrize("zip_safe", [None, False, True]) 282s def test_zip_safe_default(zip_safe, mocker): 282s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 282s 282s tmp_dir = _tmpdir("zip_safe_default") 282s 282s setup_kwarg = "" 282s if zip_safe is not None: 282s setup_kwarg = f"zip_safe={zip_safe}" 282s 282s tmp_dir.join("setup.py").write( 282s textwrap.dedent( 282s f""" 282s from skbuild import setup 282s setup( 282s name="zip_safe_default", 282s version="1.2.3", 282s description="a minimal example package", 282s author='The scikit-build team', 282s license="MIT", 282s {setup_kwarg} 282s ) 282s """ 282s ) 282s ) 282s tmp_dir.join("CMakeLists.txt").write( 282s textwrap.dedent( 282s """ 282s cmake_minimum_required(VERSION 3.5.0) 282s project(test NONE) 282s install(CODE "execute_process( 282s COMMAND \\${CMAKE_COMMAND} -E sleep 0)") 282s """ 282s ) 282s ) 282s 282s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 282s 282s mock_setup = 282s mocker = 282s setup_kwarg = 'zip_safe=True' 282s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-150/zip_safe_default0') 282s zip_safe = True 282s 282s tests/test_setup.py:1087: 282s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 282s /usr/lib/python3.12/contextlib.py:137: in __enter__ 282s return next(self.gen) 282s self = 282s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 282s 282s project_dir = local('/tmp/pytest-of-ubuntu/pytest-150/zip_safe_default0') 282s setup_args = ['build'], disable_languages_test = True 282s 282s @contextmanager 282s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 282s """Context manager executing ``setup.py`` with the given arguments. 282s 282s It yields after changing the current working directory 282s to ``project_dir``. 282s """ 282s 282s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 282s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 282s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 282s 282s disable_languages_test = True 282s project_dir = local('/tmp/pytest-of-ubuntu/pytest-150/zip_safe_default0') 282s setup_args = ['build'] 282s 282s tests/__init__.py:218: AttributeError 282s _____________________ test_generator[Unix Makefiles-make] ______________________ 282s 282s generator = 'Unix Makefiles', expected_make_program = 'make' 282s 282s @pytest.mark.parametrize( 282s ("generator", "expected_make_program"), [("NMake Makefiles", "nmake"), ("Unix Makefiles", "make")] 282s ) 282s def test_generator(generator, expected_make_program): 282s generator_platform = {"NMake Makefiles": ["windows"], "Unix Makefiles": ["darwin", "linux"]} 282s assert generator in generator_platform 282s 282s this_platform = platform.system().lower() 282s if this_platform not in generator_platform[generator]: 282s pytest.skip(f"{generator} generator is not available on {this_platform.title()}") 282s 282s if shutil.which(expected_make_program) is None: 282s pytest.skip(f"{expected_make_program} not available") 282s 282s @project_setup_py_test("hello-cpp", ["build"], ret=True) 282s def run_build(): 282s pass 282s 282s with push_env(CMAKE_GENERATOR=generator): 282s > tmp_dir = run_build()[0] 282s 282s expected_make_program = 'make' 282s generator = 'Unix Makefiles' 282s generator_platform = {'NMake Makefiles': ['windows'], 'Unix Makefiles': ['darwin', 'linux']} 282s run_build = .run_build at 0x709a4420d8a0> 282s this_platform = 'linux' 282s 282s tests/test_skbuild.py:94: 282s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 282s tests/__init__.py:255: in wrapped 282s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 282s disable_languages_test = False 282s fun = .run_build at 0x709a4420d440> 282s iargs = () 282s ikwargs = {} 282s ret = True 282s wrapped = .run_build at 0x709a4420d8a0> 282s /usr/lib/python3.12/contextlib.py:137: in __enter__ 282s return next(self.gen) 282s self = 282s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 282s 282s project_dir = local('/tmp/pytest-of-ubuntu/pytest-151/run_build0') 282s setup_args = ['build'], disable_languages_test = False 282s 282s @contextmanager 282s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 282s """Context manager executing ``setup.py`` with the given arguments. 282s 282s It yields after changing the current working directory 282s to ``project_dir``. 282s """ 282s 282s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 282s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 282s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 282s 282s disable_languages_test = False 282s project_dir = local('/tmp/pytest-of-ubuntu/pytest-151/run_build0') 282s setup_args = ['build'] 282s 282s tests/__init__.py:218: AttributeError 282s ----------------------------- Captured stdout call ----------------------------- 282s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-151/run_build0/.git/ 282s [master (root-commit) 3760139] Initial commit 282s 11 files changed, 115 insertions(+) 282s create mode 100644 CMakeLists.txt 282s create mode 100644 bonjour/__init__.py 282s create mode 100644 bonjour/data/ciel.txt 282s create mode 100644 bonjour/data/soleil.txt 282s create mode 100644 bonjour/data/terre.txt 282s create mode 100644 bonjourModule.py 282s create mode 100644 hello/CMakeLists.txt 282s create mode 100644 hello/__init__.py 282s create mode 100644 hello/__main__.py 282s create mode 100644 hello/_hello.cxx 282s create mode 100644 setup.py 282s ----------------------------- Captured stderr call ----------------------------- 282s hint: Using 'master' as the name for the initial branch. This default branch name 282s hint: is subject to change. To configure the initial branch name to use in all 282s hint: of your new repositories, which will suppress this warning, call: 282s hint: 282s hint: git config --global init.defaultBranch 282s hint: 282s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 282s hint: 'development'. The just-created branch can be renamed via this command: 282s hint: 282s hint: git branch -m 282s ___________________ test_invalid_generator[generator_args0] ____________________ 282s 282s generator_args = ['-G', 'invalid'] 282s 282s @pytest.mark.parametrize( 282s "generator_args", 282s [ 282s ["-G", "invalid"], 282s ["--", "-G", "invalid"], 282s ], 282s ) 282s def test_invalid_generator(generator_args): 282s with push_dir(): 282s build_args = ["build"] 282s build_args.extend(generator_args) 282s 282s @project_setup_py_test("hello-no-language", build_args, disable_languages_test=True) 282s def run(): 282s pass 282s 282s failed = False 282s message = "" 282s try: 282s > run() 282s 282s build_args = ['build', '-G', 'invalid'] 282s failed = False 282s generator_args = ['-G', 'invalid'] 282s message = '' 282s run = .run at 0x709a4420f240> 282s 282s tests/test_skbuild.py:121: 282s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 282s tests/__init__.py:255: in wrapped 282s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 282s disable_languages_test = True 282s fun = .run at 0x709a4420f100> 282s iargs = () 282s ikwargs = {} 282s ret = False 282s wrapped = .run at 0x709a4420f240> 282s /usr/lib/python3.12/contextlib.py:137: in __enter__ 282s return next(self.gen) 282s self = 282s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 282s 282s project_dir = local('/tmp/pytest-of-ubuntu/pytest-152/run0') 282s setup_args = ['build', '-G', 'invalid'], disable_languages_test = True 282s 282s @contextmanager 282s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 282s """Context manager executing ``setup.py`` with the given arguments. 282s 282s It yields after changing the current working directory 282s to ``project_dir``. 282s """ 282s 282s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 282s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 282s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 282s 282s disable_languages_test = True 282s project_dir = local('/tmp/pytest-of-ubuntu/pytest-152/run0') 282s setup_args = ['build', '-G', 'invalid'] 282s 282s tests/__init__.py:218: AttributeError 282s ----------------------------- Captured stdout call ----------------------------- 282s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-152/run0/.git/ 282s [master (root-commit) ab78788] Initial commit 282s 2 files changed, 16 insertions(+) 282s create mode 100644 CMakeLists.txt 282s create mode 100644 setup.py 282s ----------------------------- Captured stderr call ----------------------------- 282s hint: Using 'master' as the name for the initial branch. This default branch name 282s hint: is subject to change. To configure the initial branch name to use in all 282s hint: of your new repositories, which will suppress this warning, call: 282s hint: 282s hint: git config --global init.defaultBranch 282s hint: 282s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 282s hint: 'development'. The just-created branch can be renamed via this command: 282s hint: 282s hint: git branch -m 282s ___________________ test_invalid_generator[generator_args1] ____________________ 282s 282s generator_args = ['--', '-G', 'invalid'] 282s 282s @pytest.mark.parametrize( 282s "generator_args", 282s [ 282s ["-G", "invalid"], 282s ["--", "-G", "invalid"], 282s ], 282s ) 282s def test_invalid_generator(generator_args): 282s with push_dir(): 282s build_args = ["build"] 282s build_args.extend(generator_args) 282s 282s @project_setup_py_test("hello-no-language", build_args, disable_languages_test=True) 282s def run(): 282s pass 282s 282s failed = False 282s message = "" 282s try: 282s > run() 282s 282s build_args = ['build', '--', '-G', 'invalid'] 282s failed = False 282s generator_args = ['--', '-G', 'invalid'] 282s message = '' 282s run = .run at 0x709a4420d8a0> 282s 282s tests/test_skbuild.py:121: 282s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 282s tests/__init__.py:255: in wrapped 282s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 282s disable_languages_test = True 282s fun = .run at 0x709a4420f2e0> 282s iargs = () 282s ikwargs = {} 282s ret = False 282s wrapped = .run at 0x709a4420d8a0> 282s /usr/lib/python3.12/contextlib.py:137: in __enter__ 282s return next(self.gen) 282s self = 282s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 282s 282s project_dir = local('/tmp/pytest-of-ubuntu/pytest-153/run0') 282s setup_args = ['build', '--', '-G', 'invalid'], disable_languages_test = True 282s 282s @contextmanager 282s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 282s """Context manager executing ``setup.py`` with the given arguments. 282s 282s It yields after changing the current working directory 282s to ``project_dir``. 282s """ 282s 282s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 282s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 282s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 282s 282s disable_languages_test = True 282s project_dir = local('/tmp/pytest-of-ubuntu/pytest-153/run0') 282s setup_args = ['build', '--', '-G', 'invalid'] 282s 282s tests/__init__.py:218: AttributeError 282s ----------------------------- Captured stdout call ----------------------------- 282s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-153/run0/.git/ 282s [master (root-commit) ab78788] Initial commit 282s 2 files changed, 16 insertions(+) 282s create mode 100644 CMakeLists.txt 282s create mode 100644 setup.py 282s ----------------------------- Captured stderr call ----------------------------- 282s hint: Using 'master' as the name for the initial branch. This default branch name 282s hint: is subject to change. To configure the initial branch name to use in all 282s hint: of your new repositories, which will suppress this warning, call: 282s hint: 282s hint: git config --global init.defaultBranch 282s hint: 282s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 282s hint: 'development'. The just-created branch can be renamed via this command: 282s hint: 282s hint: git branch -m 282s _________________________ test_skbuild_variable_builds _________________________ 282s 282s iargs = (), ikwargs = {} 282s 282s @functools.wraps(fun) 282s def wrapped(*iargs, **ikwargs): 282s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 282s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 282s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 282s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 282s 282s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 282s 282s disable_languages_test = True 282s fun = 282s iargs = () 282s ikwargs = {} 282s ret = False 282s wrapped = 282s 282s tests/__init__.py:255: 282s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 282s /usr/lib/python3.12/contextlib.py:137: in __enter__ 282s return next(self.gen) 282s self = 282s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 282s 282s project_dir = local('/tmp/pytest-of-ubuntu/pytest-154/test_skbuild_variable_builds0') 282s setup_args = ['build'], disable_languages_test = True 282s 282s @contextmanager 282s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 282s """Context manager executing ``setup.py`` with the given arguments. 282s 282s It yields after changing the current working directory 282s to ``project_dir``. 282s """ 282s 282s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 282s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 282s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 282s 282s disable_languages_test = True 282s project_dir = local('/tmp/pytest-of-ubuntu/pytest-154/test_skbuild_variable_builds0') 282s setup_args = ['build'] 282s 282s tests/__init__.py:218: AttributeError 282s ----------------------------- Captured stdout call ----------------------------- 282s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-154/test_skbuild_variable_builds0/.git/ 282s [master (root-commit) 6bf7def] Initial commit 282s 2 files changed, 20 insertions(+) 282s create mode 100644 CMakeLists.txt 282s create mode 100644 setup.py 282s ----------------------------- Captured stderr call ----------------------------- 282s hint: Using 'master' as the name for the initial branch. This default branch name 282s hint: is subject to change. To configure the initial branch name to use in all 282s hint: of your new repositories, which will suppress this warning, call: 282s hint: 282s hint: git config --global init.defaultBranch 282s hint: 282s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 282s hint: 'development'. The just-created branch can be renamed via this command: 282s hint: 282s hint: git branch -m 282s _________________________ test_skbuild_variable_sdist __________________________ 282s 282s iargs = (), ikwargs = {} 282s 282s @functools.wraps(fun) 282s def wrapped(*iargs, **ikwargs): 282s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 282s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 282s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 282s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 282s 282s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 282s 282s disable_languages_test = True 282s fun = 282s iargs = () 282s ikwargs = {} 282s ret = False 282s wrapped = 282s 282s tests/__init__.py:255: 282s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 282s /usr/lib/python3.12/contextlib.py:137: in __enter__ 282s return next(self.gen) 282s self = 282s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 282s 282s project_dir = local('/tmp/pytest-of-ubuntu/pytest-155/test_skbuild_variable_sdist0') 282s setup_args = ['sdist'], disable_languages_test = True 282s 282s @contextmanager 282s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 282s """Context manager executing ``setup.py`` with the given arguments. 282s 282s It yields after changing the current working directory 282s to ``project_dir``. 282s """ 282s 282s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 282s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 282s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 282s 282s disable_languages_test = True 282s project_dir = local('/tmp/pytest-of-ubuntu/pytest-155/test_skbuild_variable_sdist0') 282s setup_args = ['sdist'] 282s 282s tests/__init__.py:218: AttributeError 282s ----------------------------- Captured stdout call ----------------------------- 282s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-155/test_skbuild_variable_sdist0/.git/ 282s [master (root-commit) 6bf7def] Initial commit 282s 2 files changed, 20 insertions(+) 282s create mode 100644 CMakeLists.txt 282s create mode 100644 setup.py 282s ----------------------------- Captured stderr call ----------------------------- 282s hint: Using 'master' as the name for the initial branch. This default branch name 282s hint: is subject to change. To configure the initial branch name to use in all 282s hint: of your new repositories, which will suppress this warning, call: 282s hint: 282s hint: git config --global init.defaultBranch 282s hint: 282s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 282s hint: 'development'. The just-created branch can be renamed via this command: 282s hint: 282s hint: git branch -m 282s _________________________ test_skbuild_variable_wheel __________________________ 282s 282s iargs = (), ikwargs = {} 282s 282s @functools.wraps(fun) 282s def wrapped(*iargs, **ikwargs): 282s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 282s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 282s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 282s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 282s 282s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 282s 282s disable_languages_test = True 282s fun = 282s iargs = () 282s ikwargs = {} 282s ret = False 282s wrapped = 282s 282s tests/__init__.py:255: 282s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 282s /usr/lib/python3.12/contextlib.py:137: in __enter__ 282s return next(self.gen) 282s self = 282s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 282s 282s project_dir = local('/tmp/pytest-of-ubuntu/pytest-156/test_skbuild_variable_wheel0') 282s setup_args = ['bdist_wheel'], disable_languages_test = True 282s 282s @contextmanager 282s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 282s """Context manager executing ``setup.py`` with the given arguments. 282s 282s It yields after changing the current working directory 282s to ``project_dir``. 282s """ 282s 282s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 282s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 282s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 282s 282s disable_languages_test = True 282s project_dir = local('/tmp/pytest-of-ubuntu/pytest-156/test_skbuild_variable_wheel0') 282s setup_args = ['bdist_wheel'] 282s 282s tests/__init__.py:218: AttributeError 282s ----------------------------- Captured stdout call ----------------------------- 282s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-156/test_skbuild_variable_wheel0/.git/ 282s [master (root-commit) 6bf7def] Initial commit 282s 2 files changed, 20 insertions(+) 282s create mode 100644 CMakeLists.txt 282s create mode 100644 setup.py 282s ----------------------------- Captured stderr call ----------------------------- 282s hint: Using 'master' as the name for the initial branch. This default branch name 282s hint: is subject to change. To configure the initial branch name to use in all 282s hint: of your new repositories, which will suppress this warning, call: 282s hint: 282s hint: git config --global init.defaultBranch 282s hint: 282s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 282s hint: 'development'. The just-created branch can be renamed via this command: 282s hint: 282s hint: git branch -m 282s =========================== short test summary info ============================ 282s SKIPPED [1] tests/test_hello_fortran.py:19: could not import 'numpy': No module named 'numpy' 282s SKIPPED [1] tests/test_platform.py:120: Requires Windows 282s SKIPPED [24] tests/test_setup.py:582: unsupported configuration: python package fully generated by CMake does *NOT* work. At least __init__.py should be in the project source tree 282s SKIPPED [1] tests/test_skbuild.py:84: NMake Makefiles generator is not available on Linux 282s SKIPPED [3] tests/test_skbuild.py:130: Requires Windows 282s SKIPPED [1] tests/test_skbuild.py:154: Requires Windows 282s FAILED tests/test_broken_project.py::test_cmakelists_with_fatalerror_fails - ... 282s FAILED tests/test_broken_project.py::test_cmakelists_with_syntaxerror_fails 282s FAILED tests/test_broken_project.py::test_hello_with_compileerror_fails - Att... 282s FAILED tests/test_broken_project.py::test_invalid_cmake[CalledProcessError] 282s FAILED tests/test_broken_project.py::test_invalid_cmake[OSError] - AttributeE... 282s FAILED tests/test_broken_project.py::test_first_invalid_generator - Attribute... 282s FAILED tests/test_broken_project.py::test_invalid_generator - AttributeError:... 282s FAILED tests/test_cmake_target.py::test_cmake_target_build - AttributeError: ... 282s FAILED tests/test_cmakelists_not_in_top_level_dir.py::test_build - AttributeE... 282s FAILED tests/test_cmakelists_not_in_top_level_dir.py::test_cmake_source_dir[invalid-True] 282s FAILED tests/test_cmakelists_not_in_top_level_dir.py::test_cmake_source_dir[-False] 282s FAILED tests/test_cmakelists_not_in_top_level_dir.py::test_cmake_source_dir[.-False] 282s FAILED tests/test_command_line.py::test_help - AttributeError: module 'distut... 282s FAILED tests/test_command_line.py::test_metadata_display - AttributeError: mo... 282s FAILED tests/test_command_line.py::test_no_command - AttributeError: module '... 282s FAILED tests/test_command_line.py::test_invalid_command - AttributeError: mod... 282s FAILED tests/test_command_line.py::test_too_many_separators - AttributeError:... 282s FAILED tests/test_command_line.py::test_cmake_initial_cache_as_global_option 282s FAILED tests/test_command_line.py::test_cmake_executable_arg - AttributeError... 282s FAILED tests/test_command_line.py::test_hide_listing[True-sdist] - AttributeE... 282s FAILED tests/test_command_line.py::test_hide_listing[True-bdist_wheel] - Attr... 282s FAILED tests/test_command_line.py::test_hide_listing[False-sdist] - Attribute... 282s FAILED tests/test_command_line.py::test_hide_listing[False-bdist_wheel] - Att... 282s FAILED tests/test_command_line.py::test_run_cmake_arg - AttributeError: modul... 282s FAILED tests/test_command_line.py::test_skip_cmake_arg - AttributeError: modu... 282s FAILED tests/test_cython_flags.py::test_hello_cython_builds - AttributeError:... 282s FAILED tests/test_filter_manifest.py::test_bdist_wheel_command - AttributeErr... 282s FAILED tests/test_hello_cpp.py::test_hello_builds - AttributeError: module 'd... 282s FAILED tests/test_hello_cpp.py::test_hello_wheel - AttributeError: module 'di... 282s FAILED tests/test_hello_cpp.py::test_hello_clean[with-dry-run] - AttributeErr... 282s FAILED tests/test_hello_cpp.py::test_hello_clean[without-dry-run] - Attribute... 282s FAILED tests/test_hello_cpp.py::test_hello_cleans - AttributeError: module 'd... 282s FAILED tests/test_hello_cython.py::test_hello_cython_builds - AttributeError:... 282s FAILED tests/test_hello_cython.py::test_hello_cython_sdist - AttributeError: ... 282s FAILED tests/test_hello_cython.py::test_hello_cython_wheel - AttributeError: ... 282s FAILED tests/test_hello_pure.py::test_hello_pure_builds - AttributeError: mod... 282s FAILED tests/test_hello_pure.py::test_hello_pure_sdist - AttributeError: modu... 282s FAILED tests/test_hello_pure.py::test_hello_pure_wheel - AttributeError: modu... 282s FAILED tests/test_hello_pure.py::test_hello_clean - AttributeError: module 'd... 282s FAILED tests/test_include_exclude_data.py::test_include_exclude_data - Attrib... 282s FAILED tests/test_include_exclude_data.py::test_include_exclude_data_with_base 282s FAILED tests/test_issue284_build_ext_inplace.py::test_build_ext_inplace_command 282s FAILED tests/test_issue335_support_cmake_source_dir.py::test_bdist_wheel_command 282s FAILED tests/test_issue342_cmake_osx_args_in_setup.py::test_cmake_args_keyword_osx_default[None-cli_setup_args0-keyword_cmake_args0-cli_cmake_args0-10.9] 282s FAILED tests/test_issue342_cmake_osx_args_in_setup.py::test_cmake_args_keyword_osx_default[10.7-cli_setup_args1-keyword_cmake_args1-cli_cmake_args1-10.7] 282s FAILED tests/test_issue342_cmake_osx_args_in_setup.py::test_cmake_args_keyword_osx_default[10.7-cli_setup_args2-keyword_cmake_args2-cli_cmake_args2-10.9] 282s FAILED tests/test_issue342_cmake_osx_args_in_setup.py::test_cmake_args_keyword_osx_default[None-cli_setup_args3-keyword_cmake_args3-cli_cmake_args3-10.6] 282s FAILED tests/test_issue342_cmake_osx_args_in_setup.py::test_cmake_args_keyword_osx_default[None-cli_setup_args4-keyword_cmake_args4-cli_cmake_args4-10.7] 282s FAILED tests/test_issue342_cmake_osx_args_in_setup.py::test_cmake_args_keyword_osx_default[None-cli_setup_args5-keyword_cmake_args5-cli_cmake_args5-10.7] 282s FAILED tests/test_issue342_cmake_osx_args_in_setup.py::test_cmake_args_keyword_osx_default[None-cli_setup_args6-keyword_cmake_args6-cli_cmake_args6-10.7] 282s FAILED tests/test_issue342_cmake_osx_args_in_setup.py::test_cmake_args_keyword_osx_default[None-cli_setup_args7-keyword_cmake_args7-cli_cmake_args7-10.8] 282s FAILED tests/test_issue342_cmake_osx_args_in_setup.py::test_cmake_args_keyword_osx_default[None-cli_setup_args8-keyword_cmake_args8-cli_cmake_args8-10.8] 282s FAILED tests/test_issue352_isolated_environment_support.py::test_isolated_env_trigger_reconfigure 282s FAILED tests/test_issue668_symbol_visibility.py::test_symbol_visibility[ON] 282s FAILED tests/test_issue668_symbol_visibility.py::test_symbol_visibility[OFF] 282s FAILED tests/test_manifest_in.py::test_manifest_in_wheel - AttributeError: mo... 282s FAILED tests/test_outside_project_root.py::test_outside_project_root_fails[None] 282s FAILED tests/test_outside_project_root.py::test_outside_project_root_fails[-DINSTALL_FILE:BOOL=1] 282s FAILED tests/test_outside_project_root.py::test_outside_project_root_fails[-DINSTALL_PROJECT:BOOL=1] 282s FAILED tests/test_setup.py::test_cmake_args_keyword[cmake_args0] - AttributeE... 282s FAILED tests/test_setup.py::test_cmake_args_keyword[cmake_args1] - AttributeE... 282s FAILED tests/test_setup.py::test_cmake_install_dir_keyword[None-True-str] - A... 282s FAILED tests/test_setup.py::test_cmake_install_dir_keyword[-True-str] - Attri... 282s FAILED tests/test_setup.py::test_cmake_install_dir_keyword[/tmp/scikit-build-True-SKBuildError] 282s FAILED tests/test_setup.py::test_cmake_install_dir_keyword[banana-False-str] 282s FAILED tests/test_setup.py::test_cmake_with_sdist_keyword[True] - AttributeEr... 282s FAILED tests/test_setup.py::test_cmake_with_sdist_keyword[False] - AttributeE... 282s FAILED tests/test_setup.py::test_cmake_minimum_required_version_keyword - Att... 282s FAILED tests/test_setup.py::test_setup_requires_keyword_include_cmake - Attri... 282s FAILED tests/test_setup.py::test_script_keyword[pure] - AttributeError: modul... 282s FAILED tests/test_setup.py::test_script_keyword[skbuild] - AttributeError: mo... 282s FAILED tests/test_setup.py::test_py_modules_keyword[pure] - AttributeError: m... 282s FAILED tests/test_setup.py::test_py_modules_keyword[skbuild] - AttributeError... 282s FAILED tests/test_setup.py::test_setup_inputs[0-0-0-0-0-0] - AttributeError: ... 282s FAILED tests/test_setup.py::test_setup_inputs[0-0-0-0-0-1] - AttributeError: ... 282s FAILED tests/test_setup.py::test_setup_inputs[0-0-0-0-1-0] - AttributeError: ... 282s FAILED tests/test_setup.py::test_setup_inputs[0-0-0-0-1-1] - AttributeError: ... 282s FAILED tests/test_setup.py::test_setup_inputs[0-0-0-1-0-0] - AttributeError: ... 282s FAILED tests/test_setup.py::test_setup_inputs[0-0-0-1-0-1] - AttributeError: ... 282s FAILED tests/test_setup.py::test_setup_inputs[0-0-0-1-1-0] - AttributeError: ... 282s FAILED tests/test_setup.py::test_setup_inputs[0-0-0-1-1-1] - AttributeError: ... 282s FAILED tests/test_setup.py::test_setup_inputs[0-0-1-0-0-0] - AttributeError: ... 282s FAILED tests/test_setup.py::test_setup_inputs[0-0-1-0-0-1] - AttributeError: ... 282s FAILED tests/test_setup.py::test_setup_inputs[0-0-1-0-1-0] - AttributeError: ... 282s FAILED tests/test_setup.py::test_setup_inputs[0-0-1-0-1-1] - AttributeError: ... 282s FAILED tests/test_setup.py::test_setup_inputs[0-0-1-1-0-0] - AttributeError: ... 282s FAILED tests/test_setup.py::test_setup_inputs[0-0-1-1-0-1] - AttributeError: ... 282s FAILED tests/test_setup.py::test_setup_inputs[0-0-1-1-1-0] - AttributeError: ... 282s FAILED tests/test_setup.py::test_setup_inputs[0-0-1-1-1-1] - AttributeError: ... 282s FAILED tests/test_setup.py::test_setup_inputs[0-1-0-0-0-0] - AttributeError: ... 282s FAILED tests/test_setup.py::test_setup_inputs[0-1-0-0-0-1] - AttributeError: ... 282s FAILED tests/test_setup.py::test_setup_inputs[0-1-0-0-1-0] - AttributeError: ... 282s FAILED tests/test_setup.py::test_setup_inputs[0-1-0-0-1-1] - AttributeError: ... 282s FAILED tests/test_setup.py::test_setup_inputs[0-1-0-1-0-0] - AttributeError: ... 282s FAILED tests/test_setup.py::test_setup_inputs[0-1-0-1-0-1] - AttributeError: ... 282s FAILED tests/test_setup.py::test_setup_inputs[0-1-0-1-1-0] - AttributeError: ... 282s FAILED tests/test_setup.py::test_setup_inputs[0-1-0-1-1-1] - AttributeError: ... 282s FAILED tests/test_setup.py::test_setup_inputs[0-1-1-0-0-0] - AttributeError: ... 282s FAILED tests/test_setup.py::test_setup_inputs[0-1-1-0-0-1] - AttributeError: ... 282s FAILED tests/test_setup.py::test_setup_inputs[0-1-1-0-1-0] - AttributeError: ... 282s FAILED tests/test_setup.py::test_setup_inputs[0-1-1-0-1-1] - AttributeError: ... 282s FAILED tests/test_setup.py::test_setup_inputs[0-1-1-1-0-0] - AttributeError: ... 282s FAILED tests/test_setup.py::test_setup_inputs[0-1-1-1-0-1] - AttributeError: ... 282s FAILED tests/test_setup.py::test_setup_inputs[0-1-1-1-1-0] - AttributeError: ... 282s FAILED tests/test_setup.py::test_setup_inputs[0-1-1-1-1-1] - AttributeError: ... 282s FAILED tests/test_setup.py::test_setup_inputs[1-0-0-0-0-0] - AttributeError: ... 282s FAILED tests/test_setup.py::test_setup_inputs[1-0-0-1-0-0] - AttributeError: ... 282s FAILED tests/test_setup.py::test_setup_inputs[1-0-1-0-0-0] - AttributeError: ... 282s FAILED tests/test_setup.py::test_setup_inputs[1-0-1-1-0-0] - AttributeError: ... 282s FAILED tests/test_setup.py::test_setup_inputs[1-1-0-0-0-0] - AttributeError: ... 282s FAILED tests/test_setup.py::test_setup_inputs[1-1-0-1-0-0] - AttributeError: ... 282s FAILED tests/test_setup.py::test_setup_inputs[1-1-1-0-0-0] - AttributeError: ... 282s FAILED tests/test_setup.py::test_setup_inputs[1-1-1-1-0-0] - AttributeError: ... 282s FAILED tests/test_setup.py::test_cmake_install_into_pure_package[0] - Attribu... 282s FAILED tests/test_setup.py::test_cmake_install_into_pure_package[1] - Attribu... 282s FAILED tests/test_setup.py::test_zip_safe_default[None] - AttributeError: mod... 282s FAILED tests/test_setup.py::test_zip_safe_default[False] - AttributeError: mo... 282s FAILED tests/test_setup.py::test_zip_safe_default[True] - AttributeError: mod... 282s FAILED tests/test_skbuild.py::test_generator[Unix Makefiles-make] - Attribute... 282s FAILED tests/test_skbuild.py::test_invalid_generator[generator_args0] - Attri... 282s FAILED tests/test_skbuild.py::test_invalid_generator[generator_args1] - Attri... 282s FAILED tests/test_skbuild_variable.py::test_skbuild_variable_builds - Attribu... 282s FAILED tests/test_skbuild_variable.py::test_skbuild_variable_sdist - Attribut... 282s FAILED tests/test_skbuild_variable.py::test_skbuild_variable_wheel - Attribut... 282s ========== 124 failed, 67 passed, 31 skipped, 17 deselected in 16.33s ========== 282s autopkgtest [17:56:37]: test testsuite: -----------------------] 283s testsuite FAIL non-zero exit status 1 283s autopkgtest [17:56:38]: test testsuite: - - - - - - - - - - results - - - - - - - - - - 284s autopkgtest [17:56:39]: @@@@@@@@@@@@@@@@@@@@ summary 284s testsuite FAIL non-zero exit status 1 288s virt: nova [W] Using flock in prodstack6-ppc64el 288s virt: flock: timeout while waiting to get lock 288s virt: Creating nova instance adt-plucky-ppc64el-scikit-build-20241109-175155-juju-7f2275-prod-proposed-migration-environment-2-69480016-7bc3-4349-b90d-d5cf528e742c from image adt/ubuntu-plucky-ppc64el-server-20241108.img (UUID 211c30ab-5e06-4166-a7df-df534accb012)...