0s autopkgtest [15:24:44]: starting date and time: 2024-11-09 15:24:44+0000 0s autopkgtest [15:24:44]: git checkout: 6f3be7a8 Fix armhf LXD image generation for plucky 0s autopkgtest [15:24:44]: host juju-7f2275-prod-proposed-migration-environment-15; command line: /home/ubuntu/autopkgtest/runner/autopkgtest --output-dir /tmp/autopkgtest-work.f05wol9o/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 --security-groups autopkgtest-juju-7f2275-prod-proposed-migration-environment-15@bos03-arm64-18.secgroup --name adt-plucky-arm64-scikit-build-20241109-152444-juju-7f2275-prod-proposed-migration-environment-15-b8c188b1-cd97-4268-b298-22dfb84c7bee --image adt/ubuntu-plucky-arm64-server --keyname testbed-juju-7f2275-prod-proposed-migration-environment-15 --net-id=net_prod-proposed-migration -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/ 94s autopkgtest [15:26:18]: testbed dpkg architecture: arm64 95s autopkgtest [15:26:19]: testbed apt version: 2.9.8 95s autopkgtest [15:26:19]: @@@@@@@@@@@@@@@@@@@@ test bed setup 96s Get:1 http://ftpmaster.internal/ubuntu plucky-proposed InRelease [73.9 kB] 96s Get:2 http://ftpmaster.internal/ubuntu plucky-proposed/universe Sources [1004 kB] 98s Get:3 http://ftpmaster.internal/ubuntu plucky-proposed/main Sources [104 kB] 98s Get:4 http://ftpmaster.internal/ubuntu plucky-proposed/restricted Sources [7016 B] 98s Get:5 http://ftpmaster.internal/ubuntu plucky-proposed/multiverse Sources [15.3 kB] 98s Get:6 http://ftpmaster.internal/ubuntu plucky-proposed/main arm64 Packages [144 kB] 98s Get:7 http://ftpmaster.internal/ubuntu plucky-proposed/restricted arm64 Packages [50.3 kB] 98s Get:8 http://ftpmaster.internal/ubuntu plucky-proposed/universe arm64 Packages [725 kB] 99s Get:9 http://ftpmaster.internal/ubuntu plucky-proposed/multiverse arm64 Packages [17.1 kB] 99s Fetched 2141 kB in 4s (534 kB/s) 100s Reading package lists... 102s Reading package lists... 102s Building dependency tree... 102s Reading state information... 103s Calculating upgrade... 103s The following NEW packages will be installed: 103s python3-jaraco.text systemd-cryptsetup 103s The following packages will be upgraded: 103s base-passwd bash-completion libattr1 libbpf1 libbsd0 libbytesize-common 103s libbytesize1 libdrm-common libdrm2 libjson-glib-1.0-0 103s libjson-glib-1.0-common libmaxminddb0 libmnl0 libnghttp2-14 libnspr4 103s libnss-systemd libpam-systemd libpython3.12-minimal libpython3.12-stdlib 103s libpython3.12t64 libsystemd-shared libsystemd0 libudev1 libudisks2-0 103s liburcu8t64 linux-firmware openssh-client openssh-server openssh-sftp-server 103s pci.ids python3-gi python3-idna python3-jsonpatch python3-lazr.restfulclient 103s python3-pkg-resources python3-setuptools python3-urllib3 python3-wadllib 103s python3.12 python3.12-gdbm python3.12-minimal systemd systemd-resolved 103s systemd-sysv systemd-timesyncd udev udisks2 usbutils 103s 48 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. 103s Need to get 558 MB of archives. 103s After this operation, 27.2 MB of additional disk space will be used. 103s Get:1 http://ftpmaster.internal/ubuntu plucky/main arm64 base-passwd arm64 3.6.5 [53.5 kB] 103s Get:2 http://ftpmaster.internal/ubuntu plucky/main arm64 libpython3.12t64 arm64 3.12.7-2 [2312 kB] 108s Get:3 http://ftpmaster.internal/ubuntu plucky/main arm64 python3.12 arm64 3.12.7-2 [661 kB] 110s Get:4 http://ftpmaster.internal/ubuntu plucky/main arm64 libpython3.12-stdlib arm64 3.12.7-2 [2048 kB] 114s Get:5 http://ftpmaster.internal/ubuntu plucky/main arm64 python3.12-minimal arm64 3.12.7-2 [2233 kB] 119s Get:6 http://ftpmaster.internal/ubuntu plucky/main arm64 libpython3.12-minimal arm64 3.12.7-2 [833 kB] 120s Get:7 http://ftpmaster.internal/ubuntu plucky/main arm64 libnss-systemd arm64 256.5-2ubuntu4 [162 kB] 121s Get:8 http://ftpmaster.internal/ubuntu plucky/main arm64 systemd-timesyncd arm64 256.5-2ubuntu4 [39.5 kB] 121s Get:9 http://ftpmaster.internal/ubuntu plucky/main arm64 systemd-resolved arm64 256.5-2ubuntu4 [312 kB] 121s Get:10 http://ftpmaster.internal/ubuntu plucky/main arm64 libsystemd-shared arm64 256.5-2ubuntu4 [2152 kB] 126s Get:11 http://ftpmaster.internal/ubuntu plucky/main arm64 libsystemd0 arm64 256.5-2ubuntu4 [446 kB] 127s Get:12 http://ftpmaster.internal/ubuntu plucky/main arm64 systemd-sysv arm64 256.5-2ubuntu4 [11.9 kB] 127s Get:13 http://ftpmaster.internal/ubuntu plucky/main arm64 libpam-systemd arm64 256.5-2ubuntu4 [242 kB] 127s Get:14 http://ftpmaster.internal/ubuntu plucky/main arm64 systemd arm64 256.5-2ubuntu4 [3356 kB] 134s Get:15 http://ftpmaster.internal/ubuntu plucky/main arm64 udev arm64 256.5-2ubuntu4 [1950 kB] 138s Get:16 http://ftpmaster.internal/ubuntu plucky/main arm64 libudev1 arm64 256.5-2ubuntu4 [194 kB] 139s Get:17 http://ftpmaster.internal/ubuntu plucky/main arm64 openssh-sftp-server arm64 1:9.7p1-7ubuntu5 [36.7 kB] 139s Get:18 http://ftpmaster.internal/ubuntu plucky/main arm64 openssh-server arm64 1:9.7p1-7ubuntu5 [507 kB] 140s Get:19 http://ftpmaster.internal/ubuntu plucky/main arm64 openssh-client arm64 1:9.7p1-7ubuntu5 [891 kB] 141s Get:20 http://ftpmaster.internal/ubuntu plucky/main arm64 libattr1 arm64 1:2.5.2-2 [11.5 kB] 141s Get:21 http://ftpmaster.internal/ubuntu plucky/main arm64 libbsd0 arm64 0.12.2-2 [41.1 kB] 141s Get:22 http://ftpmaster.internal/ubuntu plucky/main arm64 libbpf1 arm64 1:1.4.6-1 [175 kB] 142s Get:23 http://ftpmaster.internal/ubuntu plucky/main arm64 libmnl0 arm64 1.0.5-3 [12.4 kB] 142s Get:24 http://ftpmaster.internal/ubuntu plucky/main arm64 python3-gi arm64 3.50.0-3 [241 kB] 142s Get:25 http://ftpmaster.internal/ubuntu plucky/main arm64 bash-completion all 1:2.14.0-2 [210 kB] 143s Get:26 http://ftpmaster.internal/ubuntu plucky/main arm64 libdrm-common all 2.4.123-1 [8436 B] 143s Get:27 http://ftpmaster.internal/ubuntu plucky/main arm64 libdrm2 arm64 2.4.123-1 [42.2 kB] 143s Get:28 http://ftpmaster.internal/ubuntu plucky/main arm64 libmaxminddb0 arm64 1.11.0-1 [18.7 kB] 143s Get:29 http://ftpmaster.internal/ubuntu plucky/main arm64 libnghttp2-14 arm64 1.64.0-1 [74.5 kB] 143s Get:30 http://ftpmaster.internal/ubuntu plucky/main arm64 liburcu8t64 arm64 0.14.1-1 [63.5 kB] 143s Get:31 http://ftpmaster.internal/ubuntu plucky/main arm64 pci.ids all 0.0~2024.10.24-1 [279 kB] 143s Get:32 http://ftpmaster.internal/ubuntu plucky/main arm64 python3.12-gdbm arm64 3.12.7-2 [29.8 kB] 143s Get:33 http://ftpmaster.internal/ubuntu plucky/main arm64 usbutils arm64 1:018-1 [80.9 kB] 144s Get:34 http://ftpmaster.internal/ubuntu plucky/main arm64 libbytesize1 arm64 2.11-1ubuntu1 [13.0 kB] 144s Get:35 http://ftpmaster.internal/ubuntu plucky/main arm64 libbytesize-common all 2.11-1ubuntu1 [3584 B] 144s Get:36 http://ftpmaster.internal/ubuntu plucky/main arm64 libjson-glib-1.0-common all 1.10.0+ds-2 [5502 B] 144s Get:37 http://ftpmaster.internal/ubuntu plucky/main arm64 libjson-glib-1.0-0 arm64 1.10.0+ds-2 [66.4 kB] 144s Get:38 http://ftpmaster.internal/ubuntu plucky/main arm64 libnspr4 arm64 2:4.35-1.1ubuntu2 [116 kB] 144s Get:39 http://ftpmaster.internal/ubuntu plucky/main arm64 udisks2 arm64 2.10.1-11ubuntu1 [293 kB] 145s Get:40 http://ftpmaster.internal/ubuntu plucky/main arm64 libudisks2-0 arm64 2.10.1-11ubuntu1 [173 kB] 145s Get:41 http://ftpmaster.internal/ubuntu plucky/main arm64 linux-firmware arm64 20241108.git3bbb13a7-0ubuntu1 [536 MB] 937s Get:42 http://ftpmaster.internal/ubuntu plucky/main arm64 python3-idna all 3.8-2 [47.0 kB] 937s Get:43 http://ftpmaster.internal/ubuntu plucky/main arm64 python3-jaraco.text all 4.0.0-1 [11.5 kB] 937s Get:44 http://ftpmaster.internal/ubuntu plucky/main arm64 python3-jsonpatch all 1.32-4 [12.2 kB] 937s Get:45 http://ftpmaster.internal/ubuntu plucky/main arm64 python3-wadllib all 2.0.0-1 [36.7 kB] 937s Get:46 http://ftpmaster.internal/ubuntu plucky-proposed/main arm64 python3-pkg-resources all 75.2.0-1 [134 kB] 937s Get:47 http://ftpmaster.internal/ubuntu plucky-proposed/main arm64 python3-setuptools all 75.2.0-1 [657 kB] 938s Get:48 http://ftpmaster.internal/ubuntu plucky/main arm64 python3-lazr.restfulclient all 0.14.6-2 [50.9 kB] 938s Get:49 http://ftpmaster.internal/ubuntu plucky/main arm64 python3-urllib3 all 2.0.7-2ubuntu0.1 [93.1 kB] 938s Get:50 http://ftpmaster.internal/ubuntu plucky/main arm64 systemd-cryptsetup arm64 256.5-2ubuntu4 [117 kB] 938s Preconfiguring packages ... 939s Fetched 558 MB in 13min 55s (668 kB/s) 939s (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 ... 79695 files and directories currently installed.) 939s Preparing to unpack .../base-passwd_3.6.5_arm64.deb ... 939s Unpacking base-passwd (3.6.5) over (3.6.4) ... 939s Setting up base-passwd (3.6.5) ... 939s (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 ... 79696 files and directories currently installed.) 939s Preparing to unpack .../0-libpython3.12t64_3.12.7-2_arm64.deb ... 939s Unpacking libpython3.12t64:arm64 (3.12.7-2) over (3.12.7-1) ... 939s Preparing to unpack .../1-python3.12_3.12.7-2_arm64.deb ... 939s Unpacking python3.12 (3.12.7-2) over (3.12.7-1) ... 939s Preparing to unpack .../2-libpython3.12-stdlib_3.12.7-2_arm64.deb ... 939s Unpacking libpython3.12-stdlib:arm64 (3.12.7-2) over (3.12.7-1) ... 939s Preparing to unpack .../3-python3.12-minimal_3.12.7-2_arm64.deb ... 939s Unpacking python3.12-minimal (3.12.7-2) over (3.12.7-1) ... 939s Preparing to unpack .../4-libpython3.12-minimal_3.12.7-2_arm64.deb ... 940s Unpacking libpython3.12-minimal:arm64 (3.12.7-2) over (3.12.7-1) ... 940s Preparing to unpack .../5-libnss-systemd_256.5-2ubuntu4_arm64.deb ... 940s Unpacking libnss-systemd:arm64 (256.5-2ubuntu4) over (256.5-2ubuntu3) ... 940s Preparing to unpack .../6-systemd-timesyncd_256.5-2ubuntu4_arm64.deb ... 940s Unpacking systemd-timesyncd (256.5-2ubuntu4) over (256.5-2ubuntu3) ... 940s Preparing to unpack .../7-systemd-resolved_256.5-2ubuntu4_arm64.deb ... 940s Unpacking systemd-resolved (256.5-2ubuntu4) over (256.5-2ubuntu3) ... 940s Preparing to unpack .../8-libsystemd-shared_256.5-2ubuntu4_arm64.deb ... 940s Unpacking libsystemd-shared:arm64 (256.5-2ubuntu4) over (256.5-2ubuntu3) ... 940s Preparing to unpack .../9-libsystemd0_256.5-2ubuntu4_arm64.deb ... 940s Unpacking libsystemd0:arm64 (256.5-2ubuntu4) over (256.5-2ubuntu3) ... 940s Setting up libsystemd0:arm64 (256.5-2ubuntu4) ... 940s (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 ... 79696 files and directories currently installed.) 940s Preparing to unpack .../systemd-sysv_256.5-2ubuntu4_arm64.deb ... 940s Unpacking systemd-sysv (256.5-2ubuntu4) over (256.5-2ubuntu3) ... 940s Preparing to unpack .../libpam-systemd_256.5-2ubuntu4_arm64.deb ... 940s Unpacking libpam-systemd:arm64 (256.5-2ubuntu4) over (256.5-2ubuntu3) ... 940s Preparing to unpack .../systemd_256.5-2ubuntu4_arm64.deb ... 940s Unpacking systemd (256.5-2ubuntu4) over (256.5-2ubuntu3) ... 940s Preparing to unpack .../udev_256.5-2ubuntu4_arm64.deb ... 940s Unpacking udev (256.5-2ubuntu4) over (256.5-2ubuntu3) ... 940s Preparing to unpack .../libudev1_256.5-2ubuntu4_arm64.deb ... 940s Unpacking libudev1:arm64 (256.5-2ubuntu4) over (256.5-2ubuntu3) ... 940s Setting up libudev1:arm64 (256.5-2ubuntu4) ... 941s (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 ... 79696 files and directories currently installed.) 941s Preparing to unpack .../openssh-sftp-server_1%3a9.7p1-7ubuntu5_arm64.deb ... 941s Unpacking openssh-sftp-server (1:9.7p1-7ubuntu5) over (1:9.7p1-7ubuntu4) ... 941s Preparing to unpack .../openssh-server_1%3a9.7p1-7ubuntu5_arm64.deb ... 941s Unpacking openssh-server (1:9.7p1-7ubuntu5) over (1:9.7p1-7ubuntu4) ... 941s Preparing to unpack .../openssh-client_1%3a9.7p1-7ubuntu5_arm64.deb ... 941s Unpacking openssh-client (1:9.7p1-7ubuntu5) over (1:9.7p1-7ubuntu4) ... 941s Preparing to unpack .../libattr1_1%3a2.5.2-2_arm64.deb ... 941s Unpacking libattr1:arm64 (1:2.5.2-2) over (1:2.5.2-1build2) ... 941s Setting up libattr1:arm64 (1:2.5.2-2) ... 941s (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 ... 79696 files and directories currently installed.) 941s Preparing to unpack .../libbsd0_0.12.2-2_arm64.deb ... 941s Unpacking libbsd0:arm64 (0.12.2-2) over (0.12.2-1) ... 941s Setting up libbsd0:arm64 (0.12.2-2) ... 941s (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 ... 79696 files and directories currently installed.) 941s Preparing to unpack .../00-libbpf1_1%3a1.4.6-1_arm64.deb ... 941s Unpacking libbpf1:arm64 (1:1.4.6-1) over (1:1.4.5-1) ... 941s Preparing to unpack .../01-libmnl0_1.0.5-3_arm64.deb ... 941s Unpacking libmnl0:arm64 (1.0.5-3) over (1.0.5-2build1) ... 941s Preparing to unpack .../02-python3-gi_3.50.0-3_arm64.deb ... 941s Unpacking python3-gi (3.50.0-3) over (3.48.2-1) ... 941s Preparing to unpack .../03-bash-completion_1%3a2.14.0-2_all.deb ... 941s Unpacking bash-completion (1:2.14.0-2) over (1:2.14.0-1) ... 941s Preparing to unpack .../04-libdrm-common_2.4.123-1_all.deb ... 941s Unpacking libdrm-common (2.4.123-1) over (2.4.122-1) ... 942s Preparing to unpack .../05-libdrm2_2.4.123-1_arm64.deb ... 942s Unpacking libdrm2:arm64 (2.4.123-1) over (2.4.122-1) ... 942s Preparing to unpack .../06-libmaxminddb0_1.11.0-1_arm64.deb ... 942s Unpacking libmaxminddb0:arm64 (1.11.0-1) over (1.10.0-1) ... 942s Preparing to unpack .../07-libnghttp2-14_1.64.0-1_arm64.deb ... 942s Unpacking libnghttp2-14:arm64 (1.64.0-1) over (1.62.1-2) ... 942s Preparing to unpack .../08-liburcu8t64_0.14.1-1_arm64.deb ... 942s Unpacking liburcu8t64:arm64 (0.14.1-1) over (0.14.0-4) ... 942s Preparing to unpack .../09-pci.ids_0.0~2024.10.24-1_all.deb ... 942s Unpacking pci.ids (0.0~2024.10.24-1) over (0.0~2024.09.12-1) ... 942s Preparing to unpack .../10-python3.12-gdbm_3.12.7-2_arm64.deb ... 942s Unpacking python3.12-gdbm (3.12.7-2) over (3.12.7-1) ... 942s Preparing to unpack .../11-usbutils_1%3a018-1_arm64.deb ... 942s Unpacking usbutils (1:018-1) over (1:017-3build1) ... 942s Preparing to unpack .../12-libbytesize1_2.11-1ubuntu1_arm64.deb ... 942s Unpacking libbytesize1:arm64 (2.11-1ubuntu1) over (2.10-1ubuntu2) ... 942s Preparing to unpack .../13-libbytesize-common_2.11-1ubuntu1_all.deb ... 942s Unpacking libbytesize-common (2.11-1ubuntu1) over (2.10-1ubuntu2) ... 942s Preparing to unpack .../14-libjson-glib-1.0-common_1.10.0+ds-2_all.deb ... 942s Unpacking libjson-glib-1.0-common (1.10.0+ds-2) over (1.8.0-2build2) ... 942s Preparing to unpack .../15-libjson-glib-1.0-0_1.10.0+ds-2_arm64.deb ... 942s Unpacking libjson-glib-1.0-0:arm64 (1.10.0+ds-2) over (1.8.0-2build2) ... 942s Preparing to unpack .../16-libnspr4_2%3a4.35-1.1ubuntu2_arm64.deb ... 942s Unpacking libnspr4:arm64 (2:4.35-1.1ubuntu2) over (2:4.35-1.1ubuntu1) ... 942s Preparing to unpack .../17-udisks2_2.10.1-11ubuntu1_arm64.deb ... 942s Unpacking udisks2 (2.10.1-11ubuntu1) over (2.10.1-9ubuntu2) ... 942s Preparing to unpack .../18-libudisks2-0_2.10.1-11ubuntu1_arm64.deb ... 942s Unpacking libudisks2-0:arm64 (2.10.1-11ubuntu1) over (2.10.1-9ubuntu2) ... 942s Preparing to unpack .../19-linux-firmware_20241108.git3bbb13a7-0ubuntu1_arm64.deb ... 942s Unpacking linux-firmware (20241108.git3bbb13a7-0ubuntu1) over (20240913.gita34e7a5f-0ubuntu2) ... 945s Preparing to unpack .../20-python3-idna_3.8-2_all.deb ... 945s Unpacking python3-idna (3.8-2) over (3.6-2.1) ... 945s Selecting previously unselected package python3-jaraco.text. 945s Preparing to unpack .../21-python3-jaraco.text_4.0.0-1_all.deb ... 945s Unpacking python3-jaraco.text (4.0.0-1) ... 945s Preparing to unpack .../22-python3-jsonpatch_1.32-4_all.deb ... 945s Unpacking python3-jsonpatch (1.32-4) over (1.32-3) ... 945s Preparing to unpack .../23-python3-wadllib_2.0.0-1_all.deb ... 945s Unpacking python3-wadllib (2.0.0-1) over (1.3.6-5) ... 945s Preparing to unpack .../24-python3-pkg-resources_75.2.0-1_all.deb ... 945s Unpacking python3-pkg-resources (75.2.0-1) over (74.1.2-1) ... 945s Preparing to unpack .../25-python3-setuptools_75.2.0-1_all.deb ... 945s Unpacking python3-setuptools (75.2.0-1) over (74.1.2-1) ... 946s Preparing to unpack .../26-python3-lazr.restfulclient_0.14.6-2_all.deb ... 946s Unpacking python3-lazr.restfulclient (0.14.6-2) over (0.14.6-1) ... 946s Preparing to unpack .../27-python3-urllib3_2.0.7-2ubuntu0.1_all.deb ... 946s Unpacking python3-urllib3 (2.0.7-2ubuntu0.1) over (2.0.7-2) ... 946s Selecting previously unselected package systemd-cryptsetup. 946s Preparing to unpack .../28-systemd-cryptsetup_256.5-2ubuntu4_arm64.deb ... 946s Unpacking systemd-cryptsetup (256.5-2ubuntu4) ... 946s Setting up python3-pkg-resources (75.2.0-1) ... 946s Setting up liburcu8t64:arm64 (0.14.1-1) ... 946s Setting up pci.ids (0.0~2024.10.24-1) ... 946s Setting up linux-firmware (20241108.git3bbb13a7-0ubuntu1) ... 946s Setting up openssh-client (1:9.7p1-7ubuntu5) ... 946s Setting up libmaxminddb0:arm64 (1.11.0-1) ... 946s Setting up python3.12-gdbm (3.12.7-2) ... 946s Setting up python3-jsonpatch (1.32-4) ... 946s Setting up libpython3.12-minimal:arm64 (3.12.7-2) ... 946s Setting up libnghttp2-14:arm64 (1.64.0-1) ... 946s Setting up usbutils (1:018-1) ... 946s Setting up libnspr4:arm64 (2:4.35-1.1ubuntu2) ... 946s Setting up python3-jaraco.text (4.0.0-1) ... 946s Setting up bash-completion (1:2.14.0-2) ... 946s Setting up python3-wadllib (2.0.0-1) ... 946s Setting up python3-gi (3.50.0-3) ... 947s Setting up libbytesize-common (2.11-1ubuntu1) ... 947s Setting up libmnl0:arm64 (1.0.5-3) ... 947s Setting up python3-idna (3.8-2) ... 947s Setting up libsystemd-shared:arm64 (256.5-2ubuntu4) ... 947s Setting up python3-urllib3 (2.0.7-2ubuntu0.1) ... 947s Setting up libjson-glib-1.0-common (1.10.0+ds-2) ... 947s Setting up libbytesize1:arm64 (2.11-1ubuntu1) ... 947s Setting up python3-lazr.restfulclient (0.14.6-2) ... 947s Setting up libdrm-common (2.4.123-1) ... 947s Setting up libbpf1:arm64 (1:1.4.6-1) ... 947s Setting up libudisks2-0:arm64 (2.10.1-11ubuntu1) ... 947s Setting up python3.12-minimal (3.12.7-2) ... 948s Setting up openssh-sftp-server (1:9.7p1-7ubuntu5) ... 948s Setting up libpython3.12-stdlib:arm64 (3.12.7-2) ... 948s Setting up python3-setuptools (75.2.0-1) ... 948s Setting up openssh-server (1:9.7p1-7ubuntu5) ... 950s Setting up python3.12 (3.12.7-2) ... 951s Setting up systemd (256.5-2ubuntu4) ... 951s /usr/lib/tmpfiles.d/legacy.conf:13: Duplicate line for path "/run/lock", ignoring. 951s Created symlink '/run/systemd/system/tmp.mount' → '/dev/null'. 951s /usr/lib/tmpfiles.d/legacy.conf:13: Duplicate line for path "/run/lock", ignoring. 951s Setting up libjson-glib-1.0-0:arm64 (1.10.0+ds-2) ... 951s Setting up libpython3.12t64:arm64 (3.12.7-2) ... 951s Setting up systemd-cryptsetup (256.5-2ubuntu4) ... 951s Setting up systemd-timesyncd (256.5-2ubuntu4) ... 952s systemd-time-wait-sync.service is a disabled or a static unit not running, not starting it. 952s Setting up udev (256.5-2ubuntu4) ... 953s Setting up libdrm2:arm64 (2.4.123-1) ... 953s Setting up systemd-resolved (256.5-2ubuntu4) ... 953s Setting up udisks2 (2.10.1-11ubuntu1) ... 954s Setting up systemd-sysv (256.5-2ubuntu4) ... 954s Setting up libnss-systemd:arm64 (256.5-2ubuntu4) ... 954s Setting up libpam-systemd:arm64 (256.5-2ubuntu4) ... 954s Processing triggers for libc-bin (2.40-1ubuntu3) ... 954s Processing triggers for ufw (0.36.2-8) ... 954s Processing triggers for man-db (2.12.1-3) ... 955s Processing triggers for dbus (1.14.10-4ubuntu5) ... 955s Processing triggers for shared-mime-info (2.4-5) ... 956s Processing triggers for initramfs-tools (0.142ubuntu34) ... 956s update-initramfs: Generating /boot/initrd.img-6.11.0-8-generic 956s W: No lz4 in /usr/bin:/sbin:/bin, using gzip 969s System running in EFI mode, skipping. 969s Reading package lists... 970s Building dependency tree... 970s Reading state information... 970s 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 971s Get:1 http://ftpmaster.internal/ubuntu plucky-proposed InRelease [73.9 kB] 971s Get:2 http://ftpmaster.internal/ubuntu plucky InRelease [213 kB] 971s Hit:3 http://ftpmaster.internal/ubuntu plucky-updates InRelease 971s Hit:4 http://ftpmaster.internal/ubuntu plucky-security InRelease 971s Get:5 http://ftpmaster.internal/ubuntu plucky-proposed/universe Sources [998 kB] 972s Get:6 http://ftpmaster.internal/ubuntu plucky-proposed/universe arm64 Packages [721 kB] 973s Get:7 http://ftpmaster.internal/ubuntu plucky/universe Sources [20.7 MB] 987s Get:8 http://ftpmaster.internal/ubuntu plucky/main arm64 Packages [1413 kB] 988s Get:9 http://ftpmaster.internal/ubuntu plucky/universe arm64 Packages [15.5 MB] 1002s Fetched 39.6 MB in 31s (1278 kB/s) 1002s Reading package lists... 1002s Reading package lists... 1003s Building dependency tree... 1003s Reading state information... 1003s Calculating upgrade... 1004s 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 1004s Reading package lists... 1004s Building dependency tree... 1004s Reading state information... 1004s 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 1005s autopkgtest [15:41:29]: rebooting testbed after setup commands that affected boot 1009s autopkgtest-virt-ssh: WARNING: ssh connection failed. Retrying in 3 seconds... 1031s autopkgtest [15:41:55]: testbed running kernel: Linux 6.11.0-8-generic #8-Ubuntu SMP PREEMPT_DYNAMIC Mon Sep 16 14:19:41 UTC 2024 1034s autopkgtest [15:41:58]: @@@@@@@@@@@@@@@@@@@@ apt-source scikit-build 1037s Get:1 http://ftpmaster.internal/ubuntu plucky/universe scikit-build 0.18.1-1 (dsc) [2733 B] 1037s Get:2 http://ftpmaster.internal/ubuntu plucky/universe scikit-build 0.18.1-1 (tar) [273 kB] 1037s Get:3 http://ftpmaster.internal/ubuntu plucky/universe scikit-build 0.18.1-1 (diff) [5768 B] 1037s gpgv: Signature made Fri Aug 30 01:03:13 2024 UTC 1037s gpgv: using RSA key 13796755BBC72BB8ABE2AEB5FA9DEC5DE11C63F1 1037s gpgv: issuer "eamanu@debian.org" 1037s gpgv: Can't check signature: No public key 1037s dpkg-source: warning: cannot verify inline signature for ./scikit-build_0.18.1-1.dsc: no acceptable signature found 1037s autopkgtest [15:42:01]: testing package scikit-build version 0.18.1-1 1038s autopkgtest [15:42:02]: build not needed 1038s autopkgtest [15:42:02]: test testsuite: preparing testbed 1039s Reading package lists... 1040s Building dependency tree... 1040s Reading state information... 1040s Starting pkgProblemResolver with broken count: 0 1040s Starting 2 pkgProblemResolver with broken count: 0 1040s Done 1041s The following additional packages will be installed: 1041s build-essential cmake cmake-data cpp cpp-14 cpp-14-aarch64-linux-gnu 1041s cpp-aarch64-linux-gnu cython3 fonts-font-awesome fonts-lato g++ g++-14 1041s g++-14-aarch64-linux-gnu g++-aarch64-linux-gnu gcc gcc-14 1041s gcc-14-aarch64-linux-gnu gcc-aarch64-linux-gnu git git-man libasan8 libcc1-0 1041s liberror-perl libexpat1-dev libgcc-14-dev libgomp1 libhwasan0 libisl23 1041s libitm1 libjs-jquery libjs-sphinxdoc libjs-underscore libjsoncpp25 liblsan0 1041s libmpc3 libpython3-all-dev libpython3-dev libpython3.12-dev librhash0 1041s libstdc++-14-dev libtsan2 libubsan1 python-skbuild-doc python3-all 1041s python3-all-dev python3-build python3-dev python3-distlib python3-filelock 1041s python3-iniconfig python3-packaging python3-pip python3-pip-whl 1041s python3-platformdirs python3-pluggy python3-pyproject-hooks python3-pytest 1041s python3-pytest-mock python3-setuptools-whl python3-skbuild python3-toml 1041s python3-virtualenv python3-wheel python3-wheel-whl python3.12-dev 1041s sphinx-rtd-theme-common zlib1g-dev 1041s Suggested packages: 1041s cmake-doc cmake-format elpa-cmake-mode ninja-build cpp-doc gcc-14-locales 1041s cpp-14-doc cython-doc gcc-14-doc gcc-multilib manpages-dev autoconf automake 1041s libtool flex bison gdb gcc-doc gdb-aarch64-linux-gnu git-daemon-run 1041s | git-daemon-sysvinit git-doc git-email git-gui gitk gitweb git-cvs 1041s git-mediawiki git-svn libstdc++-14-doc python3-venv python-build-doc 1041s python-pytest-mock-doc 1041s Recommended packages: 1041s javascript-common 1041s The following NEW packages will be installed: 1041s autopkgtest-satdep build-essential cmake cmake-data cpp cpp-14 1041s cpp-14-aarch64-linux-gnu cpp-aarch64-linux-gnu cython3 fonts-font-awesome 1041s fonts-lato g++ g++-14 g++-14-aarch64-linux-gnu g++-aarch64-linux-gnu gcc 1041s gcc-14 gcc-14-aarch64-linux-gnu gcc-aarch64-linux-gnu git git-man libasan8 1041s libcc1-0 liberror-perl libexpat1-dev libgcc-14-dev libgomp1 libhwasan0 1041s libisl23 libitm1 libjs-jquery libjs-sphinxdoc libjs-underscore libjsoncpp25 1041s liblsan0 libmpc3 libpython3-all-dev libpython3-dev libpython3.12-dev 1041s librhash0 libstdc++-14-dev libtsan2 libubsan1 python-skbuild-doc python3-all 1041s python3-all-dev python3-build python3-dev python3-distlib python3-filelock 1041s python3-iniconfig python3-packaging python3-pip python3-pip-whl 1041s python3-platformdirs python3-pluggy python3-pyproject-hooks python3-pytest 1041s python3-pytest-mock python3-setuptools-whl python3-skbuild python3-toml 1041s python3-virtualenv python3-wheel python3-wheel-whl python3.12-dev 1041s sphinx-rtd-theme-common zlib1g-dev 1041s 0 upgraded, 68 newly installed, 0 to remove and 0 not upgraded. 1041s Need to get 97.8 MB/97.8 MB of archives. 1041s After this operation, 355 MB of additional disk space will be used. 1041s Get:1 /tmp/autopkgtest.hA5CeO/1-autopkgtest-satdep.deb autopkgtest-satdep arm64 0 [784 B] 1041s Get:2 http://ftpmaster.internal/ubuntu plucky/main arm64 fonts-lato all 2.015-1 [2781 kB] 1043s Get:3 http://ftpmaster.internal/ubuntu plucky/main arm64 libisl23 arm64 0.27-1 [676 kB] 1044s Get:4 http://ftpmaster.internal/ubuntu plucky/main arm64 libmpc3 arm64 1.3.1-1build2 [56.8 kB] 1044s Get:5 http://ftpmaster.internal/ubuntu plucky/main arm64 cpp-14-aarch64-linux-gnu arm64 14.2.0-7ubuntu1 [10.6 MB] 1051s Get:6 http://ftpmaster.internal/ubuntu plucky/main arm64 cpp-14 arm64 14.2.0-7ubuntu1 [1030 B] 1051s Get:7 http://ftpmaster.internal/ubuntu plucky/main arm64 cpp-aarch64-linux-gnu arm64 4:14.1.0-2ubuntu1 [5452 B] 1051s Get:8 http://ftpmaster.internal/ubuntu plucky/main arm64 cpp arm64 4:14.1.0-2ubuntu1 [22.5 kB] 1051s Get:9 http://ftpmaster.internal/ubuntu plucky/main arm64 libcc1-0 arm64 14.2.0-7ubuntu1 [49.7 kB] 1051s Get:10 http://ftpmaster.internal/ubuntu plucky/main arm64 libgomp1 arm64 14.2.0-7ubuntu1 [145 kB] 1051s Get:11 http://ftpmaster.internal/ubuntu plucky/main arm64 libitm1 arm64 14.2.0-7ubuntu1 [27.8 kB] 1051s Get:12 http://ftpmaster.internal/ubuntu plucky/main arm64 libasan8 arm64 14.2.0-7ubuntu1 [2893 kB] 1053s Get:13 http://ftpmaster.internal/ubuntu plucky/main arm64 liblsan0 arm64 14.2.0-7ubuntu1 [1283 kB] 1054s Get:14 http://ftpmaster.internal/ubuntu plucky/main arm64 libtsan2 arm64 14.2.0-7ubuntu1 [2691 kB] 1055s Get:15 http://ftpmaster.internal/ubuntu plucky/main arm64 libubsan1 arm64 14.2.0-7ubuntu1 [1151 kB] 1056s Get:16 http://ftpmaster.internal/ubuntu plucky/main arm64 libhwasan0 arm64 14.2.0-7ubuntu1 [1599 kB] 1057s Get:17 http://ftpmaster.internal/ubuntu plucky/main arm64 libgcc-14-dev arm64 14.2.0-7ubuntu1 [2594 kB] 1059s Get:18 http://ftpmaster.internal/ubuntu plucky/main arm64 gcc-14-aarch64-linux-gnu arm64 14.2.0-7ubuntu1 [20.9 MB] 1071s Get:19 http://ftpmaster.internal/ubuntu plucky/main arm64 gcc-14 arm64 14.2.0-7ubuntu1 [515 kB] 1071s Get:20 http://ftpmaster.internal/ubuntu plucky/main arm64 gcc-aarch64-linux-gnu arm64 4:14.1.0-2ubuntu1 [1200 B] 1071s Get:21 http://ftpmaster.internal/ubuntu plucky/main arm64 gcc arm64 4:14.1.0-2ubuntu1 [4994 B] 1071s Get:22 http://ftpmaster.internal/ubuntu plucky/main arm64 libstdc++-14-dev arm64 14.2.0-7ubuntu1 [2474 kB] 1073s Get:23 http://ftpmaster.internal/ubuntu plucky/main arm64 g++-14-aarch64-linux-gnu arm64 14.2.0-7ubuntu1 [12.1 MB] 1079s Get:24 http://ftpmaster.internal/ubuntu plucky/main arm64 g++-14 arm64 14.2.0-7ubuntu1 [19.8 kB] 1079s Get:25 http://ftpmaster.internal/ubuntu plucky/main arm64 g++-aarch64-linux-gnu arm64 4:14.1.0-2ubuntu1 [958 B] 1079s Get:26 http://ftpmaster.internal/ubuntu plucky/main arm64 g++ arm64 4:14.1.0-2ubuntu1 [1080 B] 1079s Get:27 http://ftpmaster.internal/ubuntu plucky/main arm64 build-essential arm64 12.10ubuntu1 [4932 B] 1079s Get:28 http://ftpmaster.internal/ubuntu plucky/main arm64 libjsoncpp25 arm64 1.9.5-6build1 [78.2 kB] 1079s Get:29 http://ftpmaster.internal/ubuntu plucky/main arm64 librhash0 arm64 1.4.3-3build1 [126 kB] 1079s Get:30 http://ftpmaster.internal/ubuntu plucky/main arm64 cmake-data all 3.30.3-1 [2246 kB] 1080s Get:31 http://ftpmaster.internal/ubuntu plucky/main arm64 cmake arm64 3.30.3-1 [10.9 MB] 1083s Get:32 http://ftpmaster.internal/ubuntu plucky/universe arm64 cython3 arm64 3.0.11+dfsg-1ubuntu1 [2355 kB] 1083s Get:33 http://ftpmaster.internal/ubuntu plucky/main arm64 fonts-font-awesome all 5.0.10+really4.7.0~dfsg-4.1 [516 kB] 1083s Get:34 http://ftpmaster.internal/ubuntu plucky/main arm64 liberror-perl all 0.17029-2 [25.6 kB] 1083s Get:35 http://ftpmaster.internal/ubuntu plucky/main arm64 git-man all 1:2.45.2-1ubuntu1 [1122 kB] 1083s Get:36 http://ftpmaster.internal/ubuntu plucky/main arm64 git arm64 1:2.45.2-1ubuntu1 [4045 kB] 1083s Get:37 http://ftpmaster.internal/ubuntu plucky/main arm64 libexpat1-dev arm64 2.6.2-2 [128 kB] 1083s Get:38 http://ftpmaster.internal/ubuntu plucky/main arm64 libjs-jquery all 3.6.1+dfsg+~3.5.14-1 [328 kB] 1083s Get:39 http://ftpmaster.internal/ubuntu plucky/main arm64 libjs-underscore all 1.13.4~dfsg+~1.11.4-3 [118 kB] 1083s Get:40 http://ftpmaster.internal/ubuntu plucky/main arm64 libjs-sphinxdoc all 7.4.7-3 [157 kB] 1083s Get:41 http://ftpmaster.internal/ubuntu plucky/main arm64 zlib1g-dev arm64 1:1.3.dfsg+really1.3.1-1ubuntu1 [894 kB] 1084s Get:42 http://ftpmaster.internal/ubuntu plucky/main arm64 libpython3.12-dev arm64 3.12.7-2 [5563 kB] 1084s Get:43 http://ftpmaster.internal/ubuntu plucky/main arm64 libpython3-dev arm64 3.12.6-0ubuntu1 [10.2 kB] 1084s Get:44 http://ftpmaster.internal/ubuntu plucky/main arm64 libpython3-all-dev arm64 3.12.6-0ubuntu1 [916 B] 1084s Get:45 http://ftpmaster.internal/ubuntu plucky/main arm64 sphinx-rtd-theme-common all 3.0.1+dfsg-1 [1012 kB] 1084s Get:46 http://ftpmaster.internal/ubuntu plucky/universe arm64 python-skbuild-doc all 0.18.1-1 [136 kB] 1084s Get:47 http://ftpmaster.internal/ubuntu plucky/main arm64 python3-all arm64 3.12.6-0ubuntu1 [886 B] 1084s Get:48 http://ftpmaster.internal/ubuntu plucky/main arm64 python3.12-dev arm64 3.12.7-2 [505 kB] 1084s Get:49 http://ftpmaster.internal/ubuntu plucky/main arm64 python3-dev arm64 3.12.6-0ubuntu1 [26.7 kB] 1084s Get:50 http://ftpmaster.internal/ubuntu plucky/main arm64 python3-all-dev arm64 3.12.6-0ubuntu1 [908 B] 1084s Get:51 http://ftpmaster.internal/ubuntu plucky/main arm64 python3-packaging all 24.1-1 [41.4 kB] 1084s Get:52 http://ftpmaster.internal/ubuntu plucky/universe arm64 python3-pyproject-hooks all 1.2.0-1 [10.2 kB] 1084s Get:53 http://ftpmaster.internal/ubuntu plucky/universe arm64 python3-toml all 0.10.2-1 [16.5 kB] 1084s Get:54 http://ftpmaster.internal/ubuntu plucky/universe arm64 python3-wheel all 0.44.0-1 [54.2 kB] 1084s Get:55 http://ftpmaster.internal/ubuntu plucky/universe arm64 python3-build all 1.2.2-1 [31.0 kB] 1085s Get:56 http://ftpmaster.internal/ubuntu plucky/universe arm64 python3-distlib all 0.3.8-1 [318 kB] 1085s Get:57 http://ftpmaster.internal/ubuntu plucky/universe arm64 python3-filelock all 3.15.4-1 [12.8 kB] 1085s Get:58 http://ftpmaster.internal/ubuntu plucky/universe arm64 python3-iniconfig all 1.1.1-2 [6024 B] 1085s Get:59 http://ftpmaster.internal/ubuntu plucky/universe arm64 python3-pip all 24.2+dfsg-1 [1398 kB] 1085s Get:60 http://ftpmaster.internal/ubuntu plucky/universe arm64 python3-pip-whl all 24.2+dfsg-1 [1420 kB] 1085s Get:61 http://ftpmaster.internal/ubuntu plucky/main arm64 python3-platformdirs all 4.2.2-1 [16.6 kB] 1085s Get:62 http://ftpmaster.internal/ubuntu plucky/universe arm64 python3-pluggy all 1.5.0-1 [21.0 kB] 1085s Get:63 http://ftpmaster.internal/ubuntu plucky/universe arm64 python3-pytest all 8.3.2-1 [251 kB] 1085s Get:64 http://ftpmaster.internal/ubuntu plucky/universe arm64 python3-pytest-mock all 3.14.0-1 [11.6 kB] 1085s Get:65 http://ftpmaster.internal/ubuntu plucky-proposed/universe arm64 python3-setuptools-whl all 75.2.0-1 [1158 kB] 1085s Get:66 http://ftpmaster.internal/ubuntu plucky/universe arm64 python3-skbuild all 0.18.1-1 [60.3 kB] 1085s Get:67 http://ftpmaster.internal/ubuntu plucky/universe arm64 python3-wheel-whl all 0.44.0-1 [69.5 kB] 1085s Get:68 http://ftpmaster.internal/ubuntu plucky/universe arm64 python3-virtualenv all 20.26.2+ds-1 [71.6 kB] 1086s Fetched 97.8 MB in 44s (2214 kB/s) 1086s Selecting previously unselected package fonts-lato. 1086s (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 ... 79943 files and directories currently installed.) 1086s Preparing to unpack .../00-fonts-lato_2.015-1_all.deb ... 1086s Unpacking fonts-lato (2.015-1) ... 1086s Selecting previously unselected package libisl23:arm64. 1086s Preparing to unpack .../01-libisl23_0.27-1_arm64.deb ... 1086s Unpacking libisl23:arm64 (0.27-1) ... 1086s Selecting previously unselected package libmpc3:arm64. 1086s Preparing to unpack .../02-libmpc3_1.3.1-1build2_arm64.deb ... 1086s Unpacking libmpc3:arm64 (1.3.1-1build2) ... 1086s Selecting previously unselected package cpp-14-aarch64-linux-gnu. 1086s Preparing to unpack .../03-cpp-14-aarch64-linux-gnu_14.2.0-7ubuntu1_arm64.deb ... 1086s Unpacking cpp-14-aarch64-linux-gnu (14.2.0-7ubuntu1) ... 1086s Selecting previously unselected package cpp-14. 1086s Preparing to unpack .../04-cpp-14_14.2.0-7ubuntu1_arm64.deb ... 1086s Unpacking cpp-14 (14.2.0-7ubuntu1) ... 1086s Selecting previously unselected package cpp-aarch64-linux-gnu. 1086s Preparing to unpack .../05-cpp-aarch64-linux-gnu_4%3a14.1.0-2ubuntu1_arm64.deb ... 1086s Unpacking cpp-aarch64-linux-gnu (4:14.1.0-2ubuntu1) ... 1086s Selecting previously unselected package cpp. 1086s Preparing to unpack .../06-cpp_4%3a14.1.0-2ubuntu1_arm64.deb ... 1086s Unpacking cpp (4:14.1.0-2ubuntu1) ... 1086s Selecting previously unselected package libcc1-0:arm64. 1086s Preparing to unpack .../07-libcc1-0_14.2.0-7ubuntu1_arm64.deb ... 1086s Unpacking libcc1-0:arm64 (14.2.0-7ubuntu1) ... 1086s Selecting previously unselected package libgomp1:arm64. 1086s Preparing to unpack .../08-libgomp1_14.2.0-7ubuntu1_arm64.deb ... 1086s Unpacking libgomp1:arm64 (14.2.0-7ubuntu1) ... 1086s Selecting previously unselected package libitm1:arm64. 1086s Preparing to unpack .../09-libitm1_14.2.0-7ubuntu1_arm64.deb ... 1086s Unpacking libitm1:arm64 (14.2.0-7ubuntu1) ... 1087s Selecting previously unselected package libasan8:arm64. 1087s Preparing to unpack .../10-libasan8_14.2.0-7ubuntu1_arm64.deb ... 1087s Unpacking libasan8:arm64 (14.2.0-7ubuntu1) ... 1087s Selecting previously unselected package liblsan0:arm64. 1087s Preparing to unpack .../11-liblsan0_14.2.0-7ubuntu1_arm64.deb ... 1087s Unpacking liblsan0:arm64 (14.2.0-7ubuntu1) ... 1087s Selecting previously unselected package libtsan2:arm64. 1087s Preparing to unpack .../12-libtsan2_14.2.0-7ubuntu1_arm64.deb ... 1087s Unpacking libtsan2:arm64 (14.2.0-7ubuntu1) ... 1087s Selecting previously unselected package libubsan1:arm64. 1087s Preparing to unpack .../13-libubsan1_14.2.0-7ubuntu1_arm64.deb ... 1087s Unpacking libubsan1:arm64 (14.2.0-7ubuntu1) ... 1087s Selecting previously unselected package libhwasan0:arm64. 1087s Preparing to unpack .../14-libhwasan0_14.2.0-7ubuntu1_arm64.deb ... 1087s Unpacking libhwasan0:arm64 (14.2.0-7ubuntu1) ... 1087s Selecting previously unselected package libgcc-14-dev:arm64. 1087s Preparing to unpack .../15-libgcc-14-dev_14.2.0-7ubuntu1_arm64.deb ... 1087s Unpacking libgcc-14-dev:arm64 (14.2.0-7ubuntu1) ... 1087s Selecting previously unselected package gcc-14-aarch64-linux-gnu. 1087s Preparing to unpack .../16-gcc-14-aarch64-linux-gnu_14.2.0-7ubuntu1_arm64.deb ... 1087s Unpacking gcc-14-aarch64-linux-gnu (14.2.0-7ubuntu1) ... 1087s Selecting previously unselected package gcc-14. 1087s Preparing to unpack .../17-gcc-14_14.2.0-7ubuntu1_arm64.deb ... 1087s Unpacking gcc-14 (14.2.0-7ubuntu1) ... 1087s Selecting previously unselected package gcc-aarch64-linux-gnu. 1087s Preparing to unpack .../18-gcc-aarch64-linux-gnu_4%3a14.1.0-2ubuntu1_arm64.deb ... 1087s Unpacking gcc-aarch64-linux-gnu (4:14.1.0-2ubuntu1) ... 1087s Selecting previously unselected package gcc. 1087s Preparing to unpack .../19-gcc_4%3a14.1.0-2ubuntu1_arm64.deb ... 1087s Unpacking gcc (4:14.1.0-2ubuntu1) ... 1087s Selecting previously unselected package libstdc++-14-dev:arm64. 1087s Preparing to unpack .../20-libstdc++-14-dev_14.2.0-7ubuntu1_arm64.deb ... 1087s Unpacking libstdc++-14-dev:arm64 (14.2.0-7ubuntu1) ... 1088s Selecting previously unselected package g++-14-aarch64-linux-gnu. 1088s Preparing to unpack .../21-g++-14-aarch64-linux-gnu_14.2.0-7ubuntu1_arm64.deb ... 1088s Unpacking g++-14-aarch64-linux-gnu (14.2.0-7ubuntu1) ... 1088s Selecting previously unselected package g++-14. 1088s Preparing to unpack .../22-g++-14_14.2.0-7ubuntu1_arm64.deb ... 1088s Unpacking g++-14 (14.2.0-7ubuntu1) ... 1088s Selecting previously unselected package g++-aarch64-linux-gnu. 1088s Preparing to unpack .../23-g++-aarch64-linux-gnu_4%3a14.1.0-2ubuntu1_arm64.deb ... 1088s Unpacking g++-aarch64-linux-gnu (4:14.1.0-2ubuntu1) ... 1088s Selecting previously unselected package g++. 1088s Preparing to unpack .../24-g++_4%3a14.1.0-2ubuntu1_arm64.deb ... 1088s Unpacking g++ (4:14.1.0-2ubuntu1) ... 1088s Selecting previously unselected package build-essential. 1088s Preparing to unpack .../25-build-essential_12.10ubuntu1_arm64.deb ... 1088s Unpacking build-essential (12.10ubuntu1) ... 1088s Selecting previously unselected package libjsoncpp25:arm64. 1088s Preparing to unpack .../26-libjsoncpp25_1.9.5-6build1_arm64.deb ... 1088s Unpacking libjsoncpp25:arm64 (1.9.5-6build1) ... 1088s Selecting previously unselected package librhash0:arm64. 1088s Preparing to unpack .../27-librhash0_1.4.3-3build1_arm64.deb ... 1088s Unpacking librhash0:arm64 (1.4.3-3build1) ... 1088s Selecting previously unselected package cmake-data. 1088s Preparing to unpack .../28-cmake-data_3.30.3-1_all.deb ... 1088s Unpacking cmake-data (3.30.3-1) ... 1088s Selecting previously unselected package cmake. 1088s Preparing to unpack .../29-cmake_3.30.3-1_arm64.deb ... 1088s Unpacking cmake (3.30.3-1) ... 1089s Selecting previously unselected package cython3. 1089s Preparing to unpack .../30-cython3_3.0.11+dfsg-1ubuntu1_arm64.deb ... 1089s Unpacking cython3 (3.0.11+dfsg-1ubuntu1) ... 1089s Selecting previously unselected package fonts-font-awesome. 1089s Preparing to unpack .../31-fonts-font-awesome_5.0.10+really4.7.0~dfsg-4.1_all.deb ... 1089s Unpacking fonts-font-awesome (5.0.10+really4.7.0~dfsg-4.1) ... 1089s Selecting previously unselected package liberror-perl. 1089s Preparing to unpack .../32-liberror-perl_0.17029-2_all.deb ... 1089s Unpacking liberror-perl (0.17029-2) ... 1089s Selecting previously unselected package git-man. 1089s Preparing to unpack .../33-git-man_1%3a2.45.2-1ubuntu1_all.deb ... 1089s Unpacking git-man (1:2.45.2-1ubuntu1) ... 1089s Selecting previously unselected package git. 1089s Preparing to unpack .../34-git_1%3a2.45.2-1ubuntu1_arm64.deb ... 1089s Unpacking git (1:2.45.2-1ubuntu1) ... 1089s Selecting previously unselected package libexpat1-dev:arm64. 1089s Preparing to unpack .../35-libexpat1-dev_2.6.2-2_arm64.deb ... 1089s Unpacking libexpat1-dev:arm64 (2.6.2-2) ... 1089s Selecting previously unselected package libjs-jquery. 1089s Preparing to unpack .../36-libjs-jquery_3.6.1+dfsg+~3.5.14-1_all.deb ... 1089s Unpacking libjs-jquery (3.6.1+dfsg+~3.5.14-1) ... 1089s Selecting previously unselected package libjs-underscore. 1089s Preparing to unpack .../37-libjs-underscore_1.13.4~dfsg+~1.11.4-3_all.deb ... 1089s Unpacking libjs-underscore (1.13.4~dfsg+~1.11.4-3) ... 1089s Selecting previously unselected package libjs-sphinxdoc. 1089s Preparing to unpack .../38-libjs-sphinxdoc_7.4.7-3_all.deb ... 1089s Unpacking libjs-sphinxdoc (7.4.7-3) ... 1089s Selecting previously unselected package zlib1g-dev:arm64. 1089s Preparing to unpack .../39-zlib1g-dev_1%3a1.3.dfsg+really1.3.1-1ubuntu1_arm64.deb ... 1089s Unpacking zlib1g-dev:arm64 (1:1.3.dfsg+really1.3.1-1ubuntu1) ... 1089s Selecting previously unselected package libpython3.12-dev:arm64. 1089s Preparing to unpack .../40-libpython3.12-dev_3.12.7-2_arm64.deb ... 1089s Unpacking libpython3.12-dev:arm64 (3.12.7-2) ... 1090s Selecting previously unselected package libpython3-dev:arm64. 1090s Preparing to unpack .../41-libpython3-dev_3.12.6-0ubuntu1_arm64.deb ... 1090s Unpacking libpython3-dev:arm64 (3.12.6-0ubuntu1) ... 1090s Selecting previously unselected package libpython3-all-dev:arm64. 1090s Preparing to unpack .../42-libpython3-all-dev_3.12.6-0ubuntu1_arm64.deb ... 1090s Unpacking libpython3-all-dev:arm64 (3.12.6-0ubuntu1) ... 1090s Selecting previously unselected package sphinx-rtd-theme-common. 1090s Preparing to unpack .../43-sphinx-rtd-theme-common_3.0.1+dfsg-1_all.deb ... 1090s Unpacking sphinx-rtd-theme-common (3.0.1+dfsg-1) ... 1090s Selecting previously unselected package python-skbuild-doc. 1090s Preparing to unpack .../44-python-skbuild-doc_0.18.1-1_all.deb ... 1090s Unpacking python-skbuild-doc (0.18.1-1) ... 1090s Selecting previously unselected package python3-all. 1090s Preparing to unpack .../45-python3-all_3.12.6-0ubuntu1_arm64.deb ... 1090s Unpacking python3-all (3.12.6-0ubuntu1) ... 1090s Selecting previously unselected package python3.12-dev. 1090s Preparing to unpack .../46-python3.12-dev_3.12.7-2_arm64.deb ... 1090s Unpacking python3.12-dev (3.12.7-2) ... 1090s Selecting previously unselected package python3-dev. 1090s Preparing to unpack .../47-python3-dev_3.12.6-0ubuntu1_arm64.deb ... 1090s Unpacking python3-dev (3.12.6-0ubuntu1) ... 1090s Selecting previously unselected package python3-all-dev. 1090s Preparing to unpack .../48-python3-all-dev_3.12.6-0ubuntu1_arm64.deb ... 1090s Unpacking python3-all-dev (3.12.6-0ubuntu1) ... 1090s Selecting previously unselected package python3-packaging. 1090s Preparing to unpack .../49-python3-packaging_24.1-1_all.deb ... 1090s Unpacking python3-packaging (24.1-1) ... 1090s Selecting previously unselected package python3-pyproject-hooks. 1090s Preparing to unpack .../50-python3-pyproject-hooks_1.2.0-1_all.deb ... 1090s Unpacking python3-pyproject-hooks (1.2.0-1) ... 1090s Selecting previously unselected package python3-toml. 1090s Preparing to unpack .../51-python3-toml_0.10.2-1_all.deb ... 1090s Unpacking python3-toml (0.10.2-1) ... 1090s Selecting previously unselected package python3-wheel. 1090s Preparing to unpack .../52-python3-wheel_0.44.0-1_all.deb ... 1090s Unpacking python3-wheel (0.44.0-1) ... 1090s Selecting previously unselected package python3-build. 1090s Preparing to unpack .../53-python3-build_1.2.2-1_all.deb ... 1090s Unpacking python3-build (1.2.2-1) ... 1090s Selecting previously unselected package python3-distlib. 1090s Preparing to unpack .../54-python3-distlib_0.3.8-1_all.deb ... 1090s Unpacking python3-distlib (0.3.8-1) ... 1090s Selecting previously unselected package python3-filelock. 1090s Preparing to unpack .../55-python3-filelock_3.15.4-1_all.deb ... 1090s Unpacking python3-filelock (3.15.4-1) ... 1090s Selecting previously unselected package python3-iniconfig. 1090s Preparing to unpack .../56-python3-iniconfig_1.1.1-2_all.deb ... 1090s Unpacking python3-iniconfig (1.1.1-2) ... 1090s Selecting previously unselected package python3-pip. 1090s Preparing to unpack .../57-python3-pip_24.2+dfsg-1_all.deb ... 1090s Unpacking python3-pip (24.2+dfsg-1) ... 1090s Selecting previously unselected package python3-pip-whl. 1090s Preparing to unpack .../58-python3-pip-whl_24.2+dfsg-1_all.deb ... 1090s Unpacking python3-pip-whl (24.2+dfsg-1) ... 1090s Selecting previously unselected package python3-platformdirs. 1090s Preparing to unpack .../59-python3-platformdirs_4.2.2-1_all.deb ... 1090s Unpacking python3-platformdirs (4.2.2-1) ... 1090s Selecting previously unselected package python3-pluggy. 1090s Preparing to unpack .../60-python3-pluggy_1.5.0-1_all.deb ... 1090s Unpacking python3-pluggy (1.5.0-1) ... 1090s Selecting previously unselected package python3-pytest. 1090s Preparing to unpack .../61-python3-pytest_8.3.2-1_all.deb ... 1090s Unpacking python3-pytest (8.3.2-1) ... 1090s Selecting previously unselected package python3-pytest-mock. 1090s Preparing to unpack .../62-python3-pytest-mock_3.14.0-1_all.deb ... 1090s Unpacking python3-pytest-mock (3.14.0-1) ... 1090s Selecting previously unselected package python3-setuptools-whl. 1090s Preparing to unpack .../63-python3-setuptools-whl_75.2.0-1_all.deb ... 1090s Unpacking python3-setuptools-whl (75.2.0-1) ... 1090s Selecting previously unselected package python3-skbuild. 1090s Preparing to unpack .../64-python3-skbuild_0.18.1-1_all.deb ... 1090s Unpacking python3-skbuild (0.18.1-1) ... 1090s Selecting previously unselected package python3-wheel-whl. 1090s Preparing to unpack .../65-python3-wheel-whl_0.44.0-1_all.deb ... 1090s Unpacking python3-wheel-whl (0.44.0-1) ... 1091s Selecting previously unselected package python3-virtualenv. 1091s Preparing to unpack .../66-python3-virtualenv_20.26.2+ds-1_all.deb ... 1091s Unpacking python3-virtualenv (20.26.2+ds-1) ... 1091s Selecting previously unselected package autopkgtest-satdep. 1091s Preparing to unpack .../67-1-autopkgtest-satdep.deb ... 1091s Unpacking autopkgtest-satdep (0) ... 1091s Setting up python3-iniconfig (1.1.1-2) ... 1091s Setting up python3-setuptools-whl (75.2.0-1) ... 1091s Setting up python3-filelock (3.15.4-1) ... 1091s Setting up fonts-lato (2.015-1) ... 1091s Setting up python3-pip-whl (24.2+dfsg-1) ... 1091s Setting up python3-all (3.12.6-0ubuntu1) ... 1091s Setting up python3-distlib (0.3.8-1) ... 1091s Setting up libgomp1:arm64 (14.2.0-7ubuntu1) ... 1091s Setting up python3-wheel (0.44.0-1) ... 1091s Setting up python3-platformdirs (4.2.2-1) ... 1091s Setting up liberror-perl (0.17029-2) ... 1091s Setting up python3-packaging (24.1-1) ... 1091s Setting up libexpat1-dev:arm64 (2.6.2-2) ... 1091s Setting up python3-pyproject-hooks (1.2.0-1) ... 1092s Setting up libmpc3:arm64 (1.3.1-1build2) ... 1092s Setting up cython3 (3.0.11+dfsg-1ubuntu1) ... 1092s Setting up libjsoncpp25:arm64 (1.9.5-6build1) ... 1092s Setting up python3-pip (24.2+dfsg-1) ... 1093s Setting up python3-toml (0.10.2-1) ... 1093s Setting up python3-pluggy (1.5.0-1) ... 1094s Setting up libubsan1:arm64 (14.2.0-7ubuntu1) ... 1094s Setting up zlib1g-dev:arm64 (1:1.3.dfsg+really1.3.1-1ubuntu1) ... 1094s Setting up libhwasan0:arm64 (14.2.0-7ubuntu1) ... 1094s Setting up librhash0:arm64 (1.4.3-3build1) ... 1094s Setting up libasan8:arm64 (14.2.0-7ubuntu1) ... 1094s Setting up git-man (1:2.45.2-1ubuntu1) ... 1094s Setting up cmake-data (3.30.3-1) ... 1094s Setting up libtsan2:arm64 (14.2.0-7ubuntu1) ... 1094s Setting up libjs-jquery (3.6.1+dfsg+~3.5.14-1) ... 1094s Setting up libisl23:arm64 (0.27-1) ... 1094s Setting up python3-build (1.2.2-1) ... 1094s Setting up python3-wheel-whl (0.44.0-1) ... 1094s Setting up fonts-font-awesome (5.0.10+really4.7.0~dfsg-4.1) ... 1094s Setting up sphinx-rtd-theme-common (3.0.1+dfsg-1) ... 1094s Setting up libcc1-0:arm64 (14.2.0-7ubuntu1) ... 1094s Setting up liblsan0:arm64 (14.2.0-7ubuntu1) ... 1094s Setting up libitm1:arm64 (14.2.0-7ubuntu1) ... 1094s Setting up libjs-underscore (1.13.4~dfsg+~1.11.4-3) ... 1094s Setting up python3-pytest (8.3.2-1) ... 1094s Setting up python3-virtualenv (20.26.2+ds-1) ... 1094s Setting up libpython3.12-dev:arm64 (3.12.7-2) ... 1094s Setting up python3.12-dev (3.12.7-2) ... 1094s Setting up git (1:2.45.2-1ubuntu1) ... 1094s Setting up libjs-sphinxdoc (7.4.7-3) ... 1094s Setting up python3-pytest-mock (3.14.0-1) ... 1094s Setting up cpp-14-aarch64-linux-gnu (14.2.0-7ubuntu1) ... 1094s Setting up cmake (3.30.3-1) ... 1094s Setting up libgcc-14-dev:arm64 (14.2.0-7ubuntu1) ... 1094s Setting up libstdc++-14-dev:arm64 (14.2.0-7ubuntu1) ... 1094s Setting up libpython3-dev:arm64 (3.12.6-0ubuntu1) ... 1094s Setting up python-skbuild-doc (0.18.1-1) ... 1094s Setting up python3-skbuild (0.18.1-1) ... 1095s Setting up cpp-aarch64-linux-gnu (4:14.1.0-2ubuntu1) ... 1095s Setting up libpython3-all-dev:arm64 (3.12.6-0ubuntu1) ... 1095s Setting up python3-dev (3.12.6-0ubuntu1) ... 1095s Setting up cpp-14 (14.2.0-7ubuntu1) ... 1095s Setting up cpp (4:14.1.0-2ubuntu1) ... 1095s Setting up gcc-14-aarch64-linux-gnu (14.2.0-7ubuntu1) ... 1095s Setting up python3-all-dev (3.12.6-0ubuntu1) ... 1095s Setting up gcc-aarch64-linux-gnu (4:14.1.0-2ubuntu1) ... 1095s Setting up g++-14-aarch64-linux-gnu (14.2.0-7ubuntu1) ... 1095s Setting up gcc-14 (14.2.0-7ubuntu1) ... 1095s Setting up g++-aarch64-linux-gnu (4:14.1.0-2ubuntu1) ... 1095s Setting up g++-14 (14.2.0-7ubuntu1) ... 1095s Setting up gcc (4:14.1.0-2ubuntu1) ... 1095s Setting up g++ (4:14.1.0-2ubuntu1) ... 1095s update-alternatives: using /usr/bin/g++ to provide /usr/bin/c++ (c++) in auto mode 1095s Setting up build-essential (12.10ubuntu1) ... 1095s Setting up autopkgtest-satdep (0) ... 1095s Processing triggers for man-db (2.12.1-3) ... 1096s Processing triggers for libc-bin (2.40-1ubuntu3) ... 1100s (Reading database ... 87954 files and directories currently installed.) 1100s Removing autopkgtest-satdep (0) ... 1100s autopkgtest [15:43:04]: test testsuite: [----------------------- 1101s + cp -r tests /tmp/autopkgtest.hA5CeO/autopkgtest_tmp 1101s + cp pyproject.toml /tmp/autopkgtest.hA5CeO/autopkgtest_tmp 1101s + cd /tmp/autopkgtest.hA5CeO/autopkgtest_tmp 1101s + py3versions -s 1101s + 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 1102s ============================= test session starts ============================== 1102s platform linux -- Python 3.12.7+, pytest-8.3.2, pluggy-1.5.0 1102s 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 1102s No cmake3 executable found on PATH 1102s /usr/bin/cmake: cmake version 3.30.3 1102s No ninja executable found on PATH 1102s rootdir: /tmp/autopkgtest.hA5CeO/autopkgtest_tmp 1102s configfile: pyproject.toml 1102s testpaths: tests 1102s plugins: mock-3.14.0, typeguard-4.4.1 1102s collected 238 items / 17 deselected / 1 skipped / 221 selected 1102s 1103s tests/test_broken_project.py FFFFFFF [ 3%] 1103s tests/test_cmake_target.py F [ 3%] 1103s tests/test_cmakelists_not_in_top_level_dir.py FFFF [ 5%] 1107s tests/test_cmaker.py ............... [ 12%] 1108s tests/test_command_line.py FFFFFFFFFFFFF [ 18%] 1108s tests/test_constants.py . [ 18%] 1108s tests/test_cython_flags.py F [ 19%] 1108s tests/test_filter_manifest.py F [ 19%] 1108s tests/test_hello_cpp.py FFFFF [ 21%] 1108s tests/test_hello_cython.py FFF [ 23%] 1108s tests/test_hello_pure.py FFFF [ 24%] 1108s tests/test_include_exclude_data.py FF [ 25%] 1108s tests/test_issue284_build_ext_inplace.py F [ 26%] 1108s tests/test_issue335_support_cmake_source_dir.py F [ 26%] 1109s tests/test_issue342_cmake_osx_args_in_setup.py FFFFFFFFF [ 30%] 1109s tests/test_issue352_isolated_environment_support.py F [ 31%] 1109s tests/test_issue668_symbol_visibility.py FF [ 32%] 1109s tests/test_logging.py .. [ 33%] 1109s tests/test_manifest_in.py F [ 33%] 1109s tests/test_outside_project_root.py FFF [ 34%] 1110s tests/test_platform.py .............s [ 41%] 1111s tests/test_setup.py ....FFFFFFFFFFFFFF..........FFFFFFFFFFFFFFFFFFFFFFFF [ 64%] 1112s FFFFFFFFFsssFsssFsssFsssFsssFsssFsssFsssFFFFF [ 85%] 1113s tests/test_skbuild.py .sFFFssss [ 89%] 1113s tests/test_skbuild_variable.py FFF [ 90%] 1113s tests/test_utils.py ..................... [100%] 1113s 1113s =================================== FAILURES =================================== 1113s ____________________ test_cmakelists_with_fatalerror_fails _____________________ 1113s 1113s capfd = <_pytest.capture.CaptureFixture object at 0xf726243efa10> 1113s 1113s def test_cmakelists_with_fatalerror_fails(capfd): 1113s with push_dir(): 1113s 1113s @project_setup_py_test("fail-with-fatal-error-cmakelists", ["build"], disable_languages_test=True) 1113s def should_fail(): 1113s pass 1113s 1113s with pytest.raises(SystemExit) as excinfo: 1113s > should_fail() 1113s 1113s capfd = <_pytest.capture.CaptureFixture object at 0xf726243efa10> 1113s excinfo = 1113s should_fail = .should_fail at 0xf726242ebd80> 1113s 1113s tests/test_broken_project.py:31: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s tests/__init__.py:255: in wrapped 1113s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 1113s disable_languages_test = True 1113s fun = .should_fail at 0xf726242ebce0> 1113s iargs = () 1113s ikwargs = {} 1113s ret = False 1113s wrapped = .should_fail at 0xf726242ebd80> 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-0/should_fail0') 1113s setup_args = ['build'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-0/should_fail0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ----------------------------- Captured stdout call ----------------------------- 1113s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-0/should_fail0/.git/ 1113s [master (root-commit) 9e288fc] Initial commit 1113s 2 files changed, 20 insertions(+) 1113s create mode 100644 CMakeLists.txt 1113s create mode 100644 setup.py 1113s ----------------------------- Captured stderr call ----------------------------- 1113s hint: Using 'master' as the name for the initial branch. This default branch name 1113s hint: is subject to change. To configure the initial branch name to use in all 1113s hint: of your new repositories, which will suppress this warning, call: 1113s hint: 1113s hint: git config --global init.defaultBranch 1113s hint: 1113s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 1113s hint: 'development'. The just-created branch can be renamed via this command: 1113s hint: 1113s hint: git branch -m 1113s ____________________ test_cmakelists_with_syntaxerror_fails ____________________ 1113s 1113s capfd = <_pytest.capture.CaptureFixture object at 0xf72624295880> 1113s 1113s def test_cmakelists_with_syntaxerror_fails(capfd): 1113s with push_dir(): 1113s 1113s @project_setup_py_test("fail-with-syntax-error-cmakelists", ["build"], disable_languages_test=True) 1113s def should_fail(): 1113s pass 1113s 1113s with pytest.raises(SystemExit) as excinfo: 1113s > should_fail() 1113s 1113s capfd = <_pytest.capture.CaptureFixture object at 0xf72624295880> 1113s excinfo = 1113s should_fail = .should_fail at 0xf726241a8900> 1113s 1113s tests/test_broken_project.py:49: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s tests/__init__.py:255: in wrapped 1113s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 1113s disable_languages_test = True 1113s fun = .should_fail at 0xf726241a89a0> 1113s iargs = () 1113s ikwargs = {} 1113s ret = False 1113s wrapped = .should_fail at 0xf726241a8900> 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-1/should_fail0') 1113s setup_args = ['build'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-1/should_fail0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ----------------------------- Captured stdout call ----------------------------- 1113s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-1/should_fail0/.git/ 1113s [master (root-commit) f335785] Initial commit 1113s 2 files changed, 20 insertions(+) 1113s create mode 100644 CMakeLists.txt 1113s create mode 100644 setup.py 1113s ----------------------------- Captured stderr call ----------------------------- 1113s hint: Using 'master' as the name for the initial branch. This default branch name 1113s hint: is subject to change. To configure the initial branch name to use in all 1113s hint: of your new repositories, which will suppress this warning, call: 1113s hint: 1113s hint: git config --global init.defaultBranch 1113s hint: 1113s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 1113s hint: 'development'. The just-created branch can be renamed via this command: 1113s hint: 1113s hint: git branch -m 1113s ______________________ test_hello_with_compileerror_fails ______________________ 1113s 1113s capfd = <_pytest.capture.CaptureFixture object at 0xf72624296600> 1113s 1113s def test_hello_with_compileerror_fails(capfd): 1113s with push_dir(): 1113s 1113s @project_setup_py_test("fail-hello-with-compile-error", ["build"]) 1113s def should_fail(): 1113s pass 1113s 1113s with pytest.raises(SystemExit) as excinfo: 1113s > should_fail() 1113s 1113s capfd = <_pytest.capture.CaptureFixture object at 0xf72624296600> 1113s excinfo = 1113s should_fail = .should_fail at 0xf726241a8e00> 1113s 1113s tests/test_broken_project.py:67: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s tests/__init__.py:255: in wrapped 1113s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 1113s disable_languages_test = False 1113s fun = .should_fail at 0xf726241a8a40> 1113s iargs = () 1113s ikwargs = {} 1113s ret = False 1113s wrapped = .should_fail at 0xf726241a8e00> 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-2/should_fail0') 1113s setup_args = ['build'], disable_languages_test = False 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = False 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-2/should_fail0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ----------------------------- Captured stdout call ----------------------------- 1113s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-2/should_fail0/.git/ 1113s [master (root-commit) 839623d] Initial commit 1113s 6 files changed, 97 insertions(+) 1113s create mode 100644 CMakeLists.txt 1113s create mode 100644 hello/CMakeLists.txt 1113s create mode 100644 hello/__init__.py 1113s create mode 100644 hello/__main__.py 1113s create mode 100644 hello/_hello.cxx 1113s create mode 100644 setup.py 1113s ----------------------------- Captured stderr call ----------------------------- 1113s hint: Using 'master' as the name for the initial branch. This default branch name 1113s hint: is subject to change. To configure the initial branch name to use in all 1113s hint: of your new repositories, which will suppress this warning, call: 1113s hint: 1113s hint: git config --global init.defaultBranch 1113s hint: 1113s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 1113s hint: 'development'. The just-created branch can be renamed via this command: 1113s hint: 1113s hint: git branch -m 1113s ____________________ test_invalid_cmake[CalledProcessError] ____________________ 1113s 1113s exception = 1113s mocker = 1113s 1113s @pytest.mark.parametrize("exception", [CalledProcessError, OSError]) 1113s def test_invalid_cmake(exception, mocker): 1113s exceptions = { 1113s OSError: OSError("Unknown error"), 1113s CalledProcessError: CalledProcessError(1, [CMAKE_DEFAULT_EXECUTABLE, "--version"]), 1113s } 1113s 1113s run_original = run 1113s 1113s def run_mock(*args, **kwargs): 1113s if args[0] == [CMAKE_DEFAULT_EXECUTABLE, "--version"]: 1113s raise exceptions[exception] 1113s return run_original(*args, **kwargs) 1113s 1113s mocker.patch("skbuild.cmaker.subprocess.run", new=run_mock) 1113s 1113s with push_dir(): 1113s 1113s @project_setup_py_test("hello-no-language", ["build"], disable_languages_test=True) 1113s def should_fail(): 1113s pass 1113s 1113s with pytest.raises(SystemExit) as excinfo: 1113s > should_fail() 1113s 1113s exception = 1113s exceptions = {: OSError('Unknown error'), : CalledProcessError(1, ['/usr/bin/cmake', '--version'])} 1113s excinfo = 1113s mocker = 1113s run_mock = .run_mock at 0xf726242eb420> 1113s run_original = 1113s should_fail = .should_fail at 0xf726241a89a0> 1113s 1113s tests/test_broken_project.py:100: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s tests/__init__.py:255: in wrapped 1113s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 1113s disable_languages_test = True 1113s fun = .should_fail at 0xf726241a8900> 1113s iargs = () 1113s ikwargs = {} 1113s ret = False 1113s wrapped = .should_fail at 0xf726241a89a0> 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-3/should_fail0') 1113s setup_args = ['build'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-3/should_fail0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ----------------------------- Captured stdout call ----------------------------- 1113s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-3/should_fail0/.git/ 1113s [master (root-commit) c313fde] Initial commit 1113s 2 files changed, 16 insertions(+) 1113s create mode 100644 CMakeLists.txt 1113s create mode 100644 setup.py 1113s ----------------------------- Captured stderr call ----------------------------- 1113s hint: Using 'master' as the name for the initial branch. This default branch name 1113s hint: is subject to change. To configure the initial branch name to use in all 1113s hint: of your new repositories, which will suppress this warning, call: 1113s hint: 1113s hint: git config --global init.defaultBranch 1113s hint: 1113s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 1113s hint: 'development'. The just-created branch can be renamed via this command: 1113s hint: 1113s hint: git branch -m 1113s _________________________ test_invalid_cmake[OSError] __________________________ 1113s 1113s exception = 1113s mocker = 1113s 1113s @pytest.mark.parametrize("exception", [CalledProcessError, OSError]) 1113s def test_invalid_cmake(exception, mocker): 1113s exceptions = { 1113s OSError: OSError("Unknown error"), 1113s CalledProcessError: CalledProcessError(1, [CMAKE_DEFAULT_EXECUTABLE, "--version"]), 1113s } 1113s 1113s run_original = run 1113s 1113s def run_mock(*args, **kwargs): 1113s if args[0] == [CMAKE_DEFAULT_EXECUTABLE, "--version"]: 1113s raise exceptions[exception] 1113s return run_original(*args, **kwargs) 1113s 1113s mocker.patch("skbuild.cmaker.subprocess.run", new=run_mock) 1113s 1113s with push_dir(): 1113s 1113s @project_setup_py_test("hello-no-language", ["build"], disable_languages_test=True) 1113s def should_fail(): 1113s pass 1113s 1113s with pytest.raises(SystemExit) as excinfo: 1113s > should_fail() 1113s 1113s exception = 1113s exceptions = {: OSError('Unknown error'), : CalledProcessError(1, ['/usr/bin/cmake', '--version'])} 1113s excinfo = 1113s mocker = 1113s run_mock = .run_mock at 0xf726241a9580> 1113s run_original = 1113s should_fail = .should_fail at 0xf726241a98a0> 1113s 1113s tests/test_broken_project.py:100: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s tests/__init__.py:255: in wrapped 1113s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 1113s disable_languages_test = True 1113s fun = .should_fail at 0xf726241a9760> 1113s iargs = () 1113s ikwargs = {} 1113s ret = False 1113s wrapped = .should_fail at 0xf726241a98a0> 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-4/should_fail0') 1113s setup_args = ['build'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-4/should_fail0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ----------------------------- Captured stdout call ----------------------------- 1113s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-4/should_fail0/.git/ 1113s [master (root-commit) 302685b] Initial commit 1113s 2 files changed, 16 insertions(+) 1113s create mode 100644 CMakeLists.txt 1113s create mode 100644 setup.py 1113s ----------------------------- Captured stderr call ----------------------------- 1113s hint: Using 'master' as the name for the initial branch. This default branch name 1113s hint: is subject to change. To configure the initial branch name to use in all 1113s hint: of your new repositories, which will suppress this warning, call: 1113s hint: 1113s hint: git config --global init.defaultBranch 1113s hint: 1113s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 1113s hint: 'development'. The just-created branch can be renamed via this command: 1113s hint: 1113s hint: git branch -m 1113s _________________________ test_first_invalid_generator _________________________ 1113s 1113s mocker = 1113s capfd = <_pytest.capture.CaptureFixture object at 0xf72624261e20> 1113s 1113s def test_first_invalid_generator(mocker, capfd): 1113s platform = get_platform() 1113s default_generators = [CMakeGenerator("Invalid")] 1113s default_generators.extend(platform.default_generators) 1113s mocker.patch.object( 1113s type(platform), "default_generators", new_callable=mocker.PropertyMock, return_value=default_generators 1113s ) 1113s 1113s mocker.patch("skbuild.cmaker.get_platform", return_value=platform) 1113s 1113s with push_dir(), push_env(CMAKE_GENERATOR=None): 1113s 1113s @project_setup_py_test("hello-no-language", ["build"]) 1113s def run_build(): 1113s pass 1113s 1113s > run_build() 1113s 1113s capfd = <_pytest.capture.CaptureFixture object at 0xf72624261e20> 1113s default_generators = [, , ] 1113s mocker = 1113s platform = 1113s run_build = .run_build at 0xf726241aa340> 1113s 1113s tests/test_broken_project.py:124: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s tests/__init__.py:255: in wrapped 1113s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 1113s disable_languages_test = False 1113s fun = .run_build at 0xf726241aa2a0> 1113s iargs = () 1113s ikwargs = {} 1113s ret = False 1113s wrapped = .run_build at 0xf726241aa340> 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-5/run_build0') 1113s setup_args = ['build'], disable_languages_test = False 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = False 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-5/run_build0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ----------------------------- Captured stdout call ----------------------------- 1113s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-5/run_build0/.git/ 1113s [master (root-commit) 302685b] Initial commit 1113s 2 files changed, 16 insertions(+) 1113s create mode 100644 CMakeLists.txt 1113s create mode 100644 setup.py 1113s ----------------------------- Captured stderr call ----------------------------- 1113s hint: Using 'master' as the name for the initial branch. This default branch name 1113s hint: is subject to change. To configure the initial branch name to use in all 1113s hint: of your new repositories, which will suppress this warning, call: 1113s hint: 1113s hint: git config --global init.defaultBranch 1113s hint: 1113s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 1113s hint: 'development'. The just-created branch can be renamed via this command: 1113s hint: 1113s hint: git branch -m 1113s ____________________________ test_invalid_generator ____________________________ 1113s 1113s mocker = 1113s capfd = <_pytest.capture.CaptureFixture object at 0xf72624263b90> 1113s 1113s def test_invalid_generator(mocker, capfd): 1113s platform = get_platform() 1113s mocker.patch.object( 1113s type(platform), "default_generators", new_callable=mocker.PropertyMock, return_value=[CMakeGenerator("Invalid")] 1113s ) 1113s mocker.patch("skbuild.cmaker.get_platform", return_value=platform) 1113s 1113s with push_dir(), push_env(CMAKE_GENERATOR=None): 1113s 1113s @project_setup_py_test("hello-no-language", ["build"]) 1113s def should_fail(): 1113s pass 1113s 1113s with pytest.raises(SystemExit) as excinfo: 1113s > should_fail() 1113s 1113s capfd = <_pytest.capture.CaptureFixture object at 0xf72624263b90> 1113s excinfo = 1113s mocker = 1113s platform = 1113s should_fail = .should_fail at 0xf726241aaa20> 1113s 1113s tests/test_broken_project.py:144: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s tests/__init__.py:255: in wrapped 1113s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 1113s disable_languages_test = False 1113s fun = .should_fail at 0xf726241aa980> 1113s iargs = () 1113s ikwargs = {} 1113s ret = False 1113s wrapped = .should_fail at 0xf726241aaa20> 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-6/should_fail0') 1113s setup_args = ['build'], disable_languages_test = False 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = False 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-6/should_fail0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ----------------------------- Captured stdout call ----------------------------- 1113s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-6/should_fail0/.git/ 1113s [master (root-commit) 302685b] Initial commit 1113s 2 files changed, 16 insertions(+) 1113s create mode 100644 CMakeLists.txt 1113s create mode 100644 setup.py 1113s ----------------------------- Captured stderr call ----------------------------- 1113s hint: Using 'master' as the name for the initial branch. This default branch name 1113s hint: is subject to change. To configure the initial branch name to use in all 1113s hint: of your new repositories, which will suppress this warning, call: 1113s hint: 1113s hint: git config --global init.defaultBranch 1113s hint: 1113s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 1113s hint: 'development'. The just-created branch can be renamed via this command: 1113s hint: 1113s hint: git branch -m 1113s ___________________________ test_cmake_target_build ____________________________ 1113s 1113s iargs = () 1113s ikwargs = {'capsys': <_pytest.capture.CaptureFixture object at 0xf72624262ae0>} 1113s 1113s @functools.wraps(fun) 1113s def wrapped(*iargs, **ikwargs): 1113s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 1113s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 1113s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 1113s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 1113s 1113s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 1113s 1113s disable_languages_test = True 1113s fun = 1113s iargs = () 1113s ikwargs = {'capsys': <_pytest.capture.CaptureFixture object at 0xf72624262ae0>} 1113s ret = False 1113s wrapped = 1113s 1113s tests/__init__.py:255: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-7/test_cmake_target_build0') 1113s setup_args = ['build'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-7/test_cmake_target_build0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ----------------------------- Captured stdout call ----------------------------- 1113s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-7/test_cmake_target_build0/.git/ 1113s [master (root-commit) 1a783bf] Initial commit 1113s 2 files changed, 26 insertions(+) 1113s create mode 100644 CMakeLists.txt 1113s create mode 100644 setup.py 1113s ----------------------------- Captured stderr call ----------------------------- 1113s hint: Using 'master' as the name for the initial branch. This default branch name 1113s hint: is subject to change. To configure the initial branch name to use in all 1113s hint: of your new repositories, which will suppress this warning, call: 1113s hint: 1113s hint: git config --global init.defaultBranch 1113s hint: 1113s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 1113s hint: 'development'. The just-created branch can be renamed via this command: 1113s hint: 1113s hint: git branch -m 1113s __________________________________ test_build __________________________________ 1113s 1113s iargs = () 1113s ikwargs = {'capsys': <_pytest.capture.CaptureFixture object at 0xf72624261640>} 1113s 1113s @functools.wraps(fun) 1113s def wrapped(*iargs, **ikwargs): 1113s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 1113s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 1113s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 1113s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 1113s 1113s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 1113s 1113s disable_languages_test = True 1113s fun = 1113s iargs = () 1113s ikwargs = {'capsys': <_pytest.capture.CaptureFixture object at 0xf72624261640>} 1113s ret = False 1113s wrapped = 1113s 1113s tests/__init__.py:255: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-8/test_build0') 1113s setup_args = ['build'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-8/test_build0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ----------------------------- Captured stdout call ----------------------------- 1113s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-8/test_build0/.git/ 1113s [master (root-commit) a559db6] Initial commit 1113s 5 files changed, 94 insertions(+) 1113s create mode 100644 hello/CMakeLists.txt 1113s create mode 100644 hello/__init__.py 1113s create mode 100644 hello/__main__.py 1113s create mode 100644 hello/_hello.cxx 1113s create mode 100644 setup.py 1113s ----------------------------- Captured stderr call ----------------------------- 1113s hint: Using 'master' as the name for the initial branch. This default branch name 1113s hint: is subject to change. To configure the initial branch name to use in all 1113s hint: of your new repositories, which will suppress this warning, call: 1113s hint: 1113s hint: git config --global init.defaultBranch 1113s hint: 1113s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 1113s hint: 'development'. The just-created branch can be renamed via this command: 1113s hint: 1113s hint: git branch -m 1113s _____________________ test_cmake_source_dir[invalid-True] ______________________ 1113s 1113s cmake_source_dir = 'invalid', expected_failed = True 1113s 1113s @pytest.mark.parametrize( 1113s ("cmake_source_dir", "expected_failed"), 1113s [ 1113s ("invalid", True), 1113s ("", False), 1113s (".", False), 1113s ], 1113s ) 1113s def test_cmake_source_dir(cmake_source_dir, expected_failed): 1113s tmp_dir = _tmpdir("test_cmake_source_dir") 1113s 1113s tmp_dir.join("setup.py").write( 1113s textwrap.dedent( 1113s f""" 1113s from skbuild import setup 1113s setup( 1113s name="test_cmake_source_dir", 1113s version="1.2.3", 1113s description="a minimal example package", 1113s author='The scikit-build team', 1113s license="MIT", 1113s cmake_source_dir="{cmake_source_dir}" 1113s ) 1113s """ 1113s ) 1113s ) 1113s 1113s failed = False 1113s message = "" 1113s try: 1113s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 1113s 1113s cmake_source_dir = 'invalid' 1113s expected_failed = True 1113s failed = False 1113s message = '' 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-9/test_cmake_source_dir0') 1113s 1113s tests/test_cmakelists_not_in_top_level_dir.py:60: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-9/test_cmake_source_dir0') 1113s setup_args = ['build'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-9/test_cmake_source_dir0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ________________________ test_cmake_source_dir[-False] _________________________ 1113s 1113s cmake_source_dir = '', expected_failed = False 1113s 1113s @pytest.mark.parametrize( 1113s ("cmake_source_dir", "expected_failed"), 1113s [ 1113s ("invalid", True), 1113s ("", False), 1113s (".", False), 1113s ], 1113s ) 1113s def test_cmake_source_dir(cmake_source_dir, expected_failed): 1113s tmp_dir = _tmpdir("test_cmake_source_dir") 1113s 1113s tmp_dir.join("setup.py").write( 1113s textwrap.dedent( 1113s f""" 1113s from skbuild import setup 1113s setup( 1113s name="test_cmake_source_dir", 1113s version="1.2.3", 1113s description="a minimal example package", 1113s author='The scikit-build team', 1113s license="MIT", 1113s cmake_source_dir="{cmake_source_dir}" 1113s ) 1113s """ 1113s ) 1113s ) 1113s 1113s failed = False 1113s message = "" 1113s try: 1113s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 1113s 1113s cmake_source_dir = '' 1113s expected_failed = False 1113s failed = False 1113s message = '' 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-10/test_cmake_source_dir0') 1113s 1113s tests/test_cmakelists_not_in_top_level_dir.py:60: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-10/test_cmake_source_dir0') 1113s setup_args = ['build'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-10/test_cmake_source_dir0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ________________________ test_cmake_source_dir[.-False] ________________________ 1113s 1113s cmake_source_dir = '.', expected_failed = False 1113s 1113s @pytest.mark.parametrize( 1113s ("cmake_source_dir", "expected_failed"), 1113s [ 1113s ("invalid", True), 1113s ("", False), 1113s (".", False), 1113s ], 1113s ) 1113s def test_cmake_source_dir(cmake_source_dir, expected_failed): 1113s tmp_dir = _tmpdir("test_cmake_source_dir") 1113s 1113s tmp_dir.join("setup.py").write( 1113s textwrap.dedent( 1113s f""" 1113s from skbuild import setup 1113s setup( 1113s name="test_cmake_source_dir", 1113s version="1.2.3", 1113s description="a minimal example package", 1113s author='The scikit-build team', 1113s license="MIT", 1113s cmake_source_dir="{cmake_source_dir}" 1113s ) 1113s """ 1113s ) 1113s ) 1113s 1113s failed = False 1113s message = "" 1113s try: 1113s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 1113s 1113s cmake_source_dir = '.' 1113s expected_failed = False 1113s failed = False 1113s message = '' 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-11/test_cmake_source_dir0') 1113s 1113s tests/test_cmakelists_not_in_top_level_dir.py:60: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-11/test_cmake_source_dir0') 1113s setup_args = ['build'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-11/test_cmake_source_dir0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s __________________________________ test_help ___________________________________ 1113s 1113s iargs = () 1113s ikwargs = {'capsys': <_pytest.capture.CaptureFixture object at 0xf726241d86e0>} 1113s 1113s @functools.wraps(fun) 1113s def wrapped(*iargs, **ikwargs): 1113s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 1113s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 1113s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 1113s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 1113s 1113s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 1113s 1113s disable_languages_test = True 1113s fun = 1113s iargs = () 1113s ikwargs = {'capsys': <_pytest.capture.CaptureFixture object at 0xf726241d86e0>} 1113s ret = False 1113s wrapped = 1113s 1113s tests/__init__.py:255: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-22/test_help0') 1113s setup_args = ['--help'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-22/test_help0') 1113s setup_args = ['--help'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ----------------------------- Captured stdout call ----------------------------- 1113s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-22/test_help0/.git/ 1113s [master (root-commit) 84e0d73] Initial commit 1113s 2 files changed, 16 insertions(+) 1113s create mode 100644 CMakeLists.txt 1113s create mode 100644 setup.py 1113s ----------------------------- Captured stderr call ----------------------------- 1113s hint: Using 'master' as the name for the initial branch. This default branch name 1113s hint: is subject to change. To configure the initial branch name to use in all 1113s hint: of your new repositories, which will suppress this warning, call: 1113s hint: 1113s hint: git config --global init.defaultBranch 1113s hint: 1113s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 1113s hint: 'development'. The just-created branch can be renamed via this command: 1113s hint: 1113s hint: git branch -m 1113s ____________________________ test_metadata_display _____________________________ 1113s 1113s iargs = () 1113s ikwargs = {'capsys': <_pytest.capture.CaptureFixture object at 0xf726243bb200>} 1113s 1113s @functools.wraps(fun) 1113s def wrapped(*iargs, **ikwargs): 1113s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 1113s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 1113s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 1113s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 1113s 1113s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 1113s 1113s disable_languages_test = True 1113s fun = 1113s iargs = () 1113s ikwargs = {'capsys': <_pytest.capture.CaptureFixture object at 0xf726243bb200>} 1113s ret = False 1113s wrapped = 1113s 1113s tests/__init__.py:255: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-23/test_metadata_display0') 1113s setup_args = ['--author', '--name'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-23/test_metadata_display0') 1113s setup_args = ['--author', '--name'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ----------------------------- Captured stdout call ----------------------------- 1113s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-23/test_metadata_display0/.git/ 1113s [master (root-commit) 84e0d73] Initial commit 1113s 2 files changed, 16 insertions(+) 1113s create mode 100644 CMakeLists.txt 1113s create mode 100644 setup.py 1113s ----------------------------- Captured stderr call ----------------------------- 1113s hint: Using 'master' as the name for the initial branch. This default branch name 1113s hint: is subject to change. To configure the initial branch name to use in all 1113s hint: of your new repositories, which will suppress this warning, call: 1113s hint: 1113s hint: git config --global init.defaultBranch 1113s hint: 1113s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 1113s hint: 'development'. The just-created branch can be renamed via this command: 1113s hint: 1113s hint: git branch -m 1113s _______________________________ test_no_command ________________________________ 1113s 1113s def test_no_command(): 1113s with push_dir(): 1113s 1113s @project_setup_py_test("hello-no-language", [], disable_languages_test=True) 1113s def run(): 1113s pass 1113s 1113s failed = False 1113s try: 1113s > run() 1113s 1113s failed = False 1113s run = .run at 0xf726241aaac0> 1113s 1113s tests/test_command_line.py:62: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s tests/__init__.py:255: in wrapped 1113s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 1113s disable_languages_test = True 1113s fun = .run at 0xf726241aab60> 1113s iargs = () 1113s ikwargs = {} 1113s ret = False 1113s wrapped = .run at 0xf726241aaac0> 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-24/run0'), setup_args = [] 1113s disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-24/run0') 1113s setup_args = [] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ----------------------------- Captured stdout call ----------------------------- 1113s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-24/run0/.git/ 1113s [master (root-commit) 84e0d73] Initial commit 1113s 2 files changed, 16 insertions(+) 1113s create mode 100644 CMakeLists.txt 1113s create mode 100644 setup.py 1113s ----------------------------- Captured stderr call ----------------------------- 1113s hint: Using 'master' as the name for the initial branch. This default branch name 1113s hint: is subject to change. To configure the initial branch name to use in all 1113s hint: of your new repositories, which will suppress this warning, call: 1113s hint: 1113s hint: git config --global init.defaultBranch 1113s hint: 1113s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 1113s hint: 'development'. The just-created branch can be renamed via this command: 1113s hint: 1113s hint: git branch -m 1113s _____________________________ test_invalid_command _____________________________ 1113s 1113s def test_invalid_command(): 1113s with push_dir(): 1113s 1113s @project_setup_py_test("hello-no-language", ["unknown"], disable_languages_test=True) 1113s def run(): 1113s pass 1113s 1113s failed = False 1113s try: 1113s > run() 1113s 1113s failed = False 1113s run = .run at 0xf726241a8c20> 1113s 1113s tests/test_command_line.py:79: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s tests/__init__.py:255: in wrapped 1113s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 1113s disable_languages_test = True 1113s fun = .run at 0xf726241a8d60> 1113s iargs = () 1113s ikwargs = {} 1113s ret = False 1113s wrapped = .run at 0xf726241a8c20> 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-25/run0') 1113s setup_args = ['unknown'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-25/run0') 1113s setup_args = ['unknown'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ----------------------------- Captured stdout call ----------------------------- 1113s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-25/run0/.git/ 1113s [master (root-commit) 84e0d73] Initial commit 1113s 2 files changed, 16 insertions(+) 1113s create mode 100644 CMakeLists.txt 1113s create mode 100644 setup.py 1113s ----------------------------- Captured stderr call ----------------------------- 1113s hint: Using 'master' as the name for the initial branch. This default branch name 1113s hint: is subject to change. To configure the initial branch name to use in all 1113s hint: of your new repositories, which will suppress this warning, call: 1113s hint: 1113s hint: git config --global init.defaultBranch 1113s hint: 1113s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 1113s hint: 'development'. The just-created branch can be renamed via this command: 1113s hint: 1113s hint: git branch -m 1113s ___________________________ test_too_many_separators ___________________________ 1113s 1113s def test_too_many_separators(): 1113s with push_dir(): 1113s 1113s @project_setup_py_test("hello-no-language", ["--"] * 3, disable_languages_test=True) 1113s def run(): 1113s pass 1113s 1113s failed = False 1113s try: 1113s > run() 1113s 1113s failed = False 1113s run = .run at 0xf726241ab600> 1113s 1113s tests/test_command_line.py:96: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s tests/__init__.py:255: in wrapped 1113s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 1113s disable_languages_test = True 1113s fun = .run at 0xf726241ab6a0> 1113s iargs = () 1113s ikwargs = {} 1113s ret = False 1113s wrapped = .run at 0xf726241ab600> 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-26/run0') 1113s setup_args = ['--', '--', '--'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-26/run0') 1113s setup_args = ['--', '--', '--'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ----------------------------- Captured stdout call ----------------------------- 1113s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-26/run0/.git/ 1113s [master (root-commit) 84e0d73] Initial commit 1113s 2 files changed, 16 insertions(+) 1113s create mode 100644 CMakeLists.txt 1113s create mode 100644 setup.py 1113s ----------------------------- Captured stderr call ----------------------------- 1113s hint: Using 'master' as the name for the initial branch. This default branch name 1113s hint: is subject to change. To configure the initial branch name to use in all 1113s hint: of your new repositories, which will suppress this warning, call: 1113s hint: 1113s hint: git config --global init.defaultBranch 1113s hint: 1113s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 1113s hint: 'development'. The just-created branch can be renamed via this command: 1113s hint: 1113s hint: git branch -m 1113s __________________ test_cmake_initial_cache_as_global_option ___________________ 1113s 1113s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-21/test_cmake_initial_cache_as_gl0') 1113s 1113s def test_cmake_initial_cache_as_global_option(tmpdir): 1113s project = "hello-no-language" 1113s prepare_project(project, tmpdir) 1113s initialize_git_repo_and_commit(tmpdir, verbose=True) 1113s 1113s initial_cache = tmpdir.join("initial-cache.txt") 1113s initial_cache.write("""set(MY_CMAKE_VARIABLE "1" CACHE BOOL "My cache variable")""") 1113s 1113s try: 1113s > with execute_setup_py(tmpdir, [f"-C{initial_cache}", "build"], disable_languages_test=True): 1113s 1113s initial_cache = local('/tmp/pytest-of-ubuntu/pytest-21/test_cmake_initial_cache_as_gl0/initial-cache.txt') 1113s project = 'hello-no-language' 1113s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-21/test_cmake_initial_cache_as_gl0') 1113s 1113s tests/test_command_line.py:112: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-21/test_cmake_initial_cache_as_gl0') 1113s setup_args = ['-C/tmp/pytest-of-ubuntu/pytest-21/test_cmake_initial_cache_as_gl0/initial-cache.txt', 'build'] 1113s disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-21/test_cmake_initial_cache_as_gl0') 1113s setup_args = ['-C/tmp/pytest-of-ubuntu/pytest-21/test_cmake_initial_cache_as_gl0/initial-cache.txt', 'build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ----------------------------- Captured stdout call ----------------------------- 1113s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-21/test_cmake_initial_cache_as_gl0/.git/ 1113s [master (root-commit) 84e0d73] Initial commit 1113s 2 files changed, 16 insertions(+) 1113s create mode 100644 CMakeLists.txt 1113s create mode 100644 setup.py 1113s ----------------------------- Captured stderr call ----------------------------- 1113s hint: Using 'master' as the name for the initial branch. This default branch name 1113s hint: is subject to change. To configure the initial branch name to use in all 1113s hint: of your new repositories, which will suppress this warning, call: 1113s hint: 1113s hint: git config --global init.defaultBranch 1113s hint: 1113s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 1113s hint: 'development'. The just-created branch can be renamed via this command: 1113s hint: 1113s hint: git branch -m 1113s __________________________ test_cmake_executable_arg ___________________________ 1113s 1113s def test_cmake_executable_arg(): 1113s cmake_executable = "/path/to/invalid/cmake" 1113s 1113s @project_setup_py_test( 1113s "hello-no-language", ["--cmake-executable", cmake_executable, "build"], disable_languages_test=True 1113s ) 1113s def should_fail(): 1113s pass 1113s 1113s failed = False 1113s message = "" 1113s try: 1113s > should_fail() 1113s 1113s cmake_executable = '/path/to/invalid/cmake' 1113s failed = False 1113s message = '' 1113s should_fail = .should_fail at 0xf726241ab6a0> 1113s 1113s tests/test_command_line.py:134: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s tests/__init__.py:255: in wrapped 1113s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 1113s disable_languages_test = True 1113s fun = .should_fail at 0xf726241a9940> 1113s iargs = () 1113s ikwargs = {} 1113s ret = False 1113s wrapped = .should_fail at 0xf726241ab6a0> 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-27/should_fail0') 1113s setup_args = ['--cmake-executable', '/path/to/invalid/cmake', 'build'] 1113s disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-27/should_fail0') 1113s setup_args = ['--cmake-executable', '/path/to/invalid/cmake', 'build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ----------------------------- Captured stdout call ----------------------------- 1113s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-27/should_fail0/.git/ 1113s [master (root-commit) 84e0d73] Initial commit 1113s 2 files changed, 16 insertions(+) 1113s create mode 100644 CMakeLists.txt 1113s create mode 100644 setup.py 1113s ----------------------------- Captured stderr call ----------------------------- 1113s hint: Using 'master' as the name for the initial branch. This default branch name 1113s hint: is subject to change. To configure the initial branch name to use in all 1113s hint: of your new repositories, which will suppress this warning, call: 1113s hint: 1113s hint: git config --global init.defaultBranch 1113s hint: 1113s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 1113s hint: 'development'. The just-created branch can be renamed via this command: 1113s hint: 1113s hint: git branch -m 1113s ________________________ test_hide_listing[True-sdist] _________________________ 1113s 1113s action = 'sdist', hide_listing = True 1113s capfd = <_pytest.capture.CaptureFixture object at 0xf7262418d430> 1113s caplog = <_pytest.logging.LogCaptureFixture object at 0xf7262418d1c0> 1113s 1113s @pytest.mark.parametrize("action", ["sdist", "bdist_wheel"]) 1113s @pytest.mark.parametrize("hide_listing", [True, False]) 1113s def test_hide_listing(action, hide_listing, capfd, caplog): 1113s cmd = [action] 1113s if hide_listing: 1113s cmd.insert(0, "--hide-listing") 1113s 1113s @project_setup_py_test("test-hide-listing", cmd, verbose_git=False, disable_languages_test=True) 1113s def run(): 1113s pass 1113s 1113s > run() 1113s 1113s action = 'sdist' 1113s capfd = <_pytest.capture.CaptureFixture object at 0xf7262418d430> 1113s caplog = <_pytest.logging.LogCaptureFixture object at 0xf7262418d1c0> 1113s cmd = ['--hide-listing', 'sdist'] 1113s hide_listing = True 1113s run = .run at 0xf726241a9800> 1113s 1113s tests/test_command_line.py:154: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s tests/__init__.py:255: in wrapped 1113s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 1113s disable_languages_test = True 1113s fun = .run at 0xf726241a8c20> 1113s iargs = () 1113s ikwargs = {} 1113s ret = False 1113s wrapped = .run at 0xf726241a9800> 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-28/run0') 1113s setup_args = ['--hide-listing', 'sdist'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-28/run0') 1113s setup_args = ['--hide-listing', 'sdist'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ----------------------------- Captured stderr call ----------------------------- 1113s hint: Using 'master' as the name for the initial branch. This default branch name 1113s hint: is subject to change. To configure the initial branch name to use in all 1113s hint: of your new repositories, which will suppress this warning, call: 1113s hint: 1113s hint: git config --global init.defaultBranch 1113s hint: 1113s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 1113s hint: 'development'. The just-created branch can be renamed via this command: 1113s hint: 1113s hint: git branch -m 1113s _____________________ test_hide_listing[True-bdist_wheel] ______________________ 1113s 1113s action = 'bdist_wheel', hide_listing = True 1113s capfd = <_pytest.capture.CaptureFixture object at 0xf7262418cdd0> 1113s caplog = <_pytest.logging.LogCaptureFixture object at 0xf7262418cec0> 1113s 1113s @pytest.mark.parametrize("action", ["sdist", "bdist_wheel"]) 1113s @pytest.mark.parametrize("hide_listing", [True, False]) 1113s def test_hide_listing(action, hide_listing, capfd, caplog): 1113s cmd = [action] 1113s if hide_listing: 1113s cmd.insert(0, "--hide-listing") 1113s 1113s @project_setup_py_test("test-hide-listing", cmd, verbose_git=False, disable_languages_test=True) 1113s def run(): 1113s pass 1113s 1113s > run() 1113s 1113s action = 'bdist_wheel' 1113s capfd = <_pytest.capture.CaptureFixture object at 0xf7262418cdd0> 1113s caplog = <_pytest.logging.LogCaptureFixture object at 0xf7262418cec0> 1113s cmd = ['--hide-listing', 'bdist_wheel'] 1113s hide_listing = True 1113s run = .run at 0xf726241aa160> 1113s 1113s tests/test_command_line.py:154: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s tests/__init__.py:255: in wrapped 1113s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 1113s disable_languages_test = True 1113s fun = .run at 0xf726241aa7a0> 1113s iargs = () 1113s ikwargs = {} 1113s ret = False 1113s wrapped = .run at 0xf726241aa160> 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-29/run0') 1113s setup_args = ['--hide-listing', 'bdist_wheel'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-29/run0') 1113s setup_args = ['--hide-listing', 'bdist_wheel'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ----------------------------- Captured stderr call ----------------------------- 1113s hint: Using 'master' as the name for the initial branch. This default branch name 1113s hint: is subject to change. To configure the initial branch name to use in all 1113s hint: of your new repositories, which will suppress this warning, call: 1113s hint: 1113s hint: git config --global init.defaultBranch 1113s hint: 1113s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 1113s hint: 'development'. The just-created branch can be renamed via this command: 1113s hint: 1113s hint: git branch -m 1113s ________________________ test_hide_listing[False-sdist] ________________________ 1113s 1113s action = 'sdist', hide_listing = False 1113s capfd = <_pytest.capture.CaptureFixture object at 0xf726242948f0> 1113s caplog = <_pytest.logging.LogCaptureFixture object at 0xf726242969c0> 1113s 1113s @pytest.mark.parametrize("action", ["sdist", "bdist_wheel"]) 1113s @pytest.mark.parametrize("hide_listing", [True, False]) 1113s def test_hide_listing(action, hide_listing, capfd, caplog): 1113s cmd = [action] 1113s if hide_listing: 1113s cmd.insert(0, "--hide-listing") 1113s 1113s @project_setup_py_test("test-hide-listing", cmd, verbose_git=False, disable_languages_test=True) 1113s def run(): 1113s pass 1113s 1113s > run() 1113s 1113s action = 'sdist' 1113s capfd = <_pytest.capture.CaptureFixture object at 0xf726242948f0> 1113s caplog = <_pytest.logging.LogCaptureFixture object at 0xf726242969c0> 1113s cmd = ['sdist'] 1113s hide_listing = False 1113s run = .run at 0xf726242eae80> 1113s 1113s tests/test_command_line.py:154: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s tests/__init__.py:255: in wrapped 1113s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 1113s disable_languages_test = True 1113s fun = .run at 0xf726242eaf20> 1113s iargs = () 1113s ikwargs = {} 1113s ret = False 1113s wrapped = .run at 0xf726242eae80> 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-30/run0') 1113s setup_args = ['sdist'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-30/run0') 1113s setup_args = ['sdist'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ----------------------------- Captured stderr call ----------------------------- 1113s hint: Using 'master' as the name for the initial branch. This default branch name 1113s hint: is subject to change. To configure the initial branch name to use in all 1113s hint: of your new repositories, which will suppress this warning, call: 1113s hint: 1113s hint: git config --global init.defaultBranch 1113s hint: 1113s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 1113s hint: 'development'. The just-created branch can be renamed via this command: 1113s hint: 1113s hint: git branch -m 1113s _____________________ test_hide_listing[False-bdist_wheel] _____________________ 1113s 1113s action = 'bdist_wheel', hide_listing = False 1113s capfd = <_pytest.capture.CaptureFixture object at 0xf7262418fe30> 1113s caplog = <_pytest.logging.LogCaptureFixture object at 0xf7262418d4f0> 1113s 1113s @pytest.mark.parametrize("action", ["sdist", "bdist_wheel"]) 1113s @pytest.mark.parametrize("hide_listing", [True, False]) 1113s def test_hide_listing(action, hide_listing, capfd, caplog): 1113s cmd = [action] 1113s if hide_listing: 1113s cmd.insert(0, "--hide-listing") 1113s 1113s @project_setup_py_test("test-hide-listing", cmd, verbose_git=False, disable_languages_test=True) 1113s def run(): 1113s pass 1113s 1113s > run() 1113s 1113s action = 'bdist_wheel' 1113s capfd = <_pytest.capture.CaptureFixture object at 0xf7262418fe30> 1113s caplog = <_pytest.logging.LogCaptureFixture object at 0xf7262418d4f0> 1113s cmd = ['bdist_wheel'] 1113s hide_listing = False 1113s run = .run at 0xf726241a9800> 1113s 1113s tests/test_command_line.py:154: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s tests/__init__.py:255: in wrapped 1113s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 1113s disable_languages_test = True 1113s fun = .run at 0xf726241aa340> 1113s iargs = () 1113s ikwargs = {} 1113s ret = False 1113s wrapped = .run at 0xf726241a9800> 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-31/run0') 1113s setup_args = ['bdist_wheel'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-31/run0') 1113s setup_args = ['bdist_wheel'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ----------------------------- Captured stderr call ----------------------------- 1113s hint: Using 'master' as the name for the initial branch. This default branch name 1113s hint: is subject to change. To configure the initial branch name to use in all 1113s hint: of your new repositories, which will suppress this warning, call: 1113s hint: 1113s hint: git config --global init.defaultBranch 1113s hint: 1113s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 1113s hint: 'development'. The just-created branch can be renamed via this command: 1113s hint: 1113s hint: git branch -m 1113s ______________________________ test_run_cmake_arg ______________________________ 1113s 1113s iargs = () 1113s ikwargs = {'capfd': <_pytest.capture.CaptureFixture object at 0xf726243ba600>} 1113s 1113s @functools.wraps(fun) 1113s def wrapped(*iargs, **ikwargs): 1113s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 1113s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 1113s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 1113s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 1113s 1113s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 1113s 1113s disable_languages_test = True 1113s fun = 1113s iargs = () 1113s ikwargs = {'capfd': <_pytest.capture.CaptureFixture object at 0xf726243ba600>} 1113s ret = False 1113s wrapped = 1113s 1113s tests/__init__.py:255: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-32/test_run_cmake_arg0') 1113s setup_args = ['--force-cmake', '--help'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-32/test_run_cmake_arg0') 1113s setup_args = ['--force-cmake', '--help'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ----------------------------- Captured stdout call ----------------------------- 1113s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-32/test_run_cmake_arg0/.git/ 1113s [master (root-commit) 67e7e4b] Initial commit 1113s 2 files changed, 16 insertions(+) 1113s create mode 100644 CMakeLists.txt 1113s create mode 100644 setup.py 1113s ----------------------------- Captured stderr call ----------------------------- 1113s hint: Using 'master' as the name for the initial branch. This default branch name 1113s hint: is subject to change. To configure the initial branch name to use in all 1113s hint: of your new repositories, which will suppress this warning, call: 1113s hint: 1113s hint: git config --global init.defaultBranch 1113s hint: 1113s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 1113s hint: 'development'. The just-created branch can be renamed via this command: 1113s hint: 1113s hint: git branch -m 1113s _____________________________ test_skip_cmake_arg ______________________________ 1113s 1113s iargs = () 1113s ikwargs = {'capfd': <_pytest.capture.CaptureFixture object at 0xf726242a2b70>} 1113s 1113s @functools.wraps(fun) 1113s def wrapped(*iargs, **ikwargs): 1113s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 1113s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 1113s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 1113s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 1113s 1113s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 1113s 1113s disable_languages_test = True 1113s fun = 1113s iargs = () 1113s ikwargs = {'capfd': <_pytest.capture.CaptureFixture object at 0xf726242a2b70>} 1113s ret = False 1113s wrapped = 1113s 1113s tests/__init__.py:255: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-33/test_skip_cmake_arg0') 1113s setup_args = ['--skip-cmake', 'build'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-33/test_skip_cmake_arg0') 1113s setup_args = ['--skip-cmake', 'build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ----------------------------- Captured stdout call ----------------------------- 1113s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-33/test_skip_cmake_arg0/.git/ 1113s [master (root-commit) 67e7e4b] Initial commit 1113s 2 files changed, 16 insertions(+) 1113s create mode 100644 CMakeLists.txt 1113s create mode 100644 setup.py 1113s ----------------------------- Captured stderr call ----------------------------- 1113s hint: Using 'master' as the name for the initial branch. This default branch name 1113s hint: is subject to change. To configure the initial branch name to use in all 1113s hint: of your new repositories, which will suppress this warning, call: 1113s hint: 1113s hint: git config --global init.defaultBranch 1113s hint: 1113s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 1113s hint: 'development'. The just-created branch can be renamed via this command: 1113s hint: 1113s hint: git branch -m 1113s ___________________________ test_hello_cython_builds ___________________________ 1113s 1113s iargs = (), ikwargs = {} 1113s 1113s @functools.wraps(fun) 1113s def wrapped(*iargs, **ikwargs): 1113s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 1113s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 1113s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 1113s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 1113s 1113s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 1113s 1113s disable_languages_test = False 1113s fun = 1113s iargs = () 1113s ikwargs = {} 1113s ret = False 1113s wrapped = 1113s 1113s tests/__init__.py:255: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-34/test_hello_cython_builds0') 1113s setup_args = ['build'], disable_languages_test = False 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = False 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-34/test_hello_cython_builds0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ----------------------------- Captured stdout call ----------------------------- 1113s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-34/test_hello_cython_builds0/.git/ 1113s [master (root-commit) 547973e] Initial commit 1113s 6 files changed, 40 insertions(+) 1113s create mode 100644 CMakeLists.txt 1113s create mode 100644 hello/CMakeLists.txt 1113s create mode 100644 hello/__init__.py 1113s create mode 100644 hello/__main__.py 1113s create mode 100644 hello/_hello.pyx 1113s create mode 100644 setup.py 1113s ----------------------------- Captured stderr call ----------------------------- 1113s hint: Using 'master' as the name for the initial branch. This default branch name 1113s hint: is subject to change. To configure the initial branch name to use in all 1113s hint: of your new repositories, which will suppress this warning, call: 1113s hint: 1113s hint: git config --global init.defaultBranch 1113s hint: 1113s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 1113s hint: 'development'. The just-created branch can be renamed via this command: 1113s hint: 1113s hint: git branch -m 1113s ___________________________ test_bdist_wheel_command ___________________________ 1113s 1113s def test_bdist_wheel_command(): 1113s project = "test-filter-manifest" 1113s 1113s expected_content = [ 1113s "hello/__init__.py", 1113s "hello/swig_mwe.py", 1113s "hello/_swig_mwe.pyd", 1113s "hello-1.2.3.data/data/bin/hello", 1113s ] 1113s 1113s expected_distribution_name = "hello-1.2.3" 1113s 1113s tmp_dir = _tmpdir("test_bdist_wheel_command") 1113s prepare_project(project, tmp_dir) 1113s initialize_git_repo_and_commit(tmp_dir, verbose=True) 1113s 1113s relative_setup_path = "wrapping/python/" 1113s 1113s > with execute_setup_py(tmp_dir.join(relative_setup_path), ["bdist_wheel"]): 1113s 1113s expected_content = ['hello/__init__.py', 'hello/swig_mwe.py', 'hello/_swig_mwe.pyd', 'hello-1.2.3.data/data/bin/hello'] 1113s expected_distribution_name = 'hello-1.2.3' 1113s project = 'test-filter-manifest' 1113s relative_setup_path = 'wrapping/python/' 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-35/test_bdist_wheel_command0') 1113s 1113s tests/test_filter_manifest.py:27: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-35/test_bdist_wheel_command0/wrapping/python') 1113s setup_args = ['bdist_wheel'], disable_languages_test = False 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = False 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-35/test_bdist_wheel_command0/wrapping/python') 1113s setup_args = ['bdist_wheel'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ----------------------------- Captured stdout call ----------------------------- 1113s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-35/test_bdist_wheel_command0/.git/ 1113s [master (root-commit) 493452f] Initial commit 1113s 4 files changed, 59 insertions(+) 1113s create mode 100644 CMakeLists.txt 1113s create mode 100644 wrapping/python/CMakeLists.txt 1113s create mode 100644 wrapping/python/hello/__init__.py 1113s create mode 100644 wrapping/python/setup.py 1113s ----------------------------- Captured stderr call ----------------------------- 1113s hint: Using 'master' as the name for the initial branch. This default branch name 1113s hint: is subject to change. To configure the initial branch name to use in all 1113s hint: of your new repositories, which will suppress this warning, call: 1113s hint: 1113s hint: git config --global init.defaultBranch 1113s hint: 1113s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 1113s hint: 'development'. The just-created branch can be renamed via this command: 1113s hint: 1113s hint: git branch -m 1113s ______________________________ test_hello_builds _______________________________ 1113s 1113s def test_hello_builds(): 1113s with push_dir(): 1113s 1113s @project_setup_py_test("hello-cpp", ["build"], ret=True) 1113s def run(): 1113s pass 1113s 1113s # Check that a project can be build twice in a row 1113s # See issue scikit-build#120 1113s > tmp_dir = run()[0] 1113s 1113s run = .run at 0xf726241ab600> 1113s 1113s tests/test_hello_cpp.py:30: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s tests/__init__.py:255: in wrapped 1113s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 1113s disable_languages_test = False 1113s fun = .run at 0xf726241abce0> 1113s iargs = () 1113s ikwargs = {} 1113s ret = True 1113s wrapped = .run at 0xf726241ab600> 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-36/run0') 1113s setup_args = ['build'], disable_languages_test = False 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = False 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-36/run0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ----------------------------- Captured stdout call ----------------------------- 1113s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-36/run0/.git/ 1113s [master (root-commit) 31f4da2] Initial commit 1113s 11 files changed, 115 insertions(+) 1113s create mode 100644 CMakeLists.txt 1113s create mode 100644 bonjour/__init__.py 1113s create mode 100644 bonjour/data/ciel.txt 1113s create mode 100644 bonjour/data/soleil.txt 1113s create mode 100644 bonjour/data/terre.txt 1113s create mode 100644 bonjourModule.py 1113s create mode 100644 hello/CMakeLists.txt 1113s create mode 100644 hello/__init__.py 1113s create mode 100644 hello/__main__.py 1113s create mode 100644 hello/_hello.cxx 1113s create mode 100644 setup.py 1113s ----------------------------- Captured stderr call ----------------------------- 1113s hint: Using 'master' as the name for the initial branch. This default branch name 1113s hint: is subject to change. To configure the initial branch name to use in all 1113s hint: of your new repositories, which will suppress this warning, call: 1113s hint: 1113s hint: git config --global init.defaultBranch 1113s hint: 1113s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 1113s hint: 'development'. The just-created branch can be renamed via this command: 1113s hint: 1113s hint: git branch -m 1113s _______________________________ test_hello_wheel _______________________________ 1113s 1113s def test_hello_wheel(): 1113s expected_content = [ 1113s f"hello/_hello{get_ext_suffix()}", 1113s "hello/__init__.py", 1113s "hello/__main__.py", 1113s "hello/world.py", 1113s "helloModule.py", 1113s "bonjour/__init__.py", 1113s "bonjour/data/ciel.txt", 1113s "bonjour/data/soleil.txt", 1113s "bonjour/data/terre.txt", 1113s "bonjourModule.py", 1113s ] 1113s 1113s expected_distribution_name = "hello-1.2.3" 1113s 1113s @project_setup_py_test("hello-cpp", ["bdist_wheel"], ret=True) 1113s def build_wheel(): 1113s whls = glob.glob("dist/*.whl") 1113s assert len(whls) == 1 1113s check_wheel_content(whls[0], expected_distribution_name, expected_content) 1113s os.remove(whls[0]) 1113s assert not os.path.exists(whls[0]) 1113s 1113s assert os.path.exists(os.path.join(CMAKE_BUILD_DIR(), "CMakeCache.txt")) 1113s os.remove(os.path.join(CMAKE_BUILD_DIR(), "CMakeCache.txt")) 1113s 1113s > tmp_dir = build_wheel()[0] 1113s 1113s build_wheel = .build_wheel at 0xf726241813a0> 1113s expected_content = ['hello/_hello.cpython-312-aarch64-linux-gnu.so', 'hello/__init__.py', 'hello/__main__.py', 'hello/world.py', 'helloModule.py', 'bonjour/__init__.py', ...] 1113s expected_distribution_name = 'hello-1.2.3' 1113s 1113s tests/test_hello_cpp.py:93: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s tests/__init__.py:255: in wrapped 1113s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 1113s disable_languages_test = False 1113s fun = .build_wheel at 0xf72624181440> 1113s iargs = () 1113s ikwargs = {} 1113s ret = True 1113s wrapped = .build_wheel at 0xf726241813a0> 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-37/build_wheel0') 1113s setup_args = ['bdist_wheel'], disable_languages_test = False 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = False 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-37/build_wheel0') 1113s setup_args = ['bdist_wheel'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ----------------------------- Captured stdout call ----------------------------- 1113s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-37/build_wheel0/.git/ 1113s [master (root-commit) 31f4da2] Initial commit 1113s 11 files changed, 115 insertions(+) 1113s create mode 100644 CMakeLists.txt 1113s create mode 100644 bonjour/__init__.py 1113s create mode 100644 bonjour/data/ciel.txt 1113s create mode 100644 bonjour/data/soleil.txt 1113s create mode 100644 bonjour/data/terre.txt 1113s create mode 100644 bonjourModule.py 1113s create mode 100644 hello/CMakeLists.txt 1113s create mode 100644 hello/__init__.py 1113s create mode 100644 hello/__main__.py 1113s create mode 100644 hello/_hello.cxx 1113s create mode 100644 setup.py 1113s ----------------------------- Captured stderr call ----------------------------- 1113s hint: Using 'master' as the name for the initial branch. This default branch name 1113s hint: is subject to change. To configure the initial branch name to use in all 1113s hint: of your new repositories, which will suppress this warning, call: 1113s hint: 1113s hint: git config --global init.defaultBranch 1113s hint: 1113s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 1113s hint: 'development'. The just-created branch can be renamed via this command: 1113s hint: 1113s hint: git branch -m 1113s ________________________ test_hello_clean[with-dry-run] ________________________ 1113s 1113s dry_run = True 1113s capfd = <_pytest.capture.CaptureFixture object at 0xf726242613d0> 1113s 1113s @pytest.mark.parametrize("dry_run", ["with-dry-run", "without-dry-run"]) 1113s def test_hello_clean(dry_run, capfd): 1113s with push_dir(): 1113s dry_run = dry_run == "with-dry-run" 1113s 1113s @project_setup_py_test("hello-cpp", ["build"], ret=True) 1113s def run_build(): 1113s pass 1113s 1113s > tmp_dir = run_build()[0] 1113s 1113s capfd = <_pytest.capture.CaptureFixture object at 0xf726242613d0> 1113s dry_run = True 1113s run_build = .run_build at 0xf726241819e0> 1113s 1113s tests/test_hello_cpp.py:114: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s tests/__init__.py:255: in wrapped 1113s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 1113s disable_languages_test = False 1113s fun = .run_build at 0xf726241800e0> 1113s iargs = () 1113s ikwargs = {} 1113s ret = True 1113s wrapped = .run_build at 0xf726241819e0> 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-38/run_build0') 1113s setup_args = ['build'], disable_languages_test = False 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = False 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-38/run_build0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ----------------------------- Captured stdout call ----------------------------- 1113s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-38/run_build0/.git/ 1113s [master (root-commit) 31f4da2] Initial commit 1113s 11 files changed, 115 insertions(+) 1113s create mode 100644 CMakeLists.txt 1113s create mode 100644 bonjour/__init__.py 1113s create mode 100644 bonjour/data/ciel.txt 1113s create mode 100644 bonjour/data/soleil.txt 1113s create mode 100644 bonjour/data/terre.txt 1113s create mode 100644 bonjourModule.py 1113s create mode 100644 hello/CMakeLists.txt 1113s create mode 100644 hello/__init__.py 1113s create mode 100644 hello/__main__.py 1113s create mode 100644 hello/_hello.cxx 1113s create mode 100644 setup.py 1113s ----------------------------- Captured stderr call ----------------------------- 1113s hint: Using 'master' as the name for the initial branch. This default branch name 1113s hint: is subject to change. To configure the initial branch name to use in all 1113s hint: of your new repositories, which will suppress this warning, call: 1113s hint: 1113s hint: git config --global init.defaultBranch 1113s hint: 1113s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 1113s hint: 'development'. The just-created branch can be renamed via this command: 1113s hint: 1113s hint: git branch -m 1113s ______________________ test_hello_clean[without-dry-run] _______________________ 1113s 1113s dry_run = False 1113s capfd = <_pytest.capture.CaptureFixture object at 0xf726241db1a0> 1113s 1113s @pytest.mark.parametrize("dry_run", ["with-dry-run", "without-dry-run"]) 1113s def test_hello_clean(dry_run, capfd): 1113s with push_dir(): 1113s dry_run = dry_run == "with-dry-run" 1113s 1113s @project_setup_py_test("hello-cpp", ["build"], ret=True) 1113s def run_build(): 1113s pass 1113s 1113s > tmp_dir = run_build()[0] 1113s 1113s capfd = <_pytest.capture.CaptureFixture object at 0xf726241db1a0> 1113s dry_run = False 1113s run_build = .run_build at 0xf72624181e40> 1113s 1113s tests/test_hello_cpp.py:114: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s tests/__init__.py:255: in wrapped 1113s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 1113s disable_languages_test = False 1113s fun = .run_build at 0xf72624181c60> 1113s iargs = () 1113s ikwargs = {} 1113s ret = True 1113s wrapped = .run_build at 0xf72624181e40> 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-39/run_build0') 1113s setup_args = ['build'], disable_languages_test = False 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = False 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-39/run_build0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ----------------------------- Captured stdout call ----------------------------- 1113s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-39/run_build0/.git/ 1113s [master (root-commit) 31f4da2] Initial commit 1113s 11 files changed, 115 insertions(+) 1113s create mode 100644 CMakeLists.txt 1113s create mode 100644 bonjour/__init__.py 1113s create mode 100644 bonjour/data/ciel.txt 1113s create mode 100644 bonjour/data/soleil.txt 1113s create mode 100644 bonjour/data/terre.txt 1113s create mode 100644 bonjourModule.py 1113s create mode 100644 hello/CMakeLists.txt 1113s create mode 100644 hello/__init__.py 1113s create mode 100644 hello/__main__.py 1113s create mode 100644 hello/_hello.cxx 1113s create mode 100644 setup.py 1113s ----------------------------- Captured stderr call ----------------------------- 1113s hint: Using 'master' as the name for the initial branch. This default branch name 1113s hint: is subject to change. To configure the initial branch name to use in all 1113s hint: of your new repositories, which will suppress this warning, call: 1113s hint: 1113s hint: git config --global init.defaultBranch 1113s hint: 1113s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 1113s hint: 'development'. The just-created branch can be renamed via this command: 1113s hint: 1113s hint: git branch -m 1113s ______________________________ test_hello_cleans _______________________________ 1113s 1113s capfd = <_pytest.capture.CaptureFixture object at 0xf72624261f10> 1113s caplog = <_pytest.logging.LogCaptureFixture object at 0xf726242634d0> 1113s 1113s def test_hello_cleans(capfd, caplog): 1113s with push_dir(): 1113s tmp_dir = _tmpdir("test_hello_cleans") 1113s 1113s _copy_dir(tmp_dir, os.path.join(SAMPLES_DIR, "hello-cpp")) 1113s 1113s @project_setup_py_test("hello-cpp", ["build"], tmp_dir=tmp_dir) 1113s def run_build(): 1113s pass 1113s 1113s @project_setup_py_test("hello-cpp", ["clean"], tmp_dir=tmp_dir) 1113s def run_clean(): 1113s pass 1113s 1113s # Check that a project can be cleaned twice in a row 1113s > run_build() 1113s 1113s capfd = <_pytest.capture.CaptureFixture object at 0xf72624261f10> 1113s caplog = <_pytest.logging.LogCaptureFixture object at 0xf726242634d0> 1113s run_build = .run_build at 0xf726241ab600> 1113s run_clean = .run_clean at 0xf72624181ee0> 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-40/test_hello_cleans0') 1113s 1113s tests/test_hello_cpp.py:158: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s tests/__init__.py:255: in wrapped 1113s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 1113s disable_languages_test = False 1113s fun = .run_build at 0xf726241abce0> 1113s iargs = () 1113s ikwargs = {} 1113s ret = False 1113s wrapped = .run_build at 0xf726241ab600> 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-40/test_hello_cleans0') 1113s setup_args = ['build'], disable_languages_test = False 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = False 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-40/test_hello_cleans0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ___________________________ test_hello_cython_builds ___________________________ 1113s 1113s iargs = (), ikwargs = {} 1113s 1113s @functools.wraps(fun) 1113s def wrapped(*iargs, **ikwargs): 1113s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 1113s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 1113s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 1113s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 1113s 1113s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 1113s 1113s disable_languages_test = False 1113s fun = 1113s iargs = () 1113s ikwargs = {} 1113s ret = False 1113s wrapped = 1113s 1113s tests/__init__.py:255: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-41/test_hello_cython_builds0') 1113s setup_args = ['build'], disable_languages_test = False 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = False 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-41/test_hello_cython_builds0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ----------------------------- Captured stdout call ----------------------------- 1113s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-41/test_hello_cython_builds0/.git/ 1113s [master (root-commit) c0985e7] Initial commit 1113s 6 files changed, 42 insertions(+) 1113s create mode 100644 CMakeLists.txt 1113s create mode 100644 hello/CMakeLists.txt 1113s create mode 100644 hello/__init__.py 1113s create mode 100644 hello/__main__.py 1113s create mode 100644 hello/_hello.pyx 1113s create mode 100644 setup.py 1113s ----------------------------- Captured stderr call ----------------------------- 1113s hint: Using 'master' as the name for the initial branch. This default branch name 1113s hint: is subject to change. To configure the initial branch name to use in all 1113s hint: of your new repositories, which will suppress this warning, call: 1113s hint: 1113s hint: git config --global init.defaultBranch 1113s hint: 1113s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 1113s hint: 'development'. The just-created branch can be renamed via this command: 1113s hint: 1113s hint: git branch -m 1113s ___________________________ test_hello_cython_sdist ____________________________ 1113s 1113s iargs = (), ikwargs = {} 1113s 1113s @functools.wraps(fun) 1113s def wrapped(*iargs, **ikwargs): 1113s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 1113s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 1113s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 1113s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 1113s 1113s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 1113s 1113s disable_languages_test = False 1113s fun = 1113s iargs = () 1113s ikwargs = {} 1113s ret = False 1113s wrapped = 1113s 1113s tests/__init__.py:255: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-42/test_hello_cython_sdist0') 1113s setup_args = ['sdist'], disable_languages_test = False 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = False 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-42/test_hello_cython_sdist0') 1113s setup_args = ['sdist'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ----------------------------- Captured stdout call ----------------------------- 1113s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-42/test_hello_cython_sdist0/.git/ 1113s [master (root-commit) c0985e7] Initial commit 1113s 6 files changed, 42 insertions(+) 1113s create mode 100644 CMakeLists.txt 1113s create mode 100644 hello/CMakeLists.txt 1113s create mode 100644 hello/__init__.py 1113s create mode 100644 hello/__main__.py 1113s create mode 100644 hello/_hello.pyx 1113s create mode 100644 setup.py 1113s ----------------------------- Captured stderr call ----------------------------- 1113s hint: Using 'master' as the name for the initial branch. This default branch name 1113s hint: is subject to change. To configure the initial branch name to use in all 1113s hint: of your new repositories, which will suppress this warning, call: 1113s hint: 1113s hint: git config --global init.defaultBranch 1113s hint: 1113s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 1113s hint: 'development'. The just-created branch can be renamed via this command: 1113s hint: 1113s hint: git branch -m 1113s ___________________________ test_hello_cython_wheel ____________________________ 1113s 1113s iargs = (), ikwargs = {} 1113s 1113s @functools.wraps(fun) 1113s def wrapped(*iargs, **ikwargs): 1113s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 1113s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 1113s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 1113s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 1113s 1113s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 1113s 1113s disable_languages_test = False 1113s fun = 1113s iargs = () 1113s ikwargs = {} 1113s ret = False 1113s wrapped = 1113s 1113s tests/__init__.py:255: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-43/test_hello_cython_wheel0') 1113s setup_args = ['bdist_wheel'], disable_languages_test = False 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = False 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-43/test_hello_cython_wheel0') 1113s setup_args = ['bdist_wheel'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ----------------------------- Captured stdout call ----------------------------- 1113s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-43/test_hello_cython_wheel0/.git/ 1113s [master (root-commit) c0985e7] Initial commit 1113s 6 files changed, 42 insertions(+) 1113s create mode 100644 CMakeLists.txt 1113s create mode 100644 hello/CMakeLists.txt 1113s create mode 100644 hello/__init__.py 1113s create mode 100644 hello/__main__.py 1113s create mode 100644 hello/_hello.pyx 1113s create mode 100644 setup.py 1113s ----------------------------- Captured stderr call ----------------------------- 1113s hint: Using 'master' as the name for the initial branch. This default branch name 1113s hint: is subject to change. To configure the initial branch name to use in all 1113s hint: of your new repositories, which will suppress this warning, call: 1113s hint: 1113s hint: git config --global init.defaultBranch 1113s hint: 1113s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 1113s hint: 'development'. The just-created branch can be renamed via this command: 1113s hint: 1113s hint: git branch -m 1113s ____________________________ test_hello_pure_builds ____________________________ 1113s 1113s iargs = () 1113s ikwargs = {'capsys': <_pytest.capture.CaptureFixture object at 0xf726241db950>} 1113s 1113s @functools.wraps(fun) 1113s def wrapped(*iargs, **ikwargs): 1113s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 1113s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 1113s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 1113s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 1113s 1113s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 1113s 1113s disable_languages_test = True 1113s fun = 1113s iargs = () 1113s ikwargs = {'capsys': <_pytest.capture.CaptureFixture object at 0xf726241db950>} 1113s ret = False 1113s wrapped = 1113s 1113s tests/__init__.py:255: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-44/test_hello_pure_builds0') 1113s setup_args = ['build'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-44/test_hello_pure_builds0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ----------------------------- Captured stdout call ----------------------------- 1113s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-44/test_hello_pure_builds0/.git/ 1113s [master (root-commit) d782b85] Initial commit 1113s 2 files changed, 12 insertions(+) 1113s create mode 100644 hello/__init__.py 1113s create mode 100644 setup.py 1113s ----------------------------- Captured stderr call ----------------------------- 1113s hint: Using 'master' as the name for the initial branch. This default branch name 1113s hint: is subject to change. To configure the initial branch name to use in all 1113s hint: of your new repositories, which will suppress this warning, call: 1113s hint: 1113s hint: git config --global init.defaultBranch 1113s hint: 1113s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 1113s hint: 'development'. The just-created branch can be renamed via this command: 1113s hint: 1113s hint: git branch -m 1113s ____________________________ test_hello_pure_sdist _____________________________ 1113s 1113s iargs = (), ikwargs = {} 1113s 1113s @functools.wraps(fun) 1113s def wrapped(*iargs, **ikwargs): 1113s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 1113s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 1113s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 1113s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 1113s 1113s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 1113s 1113s disable_languages_test = True 1113s fun = 1113s iargs = () 1113s ikwargs = {} 1113s ret = False 1113s wrapped = 1113s 1113s tests/__init__.py:255: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-45/test_hello_pure_sdist0') 1113s setup_args = ['sdist'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-45/test_hello_pure_sdist0') 1113s setup_args = ['sdist'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ----------------------------- Captured stdout call ----------------------------- 1113s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-45/test_hello_pure_sdist0/.git/ 1113s [master (root-commit) d782b85] Initial commit 1113s 2 files changed, 12 insertions(+) 1113s create mode 100644 hello/__init__.py 1113s create mode 100644 setup.py 1113s ----------------------------- Captured stderr call ----------------------------- 1113s hint: Using 'master' as the name for the initial branch. This default branch name 1113s hint: is subject to change. To configure the initial branch name to use in all 1113s hint: of your new repositories, which will suppress this warning, call: 1113s hint: 1113s hint: git config --global init.defaultBranch 1113s hint: 1113s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 1113s hint: 'development'. The just-created branch can be renamed via this command: 1113s hint: 1113s hint: git branch -m 1113s ____________________________ test_hello_pure_wheel _____________________________ 1113s 1113s iargs = (), ikwargs = {} 1113s 1113s @functools.wraps(fun) 1113s def wrapped(*iargs, **ikwargs): 1113s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 1113s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 1113s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 1113s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 1113s 1113s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 1113s 1113s disable_languages_test = True 1113s fun = 1113s iargs = () 1113s ikwargs = {} 1113s ret = False 1113s wrapped = 1113s 1113s tests/__init__.py:255: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-46/test_hello_pure_wheel0') 1113s setup_args = ['bdist_wheel'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-46/test_hello_pure_wheel0') 1113s setup_args = ['bdist_wheel'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ----------------------------- Captured stdout call ----------------------------- 1113s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-46/test_hello_pure_wheel0/.git/ 1113s [master (root-commit) d782b85] Initial commit 1113s 2 files changed, 12 insertions(+) 1113s create mode 100644 hello/__init__.py 1113s create mode 100644 setup.py 1113s ----------------------------- Captured stderr call ----------------------------- 1113s hint: Using 'master' as the name for the initial branch. This default branch name 1113s hint: is subject to change. To configure the initial branch name to use in all 1113s hint: of your new repositories, which will suppress this warning, call: 1113s hint: 1113s hint: git config --global init.defaultBranch 1113s hint: 1113s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 1113s hint: 'development'. The just-created branch can be renamed via this command: 1113s hint: 1113s hint: git branch -m 1113s _______________________________ test_hello_clean _______________________________ 1113s 1113s capfd = <_pytest.capture.CaptureFixture object at 0xf72624260b30> 1113s 1113s def test_hello_clean(capfd): 1113s with push_dir(): 1113s 1113s @project_setup_py_test("hello-pure", ["build"], disable_languages_test=True, ret=True) 1113s def run_build(): 1113s pass 1113s 1113s > tmp_dir = run_build()[0] 1113s 1113s capfd = <_pytest.capture.CaptureFixture object at 0xf72624260b30> 1113s run_build = .run_build at 0xf72624182ac0> 1113s 1113s tests/test_hello_pure.py:65: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s tests/__init__.py:255: in wrapped 1113s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 1113s disable_languages_test = True 1113s fun = .run_build at 0xf72624181ee0> 1113s iargs = () 1113s ikwargs = {} 1113s ret = True 1113s wrapped = .run_build at 0xf72624182ac0> 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-47/run_build0') 1113s setup_args = ['build'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-47/run_build0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ----------------------------- Captured stdout call ----------------------------- 1113s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-47/run_build0/.git/ 1113s [master (root-commit) d782b85] Initial commit 1113s 2 files changed, 12 insertions(+) 1113s create mode 100644 hello/__init__.py 1113s create mode 100644 setup.py 1113s ----------------------------- Captured stderr call ----------------------------- 1113s hint: Using 'master' as the name for the initial branch. This default branch name 1113s hint: is subject to change. To configure the initial branch name to use in all 1113s hint: of your new repositories, which will suppress this warning, call: 1113s hint: 1113s hint: git config --global init.defaultBranch 1113s hint: 1113s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 1113s hint: 'development'. The just-created branch can be renamed via this command: 1113s hint: 1113s hint: git branch -m 1113s __________________________ test_include_exclude_data ___________________________ 1113s 1113s iargs = (), ikwargs = {} 1113s 1113s @functools.wraps(fun) 1113s def wrapped(*iargs, **ikwargs): 1113s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 1113s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 1113s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 1113s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 1113s 1113s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 1113s 1113s disable_languages_test = False 1113s fun = 1113s iargs = () 1113s ikwargs = {} 1113s ret = False 1113s wrapped = 1113s 1113s tests/__init__.py:255: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-48/test_include_exclude_data0') 1113s setup_args = ['bdist_wheel'], disable_languages_test = False 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = False 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-48/test_include_exclude_data0') 1113s setup_args = ['bdist_wheel'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ----------------------------- Captured stdout call ----------------------------- 1113s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-48/test_include_exclude_data0/.git/ 1113s [master (root-commit) a1a2e9f] Initial commit 1113s 15 files changed, 79 insertions(+) 1113s create mode 100644 CMakeLists.txt 1113s create mode 100644 MANIFEST.in 1113s create mode 100644 hello/__init__.py 1113s create mode 100644 hello/data/subdata/hello_data1_include_from_manifest.txt 1113s create mode 100644 hello/data/subdata/hello_data2_include_from_manifest.txt 1113s create mode 100644 hello/data/subdata/hello_data3_include_from_manifest_and_exclude_from_manifest.txt 1113s create mode 100644 hello/data/subdata/hello_data4_include_from_manifest_and_exclude_from_setup.txt 1113s create mode 100644 hello/hello_include_from_manifest.txt 1113s create mode 100644 hello2/__init__.py 1113s create mode 100644 hello2/data2/subdata2/hello2_data1_include_from_manifest.txt 1113s create mode 100644 hello2/data2/subdata2/hello2_data2_include_from_manifest.txt 1113s create mode 100644 hello2/data2/subdata2/hello2_data3_include_from_manifest_and_exclude_from_manifest.txt 1113s create mode 100644 hello2/data2/subdata2/hello2_data4_include_from_manifest_and_exclude_from_setup.txt 1113s create mode 100644 hello2/hello2_include_from_manifest.txt 1113s create mode 100644 setup.py 1113s ----------------------------- Captured stderr call ----------------------------- 1113s hint: Using 'master' as the name for the initial branch. This default branch name 1113s hint: is subject to change. To configure the initial branch name to use in all 1113s hint: of your new repositories, which will suppress this warning, call: 1113s hint: 1113s hint: git config --global init.defaultBranch 1113s hint: 1113s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 1113s hint: 'development'. The just-created branch can be renamed via this command: 1113s hint: 1113s hint: git branch -m 1113s _____________________ test_include_exclude_data_with_base ______________________ 1113s 1113s iargs = (), ikwargs = {} 1113s 1113s @functools.wraps(fun) 1113s def wrapped(*iargs, **ikwargs): 1113s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 1113s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 1113s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 1113s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 1113s 1113s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 1113s 1113s disable_languages_test = False 1113s fun = 1113s iargs = () 1113s ikwargs = {} 1113s ret = False 1113s wrapped = 1113s 1113s tests/__init__.py:255: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-49/test_include_exclude_data_with0') 1113s setup_args = ['bdist_wheel'], disable_languages_test = False 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = False 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-49/test_include_exclude_data_with0') 1113s setup_args = ['bdist_wheel'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ----------------------------- Captured stdout call ----------------------------- 1113s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-49/test_include_exclude_data_with0/.git/ 1113s [master (root-commit) 3fe991c] Initial commit 1113s 15 files changed, 80 insertions(+) 1113s create mode 100644 CMakeLists.txt 1113s create mode 100644 MANIFEST.in 1113s create mode 100644 setup.py 1113s create mode 100644 src/hello/__init__.py 1113s create mode 100644 src/hello/data/subdata/hello_data1_include_from_manifest.txt 1113s create mode 100644 src/hello/data/subdata/hello_data2_include_from_manifest.txt 1113s create mode 100644 src/hello/data/subdata/hello_data3_include_from_manifest_and_exclude_from_manifest.txt 1113s create mode 100644 src/hello/data/subdata/hello_data4_include_from_manifest_and_exclude_from_setup.txt 1113s create mode 100644 src/hello/hello_include_from_manifest.txt 1113s create mode 100644 src/hello2/__init__.py 1113s create mode 100644 src/hello2/data2/subdata2/hello2_data1_include_from_manifest.txt 1113s create mode 100644 src/hello2/data2/subdata2/hello2_data2_include_from_manifest.txt 1113s create mode 100644 src/hello2/data2/subdata2/hello2_data3_include_from_manifest_and_exclude_from_manifest.txt 1113s create mode 100644 src/hello2/data2/subdata2/hello2_data4_include_from_manifest_and_exclude_from_setup.txt 1113s create mode 100644 src/hello2/hello2_include_from_manifest.txt 1113s ----------------------------- Captured stderr call ----------------------------- 1113s hint: Using 'master' as the name for the initial branch. This default branch name 1113s hint: is subject to change. To configure the initial branch name to use in all 1113s hint: of your new repositories, which will suppress this warning, call: 1113s hint: 1113s hint: git config --global init.defaultBranch 1113s hint: 1113s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 1113s hint: 'development'. The just-created branch can be renamed via this command: 1113s hint: 1113s hint: git branch -m 1113s ________________________ test_build_ext_inplace_command ________________________ 1113s 1113s iargs = (), ikwargs = {} 1113s 1113s @functools.wraps(fun) 1113s def wrapped(*iargs, **ikwargs): 1113s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 1113s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 1113s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 1113s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 1113s 1113s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 1113s 1113s disable_languages_test = True 1113s fun = 1113s iargs = () 1113s ikwargs = {} 1113s ret = False 1113s wrapped = 1113s 1113s tests/__init__.py:255: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-50/test_build_ext_inplace_command0') 1113s setup_args = ['build_ext', '--inplace'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-50/test_build_ext_inplace_command0') 1113s setup_args = ['build_ext', '--inplace'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ----------------------------- Captured stdout call ----------------------------- 1113s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-50/test_build_ext_inplace_command0/.git/ 1113s [master (root-commit) 174eeda] Initial commit 1113s 5 files changed, 160 insertions(+) 1113s create mode 100644 CMakeLists.txt 1113s create mode 100644 hello/__init__.py 1113s create mode 100644 hello/_hello_ext.cxx 1113s create mode 100644 hello/_hello_sk.cxx 1113s create mode 100644 setup.py 1113s ----------------------------- Captured stderr call ----------------------------- 1113s hint: Using 'master' as the name for the initial branch. This default branch name 1113s hint: is subject to change. To configure the initial branch name to use in all 1113s hint: of your new repositories, which will suppress this warning, call: 1113s hint: 1113s hint: git config --global init.defaultBranch 1113s hint: 1113s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 1113s hint: 'development'. The just-created branch can be renamed via this command: 1113s hint: 1113s hint: git branch -m 1113s ___________________________ test_bdist_wheel_command ___________________________ 1113s 1113s def test_bdist_wheel_command(): 1113s project = "issue-335-support-cmake-source-dir" 1113s 1113s expected_content = [ 1113s "hello/__init__.py", 1113s "hello/swig_mwe.py", 1113s "hello/_swig_mwe.pyd", 1113s "hello-1.2.3.data/data/bin/hello", 1113s "hello-1.2.3.data/data/lib/static/libbar.a", 1113s "hello-1.2.3.data/data/lib/static/libfoo.a", 1113s "hello-1.2.3.data/data/include/bar.h", 1113s "hello-1.2.3.data/data/include/foo.h", 1113s ] 1113s 1113s expected_distribution_name = "hello-1.2.3" 1113s 1113s tmp_dir = _tmpdir("test_bdist_wheel_command") 1113s prepare_project(project, tmp_dir) 1113s initialize_git_repo_and_commit(tmp_dir, verbose=True) 1113s 1113s relative_setup_path = "wrapping/python/" 1113s 1113s > with execute_setup_py(tmp_dir.join(relative_setup_path), ["bdist_wheel"]): 1113s 1113s 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', ...] 1113s expected_distribution_name = 'hello-1.2.3' 1113s project = 'issue-335-support-cmake-source-dir' 1113s relative_setup_path = 'wrapping/python/' 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-51/test_bdist_wheel_command0') 1113s 1113s tests/test_issue335_support_cmake_source_dir.py:31: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-51/test_bdist_wheel_command0/wrapping/python') 1113s setup_args = ['bdist_wheel'], disable_languages_test = False 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = False 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-51/test_bdist_wheel_command0/wrapping/python') 1113s setup_args = ['bdist_wheel'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ----------------------------- Captured stdout call ----------------------------- 1113s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-51/test_bdist_wheel_command0/.git/ 1113s [master (root-commit) 05f959f] Initial commit 1113s 4 files changed, 52 insertions(+) 1113s create mode 100644 CMakeLists.txt 1113s create mode 100644 wrapping/python/CMakeLists.txt 1113s create mode 100644 wrapping/python/hello/__init__.py 1113s create mode 100644 wrapping/python/setup.py 1113s ----------------------------- Captured stderr call ----------------------------- 1113s hint: Using 'master' as the name for the initial branch. This default branch name 1113s hint: is subject to change. To configure the initial branch name to use in all 1113s hint: of your new repositories, which will suppress this warning, call: 1113s hint: 1113s hint: git config --global init.defaultBranch 1113s hint: 1113s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 1113s hint: 'development'. The just-created branch can be renamed via this command: 1113s hint: 1113s hint: git branch -m 1113s _ test_cmake_args_keyword_osx_default[None-cli_setup_args0-keyword_cmake_args0-cli_cmake_args0-10.9] _ 1113s 1113s osx_deployment_target_env_var = None, cli_setup_args = [] 1113s keyword_cmake_args = [], cli_cmake_args = [] 1113s expected_cmake_osx_deployment_target = '10.9' 1113s mocker = 1113s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0xf726241db410> 1113s 1113s @pytest.mark.parametrize( 1113s params, 1113s [ 1113s # default plat_name is 'macosx-10.9-x86_64' 1113s ( 1113s # osx_deployment_target_env_var 1113s None, 1113s # cli_setup_args 1113s [], 1113s # keyword_cmake_args 1113s [], 1113s # cli_cmake_args 1113s [], 1113s # expected_cmake_osx_deployment_target 1113s "10.9", 1113s ), 1113s ( 1113s # osx_deployment_target_env_var 1113s "10.7", 1113s # cli_setup_args 1113s [], 1113s # keyword_cmake_args 1113s [], 1113s # cli_cmake_args 1113s [], 1113s # expected_cmake_osx_deployment_target 1113s "10.7", 1113s ), 1113s ( 1113s # osx_deployment_target_env_var 1113s "10.7", 1113s # cli_setup_args 1113s ["--plat-name", "macosx-10.9-x86_64"], 1113s # keyword_cmake_args 1113s [], 1113s # cli_cmake_args 1113s [], 1113s # expected_cmake_osx_deployment_target 1113s "10.9", 1113s ), 1113s ( 1113s # osx_deployment_target_env_var 1113s None, 1113s # cli_setup_args 1113s ["--plat-name", "macosx-10.6-x86_64"], 1113s # keyword_cmake_args 1113s [], 1113s # cli_cmake_args 1113s [], 1113s # expected_cmake_osx_deployment_target 1113s "10.6", 1113s ), 1113s ( 1113s # osx_deployment_target_env_var 1113s None, 1113s # cli_setup_args 1113s ["--plat-name", "macosx-10.7-x86_64"], 1113s # keyword_cmake_args 1113s [], 1113s # cli_cmake_args 1113s [], 1113s # expected_cmake_osx_deployment_target 1113s "10.7", 1113s ), 1113s ( 1113s # osx_deployment_target_env_var 1113s None, 1113s # cli_setup_args 1113s [], 1113s # keyword_cmake_args 1113s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 1113s # cli_cmake_args 1113s [], 1113s # expected_cmake_osx_deployment_target 1113s "10.7", 1113s ), 1113s ( 1113s # osx_deployment_target_env_var 1113s None, 1113s # cli_setup_args 1113s ["--plat-name", "macosx-10.12-x86_64"], 1113s # keyword_cmake_args 1113s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 1113s # cli_cmake_args 1113s [], 1113s # expected_cmake_osx_deployment_target 1113s "10.7", 1113s ), 1113s ( 1113s # osx_deployment_target_env_var 1113s None, 1113s # cli_setup_args 1113s [], 1113s # keyword_cmake_args 1113s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 1113s # cli_cmake_args 1113s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 1113s # expected_cmake_osx_deployment_target 1113s "10.8", 1113s ), 1113s ( 1113s # osx_deployment_target_env_var 1113s None, 1113s # cli_setup_args 1113s ["--plat-name", "macosx-10.12-x86_64"], 1113s # keyword_cmake_args 1113s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 1113s # cli_cmake_args 1113s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 1113s # expected_cmake_osx_deployment_target 1113s "10.8", 1113s ), 1113s ], 1113s ) 1113s def test_cmake_args_keyword_osx_default( 1113s osx_deployment_target_env_var, 1113s cli_setup_args, 1113s keyword_cmake_args, 1113s cli_cmake_args, 1113s expected_cmake_osx_deployment_target, 1113s mocker, 1113s monkeypatch, 1113s ): 1113s tmp_dir = _tmpdir("cmake_args_keyword_osx_default") 1113s 1113s tmp_dir.join("setup.py").write( 1113s textwrap.dedent( 1113s """ 1113s from skbuild import setup 1113s setup( 1113s name="test_cmake_args_keyword_osx_default", 1113s version="1.2.3", 1113s description="A minimal example package", 1113s author="The scikit-build team", 1113s license="MIT", 1113s cmake_args=[{cmake_args}] 1113s ) 1113s """.format(cmake_args=",".join([f"'{arg}'" for arg in keyword_cmake_args])) 1113s ) 1113s ) 1113s tmp_dir.join("CMakeLists.txt").write( 1113s textwrap.dedent( 1113s """ 1113s message(FATAL_ERROR "This error message should not be displayed") 1113s """ 1113s ) 1113s ) 1113s 1113s mock_configure = mocker.patch("skbuild.cmaker.CMaker.configure", side_effect=RuntimeError("exit skbuild")) 1113s 1113s monkeypatch.setattr(platform, "mac_ver", lambda: ("10.9", None, "x84_64")) 1113s monkeypatch.setattr(platform, "machine", lambda: "x86_64") 1113s monkeypatch.setattr(sys, "platform", "darwin") 1113s 1113s with push_env(MACOSX_DEPLOYMENT_TARGET=osx_deployment_target_env_var): 1113s monkeypatch.setattr(skbuild.constants, "_SKBUILD_PLAT_NAME", skbuild.constants._default_skbuild_plat_name()) 1113s with pytest.raises(RuntimeError, match="exit skbuild"): 1113s > with execute_setup_py(tmp_dir, ["build", *cli_setup_args, "--", *cli_cmake_args]): 1113s 1113s cli_cmake_args = [] 1113s cli_setup_args = [] 1113s expected_cmake_osx_deployment_target = '10.9' 1113s keyword_cmake_args = [] 1113s mock_configure = 1113s mocker = 1113s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0xf726241db410> 1113s osx_deployment_target_env_var = None 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-52/cmake_args_keyword_osx_default0') 1113s 1113s tests/test_issue342_cmake_osx_args_in_setup.py:176: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-52/cmake_args_keyword_osx_default0') 1113s setup_args = ['build', '--'], disable_languages_test = False 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = False 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-52/cmake_args_keyword_osx_default0') 1113s setup_args = ['build', '--'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s _ test_cmake_args_keyword_osx_default[10.7-cli_setup_args1-keyword_cmake_args1-cli_cmake_args1-10.7] _ 1113s 1113s osx_deployment_target_env_var = '10.7', cli_setup_args = [] 1113s keyword_cmake_args = [], cli_cmake_args = [] 1113s expected_cmake_osx_deployment_target = '10.7' 1113s mocker = 1113s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0xf72624172a80> 1113s 1113s @pytest.mark.parametrize( 1113s params, 1113s [ 1113s # default plat_name is 'macosx-10.9-x86_64' 1113s ( 1113s # osx_deployment_target_env_var 1113s None, 1113s # cli_setup_args 1113s [], 1113s # keyword_cmake_args 1113s [], 1113s # cli_cmake_args 1113s [], 1113s # expected_cmake_osx_deployment_target 1113s "10.9", 1113s ), 1113s ( 1113s # osx_deployment_target_env_var 1113s "10.7", 1113s # cli_setup_args 1113s [], 1113s # keyword_cmake_args 1113s [], 1113s # cli_cmake_args 1113s [], 1113s # expected_cmake_osx_deployment_target 1113s "10.7", 1113s ), 1113s ( 1113s # osx_deployment_target_env_var 1113s "10.7", 1113s # cli_setup_args 1113s ["--plat-name", "macosx-10.9-x86_64"], 1113s # keyword_cmake_args 1113s [], 1113s # cli_cmake_args 1113s [], 1113s # expected_cmake_osx_deployment_target 1113s "10.9", 1113s ), 1113s ( 1113s # osx_deployment_target_env_var 1113s None, 1113s # cli_setup_args 1113s ["--plat-name", "macosx-10.6-x86_64"], 1113s # keyword_cmake_args 1113s [], 1113s # cli_cmake_args 1113s [], 1113s # expected_cmake_osx_deployment_target 1113s "10.6", 1113s ), 1113s ( 1113s # osx_deployment_target_env_var 1113s None, 1113s # cli_setup_args 1113s ["--plat-name", "macosx-10.7-x86_64"], 1113s # keyword_cmake_args 1113s [], 1113s # cli_cmake_args 1113s [], 1113s # expected_cmake_osx_deployment_target 1113s "10.7", 1113s ), 1113s ( 1113s # osx_deployment_target_env_var 1113s None, 1113s # cli_setup_args 1113s [], 1113s # keyword_cmake_args 1113s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 1113s # cli_cmake_args 1113s [], 1113s # expected_cmake_osx_deployment_target 1113s "10.7", 1113s ), 1113s ( 1113s # osx_deployment_target_env_var 1113s None, 1113s # cli_setup_args 1113s ["--plat-name", "macosx-10.12-x86_64"], 1113s # keyword_cmake_args 1113s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 1113s # cli_cmake_args 1113s [], 1113s # expected_cmake_osx_deployment_target 1113s "10.7", 1113s ), 1113s ( 1113s # osx_deployment_target_env_var 1113s None, 1113s # cli_setup_args 1113s [], 1113s # keyword_cmake_args 1113s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 1113s # cli_cmake_args 1113s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 1113s # expected_cmake_osx_deployment_target 1113s "10.8", 1113s ), 1113s ( 1113s # osx_deployment_target_env_var 1113s None, 1113s # cli_setup_args 1113s ["--plat-name", "macosx-10.12-x86_64"], 1113s # keyword_cmake_args 1113s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 1113s # cli_cmake_args 1113s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 1113s # expected_cmake_osx_deployment_target 1113s "10.8", 1113s ), 1113s ], 1113s ) 1113s def test_cmake_args_keyword_osx_default( 1113s osx_deployment_target_env_var, 1113s cli_setup_args, 1113s keyword_cmake_args, 1113s cli_cmake_args, 1113s expected_cmake_osx_deployment_target, 1113s mocker, 1113s monkeypatch, 1113s ): 1113s tmp_dir = _tmpdir("cmake_args_keyword_osx_default") 1113s 1113s tmp_dir.join("setup.py").write( 1113s textwrap.dedent( 1113s """ 1113s from skbuild import setup 1113s setup( 1113s name="test_cmake_args_keyword_osx_default", 1113s version="1.2.3", 1113s description="A minimal example package", 1113s author="The scikit-build team", 1113s license="MIT", 1113s cmake_args=[{cmake_args}] 1113s ) 1113s """.format(cmake_args=",".join([f"'{arg}'" for arg in keyword_cmake_args])) 1113s ) 1113s ) 1113s tmp_dir.join("CMakeLists.txt").write( 1113s textwrap.dedent( 1113s """ 1113s message(FATAL_ERROR "This error message should not be displayed") 1113s """ 1113s ) 1113s ) 1113s 1113s mock_configure = mocker.patch("skbuild.cmaker.CMaker.configure", side_effect=RuntimeError("exit skbuild")) 1113s 1113s monkeypatch.setattr(platform, "mac_ver", lambda: ("10.9", None, "x84_64")) 1113s monkeypatch.setattr(platform, "machine", lambda: "x86_64") 1113s monkeypatch.setattr(sys, "platform", "darwin") 1113s 1113s with push_env(MACOSX_DEPLOYMENT_TARGET=osx_deployment_target_env_var): 1113s monkeypatch.setattr(skbuild.constants, "_SKBUILD_PLAT_NAME", skbuild.constants._default_skbuild_plat_name()) 1113s with pytest.raises(RuntimeError, match="exit skbuild"): 1113s > with execute_setup_py(tmp_dir, ["build", *cli_setup_args, "--", *cli_cmake_args]): 1113s 1113s cli_cmake_args = [] 1113s cli_setup_args = [] 1113s expected_cmake_osx_deployment_target = '10.7' 1113s keyword_cmake_args = [] 1113s mock_configure = 1113s mocker = 1113s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0xf72624172a80> 1113s osx_deployment_target_env_var = '10.7' 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-53/cmake_args_keyword_osx_default0') 1113s 1113s tests/test_issue342_cmake_osx_args_in_setup.py:176: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-53/cmake_args_keyword_osx_default0') 1113s setup_args = ['build', '--'], disable_languages_test = False 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = False 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-53/cmake_args_keyword_osx_default0') 1113s setup_args = ['build', '--'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s _ test_cmake_args_keyword_osx_default[10.7-cli_setup_args2-keyword_cmake_args2-cli_cmake_args2-10.9] _ 1113s 1113s osx_deployment_target_env_var = '10.7' 1113s cli_setup_args = ['--plat-name', 'macosx-10.9-x86_64'], keyword_cmake_args = [] 1113s cli_cmake_args = [], expected_cmake_osx_deployment_target = '10.9' 1113s mocker = 1113s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0xf726241739b0> 1113s 1113s @pytest.mark.parametrize( 1113s params, 1113s [ 1113s # default plat_name is 'macosx-10.9-x86_64' 1113s ( 1113s # osx_deployment_target_env_var 1113s None, 1113s # cli_setup_args 1113s [], 1113s # keyword_cmake_args 1113s [], 1113s # cli_cmake_args 1113s [], 1113s # expected_cmake_osx_deployment_target 1113s "10.9", 1113s ), 1113s ( 1113s # osx_deployment_target_env_var 1113s "10.7", 1113s # cli_setup_args 1113s [], 1113s # keyword_cmake_args 1113s [], 1113s # cli_cmake_args 1113s [], 1113s # expected_cmake_osx_deployment_target 1113s "10.7", 1113s ), 1113s ( 1113s # osx_deployment_target_env_var 1113s "10.7", 1113s # cli_setup_args 1113s ["--plat-name", "macosx-10.9-x86_64"], 1113s # keyword_cmake_args 1113s [], 1113s # cli_cmake_args 1113s [], 1113s # expected_cmake_osx_deployment_target 1113s "10.9", 1113s ), 1113s ( 1113s # osx_deployment_target_env_var 1113s None, 1113s # cli_setup_args 1113s ["--plat-name", "macosx-10.6-x86_64"], 1113s # keyword_cmake_args 1113s [], 1113s # cli_cmake_args 1113s [], 1113s # expected_cmake_osx_deployment_target 1113s "10.6", 1113s ), 1113s ( 1113s # osx_deployment_target_env_var 1113s None, 1113s # cli_setup_args 1113s ["--plat-name", "macosx-10.7-x86_64"], 1113s # keyword_cmake_args 1113s [], 1113s # cli_cmake_args 1113s [], 1113s # expected_cmake_osx_deployment_target 1113s "10.7", 1113s ), 1113s ( 1113s # osx_deployment_target_env_var 1113s None, 1113s # cli_setup_args 1113s [], 1113s # keyword_cmake_args 1113s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 1113s # cli_cmake_args 1113s [], 1113s # expected_cmake_osx_deployment_target 1113s "10.7", 1113s ), 1113s ( 1113s # osx_deployment_target_env_var 1113s None, 1113s # cli_setup_args 1113s ["--plat-name", "macosx-10.12-x86_64"], 1113s # keyword_cmake_args 1113s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 1113s # cli_cmake_args 1113s [], 1113s # expected_cmake_osx_deployment_target 1113s "10.7", 1113s ), 1113s ( 1113s # osx_deployment_target_env_var 1113s None, 1113s # cli_setup_args 1113s [], 1113s # keyword_cmake_args 1113s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 1113s # cli_cmake_args 1113s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 1113s # expected_cmake_osx_deployment_target 1113s "10.8", 1113s ), 1113s ( 1113s # osx_deployment_target_env_var 1113s None, 1113s # cli_setup_args 1113s ["--plat-name", "macosx-10.12-x86_64"], 1113s # keyword_cmake_args 1113s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 1113s # cli_cmake_args 1113s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 1113s # expected_cmake_osx_deployment_target 1113s "10.8", 1113s ), 1113s ], 1113s ) 1113s def test_cmake_args_keyword_osx_default( 1113s osx_deployment_target_env_var, 1113s cli_setup_args, 1113s keyword_cmake_args, 1113s cli_cmake_args, 1113s expected_cmake_osx_deployment_target, 1113s mocker, 1113s monkeypatch, 1113s ): 1113s tmp_dir = _tmpdir("cmake_args_keyword_osx_default") 1113s 1113s tmp_dir.join("setup.py").write( 1113s textwrap.dedent( 1113s """ 1113s from skbuild import setup 1113s setup( 1113s name="test_cmake_args_keyword_osx_default", 1113s version="1.2.3", 1113s description="A minimal example package", 1113s author="The scikit-build team", 1113s license="MIT", 1113s cmake_args=[{cmake_args}] 1113s ) 1113s """.format(cmake_args=",".join([f"'{arg}'" for arg in keyword_cmake_args])) 1113s ) 1113s ) 1113s tmp_dir.join("CMakeLists.txt").write( 1113s textwrap.dedent( 1113s """ 1113s message(FATAL_ERROR "This error message should not be displayed") 1113s """ 1113s ) 1113s ) 1113s 1113s mock_configure = mocker.patch("skbuild.cmaker.CMaker.configure", side_effect=RuntimeError("exit skbuild")) 1113s 1113s monkeypatch.setattr(platform, "mac_ver", lambda: ("10.9", None, "x84_64")) 1113s monkeypatch.setattr(platform, "machine", lambda: "x86_64") 1113s monkeypatch.setattr(sys, "platform", "darwin") 1113s 1113s with push_env(MACOSX_DEPLOYMENT_TARGET=osx_deployment_target_env_var): 1113s monkeypatch.setattr(skbuild.constants, "_SKBUILD_PLAT_NAME", skbuild.constants._default_skbuild_plat_name()) 1113s with pytest.raises(RuntimeError, match="exit skbuild"): 1113s > with execute_setup_py(tmp_dir, ["build", *cli_setup_args, "--", *cli_cmake_args]): 1113s 1113s cli_cmake_args = [] 1113s cli_setup_args = ['--plat-name', 'macosx-10.9-x86_64'] 1113s expected_cmake_osx_deployment_target = '10.9' 1113s keyword_cmake_args = [] 1113s mock_configure = 1113s mocker = 1113s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0xf726241739b0> 1113s osx_deployment_target_env_var = '10.7' 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-54/cmake_args_keyword_osx_default0') 1113s 1113s tests/test_issue342_cmake_osx_args_in_setup.py:176: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-54/cmake_args_keyword_osx_default0') 1113s setup_args = ['build', '--plat-name', 'macosx-10.9-x86_64', '--'] 1113s disable_languages_test = False 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = False 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-54/cmake_args_keyword_osx_default0') 1113s setup_args = ['build', '--plat-name', 'macosx-10.9-x86_64', '--'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s _ test_cmake_args_keyword_osx_default[None-cli_setup_args3-keyword_cmake_args3-cli_cmake_args3-10.6] _ 1113s 1113s osx_deployment_target_env_var = None 1113s cli_setup_args = ['--plat-name', 'macosx-10.6-x86_64'], keyword_cmake_args = [] 1113s cli_cmake_args = [], expected_cmake_osx_deployment_target = '10.6' 1113s mocker = 1113s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0xf72624176e70> 1113s 1113s @pytest.mark.parametrize( 1113s params, 1113s [ 1113s # default plat_name is 'macosx-10.9-x86_64' 1113s ( 1113s # osx_deployment_target_env_var 1113s None, 1113s # cli_setup_args 1113s [], 1113s # keyword_cmake_args 1113s [], 1113s # cli_cmake_args 1113s [], 1113s # expected_cmake_osx_deployment_target 1113s "10.9", 1113s ), 1113s ( 1113s # osx_deployment_target_env_var 1113s "10.7", 1113s # cli_setup_args 1113s [], 1113s # keyword_cmake_args 1113s [], 1113s # cli_cmake_args 1113s [], 1113s # expected_cmake_osx_deployment_target 1113s "10.7", 1113s ), 1113s ( 1113s # osx_deployment_target_env_var 1113s "10.7", 1113s # cli_setup_args 1113s ["--plat-name", "macosx-10.9-x86_64"], 1113s # keyword_cmake_args 1113s [], 1113s # cli_cmake_args 1113s [], 1113s # expected_cmake_osx_deployment_target 1113s "10.9", 1113s ), 1113s ( 1113s # osx_deployment_target_env_var 1113s None, 1113s # cli_setup_args 1113s ["--plat-name", "macosx-10.6-x86_64"], 1113s # keyword_cmake_args 1113s [], 1113s # cli_cmake_args 1113s [], 1113s # expected_cmake_osx_deployment_target 1113s "10.6", 1113s ), 1113s ( 1113s # osx_deployment_target_env_var 1113s None, 1113s # cli_setup_args 1113s ["--plat-name", "macosx-10.7-x86_64"], 1113s # keyword_cmake_args 1113s [], 1113s # cli_cmake_args 1113s [], 1113s # expected_cmake_osx_deployment_target 1113s "10.7", 1113s ), 1113s ( 1113s # osx_deployment_target_env_var 1113s None, 1113s # cli_setup_args 1113s [], 1113s # keyword_cmake_args 1113s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 1113s # cli_cmake_args 1113s [], 1113s # expected_cmake_osx_deployment_target 1113s "10.7", 1113s ), 1113s ( 1113s # osx_deployment_target_env_var 1113s None, 1113s # cli_setup_args 1113s ["--plat-name", "macosx-10.12-x86_64"], 1113s # keyword_cmake_args 1113s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 1113s # cli_cmake_args 1113s [], 1113s # expected_cmake_osx_deployment_target 1113s "10.7", 1113s ), 1113s ( 1113s # osx_deployment_target_env_var 1113s None, 1113s # cli_setup_args 1113s [], 1113s # keyword_cmake_args 1113s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 1113s # cli_cmake_args 1113s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 1113s # expected_cmake_osx_deployment_target 1113s "10.8", 1113s ), 1113s ( 1113s # osx_deployment_target_env_var 1113s None, 1113s # cli_setup_args 1113s ["--plat-name", "macosx-10.12-x86_64"], 1113s # keyword_cmake_args 1113s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 1113s # cli_cmake_args 1113s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 1113s # expected_cmake_osx_deployment_target 1113s "10.8", 1113s ), 1113s ], 1113s ) 1113s def test_cmake_args_keyword_osx_default( 1113s osx_deployment_target_env_var, 1113s cli_setup_args, 1113s keyword_cmake_args, 1113s cli_cmake_args, 1113s expected_cmake_osx_deployment_target, 1113s mocker, 1113s monkeypatch, 1113s ): 1113s tmp_dir = _tmpdir("cmake_args_keyword_osx_default") 1113s 1113s tmp_dir.join("setup.py").write( 1113s textwrap.dedent( 1113s """ 1113s from skbuild import setup 1113s setup( 1113s name="test_cmake_args_keyword_osx_default", 1113s version="1.2.3", 1113s description="A minimal example package", 1113s author="The scikit-build team", 1113s license="MIT", 1113s cmake_args=[{cmake_args}] 1113s ) 1113s """.format(cmake_args=",".join([f"'{arg}'" for arg in keyword_cmake_args])) 1113s ) 1113s ) 1113s tmp_dir.join("CMakeLists.txt").write( 1113s textwrap.dedent( 1113s """ 1113s message(FATAL_ERROR "This error message should not be displayed") 1113s """ 1113s ) 1113s ) 1113s 1113s mock_configure = mocker.patch("skbuild.cmaker.CMaker.configure", side_effect=RuntimeError("exit skbuild")) 1113s 1113s monkeypatch.setattr(platform, "mac_ver", lambda: ("10.9", None, "x84_64")) 1113s monkeypatch.setattr(platform, "machine", lambda: "x86_64") 1113s monkeypatch.setattr(sys, "platform", "darwin") 1113s 1113s with push_env(MACOSX_DEPLOYMENT_TARGET=osx_deployment_target_env_var): 1113s monkeypatch.setattr(skbuild.constants, "_SKBUILD_PLAT_NAME", skbuild.constants._default_skbuild_plat_name()) 1113s with pytest.raises(RuntimeError, match="exit skbuild"): 1113s > with execute_setup_py(tmp_dir, ["build", *cli_setup_args, "--", *cli_cmake_args]): 1113s 1113s cli_cmake_args = [] 1113s cli_setup_args = ['--plat-name', 'macosx-10.6-x86_64'] 1113s expected_cmake_osx_deployment_target = '10.6' 1113s keyword_cmake_args = [] 1113s mock_configure = 1113s mocker = 1113s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0xf72624176e70> 1113s osx_deployment_target_env_var = None 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-55/cmake_args_keyword_osx_default0') 1113s 1113s tests/test_issue342_cmake_osx_args_in_setup.py:176: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-55/cmake_args_keyword_osx_default0') 1113s setup_args = ['build', '--plat-name', 'macosx-10.6-x86_64', '--'] 1113s disable_languages_test = False 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = False 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-55/cmake_args_keyword_osx_default0') 1113s setup_args = ['build', '--plat-name', 'macosx-10.6-x86_64', '--'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s _ test_cmake_args_keyword_osx_default[None-cli_setup_args4-keyword_cmake_args4-cli_cmake_args4-10.7] _ 1113s 1113s osx_deployment_target_env_var = None 1113s cli_setup_args = ['--plat-name', 'macosx-10.7-x86_64'], keyword_cmake_args = [] 1113s cli_cmake_args = [], expected_cmake_osx_deployment_target = '10.7' 1113s mocker = 1113s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0xf72624175460> 1113s 1113s @pytest.mark.parametrize( 1113s params, 1113s [ 1113s # default plat_name is 'macosx-10.9-x86_64' 1113s ( 1113s # osx_deployment_target_env_var 1113s None, 1113s # cli_setup_args 1113s [], 1113s # keyword_cmake_args 1113s [], 1113s # cli_cmake_args 1113s [], 1113s # expected_cmake_osx_deployment_target 1113s "10.9", 1113s ), 1113s ( 1113s # osx_deployment_target_env_var 1113s "10.7", 1113s # cli_setup_args 1113s [], 1113s # keyword_cmake_args 1113s [], 1113s # cli_cmake_args 1113s [], 1113s # expected_cmake_osx_deployment_target 1113s "10.7", 1113s ), 1113s ( 1113s # osx_deployment_target_env_var 1113s "10.7", 1113s # cli_setup_args 1113s ["--plat-name", "macosx-10.9-x86_64"], 1113s # keyword_cmake_args 1113s [], 1113s # cli_cmake_args 1113s [], 1113s # expected_cmake_osx_deployment_target 1113s "10.9", 1113s ), 1113s ( 1113s # osx_deployment_target_env_var 1113s None, 1113s # cli_setup_args 1113s ["--plat-name", "macosx-10.6-x86_64"], 1113s # keyword_cmake_args 1113s [], 1113s # cli_cmake_args 1113s [], 1113s # expected_cmake_osx_deployment_target 1113s "10.6", 1113s ), 1113s ( 1113s # osx_deployment_target_env_var 1113s None, 1113s # cli_setup_args 1113s ["--plat-name", "macosx-10.7-x86_64"], 1113s # keyword_cmake_args 1113s [], 1113s # cli_cmake_args 1113s [], 1113s # expected_cmake_osx_deployment_target 1113s "10.7", 1113s ), 1113s ( 1113s # osx_deployment_target_env_var 1113s None, 1113s # cli_setup_args 1113s [], 1113s # keyword_cmake_args 1113s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 1113s # cli_cmake_args 1113s [], 1113s # expected_cmake_osx_deployment_target 1113s "10.7", 1113s ), 1113s ( 1113s # osx_deployment_target_env_var 1113s None, 1113s # cli_setup_args 1113s ["--plat-name", "macosx-10.12-x86_64"], 1113s # keyword_cmake_args 1113s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 1113s # cli_cmake_args 1113s [], 1113s # expected_cmake_osx_deployment_target 1113s "10.7", 1113s ), 1113s ( 1113s # osx_deployment_target_env_var 1113s None, 1113s # cli_setup_args 1113s [], 1113s # keyword_cmake_args 1113s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 1113s # cli_cmake_args 1113s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 1113s # expected_cmake_osx_deployment_target 1113s "10.8", 1113s ), 1113s ( 1113s # osx_deployment_target_env_var 1113s None, 1113s # cli_setup_args 1113s ["--plat-name", "macosx-10.12-x86_64"], 1113s # keyword_cmake_args 1113s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 1113s # cli_cmake_args 1113s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 1113s # expected_cmake_osx_deployment_target 1113s "10.8", 1113s ), 1113s ], 1113s ) 1113s def test_cmake_args_keyword_osx_default( 1113s osx_deployment_target_env_var, 1113s cli_setup_args, 1113s keyword_cmake_args, 1113s cli_cmake_args, 1113s expected_cmake_osx_deployment_target, 1113s mocker, 1113s monkeypatch, 1113s ): 1113s tmp_dir = _tmpdir("cmake_args_keyword_osx_default") 1113s 1113s tmp_dir.join("setup.py").write( 1113s textwrap.dedent( 1113s """ 1113s from skbuild import setup 1113s setup( 1113s name="test_cmake_args_keyword_osx_default", 1113s version="1.2.3", 1113s description="A minimal example package", 1113s author="The scikit-build team", 1113s license="MIT", 1113s cmake_args=[{cmake_args}] 1113s ) 1113s """.format(cmake_args=",".join([f"'{arg}'" for arg in keyword_cmake_args])) 1113s ) 1113s ) 1113s tmp_dir.join("CMakeLists.txt").write( 1113s textwrap.dedent( 1113s """ 1113s message(FATAL_ERROR "This error message should not be displayed") 1113s """ 1113s ) 1113s ) 1113s 1113s mock_configure = mocker.patch("skbuild.cmaker.CMaker.configure", side_effect=RuntimeError("exit skbuild")) 1113s 1113s monkeypatch.setattr(platform, "mac_ver", lambda: ("10.9", None, "x84_64")) 1113s monkeypatch.setattr(platform, "machine", lambda: "x86_64") 1113s monkeypatch.setattr(sys, "platform", "darwin") 1113s 1113s with push_env(MACOSX_DEPLOYMENT_TARGET=osx_deployment_target_env_var): 1113s monkeypatch.setattr(skbuild.constants, "_SKBUILD_PLAT_NAME", skbuild.constants._default_skbuild_plat_name()) 1113s with pytest.raises(RuntimeError, match="exit skbuild"): 1113s > with execute_setup_py(tmp_dir, ["build", *cli_setup_args, "--", *cli_cmake_args]): 1113s 1113s cli_cmake_args = [] 1113s cli_setup_args = ['--plat-name', 'macosx-10.7-x86_64'] 1113s expected_cmake_osx_deployment_target = '10.7' 1113s keyword_cmake_args = [] 1113s mock_configure = 1113s mocker = 1113s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0xf72624175460> 1113s osx_deployment_target_env_var = None 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-56/cmake_args_keyword_osx_default0') 1113s 1113s tests/test_issue342_cmake_osx_args_in_setup.py:176: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-56/cmake_args_keyword_osx_default0') 1113s setup_args = ['build', '--plat-name', 'macosx-10.7-x86_64', '--'] 1113s disable_languages_test = False 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = False 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-56/cmake_args_keyword_osx_default0') 1113s setup_args = ['build', '--plat-name', 'macosx-10.7-x86_64', '--'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s _ test_cmake_args_keyword_osx_default[None-cli_setup_args5-keyword_cmake_args5-cli_cmake_args5-10.7] _ 1113s 1113s osx_deployment_target_env_var = None, cli_setup_args = [] 1113s keyword_cmake_args = ['-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7'] 1113s cli_cmake_args = [], expected_cmake_osx_deployment_target = '10.7' 1113s mocker = 1113s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0xf72624167680> 1113s 1113s @pytest.mark.parametrize( 1113s params, 1113s [ 1113s # default plat_name is 'macosx-10.9-x86_64' 1113s ( 1113s # osx_deployment_target_env_var 1113s None, 1113s # cli_setup_args 1113s [], 1113s # keyword_cmake_args 1113s [], 1113s # cli_cmake_args 1113s [], 1113s # expected_cmake_osx_deployment_target 1113s "10.9", 1113s ), 1113s ( 1113s # osx_deployment_target_env_var 1113s "10.7", 1113s # cli_setup_args 1113s [], 1113s # keyword_cmake_args 1113s [], 1113s # cli_cmake_args 1113s [], 1113s # expected_cmake_osx_deployment_target 1113s "10.7", 1113s ), 1113s ( 1113s # osx_deployment_target_env_var 1113s "10.7", 1113s # cli_setup_args 1113s ["--plat-name", "macosx-10.9-x86_64"], 1113s # keyword_cmake_args 1113s [], 1113s # cli_cmake_args 1113s [], 1113s # expected_cmake_osx_deployment_target 1113s "10.9", 1113s ), 1113s ( 1113s # osx_deployment_target_env_var 1113s None, 1113s # cli_setup_args 1113s ["--plat-name", "macosx-10.6-x86_64"], 1113s # keyword_cmake_args 1113s [], 1113s # cli_cmake_args 1113s [], 1113s # expected_cmake_osx_deployment_target 1113s "10.6", 1113s ), 1113s ( 1113s # osx_deployment_target_env_var 1113s None, 1113s # cli_setup_args 1113s ["--plat-name", "macosx-10.7-x86_64"], 1113s # keyword_cmake_args 1113s [], 1113s # cli_cmake_args 1113s [], 1113s # expected_cmake_osx_deployment_target 1113s "10.7", 1113s ), 1113s ( 1113s # osx_deployment_target_env_var 1113s None, 1113s # cli_setup_args 1113s [], 1113s # keyword_cmake_args 1113s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 1113s # cli_cmake_args 1113s [], 1113s # expected_cmake_osx_deployment_target 1113s "10.7", 1113s ), 1113s ( 1113s # osx_deployment_target_env_var 1113s None, 1113s # cli_setup_args 1113s ["--plat-name", "macosx-10.12-x86_64"], 1113s # keyword_cmake_args 1113s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 1113s # cli_cmake_args 1113s [], 1113s # expected_cmake_osx_deployment_target 1113s "10.7", 1113s ), 1113s ( 1113s # osx_deployment_target_env_var 1113s None, 1113s # cli_setup_args 1113s [], 1113s # keyword_cmake_args 1113s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 1113s # cli_cmake_args 1113s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 1113s # expected_cmake_osx_deployment_target 1113s "10.8", 1113s ), 1113s ( 1113s # osx_deployment_target_env_var 1113s None, 1113s # cli_setup_args 1113s ["--plat-name", "macosx-10.12-x86_64"], 1113s # keyword_cmake_args 1113s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 1113s # cli_cmake_args 1113s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 1113s # expected_cmake_osx_deployment_target 1113s "10.8", 1113s ), 1113s ], 1113s ) 1113s def test_cmake_args_keyword_osx_default( 1113s osx_deployment_target_env_var, 1113s cli_setup_args, 1113s keyword_cmake_args, 1113s cli_cmake_args, 1113s expected_cmake_osx_deployment_target, 1113s mocker, 1113s monkeypatch, 1113s ): 1113s tmp_dir = _tmpdir("cmake_args_keyword_osx_default") 1113s 1113s tmp_dir.join("setup.py").write( 1113s textwrap.dedent( 1113s """ 1113s from skbuild import setup 1113s setup( 1113s name="test_cmake_args_keyword_osx_default", 1113s version="1.2.3", 1113s description="A minimal example package", 1113s author="The scikit-build team", 1113s license="MIT", 1113s cmake_args=[{cmake_args}] 1113s ) 1113s """.format(cmake_args=",".join([f"'{arg}'" for arg in keyword_cmake_args])) 1113s ) 1113s ) 1113s tmp_dir.join("CMakeLists.txt").write( 1113s textwrap.dedent( 1113s """ 1113s message(FATAL_ERROR "This error message should not be displayed") 1113s """ 1113s ) 1113s ) 1113s 1113s mock_configure = mocker.patch("skbuild.cmaker.CMaker.configure", side_effect=RuntimeError("exit skbuild")) 1113s 1113s monkeypatch.setattr(platform, "mac_ver", lambda: ("10.9", None, "x84_64")) 1113s monkeypatch.setattr(platform, "machine", lambda: "x86_64") 1113s monkeypatch.setattr(sys, "platform", "darwin") 1113s 1113s with push_env(MACOSX_DEPLOYMENT_TARGET=osx_deployment_target_env_var): 1113s monkeypatch.setattr(skbuild.constants, "_SKBUILD_PLAT_NAME", skbuild.constants._default_skbuild_plat_name()) 1113s with pytest.raises(RuntimeError, match="exit skbuild"): 1113s > with execute_setup_py(tmp_dir, ["build", *cli_setup_args, "--", *cli_cmake_args]): 1113s 1113s cli_cmake_args = [] 1113s cli_setup_args = [] 1113s expected_cmake_osx_deployment_target = '10.7' 1113s keyword_cmake_args = ['-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7'] 1113s mock_configure = 1113s mocker = 1113s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0xf72624167680> 1113s osx_deployment_target_env_var = None 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-57/cmake_args_keyword_osx_default0') 1113s 1113s tests/test_issue342_cmake_osx_args_in_setup.py:176: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-57/cmake_args_keyword_osx_default0') 1113s setup_args = ['build', '--'], disable_languages_test = False 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = False 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-57/cmake_args_keyword_osx_default0') 1113s setup_args = ['build', '--'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s _ test_cmake_args_keyword_osx_default[None-cli_setup_args6-keyword_cmake_args6-cli_cmake_args6-10.7] _ 1113s 1113s osx_deployment_target_env_var = None 1113s cli_setup_args = ['--plat-name', 'macosx-10.12-x86_64'] 1113s keyword_cmake_args = ['-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7'] 1113s cli_cmake_args = [], expected_cmake_osx_deployment_target = '10.7' 1113s mocker = 1113s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0xf726241705f0> 1113s 1113s @pytest.mark.parametrize( 1113s params, 1113s [ 1113s # default plat_name is 'macosx-10.9-x86_64' 1113s ( 1113s # osx_deployment_target_env_var 1113s None, 1113s # cli_setup_args 1113s [], 1113s # keyword_cmake_args 1113s [], 1113s # cli_cmake_args 1113s [], 1113s # expected_cmake_osx_deployment_target 1113s "10.9", 1113s ), 1113s ( 1113s # osx_deployment_target_env_var 1113s "10.7", 1113s # cli_setup_args 1113s [], 1113s # keyword_cmake_args 1113s [], 1113s # cli_cmake_args 1113s [], 1113s # expected_cmake_osx_deployment_target 1113s "10.7", 1113s ), 1113s ( 1113s # osx_deployment_target_env_var 1113s "10.7", 1113s # cli_setup_args 1113s ["--plat-name", "macosx-10.9-x86_64"], 1113s # keyword_cmake_args 1113s [], 1113s # cli_cmake_args 1113s [], 1113s # expected_cmake_osx_deployment_target 1113s "10.9", 1113s ), 1113s ( 1113s # osx_deployment_target_env_var 1113s None, 1113s # cli_setup_args 1113s ["--plat-name", "macosx-10.6-x86_64"], 1113s # keyword_cmake_args 1113s [], 1113s # cli_cmake_args 1113s [], 1113s # expected_cmake_osx_deployment_target 1113s "10.6", 1113s ), 1113s ( 1113s # osx_deployment_target_env_var 1113s None, 1113s # cli_setup_args 1113s ["--plat-name", "macosx-10.7-x86_64"], 1113s # keyword_cmake_args 1113s [], 1113s # cli_cmake_args 1113s [], 1113s # expected_cmake_osx_deployment_target 1113s "10.7", 1113s ), 1113s ( 1113s # osx_deployment_target_env_var 1113s None, 1113s # cli_setup_args 1113s [], 1113s # keyword_cmake_args 1113s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 1113s # cli_cmake_args 1113s [], 1113s # expected_cmake_osx_deployment_target 1113s "10.7", 1113s ), 1113s ( 1113s # osx_deployment_target_env_var 1113s None, 1113s # cli_setup_args 1113s ["--plat-name", "macosx-10.12-x86_64"], 1113s # keyword_cmake_args 1113s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 1113s # cli_cmake_args 1113s [], 1113s # expected_cmake_osx_deployment_target 1113s "10.7", 1113s ), 1113s ( 1113s # osx_deployment_target_env_var 1113s None, 1113s # cli_setup_args 1113s [], 1113s # keyword_cmake_args 1113s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 1113s # cli_cmake_args 1113s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 1113s # expected_cmake_osx_deployment_target 1113s "10.8", 1113s ), 1113s ( 1113s # osx_deployment_target_env_var 1113s None, 1113s # cli_setup_args 1113s ["--plat-name", "macosx-10.12-x86_64"], 1113s # keyword_cmake_args 1113s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 1113s # cli_cmake_args 1113s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 1113s # expected_cmake_osx_deployment_target 1113s "10.8", 1113s ), 1113s ], 1113s ) 1113s def test_cmake_args_keyword_osx_default( 1113s osx_deployment_target_env_var, 1113s cli_setup_args, 1113s keyword_cmake_args, 1113s cli_cmake_args, 1113s expected_cmake_osx_deployment_target, 1113s mocker, 1113s monkeypatch, 1113s ): 1113s tmp_dir = _tmpdir("cmake_args_keyword_osx_default") 1113s 1113s tmp_dir.join("setup.py").write( 1113s textwrap.dedent( 1113s """ 1113s from skbuild import setup 1113s setup( 1113s name="test_cmake_args_keyword_osx_default", 1113s version="1.2.3", 1113s description="A minimal example package", 1113s author="The scikit-build team", 1113s license="MIT", 1113s cmake_args=[{cmake_args}] 1113s ) 1113s """.format(cmake_args=",".join([f"'{arg}'" for arg in keyword_cmake_args])) 1113s ) 1113s ) 1113s tmp_dir.join("CMakeLists.txt").write( 1113s textwrap.dedent( 1113s """ 1113s message(FATAL_ERROR "This error message should not be displayed") 1113s """ 1113s ) 1113s ) 1113s 1113s mock_configure = mocker.patch("skbuild.cmaker.CMaker.configure", side_effect=RuntimeError("exit skbuild")) 1113s 1113s monkeypatch.setattr(platform, "mac_ver", lambda: ("10.9", None, "x84_64")) 1113s monkeypatch.setattr(platform, "machine", lambda: "x86_64") 1113s monkeypatch.setattr(sys, "platform", "darwin") 1113s 1113s with push_env(MACOSX_DEPLOYMENT_TARGET=osx_deployment_target_env_var): 1113s monkeypatch.setattr(skbuild.constants, "_SKBUILD_PLAT_NAME", skbuild.constants._default_skbuild_plat_name()) 1113s with pytest.raises(RuntimeError, match="exit skbuild"): 1113s > with execute_setup_py(tmp_dir, ["build", *cli_setup_args, "--", *cli_cmake_args]): 1113s 1113s cli_cmake_args = [] 1113s cli_setup_args = ['--plat-name', 'macosx-10.12-x86_64'] 1113s expected_cmake_osx_deployment_target = '10.7' 1113s keyword_cmake_args = ['-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7'] 1113s mock_configure = 1113s mocker = 1113s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0xf726241705f0> 1113s osx_deployment_target_env_var = None 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-58/cmake_args_keyword_osx_default0') 1113s 1113s tests/test_issue342_cmake_osx_args_in_setup.py:176: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-58/cmake_args_keyword_osx_default0') 1113s setup_args = ['build', '--plat-name', 'macosx-10.12-x86_64', '--'] 1113s disable_languages_test = False 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = False 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-58/cmake_args_keyword_osx_default0') 1113s setup_args = ['build', '--plat-name', 'macosx-10.12-x86_64', '--'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s _ test_cmake_args_keyword_osx_default[None-cli_setup_args7-keyword_cmake_args7-cli_cmake_args7-10.8] _ 1113s 1113s osx_deployment_target_env_var = None, cli_setup_args = [] 1113s keyword_cmake_args = ['-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7'] 1113s cli_cmake_args = ['-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8'] 1113s expected_cmake_osx_deployment_target = '10.8' 1113s mocker = 1113s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0xf72624203650> 1113s 1113s @pytest.mark.parametrize( 1113s params, 1113s [ 1113s # default plat_name is 'macosx-10.9-x86_64' 1113s ( 1113s # osx_deployment_target_env_var 1113s None, 1113s # cli_setup_args 1113s [], 1113s # keyword_cmake_args 1113s [], 1113s # cli_cmake_args 1113s [], 1113s # expected_cmake_osx_deployment_target 1113s "10.9", 1113s ), 1113s ( 1113s # osx_deployment_target_env_var 1113s "10.7", 1113s # cli_setup_args 1113s [], 1113s # keyword_cmake_args 1113s [], 1113s # cli_cmake_args 1113s [], 1113s # expected_cmake_osx_deployment_target 1113s "10.7", 1113s ), 1113s ( 1113s # osx_deployment_target_env_var 1113s "10.7", 1113s # cli_setup_args 1113s ["--plat-name", "macosx-10.9-x86_64"], 1113s # keyword_cmake_args 1113s [], 1113s # cli_cmake_args 1113s [], 1113s # expected_cmake_osx_deployment_target 1113s "10.9", 1113s ), 1113s ( 1113s # osx_deployment_target_env_var 1113s None, 1113s # cli_setup_args 1113s ["--plat-name", "macosx-10.6-x86_64"], 1113s # keyword_cmake_args 1113s [], 1113s # cli_cmake_args 1113s [], 1113s # expected_cmake_osx_deployment_target 1113s "10.6", 1113s ), 1113s ( 1113s # osx_deployment_target_env_var 1113s None, 1113s # cli_setup_args 1113s ["--plat-name", "macosx-10.7-x86_64"], 1113s # keyword_cmake_args 1113s [], 1113s # cli_cmake_args 1113s [], 1113s # expected_cmake_osx_deployment_target 1113s "10.7", 1113s ), 1113s ( 1113s # osx_deployment_target_env_var 1113s None, 1113s # cli_setup_args 1113s [], 1113s # keyword_cmake_args 1113s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 1113s # cli_cmake_args 1113s [], 1113s # expected_cmake_osx_deployment_target 1113s "10.7", 1113s ), 1113s ( 1113s # osx_deployment_target_env_var 1113s None, 1113s # cli_setup_args 1113s ["--plat-name", "macosx-10.12-x86_64"], 1113s # keyword_cmake_args 1113s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 1113s # cli_cmake_args 1113s [], 1113s # expected_cmake_osx_deployment_target 1113s "10.7", 1113s ), 1113s ( 1113s # osx_deployment_target_env_var 1113s None, 1113s # cli_setup_args 1113s [], 1113s # keyword_cmake_args 1113s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 1113s # cli_cmake_args 1113s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 1113s # expected_cmake_osx_deployment_target 1113s "10.8", 1113s ), 1113s ( 1113s # osx_deployment_target_env_var 1113s None, 1113s # cli_setup_args 1113s ["--plat-name", "macosx-10.12-x86_64"], 1113s # keyword_cmake_args 1113s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 1113s # cli_cmake_args 1113s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 1113s # expected_cmake_osx_deployment_target 1113s "10.8", 1113s ), 1113s ], 1113s ) 1113s def test_cmake_args_keyword_osx_default( 1113s osx_deployment_target_env_var, 1113s cli_setup_args, 1113s keyword_cmake_args, 1113s cli_cmake_args, 1113s expected_cmake_osx_deployment_target, 1113s mocker, 1113s monkeypatch, 1113s ): 1113s tmp_dir = _tmpdir("cmake_args_keyword_osx_default") 1113s 1113s tmp_dir.join("setup.py").write( 1113s textwrap.dedent( 1113s """ 1113s from skbuild import setup 1113s setup( 1113s name="test_cmake_args_keyword_osx_default", 1113s version="1.2.3", 1113s description="A minimal example package", 1113s author="The scikit-build team", 1113s license="MIT", 1113s cmake_args=[{cmake_args}] 1113s ) 1113s """.format(cmake_args=",".join([f"'{arg}'" for arg in keyword_cmake_args])) 1113s ) 1113s ) 1113s tmp_dir.join("CMakeLists.txt").write( 1113s textwrap.dedent( 1113s """ 1113s message(FATAL_ERROR "This error message should not be displayed") 1113s """ 1113s ) 1113s ) 1113s 1113s mock_configure = mocker.patch("skbuild.cmaker.CMaker.configure", side_effect=RuntimeError("exit skbuild")) 1113s 1113s monkeypatch.setattr(platform, "mac_ver", lambda: ("10.9", None, "x84_64")) 1113s monkeypatch.setattr(platform, "machine", lambda: "x86_64") 1113s monkeypatch.setattr(sys, "platform", "darwin") 1113s 1113s with push_env(MACOSX_DEPLOYMENT_TARGET=osx_deployment_target_env_var): 1113s monkeypatch.setattr(skbuild.constants, "_SKBUILD_PLAT_NAME", skbuild.constants._default_skbuild_plat_name()) 1113s with pytest.raises(RuntimeError, match="exit skbuild"): 1113s > with execute_setup_py(tmp_dir, ["build", *cli_setup_args, "--", *cli_cmake_args]): 1113s 1113s cli_cmake_args = ['-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8'] 1113s cli_setup_args = [] 1113s expected_cmake_osx_deployment_target = '10.8' 1113s keyword_cmake_args = ['-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7'] 1113s mock_configure = 1113s mocker = 1113s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0xf72624203650> 1113s osx_deployment_target_env_var = None 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-59/cmake_args_keyword_osx_default0') 1113s 1113s tests/test_issue342_cmake_osx_args_in_setup.py:176: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-59/cmake_args_keyword_osx_default0') 1113s setup_args = ['build', '--', '-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8'] 1113s disable_languages_test = False 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = False 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-59/cmake_args_keyword_osx_default0') 1113s setup_args = ['build', '--', '-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s _ test_cmake_args_keyword_osx_default[None-cli_setup_args8-keyword_cmake_args8-cli_cmake_args8-10.8] _ 1113s 1113s osx_deployment_target_env_var = None 1113s cli_setup_args = ['--plat-name', 'macosx-10.12-x86_64'] 1113s keyword_cmake_args = ['-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7'] 1113s cli_cmake_args = ['-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8'] 1113s expected_cmake_osx_deployment_target = '10.8' 1113s mocker = 1113s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0xf726242a2a80> 1113s 1113s @pytest.mark.parametrize( 1113s params, 1113s [ 1113s # default plat_name is 'macosx-10.9-x86_64' 1113s ( 1113s # osx_deployment_target_env_var 1113s None, 1113s # cli_setup_args 1113s [], 1113s # keyword_cmake_args 1113s [], 1113s # cli_cmake_args 1113s [], 1113s # expected_cmake_osx_deployment_target 1113s "10.9", 1113s ), 1113s ( 1113s # osx_deployment_target_env_var 1113s "10.7", 1113s # cli_setup_args 1113s [], 1113s # keyword_cmake_args 1113s [], 1113s # cli_cmake_args 1113s [], 1113s # expected_cmake_osx_deployment_target 1113s "10.7", 1113s ), 1113s ( 1113s # osx_deployment_target_env_var 1113s "10.7", 1113s # cli_setup_args 1113s ["--plat-name", "macosx-10.9-x86_64"], 1113s # keyword_cmake_args 1113s [], 1113s # cli_cmake_args 1113s [], 1113s # expected_cmake_osx_deployment_target 1113s "10.9", 1113s ), 1113s ( 1113s # osx_deployment_target_env_var 1113s None, 1113s # cli_setup_args 1113s ["--plat-name", "macosx-10.6-x86_64"], 1113s # keyword_cmake_args 1113s [], 1113s # cli_cmake_args 1113s [], 1113s # expected_cmake_osx_deployment_target 1113s "10.6", 1113s ), 1113s ( 1113s # osx_deployment_target_env_var 1113s None, 1113s # cli_setup_args 1113s ["--plat-name", "macosx-10.7-x86_64"], 1113s # keyword_cmake_args 1113s [], 1113s # cli_cmake_args 1113s [], 1113s # expected_cmake_osx_deployment_target 1113s "10.7", 1113s ), 1113s ( 1113s # osx_deployment_target_env_var 1113s None, 1113s # cli_setup_args 1113s [], 1113s # keyword_cmake_args 1113s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 1113s # cli_cmake_args 1113s [], 1113s # expected_cmake_osx_deployment_target 1113s "10.7", 1113s ), 1113s ( 1113s # osx_deployment_target_env_var 1113s None, 1113s # cli_setup_args 1113s ["--plat-name", "macosx-10.12-x86_64"], 1113s # keyword_cmake_args 1113s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 1113s # cli_cmake_args 1113s [], 1113s # expected_cmake_osx_deployment_target 1113s "10.7", 1113s ), 1113s ( 1113s # osx_deployment_target_env_var 1113s None, 1113s # cli_setup_args 1113s [], 1113s # keyword_cmake_args 1113s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 1113s # cli_cmake_args 1113s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 1113s # expected_cmake_osx_deployment_target 1113s "10.8", 1113s ), 1113s ( 1113s # osx_deployment_target_env_var 1113s None, 1113s # cli_setup_args 1113s ["--plat-name", "macosx-10.12-x86_64"], 1113s # keyword_cmake_args 1113s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 1113s # cli_cmake_args 1113s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 1113s # expected_cmake_osx_deployment_target 1113s "10.8", 1113s ), 1113s ], 1113s ) 1113s def test_cmake_args_keyword_osx_default( 1113s osx_deployment_target_env_var, 1113s cli_setup_args, 1113s keyword_cmake_args, 1113s cli_cmake_args, 1113s expected_cmake_osx_deployment_target, 1113s mocker, 1113s monkeypatch, 1113s ): 1113s tmp_dir = _tmpdir("cmake_args_keyword_osx_default") 1113s 1113s tmp_dir.join("setup.py").write( 1113s textwrap.dedent( 1113s """ 1113s from skbuild import setup 1113s setup( 1113s name="test_cmake_args_keyword_osx_default", 1113s version="1.2.3", 1113s description="A minimal example package", 1113s author="The scikit-build team", 1113s license="MIT", 1113s cmake_args=[{cmake_args}] 1113s ) 1113s """.format(cmake_args=",".join([f"'{arg}'" for arg in keyword_cmake_args])) 1113s ) 1113s ) 1113s tmp_dir.join("CMakeLists.txt").write( 1113s textwrap.dedent( 1113s """ 1113s message(FATAL_ERROR "This error message should not be displayed") 1113s """ 1113s ) 1113s ) 1113s 1113s mock_configure = mocker.patch("skbuild.cmaker.CMaker.configure", side_effect=RuntimeError("exit skbuild")) 1113s 1113s monkeypatch.setattr(platform, "mac_ver", lambda: ("10.9", None, "x84_64")) 1113s monkeypatch.setattr(platform, "machine", lambda: "x86_64") 1113s monkeypatch.setattr(sys, "platform", "darwin") 1113s 1113s with push_env(MACOSX_DEPLOYMENT_TARGET=osx_deployment_target_env_var): 1113s monkeypatch.setattr(skbuild.constants, "_SKBUILD_PLAT_NAME", skbuild.constants._default_skbuild_plat_name()) 1113s with pytest.raises(RuntimeError, match="exit skbuild"): 1113s > with execute_setup_py(tmp_dir, ["build", *cli_setup_args, "--", *cli_cmake_args]): 1113s 1113s cli_cmake_args = ['-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8'] 1113s cli_setup_args = ['--plat-name', 'macosx-10.12-x86_64'] 1113s expected_cmake_osx_deployment_target = '10.8' 1113s keyword_cmake_args = ['-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7'] 1113s mock_configure = 1113s mocker = 1113s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0xf726242a2a80> 1113s osx_deployment_target_env_var = None 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-60/cmake_args_keyword_osx_default0') 1113s 1113s tests/test_issue342_cmake_osx_args_in_setup.py:176: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-60/cmake_args_keyword_osx_default0') 1113s setup_args = ['build', '--plat-name', 'macosx-10.12-x86_64', '--', '-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8'] 1113s disable_languages_test = False 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = False 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-60/cmake_args_keyword_osx_default0') 1113s setup_args = ['build', '--plat-name', 'macosx-10.12-x86_64', '--', '-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ____________________ test_isolated_env_trigger_reconfigure _____________________ 1113s 1113s mocker = 1113s 1113s def test_isolated_env_trigger_reconfigure(mocker): 1113s tmp_dir = _tmpdir("isolated_env_trigger_reconfigure") 1113s 1113s tmp_dir.join("setup.py").write( 1113s textwrap.dedent( 1113s """ 1113s from skbuild import setup 1113s setup( 1113s name="test_isolated_env_trigger_reconfigure", 1113s version="1.2.3", 1113s description="A minimal example package", 1113s author="The scikit-build team", 1113s license="MIT", 1113s ) 1113s """ 1113s ) 1113s ) 1113s tmp_dir.join("CMakeLists.txt").write( 1113s textwrap.dedent( 1113s """ 1113s message(FATAL_ERROR "This error message should not be displayed") 1113s """ 1113s ) 1113s ) 1113s 1113s # 1113s # mock configure 1113s # 1113s def fake_configure(*args, **kwargs): 1113s # Simulate a successful configuration creating a CMakeCache.txt 1113s tmp_dir.ensure(CMAKE_BUILD_DIR(), dir=1).join("CMakeCache.txt").write( 1113s textwrap.dedent( 1113s """ 1113s //Name of generator. 1113s CMAKE_GENERATOR:INTERNAL=Ninja 1113s """ 1113s ) 1113s ) 1113s 1113s # Skip real configuration creating the CMakeCache.txt expected by 1113s # "skbuild.setuptools_wrap._load_cmake_spec()" function 1113s mocker.patch("skbuild.cmaker.CMaker.configure", new=fake_configure) 1113s 1113s # 1113s # mock _save_cmake_spec 1113s # 1113s _save_cmake_spec_original = skbuild.setuptools_wrap._save_cmake_spec 1113s 1113s exit_after_saving_cmake_spec = "exit skbuild saving cmake spec" 1113s 1113s def _save_cmake_spec_mock(args): 1113s _save_cmake_spec_original(args) 1113s raise RuntimeError(exit_after_saving_cmake_spec) 1113s 1113s mocker.patch("skbuild.setuptools_wrap._save_cmake_spec", new=_save_cmake_spec_mock) 1113s 1113s # 1113s # mock make 1113s # 1113s exit_before_running_cmake = "exit skbuild running make" 1113s mocker.patch("skbuild.cmaker.CMaker.make", side_effect=RuntimeError(exit_before_running_cmake)) 1113s 1113s # first build: "configure" and "_save_cmake_spec" are expected to be called 1113s with pytest.raises(RuntimeError, match=exit_after_saving_cmake_spec): 1113s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 1113s 1113s _save_cmake_spec_mock = ._save_cmake_spec_mock at 0xf72624160f40> 1113s _save_cmake_spec_original = 1113s exit_after_saving_cmake_spec = 'exit skbuild saving cmake spec' 1113s exit_before_running_cmake = 'exit skbuild running make' 1113s fake_configure = .fake_configure at 0xf72624160680> 1113s mocker = 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-61/isolated_env_trigger_reconfigu0') 1113s 1113s tests/test_issue352_isolated_environment_support.py:78: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-61/isolated_env_trigger_reconfigu0') 1113s setup_args = ['build'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-61/isolated_env_trigger_reconfigu0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s __________________________ test_symbol_visibility[ON] __________________________ 1113s 1113s skip_override = 'ON' 1113s 1113s @pytest.mark.skipif( 1113s platform.system().lower() not in ["linux"], reason="Executable and Linkable Format (ELF) is specific to Linux" 1113s ) 1113s @pytest.mark.parametrize("skip_override", ["ON", "OFF"]) 1113s def test_symbol_visibility(skip_override): 1113s with push_dir(): 1113s tmp_dir = _tmpdir("test_issue668_symbol_visibility") 1113s project = "issue-668-symbol-visibility" 1113s prepare_project(project, tmp_dir) 1113s initialize_git_repo_and_commit(tmp_dir, verbose=True) 1113s 1113s > with execute_setup_py( 1113s tmp_dir, ["build", f"-DSKBUILD_GNU_SKIP_LOCAL_SYMBOL_EXPORT_OVERRIDE:BOOL={skip_override}"] 1113s ): 1113s 1113s project = 'issue-668-symbol-visibility' 1113s skip_override = 'ON' 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-62/test_issue668_symbol_visibilit0') 1113s 1113s tests/test_issue668_symbol_visibility.py:32: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-62/test_issue668_symbol_visibilit0') 1113s setup_args = ['build', '-DSKBUILD_GNU_SKIP_LOCAL_SYMBOL_EXPORT_OVERRIDE:BOOL=ON'] 1113s disable_languages_test = False 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = False 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-62/test_issue668_symbol_visibilit0') 1113s setup_args = ['build', '-DSKBUILD_GNU_SKIP_LOCAL_SYMBOL_EXPORT_OVERRIDE:BOOL=ON'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ----------------------------- Captured stdout call ----------------------------- 1113s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-62/test_issue668_symbol_visibilit0/.git/ 1113s [master (root-commit) 3c9a4fd] Initial commit 1113s 5 files changed, 121 insertions(+) 1113s create mode 100644 CMakeLists.txt 1113s create mode 100644 hello/__init__.py 1113s create mode 100644 hello/_hello.cxx 1113s create mode 100644 pyproject.toml 1113s create mode 100644 setup.py 1113s ----------------------------- Captured stderr call ----------------------------- 1113s hint: Using 'master' as the name for the initial branch. This default branch name 1113s hint: is subject to change. To configure the initial branch name to use in all 1113s hint: of your new repositories, which will suppress this warning, call: 1113s hint: 1113s hint: git config --global init.defaultBranch 1113s hint: 1113s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 1113s hint: 'development'. The just-created branch can be renamed via this command: 1113s hint: 1113s hint: git branch -m 1113s _________________________ test_symbol_visibility[OFF] __________________________ 1113s 1113s skip_override = 'OFF' 1113s 1113s @pytest.mark.skipif( 1113s platform.system().lower() not in ["linux"], reason="Executable and Linkable Format (ELF) is specific to Linux" 1113s ) 1113s @pytest.mark.parametrize("skip_override", ["ON", "OFF"]) 1113s def test_symbol_visibility(skip_override): 1113s with push_dir(): 1113s tmp_dir = _tmpdir("test_issue668_symbol_visibility") 1113s project = "issue-668-symbol-visibility" 1113s prepare_project(project, tmp_dir) 1113s initialize_git_repo_and_commit(tmp_dir, verbose=True) 1113s 1113s > with execute_setup_py( 1113s tmp_dir, ["build", f"-DSKBUILD_GNU_SKIP_LOCAL_SYMBOL_EXPORT_OVERRIDE:BOOL={skip_override}"] 1113s ): 1113s 1113s project = 'issue-668-symbol-visibility' 1113s skip_override = 'OFF' 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-63/test_issue668_symbol_visibilit0') 1113s 1113s tests/test_issue668_symbol_visibility.py:32: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-63/test_issue668_symbol_visibilit0') 1113s setup_args = ['build', '-DSKBUILD_GNU_SKIP_LOCAL_SYMBOL_EXPORT_OVERRIDE:BOOL=OFF'] 1113s disable_languages_test = False 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = False 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-63/test_issue668_symbol_visibilit0') 1113s setup_args = ['build', '-DSKBUILD_GNU_SKIP_LOCAL_SYMBOL_EXPORT_OVERRIDE:BOOL=OFF'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ----------------------------- Captured stdout call ----------------------------- 1113s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-63/test_issue668_symbol_visibilit0/.git/ 1113s [master (root-commit) 3c9a4fd] Initial commit 1113s 5 files changed, 121 insertions(+) 1113s create mode 100644 CMakeLists.txt 1113s create mode 100644 hello/__init__.py 1113s create mode 100644 hello/_hello.cxx 1113s create mode 100644 pyproject.toml 1113s create mode 100644 setup.py 1113s ----------------------------- Captured stderr call ----------------------------- 1113s hint: Using 'master' as the name for the initial branch. This default branch name 1113s hint: is subject to change. To configure the initial branch name to use in all 1113s hint: of your new repositories, which will suppress this warning, call: 1113s hint: 1113s hint: git config --global init.defaultBranch 1113s hint: 1113s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 1113s hint: 'development'. The just-created branch can be renamed via this command: 1113s hint: 1113s hint: git branch -m 1113s ____________________________ test_manifest_in_wheel ____________________________ 1113s 1113s iargs = (), ikwargs = {} 1113s 1113s @functools.wraps(fun) 1113s def wrapped(*iargs, **ikwargs): 1113s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 1113s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 1113s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 1113s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 1113s 1113s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 1113s 1113s disable_languages_test = True 1113s fun = 1113s iargs = () 1113s ikwargs = {} 1113s ret = False 1113s wrapped = 1113s 1113s tests/__init__.py:255: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-64/test_manifest_in_wheel0') 1113s setup_args = ['bdist_wheel'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-64/test_manifest_in_wheel0') 1113s setup_args = ['bdist_wheel'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ----------------------------- Captured stdout call ----------------------------- 1113s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-64/test_manifest_in_wheel0/.git/ 1113s [master (root-commit) 8800e1c] Initial commit 1113s 4 files changed, 14 insertions(+) 1113s create mode 100644 MANIFEST.in 1113s create mode 100644 hello/__init__.py 1113s create mode 100644 not_included.txt 1113s create mode 100644 setup.py 1113s ----------------------------- Captured stderr call ----------------------------- 1113s hint: Using 'master' as the name for the initial branch. This default branch name 1113s hint: is subject to change. To configure the initial branch name to use in all 1113s hint: of your new repositories, which will suppress this warning, call: 1113s hint: 1113s hint: git config --global init.defaultBranch 1113s hint: 1113s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 1113s hint: 'development'. The just-created branch can be renamed via this command: 1113s hint: 1113s hint: git branch -m 1113s ____________________ test_outside_project_root_fails[None] _____________________ 1113s 1113s option = None 1113s 1113s @pytest.mark.parametrize("option", [None, "-DINSTALL_FILE:BOOL=1", "-DINSTALL_PROJECT:BOOL=1"]) 1113s def test_outside_project_root_fails(option): 1113s with push_dir(): 1113s expected_failure = False 1113s 1113s cmd = ["install"] 1113s if option is not None: 1113s expected_failure = True 1113s cmd.extend(["--", option]) 1113s 1113s @project_setup_py_test("fail-outside-project-root", cmd, disable_languages_test=True) 1113s def should_fail(): 1113s pass 1113s 1113s failed = False 1113s msg = "" 1113s try: 1113s > should_fail() 1113s 1113s cmd = ['install'] 1113s expected_failure = False 1113s failed = False 1113s msg = '' 1113s option = None 1113s should_fail = .should_fail at 0xf72624161300> 1113s 1113s tests/test_outside_project_root.py:36: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s tests/__init__.py:255: in wrapped 1113s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 1113s disable_languages_test = True 1113s fun = .should_fail at 0xf72624160860> 1113s iargs = () 1113s ikwargs = {} 1113s ret = False 1113s wrapped = .should_fail at 0xf72624161300> 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-65/should_fail0') 1113s setup_args = ['install'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-65/should_fail0') 1113s setup_args = ['install'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ----------------------------- Captured stdout call ----------------------------- 1113s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-65/should_fail0/.git/ 1113s [master (root-commit) 7df97b1] Initial commit 1113s 4 files changed, 51 insertions(+) 1113s create mode 100644 CMakeLists.txt 1113s create mode 100644 dummy 1113s create mode 100644 other_project/CMakeLists.txt 1113s create mode 100644 setup.py 1113s ----------------------------- Captured stderr call ----------------------------- 1113s hint: Using 'master' as the name for the initial branch. This default branch name 1113s hint: is subject to change. To configure the initial branch name to use in all 1113s hint: of your new repositories, which will suppress this warning, call: 1113s hint: 1113s hint: git config --global init.defaultBranch 1113s hint: 1113s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 1113s hint: 'development'. The just-created branch can be renamed via this command: 1113s hint: 1113s hint: git branch -m 1113s ____________ test_outside_project_root_fails[-DINSTALL_FILE:BOOL=1] ____________ 1113s 1113s option = '-DINSTALL_FILE:BOOL=1' 1113s 1113s @pytest.mark.parametrize("option", [None, "-DINSTALL_FILE:BOOL=1", "-DINSTALL_PROJECT:BOOL=1"]) 1113s def test_outside_project_root_fails(option): 1113s with push_dir(): 1113s expected_failure = False 1113s 1113s cmd = ["install"] 1113s if option is not None: 1113s expected_failure = True 1113s cmd.extend(["--", option]) 1113s 1113s @project_setup_py_test("fail-outside-project-root", cmd, disable_languages_test=True) 1113s def should_fail(): 1113s pass 1113s 1113s failed = False 1113s msg = "" 1113s try: 1113s > should_fail() 1113s 1113s cmd = ['install', '--', '-DINSTALL_FILE:BOOL=1'] 1113s expected_failure = True 1113s failed = False 1113s msg = '' 1113s option = '-DINSTALL_FILE:BOOL=1' 1113s should_fail = .should_fail at 0xf72624160d60> 1113s 1113s tests/test_outside_project_root.py:36: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s tests/__init__.py:255: in wrapped 1113s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 1113s disable_languages_test = True 1113s fun = .should_fail at 0xf72624160cc0> 1113s iargs = () 1113s ikwargs = {} 1113s ret = False 1113s wrapped = .should_fail at 0xf72624160d60> 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-66/should_fail0') 1113s setup_args = ['install', '--', '-DINSTALL_FILE:BOOL=1'] 1113s disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-66/should_fail0') 1113s setup_args = ['install', '--', '-DINSTALL_FILE:BOOL=1'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ----------------------------- Captured stdout call ----------------------------- 1113s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-66/should_fail0/.git/ 1113s [master (root-commit) 7df97b1] Initial commit 1113s 4 files changed, 51 insertions(+) 1113s create mode 100644 CMakeLists.txt 1113s create mode 100644 dummy 1113s create mode 100644 other_project/CMakeLists.txt 1113s create mode 100644 setup.py 1113s ----------------------------- Captured stderr call ----------------------------- 1113s hint: Using 'master' as the name for the initial branch. This default branch name 1113s hint: is subject to change. To configure the initial branch name to use in all 1113s hint: of your new repositories, which will suppress this warning, call: 1113s hint: 1113s hint: git config --global init.defaultBranch 1113s hint: 1113s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 1113s hint: 'development'. The just-created branch can be renamed via this command: 1113s hint: 1113s hint: git branch -m 1113s __________ test_outside_project_root_fails[-DINSTALL_PROJECT:BOOL=1] ___________ 1113s 1113s option = '-DINSTALL_PROJECT:BOOL=1' 1113s 1113s @pytest.mark.parametrize("option", [None, "-DINSTALL_FILE:BOOL=1", "-DINSTALL_PROJECT:BOOL=1"]) 1113s def test_outside_project_root_fails(option): 1113s with push_dir(): 1113s expected_failure = False 1113s 1113s cmd = ["install"] 1113s if option is not None: 1113s expected_failure = True 1113s cmd.extend(["--", option]) 1113s 1113s @project_setup_py_test("fail-outside-project-root", cmd, disable_languages_test=True) 1113s def should_fail(): 1113s pass 1113s 1113s failed = False 1113s msg = "" 1113s try: 1113s > should_fail() 1113s 1113s cmd = ['install', '--', '-DINSTALL_PROJECT:BOOL=1'] 1113s expected_failure = True 1113s failed = False 1113s msg = '' 1113s option = '-DINSTALL_PROJECT:BOOL=1' 1113s should_fail = .should_fail at 0xf726241622a0> 1113s 1113s tests/test_outside_project_root.py:36: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s tests/__init__.py:255: in wrapped 1113s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 1113s disable_languages_test = True 1113s fun = .should_fail at 0xf726241620c0> 1113s iargs = () 1113s ikwargs = {} 1113s ret = False 1113s wrapped = .should_fail at 0xf726241622a0> 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-67/should_fail0') 1113s setup_args = ['install', '--', '-DINSTALL_PROJECT:BOOL=1'] 1113s disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-67/should_fail0') 1113s setup_args = ['install', '--', '-DINSTALL_PROJECT:BOOL=1'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ----------------------------- Captured stdout call ----------------------------- 1113s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-67/should_fail0/.git/ 1113s [master (root-commit) 7df97b1] Initial commit 1113s 4 files changed, 51 insertions(+) 1113s create mode 100644 CMakeLists.txt 1113s create mode 100644 dummy 1113s create mode 100644 other_project/CMakeLists.txt 1113s create mode 100644 setup.py 1113s ----------------------------- Captured stderr call ----------------------------- 1113s hint: Using 'master' as the name for the initial branch. This default branch name 1113s hint: is subject to change. To configure the initial branch name to use in all 1113s hint: of your new repositories, which will suppress this warning, call: 1113s hint: 1113s hint: git config --global init.defaultBranch 1113s hint: 1113s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 1113s hint: 'development'. The just-created branch can be renamed via this command: 1113s hint: 1113s hint: git branch -m 1113s _____________________ test_cmake_args_keyword[cmake_args0] _____________________ 1113s 1113s cmake_args = [] 1113s capfd = <_pytest.capture.CaptureFixture object at 0xf7262414d4f0> 1113s 1113s @pytest.mark.parametrize("cmake_args", [[], ["--", "-DVAR:STRING=43", "-DVAR_WITH_SPACE:STRING=Ciao Mondo"]]) 1113s def test_cmake_args_keyword(cmake_args, capfd): 1113s tmp_dir = _tmpdir("cmake_args_keyword") 1113s 1113s tmp_dir.join("setup.py").write( 1113s textwrap.dedent( 1113s """ 1113s from skbuild import setup 1113s setup( 1113s name="test_cmake_args_keyword", 1113s version="1.2.3", 1113s description="a minimal example package", 1113s author='The scikit-build team', 1113s license="MIT", 1113s cmake_args=[ 1113s "-DVAR:STRING=42", 1113s "-DVAR_WITH_SPACE:STRING=Hello World" 1113s ] 1113s 1113s ) 1113s """ 1113s ) 1113s ) 1113s tmp_dir.join("CMakeLists.txt").write( 1113s textwrap.dedent( 1113s """ 1113s cmake_minimum_required(VERSION 3.5.0) 1113s project(test NONE) 1113s message(STATUS "VAR[${VAR}]") 1113s message(STATUS "VAR_WITH_SPACE[${VAR_WITH_SPACE}]") 1113s install(CODE "execute_process( 1113s COMMAND \\${CMAKE_COMMAND} -E sleep 0)") 1113s """ 1113s ) 1113s ) 1113s 1113s > with execute_setup_py(tmp_dir, ["build", *cmake_args], disable_languages_test=True): 1113s 1113s capfd = <_pytest.capture.CaptureFixture object at 0xf7262414d4f0> 1113s cmake_args = [] 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-68/cmake_args_keyword0') 1113s 1113s tests/test_setup.py:127: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-68/cmake_args_keyword0') 1113s setup_args = ['build'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-68/cmake_args_keyword0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s _____________________ test_cmake_args_keyword[cmake_args1] _____________________ 1113s 1113s cmake_args = ['--', '-DVAR:STRING=43', '-DVAR_WITH_SPACE:STRING=Ciao Mondo'] 1113s capfd = <_pytest.capture.CaptureFixture object at 0xf72624066810> 1113s 1113s @pytest.mark.parametrize("cmake_args", [[], ["--", "-DVAR:STRING=43", "-DVAR_WITH_SPACE:STRING=Ciao Mondo"]]) 1113s def test_cmake_args_keyword(cmake_args, capfd): 1113s tmp_dir = _tmpdir("cmake_args_keyword") 1113s 1113s tmp_dir.join("setup.py").write( 1113s textwrap.dedent( 1113s """ 1113s from skbuild import setup 1113s setup( 1113s name="test_cmake_args_keyword", 1113s version="1.2.3", 1113s description="a minimal example package", 1113s author='The scikit-build team', 1113s license="MIT", 1113s cmake_args=[ 1113s "-DVAR:STRING=42", 1113s "-DVAR_WITH_SPACE:STRING=Hello World" 1113s ] 1113s 1113s ) 1113s """ 1113s ) 1113s ) 1113s tmp_dir.join("CMakeLists.txt").write( 1113s textwrap.dedent( 1113s """ 1113s cmake_minimum_required(VERSION 3.5.0) 1113s project(test NONE) 1113s message(STATUS "VAR[${VAR}]") 1113s message(STATUS "VAR_WITH_SPACE[${VAR_WITH_SPACE}]") 1113s install(CODE "execute_process( 1113s COMMAND \\${CMAKE_COMMAND} -E sleep 0)") 1113s """ 1113s ) 1113s ) 1113s 1113s > with execute_setup_py(tmp_dir, ["build", *cmake_args], disable_languages_test=True): 1113s 1113s capfd = <_pytest.capture.CaptureFixture object at 0xf72624066810> 1113s cmake_args = ['--', '-DVAR:STRING=43', '-DVAR_WITH_SPACE:STRING=Ciao Mondo'] 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-69/cmake_args_keyword0') 1113s 1113s tests/test_setup.py:127: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-69/cmake_args_keyword0') 1113s setup_args = ['build', '--', '-DVAR:STRING=43', '-DVAR_WITH_SPACE:STRING=Ciao Mondo'] 1113s disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-69/cmake_args_keyword0') 1113s setup_args = ['build', '--', '-DVAR:STRING=43', '-DVAR_WITH_SPACE:STRING=Ciao Mondo'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ________________ test_cmake_install_dir_keyword[None-True-str] _________________ 1113s 1113s cmake_install_dir = None, expected_failed = True 1113s error_code_type = 1113s capsys = <_pytest.capture.CaptureFixture object at 0xf7262414e570> 1113s caplog = <_pytest.logging.LogCaptureFixture object at 0xf7262418e3c0> 1113s 1113s @pytest.mark.parametrize( 1113s ("cmake_install_dir", "expected_failed", "error_code_type"), 1113s [ 1113s (None, True, str), 1113s ("", True, str), 1113s (str(py.path.local.get_temproot().join("scikit-build")), True, SKBuildError), 1113s ("banana", False, str), 1113s ], 1113s ) 1113s def test_cmake_install_dir_keyword(cmake_install_dir, expected_failed, error_code_type, capsys, caplog): 1113s # ------------------------------------------------------------------------- 1113s # "SOURCE" tree layout: 1113s # 1113s # ROOT/ 1113s # 1113s # CMakeLists.txt 1113s # setup.py 1113s # 1113s # apple/ 1113s # __init__.py 1113s # 1113s # ------------------------------------------------------------------------- 1113s # "BINARY" distribution layout 1113s # 1113s # ROOT/ 1113s # 1113s # apple/ 1113s # __init__.py 1113s # 1113s 1113s tmp_dir = _tmpdir("cmake_install_dir_keyword") 1113s 1113s setup_kwarg = "" 1113s if cmake_install_dir is not None: 1113s setup_kwarg = f"cmake_install_dir={str(cmake_install_dir)!r}" 1113s 1113s tmp_dir.join("setup.py").write( 1113s textwrap.dedent( 1113s f""" 1113s from skbuild import setup 1113s setup( 1113s name="test_cmake_install_dir", 1113s version="1.2.3", 1113s description="a package testing use of cmake_install_dir", 1113s author='The scikit-build team', 1113s license="MIT", 1113s packages=['apple', 'banana'], 1113s {setup_kwarg} 1113s ) 1113s """ 1113s ) 1113s ) 1113s 1113s # Install location purposely set to "." so that we can test 1113s # usage of "cmake_install_dir" skbuild.setup keyword. 1113s tmp_dir.join("CMakeLists.txt").write( 1113s textwrap.dedent( 1113s """ 1113s cmake_minimum_required(VERSION 3.5.0) 1113s project(banana NONE) 1113s file(WRITE "${CMAKE_BINARY_DIR}/__init__.py" "") 1113s install(FILES "${CMAKE_BINARY_DIR}/__init__.py" DESTINATION ".") 1113s """ 1113s ) 1113s ) 1113s 1113s tmp_dir.ensure("apple", "__init__.py") 1113s 1113s failed = False 1113s message = "" 1113s try: 1113s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 1113s 1113s caplog = <_pytest.logging.LogCaptureFixture object at 0xf7262418e3c0> 1113s capsys = <_pytest.capture.CaptureFixture object at 0xf7262414e570> 1113s cmake_install_dir = None 1113s error_code_type = 1113s expected_failed = True 1113s failed = False 1113s message = '' 1113s setup_kwarg = '' 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-70/cmake_install_dir_keyword0') 1113s 1113s tests/test_setup.py:211: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-70/cmake_install_dir_keyword0') 1113s setup_args = ['build'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-70/cmake_install_dir_keyword0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s __________________ test_cmake_install_dir_keyword[-True-str] ___________________ 1113s 1113s cmake_install_dir = '', expected_failed = True, error_code_type = 1113s capsys = <_pytest.capture.CaptureFixture object at 0xf72624065b50> 1113s caplog = <_pytest.logging.LogCaptureFixture object at 0xf726240663f0> 1113s 1113s @pytest.mark.parametrize( 1113s ("cmake_install_dir", "expected_failed", "error_code_type"), 1113s [ 1113s (None, True, str), 1113s ("", True, str), 1113s (str(py.path.local.get_temproot().join("scikit-build")), True, SKBuildError), 1113s ("banana", False, str), 1113s ], 1113s ) 1113s def test_cmake_install_dir_keyword(cmake_install_dir, expected_failed, error_code_type, capsys, caplog): 1113s # ------------------------------------------------------------------------- 1113s # "SOURCE" tree layout: 1113s # 1113s # ROOT/ 1113s # 1113s # CMakeLists.txt 1113s # setup.py 1113s # 1113s # apple/ 1113s # __init__.py 1113s # 1113s # ------------------------------------------------------------------------- 1113s # "BINARY" distribution layout 1113s # 1113s # ROOT/ 1113s # 1113s # apple/ 1113s # __init__.py 1113s # 1113s 1113s tmp_dir = _tmpdir("cmake_install_dir_keyword") 1113s 1113s setup_kwarg = "" 1113s if cmake_install_dir is not None: 1113s setup_kwarg = f"cmake_install_dir={str(cmake_install_dir)!r}" 1113s 1113s tmp_dir.join("setup.py").write( 1113s textwrap.dedent( 1113s f""" 1113s from skbuild import setup 1113s setup( 1113s name="test_cmake_install_dir", 1113s version="1.2.3", 1113s description="a package testing use of cmake_install_dir", 1113s author='The scikit-build team', 1113s license="MIT", 1113s packages=['apple', 'banana'], 1113s {setup_kwarg} 1113s ) 1113s """ 1113s ) 1113s ) 1113s 1113s # Install location purposely set to "." so that we can test 1113s # usage of "cmake_install_dir" skbuild.setup keyword. 1113s tmp_dir.join("CMakeLists.txt").write( 1113s textwrap.dedent( 1113s """ 1113s cmake_minimum_required(VERSION 3.5.0) 1113s project(banana NONE) 1113s file(WRITE "${CMAKE_BINARY_DIR}/__init__.py" "") 1113s install(FILES "${CMAKE_BINARY_DIR}/__init__.py" DESTINATION ".") 1113s """ 1113s ) 1113s ) 1113s 1113s tmp_dir.ensure("apple", "__init__.py") 1113s 1113s failed = False 1113s message = "" 1113s try: 1113s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 1113s 1113s caplog = <_pytest.logging.LogCaptureFixture object at 0xf726240663f0> 1113s capsys = <_pytest.capture.CaptureFixture object at 0xf72624065b50> 1113s cmake_install_dir = '' 1113s error_code_type = 1113s expected_failed = True 1113s failed = False 1113s message = '' 1113s setup_kwarg = "cmake_install_dir=''" 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-71/cmake_install_dir_keyword0') 1113s 1113s tests/test_setup.py:211: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-71/cmake_install_dir_keyword0') 1113s setup_args = ['build'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-71/cmake_install_dir_keyword0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s _____ test_cmake_install_dir_keyword[/tmp/scikit-build-True-SKBuildError] ______ 1113s 1113s cmake_install_dir = '/tmp/scikit-build', expected_failed = True 1113s error_code_type = 1113s capsys = <_pytest.capture.CaptureFixture object at 0xf72624066a80> 1113s caplog = <_pytest.logging.LogCaptureFixture object at 0xf72624066210> 1113s 1113s @pytest.mark.parametrize( 1113s ("cmake_install_dir", "expected_failed", "error_code_type"), 1113s [ 1113s (None, True, str), 1113s ("", True, str), 1113s (str(py.path.local.get_temproot().join("scikit-build")), True, SKBuildError), 1113s ("banana", False, str), 1113s ], 1113s ) 1113s def test_cmake_install_dir_keyword(cmake_install_dir, expected_failed, error_code_type, capsys, caplog): 1113s # ------------------------------------------------------------------------- 1113s # "SOURCE" tree layout: 1113s # 1113s # ROOT/ 1113s # 1113s # CMakeLists.txt 1113s # setup.py 1113s # 1113s # apple/ 1113s # __init__.py 1113s # 1113s # ------------------------------------------------------------------------- 1113s # "BINARY" distribution layout 1113s # 1113s # ROOT/ 1113s # 1113s # apple/ 1113s # __init__.py 1113s # 1113s 1113s tmp_dir = _tmpdir("cmake_install_dir_keyword") 1113s 1113s setup_kwarg = "" 1113s if cmake_install_dir is not None: 1113s setup_kwarg = f"cmake_install_dir={str(cmake_install_dir)!r}" 1113s 1113s tmp_dir.join("setup.py").write( 1113s textwrap.dedent( 1113s f""" 1113s from skbuild import setup 1113s setup( 1113s name="test_cmake_install_dir", 1113s version="1.2.3", 1113s description="a package testing use of cmake_install_dir", 1113s author='The scikit-build team', 1113s license="MIT", 1113s packages=['apple', 'banana'], 1113s {setup_kwarg} 1113s ) 1113s """ 1113s ) 1113s ) 1113s 1113s # Install location purposely set to "." so that we can test 1113s # usage of "cmake_install_dir" skbuild.setup keyword. 1113s tmp_dir.join("CMakeLists.txt").write( 1113s textwrap.dedent( 1113s """ 1113s cmake_minimum_required(VERSION 3.5.0) 1113s project(banana NONE) 1113s file(WRITE "${CMAKE_BINARY_DIR}/__init__.py" "") 1113s install(FILES "${CMAKE_BINARY_DIR}/__init__.py" DESTINATION ".") 1113s """ 1113s ) 1113s ) 1113s 1113s tmp_dir.ensure("apple", "__init__.py") 1113s 1113s failed = False 1113s message = "" 1113s try: 1113s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 1113s 1113s caplog = <_pytest.logging.LogCaptureFixture object at 0xf72624066210> 1113s capsys = <_pytest.capture.CaptureFixture object at 0xf72624066a80> 1113s cmake_install_dir = '/tmp/scikit-build' 1113s error_code_type = 1113s expected_failed = True 1113s failed = False 1113s message = '' 1113s setup_kwarg = "cmake_install_dir='/tmp/scikit-build'" 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-72/cmake_install_dir_keyword0') 1113s 1113s tests/test_setup.py:211: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-72/cmake_install_dir_keyword0') 1113s setup_args = ['build'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-72/cmake_install_dir_keyword0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s _______________ test_cmake_install_dir_keyword[banana-False-str] _______________ 1113s 1113s cmake_install_dir = 'banana', expected_failed = False 1113s error_code_type = 1113s capsys = <_pytest.capture.CaptureFixture object at 0xf72624067320> 1113s caplog = <_pytest.logging.LogCaptureFixture object at 0xf72624065f70> 1113s 1113s @pytest.mark.parametrize( 1113s ("cmake_install_dir", "expected_failed", "error_code_type"), 1113s [ 1113s (None, True, str), 1113s ("", True, str), 1113s (str(py.path.local.get_temproot().join("scikit-build")), True, SKBuildError), 1113s ("banana", False, str), 1113s ], 1113s ) 1113s def test_cmake_install_dir_keyword(cmake_install_dir, expected_failed, error_code_type, capsys, caplog): 1113s # ------------------------------------------------------------------------- 1113s # "SOURCE" tree layout: 1113s # 1113s # ROOT/ 1113s # 1113s # CMakeLists.txt 1113s # setup.py 1113s # 1113s # apple/ 1113s # __init__.py 1113s # 1113s # ------------------------------------------------------------------------- 1113s # "BINARY" distribution layout 1113s # 1113s # ROOT/ 1113s # 1113s # apple/ 1113s # __init__.py 1113s # 1113s 1113s tmp_dir = _tmpdir("cmake_install_dir_keyword") 1113s 1113s setup_kwarg = "" 1113s if cmake_install_dir is not None: 1113s setup_kwarg = f"cmake_install_dir={str(cmake_install_dir)!r}" 1113s 1113s tmp_dir.join("setup.py").write( 1113s textwrap.dedent( 1113s f""" 1113s from skbuild import setup 1113s setup( 1113s name="test_cmake_install_dir", 1113s version="1.2.3", 1113s description="a package testing use of cmake_install_dir", 1113s author='The scikit-build team', 1113s license="MIT", 1113s packages=['apple', 'banana'], 1113s {setup_kwarg} 1113s ) 1113s """ 1113s ) 1113s ) 1113s 1113s # Install location purposely set to "." so that we can test 1113s # usage of "cmake_install_dir" skbuild.setup keyword. 1113s tmp_dir.join("CMakeLists.txt").write( 1113s textwrap.dedent( 1113s """ 1113s cmake_minimum_required(VERSION 3.5.0) 1113s project(banana NONE) 1113s file(WRITE "${CMAKE_BINARY_DIR}/__init__.py" "") 1113s install(FILES "${CMAKE_BINARY_DIR}/__init__.py" DESTINATION ".") 1113s """ 1113s ) 1113s ) 1113s 1113s tmp_dir.ensure("apple", "__init__.py") 1113s 1113s failed = False 1113s message = "" 1113s try: 1113s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 1113s 1113s caplog = <_pytest.logging.LogCaptureFixture object at 0xf72624065f70> 1113s capsys = <_pytest.capture.CaptureFixture object at 0xf72624067320> 1113s cmake_install_dir = 'banana' 1113s error_code_type = 1113s expected_failed = False 1113s failed = False 1113s message = '' 1113s setup_kwarg = "cmake_install_dir='banana'" 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-73/cmake_install_dir_keyword0') 1113s 1113s tests/test_setup.py:211: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-73/cmake_install_dir_keyword0') 1113s setup_args = ['build'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-73/cmake_install_dir_keyword0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s _____________________ test_cmake_with_sdist_keyword[True] ______________________ 1113s 1113s cmake_with_sdist = True 1113s capfd = <_pytest.capture.CaptureFixture object at 0xf72624064bc0> 1113s 1113s @pytest.mark.parametrize("cmake_with_sdist", [True, False]) 1113s def test_cmake_with_sdist_keyword(cmake_with_sdist, capfd): 1113s tmp_dir = _tmpdir("cmake_with_sdist") 1113s 1113s tmp_dir.join("setup.py").write( 1113s textwrap.dedent( 1113s f""" 1113s from skbuild import setup 1113s setup( 1113s name="cmake_with_sdist_keyword", 1113s version="1.2.3", 1113s description="a minimal example package", 1113s author='The scikit-build team', 1113s license="MIT", 1113s cmake_with_sdist={cmake_with_sdist} 1113s ) 1113s """ 1113s ) 1113s ) 1113s tmp_dir.join("CMakeLists.txt").write( 1113s textwrap.dedent( 1113s """ 1113s cmake_minimum_required(VERSION 3.5.0) 1113s project(test NONE) 1113s install(CODE "execute_process( 1113s COMMAND \\${CMAKE_COMMAND} -E sleep 0)") 1113s """ 1113s ) 1113s ) 1113s 1113s initialize_git_repo_and_commit(tmp_dir) 1113s 1113s > with execute_setup_py(tmp_dir, ["sdist"], disable_languages_test=True): 1113s 1113s capfd = <_pytest.capture.CaptureFixture object at 0xf72624064bc0> 1113s cmake_with_sdist = True 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-74/cmake_with_sdist0') 1113s 1113s tests/test_setup.py:267: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-74/cmake_with_sdist0') 1113s setup_args = ['sdist'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-74/cmake_with_sdist0') 1113s setup_args = ['sdist'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ----------------------------- Captured stdout call ----------------------------- 1113s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-74/cmake_with_sdist0/.git/ 1113s [master (root-commit) 1491b5f] Initial commit 1113s 2 files changed, 15 insertions(+) 1113s create mode 100644 CMakeLists.txt 1113s create mode 100644 setup.py 1113s ----------------------------- Captured stderr call ----------------------------- 1113s hint: Using 'master' as the name for the initial branch. This default branch name 1113s hint: is subject to change. To configure the initial branch name to use in all 1113s hint: of your new repositories, which will suppress this warning, call: 1113s hint: 1113s hint: git config --global init.defaultBranch 1113s hint: 1113s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 1113s hint: 'development'. The just-created branch can be renamed via this command: 1113s hint: 1113s hint: git branch -m 1113s _____________________ test_cmake_with_sdist_keyword[False] _____________________ 1113s 1113s cmake_with_sdist = False 1113s capfd = <_pytest.capture.CaptureFixture object at 0xf72624066f00> 1113s 1113s @pytest.mark.parametrize("cmake_with_sdist", [True, False]) 1113s def test_cmake_with_sdist_keyword(cmake_with_sdist, capfd): 1113s tmp_dir = _tmpdir("cmake_with_sdist") 1113s 1113s tmp_dir.join("setup.py").write( 1113s textwrap.dedent( 1113s f""" 1113s from skbuild import setup 1113s setup( 1113s name="cmake_with_sdist_keyword", 1113s version="1.2.3", 1113s description="a minimal example package", 1113s author='The scikit-build team', 1113s license="MIT", 1113s cmake_with_sdist={cmake_with_sdist} 1113s ) 1113s """ 1113s ) 1113s ) 1113s tmp_dir.join("CMakeLists.txt").write( 1113s textwrap.dedent( 1113s """ 1113s cmake_minimum_required(VERSION 3.5.0) 1113s project(test NONE) 1113s install(CODE "execute_process( 1113s COMMAND \\${CMAKE_COMMAND} -E sleep 0)") 1113s """ 1113s ) 1113s ) 1113s 1113s initialize_git_repo_and_commit(tmp_dir) 1113s 1113s > with execute_setup_py(tmp_dir, ["sdist"], disable_languages_test=True): 1113s 1113s capfd = <_pytest.capture.CaptureFixture object at 0xf72624066f00> 1113s cmake_with_sdist = False 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-75/cmake_with_sdist0') 1113s 1113s tests/test_setup.py:267: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-75/cmake_with_sdist0') 1113s setup_args = ['sdist'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-75/cmake_with_sdist0') 1113s setup_args = ['sdist'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ----------------------------- Captured stdout call ----------------------------- 1113s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-75/cmake_with_sdist0/.git/ 1113s [master (root-commit) 7fbde5d] Initial commit 1113s 2 files changed, 15 insertions(+) 1113s create mode 100644 CMakeLists.txt 1113s create mode 100644 setup.py 1113s ----------------------------- Captured stderr call ----------------------------- 1113s hint: Using 'master' as the name for the initial branch. This default branch name 1113s hint: is subject to change. To configure the initial branch name to use in all 1113s hint: of your new repositories, which will suppress this warning, call: 1113s hint: 1113s hint: git config --global init.defaultBranch 1113s hint: 1113s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 1113s hint: 'development'. The just-created branch can be renamed via this command: 1113s hint: 1113s hint: git branch -m 1113s _________________ test_cmake_minimum_required_version_keyword __________________ 1113s 1113s def test_cmake_minimum_required_version_keyword(): 1113s tmp_dir = _tmpdir("cmake_minimum_required_version") 1113s 1113s tmp_dir.join("setup.py").write( 1113s textwrap.dedent( 1113s """ 1113s from skbuild import setup 1113s setup( 1113s name="cmake_with_sdist_keyword", 1113s version="1.2.3", 1113s description="a minimal example package", 1113s author='The scikit-build team', 1113s license="MIT", 1113s cmake_minimum_required_version='99.98.97' 1113s ) 1113s """ 1113s ) 1113s ) 1113s tmp_dir.join("CMakeLists.txt").write( 1113s textwrap.dedent( 1113s """ 1113s cmake_minimum_required(VERSION 3.5.0) 1113s project(test NONE) 1113s install(CODE "execute_process( 1113s COMMAND \\${CMAKE_COMMAND} -E sleep 0)") 1113s """ 1113s ) 1113s ) 1113s 1113s try: 1113s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 1113s 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-76/cmake_minimum_required_version0') 1113s 1113s tests/test_setup.py:308: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-76/cmake_minimum_required_version0') 1113s setup_args = ['build'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-76/cmake_minimum_required_version0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s __________________ test_setup_requires_keyword_include_cmake ___________________ 1113s 1113s mocker = 1113s capsys = <_pytest.capture.CaptureFixture object at 0xf7262414d220> 1113s 1113s @pytest.mark.deprecated() 1113s @pytest.mark.filterwarnings("ignore:setuptools.installer is deprecated:Warning") 1113s @pytest.mark.skipif( 1113s os.environ.get("CONDA_BUILD", "0") == "1", 1113s reason="running tests expecting network connection in Conda is not possible. " 1113s "See https://github.com/conda/conda/issues/508", 1113s ) 1113s @pytest.mark.skipif(not is_site_reachable("https://pypi.org/simple/cmake/"), reason="pypi.org website not reachable") 1113s @pytest.mark.xfail( 1113s sys.platform.startswith("cygwin"), strict=False, reason="Cygwin needs a release of scikit-build first" 1113s ) 1113s def test_setup_requires_keyword_include_cmake(mocker, capsys): 1113s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 1113s 1113s tmp_dir = _tmpdir("setup_requires_keyword_include_cmake") 1113s 1113s setup_requires = ["cmake>=3.10"] 1113s 1113s tmp_dir.join("setup.py").write( 1113s textwrap.dedent( 1113s """ 1113s from skbuild import setup 1113s setup( 1113s name="cmake_with_sdist_keyword", 1113s version="1.2.3", 1113s description="a minimal example package", 1113s author='The scikit-build team', 1113s license="MIT", 1113s setup_requires=[{setup_requires}] 1113s ) 1113s """.format(setup_requires=",".join([f"'{package}'" for package in setup_requires])) 1113s ) 1113s ) 1113s tmp_dir.join("CMakeLists.txt").write( 1113s textwrap.dedent( 1113s """ 1113s cmake_minimum_required(VERSION 3.5.0) 1113s project(test NONE) 1113s install(CODE "execute_process( 1113s COMMAND \\${CMAKE_COMMAND} -E sleep 0)") 1113s """ 1113s ) 1113s ) 1113s 1113s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 1113s 1113s capsys = <_pytest.capture.CaptureFixture object at 0xf7262414d220> 1113s mock_setup = 1113s mocker = 1113s setup_requires = ['cmake>=3.10'] 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-77/setup_requires_keyword_include0') 1113s 1113s tests/test_setup.py:363: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-77/setup_requires_keyword_include0') 1113s setup_args = ['build'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-77/setup_requires_keyword_include0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s __________________________ test_script_keyword[pure] ___________________________ 1113s 1113s distribution_type = 'pure' 1113s capsys = <_pytest.capture.CaptureFixture object at 0xf7262418cb90> 1113s caplog = <_pytest.logging.LogCaptureFixture object at 0xf7262418c410> 1113s 1113s @pytest.mark.parametrize("distribution_type", ["pure", "skbuild"]) 1113s def test_script_keyword(distribution_type, capsys, caplog): 1113s # ------------------------------------------------------------------------- 1113s # 1113s # "SOURCE" tree layout for "pure" distribution: 1113s # 1113s # ROOT/ 1113s # setup.py 1113s # foo.py 1113s # bar.py 1113s # 1113s # "SOURCE" tree layout for "pure" distribution: 1113s # 1113s # ROOT/ 1113s # setup.py 1113s # CMakeLists.txt 1113s # 1113s # ------------------------------------------------------------------------- 1113s # "BINARY" distribution layout is identical for both 1113s # 1113s # ROOT/ 1113s # foo.py 1113s # bar.py 1113s # 1113s 1113s tmp_dir = _tmpdir("script_keyword") 1113s 1113s tmp_dir.join("setup.py").write( 1113s textwrap.dedent( 1113s """ 1113s from skbuild import setup 1113s setup( 1113s name="test_script_keyword", 1113s version="1.2.3", 1113s description="a package testing use of script keyword", 1113s author='The scikit-build team', 1113s license="MIT", 1113s scripts=['foo.py', 'bar.py'], 1113s packages=[], 1113s ) 1113s """ 1113s ) 1113s ) 1113s 1113s if distribution_type == "skbuild": 1113s tmp_dir.join("CMakeLists.txt").write( 1113s textwrap.dedent( 1113s """ 1113s cmake_minimum_required(VERSION 3.5.0) 1113s project(foo NONE) 1113s file(WRITE "${CMAKE_BINARY_DIR}/foo.py" "# foo.py") 1113s file(WRITE "${CMAKE_BINARY_DIR}/bar.py" "# bar.py") 1113s install( 1113s FILES 1113s "${CMAKE_BINARY_DIR}/foo.py" 1113s "${CMAKE_BINARY_DIR}/bar.py" 1113s DESTINATION "." 1113s ) 1113s """ 1113s ) 1113s ) 1113s 1113s messages = [ 1113s f"copying {CMAKE_INSTALL_DIR()}/{module}.py -> {SKBUILD_DIR()}/setuptools/scripts-" 1113s for module in ["foo", "bar"] 1113s ] 1113s 1113s elif distribution_type == "pure": 1113s tmp_dir.join("foo.py").write("# foo.py") 1113s tmp_dir.join("bar.py").write("# bar.py") 1113s 1113s messages = [f"copying {module}.py -> {SKBUILD_DIR()}/setuptools/scripts-" for module in ["foo", "bar"]] 1113s 1113s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 1113s 1113s caplog = <_pytest.logging.LogCaptureFixture object at 0xf7262418c410> 1113s capsys = <_pytest.capture.CaptureFixture object at 0xf7262418cb90> 1113s distribution_type = 'pure' 1113s messages = ['copying foo.py -> _skbuild/linux-aarch64-3.12/setuptools/scripts-', 'copying bar.py -> _skbuild/linux-aarch64-3.12/setuptools/scripts-'] 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-78/script_keyword0') 1113s 1113s tests/test_setup.py:448: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-78/script_keyword0') 1113s setup_args = ['build'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-78/script_keyword0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s _________________________ test_script_keyword[skbuild] _________________________ 1113s 1113s distribution_type = 'skbuild' 1113s capsys = <_pytest.capture.CaptureFixture object at 0xf72624260f50> 1113s caplog = <_pytest.logging.LogCaptureFixture object at 0xf72624263590> 1113s 1113s @pytest.mark.parametrize("distribution_type", ["pure", "skbuild"]) 1113s def test_script_keyword(distribution_type, capsys, caplog): 1113s # ------------------------------------------------------------------------- 1113s # 1113s # "SOURCE" tree layout for "pure" distribution: 1113s # 1113s # ROOT/ 1113s # setup.py 1113s # foo.py 1113s # bar.py 1113s # 1113s # "SOURCE" tree layout for "pure" distribution: 1113s # 1113s # ROOT/ 1113s # setup.py 1113s # CMakeLists.txt 1113s # 1113s # ------------------------------------------------------------------------- 1113s # "BINARY" distribution layout is identical for both 1113s # 1113s # ROOT/ 1113s # foo.py 1113s # bar.py 1113s # 1113s 1113s tmp_dir = _tmpdir("script_keyword") 1113s 1113s tmp_dir.join("setup.py").write( 1113s textwrap.dedent( 1113s """ 1113s from skbuild import setup 1113s setup( 1113s name="test_script_keyword", 1113s version="1.2.3", 1113s description="a package testing use of script keyword", 1113s author='The scikit-build team', 1113s license="MIT", 1113s scripts=['foo.py', 'bar.py'], 1113s packages=[], 1113s ) 1113s """ 1113s ) 1113s ) 1113s 1113s if distribution_type == "skbuild": 1113s tmp_dir.join("CMakeLists.txt").write( 1113s textwrap.dedent( 1113s """ 1113s cmake_minimum_required(VERSION 3.5.0) 1113s project(foo NONE) 1113s file(WRITE "${CMAKE_BINARY_DIR}/foo.py" "# foo.py") 1113s file(WRITE "${CMAKE_BINARY_DIR}/bar.py" "# bar.py") 1113s install( 1113s FILES 1113s "${CMAKE_BINARY_DIR}/foo.py" 1113s "${CMAKE_BINARY_DIR}/bar.py" 1113s DESTINATION "." 1113s ) 1113s """ 1113s ) 1113s ) 1113s 1113s messages = [ 1113s f"copying {CMAKE_INSTALL_DIR()}/{module}.py -> {SKBUILD_DIR()}/setuptools/scripts-" 1113s for module in ["foo", "bar"] 1113s ] 1113s 1113s elif distribution_type == "pure": 1113s tmp_dir.join("foo.py").write("# foo.py") 1113s tmp_dir.join("bar.py").write("# bar.py") 1113s 1113s messages = [f"copying {module}.py -> {SKBUILD_DIR()}/setuptools/scripts-" for module in ["foo", "bar"]] 1113s 1113s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 1113s 1113s caplog = <_pytest.logging.LogCaptureFixture object at 0xf72624263590> 1113s capsys = <_pytest.capture.CaptureFixture object at 0xf72624260f50> 1113s distribution_type = 'skbuild' 1113s messages = ['copying _skbuild/linux-aarch64-3.12/cmake-install/foo.py -> _skbuild/linux-aarch64-3.12/setuptools/scripts-', 'copying _skbuild/linux-aarch64-3.12/cmake-install/bar.py -> _skbuild/linux-aarch64-3.12/setuptools/scripts-'] 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-79/script_keyword0') 1113s 1113s tests/test_setup.py:448: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-79/script_keyword0') 1113s setup_args = ['build'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-79/script_keyword0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ________________________ test_py_modules_keyword[pure] _________________________ 1113s 1113s distribution_type = 'pure' 1113s capsys = <_pytest.capture.CaptureFixture object at 0xf7262414c230> 1113s caplog = <_pytest.logging.LogCaptureFixture object at 0xf7262414dcd0> 1113s 1113s @pytest.mark.parametrize("distribution_type", ["pure", "skbuild"]) 1113s def test_py_modules_keyword(distribution_type, capsys, caplog): 1113s # ------------------------------------------------------------------------- 1113s # 1113s # "SOURCE" tree layout for "pure" distribution: 1113s # 1113s # ROOT/ 1113s # setup.py 1113s # foo.py 1113s # bar.py 1113s # 1113s # "SOURCE" tree layout for "skbuild" distribution: 1113s # 1113s # ROOT/ 1113s # setup.py 1113s # CMakeLists.txt 1113s # 1113s # ------------------------------------------------------------------------- 1113s # "BINARY" distribution layout is identical for both 1113s # 1113s # ROOT/ 1113s # foo.py 1113s # bar.py 1113s # 1113s 1113s tmp_dir = _tmpdir("py_modules_keyword") 1113s 1113s tmp_dir.join("setup.py").write( 1113s textwrap.dedent( 1113s """ 1113s from skbuild import setup 1113s setup( 1113s name="test_py_modules_keyword", 1113s version="1.2.3", 1113s description="a package testing use of py_modules keyword", 1113s author='The scikit-build team', 1113s license="MIT", 1113s py_modules=['foo', 'bar'] 1113s ) 1113s """ 1113s ) 1113s ) 1113s 1113s if distribution_type == "skbuild": 1113s tmp_dir.join("CMakeLists.txt").write( 1113s textwrap.dedent( 1113s """ 1113s cmake_minimum_required(VERSION 3.5.0) 1113s project(foobar NONE) 1113s file(WRITE "${CMAKE_BINARY_DIR}/foo.py" "# foo.py") 1113s file(WRITE "${CMAKE_BINARY_DIR}/bar.py" "# bar.py") 1113s install( 1113s FILES 1113s "${CMAKE_BINARY_DIR}/foo.py" 1113s "${CMAKE_BINARY_DIR}/bar.py" 1113s DESTINATION "." 1113s ) 1113s """ 1113s ) 1113s ) 1113s 1113s messages = [ 1113s f"copying {CMAKE_INSTALL_DIR()}/{module}.py -> {SKBUILD_DIR()}/setuptools/lib" for module in ["foo", "bar"] 1113s ] 1113s 1113s elif distribution_type == "pure": 1113s tmp_dir.join("foo.py").write("# foo.py") 1113s tmp_dir.join("bar.py").write("# bar.py") 1113s 1113s messages = [f"copying {module}.py -> {SKBUILD_DIR()}/setuptools/lib" for module in ["foo", "bar"]] 1113s 1113s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 1113s 1113s caplog = <_pytest.logging.LogCaptureFixture object at 0xf7262414dcd0> 1113s capsys = <_pytest.capture.CaptureFixture object at 0xf7262414c230> 1113s distribution_type = 'pure' 1113s messages = ['copying foo.py -> _skbuild/linux-aarch64-3.12/setuptools/lib', 'copying bar.py -> _skbuild/linux-aarch64-3.12/setuptools/lib'] 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-80/py_modules_keyword0') 1113s 1113s tests/test_setup.py:528: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-80/py_modules_keyword0') 1113s setup_args = ['build'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-80/py_modules_keyword0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s _______________________ test_py_modules_keyword[skbuild] _______________________ 1113s 1113s distribution_type = 'skbuild' 1113s capsys = <_pytest.capture.CaptureFixture object at 0xf7262414d880> 1113s caplog = <_pytest.logging.LogCaptureFixture object at 0xf7262414fb30> 1113s 1113s @pytest.mark.parametrize("distribution_type", ["pure", "skbuild"]) 1113s def test_py_modules_keyword(distribution_type, capsys, caplog): 1113s # ------------------------------------------------------------------------- 1113s # 1113s # "SOURCE" tree layout for "pure" distribution: 1113s # 1113s # ROOT/ 1113s # setup.py 1113s # foo.py 1113s # bar.py 1113s # 1113s # "SOURCE" tree layout for "skbuild" distribution: 1113s # 1113s # ROOT/ 1113s # setup.py 1113s # CMakeLists.txt 1113s # 1113s # ------------------------------------------------------------------------- 1113s # "BINARY" distribution layout is identical for both 1113s # 1113s # ROOT/ 1113s # foo.py 1113s # bar.py 1113s # 1113s 1113s tmp_dir = _tmpdir("py_modules_keyword") 1113s 1113s tmp_dir.join("setup.py").write( 1113s textwrap.dedent( 1113s """ 1113s from skbuild import setup 1113s setup( 1113s name="test_py_modules_keyword", 1113s version="1.2.3", 1113s description="a package testing use of py_modules keyword", 1113s author='The scikit-build team', 1113s license="MIT", 1113s py_modules=['foo', 'bar'] 1113s ) 1113s """ 1113s ) 1113s ) 1113s 1113s if distribution_type == "skbuild": 1113s tmp_dir.join("CMakeLists.txt").write( 1113s textwrap.dedent( 1113s """ 1113s cmake_minimum_required(VERSION 3.5.0) 1113s project(foobar NONE) 1113s file(WRITE "${CMAKE_BINARY_DIR}/foo.py" "# foo.py") 1113s file(WRITE "${CMAKE_BINARY_DIR}/bar.py" "# bar.py") 1113s install( 1113s FILES 1113s "${CMAKE_BINARY_DIR}/foo.py" 1113s "${CMAKE_BINARY_DIR}/bar.py" 1113s DESTINATION "." 1113s ) 1113s """ 1113s ) 1113s ) 1113s 1113s messages = [ 1113s f"copying {CMAKE_INSTALL_DIR()}/{module}.py -> {SKBUILD_DIR()}/setuptools/lib" for module in ["foo", "bar"] 1113s ] 1113s 1113s elif distribution_type == "pure": 1113s tmp_dir.join("foo.py").write("# foo.py") 1113s tmp_dir.join("bar.py").write("# bar.py") 1113s 1113s messages = [f"copying {module}.py -> {SKBUILD_DIR()}/setuptools/lib" for module in ["foo", "bar"]] 1113s 1113s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 1113s 1113s caplog = <_pytest.logging.LogCaptureFixture object at 0xf7262414fb30> 1113s capsys = <_pytest.capture.CaptureFixture object at 0xf7262414d880> 1113s distribution_type = 'skbuild' 1113s messages = ['copying _skbuild/linux-aarch64-3.12/cmake-install/foo.py -> _skbuild/linux-aarch64-3.12/setuptools/lib', 'copying _skbuild/linux-aarch64-3.12/cmake-install/bar.py -> _skbuild/linux-aarch64-3.12/setuptools/lib'] 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-81/py_modules_keyword0') 1113s 1113s tests/test_setup.py:528: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-81/py_modules_keyword0') 1113s setup_args = ['build'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-81/py_modules_keyword0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ________________________ test_setup_inputs[0-0-0-0-0-0] ________________________ 1113s 1113s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 0 1113s has_pure_package = 0, has_pure_module = 0, with_package_base = 0 1113s mocker = 1113s 1113s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 1113s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 1113s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_module", [0, 1]) 1113s @pytest.mark.parametrize("with_package_base", [0, 1]) 1113s def test_setup_inputs( 1113s has_cmake_package, 1113s has_cmake_module, 1113s has_hybrid_package, 1113s has_pure_package, 1113s has_pure_module, 1113s with_package_base, 1113s mocker, 1113s ): 1113s """This test that a project can have a package with some modules 1113s installed using setup.py and some other modules installed using CMake. 1113s """ 1113s 1113s tmp_dir = _tmpdir("test_setup_inputs") 1113s 1113s package_base = "to/the/base" if with_package_base else "" 1113s package_base_dir = package_base + "/" if package_base else "" 1113s cmake_source_dir = package_base 1113s 1113s if cmake_source_dir and (has_cmake_package or has_cmake_module): 1113s pytest.skip( 1113s "unsupported configuration: " 1113s "python package fully generated by CMake does *NOT* work. " 1113s "At least __init__.py should be in the project source tree" 1113s ) 1113s 1113s # ------------------------------------------------------------------------- 1113s # Here is the "SOURCE" tree layout: 1113s # 1113s # ROOT/ 1113s # 1113s # setup.py 1113s # 1113s # [/] 1113s # 1113s # pureModule.py 1113s # 1113s # pure/ 1113s # __init__.py 1113s # pure.py 1113s # 1113s # data/ 1113s # pure.dat 1113s # 1113s # [/] 1113s # 1113s # hybrid/ 1113s # CMakeLists.txt 1113s # __init__.py 1113s # hybrid_pure.dat 1113s # hybrid_pure.py 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat 1113s # 1113s # hybrid_2/ 1113s # __init__.py 1113s # hybrid_2_pure.py 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py 1113s # hybrid_2_pure_1.py 1113s # hybrid_2_pure_2.py 1113s # 1113s # 1113s # ------------------------------------------------------------------------- 1113s # and here is the "BINARY" distribution layout: 1113s # 1113s # The comment "CMake" or "Setuptools" indicates which tool is responsible 1113s # for placing the file in the tree used to create the binary distribution. 1113s # 1113s # ROOT/ 1113s # 1113s # cmakeModule.py # CMake 1113s # 1113s # cmake/ 1113s # __init__.py # CMake 1113s # cmake.py # CMake 1113s # 1113s # hybrid/ 1113s # hybrid_cmake.dat # CMake 1113s # hybrid_cmake.py # CMake 1113s # hybrid_pure.dat # Setuptools 1113s # hybrid_pure.py # Setuptools 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat # CMake or Setuptools 1113s # hybrid_data_cmake.dat # CMake *NO TEST* 1113s # 1113s # hybrid_2/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure.py # CMake or Setuptools 1113s # hybrid_2_cmake.py # CMake 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure_1.py # CMake or Setuptools 1113s # hybrid_2_pure_2.py # CMake or Setuptools 1113s # 1113s # pureModule.py # Setuptools 1113s # 1113s # pure/ 1113s # __init__.py # Setuptools 1113s # pure.py # Setuptools 1113s # 1113s # data/ 1113s # pure.dat # Setuptools 1113s 1113s tmp_dir.join("setup.py").write( 1113s textwrap.dedent( 1113s """ 1113s from skbuild import setup 1113s #from setuptools import setup 1113s setup( 1113s name="test_hybrid_project", 1113s version="1.2.3", 1113s description=("an hybrid package mixing files installed by both " 1113s "CMake and setuptools"), 1113s author='The scikit-build team', 1113s license="MIT", 1113s cmake_source_dir='{cmake_source_dir}', 1113s cmake_install_dir='{cmake_install_dir}', 1113s # Arbitrary order of packages 1113s packages=[ 1113s {p_off} 'pure', 1113s {h_off} 'hybrid.hybrid_2', 1113s {h_off} 'hybrid', 1113s {c_off} 'cmake', 1113s {p_off} 'hybrid.hybrid_2_pure', 1113s ], 1113s py_modules=[ 1113s {pm_off} '{package_base}pureModule', 1113s {cm_off} '{package_base}cmakeModule', 1113s ], 1113s package_data={{ 1113s {p_off} 'pure': ['data/pure.dat'], 1113s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 1113s }}, 1113s # Arbitrary order of package_dir 1113s package_dir = {{ 1113s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 1113s {p_off} 'pure': '{package_base}pure', 1113s {h_off} 'hybrid': '{package_base}hybrid', 1113s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 1113s {c_off} 'cmake': '{package_base}cmake', 1113s }} 1113s ) 1113s """.format( 1113s cmake_source_dir=cmake_source_dir, 1113s cmake_install_dir=package_base, 1113s package_base=package_base_dir, 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s p_off="" if has_pure_package else "#", 1113s pm_off="" if has_pure_module else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s src_dir = tmp_dir.ensure(package_base, dir=1) 1113s 1113s src_dir.join("CMakeLists.txt").write( 1113s textwrap.dedent( 1113s """ 1113s cmake_minimum_required(VERSION 3.5.0) 1113s project(hybrid NONE) 1113s set(build_dir ${{CMAKE_BINARY_DIR}}) 1113s 1113s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 1113s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 1113s {c_off} install( 1113s {c_off} FILES 1113s {c_off} ${{build_dir}}/__init__.py 1113s {c_off} ${{build_dir}}/cmake.py 1113s {c_off} DESTINATION cmake 1113s {c_off} ) 1113s 1113s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 1113s {cm_off} install( 1113s {cm_off} FILES ${{build_dir}}/cmakeModule.py 1113s {cm_off} DESTINATION .) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 1113s {h_off} DESTINATION hybrid/data) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 1113s {h_off} DESTINATION hybrid/hybrid_2) 1113s 1113s install(CODE "message(STATUS \\\"Installation complete\\\")") 1113s """.format( 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 1113s path_types: Sequence[str] 1113s try: 1113s path_types = next( 1113s iter( 1113s zip( 1113s *filter( 1113s lambda i: i[1], 1113s [ 1113s ("c", has_cmake_package), 1113s ("cm", has_cmake_module), 1113s ("h", has_hybrid_package), 1113s ("p", has_pure_package), 1113s ("pm", has_pure_module), 1113s ], 1113s ) 1113s ) 1113s ) 1113s ) 1113s except StopIteration: 1113s path_types = [] 1113s 1113s def select_paths(annotated_paths): 1113s """Return a filtered list paths considering ``path_types``. 1113s 1113s `annotated_paths`` is list of tuple ``(type, path)`` where type 1113s is either `c`, 'cm', `h`, `p` or 'pm'. 1113s 1113s """ 1113s return filter(lambda i: i[0] in path_types, annotated_paths) 1113s 1113s # Commented paths are the one expected to be installed by CMake. For 1113s # this reason, corresponding files should NOT be created in the source 1113s # tree. 1113s for _type, path in select_paths( 1113s [ 1113s # ('c', 'cmake/__init__.py'), 1113s # ('c', 'cmake/cmake.py'), 1113s # ('cm', 'cmakeModule.py'), 1113s ("h", "hybrid/__init__.py"), 1113s # ('h', 'hybrid/hybrid_cmake.dat'), 1113s # ('h', 'hybrid/hybrid_cmake.py'), 1113s ("h", "hybrid/hybrid_pure.dat"), 1113s ("h", "hybrid/hybrid_pure.py"), 1113s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 1113s ("h", "hybrid/data/hybrid_data_pure.dat"), 1113s ("h", "hybrid/hybrid_2/__init__.py"), 1113s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 1113s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 1113s ("p", "hybrid/hybrid_2_pure/__init__.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 1113s ("pm", "pureModule.py"), 1113s ("p", "pure/__init__.py"), 1113s ("p", "pure/pure.py"), 1113s ("p", "pure/data/pure.dat"), 1113s ] 1113s ): 1113s assert _type in {"p", "pm", "h"} 1113s root = package_base if _type in {"p", "pm"} else cmake_source_dir 1113s tmp_dir.ensure(os.path.join(root, path)) 1113s 1113s # Do not call the real setup function. Instead, replace it with 1113s # a MagicMock allowing to check with which arguments it was invoked. 1113s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 1113s 1113s # Convenience print function 1113s def _pprint(desc, value=None): 1113s print( 1113s "-----------------\n" 1113s f"{desc}:\n" 1113s "\n" 1113s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 1113s ) 1113s 1113s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 1113s 1113s _pprint = ._pprint at 0xf726240f0180> 1113s cmake_source_dir = '' 1113s has_cmake_module = 0 1113s has_cmake_package = 0 1113s has_hybrid_package = 0 1113s has_pure_module = 0 1113s has_pure_package = 0 1113s mock_setup = 1113s mocker = 1113s package_base = '' 1113s package_base_dir = '' 1113s path_types = [] 1113s select_paths = .select_paths at 0xf72624396660> 1113s src_dir = local('/tmp/pytest-of-ubuntu/pytest-82/test_setup_inputs0') 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-82/test_setup_inputs0') 1113s with_package_base = 0 1113s 1113s tests/test_setup.py:849: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-82/test_setup_inputs0') 1113s setup_args = ['build'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-82/test_setup_inputs0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ________________________ test_setup_inputs[0-0-0-0-0-1] ________________________ 1113s 1113s has_cmake_package = 1, has_cmake_module = 0, has_hybrid_package = 0 1113s has_pure_package = 0, has_pure_module = 0, with_package_base = 0 1113s mocker = 1113s 1113s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 1113s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 1113s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_module", [0, 1]) 1113s @pytest.mark.parametrize("with_package_base", [0, 1]) 1113s def test_setup_inputs( 1113s has_cmake_package, 1113s has_cmake_module, 1113s has_hybrid_package, 1113s has_pure_package, 1113s has_pure_module, 1113s with_package_base, 1113s mocker, 1113s ): 1113s """This test that a project can have a package with some modules 1113s installed using setup.py and some other modules installed using CMake. 1113s """ 1113s 1113s tmp_dir = _tmpdir("test_setup_inputs") 1113s 1113s package_base = "to/the/base" if with_package_base else "" 1113s package_base_dir = package_base + "/" if package_base else "" 1113s cmake_source_dir = package_base 1113s 1113s if cmake_source_dir and (has_cmake_package or has_cmake_module): 1113s pytest.skip( 1113s "unsupported configuration: " 1113s "python package fully generated by CMake does *NOT* work. " 1113s "At least __init__.py should be in the project source tree" 1113s ) 1113s 1113s # ------------------------------------------------------------------------- 1113s # Here is the "SOURCE" tree layout: 1113s # 1113s # ROOT/ 1113s # 1113s # setup.py 1113s # 1113s # [/] 1113s # 1113s # pureModule.py 1113s # 1113s # pure/ 1113s # __init__.py 1113s # pure.py 1113s # 1113s # data/ 1113s # pure.dat 1113s # 1113s # [/] 1113s # 1113s # hybrid/ 1113s # CMakeLists.txt 1113s # __init__.py 1113s # hybrid_pure.dat 1113s # hybrid_pure.py 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat 1113s # 1113s # hybrid_2/ 1113s # __init__.py 1113s # hybrid_2_pure.py 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py 1113s # hybrid_2_pure_1.py 1113s # hybrid_2_pure_2.py 1113s # 1113s # 1113s # ------------------------------------------------------------------------- 1113s # and here is the "BINARY" distribution layout: 1113s # 1113s # The comment "CMake" or "Setuptools" indicates which tool is responsible 1113s # for placing the file in the tree used to create the binary distribution. 1113s # 1113s # ROOT/ 1113s # 1113s # cmakeModule.py # CMake 1113s # 1113s # cmake/ 1113s # __init__.py # CMake 1113s # cmake.py # CMake 1113s # 1113s # hybrid/ 1113s # hybrid_cmake.dat # CMake 1113s # hybrid_cmake.py # CMake 1113s # hybrid_pure.dat # Setuptools 1113s # hybrid_pure.py # Setuptools 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat # CMake or Setuptools 1113s # hybrid_data_cmake.dat # CMake *NO TEST* 1113s # 1113s # hybrid_2/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure.py # CMake or Setuptools 1113s # hybrid_2_cmake.py # CMake 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure_1.py # CMake or Setuptools 1113s # hybrid_2_pure_2.py # CMake or Setuptools 1113s # 1113s # pureModule.py # Setuptools 1113s # 1113s # pure/ 1113s # __init__.py # Setuptools 1113s # pure.py # Setuptools 1113s # 1113s # data/ 1113s # pure.dat # Setuptools 1113s 1113s tmp_dir.join("setup.py").write( 1113s textwrap.dedent( 1113s """ 1113s from skbuild import setup 1113s #from setuptools import setup 1113s setup( 1113s name="test_hybrid_project", 1113s version="1.2.3", 1113s description=("an hybrid package mixing files installed by both " 1113s "CMake and setuptools"), 1113s author='The scikit-build team', 1113s license="MIT", 1113s cmake_source_dir='{cmake_source_dir}', 1113s cmake_install_dir='{cmake_install_dir}', 1113s # Arbitrary order of packages 1113s packages=[ 1113s {p_off} 'pure', 1113s {h_off} 'hybrid.hybrid_2', 1113s {h_off} 'hybrid', 1113s {c_off} 'cmake', 1113s {p_off} 'hybrid.hybrid_2_pure', 1113s ], 1113s py_modules=[ 1113s {pm_off} '{package_base}pureModule', 1113s {cm_off} '{package_base}cmakeModule', 1113s ], 1113s package_data={{ 1113s {p_off} 'pure': ['data/pure.dat'], 1113s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 1113s }}, 1113s # Arbitrary order of package_dir 1113s package_dir = {{ 1113s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 1113s {p_off} 'pure': '{package_base}pure', 1113s {h_off} 'hybrid': '{package_base}hybrid', 1113s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 1113s {c_off} 'cmake': '{package_base}cmake', 1113s }} 1113s ) 1113s """.format( 1113s cmake_source_dir=cmake_source_dir, 1113s cmake_install_dir=package_base, 1113s package_base=package_base_dir, 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s p_off="" if has_pure_package else "#", 1113s pm_off="" if has_pure_module else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s src_dir = tmp_dir.ensure(package_base, dir=1) 1113s 1113s src_dir.join("CMakeLists.txt").write( 1113s textwrap.dedent( 1113s """ 1113s cmake_minimum_required(VERSION 3.5.0) 1113s project(hybrid NONE) 1113s set(build_dir ${{CMAKE_BINARY_DIR}}) 1113s 1113s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 1113s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 1113s {c_off} install( 1113s {c_off} FILES 1113s {c_off} ${{build_dir}}/__init__.py 1113s {c_off} ${{build_dir}}/cmake.py 1113s {c_off} DESTINATION cmake 1113s {c_off} ) 1113s 1113s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 1113s {cm_off} install( 1113s {cm_off} FILES ${{build_dir}}/cmakeModule.py 1113s {cm_off} DESTINATION .) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 1113s {h_off} DESTINATION hybrid/data) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 1113s {h_off} DESTINATION hybrid/hybrid_2) 1113s 1113s install(CODE "message(STATUS \\\"Installation complete\\\")") 1113s """.format( 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 1113s path_types: Sequence[str] 1113s try: 1113s path_types = next( 1113s iter( 1113s zip( 1113s *filter( 1113s lambda i: i[1], 1113s [ 1113s ("c", has_cmake_package), 1113s ("cm", has_cmake_module), 1113s ("h", has_hybrid_package), 1113s ("p", has_pure_package), 1113s ("pm", has_pure_module), 1113s ], 1113s ) 1113s ) 1113s ) 1113s ) 1113s except StopIteration: 1113s path_types = [] 1113s 1113s def select_paths(annotated_paths): 1113s """Return a filtered list paths considering ``path_types``. 1113s 1113s `annotated_paths`` is list of tuple ``(type, path)`` where type 1113s is either `c`, 'cm', `h`, `p` or 'pm'. 1113s 1113s """ 1113s return filter(lambda i: i[0] in path_types, annotated_paths) 1113s 1113s # Commented paths are the one expected to be installed by CMake. For 1113s # this reason, corresponding files should NOT be created in the source 1113s # tree. 1113s for _type, path in select_paths( 1113s [ 1113s # ('c', 'cmake/__init__.py'), 1113s # ('c', 'cmake/cmake.py'), 1113s # ('cm', 'cmakeModule.py'), 1113s ("h", "hybrid/__init__.py"), 1113s # ('h', 'hybrid/hybrid_cmake.dat'), 1113s # ('h', 'hybrid/hybrid_cmake.py'), 1113s ("h", "hybrid/hybrid_pure.dat"), 1113s ("h", "hybrid/hybrid_pure.py"), 1113s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 1113s ("h", "hybrid/data/hybrid_data_pure.dat"), 1113s ("h", "hybrid/hybrid_2/__init__.py"), 1113s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 1113s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 1113s ("p", "hybrid/hybrid_2_pure/__init__.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 1113s ("pm", "pureModule.py"), 1113s ("p", "pure/__init__.py"), 1113s ("p", "pure/pure.py"), 1113s ("p", "pure/data/pure.dat"), 1113s ] 1113s ): 1113s assert _type in {"p", "pm", "h"} 1113s root = package_base if _type in {"p", "pm"} else cmake_source_dir 1113s tmp_dir.ensure(os.path.join(root, path)) 1113s 1113s # Do not call the real setup function. Instead, replace it with 1113s # a MagicMock allowing to check with which arguments it was invoked. 1113s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 1113s 1113s # Convenience print function 1113s def _pprint(desc, value=None): 1113s print( 1113s "-----------------\n" 1113s f"{desc}:\n" 1113s "\n" 1113s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 1113s ) 1113s 1113s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 1113s 1113s _pprint = ._pprint at 0xf72624161300> 1113s cmake_source_dir = '' 1113s has_cmake_module = 0 1113s has_cmake_package = 1 1113s has_hybrid_package = 0 1113s has_pure_module = 0 1113s has_pure_package = 0 1113s mock_setup = 1113s mocker = 1113s package_base = '' 1113s package_base_dir = '' 1113s path_types = ('c',) 1113s select_paths = .select_paths at 0xf72624182980> 1113s src_dir = local('/tmp/pytest-of-ubuntu/pytest-83/test_setup_inputs0') 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-83/test_setup_inputs0') 1113s with_package_base = 0 1113s 1113s tests/test_setup.py:849: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-83/test_setup_inputs0') 1113s setup_args = ['build'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-83/test_setup_inputs0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ________________________ test_setup_inputs[0-0-0-0-1-0] ________________________ 1113s 1113s has_cmake_package = 0, has_cmake_module = 1, has_hybrid_package = 0 1113s has_pure_package = 0, has_pure_module = 0, with_package_base = 0 1113s mocker = 1113s 1113s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 1113s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 1113s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_module", [0, 1]) 1113s @pytest.mark.parametrize("with_package_base", [0, 1]) 1113s def test_setup_inputs( 1113s has_cmake_package, 1113s has_cmake_module, 1113s has_hybrid_package, 1113s has_pure_package, 1113s has_pure_module, 1113s with_package_base, 1113s mocker, 1113s ): 1113s """This test that a project can have a package with some modules 1113s installed using setup.py and some other modules installed using CMake. 1113s """ 1113s 1113s tmp_dir = _tmpdir("test_setup_inputs") 1113s 1113s package_base = "to/the/base" if with_package_base else "" 1113s package_base_dir = package_base + "/" if package_base else "" 1113s cmake_source_dir = package_base 1113s 1113s if cmake_source_dir and (has_cmake_package or has_cmake_module): 1113s pytest.skip( 1113s "unsupported configuration: " 1113s "python package fully generated by CMake does *NOT* work. " 1113s "At least __init__.py should be in the project source tree" 1113s ) 1113s 1113s # ------------------------------------------------------------------------- 1113s # Here is the "SOURCE" tree layout: 1113s # 1113s # ROOT/ 1113s # 1113s # setup.py 1113s # 1113s # [/] 1113s # 1113s # pureModule.py 1113s # 1113s # pure/ 1113s # __init__.py 1113s # pure.py 1113s # 1113s # data/ 1113s # pure.dat 1113s # 1113s # [/] 1113s # 1113s # hybrid/ 1113s # CMakeLists.txt 1113s # __init__.py 1113s # hybrid_pure.dat 1113s # hybrid_pure.py 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat 1113s # 1113s # hybrid_2/ 1113s # __init__.py 1113s # hybrid_2_pure.py 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py 1113s # hybrid_2_pure_1.py 1113s # hybrid_2_pure_2.py 1113s # 1113s # 1113s # ------------------------------------------------------------------------- 1113s # and here is the "BINARY" distribution layout: 1113s # 1113s # The comment "CMake" or "Setuptools" indicates which tool is responsible 1113s # for placing the file in the tree used to create the binary distribution. 1113s # 1113s # ROOT/ 1113s # 1113s # cmakeModule.py # CMake 1113s # 1113s # cmake/ 1113s # __init__.py # CMake 1113s # cmake.py # CMake 1113s # 1113s # hybrid/ 1113s # hybrid_cmake.dat # CMake 1113s # hybrid_cmake.py # CMake 1113s # hybrid_pure.dat # Setuptools 1113s # hybrid_pure.py # Setuptools 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat # CMake or Setuptools 1113s # hybrid_data_cmake.dat # CMake *NO TEST* 1113s # 1113s # hybrid_2/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure.py # CMake or Setuptools 1113s # hybrid_2_cmake.py # CMake 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure_1.py # CMake or Setuptools 1113s # hybrid_2_pure_2.py # CMake or Setuptools 1113s # 1113s # pureModule.py # Setuptools 1113s # 1113s # pure/ 1113s # __init__.py # Setuptools 1113s # pure.py # Setuptools 1113s # 1113s # data/ 1113s # pure.dat # Setuptools 1113s 1113s tmp_dir.join("setup.py").write( 1113s textwrap.dedent( 1113s """ 1113s from skbuild import setup 1113s #from setuptools import setup 1113s setup( 1113s name="test_hybrid_project", 1113s version="1.2.3", 1113s description=("an hybrid package mixing files installed by both " 1113s "CMake and setuptools"), 1113s author='The scikit-build team', 1113s license="MIT", 1113s cmake_source_dir='{cmake_source_dir}', 1113s cmake_install_dir='{cmake_install_dir}', 1113s # Arbitrary order of packages 1113s packages=[ 1113s {p_off} 'pure', 1113s {h_off} 'hybrid.hybrid_2', 1113s {h_off} 'hybrid', 1113s {c_off} 'cmake', 1113s {p_off} 'hybrid.hybrid_2_pure', 1113s ], 1113s py_modules=[ 1113s {pm_off} '{package_base}pureModule', 1113s {cm_off} '{package_base}cmakeModule', 1113s ], 1113s package_data={{ 1113s {p_off} 'pure': ['data/pure.dat'], 1113s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 1113s }}, 1113s # Arbitrary order of package_dir 1113s package_dir = {{ 1113s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 1113s {p_off} 'pure': '{package_base}pure', 1113s {h_off} 'hybrid': '{package_base}hybrid', 1113s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 1113s {c_off} 'cmake': '{package_base}cmake', 1113s }} 1113s ) 1113s """.format( 1113s cmake_source_dir=cmake_source_dir, 1113s cmake_install_dir=package_base, 1113s package_base=package_base_dir, 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s p_off="" if has_pure_package else "#", 1113s pm_off="" if has_pure_module else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s src_dir = tmp_dir.ensure(package_base, dir=1) 1113s 1113s src_dir.join("CMakeLists.txt").write( 1113s textwrap.dedent( 1113s """ 1113s cmake_minimum_required(VERSION 3.5.0) 1113s project(hybrid NONE) 1113s set(build_dir ${{CMAKE_BINARY_DIR}}) 1113s 1113s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 1113s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 1113s {c_off} install( 1113s {c_off} FILES 1113s {c_off} ${{build_dir}}/__init__.py 1113s {c_off} ${{build_dir}}/cmake.py 1113s {c_off} DESTINATION cmake 1113s {c_off} ) 1113s 1113s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 1113s {cm_off} install( 1113s {cm_off} FILES ${{build_dir}}/cmakeModule.py 1113s {cm_off} DESTINATION .) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 1113s {h_off} DESTINATION hybrid/data) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 1113s {h_off} DESTINATION hybrid/hybrid_2) 1113s 1113s install(CODE "message(STATUS \\\"Installation complete\\\")") 1113s """.format( 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 1113s path_types: Sequence[str] 1113s try: 1113s path_types = next( 1113s iter( 1113s zip( 1113s *filter( 1113s lambda i: i[1], 1113s [ 1113s ("c", has_cmake_package), 1113s ("cm", has_cmake_module), 1113s ("h", has_hybrid_package), 1113s ("p", has_pure_package), 1113s ("pm", has_pure_module), 1113s ], 1113s ) 1113s ) 1113s ) 1113s ) 1113s except StopIteration: 1113s path_types = [] 1113s 1113s def select_paths(annotated_paths): 1113s """Return a filtered list paths considering ``path_types``. 1113s 1113s `annotated_paths`` is list of tuple ``(type, path)`` where type 1113s is either `c`, 'cm', `h`, `p` or 'pm'. 1113s 1113s """ 1113s return filter(lambda i: i[0] in path_types, annotated_paths) 1113s 1113s # Commented paths are the one expected to be installed by CMake. For 1113s # this reason, corresponding files should NOT be created in the source 1113s # tree. 1113s for _type, path in select_paths( 1113s [ 1113s # ('c', 'cmake/__init__.py'), 1113s # ('c', 'cmake/cmake.py'), 1113s # ('cm', 'cmakeModule.py'), 1113s ("h", "hybrid/__init__.py"), 1113s # ('h', 'hybrid/hybrid_cmake.dat'), 1113s # ('h', 'hybrid/hybrid_cmake.py'), 1113s ("h", "hybrid/hybrid_pure.dat"), 1113s ("h", "hybrid/hybrid_pure.py"), 1113s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 1113s ("h", "hybrid/data/hybrid_data_pure.dat"), 1113s ("h", "hybrid/hybrid_2/__init__.py"), 1113s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 1113s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 1113s ("p", "hybrid/hybrid_2_pure/__init__.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 1113s ("pm", "pureModule.py"), 1113s ("p", "pure/__init__.py"), 1113s ("p", "pure/pure.py"), 1113s ("p", "pure/data/pure.dat"), 1113s ] 1113s ): 1113s assert _type in {"p", "pm", "h"} 1113s root = package_base if _type in {"p", "pm"} else cmake_source_dir 1113s tmp_dir.ensure(os.path.join(root, path)) 1113s 1113s # Do not call the real setup function. Instead, replace it with 1113s # a MagicMock allowing to check with which arguments it was invoked. 1113s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 1113s 1113s # Convenience print function 1113s def _pprint(desc, value=None): 1113s print( 1113s "-----------------\n" 1113s f"{desc}:\n" 1113s "\n" 1113s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 1113s ) 1113s 1113s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 1113s 1113s _pprint = ._pprint at 0xf726240f0b80> 1113s cmake_source_dir = '' 1113s has_cmake_module = 1 1113s has_cmake_package = 0 1113s has_hybrid_package = 0 1113s has_pure_module = 0 1113s has_pure_package = 0 1113s mock_setup = 1113s mocker = 1113s package_base = '' 1113s package_base_dir = '' 1113s path_types = ('cm',) 1113s select_paths = .select_paths at 0xf72624163560> 1113s src_dir = local('/tmp/pytest-of-ubuntu/pytest-84/test_setup_inputs0') 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-84/test_setup_inputs0') 1113s with_package_base = 0 1113s 1113s tests/test_setup.py:849: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-84/test_setup_inputs0') 1113s setup_args = ['build'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-84/test_setup_inputs0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ________________________ test_setup_inputs[0-0-0-0-1-1] ________________________ 1113s 1113s has_cmake_package = 1, has_cmake_module = 1, has_hybrid_package = 0 1113s has_pure_package = 0, has_pure_module = 0, with_package_base = 0 1113s mocker = 1113s 1113s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 1113s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 1113s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_module", [0, 1]) 1113s @pytest.mark.parametrize("with_package_base", [0, 1]) 1113s def test_setup_inputs( 1113s has_cmake_package, 1113s has_cmake_module, 1113s has_hybrid_package, 1113s has_pure_package, 1113s has_pure_module, 1113s with_package_base, 1113s mocker, 1113s ): 1113s """This test that a project can have a package with some modules 1113s installed using setup.py and some other modules installed using CMake. 1113s """ 1113s 1113s tmp_dir = _tmpdir("test_setup_inputs") 1113s 1113s package_base = "to/the/base" if with_package_base else "" 1113s package_base_dir = package_base + "/" if package_base else "" 1113s cmake_source_dir = package_base 1113s 1113s if cmake_source_dir and (has_cmake_package or has_cmake_module): 1113s pytest.skip( 1113s "unsupported configuration: " 1113s "python package fully generated by CMake does *NOT* work. " 1113s "At least __init__.py should be in the project source tree" 1113s ) 1113s 1113s # ------------------------------------------------------------------------- 1113s # Here is the "SOURCE" tree layout: 1113s # 1113s # ROOT/ 1113s # 1113s # setup.py 1113s # 1113s # [/] 1113s # 1113s # pureModule.py 1113s # 1113s # pure/ 1113s # __init__.py 1113s # pure.py 1113s # 1113s # data/ 1113s # pure.dat 1113s # 1113s # [/] 1113s # 1113s # hybrid/ 1113s # CMakeLists.txt 1113s # __init__.py 1113s # hybrid_pure.dat 1113s # hybrid_pure.py 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat 1113s # 1113s # hybrid_2/ 1113s # __init__.py 1113s # hybrid_2_pure.py 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py 1113s # hybrid_2_pure_1.py 1113s # hybrid_2_pure_2.py 1113s # 1113s # 1113s # ------------------------------------------------------------------------- 1113s # and here is the "BINARY" distribution layout: 1113s # 1113s # The comment "CMake" or "Setuptools" indicates which tool is responsible 1113s # for placing the file in the tree used to create the binary distribution. 1113s # 1113s # ROOT/ 1113s # 1113s # cmakeModule.py # CMake 1113s # 1113s # cmake/ 1113s # __init__.py # CMake 1113s # cmake.py # CMake 1113s # 1113s # hybrid/ 1113s # hybrid_cmake.dat # CMake 1113s # hybrid_cmake.py # CMake 1113s # hybrid_pure.dat # Setuptools 1113s # hybrid_pure.py # Setuptools 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat # CMake or Setuptools 1113s # hybrid_data_cmake.dat # CMake *NO TEST* 1113s # 1113s # hybrid_2/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure.py # CMake or Setuptools 1113s # hybrid_2_cmake.py # CMake 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure_1.py # CMake or Setuptools 1113s # hybrid_2_pure_2.py # CMake or Setuptools 1113s # 1113s # pureModule.py # Setuptools 1113s # 1113s # pure/ 1113s # __init__.py # Setuptools 1113s # pure.py # Setuptools 1113s # 1113s # data/ 1113s # pure.dat # Setuptools 1113s 1113s tmp_dir.join("setup.py").write( 1113s textwrap.dedent( 1113s """ 1113s from skbuild import setup 1113s #from setuptools import setup 1113s setup( 1113s name="test_hybrid_project", 1113s version="1.2.3", 1113s description=("an hybrid package mixing files installed by both " 1113s "CMake and setuptools"), 1113s author='The scikit-build team', 1113s license="MIT", 1113s cmake_source_dir='{cmake_source_dir}', 1113s cmake_install_dir='{cmake_install_dir}', 1113s # Arbitrary order of packages 1113s packages=[ 1113s {p_off} 'pure', 1113s {h_off} 'hybrid.hybrid_2', 1113s {h_off} 'hybrid', 1113s {c_off} 'cmake', 1113s {p_off} 'hybrid.hybrid_2_pure', 1113s ], 1113s py_modules=[ 1113s {pm_off} '{package_base}pureModule', 1113s {cm_off} '{package_base}cmakeModule', 1113s ], 1113s package_data={{ 1113s {p_off} 'pure': ['data/pure.dat'], 1113s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 1113s }}, 1113s # Arbitrary order of package_dir 1113s package_dir = {{ 1113s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 1113s {p_off} 'pure': '{package_base}pure', 1113s {h_off} 'hybrid': '{package_base}hybrid', 1113s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 1113s {c_off} 'cmake': '{package_base}cmake', 1113s }} 1113s ) 1113s """.format( 1113s cmake_source_dir=cmake_source_dir, 1113s cmake_install_dir=package_base, 1113s package_base=package_base_dir, 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s p_off="" if has_pure_package else "#", 1113s pm_off="" if has_pure_module else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s src_dir = tmp_dir.ensure(package_base, dir=1) 1113s 1113s src_dir.join("CMakeLists.txt").write( 1113s textwrap.dedent( 1113s """ 1113s cmake_minimum_required(VERSION 3.5.0) 1113s project(hybrid NONE) 1113s set(build_dir ${{CMAKE_BINARY_DIR}}) 1113s 1113s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 1113s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 1113s {c_off} install( 1113s {c_off} FILES 1113s {c_off} ${{build_dir}}/__init__.py 1113s {c_off} ${{build_dir}}/cmake.py 1113s {c_off} DESTINATION cmake 1113s {c_off} ) 1113s 1113s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 1113s {cm_off} install( 1113s {cm_off} FILES ${{build_dir}}/cmakeModule.py 1113s {cm_off} DESTINATION .) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 1113s {h_off} DESTINATION hybrid/data) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 1113s {h_off} DESTINATION hybrid/hybrid_2) 1113s 1113s install(CODE "message(STATUS \\\"Installation complete\\\")") 1113s """.format( 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 1113s path_types: Sequence[str] 1113s try: 1113s path_types = next( 1113s iter( 1113s zip( 1113s *filter( 1113s lambda i: i[1], 1113s [ 1113s ("c", has_cmake_package), 1113s ("cm", has_cmake_module), 1113s ("h", has_hybrid_package), 1113s ("p", has_pure_package), 1113s ("pm", has_pure_module), 1113s ], 1113s ) 1113s ) 1113s ) 1113s ) 1113s except StopIteration: 1113s path_types = [] 1113s 1113s def select_paths(annotated_paths): 1113s """Return a filtered list paths considering ``path_types``. 1113s 1113s `annotated_paths`` is list of tuple ``(type, path)`` where type 1113s is either `c`, 'cm', `h`, `p` or 'pm'. 1113s 1113s """ 1113s return filter(lambda i: i[0] in path_types, annotated_paths) 1113s 1113s # Commented paths are the one expected to be installed by CMake. For 1113s # this reason, corresponding files should NOT be created in the source 1113s # tree. 1113s for _type, path in select_paths( 1113s [ 1113s # ('c', 'cmake/__init__.py'), 1113s # ('c', 'cmake/cmake.py'), 1113s # ('cm', 'cmakeModule.py'), 1113s ("h", "hybrid/__init__.py"), 1113s # ('h', 'hybrid/hybrid_cmake.dat'), 1113s # ('h', 'hybrid/hybrid_cmake.py'), 1113s ("h", "hybrid/hybrid_pure.dat"), 1113s ("h", "hybrid/hybrid_pure.py"), 1113s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 1113s ("h", "hybrid/data/hybrid_data_pure.dat"), 1113s ("h", "hybrid/hybrid_2/__init__.py"), 1113s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 1113s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 1113s ("p", "hybrid/hybrid_2_pure/__init__.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 1113s ("pm", "pureModule.py"), 1113s ("p", "pure/__init__.py"), 1113s ("p", "pure/pure.py"), 1113s ("p", "pure/data/pure.dat"), 1113s ] 1113s ): 1113s assert _type in {"p", "pm", "h"} 1113s root = package_base if _type in {"p", "pm"} else cmake_source_dir 1113s tmp_dir.ensure(os.path.join(root, path)) 1113s 1113s # Do not call the real setup function. Instead, replace it with 1113s # a MagicMock allowing to check with which arguments it was invoked. 1113s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 1113s 1113s # Convenience print function 1113s def _pprint(desc, value=None): 1113s print( 1113s "-----------------\n" 1113s f"{desc}:\n" 1113s "\n" 1113s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 1113s ) 1113s 1113s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 1113s 1113s _pprint = ._pprint at 0xf726240f0220> 1113s cmake_source_dir = '' 1113s has_cmake_module = 1 1113s has_cmake_package = 1 1113s has_hybrid_package = 0 1113s has_pure_module = 0 1113s has_pure_package = 0 1113s mock_setup = 1113s mocker = 1113s package_base = '' 1113s package_base_dir = '' 1113s path_types = ('c', 'cm') 1113s select_paths = .select_paths at 0xf726240f1620> 1113s src_dir = local('/tmp/pytest-of-ubuntu/pytest-85/test_setup_inputs0') 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-85/test_setup_inputs0') 1113s with_package_base = 0 1113s 1113s tests/test_setup.py:849: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-85/test_setup_inputs0') 1113s setup_args = ['build'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-85/test_setup_inputs0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ________________________ test_setup_inputs[0-0-0-1-0-0] ________________________ 1113s 1113s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 1 1113s has_pure_package = 0, has_pure_module = 0, with_package_base = 0 1113s mocker = 1113s 1113s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 1113s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 1113s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_module", [0, 1]) 1113s @pytest.mark.parametrize("with_package_base", [0, 1]) 1113s def test_setup_inputs( 1113s has_cmake_package, 1113s has_cmake_module, 1113s has_hybrid_package, 1113s has_pure_package, 1113s has_pure_module, 1113s with_package_base, 1113s mocker, 1113s ): 1113s """This test that a project can have a package with some modules 1113s installed using setup.py and some other modules installed using CMake. 1113s """ 1113s 1113s tmp_dir = _tmpdir("test_setup_inputs") 1113s 1113s package_base = "to/the/base" if with_package_base else "" 1113s package_base_dir = package_base + "/" if package_base else "" 1113s cmake_source_dir = package_base 1113s 1113s if cmake_source_dir and (has_cmake_package or has_cmake_module): 1113s pytest.skip( 1113s "unsupported configuration: " 1113s "python package fully generated by CMake does *NOT* work. " 1113s "At least __init__.py should be in the project source tree" 1113s ) 1113s 1113s # ------------------------------------------------------------------------- 1113s # Here is the "SOURCE" tree layout: 1113s # 1113s # ROOT/ 1113s # 1113s # setup.py 1113s # 1113s # [/] 1113s # 1113s # pureModule.py 1113s # 1113s # pure/ 1113s # __init__.py 1113s # pure.py 1113s # 1113s # data/ 1113s # pure.dat 1113s # 1113s # [/] 1113s # 1113s # hybrid/ 1113s # CMakeLists.txt 1113s # __init__.py 1113s # hybrid_pure.dat 1113s # hybrid_pure.py 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat 1113s # 1113s # hybrid_2/ 1113s # __init__.py 1113s # hybrid_2_pure.py 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py 1113s # hybrid_2_pure_1.py 1113s # hybrid_2_pure_2.py 1113s # 1113s # 1113s # ------------------------------------------------------------------------- 1113s # and here is the "BINARY" distribution layout: 1113s # 1113s # The comment "CMake" or "Setuptools" indicates which tool is responsible 1113s # for placing the file in the tree used to create the binary distribution. 1113s # 1113s # ROOT/ 1113s # 1113s # cmakeModule.py # CMake 1113s # 1113s # cmake/ 1113s # __init__.py # CMake 1113s # cmake.py # CMake 1113s # 1113s # hybrid/ 1113s # hybrid_cmake.dat # CMake 1113s # hybrid_cmake.py # CMake 1113s # hybrid_pure.dat # Setuptools 1113s # hybrid_pure.py # Setuptools 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat # CMake or Setuptools 1113s # hybrid_data_cmake.dat # CMake *NO TEST* 1113s # 1113s # hybrid_2/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure.py # CMake or Setuptools 1113s # hybrid_2_cmake.py # CMake 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure_1.py # CMake or Setuptools 1113s # hybrid_2_pure_2.py # CMake or Setuptools 1113s # 1113s # pureModule.py # Setuptools 1113s # 1113s # pure/ 1113s # __init__.py # Setuptools 1113s # pure.py # Setuptools 1113s # 1113s # data/ 1113s # pure.dat # Setuptools 1113s 1113s tmp_dir.join("setup.py").write( 1113s textwrap.dedent( 1113s """ 1113s from skbuild import setup 1113s #from setuptools import setup 1113s setup( 1113s name="test_hybrid_project", 1113s version="1.2.3", 1113s description=("an hybrid package mixing files installed by both " 1113s "CMake and setuptools"), 1113s author='The scikit-build team', 1113s license="MIT", 1113s cmake_source_dir='{cmake_source_dir}', 1113s cmake_install_dir='{cmake_install_dir}', 1113s # Arbitrary order of packages 1113s packages=[ 1113s {p_off} 'pure', 1113s {h_off} 'hybrid.hybrid_2', 1113s {h_off} 'hybrid', 1113s {c_off} 'cmake', 1113s {p_off} 'hybrid.hybrid_2_pure', 1113s ], 1113s py_modules=[ 1113s {pm_off} '{package_base}pureModule', 1113s {cm_off} '{package_base}cmakeModule', 1113s ], 1113s package_data={{ 1113s {p_off} 'pure': ['data/pure.dat'], 1113s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 1113s }}, 1113s # Arbitrary order of package_dir 1113s package_dir = {{ 1113s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 1113s {p_off} 'pure': '{package_base}pure', 1113s {h_off} 'hybrid': '{package_base}hybrid', 1113s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 1113s {c_off} 'cmake': '{package_base}cmake', 1113s }} 1113s ) 1113s """.format( 1113s cmake_source_dir=cmake_source_dir, 1113s cmake_install_dir=package_base, 1113s package_base=package_base_dir, 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s p_off="" if has_pure_package else "#", 1113s pm_off="" if has_pure_module else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s src_dir = tmp_dir.ensure(package_base, dir=1) 1113s 1113s src_dir.join("CMakeLists.txt").write( 1113s textwrap.dedent( 1113s """ 1113s cmake_minimum_required(VERSION 3.5.0) 1113s project(hybrid NONE) 1113s set(build_dir ${{CMAKE_BINARY_DIR}}) 1113s 1113s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 1113s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 1113s {c_off} install( 1113s {c_off} FILES 1113s {c_off} ${{build_dir}}/__init__.py 1113s {c_off} ${{build_dir}}/cmake.py 1113s {c_off} DESTINATION cmake 1113s {c_off} ) 1113s 1113s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 1113s {cm_off} install( 1113s {cm_off} FILES ${{build_dir}}/cmakeModule.py 1113s {cm_off} DESTINATION .) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 1113s {h_off} DESTINATION hybrid/data) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 1113s {h_off} DESTINATION hybrid/hybrid_2) 1113s 1113s install(CODE "message(STATUS \\\"Installation complete\\\")") 1113s """.format( 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 1113s path_types: Sequence[str] 1113s try: 1113s path_types = next( 1113s iter( 1113s zip( 1113s *filter( 1113s lambda i: i[1], 1113s [ 1113s ("c", has_cmake_package), 1113s ("cm", has_cmake_module), 1113s ("h", has_hybrid_package), 1113s ("p", has_pure_package), 1113s ("pm", has_pure_module), 1113s ], 1113s ) 1113s ) 1113s ) 1113s ) 1113s except StopIteration: 1113s path_types = [] 1113s 1113s def select_paths(annotated_paths): 1113s """Return a filtered list paths considering ``path_types``. 1113s 1113s `annotated_paths`` is list of tuple ``(type, path)`` where type 1113s is either `c`, 'cm', `h`, `p` or 'pm'. 1113s 1113s """ 1113s return filter(lambda i: i[0] in path_types, annotated_paths) 1113s 1113s # Commented paths are the one expected to be installed by CMake. For 1113s # this reason, corresponding files should NOT be created in the source 1113s # tree. 1113s for _type, path in select_paths( 1113s [ 1113s # ('c', 'cmake/__init__.py'), 1113s # ('c', 'cmake/cmake.py'), 1113s # ('cm', 'cmakeModule.py'), 1113s ("h", "hybrid/__init__.py"), 1113s # ('h', 'hybrid/hybrid_cmake.dat'), 1113s # ('h', 'hybrid/hybrid_cmake.py'), 1113s ("h", "hybrid/hybrid_pure.dat"), 1113s ("h", "hybrid/hybrid_pure.py"), 1113s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 1113s ("h", "hybrid/data/hybrid_data_pure.dat"), 1113s ("h", "hybrid/hybrid_2/__init__.py"), 1113s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 1113s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 1113s ("p", "hybrid/hybrid_2_pure/__init__.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 1113s ("pm", "pureModule.py"), 1113s ("p", "pure/__init__.py"), 1113s ("p", "pure/pure.py"), 1113s ("p", "pure/data/pure.dat"), 1113s ] 1113s ): 1113s assert _type in {"p", "pm", "h"} 1113s root = package_base if _type in {"p", "pm"} else cmake_source_dir 1113s tmp_dir.ensure(os.path.join(root, path)) 1113s 1113s # Do not call the real setup function. Instead, replace it with 1113s # a MagicMock allowing to check with which arguments it was invoked. 1113s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 1113s 1113s # Convenience print function 1113s def _pprint(desc, value=None): 1113s print( 1113s "-----------------\n" 1113s f"{desc}:\n" 1113s "\n" 1113s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 1113s ) 1113s 1113s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 1113s 1113s _pprint = ._pprint at 0xf726240f1940> 1113s _type = 'h' 1113s cmake_source_dir = '' 1113s has_cmake_module = 0 1113s has_cmake_package = 0 1113s has_hybrid_package = 1 1113s has_pure_module = 0 1113s has_pure_package = 0 1113s mock_setup = 1113s mocker = 1113s package_base = '' 1113s package_base_dir = '' 1113s path = 'hybrid/hybrid_2/hybrid_2_pure.py' 1113s path_types = ('h',) 1113s root = '' 1113s select_paths = .select_paths at 0xf726240f0cc0> 1113s src_dir = local('/tmp/pytest-of-ubuntu/pytest-86/test_setup_inputs0') 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-86/test_setup_inputs0') 1113s with_package_base = 0 1113s 1113s tests/test_setup.py:849: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-86/test_setup_inputs0') 1113s setup_args = ['build'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-86/test_setup_inputs0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ________________________ test_setup_inputs[0-0-0-1-0-1] ________________________ 1113s 1113s has_cmake_package = 1, has_cmake_module = 0, has_hybrid_package = 1 1113s has_pure_package = 0, has_pure_module = 0, with_package_base = 0 1113s mocker = 1113s 1113s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 1113s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 1113s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_module", [0, 1]) 1113s @pytest.mark.parametrize("with_package_base", [0, 1]) 1113s def test_setup_inputs( 1113s has_cmake_package, 1113s has_cmake_module, 1113s has_hybrid_package, 1113s has_pure_package, 1113s has_pure_module, 1113s with_package_base, 1113s mocker, 1113s ): 1113s """This test that a project can have a package with some modules 1113s installed using setup.py and some other modules installed using CMake. 1113s """ 1113s 1113s tmp_dir = _tmpdir("test_setup_inputs") 1113s 1113s package_base = "to/the/base" if with_package_base else "" 1113s package_base_dir = package_base + "/" if package_base else "" 1113s cmake_source_dir = package_base 1113s 1113s if cmake_source_dir and (has_cmake_package or has_cmake_module): 1113s pytest.skip( 1113s "unsupported configuration: " 1113s "python package fully generated by CMake does *NOT* work. " 1113s "At least __init__.py should be in the project source tree" 1113s ) 1113s 1113s # ------------------------------------------------------------------------- 1113s # Here is the "SOURCE" tree layout: 1113s # 1113s # ROOT/ 1113s # 1113s # setup.py 1113s # 1113s # [/] 1113s # 1113s # pureModule.py 1113s # 1113s # pure/ 1113s # __init__.py 1113s # pure.py 1113s # 1113s # data/ 1113s # pure.dat 1113s # 1113s # [/] 1113s # 1113s # hybrid/ 1113s # CMakeLists.txt 1113s # __init__.py 1113s # hybrid_pure.dat 1113s # hybrid_pure.py 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat 1113s # 1113s # hybrid_2/ 1113s # __init__.py 1113s # hybrid_2_pure.py 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py 1113s # hybrid_2_pure_1.py 1113s # hybrid_2_pure_2.py 1113s # 1113s # 1113s # ------------------------------------------------------------------------- 1113s # and here is the "BINARY" distribution layout: 1113s # 1113s # The comment "CMake" or "Setuptools" indicates which tool is responsible 1113s # for placing the file in the tree used to create the binary distribution. 1113s # 1113s # ROOT/ 1113s # 1113s # cmakeModule.py # CMake 1113s # 1113s # cmake/ 1113s # __init__.py # CMake 1113s # cmake.py # CMake 1113s # 1113s # hybrid/ 1113s # hybrid_cmake.dat # CMake 1113s # hybrid_cmake.py # CMake 1113s # hybrid_pure.dat # Setuptools 1113s # hybrid_pure.py # Setuptools 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat # CMake or Setuptools 1113s # hybrid_data_cmake.dat # CMake *NO TEST* 1113s # 1113s # hybrid_2/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure.py # CMake or Setuptools 1113s # hybrid_2_cmake.py # CMake 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure_1.py # CMake or Setuptools 1113s # hybrid_2_pure_2.py # CMake or Setuptools 1113s # 1113s # pureModule.py # Setuptools 1113s # 1113s # pure/ 1113s # __init__.py # Setuptools 1113s # pure.py # Setuptools 1113s # 1113s # data/ 1113s # pure.dat # Setuptools 1113s 1113s tmp_dir.join("setup.py").write( 1113s textwrap.dedent( 1113s """ 1113s from skbuild import setup 1113s #from setuptools import setup 1113s setup( 1113s name="test_hybrid_project", 1113s version="1.2.3", 1113s description=("an hybrid package mixing files installed by both " 1113s "CMake and setuptools"), 1113s author='The scikit-build team', 1113s license="MIT", 1113s cmake_source_dir='{cmake_source_dir}', 1113s cmake_install_dir='{cmake_install_dir}', 1113s # Arbitrary order of packages 1113s packages=[ 1113s {p_off} 'pure', 1113s {h_off} 'hybrid.hybrid_2', 1113s {h_off} 'hybrid', 1113s {c_off} 'cmake', 1113s {p_off} 'hybrid.hybrid_2_pure', 1113s ], 1113s py_modules=[ 1113s {pm_off} '{package_base}pureModule', 1113s {cm_off} '{package_base}cmakeModule', 1113s ], 1113s package_data={{ 1113s {p_off} 'pure': ['data/pure.dat'], 1113s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 1113s }}, 1113s # Arbitrary order of package_dir 1113s package_dir = {{ 1113s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 1113s {p_off} 'pure': '{package_base}pure', 1113s {h_off} 'hybrid': '{package_base}hybrid', 1113s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 1113s {c_off} 'cmake': '{package_base}cmake', 1113s }} 1113s ) 1113s """.format( 1113s cmake_source_dir=cmake_source_dir, 1113s cmake_install_dir=package_base, 1113s package_base=package_base_dir, 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s p_off="" if has_pure_package else "#", 1113s pm_off="" if has_pure_module else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s src_dir = tmp_dir.ensure(package_base, dir=1) 1113s 1113s src_dir.join("CMakeLists.txt").write( 1113s textwrap.dedent( 1113s """ 1113s cmake_minimum_required(VERSION 3.5.0) 1113s project(hybrid NONE) 1113s set(build_dir ${{CMAKE_BINARY_DIR}}) 1113s 1113s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 1113s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 1113s {c_off} install( 1113s {c_off} FILES 1113s {c_off} ${{build_dir}}/__init__.py 1113s {c_off} ${{build_dir}}/cmake.py 1113s {c_off} DESTINATION cmake 1113s {c_off} ) 1113s 1113s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 1113s {cm_off} install( 1113s {cm_off} FILES ${{build_dir}}/cmakeModule.py 1113s {cm_off} DESTINATION .) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 1113s {h_off} DESTINATION hybrid/data) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 1113s {h_off} DESTINATION hybrid/hybrid_2) 1113s 1113s install(CODE "message(STATUS \\\"Installation complete\\\")") 1113s """.format( 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 1113s path_types: Sequence[str] 1113s try: 1113s path_types = next( 1113s iter( 1113s zip( 1113s *filter( 1113s lambda i: i[1], 1113s [ 1113s ("c", has_cmake_package), 1113s ("cm", has_cmake_module), 1113s ("h", has_hybrid_package), 1113s ("p", has_pure_package), 1113s ("pm", has_pure_module), 1113s ], 1113s ) 1113s ) 1113s ) 1113s ) 1113s except StopIteration: 1113s path_types = [] 1113s 1113s def select_paths(annotated_paths): 1113s """Return a filtered list paths considering ``path_types``. 1113s 1113s `annotated_paths`` is list of tuple ``(type, path)`` where type 1113s is either `c`, 'cm', `h`, `p` or 'pm'. 1113s 1113s """ 1113s return filter(lambda i: i[0] in path_types, annotated_paths) 1113s 1113s # Commented paths are the one expected to be installed by CMake. For 1113s # this reason, corresponding files should NOT be created in the source 1113s # tree. 1113s for _type, path in select_paths( 1113s [ 1113s # ('c', 'cmake/__init__.py'), 1113s # ('c', 'cmake/cmake.py'), 1113s # ('cm', 'cmakeModule.py'), 1113s ("h", "hybrid/__init__.py"), 1113s # ('h', 'hybrid/hybrid_cmake.dat'), 1113s # ('h', 'hybrid/hybrid_cmake.py'), 1113s ("h", "hybrid/hybrid_pure.dat"), 1113s ("h", "hybrid/hybrid_pure.py"), 1113s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 1113s ("h", "hybrid/data/hybrid_data_pure.dat"), 1113s ("h", "hybrid/hybrid_2/__init__.py"), 1113s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 1113s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 1113s ("p", "hybrid/hybrid_2_pure/__init__.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 1113s ("pm", "pureModule.py"), 1113s ("p", "pure/__init__.py"), 1113s ("p", "pure/pure.py"), 1113s ("p", "pure/data/pure.dat"), 1113s ] 1113s ): 1113s assert _type in {"p", "pm", "h"} 1113s root = package_base if _type in {"p", "pm"} else cmake_source_dir 1113s tmp_dir.ensure(os.path.join(root, path)) 1113s 1113s # Do not call the real setup function. Instead, replace it with 1113s # a MagicMock allowing to check with which arguments it was invoked. 1113s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 1113s 1113s # Convenience print function 1113s def _pprint(desc, value=None): 1113s print( 1113s "-----------------\n" 1113s f"{desc}:\n" 1113s "\n" 1113s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 1113s ) 1113s 1113s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 1113s 1113s _pprint = ._pprint at 0xf72624161300> 1113s _type = 'h' 1113s cmake_source_dir = '' 1113s has_cmake_module = 0 1113s has_cmake_package = 1 1113s has_hybrid_package = 1 1113s has_pure_module = 0 1113s has_pure_package = 0 1113s mock_setup = 1113s mocker = 1113s package_base = '' 1113s package_base_dir = '' 1113s path = 'hybrid/hybrid_2/hybrid_2_pure.py' 1113s path_types = ('c', 'h') 1113s root = '' 1113s select_paths = .select_paths at 0xf72624163880> 1113s src_dir = local('/tmp/pytest-of-ubuntu/pytest-87/test_setup_inputs0') 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-87/test_setup_inputs0') 1113s with_package_base = 0 1113s 1113s tests/test_setup.py:849: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-87/test_setup_inputs0') 1113s setup_args = ['build'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-87/test_setup_inputs0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ________________________ test_setup_inputs[0-0-0-1-1-0] ________________________ 1113s 1113s has_cmake_package = 0, has_cmake_module = 1, has_hybrid_package = 1 1113s has_pure_package = 0, has_pure_module = 0, with_package_base = 0 1113s mocker = 1113s 1113s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 1113s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 1113s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_module", [0, 1]) 1113s @pytest.mark.parametrize("with_package_base", [0, 1]) 1113s def test_setup_inputs( 1113s has_cmake_package, 1113s has_cmake_module, 1113s has_hybrid_package, 1113s has_pure_package, 1113s has_pure_module, 1113s with_package_base, 1113s mocker, 1113s ): 1113s """This test that a project can have a package with some modules 1113s installed using setup.py and some other modules installed using CMake. 1113s """ 1113s 1113s tmp_dir = _tmpdir("test_setup_inputs") 1113s 1113s package_base = "to/the/base" if with_package_base else "" 1113s package_base_dir = package_base + "/" if package_base else "" 1113s cmake_source_dir = package_base 1113s 1113s if cmake_source_dir and (has_cmake_package or has_cmake_module): 1113s pytest.skip( 1113s "unsupported configuration: " 1113s "python package fully generated by CMake does *NOT* work. " 1113s "At least __init__.py should be in the project source tree" 1113s ) 1113s 1113s # ------------------------------------------------------------------------- 1113s # Here is the "SOURCE" tree layout: 1113s # 1113s # ROOT/ 1113s # 1113s # setup.py 1113s # 1113s # [/] 1113s # 1113s # pureModule.py 1113s # 1113s # pure/ 1113s # __init__.py 1113s # pure.py 1113s # 1113s # data/ 1113s # pure.dat 1113s # 1113s # [/] 1113s # 1113s # hybrid/ 1113s # CMakeLists.txt 1113s # __init__.py 1113s # hybrid_pure.dat 1113s # hybrid_pure.py 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat 1113s # 1113s # hybrid_2/ 1113s # __init__.py 1113s # hybrid_2_pure.py 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py 1113s # hybrid_2_pure_1.py 1113s # hybrid_2_pure_2.py 1113s # 1113s # 1113s # ------------------------------------------------------------------------- 1113s # and here is the "BINARY" distribution layout: 1113s # 1113s # The comment "CMake" or "Setuptools" indicates which tool is responsible 1113s # for placing the file in the tree used to create the binary distribution. 1113s # 1113s # ROOT/ 1113s # 1113s # cmakeModule.py # CMake 1113s # 1113s # cmake/ 1113s # __init__.py # CMake 1113s # cmake.py # CMake 1113s # 1113s # hybrid/ 1113s # hybrid_cmake.dat # CMake 1113s # hybrid_cmake.py # CMake 1113s # hybrid_pure.dat # Setuptools 1113s # hybrid_pure.py # Setuptools 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat # CMake or Setuptools 1113s # hybrid_data_cmake.dat # CMake *NO TEST* 1113s # 1113s # hybrid_2/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure.py # CMake or Setuptools 1113s # hybrid_2_cmake.py # CMake 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure_1.py # CMake or Setuptools 1113s # hybrid_2_pure_2.py # CMake or Setuptools 1113s # 1113s # pureModule.py # Setuptools 1113s # 1113s # pure/ 1113s # __init__.py # Setuptools 1113s # pure.py # Setuptools 1113s # 1113s # data/ 1113s # pure.dat # Setuptools 1113s 1113s tmp_dir.join("setup.py").write( 1113s textwrap.dedent( 1113s """ 1113s from skbuild import setup 1113s #from setuptools import setup 1113s setup( 1113s name="test_hybrid_project", 1113s version="1.2.3", 1113s description=("an hybrid package mixing files installed by both " 1113s "CMake and setuptools"), 1113s author='The scikit-build team', 1113s license="MIT", 1113s cmake_source_dir='{cmake_source_dir}', 1113s cmake_install_dir='{cmake_install_dir}', 1113s # Arbitrary order of packages 1113s packages=[ 1113s {p_off} 'pure', 1113s {h_off} 'hybrid.hybrid_2', 1113s {h_off} 'hybrid', 1113s {c_off} 'cmake', 1113s {p_off} 'hybrid.hybrid_2_pure', 1113s ], 1113s py_modules=[ 1113s {pm_off} '{package_base}pureModule', 1113s {cm_off} '{package_base}cmakeModule', 1113s ], 1113s package_data={{ 1113s {p_off} 'pure': ['data/pure.dat'], 1113s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 1113s }}, 1113s # Arbitrary order of package_dir 1113s package_dir = {{ 1113s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 1113s {p_off} 'pure': '{package_base}pure', 1113s {h_off} 'hybrid': '{package_base}hybrid', 1113s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 1113s {c_off} 'cmake': '{package_base}cmake', 1113s }} 1113s ) 1113s """.format( 1113s cmake_source_dir=cmake_source_dir, 1113s cmake_install_dir=package_base, 1113s package_base=package_base_dir, 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s p_off="" if has_pure_package else "#", 1113s pm_off="" if has_pure_module else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s src_dir = tmp_dir.ensure(package_base, dir=1) 1113s 1113s src_dir.join("CMakeLists.txt").write( 1113s textwrap.dedent( 1113s """ 1113s cmake_minimum_required(VERSION 3.5.0) 1113s project(hybrid NONE) 1113s set(build_dir ${{CMAKE_BINARY_DIR}}) 1113s 1113s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 1113s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 1113s {c_off} install( 1113s {c_off} FILES 1113s {c_off} ${{build_dir}}/__init__.py 1113s {c_off} ${{build_dir}}/cmake.py 1113s {c_off} DESTINATION cmake 1113s {c_off} ) 1113s 1113s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 1113s {cm_off} install( 1113s {cm_off} FILES ${{build_dir}}/cmakeModule.py 1113s {cm_off} DESTINATION .) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 1113s {h_off} DESTINATION hybrid/data) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 1113s {h_off} DESTINATION hybrid/hybrid_2) 1113s 1113s install(CODE "message(STATUS \\\"Installation complete\\\")") 1113s """.format( 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 1113s path_types: Sequence[str] 1113s try: 1113s path_types = next( 1113s iter( 1113s zip( 1113s *filter( 1113s lambda i: i[1], 1113s [ 1113s ("c", has_cmake_package), 1113s ("cm", has_cmake_module), 1113s ("h", has_hybrid_package), 1113s ("p", has_pure_package), 1113s ("pm", has_pure_module), 1113s ], 1113s ) 1113s ) 1113s ) 1113s ) 1113s except StopIteration: 1113s path_types = [] 1113s 1113s def select_paths(annotated_paths): 1113s """Return a filtered list paths considering ``path_types``. 1113s 1113s `annotated_paths`` is list of tuple ``(type, path)`` where type 1113s is either `c`, 'cm', `h`, `p` or 'pm'. 1113s 1113s """ 1113s return filter(lambda i: i[0] in path_types, annotated_paths) 1113s 1113s # Commented paths are the one expected to be installed by CMake. For 1113s # this reason, corresponding files should NOT be created in the source 1113s # tree. 1113s for _type, path in select_paths( 1113s [ 1113s # ('c', 'cmake/__init__.py'), 1113s # ('c', 'cmake/cmake.py'), 1113s # ('cm', 'cmakeModule.py'), 1113s ("h", "hybrid/__init__.py"), 1113s # ('h', 'hybrid/hybrid_cmake.dat'), 1113s # ('h', 'hybrid/hybrid_cmake.py'), 1113s ("h", "hybrid/hybrid_pure.dat"), 1113s ("h", "hybrid/hybrid_pure.py"), 1113s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 1113s ("h", "hybrid/data/hybrid_data_pure.dat"), 1113s ("h", "hybrid/hybrid_2/__init__.py"), 1113s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 1113s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 1113s ("p", "hybrid/hybrid_2_pure/__init__.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 1113s ("pm", "pureModule.py"), 1113s ("p", "pure/__init__.py"), 1113s ("p", "pure/pure.py"), 1113s ("p", "pure/data/pure.dat"), 1113s ] 1113s ): 1113s assert _type in {"p", "pm", "h"} 1113s root = package_base if _type in {"p", "pm"} else cmake_source_dir 1113s tmp_dir.ensure(os.path.join(root, path)) 1113s 1113s # Do not call the real setup function. Instead, replace it with 1113s # a MagicMock allowing to check with which arguments it was invoked. 1113s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 1113s 1113s # Convenience print function 1113s def _pprint(desc, value=None): 1113s print( 1113s "-----------------\n" 1113s f"{desc}:\n" 1113s "\n" 1113s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 1113s ) 1113s 1113s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 1113s 1113s _pprint = ._pprint at 0xf726240f25c0> 1113s _type = 'h' 1113s cmake_source_dir = '' 1113s has_cmake_module = 1 1113s has_cmake_package = 0 1113s has_hybrid_package = 1 1113s has_pure_module = 0 1113s has_pure_package = 0 1113s mock_setup = 1113s mocker = 1113s package_base = '' 1113s package_base_dir = '' 1113s path = 'hybrid/hybrid_2/hybrid_2_pure.py' 1113s path_types = ('cm', 'h') 1113s root = '' 1113s select_paths = .select_paths at 0xf726240f2200> 1113s src_dir = local('/tmp/pytest-of-ubuntu/pytest-88/test_setup_inputs0') 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-88/test_setup_inputs0') 1113s with_package_base = 0 1113s 1113s tests/test_setup.py:849: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-88/test_setup_inputs0') 1113s setup_args = ['build'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-88/test_setup_inputs0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ________________________ test_setup_inputs[0-0-0-1-1-1] ________________________ 1113s 1113s has_cmake_package = 1, has_cmake_module = 1, has_hybrid_package = 1 1113s has_pure_package = 0, has_pure_module = 0, with_package_base = 0 1113s mocker = 1113s 1113s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 1113s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 1113s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_module", [0, 1]) 1113s @pytest.mark.parametrize("with_package_base", [0, 1]) 1113s def test_setup_inputs( 1113s has_cmake_package, 1113s has_cmake_module, 1113s has_hybrid_package, 1113s has_pure_package, 1113s has_pure_module, 1113s with_package_base, 1113s mocker, 1113s ): 1113s """This test that a project can have a package with some modules 1113s installed using setup.py and some other modules installed using CMake. 1113s """ 1113s 1113s tmp_dir = _tmpdir("test_setup_inputs") 1113s 1113s package_base = "to/the/base" if with_package_base else "" 1113s package_base_dir = package_base + "/" if package_base else "" 1113s cmake_source_dir = package_base 1113s 1113s if cmake_source_dir and (has_cmake_package or has_cmake_module): 1113s pytest.skip( 1113s "unsupported configuration: " 1113s "python package fully generated by CMake does *NOT* work. " 1113s "At least __init__.py should be in the project source tree" 1113s ) 1113s 1113s # ------------------------------------------------------------------------- 1113s # Here is the "SOURCE" tree layout: 1113s # 1113s # ROOT/ 1113s # 1113s # setup.py 1113s # 1113s # [/] 1113s # 1113s # pureModule.py 1113s # 1113s # pure/ 1113s # __init__.py 1113s # pure.py 1113s # 1113s # data/ 1113s # pure.dat 1113s # 1113s # [/] 1113s # 1113s # hybrid/ 1113s # CMakeLists.txt 1113s # __init__.py 1113s # hybrid_pure.dat 1113s # hybrid_pure.py 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat 1113s # 1113s # hybrid_2/ 1113s # __init__.py 1113s # hybrid_2_pure.py 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py 1113s # hybrid_2_pure_1.py 1113s # hybrid_2_pure_2.py 1113s # 1113s # 1113s # ------------------------------------------------------------------------- 1113s # and here is the "BINARY" distribution layout: 1113s # 1113s # The comment "CMake" or "Setuptools" indicates which tool is responsible 1113s # for placing the file in the tree used to create the binary distribution. 1113s # 1113s # ROOT/ 1113s # 1113s # cmakeModule.py # CMake 1113s # 1113s # cmake/ 1113s # __init__.py # CMake 1113s # cmake.py # CMake 1113s # 1113s # hybrid/ 1113s # hybrid_cmake.dat # CMake 1113s # hybrid_cmake.py # CMake 1113s # hybrid_pure.dat # Setuptools 1113s # hybrid_pure.py # Setuptools 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat # CMake or Setuptools 1113s # hybrid_data_cmake.dat # CMake *NO TEST* 1113s # 1113s # hybrid_2/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure.py # CMake or Setuptools 1113s # hybrid_2_cmake.py # CMake 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure_1.py # CMake or Setuptools 1113s # hybrid_2_pure_2.py # CMake or Setuptools 1113s # 1113s # pureModule.py # Setuptools 1113s # 1113s # pure/ 1113s # __init__.py # Setuptools 1113s # pure.py # Setuptools 1113s # 1113s # data/ 1113s # pure.dat # Setuptools 1113s 1113s tmp_dir.join("setup.py").write( 1113s textwrap.dedent( 1113s """ 1113s from skbuild import setup 1113s #from setuptools import setup 1113s setup( 1113s name="test_hybrid_project", 1113s version="1.2.3", 1113s description=("an hybrid package mixing files installed by both " 1113s "CMake and setuptools"), 1113s author='The scikit-build team', 1113s license="MIT", 1113s cmake_source_dir='{cmake_source_dir}', 1113s cmake_install_dir='{cmake_install_dir}', 1113s # Arbitrary order of packages 1113s packages=[ 1113s {p_off} 'pure', 1113s {h_off} 'hybrid.hybrid_2', 1113s {h_off} 'hybrid', 1113s {c_off} 'cmake', 1113s {p_off} 'hybrid.hybrid_2_pure', 1113s ], 1113s py_modules=[ 1113s {pm_off} '{package_base}pureModule', 1113s {cm_off} '{package_base}cmakeModule', 1113s ], 1113s package_data={{ 1113s {p_off} 'pure': ['data/pure.dat'], 1113s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 1113s }}, 1113s # Arbitrary order of package_dir 1113s package_dir = {{ 1113s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 1113s {p_off} 'pure': '{package_base}pure', 1113s {h_off} 'hybrid': '{package_base}hybrid', 1113s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 1113s {c_off} 'cmake': '{package_base}cmake', 1113s }} 1113s ) 1113s """.format( 1113s cmake_source_dir=cmake_source_dir, 1113s cmake_install_dir=package_base, 1113s package_base=package_base_dir, 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s p_off="" if has_pure_package else "#", 1113s pm_off="" if has_pure_module else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s src_dir = tmp_dir.ensure(package_base, dir=1) 1113s 1113s src_dir.join("CMakeLists.txt").write( 1113s textwrap.dedent( 1113s """ 1113s cmake_minimum_required(VERSION 3.5.0) 1113s project(hybrid NONE) 1113s set(build_dir ${{CMAKE_BINARY_DIR}}) 1113s 1113s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 1113s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 1113s {c_off} install( 1113s {c_off} FILES 1113s {c_off} ${{build_dir}}/__init__.py 1113s {c_off} ${{build_dir}}/cmake.py 1113s {c_off} DESTINATION cmake 1113s {c_off} ) 1113s 1113s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 1113s {cm_off} install( 1113s {cm_off} FILES ${{build_dir}}/cmakeModule.py 1113s {cm_off} DESTINATION .) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 1113s {h_off} DESTINATION hybrid/data) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 1113s {h_off} DESTINATION hybrid/hybrid_2) 1113s 1113s install(CODE "message(STATUS \\\"Installation complete\\\")") 1113s """.format( 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 1113s path_types: Sequence[str] 1113s try: 1113s path_types = next( 1113s iter( 1113s zip( 1113s *filter( 1113s lambda i: i[1], 1113s [ 1113s ("c", has_cmake_package), 1113s ("cm", has_cmake_module), 1113s ("h", has_hybrid_package), 1113s ("p", has_pure_package), 1113s ("pm", has_pure_module), 1113s ], 1113s ) 1113s ) 1113s ) 1113s ) 1113s except StopIteration: 1113s path_types = [] 1113s 1113s def select_paths(annotated_paths): 1113s """Return a filtered list paths considering ``path_types``. 1113s 1113s `annotated_paths`` is list of tuple ``(type, path)`` where type 1113s is either `c`, 'cm', `h`, `p` or 'pm'. 1113s 1113s """ 1113s return filter(lambda i: i[0] in path_types, annotated_paths) 1113s 1113s # Commented paths are the one expected to be installed by CMake. For 1113s # this reason, corresponding files should NOT be created in the source 1113s # tree. 1113s for _type, path in select_paths( 1113s [ 1113s # ('c', 'cmake/__init__.py'), 1113s # ('c', 'cmake/cmake.py'), 1113s # ('cm', 'cmakeModule.py'), 1113s ("h", "hybrid/__init__.py"), 1113s # ('h', 'hybrid/hybrid_cmake.dat'), 1113s # ('h', 'hybrid/hybrid_cmake.py'), 1113s ("h", "hybrid/hybrid_pure.dat"), 1113s ("h", "hybrid/hybrid_pure.py"), 1113s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 1113s ("h", "hybrid/data/hybrid_data_pure.dat"), 1113s ("h", "hybrid/hybrid_2/__init__.py"), 1113s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 1113s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 1113s ("p", "hybrid/hybrid_2_pure/__init__.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 1113s ("pm", "pureModule.py"), 1113s ("p", "pure/__init__.py"), 1113s ("p", "pure/pure.py"), 1113s ("p", "pure/data/pure.dat"), 1113s ] 1113s ): 1113s assert _type in {"p", "pm", "h"} 1113s root = package_base if _type in {"p", "pm"} else cmake_source_dir 1113s tmp_dir.ensure(os.path.join(root, path)) 1113s 1113s # Do not call the real setup function. Instead, replace it with 1113s # a MagicMock allowing to check with which arguments it was invoked. 1113s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 1113s 1113s # Convenience print function 1113s def _pprint(desc, value=None): 1113s print( 1113s "-----------------\n" 1113s f"{desc}:\n" 1113s "\n" 1113s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 1113s ) 1113s 1113s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 1113s 1113s _pprint = ._pprint at 0xf726240f0540> 1113s _type = 'h' 1113s cmake_source_dir = '' 1113s has_cmake_module = 1 1113s has_cmake_package = 1 1113s has_hybrid_package = 1 1113s has_pure_module = 0 1113s has_pure_package = 0 1113s mock_setup = 1113s mocker = 1113s package_base = '' 1113s package_base_dir = '' 1113s path = 'hybrid/hybrid_2/hybrid_2_pure.py' 1113s path_types = ('c', 'cm', 'h') 1113s root = '' 1113s select_paths = .select_paths at 0xf726240f1e40> 1113s src_dir = local('/tmp/pytest-of-ubuntu/pytest-89/test_setup_inputs0') 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-89/test_setup_inputs0') 1113s with_package_base = 0 1113s 1113s tests/test_setup.py:849: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-89/test_setup_inputs0') 1113s setup_args = ['build'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-89/test_setup_inputs0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ________________________ test_setup_inputs[0-0-1-0-0-0] ________________________ 1113s 1113s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 0 1113s has_pure_package = 1, has_pure_module = 0, with_package_base = 0 1113s mocker = 1113s 1113s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 1113s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 1113s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_module", [0, 1]) 1113s @pytest.mark.parametrize("with_package_base", [0, 1]) 1113s def test_setup_inputs( 1113s has_cmake_package, 1113s has_cmake_module, 1113s has_hybrid_package, 1113s has_pure_package, 1113s has_pure_module, 1113s with_package_base, 1113s mocker, 1113s ): 1113s """This test that a project can have a package with some modules 1113s installed using setup.py and some other modules installed using CMake. 1113s """ 1113s 1113s tmp_dir = _tmpdir("test_setup_inputs") 1113s 1113s package_base = "to/the/base" if with_package_base else "" 1113s package_base_dir = package_base + "/" if package_base else "" 1113s cmake_source_dir = package_base 1113s 1113s if cmake_source_dir and (has_cmake_package or has_cmake_module): 1113s pytest.skip( 1113s "unsupported configuration: " 1113s "python package fully generated by CMake does *NOT* work. " 1113s "At least __init__.py should be in the project source tree" 1113s ) 1113s 1113s # ------------------------------------------------------------------------- 1113s # Here is the "SOURCE" tree layout: 1113s # 1113s # ROOT/ 1113s # 1113s # setup.py 1113s # 1113s # [/] 1113s # 1113s # pureModule.py 1113s # 1113s # pure/ 1113s # __init__.py 1113s # pure.py 1113s # 1113s # data/ 1113s # pure.dat 1113s # 1113s # [/] 1113s # 1113s # hybrid/ 1113s # CMakeLists.txt 1113s # __init__.py 1113s # hybrid_pure.dat 1113s # hybrid_pure.py 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat 1113s # 1113s # hybrid_2/ 1113s # __init__.py 1113s # hybrid_2_pure.py 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py 1113s # hybrid_2_pure_1.py 1113s # hybrid_2_pure_2.py 1113s # 1113s # 1113s # ------------------------------------------------------------------------- 1113s # and here is the "BINARY" distribution layout: 1113s # 1113s # The comment "CMake" or "Setuptools" indicates which tool is responsible 1113s # for placing the file in the tree used to create the binary distribution. 1113s # 1113s # ROOT/ 1113s # 1113s # cmakeModule.py # CMake 1113s # 1113s # cmake/ 1113s # __init__.py # CMake 1113s # cmake.py # CMake 1113s # 1113s # hybrid/ 1113s # hybrid_cmake.dat # CMake 1113s # hybrid_cmake.py # CMake 1113s # hybrid_pure.dat # Setuptools 1113s # hybrid_pure.py # Setuptools 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat # CMake or Setuptools 1113s # hybrid_data_cmake.dat # CMake *NO TEST* 1113s # 1113s # hybrid_2/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure.py # CMake or Setuptools 1113s # hybrid_2_cmake.py # CMake 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure_1.py # CMake or Setuptools 1113s # hybrid_2_pure_2.py # CMake or Setuptools 1113s # 1113s # pureModule.py # Setuptools 1113s # 1113s # pure/ 1113s # __init__.py # Setuptools 1113s # pure.py # Setuptools 1113s # 1113s # data/ 1113s # pure.dat # Setuptools 1113s 1113s tmp_dir.join("setup.py").write( 1113s textwrap.dedent( 1113s """ 1113s from skbuild import setup 1113s #from setuptools import setup 1113s setup( 1113s name="test_hybrid_project", 1113s version="1.2.3", 1113s description=("an hybrid package mixing files installed by both " 1113s "CMake and setuptools"), 1113s author='The scikit-build team', 1113s license="MIT", 1113s cmake_source_dir='{cmake_source_dir}', 1113s cmake_install_dir='{cmake_install_dir}', 1113s # Arbitrary order of packages 1113s packages=[ 1113s {p_off} 'pure', 1113s {h_off} 'hybrid.hybrid_2', 1113s {h_off} 'hybrid', 1113s {c_off} 'cmake', 1113s {p_off} 'hybrid.hybrid_2_pure', 1113s ], 1113s py_modules=[ 1113s {pm_off} '{package_base}pureModule', 1113s {cm_off} '{package_base}cmakeModule', 1113s ], 1113s package_data={{ 1113s {p_off} 'pure': ['data/pure.dat'], 1113s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 1113s }}, 1113s # Arbitrary order of package_dir 1113s package_dir = {{ 1113s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 1113s {p_off} 'pure': '{package_base}pure', 1113s {h_off} 'hybrid': '{package_base}hybrid', 1113s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 1113s {c_off} 'cmake': '{package_base}cmake', 1113s }} 1113s ) 1113s """.format( 1113s cmake_source_dir=cmake_source_dir, 1113s cmake_install_dir=package_base, 1113s package_base=package_base_dir, 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s p_off="" if has_pure_package else "#", 1113s pm_off="" if has_pure_module else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s src_dir = tmp_dir.ensure(package_base, dir=1) 1113s 1113s src_dir.join("CMakeLists.txt").write( 1113s textwrap.dedent( 1113s """ 1113s cmake_minimum_required(VERSION 3.5.0) 1113s project(hybrid NONE) 1113s set(build_dir ${{CMAKE_BINARY_DIR}}) 1113s 1113s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 1113s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 1113s {c_off} install( 1113s {c_off} FILES 1113s {c_off} ${{build_dir}}/__init__.py 1113s {c_off} ${{build_dir}}/cmake.py 1113s {c_off} DESTINATION cmake 1113s {c_off} ) 1113s 1113s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 1113s {cm_off} install( 1113s {cm_off} FILES ${{build_dir}}/cmakeModule.py 1113s {cm_off} DESTINATION .) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 1113s {h_off} DESTINATION hybrid/data) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 1113s {h_off} DESTINATION hybrid/hybrid_2) 1113s 1113s install(CODE "message(STATUS \\\"Installation complete\\\")") 1113s """.format( 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 1113s path_types: Sequence[str] 1113s try: 1113s path_types = next( 1113s iter( 1113s zip( 1113s *filter( 1113s lambda i: i[1], 1113s [ 1113s ("c", has_cmake_package), 1113s ("cm", has_cmake_module), 1113s ("h", has_hybrid_package), 1113s ("p", has_pure_package), 1113s ("pm", has_pure_module), 1113s ], 1113s ) 1113s ) 1113s ) 1113s ) 1113s except StopIteration: 1113s path_types = [] 1113s 1113s def select_paths(annotated_paths): 1113s """Return a filtered list paths considering ``path_types``. 1113s 1113s `annotated_paths`` is list of tuple ``(type, path)`` where type 1113s is either `c`, 'cm', `h`, `p` or 'pm'. 1113s 1113s """ 1113s return filter(lambda i: i[0] in path_types, annotated_paths) 1113s 1113s # Commented paths are the one expected to be installed by CMake. For 1113s # this reason, corresponding files should NOT be created in the source 1113s # tree. 1113s for _type, path in select_paths( 1113s [ 1113s # ('c', 'cmake/__init__.py'), 1113s # ('c', 'cmake/cmake.py'), 1113s # ('cm', 'cmakeModule.py'), 1113s ("h", "hybrid/__init__.py"), 1113s # ('h', 'hybrid/hybrid_cmake.dat'), 1113s # ('h', 'hybrid/hybrid_cmake.py'), 1113s ("h", "hybrid/hybrid_pure.dat"), 1113s ("h", "hybrid/hybrid_pure.py"), 1113s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 1113s ("h", "hybrid/data/hybrid_data_pure.dat"), 1113s ("h", "hybrid/hybrid_2/__init__.py"), 1113s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 1113s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 1113s ("p", "hybrid/hybrid_2_pure/__init__.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 1113s ("pm", "pureModule.py"), 1113s ("p", "pure/__init__.py"), 1113s ("p", "pure/pure.py"), 1113s ("p", "pure/data/pure.dat"), 1113s ] 1113s ): 1113s assert _type in {"p", "pm", "h"} 1113s root = package_base if _type in {"p", "pm"} else cmake_source_dir 1113s tmp_dir.ensure(os.path.join(root, path)) 1113s 1113s # Do not call the real setup function. Instead, replace it with 1113s # a MagicMock allowing to check with which arguments it was invoked. 1113s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 1113s 1113s # Convenience print function 1113s def _pprint(desc, value=None): 1113s print( 1113s "-----------------\n" 1113s f"{desc}:\n" 1113s "\n" 1113s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 1113s ) 1113s 1113s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 1113s 1113s _pprint = ._pprint at 0xf726240f0f40> 1113s _type = 'p' 1113s cmake_source_dir = '' 1113s has_cmake_module = 0 1113s has_cmake_package = 0 1113s has_hybrid_package = 0 1113s has_pure_module = 0 1113s has_pure_package = 1 1113s mock_setup = 1113s mocker = 1113s package_base = '' 1113s package_base_dir = '' 1113s path = 'pure/data/pure.dat' 1113s path_types = ('p',) 1113s root = '' 1113s select_paths = .select_paths at 0xf726240f1760> 1113s src_dir = local('/tmp/pytest-of-ubuntu/pytest-90/test_setup_inputs0') 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-90/test_setup_inputs0') 1113s with_package_base = 0 1113s 1113s tests/test_setup.py:849: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-90/test_setup_inputs0') 1113s setup_args = ['build'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-90/test_setup_inputs0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ________________________ test_setup_inputs[0-0-1-0-0-1] ________________________ 1113s 1113s has_cmake_package = 1, has_cmake_module = 0, has_hybrid_package = 0 1113s has_pure_package = 1, has_pure_module = 0, with_package_base = 0 1113s mocker = 1113s 1113s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 1113s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 1113s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_module", [0, 1]) 1113s @pytest.mark.parametrize("with_package_base", [0, 1]) 1113s def test_setup_inputs( 1113s has_cmake_package, 1113s has_cmake_module, 1113s has_hybrid_package, 1113s has_pure_package, 1113s has_pure_module, 1113s with_package_base, 1113s mocker, 1113s ): 1113s """This test that a project can have a package with some modules 1113s installed using setup.py and some other modules installed using CMake. 1113s """ 1113s 1113s tmp_dir = _tmpdir("test_setup_inputs") 1113s 1113s package_base = "to/the/base" if with_package_base else "" 1113s package_base_dir = package_base + "/" if package_base else "" 1113s cmake_source_dir = package_base 1113s 1113s if cmake_source_dir and (has_cmake_package or has_cmake_module): 1113s pytest.skip( 1113s "unsupported configuration: " 1113s "python package fully generated by CMake does *NOT* work. " 1113s "At least __init__.py should be in the project source tree" 1113s ) 1113s 1113s # ------------------------------------------------------------------------- 1113s # Here is the "SOURCE" tree layout: 1113s # 1113s # ROOT/ 1113s # 1113s # setup.py 1113s # 1113s # [/] 1113s # 1113s # pureModule.py 1113s # 1113s # pure/ 1113s # __init__.py 1113s # pure.py 1113s # 1113s # data/ 1113s # pure.dat 1113s # 1113s # [/] 1113s # 1113s # hybrid/ 1113s # CMakeLists.txt 1113s # __init__.py 1113s # hybrid_pure.dat 1113s # hybrid_pure.py 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat 1113s # 1113s # hybrid_2/ 1113s # __init__.py 1113s # hybrid_2_pure.py 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py 1113s # hybrid_2_pure_1.py 1113s # hybrid_2_pure_2.py 1113s # 1113s # 1113s # ------------------------------------------------------------------------- 1113s # and here is the "BINARY" distribution layout: 1113s # 1113s # The comment "CMake" or "Setuptools" indicates which tool is responsible 1113s # for placing the file in the tree used to create the binary distribution. 1113s # 1113s # ROOT/ 1113s # 1113s # cmakeModule.py # CMake 1113s # 1113s # cmake/ 1113s # __init__.py # CMake 1113s # cmake.py # CMake 1113s # 1113s # hybrid/ 1113s # hybrid_cmake.dat # CMake 1113s # hybrid_cmake.py # CMake 1113s # hybrid_pure.dat # Setuptools 1113s # hybrid_pure.py # Setuptools 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat # CMake or Setuptools 1113s # hybrid_data_cmake.dat # CMake *NO TEST* 1113s # 1113s # hybrid_2/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure.py # CMake or Setuptools 1113s # hybrid_2_cmake.py # CMake 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure_1.py # CMake or Setuptools 1113s # hybrid_2_pure_2.py # CMake or Setuptools 1113s # 1113s # pureModule.py # Setuptools 1113s # 1113s # pure/ 1113s # __init__.py # Setuptools 1113s # pure.py # Setuptools 1113s # 1113s # data/ 1113s # pure.dat # Setuptools 1113s 1113s tmp_dir.join("setup.py").write( 1113s textwrap.dedent( 1113s """ 1113s from skbuild import setup 1113s #from setuptools import setup 1113s setup( 1113s name="test_hybrid_project", 1113s version="1.2.3", 1113s description=("an hybrid package mixing files installed by both " 1113s "CMake and setuptools"), 1113s author='The scikit-build team', 1113s license="MIT", 1113s cmake_source_dir='{cmake_source_dir}', 1113s cmake_install_dir='{cmake_install_dir}', 1113s # Arbitrary order of packages 1113s packages=[ 1113s {p_off} 'pure', 1113s {h_off} 'hybrid.hybrid_2', 1113s {h_off} 'hybrid', 1113s {c_off} 'cmake', 1113s {p_off} 'hybrid.hybrid_2_pure', 1113s ], 1113s py_modules=[ 1113s {pm_off} '{package_base}pureModule', 1113s {cm_off} '{package_base}cmakeModule', 1113s ], 1113s package_data={{ 1113s {p_off} 'pure': ['data/pure.dat'], 1113s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 1113s }}, 1113s # Arbitrary order of package_dir 1113s package_dir = {{ 1113s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 1113s {p_off} 'pure': '{package_base}pure', 1113s {h_off} 'hybrid': '{package_base}hybrid', 1113s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 1113s {c_off} 'cmake': '{package_base}cmake', 1113s }} 1113s ) 1113s """.format( 1113s cmake_source_dir=cmake_source_dir, 1113s cmake_install_dir=package_base, 1113s package_base=package_base_dir, 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s p_off="" if has_pure_package else "#", 1113s pm_off="" if has_pure_module else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s src_dir = tmp_dir.ensure(package_base, dir=1) 1113s 1113s src_dir.join("CMakeLists.txt").write( 1113s textwrap.dedent( 1113s """ 1113s cmake_minimum_required(VERSION 3.5.0) 1113s project(hybrid NONE) 1113s set(build_dir ${{CMAKE_BINARY_DIR}}) 1113s 1113s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 1113s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 1113s {c_off} install( 1113s {c_off} FILES 1113s {c_off} ${{build_dir}}/__init__.py 1113s {c_off} ${{build_dir}}/cmake.py 1113s {c_off} DESTINATION cmake 1113s {c_off} ) 1113s 1113s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 1113s {cm_off} install( 1113s {cm_off} FILES ${{build_dir}}/cmakeModule.py 1113s {cm_off} DESTINATION .) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 1113s {h_off} DESTINATION hybrid/data) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 1113s {h_off} DESTINATION hybrid/hybrid_2) 1113s 1113s install(CODE "message(STATUS \\\"Installation complete\\\")") 1113s """.format( 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 1113s path_types: Sequence[str] 1113s try: 1113s path_types = next( 1113s iter( 1113s zip( 1113s *filter( 1113s lambda i: i[1], 1113s [ 1113s ("c", has_cmake_package), 1113s ("cm", has_cmake_module), 1113s ("h", has_hybrid_package), 1113s ("p", has_pure_package), 1113s ("pm", has_pure_module), 1113s ], 1113s ) 1113s ) 1113s ) 1113s ) 1113s except StopIteration: 1113s path_types = [] 1113s 1113s def select_paths(annotated_paths): 1113s """Return a filtered list paths considering ``path_types``. 1113s 1113s `annotated_paths`` is list of tuple ``(type, path)`` where type 1113s is either `c`, 'cm', `h`, `p` or 'pm'. 1113s 1113s """ 1113s return filter(lambda i: i[0] in path_types, annotated_paths) 1113s 1113s # Commented paths are the one expected to be installed by CMake. For 1113s # this reason, corresponding files should NOT be created in the source 1113s # tree. 1113s for _type, path in select_paths( 1113s [ 1113s # ('c', 'cmake/__init__.py'), 1113s # ('c', 'cmake/cmake.py'), 1113s # ('cm', 'cmakeModule.py'), 1113s ("h", "hybrid/__init__.py"), 1113s # ('h', 'hybrid/hybrid_cmake.dat'), 1113s # ('h', 'hybrid/hybrid_cmake.py'), 1113s ("h", "hybrid/hybrid_pure.dat"), 1113s ("h", "hybrid/hybrid_pure.py"), 1113s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 1113s ("h", "hybrid/data/hybrid_data_pure.dat"), 1113s ("h", "hybrid/hybrid_2/__init__.py"), 1113s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 1113s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 1113s ("p", "hybrid/hybrid_2_pure/__init__.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 1113s ("pm", "pureModule.py"), 1113s ("p", "pure/__init__.py"), 1113s ("p", "pure/pure.py"), 1113s ("p", "pure/data/pure.dat"), 1113s ] 1113s ): 1113s assert _type in {"p", "pm", "h"} 1113s root = package_base if _type in {"p", "pm"} else cmake_source_dir 1113s tmp_dir.ensure(os.path.join(root, path)) 1113s 1113s # Do not call the real setup function. Instead, replace it with 1113s # a MagicMock allowing to check with which arguments it was invoked. 1113s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 1113s 1113s # Convenience print function 1113s def _pprint(desc, value=None): 1113s print( 1113s "-----------------\n" 1113s f"{desc}:\n" 1113s "\n" 1113s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 1113s ) 1113s 1113s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 1113s 1113s _pprint = ._pprint at 0xf72624163560> 1113s _type = 'p' 1113s cmake_source_dir = '' 1113s has_cmake_module = 0 1113s has_cmake_package = 1 1113s has_hybrid_package = 0 1113s has_pure_module = 0 1113s has_pure_package = 1 1113s mock_setup = 1113s mocker = 1113s package_base = '' 1113s package_base_dir = '' 1113s path = 'pure/data/pure.dat' 1113s path_types = ('c', 'p') 1113s root = '' 1113s select_paths = .select_paths at 0xf726242eaf20> 1113s src_dir = local('/tmp/pytest-of-ubuntu/pytest-91/test_setup_inputs0') 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-91/test_setup_inputs0') 1113s with_package_base = 0 1113s 1113s tests/test_setup.py:849: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-91/test_setup_inputs0') 1113s setup_args = ['build'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-91/test_setup_inputs0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ________________________ test_setup_inputs[0-0-1-0-1-0] ________________________ 1113s 1113s has_cmake_package = 0, has_cmake_module = 1, has_hybrid_package = 0 1113s has_pure_package = 1, has_pure_module = 0, with_package_base = 0 1113s mocker = 1113s 1113s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 1113s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 1113s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_module", [0, 1]) 1113s @pytest.mark.parametrize("with_package_base", [0, 1]) 1113s def test_setup_inputs( 1113s has_cmake_package, 1113s has_cmake_module, 1113s has_hybrid_package, 1113s has_pure_package, 1113s has_pure_module, 1113s with_package_base, 1113s mocker, 1113s ): 1113s """This test that a project can have a package with some modules 1113s installed using setup.py and some other modules installed using CMake. 1113s """ 1113s 1113s tmp_dir = _tmpdir("test_setup_inputs") 1113s 1113s package_base = "to/the/base" if with_package_base else "" 1113s package_base_dir = package_base + "/" if package_base else "" 1113s cmake_source_dir = package_base 1113s 1113s if cmake_source_dir and (has_cmake_package or has_cmake_module): 1113s pytest.skip( 1113s "unsupported configuration: " 1113s "python package fully generated by CMake does *NOT* work. " 1113s "At least __init__.py should be in the project source tree" 1113s ) 1113s 1113s # ------------------------------------------------------------------------- 1113s # Here is the "SOURCE" tree layout: 1113s # 1113s # ROOT/ 1113s # 1113s # setup.py 1113s # 1113s # [/] 1113s # 1113s # pureModule.py 1113s # 1113s # pure/ 1113s # __init__.py 1113s # pure.py 1113s # 1113s # data/ 1113s # pure.dat 1113s # 1113s # [/] 1113s # 1113s # hybrid/ 1113s # CMakeLists.txt 1113s # __init__.py 1113s # hybrid_pure.dat 1113s # hybrid_pure.py 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat 1113s # 1113s # hybrid_2/ 1113s # __init__.py 1113s # hybrid_2_pure.py 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py 1113s # hybrid_2_pure_1.py 1113s # hybrid_2_pure_2.py 1113s # 1113s # 1113s # ------------------------------------------------------------------------- 1113s # and here is the "BINARY" distribution layout: 1113s # 1113s # The comment "CMake" or "Setuptools" indicates which tool is responsible 1113s # for placing the file in the tree used to create the binary distribution. 1113s # 1113s # ROOT/ 1113s # 1113s # cmakeModule.py # CMake 1113s # 1113s # cmake/ 1113s # __init__.py # CMake 1113s # cmake.py # CMake 1113s # 1113s # hybrid/ 1113s # hybrid_cmake.dat # CMake 1113s # hybrid_cmake.py # CMake 1113s # hybrid_pure.dat # Setuptools 1113s # hybrid_pure.py # Setuptools 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat # CMake or Setuptools 1113s # hybrid_data_cmake.dat # CMake *NO TEST* 1113s # 1113s # hybrid_2/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure.py # CMake or Setuptools 1113s # hybrid_2_cmake.py # CMake 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure_1.py # CMake or Setuptools 1113s # hybrid_2_pure_2.py # CMake or Setuptools 1113s # 1113s # pureModule.py # Setuptools 1113s # 1113s # pure/ 1113s # __init__.py # Setuptools 1113s # pure.py # Setuptools 1113s # 1113s # data/ 1113s # pure.dat # Setuptools 1113s 1113s tmp_dir.join("setup.py").write( 1113s textwrap.dedent( 1113s """ 1113s from skbuild import setup 1113s #from setuptools import setup 1113s setup( 1113s name="test_hybrid_project", 1113s version="1.2.3", 1113s description=("an hybrid package mixing files installed by both " 1113s "CMake and setuptools"), 1113s author='The scikit-build team', 1113s license="MIT", 1113s cmake_source_dir='{cmake_source_dir}', 1113s cmake_install_dir='{cmake_install_dir}', 1113s # Arbitrary order of packages 1113s packages=[ 1113s {p_off} 'pure', 1113s {h_off} 'hybrid.hybrid_2', 1113s {h_off} 'hybrid', 1113s {c_off} 'cmake', 1113s {p_off} 'hybrid.hybrid_2_pure', 1113s ], 1113s py_modules=[ 1113s {pm_off} '{package_base}pureModule', 1113s {cm_off} '{package_base}cmakeModule', 1113s ], 1113s package_data={{ 1113s {p_off} 'pure': ['data/pure.dat'], 1113s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 1113s }}, 1113s # Arbitrary order of package_dir 1113s package_dir = {{ 1113s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 1113s {p_off} 'pure': '{package_base}pure', 1113s {h_off} 'hybrid': '{package_base}hybrid', 1113s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 1113s {c_off} 'cmake': '{package_base}cmake', 1113s }} 1113s ) 1113s """.format( 1113s cmake_source_dir=cmake_source_dir, 1113s cmake_install_dir=package_base, 1113s package_base=package_base_dir, 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s p_off="" if has_pure_package else "#", 1113s pm_off="" if has_pure_module else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s src_dir = tmp_dir.ensure(package_base, dir=1) 1113s 1113s src_dir.join("CMakeLists.txt").write( 1113s textwrap.dedent( 1113s """ 1113s cmake_minimum_required(VERSION 3.5.0) 1113s project(hybrid NONE) 1113s set(build_dir ${{CMAKE_BINARY_DIR}}) 1113s 1113s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 1113s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 1113s {c_off} install( 1113s {c_off} FILES 1113s {c_off} ${{build_dir}}/__init__.py 1113s {c_off} ${{build_dir}}/cmake.py 1113s {c_off} DESTINATION cmake 1113s {c_off} ) 1113s 1113s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 1113s {cm_off} install( 1113s {cm_off} FILES ${{build_dir}}/cmakeModule.py 1113s {cm_off} DESTINATION .) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 1113s {h_off} DESTINATION hybrid/data) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 1113s {h_off} DESTINATION hybrid/hybrid_2) 1113s 1113s install(CODE "message(STATUS \\\"Installation complete\\\")") 1113s """.format( 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 1113s path_types: Sequence[str] 1113s try: 1113s path_types = next( 1113s iter( 1113s zip( 1113s *filter( 1113s lambda i: i[1], 1113s [ 1113s ("c", has_cmake_package), 1113s ("cm", has_cmake_module), 1113s ("h", has_hybrid_package), 1113s ("p", has_pure_package), 1113s ("pm", has_pure_module), 1113s ], 1113s ) 1113s ) 1113s ) 1113s ) 1113s except StopIteration: 1113s path_types = [] 1113s 1113s def select_paths(annotated_paths): 1113s """Return a filtered list paths considering ``path_types``. 1113s 1113s `annotated_paths`` is list of tuple ``(type, path)`` where type 1113s is either `c`, 'cm', `h`, `p` or 'pm'. 1113s 1113s """ 1113s return filter(lambda i: i[0] in path_types, annotated_paths) 1113s 1113s # Commented paths are the one expected to be installed by CMake. For 1113s # this reason, corresponding files should NOT be created in the source 1113s # tree. 1113s for _type, path in select_paths( 1113s [ 1113s # ('c', 'cmake/__init__.py'), 1113s # ('c', 'cmake/cmake.py'), 1113s # ('cm', 'cmakeModule.py'), 1113s ("h", "hybrid/__init__.py"), 1113s # ('h', 'hybrid/hybrid_cmake.dat'), 1113s # ('h', 'hybrid/hybrid_cmake.py'), 1113s ("h", "hybrid/hybrid_pure.dat"), 1113s ("h", "hybrid/hybrid_pure.py"), 1113s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 1113s ("h", "hybrid/data/hybrid_data_pure.dat"), 1113s ("h", "hybrid/hybrid_2/__init__.py"), 1113s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 1113s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 1113s ("p", "hybrid/hybrid_2_pure/__init__.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 1113s ("pm", "pureModule.py"), 1113s ("p", "pure/__init__.py"), 1113s ("p", "pure/pure.py"), 1113s ("p", "pure/data/pure.dat"), 1113s ] 1113s ): 1113s assert _type in {"p", "pm", "h"} 1113s root = package_base if _type in {"p", "pm"} else cmake_source_dir 1113s tmp_dir.ensure(os.path.join(root, path)) 1113s 1113s # Do not call the real setup function. Instead, replace it with 1113s # a MagicMock allowing to check with which arguments it was invoked. 1113s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 1113s 1113s # Convenience print function 1113s def _pprint(desc, value=None): 1113s print( 1113s "-----------------\n" 1113s f"{desc}:\n" 1113s "\n" 1113s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 1113s ) 1113s 1113s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 1113s 1113s _pprint = ._pprint at 0xf726240f2700> 1113s _type = 'p' 1113s cmake_source_dir = '' 1113s has_cmake_module = 1 1113s has_cmake_package = 0 1113s has_hybrid_package = 0 1113s has_pure_module = 0 1113s has_pure_package = 1 1113s mock_setup = 1113s mocker = 1113s package_base = '' 1113s package_base_dir = '' 1113s path = 'pure/data/pure.dat' 1113s path_types = ('cm', 'p') 1113s root = '' 1113s select_paths = .select_paths at 0xf726240f2f20> 1113s src_dir = local('/tmp/pytest-of-ubuntu/pytest-92/test_setup_inputs0') 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-92/test_setup_inputs0') 1113s with_package_base = 0 1113s 1113s tests/test_setup.py:849: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-92/test_setup_inputs0') 1113s setup_args = ['build'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-92/test_setup_inputs0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ________________________ test_setup_inputs[0-0-1-0-1-1] ________________________ 1113s 1113s has_cmake_package = 1, has_cmake_module = 1, has_hybrid_package = 0 1113s has_pure_package = 1, has_pure_module = 0, with_package_base = 0 1113s mocker = 1113s 1113s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 1113s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 1113s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_module", [0, 1]) 1113s @pytest.mark.parametrize("with_package_base", [0, 1]) 1113s def test_setup_inputs( 1113s has_cmake_package, 1113s has_cmake_module, 1113s has_hybrid_package, 1113s has_pure_package, 1113s has_pure_module, 1113s with_package_base, 1113s mocker, 1113s ): 1113s """This test that a project can have a package with some modules 1113s installed using setup.py and some other modules installed using CMake. 1113s """ 1113s 1113s tmp_dir = _tmpdir("test_setup_inputs") 1113s 1113s package_base = "to/the/base" if with_package_base else "" 1113s package_base_dir = package_base + "/" if package_base else "" 1113s cmake_source_dir = package_base 1113s 1113s if cmake_source_dir and (has_cmake_package or has_cmake_module): 1113s pytest.skip( 1113s "unsupported configuration: " 1113s "python package fully generated by CMake does *NOT* work. " 1113s "At least __init__.py should be in the project source tree" 1113s ) 1113s 1113s # ------------------------------------------------------------------------- 1113s # Here is the "SOURCE" tree layout: 1113s # 1113s # ROOT/ 1113s # 1113s # setup.py 1113s # 1113s # [/] 1113s # 1113s # pureModule.py 1113s # 1113s # pure/ 1113s # __init__.py 1113s # pure.py 1113s # 1113s # data/ 1113s # pure.dat 1113s # 1113s # [/] 1113s # 1113s # hybrid/ 1113s # CMakeLists.txt 1113s # __init__.py 1113s # hybrid_pure.dat 1113s # hybrid_pure.py 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat 1113s # 1113s # hybrid_2/ 1113s # __init__.py 1113s # hybrid_2_pure.py 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py 1113s # hybrid_2_pure_1.py 1113s # hybrid_2_pure_2.py 1113s # 1113s # 1113s # ------------------------------------------------------------------------- 1113s # and here is the "BINARY" distribution layout: 1113s # 1113s # The comment "CMake" or "Setuptools" indicates which tool is responsible 1113s # for placing the file in the tree used to create the binary distribution. 1113s # 1113s # ROOT/ 1113s # 1113s # cmakeModule.py # CMake 1113s # 1113s # cmake/ 1113s # __init__.py # CMake 1113s # cmake.py # CMake 1113s # 1113s # hybrid/ 1113s # hybrid_cmake.dat # CMake 1113s # hybrid_cmake.py # CMake 1113s # hybrid_pure.dat # Setuptools 1113s # hybrid_pure.py # Setuptools 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat # CMake or Setuptools 1113s # hybrid_data_cmake.dat # CMake *NO TEST* 1113s # 1113s # hybrid_2/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure.py # CMake or Setuptools 1113s # hybrid_2_cmake.py # CMake 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure_1.py # CMake or Setuptools 1113s # hybrid_2_pure_2.py # CMake or Setuptools 1113s # 1113s # pureModule.py # Setuptools 1113s # 1113s # pure/ 1113s # __init__.py # Setuptools 1113s # pure.py # Setuptools 1113s # 1113s # data/ 1113s # pure.dat # Setuptools 1113s 1113s tmp_dir.join("setup.py").write( 1113s textwrap.dedent( 1113s """ 1113s from skbuild import setup 1113s #from setuptools import setup 1113s setup( 1113s name="test_hybrid_project", 1113s version="1.2.3", 1113s description=("an hybrid package mixing files installed by both " 1113s "CMake and setuptools"), 1113s author='The scikit-build team', 1113s license="MIT", 1113s cmake_source_dir='{cmake_source_dir}', 1113s cmake_install_dir='{cmake_install_dir}', 1113s # Arbitrary order of packages 1113s packages=[ 1113s {p_off} 'pure', 1113s {h_off} 'hybrid.hybrid_2', 1113s {h_off} 'hybrid', 1113s {c_off} 'cmake', 1113s {p_off} 'hybrid.hybrid_2_pure', 1113s ], 1113s py_modules=[ 1113s {pm_off} '{package_base}pureModule', 1113s {cm_off} '{package_base}cmakeModule', 1113s ], 1113s package_data={{ 1113s {p_off} 'pure': ['data/pure.dat'], 1113s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 1113s }}, 1113s # Arbitrary order of package_dir 1113s package_dir = {{ 1113s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 1113s {p_off} 'pure': '{package_base}pure', 1113s {h_off} 'hybrid': '{package_base}hybrid', 1113s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 1113s {c_off} 'cmake': '{package_base}cmake', 1113s }} 1113s ) 1113s """.format( 1113s cmake_source_dir=cmake_source_dir, 1113s cmake_install_dir=package_base, 1113s package_base=package_base_dir, 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s p_off="" if has_pure_package else "#", 1113s pm_off="" if has_pure_module else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s src_dir = tmp_dir.ensure(package_base, dir=1) 1113s 1113s src_dir.join("CMakeLists.txt").write( 1113s textwrap.dedent( 1113s """ 1113s cmake_minimum_required(VERSION 3.5.0) 1113s project(hybrid NONE) 1113s set(build_dir ${{CMAKE_BINARY_DIR}}) 1113s 1113s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 1113s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 1113s {c_off} install( 1113s {c_off} FILES 1113s {c_off} ${{build_dir}}/__init__.py 1113s {c_off} ${{build_dir}}/cmake.py 1113s {c_off} DESTINATION cmake 1113s {c_off} ) 1113s 1113s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 1113s {cm_off} install( 1113s {cm_off} FILES ${{build_dir}}/cmakeModule.py 1113s {cm_off} DESTINATION .) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 1113s {h_off} DESTINATION hybrid/data) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 1113s {h_off} DESTINATION hybrid/hybrid_2) 1113s 1113s install(CODE "message(STATUS \\\"Installation complete\\\")") 1113s """.format( 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 1113s path_types: Sequence[str] 1113s try: 1113s path_types = next( 1113s iter( 1113s zip( 1113s *filter( 1113s lambda i: i[1], 1113s [ 1113s ("c", has_cmake_package), 1113s ("cm", has_cmake_module), 1113s ("h", has_hybrid_package), 1113s ("p", has_pure_package), 1113s ("pm", has_pure_module), 1113s ], 1113s ) 1113s ) 1113s ) 1113s ) 1113s except StopIteration: 1113s path_types = [] 1113s 1113s def select_paths(annotated_paths): 1113s """Return a filtered list paths considering ``path_types``. 1113s 1113s `annotated_paths`` is list of tuple ``(type, path)`` where type 1113s is either `c`, 'cm', `h`, `p` or 'pm'. 1113s 1113s """ 1113s return filter(lambda i: i[0] in path_types, annotated_paths) 1113s 1113s # Commented paths are the one expected to be installed by CMake. For 1113s # this reason, corresponding files should NOT be created in the source 1113s # tree. 1113s for _type, path in select_paths( 1113s [ 1113s # ('c', 'cmake/__init__.py'), 1113s # ('c', 'cmake/cmake.py'), 1113s # ('cm', 'cmakeModule.py'), 1113s ("h", "hybrid/__init__.py"), 1113s # ('h', 'hybrid/hybrid_cmake.dat'), 1113s # ('h', 'hybrid/hybrid_cmake.py'), 1113s ("h", "hybrid/hybrid_pure.dat"), 1113s ("h", "hybrid/hybrid_pure.py"), 1113s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 1113s ("h", "hybrid/data/hybrid_data_pure.dat"), 1113s ("h", "hybrid/hybrid_2/__init__.py"), 1113s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 1113s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 1113s ("p", "hybrid/hybrid_2_pure/__init__.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 1113s ("pm", "pureModule.py"), 1113s ("p", "pure/__init__.py"), 1113s ("p", "pure/pure.py"), 1113s ("p", "pure/data/pure.dat"), 1113s ] 1113s ): 1113s assert _type in {"p", "pm", "h"} 1113s root = package_base if _type in {"p", "pm"} else cmake_source_dir 1113s tmp_dir.ensure(os.path.join(root, path)) 1113s 1113s # Do not call the real setup function. Instead, replace it with 1113s # a MagicMock allowing to check with which arguments it was invoked. 1113s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 1113s 1113s # Convenience print function 1113s def _pprint(desc, value=None): 1113s print( 1113s "-----------------\n" 1113s f"{desc}:\n" 1113s "\n" 1113s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 1113s ) 1113s 1113s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 1113s 1113s _pprint = ._pprint at 0xf726240f2ca0> 1113s _type = 'p' 1113s cmake_source_dir = '' 1113s has_cmake_module = 1 1113s has_cmake_package = 1 1113s has_hybrid_package = 0 1113s has_pure_module = 0 1113s has_pure_package = 1 1113s mock_setup = 1113s mocker = 1113s package_base = '' 1113s package_base_dir = '' 1113s path = 'pure/data/pure.dat' 1113s path_types = ('c', 'cm', 'p') 1113s root = '' 1113s select_paths = .select_paths at 0xf726240f2ac0> 1113s src_dir = local('/tmp/pytest-of-ubuntu/pytest-93/test_setup_inputs0') 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-93/test_setup_inputs0') 1113s with_package_base = 0 1113s 1113s tests/test_setup.py:849: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-93/test_setup_inputs0') 1113s setup_args = ['build'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-93/test_setup_inputs0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ________________________ test_setup_inputs[0-0-1-1-0-0] ________________________ 1113s 1113s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 1 1113s has_pure_package = 1, has_pure_module = 0, with_package_base = 0 1113s mocker = 1113s 1113s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 1113s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 1113s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_module", [0, 1]) 1113s @pytest.mark.parametrize("with_package_base", [0, 1]) 1113s def test_setup_inputs( 1113s has_cmake_package, 1113s has_cmake_module, 1113s has_hybrid_package, 1113s has_pure_package, 1113s has_pure_module, 1113s with_package_base, 1113s mocker, 1113s ): 1113s """This test that a project can have a package with some modules 1113s installed using setup.py and some other modules installed using CMake. 1113s """ 1113s 1113s tmp_dir = _tmpdir("test_setup_inputs") 1113s 1113s package_base = "to/the/base" if with_package_base else "" 1113s package_base_dir = package_base + "/" if package_base else "" 1113s cmake_source_dir = package_base 1113s 1113s if cmake_source_dir and (has_cmake_package or has_cmake_module): 1113s pytest.skip( 1113s "unsupported configuration: " 1113s "python package fully generated by CMake does *NOT* work. " 1113s "At least __init__.py should be in the project source tree" 1113s ) 1113s 1113s # ------------------------------------------------------------------------- 1113s # Here is the "SOURCE" tree layout: 1113s # 1113s # ROOT/ 1113s # 1113s # setup.py 1113s # 1113s # [/] 1113s # 1113s # pureModule.py 1113s # 1113s # pure/ 1113s # __init__.py 1113s # pure.py 1113s # 1113s # data/ 1113s # pure.dat 1113s # 1113s # [/] 1113s # 1113s # hybrid/ 1113s # CMakeLists.txt 1113s # __init__.py 1113s # hybrid_pure.dat 1113s # hybrid_pure.py 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat 1113s # 1113s # hybrid_2/ 1113s # __init__.py 1113s # hybrid_2_pure.py 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py 1113s # hybrid_2_pure_1.py 1113s # hybrid_2_pure_2.py 1113s # 1113s # 1113s # ------------------------------------------------------------------------- 1113s # and here is the "BINARY" distribution layout: 1113s # 1113s # The comment "CMake" or "Setuptools" indicates which tool is responsible 1113s # for placing the file in the tree used to create the binary distribution. 1113s # 1113s # ROOT/ 1113s # 1113s # cmakeModule.py # CMake 1113s # 1113s # cmake/ 1113s # __init__.py # CMake 1113s # cmake.py # CMake 1113s # 1113s # hybrid/ 1113s # hybrid_cmake.dat # CMake 1113s # hybrid_cmake.py # CMake 1113s # hybrid_pure.dat # Setuptools 1113s # hybrid_pure.py # Setuptools 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat # CMake or Setuptools 1113s # hybrid_data_cmake.dat # CMake *NO TEST* 1113s # 1113s # hybrid_2/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure.py # CMake or Setuptools 1113s # hybrid_2_cmake.py # CMake 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure_1.py # CMake or Setuptools 1113s # hybrid_2_pure_2.py # CMake or Setuptools 1113s # 1113s # pureModule.py # Setuptools 1113s # 1113s # pure/ 1113s # __init__.py # Setuptools 1113s # pure.py # Setuptools 1113s # 1113s # data/ 1113s # pure.dat # Setuptools 1113s 1113s tmp_dir.join("setup.py").write( 1113s textwrap.dedent( 1113s """ 1113s from skbuild import setup 1113s #from setuptools import setup 1113s setup( 1113s name="test_hybrid_project", 1113s version="1.2.3", 1113s description=("an hybrid package mixing files installed by both " 1113s "CMake and setuptools"), 1113s author='The scikit-build team', 1113s license="MIT", 1113s cmake_source_dir='{cmake_source_dir}', 1113s cmake_install_dir='{cmake_install_dir}', 1113s # Arbitrary order of packages 1113s packages=[ 1113s {p_off} 'pure', 1113s {h_off} 'hybrid.hybrid_2', 1113s {h_off} 'hybrid', 1113s {c_off} 'cmake', 1113s {p_off} 'hybrid.hybrid_2_pure', 1113s ], 1113s py_modules=[ 1113s {pm_off} '{package_base}pureModule', 1113s {cm_off} '{package_base}cmakeModule', 1113s ], 1113s package_data={{ 1113s {p_off} 'pure': ['data/pure.dat'], 1113s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 1113s }}, 1113s # Arbitrary order of package_dir 1113s package_dir = {{ 1113s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 1113s {p_off} 'pure': '{package_base}pure', 1113s {h_off} 'hybrid': '{package_base}hybrid', 1113s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 1113s {c_off} 'cmake': '{package_base}cmake', 1113s }} 1113s ) 1113s """.format( 1113s cmake_source_dir=cmake_source_dir, 1113s cmake_install_dir=package_base, 1113s package_base=package_base_dir, 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s p_off="" if has_pure_package else "#", 1113s pm_off="" if has_pure_module else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s src_dir = tmp_dir.ensure(package_base, dir=1) 1113s 1113s src_dir.join("CMakeLists.txt").write( 1113s textwrap.dedent( 1113s """ 1113s cmake_minimum_required(VERSION 3.5.0) 1113s project(hybrid NONE) 1113s set(build_dir ${{CMAKE_BINARY_DIR}}) 1113s 1113s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 1113s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 1113s {c_off} install( 1113s {c_off} FILES 1113s {c_off} ${{build_dir}}/__init__.py 1113s {c_off} ${{build_dir}}/cmake.py 1113s {c_off} DESTINATION cmake 1113s {c_off} ) 1113s 1113s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 1113s {cm_off} install( 1113s {cm_off} FILES ${{build_dir}}/cmakeModule.py 1113s {cm_off} DESTINATION .) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 1113s {h_off} DESTINATION hybrid/data) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 1113s {h_off} DESTINATION hybrid/hybrid_2) 1113s 1113s install(CODE "message(STATUS \\\"Installation complete\\\")") 1113s """.format( 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 1113s path_types: Sequence[str] 1113s try: 1113s path_types = next( 1113s iter( 1113s zip( 1113s *filter( 1113s lambda i: i[1], 1113s [ 1113s ("c", has_cmake_package), 1113s ("cm", has_cmake_module), 1113s ("h", has_hybrid_package), 1113s ("p", has_pure_package), 1113s ("pm", has_pure_module), 1113s ], 1113s ) 1113s ) 1113s ) 1113s ) 1113s except StopIteration: 1113s path_types = [] 1113s 1113s def select_paths(annotated_paths): 1113s """Return a filtered list paths considering ``path_types``. 1113s 1113s `annotated_paths`` is list of tuple ``(type, path)`` where type 1113s is either `c`, 'cm', `h`, `p` or 'pm'. 1113s 1113s """ 1113s return filter(lambda i: i[0] in path_types, annotated_paths) 1113s 1113s # Commented paths are the one expected to be installed by CMake. For 1113s # this reason, corresponding files should NOT be created in the source 1113s # tree. 1113s for _type, path in select_paths( 1113s [ 1113s # ('c', 'cmake/__init__.py'), 1113s # ('c', 'cmake/cmake.py'), 1113s # ('cm', 'cmakeModule.py'), 1113s ("h", "hybrid/__init__.py"), 1113s # ('h', 'hybrid/hybrid_cmake.dat'), 1113s # ('h', 'hybrid/hybrid_cmake.py'), 1113s ("h", "hybrid/hybrid_pure.dat"), 1113s ("h", "hybrid/hybrid_pure.py"), 1113s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 1113s ("h", "hybrid/data/hybrid_data_pure.dat"), 1113s ("h", "hybrid/hybrid_2/__init__.py"), 1113s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 1113s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 1113s ("p", "hybrid/hybrid_2_pure/__init__.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 1113s ("pm", "pureModule.py"), 1113s ("p", "pure/__init__.py"), 1113s ("p", "pure/pure.py"), 1113s ("p", "pure/data/pure.dat"), 1113s ] 1113s ): 1113s assert _type in {"p", "pm", "h"} 1113s root = package_base if _type in {"p", "pm"} else cmake_source_dir 1113s tmp_dir.ensure(os.path.join(root, path)) 1113s 1113s # Do not call the real setup function. Instead, replace it with 1113s # a MagicMock allowing to check with which arguments it was invoked. 1113s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 1113s 1113s # Convenience print function 1113s def _pprint(desc, value=None): 1113s print( 1113s "-----------------\n" 1113s f"{desc}:\n" 1113s "\n" 1113s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 1113s ) 1113s 1113s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 1113s 1113s _pprint = ._pprint at 0xf726240f1800> 1113s _type = 'p' 1113s cmake_source_dir = '' 1113s has_cmake_module = 0 1113s has_cmake_package = 0 1113s has_hybrid_package = 1 1113s has_pure_module = 0 1113s has_pure_package = 1 1113s mock_setup = 1113s mocker = 1113s package_base = '' 1113s package_base_dir = '' 1113s path = 'pure/data/pure.dat' 1113s path_types = ('h', 'p') 1113s root = '' 1113s select_paths = .select_paths at 0xf726240f1e40> 1113s src_dir = local('/tmp/pytest-of-ubuntu/pytest-94/test_setup_inputs0') 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-94/test_setup_inputs0') 1113s with_package_base = 0 1113s 1113s tests/test_setup.py:849: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-94/test_setup_inputs0') 1113s setup_args = ['build'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-94/test_setup_inputs0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ________________________ test_setup_inputs[0-0-1-1-0-1] ________________________ 1113s 1113s has_cmake_package = 1, has_cmake_module = 0, has_hybrid_package = 1 1113s has_pure_package = 1, has_pure_module = 0, with_package_base = 0 1113s mocker = 1113s 1113s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 1113s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 1113s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_module", [0, 1]) 1113s @pytest.mark.parametrize("with_package_base", [0, 1]) 1113s def test_setup_inputs( 1113s has_cmake_package, 1113s has_cmake_module, 1113s has_hybrid_package, 1113s has_pure_package, 1113s has_pure_module, 1113s with_package_base, 1113s mocker, 1113s ): 1113s """This test that a project can have a package with some modules 1113s installed using setup.py and some other modules installed using CMake. 1113s """ 1113s 1113s tmp_dir = _tmpdir("test_setup_inputs") 1113s 1113s package_base = "to/the/base" if with_package_base else "" 1113s package_base_dir = package_base + "/" if package_base else "" 1113s cmake_source_dir = package_base 1113s 1113s if cmake_source_dir and (has_cmake_package or has_cmake_module): 1113s pytest.skip( 1113s "unsupported configuration: " 1113s "python package fully generated by CMake does *NOT* work. " 1113s "At least __init__.py should be in the project source tree" 1113s ) 1113s 1113s # ------------------------------------------------------------------------- 1113s # Here is the "SOURCE" tree layout: 1113s # 1113s # ROOT/ 1113s # 1113s # setup.py 1113s # 1113s # [/] 1113s # 1113s # pureModule.py 1113s # 1113s # pure/ 1113s # __init__.py 1113s # pure.py 1113s # 1113s # data/ 1113s # pure.dat 1113s # 1113s # [/] 1113s # 1113s # hybrid/ 1113s # CMakeLists.txt 1113s # __init__.py 1113s # hybrid_pure.dat 1113s # hybrid_pure.py 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat 1113s # 1113s # hybrid_2/ 1113s # __init__.py 1113s # hybrid_2_pure.py 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py 1113s # hybrid_2_pure_1.py 1113s # hybrid_2_pure_2.py 1113s # 1113s # 1113s # ------------------------------------------------------------------------- 1113s # and here is the "BINARY" distribution layout: 1113s # 1113s # The comment "CMake" or "Setuptools" indicates which tool is responsible 1113s # for placing the file in the tree used to create the binary distribution. 1113s # 1113s # ROOT/ 1113s # 1113s # cmakeModule.py # CMake 1113s # 1113s # cmake/ 1113s # __init__.py # CMake 1113s # cmake.py # CMake 1113s # 1113s # hybrid/ 1113s # hybrid_cmake.dat # CMake 1113s # hybrid_cmake.py # CMake 1113s # hybrid_pure.dat # Setuptools 1113s # hybrid_pure.py # Setuptools 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat # CMake or Setuptools 1113s # hybrid_data_cmake.dat # CMake *NO TEST* 1113s # 1113s # hybrid_2/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure.py # CMake or Setuptools 1113s # hybrid_2_cmake.py # CMake 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure_1.py # CMake or Setuptools 1113s # hybrid_2_pure_2.py # CMake or Setuptools 1113s # 1113s # pureModule.py # Setuptools 1113s # 1113s # pure/ 1113s # __init__.py # Setuptools 1113s # pure.py # Setuptools 1113s # 1113s # data/ 1113s # pure.dat # Setuptools 1113s 1113s tmp_dir.join("setup.py").write( 1113s textwrap.dedent( 1113s """ 1113s from skbuild import setup 1113s #from setuptools import setup 1113s setup( 1113s name="test_hybrid_project", 1113s version="1.2.3", 1113s description=("an hybrid package mixing files installed by both " 1113s "CMake and setuptools"), 1113s author='The scikit-build team', 1113s license="MIT", 1113s cmake_source_dir='{cmake_source_dir}', 1113s cmake_install_dir='{cmake_install_dir}', 1113s # Arbitrary order of packages 1113s packages=[ 1113s {p_off} 'pure', 1113s {h_off} 'hybrid.hybrid_2', 1113s {h_off} 'hybrid', 1113s {c_off} 'cmake', 1113s {p_off} 'hybrid.hybrid_2_pure', 1113s ], 1113s py_modules=[ 1113s {pm_off} '{package_base}pureModule', 1113s {cm_off} '{package_base}cmakeModule', 1113s ], 1113s package_data={{ 1113s {p_off} 'pure': ['data/pure.dat'], 1113s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 1113s }}, 1113s # Arbitrary order of package_dir 1113s package_dir = {{ 1113s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 1113s {p_off} 'pure': '{package_base}pure', 1113s {h_off} 'hybrid': '{package_base}hybrid', 1113s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 1113s {c_off} 'cmake': '{package_base}cmake', 1113s }} 1113s ) 1113s """.format( 1113s cmake_source_dir=cmake_source_dir, 1113s cmake_install_dir=package_base, 1113s package_base=package_base_dir, 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s p_off="" if has_pure_package else "#", 1113s pm_off="" if has_pure_module else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s src_dir = tmp_dir.ensure(package_base, dir=1) 1113s 1113s src_dir.join("CMakeLists.txt").write( 1113s textwrap.dedent( 1113s """ 1113s cmake_minimum_required(VERSION 3.5.0) 1113s project(hybrid NONE) 1113s set(build_dir ${{CMAKE_BINARY_DIR}}) 1113s 1113s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 1113s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 1113s {c_off} install( 1113s {c_off} FILES 1113s {c_off} ${{build_dir}}/__init__.py 1113s {c_off} ${{build_dir}}/cmake.py 1113s {c_off} DESTINATION cmake 1113s {c_off} ) 1113s 1113s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 1113s {cm_off} install( 1113s {cm_off} FILES ${{build_dir}}/cmakeModule.py 1113s {cm_off} DESTINATION .) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 1113s {h_off} DESTINATION hybrid/data) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 1113s {h_off} DESTINATION hybrid/hybrid_2) 1113s 1113s install(CODE "message(STATUS \\\"Installation complete\\\")") 1113s """.format( 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 1113s path_types: Sequence[str] 1113s try: 1113s path_types = next( 1113s iter( 1113s zip( 1113s *filter( 1113s lambda i: i[1], 1113s [ 1113s ("c", has_cmake_package), 1113s ("cm", has_cmake_module), 1113s ("h", has_hybrid_package), 1113s ("p", has_pure_package), 1113s ("pm", has_pure_module), 1113s ], 1113s ) 1113s ) 1113s ) 1113s ) 1113s except StopIteration: 1113s path_types = [] 1113s 1113s def select_paths(annotated_paths): 1113s """Return a filtered list paths considering ``path_types``. 1113s 1113s `annotated_paths`` is list of tuple ``(type, path)`` where type 1113s is either `c`, 'cm', `h`, `p` or 'pm'. 1113s 1113s """ 1113s return filter(lambda i: i[0] in path_types, annotated_paths) 1113s 1113s # Commented paths are the one expected to be installed by CMake. For 1113s # this reason, corresponding files should NOT be created in the source 1113s # tree. 1113s for _type, path in select_paths( 1113s [ 1113s # ('c', 'cmake/__init__.py'), 1113s # ('c', 'cmake/cmake.py'), 1113s # ('cm', 'cmakeModule.py'), 1113s ("h", "hybrid/__init__.py"), 1113s # ('h', 'hybrid/hybrid_cmake.dat'), 1113s # ('h', 'hybrid/hybrid_cmake.py'), 1113s ("h", "hybrid/hybrid_pure.dat"), 1113s ("h", "hybrid/hybrid_pure.py"), 1113s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 1113s ("h", "hybrid/data/hybrid_data_pure.dat"), 1113s ("h", "hybrid/hybrid_2/__init__.py"), 1113s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 1113s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 1113s ("p", "hybrid/hybrid_2_pure/__init__.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 1113s ("pm", "pureModule.py"), 1113s ("p", "pure/__init__.py"), 1113s ("p", "pure/pure.py"), 1113s ("p", "pure/data/pure.dat"), 1113s ] 1113s ): 1113s assert _type in {"p", "pm", "h"} 1113s root = package_base if _type in {"p", "pm"} else cmake_source_dir 1113s tmp_dir.ensure(os.path.join(root, path)) 1113s 1113s # Do not call the real setup function. Instead, replace it with 1113s # a MagicMock allowing to check with which arguments it was invoked. 1113s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 1113s 1113s # Convenience print function 1113s def _pprint(desc, value=None): 1113s print( 1113s "-----------------\n" 1113s f"{desc}:\n" 1113s "\n" 1113s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 1113s ) 1113s 1113s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 1113s 1113s _pprint = ._pprint at 0xf726240f3880> 1113s _type = 'p' 1113s cmake_source_dir = '' 1113s has_cmake_module = 0 1113s has_cmake_package = 1 1113s has_hybrid_package = 1 1113s has_pure_module = 0 1113s has_pure_package = 1 1113s mock_setup = 1113s mocker = 1113s package_base = '' 1113s package_base_dir = '' 1113s path = 'pure/data/pure.dat' 1113s path_types = ('c', 'h', 'p') 1113s root = '' 1113s select_paths = .select_paths at 0xf72624161300> 1113s src_dir = local('/tmp/pytest-of-ubuntu/pytest-95/test_setup_inputs0') 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-95/test_setup_inputs0') 1113s with_package_base = 0 1113s 1113s tests/test_setup.py:849: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-95/test_setup_inputs0') 1113s setup_args = ['build'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-95/test_setup_inputs0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ________________________ test_setup_inputs[0-0-1-1-1-0] ________________________ 1113s 1113s has_cmake_package = 0, has_cmake_module = 1, has_hybrid_package = 1 1113s has_pure_package = 1, has_pure_module = 0, with_package_base = 0 1113s mocker = 1113s 1113s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 1113s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 1113s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_module", [0, 1]) 1113s @pytest.mark.parametrize("with_package_base", [0, 1]) 1113s def test_setup_inputs( 1113s has_cmake_package, 1113s has_cmake_module, 1113s has_hybrid_package, 1113s has_pure_package, 1113s has_pure_module, 1113s with_package_base, 1113s mocker, 1113s ): 1113s """This test that a project can have a package with some modules 1113s installed using setup.py and some other modules installed using CMake. 1113s """ 1113s 1113s tmp_dir = _tmpdir("test_setup_inputs") 1113s 1113s package_base = "to/the/base" if with_package_base else "" 1113s package_base_dir = package_base + "/" if package_base else "" 1113s cmake_source_dir = package_base 1113s 1113s if cmake_source_dir and (has_cmake_package or has_cmake_module): 1113s pytest.skip( 1113s "unsupported configuration: " 1113s "python package fully generated by CMake does *NOT* work. " 1113s "At least __init__.py should be in the project source tree" 1113s ) 1113s 1113s # ------------------------------------------------------------------------- 1113s # Here is the "SOURCE" tree layout: 1113s # 1113s # ROOT/ 1113s # 1113s # setup.py 1113s # 1113s # [/] 1113s # 1113s # pureModule.py 1113s # 1113s # pure/ 1113s # __init__.py 1113s # pure.py 1113s # 1113s # data/ 1113s # pure.dat 1113s # 1113s # [/] 1113s # 1113s # hybrid/ 1113s # CMakeLists.txt 1113s # __init__.py 1113s # hybrid_pure.dat 1113s # hybrid_pure.py 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat 1113s # 1113s # hybrid_2/ 1113s # __init__.py 1113s # hybrid_2_pure.py 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py 1113s # hybrid_2_pure_1.py 1113s # hybrid_2_pure_2.py 1113s # 1113s # 1113s # ------------------------------------------------------------------------- 1113s # and here is the "BINARY" distribution layout: 1113s # 1113s # The comment "CMake" or "Setuptools" indicates which tool is responsible 1113s # for placing the file in the tree used to create the binary distribution. 1113s # 1113s # ROOT/ 1113s # 1113s # cmakeModule.py # CMake 1113s # 1113s # cmake/ 1113s # __init__.py # CMake 1113s # cmake.py # CMake 1113s # 1113s # hybrid/ 1113s # hybrid_cmake.dat # CMake 1113s # hybrid_cmake.py # CMake 1113s # hybrid_pure.dat # Setuptools 1113s # hybrid_pure.py # Setuptools 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat # CMake or Setuptools 1113s # hybrid_data_cmake.dat # CMake *NO TEST* 1113s # 1113s # hybrid_2/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure.py # CMake or Setuptools 1113s # hybrid_2_cmake.py # CMake 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure_1.py # CMake or Setuptools 1113s # hybrid_2_pure_2.py # CMake or Setuptools 1113s # 1113s # pureModule.py # Setuptools 1113s # 1113s # pure/ 1113s # __init__.py # Setuptools 1113s # pure.py # Setuptools 1113s # 1113s # data/ 1113s # pure.dat # Setuptools 1113s 1113s tmp_dir.join("setup.py").write( 1113s textwrap.dedent( 1113s """ 1113s from skbuild import setup 1113s #from setuptools import setup 1113s setup( 1113s name="test_hybrid_project", 1113s version="1.2.3", 1113s description=("an hybrid package mixing files installed by both " 1113s "CMake and setuptools"), 1113s author='The scikit-build team', 1113s license="MIT", 1113s cmake_source_dir='{cmake_source_dir}', 1113s cmake_install_dir='{cmake_install_dir}', 1113s # Arbitrary order of packages 1113s packages=[ 1113s {p_off} 'pure', 1113s {h_off} 'hybrid.hybrid_2', 1113s {h_off} 'hybrid', 1113s {c_off} 'cmake', 1113s {p_off} 'hybrid.hybrid_2_pure', 1113s ], 1113s py_modules=[ 1113s {pm_off} '{package_base}pureModule', 1113s {cm_off} '{package_base}cmakeModule', 1113s ], 1113s package_data={{ 1113s {p_off} 'pure': ['data/pure.dat'], 1113s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 1113s }}, 1113s # Arbitrary order of package_dir 1113s package_dir = {{ 1113s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 1113s {p_off} 'pure': '{package_base}pure', 1113s {h_off} 'hybrid': '{package_base}hybrid', 1113s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 1113s {c_off} 'cmake': '{package_base}cmake', 1113s }} 1113s ) 1113s """.format( 1113s cmake_source_dir=cmake_source_dir, 1113s cmake_install_dir=package_base, 1113s package_base=package_base_dir, 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s p_off="" if has_pure_package else "#", 1113s pm_off="" if has_pure_module else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s src_dir = tmp_dir.ensure(package_base, dir=1) 1113s 1113s src_dir.join("CMakeLists.txt").write( 1113s textwrap.dedent( 1113s """ 1113s cmake_minimum_required(VERSION 3.5.0) 1113s project(hybrid NONE) 1113s set(build_dir ${{CMAKE_BINARY_DIR}}) 1113s 1113s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 1113s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 1113s {c_off} install( 1113s {c_off} FILES 1113s {c_off} ${{build_dir}}/__init__.py 1113s {c_off} ${{build_dir}}/cmake.py 1113s {c_off} DESTINATION cmake 1113s {c_off} ) 1113s 1113s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 1113s {cm_off} install( 1113s {cm_off} FILES ${{build_dir}}/cmakeModule.py 1113s {cm_off} DESTINATION .) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 1113s {h_off} DESTINATION hybrid/data) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 1113s {h_off} DESTINATION hybrid/hybrid_2) 1113s 1113s install(CODE "message(STATUS \\\"Installation complete\\\")") 1113s """.format( 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 1113s path_types: Sequence[str] 1113s try: 1113s path_types = next( 1113s iter( 1113s zip( 1113s *filter( 1113s lambda i: i[1], 1113s [ 1113s ("c", has_cmake_package), 1113s ("cm", has_cmake_module), 1113s ("h", has_hybrid_package), 1113s ("p", has_pure_package), 1113s ("pm", has_pure_module), 1113s ], 1113s ) 1113s ) 1113s ) 1113s ) 1113s except StopIteration: 1113s path_types = [] 1113s 1113s def select_paths(annotated_paths): 1113s """Return a filtered list paths considering ``path_types``. 1113s 1113s `annotated_paths`` is list of tuple ``(type, path)`` where type 1113s is either `c`, 'cm', `h`, `p` or 'pm'. 1113s 1113s """ 1113s return filter(lambda i: i[0] in path_types, annotated_paths) 1113s 1113s # Commented paths are the one expected to be installed by CMake. For 1113s # this reason, corresponding files should NOT be created in the source 1113s # tree. 1113s for _type, path in select_paths( 1113s [ 1113s # ('c', 'cmake/__init__.py'), 1113s # ('c', 'cmake/cmake.py'), 1113s # ('cm', 'cmakeModule.py'), 1113s ("h", "hybrid/__init__.py"), 1113s # ('h', 'hybrid/hybrid_cmake.dat'), 1113s # ('h', 'hybrid/hybrid_cmake.py'), 1113s ("h", "hybrid/hybrid_pure.dat"), 1113s ("h", "hybrid/hybrid_pure.py"), 1113s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 1113s ("h", "hybrid/data/hybrid_data_pure.dat"), 1113s ("h", "hybrid/hybrid_2/__init__.py"), 1113s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 1113s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 1113s ("p", "hybrid/hybrid_2_pure/__init__.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 1113s ("pm", "pureModule.py"), 1113s ("p", "pure/__init__.py"), 1113s ("p", "pure/pure.py"), 1113s ("p", "pure/data/pure.dat"), 1113s ] 1113s ): 1113s assert _type in {"p", "pm", "h"} 1113s root = package_base if _type in {"p", "pm"} else cmake_source_dir 1113s tmp_dir.ensure(os.path.join(root, path)) 1113s 1113s # Do not call the real setup function. Instead, replace it with 1113s # a MagicMock allowing to check with which arguments it was invoked. 1113s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 1113s 1113s # Convenience print function 1113s def _pprint(desc, value=None): 1113s print( 1113s "-----------------\n" 1113s f"{desc}:\n" 1113s "\n" 1113s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 1113s ) 1113s 1113s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 1113s 1113s _pprint = ._pprint at 0xf726240f1da0> 1113s _type = 'p' 1113s cmake_source_dir = '' 1113s has_cmake_module = 1 1113s has_cmake_package = 0 1113s has_hybrid_package = 1 1113s has_pure_module = 0 1113s has_pure_package = 1 1113s mock_setup = 1113s mocker = 1113s package_base = '' 1113s package_base_dir = '' 1113s path = 'pure/data/pure.dat' 1113s path_types = ('cm', 'h', 'p') 1113s root = '' 1113s select_paths = .select_paths at 0xf726240f3060> 1113s src_dir = local('/tmp/pytest-of-ubuntu/pytest-96/test_setup_inputs0') 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-96/test_setup_inputs0') 1113s with_package_base = 0 1113s 1113s tests/test_setup.py:849: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-96/test_setup_inputs0') 1113s setup_args = ['build'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-96/test_setup_inputs0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ________________________ test_setup_inputs[0-0-1-1-1-1] ________________________ 1113s 1113s has_cmake_package = 1, has_cmake_module = 1, has_hybrid_package = 1 1113s has_pure_package = 1, has_pure_module = 0, with_package_base = 0 1113s mocker = 1113s 1113s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 1113s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 1113s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_module", [0, 1]) 1113s @pytest.mark.parametrize("with_package_base", [0, 1]) 1113s def test_setup_inputs( 1113s has_cmake_package, 1113s has_cmake_module, 1113s has_hybrid_package, 1113s has_pure_package, 1113s has_pure_module, 1113s with_package_base, 1113s mocker, 1113s ): 1113s """This test that a project can have a package with some modules 1113s installed using setup.py and some other modules installed using CMake. 1113s """ 1113s 1113s tmp_dir = _tmpdir("test_setup_inputs") 1113s 1113s package_base = "to/the/base" if with_package_base else "" 1113s package_base_dir = package_base + "/" if package_base else "" 1113s cmake_source_dir = package_base 1113s 1113s if cmake_source_dir and (has_cmake_package or has_cmake_module): 1113s pytest.skip( 1113s "unsupported configuration: " 1113s "python package fully generated by CMake does *NOT* work. " 1113s "At least __init__.py should be in the project source tree" 1113s ) 1113s 1113s # ------------------------------------------------------------------------- 1113s # Here is the "SOURCE" tree layout: 1113s # 1113s # ROOT/ 1113s # 1113s # setup.py 1113s # 1113s # [/] 1113s # 1113s # pureModule.py 1113s # 1113s # pure/ 1113s # __init__.py 1113s # pure.py 1113s # 1113s # data/ 1113s # pure.dat 1113s # 1113s # [/] 1113s # 1113s # hybrid/ 1113s # CMakeLists.txt 1113s # __init__.py 1113s # hybrid_pure.dat 1113s # hybrid_pure.py 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat 1113s # 1113s # hybrid_2/ 1113s # __init__.py 1113s # hybrid_2_pure.py 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py 1113s # hybrid_2_pure_1.py 1113s # hybrid_2_pure_2.py 1113s # 1113s # 1113s # ------------------------------------------------------------------------- 1113s # and here is the "BINARY" distribution layout: 1113s # 1113s # The comment "CMake" or "Setuptools" indicates which tool is responsible 1113s # for placing the file in the tree used to create the binary distribution. 1113s # 1113s # ROOT/ 1113s # 1113s # cmakeModule.py # CMake 1113s # 1113s # cmake/ 1113s # __init__.py # CMake 1113s # cmake.py # CMake 1113s # 1113s # hybrid/ 1113s # hybrid_cmake.dat # CMake 1113s # hybrid_cmake.py # CMake 1113s # hybrid_pure.dat # Setuptools 1113s # hybrid_pure.py # Setuptools 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat # CMake or Setuptools 1113s # hybrid_data_cmake.dat # CMake *NO TEST* 1113s # 1113s # hybrid_2/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure.py # CMake or Setuptools 1113s # hybrid_2_cmake.py # CMake 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure_1.py # CMake or Setuptools 1113s # hybrid_2_pure_2.py # CMake or Setuptools 1113s # 1113s # pureModule.py # Setuptools 1113s # 1113s # pure/ 1113s # __init__.py # Setuptools 1113s # pure.py # Setuptools 1113s # 1113s # data/ 1113s # pure.dat # Setuptools 1113s 1113s tmp_dir.join("setup.py").write( 1113s textwrap.dedent( 1113s """ 1113s from skbuild import setup 1113s #from setuptools import setup 1113s setup( 1113s name="test_hybrid_project", 1113s version="1.2.3", 1113s description=("an hybrid package mixing files installed by both " 1113s "CMake and setuptools"), 1113s author='The scikit-build team', 1113s license="MIT", 1113s cmake_source_dir='{cmake_source_dir}', 1113s cmake_install_dir='{cmake_install_dir}', 1113s # Arbitrary order of packages 1113s packages=[ 1113s {p_off} 'pure', 1113s {h_off} 'hybrid.hybrid_2', 1113s {h_off} 'hybrid', 1113s {c_off} 'cmake', 1113s {p_off} 'hybrid.hybrid_2_pure', 1113s ], 1113s py_modules=[ 1113s {pm_off} '{package_base}pureModule', 1113s {cm_off} '{package_base}cmakeModule', 1113s ], 1113s package_data={{ 1113s {p_off} 'pure': ['data/pure.dat'], 1113s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 1113s }}, 1113s # Arbitrary order of package_dir 1113s package_dir = {{ 1113s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 1113s {p_off} 'pure': '{package_base}pure', 1113s {h_off} 'hybrid': '{package_base}hybrid', 1113s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 1113s {c_off} 'cmake': '{package_base}cmake', 1113s }} 1113s ) 1113s """.format( 1113s cmake_source_dir=cmake_source_dir, 1113s cmake_install_dir=package_base, 1113s package_base=package_base_dir, 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s p_off="" if has_pure_package else "#", 1113s pm_off="" if has_pure_module else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s src_dir = tmp_dir.ensure(package_base, dir=1) 1113s 1113s src_dir.join("CMakeLists.txt").write( 1113s textwrap.dedent( 1113s """ 1113s cmake_minimum_required(VERSION 3.5.0) 1113s project(hybrid NONE) 1113s set(build_dir ${{CMAKE_BINARY_DIR}}) 1113s 1113s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 1113s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 1113s {c_off} install( 1113s {c_off} FILES 1113s {c_off} ${{build_dir}}/__init__.py 1113s {c_off} ${{build_dir}}/cmake.py 1113s {c_off} DESTINATION cmake 1113s {c_off} ) 1113s 1113s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 1113s {cm_off} install( 1113s {cm_off} FILES ${{build_dir}}/cmakeModule.py 1113s {cm_off} DESTINATION .) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 1113s {h_off} DESTINATION hybrid/data) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 1113s {h_off} DESTINATION hybrid/hybrid_2) 1113s 1113s install(CODE "message(STATUS \\\"Installation complete\\\")") 1113s """.format( 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 1113s path_types: Sequence[str] 1113s try: 1113s path_types = next( 1113s iter( 1113s zip( 1113s *filter( 1113s lambda i: i[1], 1113s [ 1113s ("c", has_cmake_package), 1113s ("cm", has_cmake_module), 1113s ("h", has_hybrid_package), 1113s ("p", has_pure_package), 1113s ("pm", has_pure_module), 1113s ], 1113s ) 1113s ) 1113s ) 1113s ) 1113s except StopIteration: 1113s path_types = [] 1113s 1113s def select_paths(annotated_paths): 1113s """Return a filtered list paths considering ``path_types``. 1113s 1113s `annotated_paths`` is list of tuple ``(type, path)`` where type 1113s is either `c`, 'cm', `h`, `p` or 'pm'. 1113s 1113s """ 1113s return filter(lambda i: i[0] in path_types, annotated_paths) 1113s 1113s # Commented paths are the one expected to be installed by CMake. For 1113s # this reason, corresponding files should NOT be created in the source 1113s # tree. 1113s for _type, path in select_paths( 1113s [ 1113s # ('c', 'cmake/__init__.py'), 1113s # ('c', 'cmake/cmake.py'), 1113s # ('cm', 'cmakeModule.py'), 1113s ("h", "hybrid/__init__.py"), 1113s # ('h', 'hybrid/hybrid_cmake.dat'), 1113s # ('h', 'hybrid/hybrid_cmake.py'), 1113s ("h", "hybrid/hybrid_pure.dat"), 1113s ("h", "hybrid/hybrid_pure.py"), 1113s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 1113s ("h", "hybrid/data/hybrid_data_pure.dat"), 1113s ("h", "hybrid/hybrid_2/__init__.py"), 1113s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 1113s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 1113s ("p", "hybrid/hybrid_2_pure/__init__.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 1113s ("pm", "pureModule.py"), 1113s ("p", "pure/__init__.py"), 1113s ("p", "pure/pure.py"), 1113s ("p", "pure/data/pure.dat"), 1113s ] 1113s ): 1113s assert _type in {"p", "pm", "h"} 1113s root = package_base if _type in {"p", "pm"} else cmake_source_dir 1113s tmp_dir.ensure(os.path.join(root, path)) 1113s 1113s # Do not call the real setup function. Instead, replace it with 1113s # a MagicMock allowing to check with which arguments it was invoked. 1113s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 1113s 1113s # Convenience print function 1113s def _pprint(desc, value=None): 1113s print( 1113s "-----------------\n" 1113s f"{desc}:\n" 1113s "\n" 1113s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 1113s ) 1113s 1113s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 1113s 1113s _pprint = ._pprint at 0xf726240f0540> 1113s _type = 'p' 1113s cmake_source_dir = '' 1113s has_cmake_module = 1 1113s has_cmake_package = 1 1113s has_hybrid_package = 1 1113s has_pure_module = 0 1113s has_pure_package = 1 1113s mock_setup = 1113s mocker = 1113s package_base = '' 1113s package_base_dir = '' 1113s path = 'pure/data/pure.dat' 1113s path_types = ('c', 'cm', 'h', 'p') 1113s root = '' 1113s select_paths = .select_paths at 0xf726240f3600> 1113s src_dir = local('/tmp/pytest-of-ubuntu/pytest-97/test_setup_inputs0') 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-97/test_setup_inputs0') 1113s with_package_base = 0 1113s 1113s tests/test_setup.py:849: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-97/test_setup_inputs0') 1113s setup_args = ['build'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-97/test_setup_inputs0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ________________________ test_setup_inputs[0-1-0-0-0-0] ________________________ 1113s 1113s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 0 1113s has_pure_package = 0, has_pure_module = 1, with_package_base = 0 1113s mocker = 1113s 1113s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 1113s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 1113s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_module", [0, 1]) 1113s @pytest.mark.parametrize("with_package_base", [0, 1]) 1113s def test_setup_inputs( 1113s has_cmake_package, 1113s has_cmake_module, 1113s has_hybrid_package, 1113s has_pure_package, 1113s has_pure_module, 1113s with_package_base, 1113s mocker, 1113s ): 1113s """This test that a project can have a package with some modules 1113s installed using setup.py and some other modules installed using CMake. 1113s """ 1113s 1113s tmp_dir = _tmpdir("test_setup_inputs") 1113s 1113s package_base = "to/the/base" if with_package_base else "" 1113s package_base_dir = package_base + "/" if package_base else "" 1113s cmake_source_dir = package_base 1113s 1113s if cmake_source_dir and (has_cmake_package or has_cmake_module): 1113s pytest.skip( 1113s "unsupported configuration: " 1113s "python package fully generated by CMake does *NOT* work. " 1113s "At least __init__.py should be in the project source tree" 1113s ) 1113s 1113s # ------------------------------------------------------------------------- 1113s # Here is the "SOURCE" tree layout: 1113s # 1113s # ROOT/ 1113s # 1113s # setup.py 1113s # 1113s # [/] 1113s # 1113s # pureModule.py 1113s # 1113s # pure/ 1113s # __init__.py 1113s # pure.py 1113s # 1113s # data/ 1113s # pure.dat 1113s # 1113s # [/] 1113s # 1113s # hybrid/ 1113s # CMakeLists.txt 1113s # __init__.py 1113s # hybrid_pure.dat 1113s # hybrid_pure.py 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat 1113s # 1113s # hybrid_2/ 1113s # __init__.py 1113s # hybrid_2_pure.py 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py 1113s # hybrid_2_pure_1.py 1113s # hybrid_2_pure_2.py 1113s # 1113s # 1113s # ------------------------------------------------------------------------- 1113s # and here is the "BINARY" distribution layout: 1113s # 1113s # The comment "CMake" or "Setuptools" indicates which tool is responsible 1113s # for placing the file in the tree used to create the binary distribution. 1113s # 1113s # ROOT/ 1113s # 1113s # cmakeModule.py # CMake 1113s # 1113s # cmake/ 1113s # __init__.py # CMake 1113s # cmake.py # CMake 1113s # 1113s # hybrid/ 1113s # hybrid_cmake.dat # CMake 1113s # hybrid_cmake.py # CMake 1113s # hybrid_pure.dat # Setuptools 1113s # hybrid_pure.py # Setuptools 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat # CMake or Setuptools 1113s # hybrid_data_cmake.dat # CMake *NO TEST* 1113s # 1113s # hybrid_2/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure.py # CMake or Setuptools 1113s # hybrid_2_cmake.py # CMake 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure_1.py # CMake or Setuptools 1113s # hybrid_2_pure_2.py # CMake or Setuptools 1113s # 1113s # pureModule.py # Setuptools 1113s # 1113s # pure/ 1113s # __init__.py # Setuptools 1113s # pure.py # Setuptools 1113s # 1113s # data/ 1113s # pure.dat # Setuptools 1113s 1113s tmp_dir.join("setup.py").write( 1113s textwrap.dedent( 1113s """ 1113s from skbuild import setup 1113s #from setuptools import setup 1113s setup( 1113s name="test_hybrid_project", 1113s version="1.2.3", 1113s description=("an hybrid package mixing files installed by both " 1113s "CMake and setuptools"), 1113s author='The scikit-build team', 1113s license="MIT", 1113s cmake_source_dir='{cmake_source_dir}', 1113s cmake_install_dir='{cmake_install_dir}', 1113s # Arbitrary order of packages 1113s packages=[ 1113s {p_off} 'pure', 1113s {h_off} 'hybrid.hybrid_2', 1113s {h_off} 'hybrid', 1113s {c_off} 'cmake', 1113s {p_off} 'hybrid.hybrid_2_pure', 1113s ], 1113s py_modules=[ 1113s {pm_off} '{package_base}pureModule', 1113s {cm_off} '{package_base}cmakeModule', 1113s ], 1113s package_data={{ 1113s {p_off} 'pure': ['data/pure.dat'], 1113s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 1113s }}, 1113s # Arbitrary order of package_dir 1113s package_dir = {{ 1113s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 1113s {p_off} 'pure': '{package_base}pure', 1113s {h_off} 'hybrid': '{package_base}hybrid', 1113s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 1113s {c_off} 'cmake': '{package_base}cmake', 1113s }} 1113s ) 1113s """.format( 1113s cmake_source_dir=cmake_source_dir, 1113s cmake_install_dir=package_base, 1113s package_base=package_base_dir, 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s p_off="" if has_pure_package else "#", 1113s pm_off="" if has_pure_module else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s src_dir = tmp_dir.ensure(package_base, dir=1) 1113s 1113s src_dir.join("CMakeLists.txt").write( 1113s textwrap.dedent( 1113s """ 1113s cmake_minimum_required(VERSION 3.5.0) 1113s project(hybrid NONE) 1113s set(build_dir ${{CMAKE_BINARY_DIR}}) 1113s 1113s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 1113s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 1113s {c_off} install( 1113s {c_off} FILES 1113s {c_off} ${{build_dir}}/__init__.py 1113s {c_off} ${{build_dir}}/cmake.py 1113s {c_off} DESTINATION cmake 1113s {c_off} ) 1113s 1113s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 1113s {cm_off} install( 1113s {cm_off} FILES ${{build_dir}}/cmakeModule.py 1113s {cm_off} DESTINATION .) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 1113s {h_off} DESTINATION hybrid/data) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 1113s {h_off} DESTINATION hybrid/hybrid_2) 1113s 1113s install(CODE "message(STATUS \\\"Installation complete\\\")") 1113s """.format( 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 1113s path_types: Sequence[str] 1113s try: 1113s path_types = next( 1113s iter( 1113s zip( 1113s *filter( 1113s lambda i: i[1], 1113s [ 1113s ("c", has_cmake_package), 1113s ("cm", has_cmake_module), 1113s ("h", has_hybrid_package), 1113s ("p", has_pure_package), 1113s ("pm", has_pure_module), 1113s ], 1113s ) 1113s ) 1113s ) 1113s ) 1113s except StopIteration: 1113s path_types = [] 1113s 1113s def select_paths(annotated_paths): 1113s """Return a filtered list paths considering ``path_types``. 1113s 1113s `annotated_paths`` is list of tuple ``(type, path)`` where type 1113s is either `c`, 'cm', `h`, `p` or 'pm'. 1113s 1113s """ 1113s return filter(lambda i: i[0] in path_types, annotated_paths) 1113s 1113s # Commented paths are the one expected to be installed by CMake. For 1113s # this reason, corresponding files should NOT be created in the source 1113s # tree. 1113s for _type, path in select_paths( 1113s [ 1113s # ('c', 'cmake/__init__.py'), 1113s # ('c', 'cmake/cmake.py'), 1113s # ('cm', 'cmakeModule.py'), 1113s ("h", "hybrid/__init__.py"), 1113s # ('h', 'hybrid/hybrid_cmake.dat'), 1113s # ('h', 'hybrid/hybrid_cmake.py'), 1113s ("h", "hybrid/hybrid_pure.dat"), 1113s ("h", "hybrid/hybrid_pure.py"), 1113s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 1113s ("h", "hybrid/data/hybrid_data_pure.dat"), 1113s ("h", "hybrid/hybrid_2/__init__.py"), 1113s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 1113s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 1113s ("p", "hybrid/hybrid_2_pure/__init__.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 1113s ("pm", "pureModule.py"), 1113s ("p", "pure/__init__.py"), 1113s ("p", "pure/pure.py"), 1113s ("p", "pure/data/pure.dat"), 1113s ] 1113s ): 1113s assert _type in {"p", "pm", "h"} 1113s root = package_base if _type in {"p", "pm"} else cmake_source_dir 1113s tmp_dir.ensure(os.path.join(root, path)) 1113s 1113s # Do not call the real setup function. Instead, replace it with 1113s # a MagicMock allowing to check with which arguments it was invoked. 1113s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 1113s 1113s # Convenience print function 1113s def _pprint(desc, value=None): 1113s print( 1113s "-----------------\n" 1113s f"{desc}:\n" 1113s "\n" 1113s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 1113s ) 1113s 1113s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 1113s 1113s _pprint = ._pprint at 0xf726240f2f20> 1113s _type = 'pm' 1113s cmake_source_dir = '' 1113s has_cmake_module = 0 1113s has_cmake_package = 0 1113s has_hybrid_package = 0 1113s has_pure_module = 1 1113s has_pure_package = 0 1113s mock_setup = 1113s mocker = 1113s package_base = '' 1113s package_base_dir = '' 1113s path = 'pureModule.py' 1113s path_types = ('pm',) 1113s root = '' 1113s select_paths = .select_paths at 0xf726240f2a20> 1113s src_dir = local('/tmp/pytest-of-ubuntu/pytest-98/test_setup_inputs0') 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-98/test_setup_inputs0') 1113s with_package_base = 0 1113s 1113s tests/test_setup.py:849: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-98/test_setup_inputs0') 1113s setup_args = ['build'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-98/test_setup_inputs0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ________________________ test_setup_inputs[0-1-0-0-0-1] ________________________ 1113s 1113s has_cmake_package = 1, has_cmake_module = 0, has_hybrid_package = 0 1113s has_pure_package = 0, has_pure_module = 1, with_package_base = 0 1113s mocker = 1113s 1113s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 1113s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 1113s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_module", [0, 1]) 1113s @pytest.mark.parametrize("with_package_base", [0, 1]) 1113s def test_setup_inputs( 1113s has_cmake_package, 1113s has_cmake_module, 1113s has_hybrid_package, 1113s has_pure_package, 1113s has_pure_module, 1113s with_package_base, 1113s mocker, 1113s ): 1113s """This test that a project can have a package with some modules 1113s installed using setup.py and some other modules installed using CMake. 1113s """ 1113s 1113s tmp_dir = _tmpdir("test_setup_inputs") 1113s 1113s package_base = "to/the/base" if with_package_base else "" 1113s package_base_dir = package_base + "/" if package_base else "" 1113s cmake_source_dir = package_base 1113s 1113s if cmake_source_dir and (has_cmake_package or has_cmake_module): 1113s pytest.skip( 1113s "unsupported configuration: " 1113s "python package fully generated by CMake does *NOT* work. " 1113s "At least __init__.py should be in the project source tree" 1113s ) 1113s 1113s # ------------------------------------------------------------------------- 1113s # Here is the "SOURCE" tree layout: 1113s # 1113s # ROOT/ 1113s # 1113s # setup.py 1113s # 1113s # [/] 1113s # 1113s # pureModule.py 1113s # 1113s # pure/ 1113s # __init__.py 1113s # pure.py 1113s # 1113s # data/ 1113s # pure.dat 1113s # 1113s # [/] 1113s # 1113s # hybrid/ 1113s # CMakeLists.txt 1113s # __init__.py 1113s # hybrid_pure.dat 1113s # hybrid_pure.py 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat 1113s # 1113s # hybrid_2/ 1113s # __init__.py 1113s # hybrid_2_pure.py 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py 1113s # hybrid_2_pure_1.py 1113s # hybrid_2_pure_2.py 1113s # 1113s # 1113s # ------------------------------------------------------------------------- 1113s # and here is the "BINARY" distribution layout: 1113s # 1113s # The comment "CMake" or "Setuptools" indicates which tool is responsible 1113s # for placing the file in the tree used to create the binary distribution. 1113s # 1113s # ROOT/ 1113s # 1113s # cmakeModule.py # CMake 1113s # 1113s # cmake/ 1113s # __init__.py # CMake 1113s # cmake.py # CMake 1113s # 1113s # hybrid/ 1113s # hybrid_cmake.dat # CMake 1113s # hybrid_cmake.py # CMake 1113s # hybrid_pure.dat # Setuptools 1113s # hybrid_pure.py # Setuptools 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat # CMake or Setuptools 1113s # hybrid_data_cmake.dat # CMake *NO TEST* 1113s # 1113s # hybrid_2/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure.py # CMake or Setuptools 1113s # hybrid_2_cmake.py # CMake 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure_1.py # CMake or Setuptools 1113s # hybrid_2_pure_2.py # CMake or Setuptools 1113s # 1113s # pureModule.py # Setuptools 1113s # 1113s # pure/ 1113s # __init__.py # Setuptools 1113s # pure.py # Setuptools 1113s # 1113s # data/ 1113s # pure.dat # Setuptools 1113s 1113s tmp_dir.join("setup.py").write( 1113s textwrap.dedent( 1113s """ 1113s from skbuild import setup 1113s #from setuptools import setup 1113s setup( 1113s name="test_hybrid_project", 1113s version="1.2.3", 1113s description=("an hybrid package mixing files installed by both " 1113s "CMake and setuptools"), 1113s author='The scikit-build team', 1113s license="MIT", 1113s cmake_source_dir='{cmake_source_dir}', 1113s cmake_install_dir='{cmake_install_dir}', 1113s # Arbitrary order of packages 1113s packages=[ 1113s {p_off} 'pure', 1113s {h_off} 'hybrid.hybrid_2', 1113s {h_off} 'hybrid', 1113s {c_off} 'cmake', 1113s {p_off} 'hybrid.hybrid_2_pure', 1113s ], 1113s py_modules=[ 1113s {pm_off} '{package_base}pureModule', 1113s {cm_off} '{package_base}cmakeModule', 1113s ], 1113s package_data={{ 1113s {p_off} 'pure': ['data/pure.dat'], 1113s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 1113s }}, 1113s # Arbitrary order of package_dir 1113s package_dir = {{ 1113s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 1113s {p_off} 'pure': '{package_base}pure', 1113s {h_off} 'hybrid': '{package_base}hybrid', 1113s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 1113s {c_off} 'cmake': '{package_base}cmake', 1113s }} 1113s ) 1113s """.format( 1113s cmake_source_dir=cmake_source_dir, 1113s cmake_install_dir=package_base, 1113s package_base=package_base_dir, 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s p_off="" if has_pure_package else "#", 1113s pm_off="" if has_pure_module else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s src_dir = tmp_dir.ensure(package_base, dir=1) 1113s 1113s src_dir.join("CMakeLists.txt").write( 1113s textwrap.dedent( 1113s """ 1113s cmake_minimum_required(VERSION 3.5.0) 1113s project(hybrid NONE) 1113s set(build_dir ${{CMAKE_BINARY_DIR}}) 1113s 1113s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 1113s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 1113s {c_off} install( 1113s {c_off} FILES 1113s {c_off} ${{build_dir}}/__init__.py 1113s {c_off} ${{build_dir}}/cmake.py 1113s {c_off} DESTINATION cmake 1113s {c_off} ) 1113s 1113s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 1113s {cm_off} install( 1113s {cm_off} FILES ${{build_dir}}/cmakeModule.py 1113s {cm_off} DESTINATION .) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 1113s {h_off} DESTINATION hybrid/data) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 1113s {h_off} DESTINATION hybrid/hybrid_2) 1113s 1113s install(CODE "message(STATUS \\\"Installation complete\\\")") 1113s """.format( 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 1113s path_types: Sequence[str] 1113s try: 1113s path_types = next( 1113s iter( 1113s zip( 1113s *filter( 1113s lambda i: i[1], 1113s [ 1113s ("c", has_cmake_package), 1113s ("cm", has_cmake_module), 1113s ("h", has_hybrid_package), 1113s ("p", has_pure_package), 1113s ("pm", has_pure_module), 1113s ], 1113s ) 1113s ) 1113s ) 1113s ) 1113s except StopIteration: 1113s path_types = [] 1113s 1113s def select_paths(annotated_paths): 1113s """Return a filtered list paths considering ``path_types``. 1113s 1113s `annotated_paths`` is list of tuple ``(type, path)`` where type 1113s is either `c`, 'cm', `h`, `p` or 'pm'. 1113s 1113s """ 1113s return filter(lambda i: i[0] in path_types, annotated_paths) 1113s 1113s # Commented paths are the one expected to be installed by CMake. For 1113s # this reason, corresponding files should NOT be created in the source 1113s # tree. 1113s for _type, path in select_paths( 1113s [ 1113s # ('c', 'cmake/__init__.py'), 1113s # ('c', 'cmake/cmake.py'), 1113s # ('cm', 'cmakeModule.py'), 1113s ("h", "hybrid/__init__.py"), 1113s # ('h', 'hybrid/hybrid_cmake.dat'), 1113s # ('h', 'hybrid/hybrid_cmake.py'), 1113s ("h", "hybrid/hybrid_pure.dat"), 1113s ("h", "hybrid/hybrid_pure.py"), 1113s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 1113s ("h", "hybrid/data/hybrid_data_pure.dat"), 1113s ("h", "hybrid/hybrid_2/__init__.py"), 1113s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 1113s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 1113s ("p", "hybrid/hybrid_2_pure/__init__.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 1113s ("pm", "pureModule.py"), 1113s ("p", "pure/__init__.py"), 1113s ("p", "pure/pure.py"), 1113s ("p", "pure/data/pure.dat"), 1113s ] 1113s ): 1113s assert _type in {"p", "pm", "h"} 1113s root = package_base if _type in {"p", "pm"} else cmake_source_dir 1113s tmp_dir.ensure(os.path.join(root, path)) 1113s 1113s # Do not call the real setup function. Instead, replace it with 1113s # a MagicMock allowing to check with which arguments it was invoked. 1113s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 1113s 1113s # Convenience print function 1113s def _pprint(desc, value=None): 1113s print( 1113s "-----------------\n" 1113s f"{desc}:\n" 1113s "\n" 1113s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 1113s ) 1113s 1113s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 1113s 1113s _pprint = ._pprint at 0xf726240f3380> 1113s _type = 'pm' 1113s cmake_source_dir = '' 1113s has_cmake_module = 0 1113s has_cmake_package = 1 1113s has_hybrid_package = 0 1113s has_pure_module = 1 1113s has_pure_package = 0 1113s mock_setup = 1113s mocker = 1113s package_base = '' 1113s package_base_dir = '' 1113s path = 'pureModule.py' 1113s path_types = ('c', 'pm') 1113s root = '' 1113s select_paths = .select_paths at 0xf726240f3920> 1113s src_dir = local('/tmp/pytest-of-ubuntu/pytest-99/test_setup_inputs0') 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-99/test_setup_inputs0') 1113s with_package_base = 0 1113s 1113s tests/test_setup.py:849: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-99/test_setup_inputs0') 1113s setup_args = ['build'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-99/test_setup_inputs0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ________________________ test_setup_inputs[0-1-0-0-1-0] ________________________ 1113s 1113s has_cmake_package = 0, has_cmake_module = 1, has_hybrid_package = 0 1113s has_pure_package = 0, has_pure_module = 1, with_package_base = 0 1113s mocker = 1113s 1113s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 1113s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 1113s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_module", [0, 1]) 1113s @pytest.mark.parametrize("with_package_base", [0, 1]) 1113s def test_setup_inputs( 1113s has_cmake_package, 1113s has_cmake_module, 1113s has_hybrid_package, 1113s has_pure_package, 1113s has_pure_module, 1113s with_package_base, 1113s mocker, 1113s ): 1113s """This test that a project can have a package with some modules 1113s installed using setup.py and some other modules installed using CMake. 1113s """ 1113s 1113s tmp_dir = _tmpdir("test_setup_inputs") 1113s 1113s package_base = "to/the/base" if with_package_base else "" 1113s package_base_dir = package_base + "/" if package_base else "" 1113s cmake_source_dir = package_base 1113s 1113s if cmake_source_dir and (has_cmake_package or has_cmake_module): 1113s pytest.skip( 1113s "unsupported configuration: " 1113s "python package fully generated by CMake does *NOT* work. " 1113s "At least __init__.py should be in the project source tree" 1113s ) 1113s 1113s # ------------------------------------------------------------------------- 1113s # Here is the "SOURCE" tree layout: 1113s # 1113s # ROOT/ 1113s # 1113s # setup.py 1113s # 1113s # [/] 1113s # 1113s # pureModule.py 1113s # 1113s # pure/ 1113s # __init__.py 1113s # pure.py 1113s # 1113s # data/ 1113s # pure.dat 1113s # 1113s # [/] 1113s # 1113s # hybrid/ 1113s # CMakeLists.txt 1113s # __init__.py 1113s # hybrid_pure.dat 1113s # hybrid_pure.py 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat 1113s # 1113s # hybrid_2/ 1113s # __init__.py 1113s # hybrid_2_pure.py 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py 1113s # hybrid_2_pure_1.py 1113s # hybrid_2_pure_2.py 1113s # 1113s # 1113s # ------------------------------------------------------------------------- 1113s # and here is the "BINARY" distribution layout: 1113s # 1113s # The comment "CMake" or "Setuptools" indicates which tool is responsible 1113s # for placing the file in the tree used to create the binary distribution. 1113s # 1113s # ROOT/ 1113s # 1113s # cmakeModule.py # CMake 1113s # 1113s # cmake/ 1113s # __init__.py # CMake 1113s # cmake.py # CMake 1113s # 1113s # hybrid/ 1113s # hybrid_cmake.dat # CMake 1113s # hybrid_cmake.py # CMake 1113s # hybrid_pure.dat # Setuptools 1113s # hybrid_pure.py # Setuptools 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat # CMake or Setuptools 1113s # hybrid_data_cmake.dat # CMake *NO TEST* 1113s # 1113s # hybrid_2/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure.py # CMake or Setuptools 1113s # hybrid_2_cmake.py # CMake 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure_1.py # CMake or Setuptools 1113s # hybrid_2_pure_2.py # CMake or Setuptools 1113s # 1113s # pureModule.py # Setuptools 1113s # 1113s # pure/ 1113s # __init__.py # Setuptools 1113s # pure.py # Setuptools 1113s # 1113s # data/ 1113s # pure.dat # Setuptools 1113s 1113s tmp_dir.join("setup.py").write( 1113s textwrap.dedent( 1113s """ 1113s from skbuild import setup 1113s #from setuptools import setup 1113s setup( 1113s name="test_hybrid_project", 1113s version="1.2.3", 1113s description=("an hybrid package mixing files installed by both " 1113s "CMake and setuptools"), 1113s author='The scikit-build team', 1113s license="MIT", 1113s cmake_source_dir='{cmake_source_dir}', 1113s cmake_install_dir='{cmake_install_dir}', 1113s # Arbitrary order of packages 1113s packages=[ 1113s {p_off} 'pure', 1113s {h_off} 'hybrid.hybrid_2', 1113s {h_off} 'hybrid', 1113s {c_off} 'cmake', 1113s {p_off} 'hybrid.hybrid_2_pure', 1113s ], 1113s py_modules=[ 1113s {pm_off} '{package_base}pureModule', 1113s {cm_off} '{package_base}cmakeModule', 1113s ], 1113s package_data={{ 1113s {p_off} 'pure': ['data/pure.dat'], 1113s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 1113s }}, 1113s # Arbitrary order of package_dir 1113s package_dir = {{ 1113s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 1113s {p_off} 'pure': '{package_base}pure', 1113s {h_off} 'hybrid': '{package_base}hybrid', 1113s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 1113s {c_off} 'cmake': '{package_base}cmake', 1113s }} 1113s ) 1113s """.format( 1113s cmake_source_dir=cmake_source_dir, 1113s cmake_install_dir=package_base, 1113s package_base=package_base_dir, 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s p_off="" if has_pure_package else "#", 1113s pm_off="" if has_pure_module else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s src_dir = tmp_dir.ensure(package_base, dir=1) 1113s 1113s src_dir.join("CMakeLists.txt").write( 1113s textwrap.dedent( 1113s """ 1113s cmake_minimum_required(VERSION 3.5.0) 1113s project(hybrid NONE) 1113s set(build_dir ${{CMAKE_BINARY_DIR}}) 1113s 1113s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 1113s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 1113s {c_off} install( 1113s {c_off} FILES 1113s {c_off} ${{build_dir}}/__init__.py 1113s {c_off} ${{build_dir}}/cmake.py 1113s {c_off} DESTINATION cmake 1113s {c_off} ) 1113s 1113s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 1113s {cm_off} install( 1113s {cm_off} FILES ${{build_dir}}/cmakeModule.py 1113s {cm_off} DESTINATION .) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 1113s {h_off} DESTINATION hybrid/data) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 1113s {h_off} DESTINATION hybrid/hybrid_2) 1113s 1113s install(CODE "message(STATUS \\\"Installation complete\\\")") 1113s """.format( 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 1113s path_types: Sequence[str] 1113s try: 1113s path_types = next( 1113s iter( 1113s zip( 1113s *filter( 1113s lambda i: i[1], 1113s [ 1113s ("c", has_cmake_package), 1113s ("cm", has_cmake_module), 1113s ("h", has_hybrid_package), 1113s ("p", has_pure_package), 1113s ("pm", has_pure_module), 1113s ], 1113s ) 1113s ) 1113s ) 1113s ) 1113s except StopIteration: 1113s path_types = [] 1113s 1113s def select_paths(annotated_paths): 1113s """Return a filtered list paths considering ``path_types``. 1113s 1113s `annotated_paths`` is list of tuple ``(type, path)`` where type 1113s is either `c`, 'cm', `h`, `p` or 'pm'. 1113s 1113s """ 1113s return filter(lambda i: i[0] in path_types, annotated_paths) 1113s 1113s # Commented paths are the one expected to be installed by CMake. For 1113s # this reason, corresponding files should NOT be created in the source 1113s # tree. 1113s for _type, path in select_paths( 1113s [ 1113s # ('c', 'cmake/__init__.py'), 1113s # ('c', 'cmake/cmake.py'), 1113s # ('cm', 'cmakeModule.py'), 1113s ("h", "hybrid/__init__.py"), 1113s # ('h', 'hybrid/hybrid_cmake.dat'), 1113s # ('h', 'hybrid/hybrid_cmake.py'), 1113s ("h", "hybrid/hybrid_pure.dat"), 1113s ("h", "hybrid/hybrid_pure.py"), 1113s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 1113s ("h", "hybrid/data/hybrid_data_pure.dat"), 1113s ("h", "hybrid/hybrid_2/__init__.py"), 1113s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 1113s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 1113s ("p", "hybrid/hybrid_2_pure/__init__.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 1113s ("pm", "pureModule.py"), 1113s ("p", "pure/__init__.py"), 1113s ("p", "pure/pure.py"), 1113s ("p", "pure/data/pure.dat"), 1113s ] 1113s ): 1113s assert _type in {"p", "pm", "h"} 1113s root = package_base if _type in {"p", "pm"} else cmake_source_dir 1113s tmp_dir.ensure(os.path.join(root, path)) 1113s 1113s # Do not call the real setup function. Instead, replace it with 1113s # a MagicMock allowing to check with which arguments it was invoked. 1113s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 1113s 1113s # Convenience print function 1113s def _pprint(desc, value=None): 1113s print( 1113s "-----------------\n" 1113s f"{desc}:\n" 1113s "\n" 1113s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 1113s ) 1113s 1113s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 1113s 1113s _pprint = ._pprint at 0xf726240f2200> 1113s _type = 'pm' 1113s cmake_source_dir = '' 1113s has_cmake_module = 1 1113s has_cmake_package = 0 1113s has_hybrid_package = 0 1113s has_pure_module = 1 1113s has_pure_package = 0 1113s mock_setup = 1113s mocker = 1113s package_base = '' 1113s package_base_dir = '' 1113s path = 'pureModule.py' 1113s path_types = ('cm', 'pm') 1113s root = '' 1113s select_paths = .select_paths at 0xf726240f3ec0> 1113s src_dir = local('/tmp/pytest-of-ubuntu/pytest-100/test_setup_inputs0') 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-100/test_setup_inputs0') 1113s with_package_base = 0 1113s 1113s tests/test_setup.py:849: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-100/test_setup_inputs0') 1113s setup_args = ['build'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-100/test_setup_inputs0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ________________________ test_setup_inputs[0-1-0-0-1-1] ________________________ 1113s 1113s has_cmake_package = 1, has_cmake_module = 1, has_hybrid_package = 0 1113s has_pure_package = 0, has_pure_module = 1, with_package_base = 0 1113s mocker = 1113s 1113s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 1113s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 1113s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_module", [0, 1]) 1113s @pytest.mark.parametrize("with_package_base", [0, 1]) 1113s def test_setup_inputs( 1113s has_cmake_package, 1113s has_cmake_module, 1113s has_hybrid_package, 1113s has_pure_package, 1113s has_pure_module, 1113s with_package_base, 1113s mocker, 1113s ): 1113s """This test that a project can have a package with some modules 1113s installed using setup.py and some other modules installed using CMake. 1113s """ 1113s 1113s tmp_dir = _tmpdir("test_setup_inputs") 1113s 1113s package_base = "to/the/base" if with_package_base else "" 1113s package_base_dir = package_base + "/" if package_base else "" 1113s cmake_source_dir = package_base 1113s 1113s if cmake_source_dir and (has_cmake_package or has_cmake_module): 1113s pytest.skip( 1113s "unsupported configuration: " 1113s "python package fully generated by CMake does *NOT* work. " 1113s "At least __init__.py should be in the project source tree" 1113s ) 1113s 1113s # ------------------------------------------------------------------------- 1113s # Here is the "SOURCE" tree layout: 1113s # 1113s # ROOT/ 1113s # 1113s # setup.py 1113s # 1113s # [/] 1113s # 1113s # pureModule.py 1113s # 1113s # pure/ 1113s # __init__.py 1113s # pure.py 1113s # 1113s # data/ 1113s # pure.dat 1113s # 1113s # [/] 1113s # 1113s # hybrid/ 1113s # CMakeLists.txt 1113s # __init__.py 1113s # hybrid_pure.dat 1113s # hybrid_pure.py 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat 1113s # 1113s # hybrid_2/ 1113s # __init__.py 1113s # hybrid_2_pure.py 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py 1113s # hybrid_2_pure_1.py 1113s # hybrid_2_pure_2.py 1113s # 1113s # 1113s # ------------------------------------------------------------------------- 1113s # and here is the "BINARY" distribution layout: 1113s # 1113s # The comment "CMake" or "Setuptools" indicates which tool is responsible 1113s # for placing the file in the tree used to create the binary distribution. 1113s # 1113s # ROOT/ 1113s # 1113s # cmakeModule.py # CMake 1113s # 1113s # cmake/ 1113s # __init__.py # CMake 1113s # cmake.py # CMake 1113s # 1113s # hybrid/ 1113s # hybrid_cmake.dat # CMake 1113s # hybrid_cmake.py # CMake 1113s # hybrid_pure.dat # Setuptools 1113s # hybrid_pure.py # Setuptools 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat # CMake or Setuptools 1113s # hybrid_data_cmake.dat # CMake *NO TEST* 1113s # 1113s # hybrid_2/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure.py # CMake or Setuptools 1113s # hybrid_2_cmake.py # CMake 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure_1.py # CMake or Setuptools 1113s # hybrid_2_pure_2.py # CMake or Setuptools 1113s # 1113s # pureModule.py # Setuptools 1113s # 1113s # pure/ 1113s # __init__.py # Setuptools 1113s # pure.py # Setuptools 1113s # 1113s # data/ 1113s # pure.dat # Setuptools 1113s 1113s tmp_dir.join("setup.py").write( 1113s textwrap.dedent( 1113s """ 1113s from skbuild import setup 1113s #from setuptools import setup 1113s setup( 1113s name="test_hybrid_project", 1113s version="1.2.3", 1113s description=("an hybrid package mixing files installed by both " 1113s "CMake and setuptools"), 1113s author='The scikit-build team', 1113s license="MIT", 1113s cmake_source_dir='{cmake_source_dir}', 1113s cmake_install_dir='{cmake_install_dir}', 1113s # Arbitrary order of packages 1113s packages=[ 1113s {p_off} 'pure', 1113s {h_off} 'hybrid.hybrid_2', 1113s {h_off} 'hybrid', 1113s {c_off} 'cmake', 1113s {p_off} 'hybrid.hybrid_2_pure', 1113s ], 1113s py_modules=[ 1113s {pm_off} '{package_base}pureModule', 1113s {cm_off} '{package_base}cmakeModule', 1113s ], 1113s package_data={{ 1113s {p_off} 'pure': ['data/pure.dat'], 1113s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 1113s }}, 1113s # Arbitrary order of package_dir 1113s package_dir = {{ 1113s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 1113s {p_off} 'pure': '{package_base}pure', 1113s {h_off} 'hybrid': '{package_base}hybrid', 1113s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 1113s {c_off} 'cmake': '{package_base}cmake', 1113s }} 1113s ) 1113s """.format( 1113s cmake_source_dir=cmake_source_dir, 1113s cmake_install_dir=package_base, 1113s package_base=package_base_dir, 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s p_off="" if has_pure_package else "#", 1113s pm_off="" if has_pure_module else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s src_dir = tmp_dir.ensure(package_base, dir=1) 1113s 1113s src_dir.join("CMakeLists.txt").write( 1113s textwrap.dedent( 1113s """ 1113s cmake_minimum_required(VERSION 3.5.0) 1113s project(hybrid NONE) 1113s set(build_dir ${{CMAKE_BINARY_DIR}}) 1113s 1113s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 1113s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 1113s {c_off} install( 1113s {c_off} FILES 1113s {c_off} ${{build_dir}}/__init__.py 1113s {c_off} ${{build_dir}}/cmake.py 1113s {c_off} DESTINATION cmake 1113s {c_off} ) 1113s 1113s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 1113s {cm_off} install( 1113s {cm_off} FILES ${{build_dir}}/cmakeModule.py 1113s {cm_off} DESTINATION .) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 1113s {h_off} DESTINATION hybrid/data) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 1113s {h_off} DESTINATION hybrid/hybrid_2) 1113s 1113s install(CODE "message(STATUS \\\"Installation complete\\\")") 1113s """.format( 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 1113s path_types: Sequence[str] 1113s try: 1113s path_types = next( 1113s iter( 1113s zip( 1113s *filter( 1113s lambda i: i[1], 1113s [ 1113s ("c", has_cmake_package), 1113s ("cm", has_cmake_module), 1113s ("h", has_hybrid_package), 1113s ("p", has_pure_package), 1113s ("pm", has_pure_module), 1113s ], 1113s ) 1113s ) 1113s ) 1113s ) 1113s except StopIteration: 1113s path_types = [] 1113s 1113s def select_paths(annotated_paths): 1113s """Return a filtered list paths considering ``path_types``. 1113s 1113s `annotated_paths`` is list of tuple ``(type, path)`` where type 1113s is either `c`, 'cm', `h`, `p` or 'pm'. 1113s 1113s """ 1113s return filter(lambda i: i[0] in path_types, annotated_paths) 1113s 1113s # Commented paths are the one expected to be installed by CMake. For 1113s # this reason, corresponding files should NOT be created in the source 1113s # tree. 1113s for _type, path in select_paths( 1113s [ 1113s # ('c', 'cmake/__init__.py'), 1113s # ('c', 'cmake/cmake.py'), 1113s # ('cm', 'cmakeModule.py'), 1113s ("h", "hybrid/__init__.py"), 1113s # ('h', 'hybrid/hybrid_cmake.dat'), 1113s # ('h', 'hybrid/hybrid_cmake.py'), 1113s ("h", "hybrid/hybrid_pure.dat"), 1113s ("h", "hybrid/hybrid_pure.py"), 1113s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 1113s ("h", "hybrid/data/hybrid_data_pure.dat"), 1113s ("h", "hybrid/hybrid_2/__init__.py"), 1113s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 1113s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 1113s ("p", "hybrid/hybrid_2_pure/__init__.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 1113s ("pm", "pureModule.py"), 1113s ("p", "pure/__init__.py"), 1113s ("p", "pure/pure.py"), 1113s ("p", "pure/data/pure.dat"), 1113s ] 1113s ): 1113s assert _type in {"p", "pm", "h"} 1113s root = package_base if _type in {"p", "pm"} else cmake_source_dir 1113s tmp_dir.ensure(os.path.join(root, path)) 1113s 1113s # Do not call the real setup function. Instead, replace it with 1113s # a MagicMock allowing to check with which arguments it was invoked. 1113s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 1113s 1113s # Convenience print function 1113s def _pprint(desc, value=None): 1113s print( 1113s "-----------------\n" 1113s f"{desc}:\n" 1113s "\n" 1113s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 1113s ) 1113s 1113s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 1113s 1113s _pprint = ._pprint at 0xf726240f3ce0> 1113s _type = 'pm' 1113s cmake_source_dir = '' 1113s has_cmake_module = 1 1113s has_cmake_package = 1 1113s has_hybrid_package = 0 1113s has_pure_module = 1 1113s has_pure_package = 0 1113s mock_setup = 1113s mocker = 1113s package_base = '' 1113s package_base_dir = '' 1113s path = 'pureModule.py' 1113s path_types = ('c', 'cm', 'pm') 1113s root = '' 1113s select_paths = .select_paths at 0xf726240f3560> 1113s src_dir = local('/tmp/pytest-of-ubuntu/pytest-101/test_setup_inputs0') 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-101/test_setup_inputs0') 1113s with_package_base = 0 1113s 1113s tests/test_setup.py:849: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-101/test_setup_inputs0') 1113s setup_args = ['build'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-101/test_setup_inputs0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ________________________ test_setup_inputs[0-1-0-1-0-0] ________________________ 1113s 1113s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 1 1113s has_pure_package = 0, has_pure_module = 1, with_package_base = 0 1113s mocker = 1113s 1113s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 1113s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 1113s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_module", [0, 1]) 1113s @pytest.mark.parametrize("with_package_base", [0, 1]) 1113s def test_setup_inputs( 1113s has_cmake_package, 1113s has_cmake_module, 1113s has_hybrid_package, 1113s has_pure_package, 1113s has_pure_module, 1113s with_package_base, 1113s mocker, 1113s ): 1113s """This test that a project can have a package with some modules 1113s installed using setup.py and some other modules installed using CMake. 1113s """ 1113s 1113s tmp_dir = _tmpdir("test_setup_inputs") 1113s 1113s package_base = "to/the/base" if with_package_base else "" 1113s package_base_dir = package_base + "/" if package_base else "" 1113s cmake_source_dir = package_base 1113s 1113s if cmake_source_dir and (has_cmake_package or has_cmake_module): 1113s pytest.skip( 1113s "unsupported configuration: " 1113s "python package fully generated by CMake does *NOT* work. " 1113s "At least __init__.py should be in the project source tree" 1113s ) 1113s 1113s # ------------------------------------------------------------------------- 1113s # Here is the "SOURCE" tree layout: 1113s # 1113s # ROOT/ 1113s # 1113s # setup.py 1113s # 1113s # [/] 1113s # 1113s # pureModule.py 1113s # 1113s # pure/ 1113s # __init__.py 1113s # pure.py 1113s # 1113s # data/ 1113s # pure.dat 1113s # 1113s # [/] 1113s # 1113s # hybrid/ 1113s # CMakeLists.txt 1113s # __init__.py 1113s # hybrid_pure.dat 1113s # hybrid_pure.py 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat 1113s # 1113s # hybrid_2/ 1113s # __init__.py 1113s # hybrid_2_pure.py 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py 1113s # hybrid_2_pure_1.py 1113s # hybrid_2_pure_2.py 1113s # 1113s # 1113s # ------------------------------------------------------------------------- 1113s # and here is the "BINARY" distribution layout: 1113s # 1113s # The comment "CMake" or "Setuptools" indicates which tool is responsible 1113s # for placing the file in the tree used to create the binary distribution. 1113s # 1113s # ROOT/ 1113s # 1113s # cmakeModule.py # CMake 1113s # 1113s # cmake/ 1113s # __init__.py # CMake 1113s # cmake.py # CMake 1113s # 1113s # hybrid/ 1113s # hybrid_cmake.dat # CMake 1113s # hybrid_cmake.py # CMake 1113s # hybrid_pure.dat # Setuptools 1113s # hybrid_pure.py # Setuptools 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat # CMake or Setuptools 1113s # hybrid_data_cmake.dat # CMake *NO TEST* 1113s # 1113s # hybrid_2/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure.py # CMake or Setuptools 1113s # hybrid_2_cmake.py # CMake 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure_1.py # CMake or Setuptools 1113s # hybrid_2_pure_2.py # CMake or Setuptools 1113s # 1113s # pureModule.py # Setuptools 1113s # 1113s # pure/ 1113s # __init__.py # Setuptools 1113s # pure.py # Setuptools 1113s # 1113s # data/ 1113s # pure.dat # Setuptools 1113s 1113s tmp_dir.join("setup.py").write( 1113s textwrap.dedent( 1113s """ 1113s from skbuild import setup 1113s #from setuptools import setup 1113s setup( 1113s name="test_hybrid_project", 1113s version="1.2.3", 1113s description=("an hybrid package mixing files installed by both " 1113s "CMake and setuptools"), 1113s author='The scikit-build team', 1113s license="MIT", 1113s cmake_source_dir='{cmake_source_dir}', 1113s cmake_install_dir='{cmake_install_dir}', 1113s # Arbitrary order of packages 1113s packages=[ 1113s {p_off} 'pure', 1113s {h_off} 'hybrid.hybrid_2', 1113s {h_off} 'hybrid', 1113s {c_off} 'cmake', 1113s {p_off} 'hybrid.hybrid_2_pure', 1113s ], 1113s py_modules=[ 1113s {pm_off} '{package_base}pureModule', 1113s {cm_off} '{package_base}cmakeModule', 1113s ], 1113s package_data={{ 1113s {p_off} 'pure': ['data/pure.dat'], 1113s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 1113s }}, 1113s # Arbitrary order of package_dir 1113s package_dir = {{ 1113s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 1113s {p_off} 'pure': '{package_base}pure', 1113s {h_off} 'hybrid': '{package_base}hybrid', 1113s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 1113s {c_off} 'cmake': '{package_base}cmake', 1113s }} 1113s ) 1113s """.format( 1113s cmake_source_dir=cmake_source_dir, 1113s cmake_install_dir=package_base, 1113s package_base=package_base_dir, 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s p_off="" if has_pure_package else "#", 1113s pm_off="" if has_pure_module else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s src_dir = tmp_dir.ensure(package_base, dir=1) 1113s 1113s src_dir.join("CMakeLists.txt").write( 1113s textwrap.dedent( 1113s """ 1113s cmake_minimum_required(VERSION 3.5.0) 1113s project(hybrid NONE) 1113s set(build_dir ${{CMAKE_BINARY_DIR}}) 1113s 1113s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 1113s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 1113s {c_off} install( 1113s {c_off} FILES 1113s {c_off} ${{build_dir}}/__init__.py 1113s {c_off} ${{build_dir}}/cmake.py 1113s {c_off} DESTINATION cmake 1113s {c_off} ) 1113s 1113s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 1113s {cm_off} install( 1113s {cm_off} FILES ${{build_dir}}/cmakeModule.py 1113s {cm_off} DESTINATION .) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 1113s {h_off} DESTINATION hybrid/data) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 1113s {h_off} DESTINATION hybrid/hybrid_2) 1113s 1113s install(CODE "message(STATUS \\\"Installation complete\\\")") 1113s """.format( 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 1113s path_types: Sequence[str] 1113s try: 1113s path_types = next( 1113s iter( 1113s zip( 1113s *filter( 1113s lambda i: i[1], 1113s [ 1113s ("c", has_cmake_package), 1113s ("cm", has_cmake_module), 1113s ("h", has_hybrid_package), 1113s ("p", has_pure_package), 1113s ("pm", has_pure_module), 1113s ], 1113s ) 1113s ) 1113s ) 1113s ) 1113s except StopIteration: 1113s path_types = [] 1113s 1113s def select_paths(annotated_paths): 1113s """Return a filtered list paths considering ``path_types``. 1113s 1113s `annotated_paths`` is list of tuple ``(type, path)`` where type 1113s is either `c`, 'cm', `h`, `p` or 'pm'. 1113s 1113s """ 1113s return filter(lambda i: i[0] in path_types, annotated_paths) 1113s 1113s # Commented paths are the one expected to be installed by CMake. For 1113s # this reason, corresponding files should NOT be created in the source 1113s # tree. 1113s for _type, path in select_paths( 1113s [ 1113s # ('c', 'cmake/__init__.py'), 1113s # ('c', 'cmake/cmake.py'), 1113s # ('cm', 'cmakeModule.py'), 1113s ("h", "hybrid/__init__.py"), 1113s # ('h', 'hybrid/hybrid_cmake.dat'), 1113s # ('h', 'hybrid/hybrid_cmake.py'), 1113s ("h", "hybrid/hybrid_pure.dat"), 1113s ("h", "hybrid/hybrid_pure.py"), 1113s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 1113s ("h", "hybrid/data/hybrid_data_pure.dat"), 1113s ("h", "hybrid/hybrid_2/__init__.py"), 1113s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 1113s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 1113s ("p", "hybrid/hybrid_2_pure/__init__.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 1113s ("pm", "pureModule.py"), 1113s ("p", "pure/__init__.py"), 1113s ("p", "pure/pure.py"), 1113s ("p", "pure/data/pure.dat"), 1113s ] 1113s ): 1113s assert _type in {"p", "pm", "h"} 1113s root = package_base if _type in {"p", "pm"} else cmake_source_dir 1113s tmp_dir.ensure(os.path.join(root, path)) 1113s 1113s # Do not call the real setup function. Instead, replace it with 1113s # a MagicMock allowing to check with which arguments it was invoked. 1113s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 1113s 1113s # Convenience print function 1113s def _pprint(desc, value=None): 1113s print( 1113s "-----------------\n" 1113s f"{desc}:\n" 1113s "\n" 1113s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 1113s ) 1113s 1113s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 1113s 1113s _pprint = ._pprint at 0xf72623fac040> 1113s _type = 'pm' 1113s cmake_source_dir = '' 1113s has_cmake_module = 0 1113s has_cmake_package = 0 1113s has_hybrid_package = 1 1113s has_pure_module = 1 1113s has_pure_package = 0 1113s mock_setup = 1113s mocker = 1113s package_base = '' 1113s package_base_dir = '' 1113s path = 'pureModule.py' 1113s path_types = ('h', 'pm') 1113s root = '' 1113s select_paths = .select_paths at 0xf72624161300> 1113s src_dir = local('/tmp/pytest-of-ubuntu/pytest-102/test_setup_inputs0') 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-102/test_setup_inputs0') 1113s with_package_base = 0 1113s 1113s tests/test_setup.py:849: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-102/test_setup_inputs0') 1113s setup_args = ['build'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-102/test_setup_inputs0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ________________________ test_setup_inputs[0-1-0-1-0-1] ________________________ 1113s 1113s has_cmake_package = 1, has_cmake_module = 0, has_hybrid_package = 1 1113s has_pure_package = 0, has_pure_module = 1, with_package_base = 0 1113s mocker = 1113s 1113s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 1113s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 1113s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_module", [0, 1]) 1113s @pytest.mark.parametrize("with_package_base", [0, 1]) 1113s def test_setup_inputs( 1113s has_cmake_package, 1113s has_cmake_module, 1113s has_hybrid_package, 1113s has_pure_package, 1113s has_pure_module, 1113s with_package_base, 1113s mocker, 1113s ): 1113s """This test that a project can have a package with some modules 1113s installed using setup.py and some other modules installed using CMake. 1113s """ 1113s 1113s tmp_dir = _tmpdir("test_setup_inputs") 1113s 1113s package_base = "to/the/base" if with_package_base else "" 1113s package_base_dir = package_base + "/" if package_base else "" 1113s cmake_source_dir = package_base 1113s 1113s if cmake_source_dir and (has_cmake_package or has_cmake_module): 1113s pytest.skip( 1113s "unsupported configuration: " 1113s "python package fully generated by CMake does *NOT* work. " 1113s "At least __init__.py should be in the project source tree" 1113s ) 1113s 1113s # ------------------------------------------------------------------------- 1113s # Here is the "SOURCE" tree layout: 1113s # 1113s # ROOT/ 1113s # 1113s # setup.py 1113s # 1113s # [/] 1113s # 1113s # pureModule.py 1113s # 1113s # pure/ 1113s # __init__.py 1113s # pure.py 1113s # 1113s # data/ 1113s # pure.dat 1113s # 1113s # [/] 1113s # 1113s # hybrid/ 1113s # CMakeLists.txt 1113s # __init__.py 1113s # hybrid_pure.dat 1113s # hybrid_pure.py 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat 1113s # 1113s # hybrid_2/ 1113s # __init__.py 1113s # hybrid_2_pure.py 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py 1113s # hybrid_2_pure_1.py 1113s # hybrid_2_pure_2.py 1113s # 1113s # 1113s # ------------------------------------------------------------------------- 1113s # and here is the "BINARY" distribution layout: 1113s # 1113s # The comment "CMake" or "Setuptools" indicates which tool is responsible 1113s # for placing the file in the tree used to create the binary distribution. 1113s # 1113s # ROOT/ 1113s # 1113s # cmakeModule.py # CMake 1113s # 1113s # cmake/ 1113s # __init__.py # CMake 1113s # cmake.py # CMake 1113s # 1113s # hybrid/ 1113s # hybrid_cmake.dat # CMake 1113s # hybrid_cmake.py # CMake 1113s # hybrid_pure.dat # Setuptools 1113s # hybrid_pure.py # Setuptools 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat # CMake or Setuptools 1113s # hybrid_data_cmake.dat # CMake *NO TEST* 1113s # 1113s # hybrid_2/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure.py # CMake or Setuptools 1113s # hybrid_2_cmake.py # CMake 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure_1.py # CMake or Setuptools 1113s # hybrid_2_pure_2.py # CMake or Setuptools 1113s # 1113s # pureModule.py # Setuptools 1113s # 1113s # pure/ 1113s # __init__.py # Setuptools 1113s # pure.py # Setuptools 1113s # 1113s # data/ 1113s # pure.dat # Setuptools 1113s 1113s tmp_dir.join("setup.py").write( 1113s textwrap.dedent( 1113s """ 1113s from skbuild import setup 1113s #from setuptools import setup 1113s setup( 1113s name="test_hybrid_project", 1113s version="1.2.3", 1113s description=("an hybrid package mixing files installed by both " 1113s "CMake and setuptools"), 1113s author='The scikit-build team', 1113s license="MIT", 1113s cmake_source_dir='{cmake_source_dir}', 1113s cmake_install_dir='{cmake_install_dir}', 1113s # Arbitrary order of packages 1113s packages=[ 1113s {p_off} 'pure', 1113s {h_off} 'hybrid.hybrid_2', 1113s {h_off} 'hybrid', 1113s {c_off} 'cmake', 1113s {p_off} 'hybrid.hybrid_2_pure', 1113s ], 1113s py_modules=[ 1113s {pm_off} '{package_base}pureModule', 1113s {cm_off} '{package_base}cmakeModule', 1113s ], 1113s package_data={{ 1113s {p_off} 'pure': ['data/pure.dat'], 1113s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 1113s }}, 1113s # Arbitrary order of package_dir 1113s package_dir = {{ 1113s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 1113s {p_off} 'pure': '{package_base}pure', 1113s {h_off} 'hybrid': '{package_base}hybrid', 1113s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 1113s {c_off} 'cmake': '{package_base}cmake', 1113s }} 1113s ) 1113s """.format( 1113s cmake_source_dir=cmake_source_dir, 1113s cmake_install_dir=package_base, 1113s package_base=package_base_dir, 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s p_off="" if has_pure_package else "#", 1113s pm_off="" if has_pure_module else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s src_dir = tmp_dir.ensure(package_base, dir=1) 1113s 1113s src_dir.join("CMakeLists.txt").write( 1113s textwrap.dedent( 1113s """ 1113s cmake_minimum_required(VERSION 3.5.0) 1113s project(hybrid NONE) 1113s set(build_dir ${{CMAKE_BINARY_DIR}}) 1113s 1113s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 1113s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 1113s {c_off} install( 1113s {c_off} FILES 1113s {c_off} ${{build_dir}}/__init__.py 1113s {c_off} ${{build_dir}}/cmake.py 1113s {c_off} DESTINATION cmake 1113s {c_off} ) 1113s 1113s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 1113s {cm_off} install( 1113s {cm_off} FILES ${{build_dir}}/cmakeModule.py 1113s {cm_off} DESTINATION .) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 1113s {h_off} DESTINATION hybrid/data) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 1113s {h_off} DESTINATION hybrid/hybrid_2) 1113s 1113s install(CODE "message(STATUS \\\"Installation complete\\\")") 1113s """.format( 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 1113s path_types: Sequence[str] 1113s try: 1113s path_types = next( 1113s iter( 1113s zip( 1113s *filter( 1113s lambda i: i[1], 1113s [ 1113s ("c", has_cmake_package), 1113s ("cm", has_cmake_module), 1113s ("h", has_hybrid_package), 1113s ("p", has_pure_package), 1113s ("pm", has_pure_module), 1113s ], 1113s ) 1113s ) 1113s ) 1113s ) 1113s except StopIteration: 1113s path_types = [] 1113s 1113s def select_paths(annotated_paths): 1113s """Return a filtered list paths considering ``path_types``. 1113s 1113s `annotated_paths`` is list of tuple ``(type, path)`` where type 1113s is either `c`, 'cm', `h`, `p` or 'pm'. 1113s 1113s """ 1113s return filter(lambda i: i[0] in path_types, annotated_paths) 1113s 1113s # Commented paths are the one expected to be installed by CMake. For 1113s # this reason, corresponding files should NOT be created in the source 1113s # tree. 1113s for _type, path in select_paths( 1113s [ 1113s # ('c', 'cmake/__init__.py'), 1113s # ('c', 'cmake/cmake.py'), 1113s # ('cm', 'cmakeModule.py'), 1113s ("h", "hybrid/__init__.py"), 1113s # ('h', 'hybrid/hybrid_cmake.dat'), 1113s # ('h', 'hybrid/hybrid_cmake.py'), 1113s ("h", "hybrid/hybrid_pure.dat"), 1113s ("h", "hybrid/hybrid_pure.py"), 1113s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 1113s ("h", "hybrid/data/hybrid_data_pure.dat"), 1113s ("h", "hybrid/hybrid_2/__init__.py"), 1113s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 1113s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 1113s ("p", "hybrid/hybrid_2_pure/__init__.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 1113s ("pm", "pureModule.py"), 1113s ("p", "pure/__init__.py"), 1113s ("p", "pure/pure.py"), 1113s ("p", "pure/data/pure.dat"), 1113s ] 1113s ): 1113s assert _type in {"p", "pm", "h"} 1113s root = package_base if _type in {"p", "pm"} else cmake_source_dir 1113s tmp_dir.ensure(os.path.join(root, path)) 1113s 1113s # Do not call the real setup function. Instead, replace it with 1113s # a MagicMock allowing to check with which arguments it was invoked. 1113s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 1113s 1113s # Convenience print function 1113s def _pprint(desc, value=None): 1113s print( 1113s "-----------------\n" 1113s f"{desc}:\n" 1113s "\n" 1113s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 1113s ) 1113s 1113s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 1113s 1113s _pprint = ._pprint at 0xf726240f34c0> 1113s _type = 'pm' 1113s cmake_source_dir = '' 1113s has_cmake_module = 0 1113s has_cmake_package = 1 1113s has_hybrid_package = 1 1113s has_pure_module = 1 1113s has_pure_package = 0 1113s mock_setup = 1113s mocker = 1113s package_base = '' 1113s package_base_dir = '' 1113s path = 'pureModule.py' 1113s path_types = ('c', 'h', 'pm') 1113s root = '' 1113s select_paths = .select_paths at 0xf726240f3880> 1113s src_dir = local('/tmp/pytest-of-ubuntu/pytest-103/test_setup_inputs0') 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-103/test_setup_inputs0') 1113s with_package_base = 0 1113s 1113s tests/test_setup.py:849: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-103/test_setup_inputs0') 1113s setup_args = ['build'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-103/test_setup_inputs0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ________________________ test_setup_inputs[0-1-0-1-1-0] ________________________ 1113s 1113s has_cmake_package = 0, has_cmake_module = 1, has_hybrid_package = 1 1113s has_pure_package = 0, has_pure_module = 1, with_package_base = 0 1113s mocker = 1113s 1113s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 1113s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 1113s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_module", [0, 1]) 1113s @pytest.mark.parametrize("with_package_base", [0, 1]) 1113s def test_setup_inputs( 1113s has_cmake_package, 1113s has_cmake_module, 1113s has_hybrid_package, 1113s has_pure_package, 1113s has_pure_module, 1113s with_package_base, 1113s mocker, 1113s ): 1113s """This test that a project can have a package with some modules 1113s installed using setup.py and some other modules installed using CMake. 1113s """ 1113s 1113s tmp_dir = _tmpdir("test_setup_inputs") 1113s 1113s package_base = "to/the/base" if with_package_base else "" 1113s package_base_dir = package_base + "/" if package_base else "" 1113s cmake_source_dir = package_base 1113s 1113s if cmake_source_dir and (has_cmake_package or has_cmake_module): 1113s pytest.skip( 1113s "unsupported configuration: " 1113s "python package fully generated by CMake does *NOT* work. " 1113s "At least __init__.py should be in the project source tree" 1113s ) 1113s 1113s # ------------------------------------------------------------------------- 1113s # Here is the "SOURCE" tree layout: 1113s # 1113s # ROOT/ 1113s # 1113s # setup.py 1113s # 1113s # [/] 1113s # 1113s # pureModule.py 1113s # 1113s # pure/ 1113s # __init__.py 1113s # pure.py 1113s # 1113s # data/ 1113s # pure.dat 1113s # 1113s # [/] 1113s # 1113s # hybrid/ 1113s # CMakeLists.txt 1113s # __init__.py 1113s # hybrid_pure.dat 1113s # hybrid_pure.py 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat 1113s # 1113s # hybrid_2/ 1113s # __init__.py 1113s # hybrid_2_pure.py 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py 1113s # hybrid_2_pure_1.py 1113s # hybrid_2_pure_2.py 1113s # 1113s # 1113s # ------------------------------------------------------------------------- 1113s # and here is the "BINARY" distribution layout: 1113s # 1113s # The comment "CMake" or "Setuptools" indicates which tool is responsible 1113s # for placing the file in the tree used to create the binary distribution. 1113s # 1113s # ROOT/ 1113s # 1113s # cmakeModule.py # CMake 1113s # 1113s # cmake/ 1113s # __init__.py # CMake 1113s # cmake.py # CMake 1113s # 1113s # hybrid/ 1113s # hybrid_cmake.dat # CMake 1113s # hybrid_cmake.py # CMake 1113s # hybrid_pure.dat # Setuptools 1113s # hybrid_pure.py # Setuptools 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat # CMake or Setuptools 1113s # hybrid_data_cmake.dat # CMake *NO TEST* 1113s # 1113s # hybrid_2/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure.py # CMake or Setuptools 1113s # hybrid_2_cmake.py # CMake 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure_1.py # CMake or Setuptools 1113s # hybrid_2_pure_2.py # CMake or Setuptools 1113s # 1113s # pureModule.py # Setuptools 1113s # 1113s # pure/ 1113s # __init__.py # Setuptools 1113s # pure.py # Setuptools 1113s # 1113s # data/ 1113s # pure.dat # Setuptools 1113s 1113s tmp_dir.join("setup.py").write( 1113s textwrap.dedent( 1113s """ 1113s from skbuild import setup 1113s #from setuptools import setup 1113s setup( 1113s name="test_hybrid_project", 1113s version="1.2.3", 1113s description=("an hybrid package mixing files installed by both " 1113s "CMake and setuptools"), 1113s author='The scikit-build team', 1113s license="MIT", 1113s cmake_source_dir='{cmake_source_dir}', 1113s cmake_install_dir='{cmake_install_dir}', 1113s # Arbitrary order of packages 1113s packages=[ 1113s {p_off} 'pure', 1113s {h_off} 'hybrid.hybrid_2', 1113s {h_off} 'hybrid', 1113s {c_off} 'cmake', 1113s {p_off} 'hybrid.hybrid_2_pure', 1113s ], 1113s py_modules=[ 1113s {pm_off} '{package_base}pureModule', 1113s {cm_off} '{package_base}cmakeModule', 1113s ], 1113s package_data={{ 1113s {p_off} 'pure': ['data/pure.dat'], 1113s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 1113s }}, 1113s # Arbitrary order of package_dir 1113s package_dir = {{ 1113s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 1113s {p_off} 'pure': '{package_base}pure', 1113s {h_off} 'hybrid': '{package_base}hybrid', 1113s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 1113s {c_off} 'cmake': '{package_base}cmake', 1113s }} 1113s ) 1113s """.format( 1113s cmake_source_dir=cmake_source_dir, 1113s cmake_install_dir=package_base, 1113s package_base=package_base_dir, 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s p_off="" if has_pure_package else "#", 1113s pm_off="" if has_pure_module else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s src_dir = tmp_dir.ensure(package_base, dir=1) 1113s 1113s src_dir.join("CMakeLists.txt").write( 1113s textwrap.dedent( 1113s """ 1113s cmake_minimum_required(VERSION 3.5.0) 1113s project(hybrid NONE) 1113s set(build_dir ${{CMAKE_BINARY_DIR}}) 1113s 1113s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 1113s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 1113s {c_off} install( 1113s {c_off} FILES 1113s {c_off} ${{build_dir}}/__init__.py 1113s {c_off} ${{build_dir}}/cmake.py 1113s {c_off} DESTINATION cmake 1113s {c_off} ) 1113s 1113s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 1113s {cm_off} install( 1113s {cm_off} FILES ${{build_dir}}/cmakeModule.py 1113s {cm_off} DESTINATION .) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 1113s {h_off} DESTINATION hybrid/data) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 1113s {h_off} DESTINATION hybrid/hybrid_2) 1113s 1113s install(CODE "message(STATUS \\\"Installation complete\\\")") 1113s """.format( 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 1113s path_types: Sequence[str] 1113s try: 1113s path_types = next( 1113s iter( 1113s zip( 1113s *filter( 1113s lambda i: i[1], 1113s [ 1113s ("c", has_cmake_package), 1113s ("cm", has_cmake_module), 1113s ("h", has_hybrid_package), 1113s ("p", has_pure_package), 1113s ("pm", has_pure_module), 1113s ], 1113s ) 1113s ) 1113s ) 1113s ) 1113s except StopIteration: 1113s path_types = [] 1113s 1113s def select_paths(annotated_paths): 1113s """Return a filtered list paths considering ``path_types``. 1113s 1113s `annotated_paths`` is list of tuple ``(type, path)`` where type 1113s is either `c`, 'cm', `h`, `p` or 'pm'. 1113s 1113s """ 1113s return filter(lambda i: i[0] in path_types, annotated_paths) 1113s 1113s # Commented paths are the one expected to be installed by CMake. For 1113s # this reason, corresponding files should NOT be created in the source 1113s # tree. 1113s for _type, path in select_paths( 1113s [ 1113s # ('c', 'cmake/__init__.py'), 1113s # ('c', 'cmake/cmake.py'), 1113s # ('cm', 'cmakeModule.py'), 1113s ("h", "hybrid/__init__.py"), 1113s # ('h', 'hybrid/hybrid_cmake.dat'), 1113s # ('h', 'hybrid/hybrid_cmake.py'), 1113s ("h", "hybrid/hybrid_pure.dat"), 1113s ("h", "hybrid/hybrid_pure.py"), 1113s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 1113s ("h", "hybrid/data/hybrid_data_pure.dat"), 1113s ("h", "hybrid/hybrid_2/__init__.py"), 1113s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 1113s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 1113s ("p", "hybrid/hybrid_2_pure/__init__.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 1113s ("pm", "pureModule.py"), 1113s ("p", "pure/__init__.py"), 1113s ("p", "pure/pure.py"), 1113s ("p", "pure/data/pure.dat"), 1113s ] 1113s ): 1113s assert _type in {"p", "pm", "h"} 1113s root = package_base if _type in {"p", "pm"} else cmake_source_dir 1113s tmp_dir.ensure(os.path.join(root, path)) 1113s 1113s # Do not call the real setup function. Instead, replace it with 1113s # a MagicMock allowing to check with which arguments it was invoked. 1113s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 1113s 1113s # Convenience print function 1113s def _pprint(desc, value=None): 1113s print( 1113s "-----------------\n" 1113s f"{desc}:\n" 1113s "\n" 1113s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 1113s ) 1113s 1113s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 1113s 1113s _pprint = ._pprint at 0xf726240f2fc0> 1113s _type = 'pm' 1113s cmake_source_dir = '' 1113s has_cmake_module = 1 1113s has_cmake_package = 0 1113s has_hybrid_package = 1 1113s has_pure_module = 1 1113s has_pure_package = 0 1113s mock_setup = 1113s mocker = 1113s package_base = '' 1113s package_base_dir = '' 1113s path = 'pureModule.py' 1113s path_types = ('cm', 'h', 'pm') 1113s root = '' 1113s select_paths = .select_paths at 0xf726240f0540> 1113s src_dir = local('/tmp/pytest-of-ubuntu/pytest-104/test_setup_inputs0') 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-104/test_setup_inputs0') 1113s with_package_base = 0 1113s 1113s tests/test_setup.py:849: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-104/test_setup_inputs0') 1113s setup_args = ['build'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-104/test_setup_inputs0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ________________________ test_setup_inputs[0-1-0-1-1-1] ________________________ 1113s 1113s has_cmake_package = 1, has_cmake_module = 1, has_hybrid_package = 1 1113s has_pure_package = 0, has_pure_module = 1, with_package_base = 0 1113s mocker = 1113s 1113s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 1113s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 1113s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_module", [0, 1]) 1113s @pytest.mark.parametrize("with_package_base", [0, 1]) 1113s def test_setup_inputs( 1113s has_cmake_package, 1113s has_cmake_module, 1113s has_hybrid_package, 1113s has_pure_package, 1113s has_pure_module, 1113s with_package_base, 1113s mocker, 1113s ): 1113s """This test that a project can have a package with some modules 1113s installed using setup.py and some other modules installed using CMake. 1113s """ 1113s 1113s tmp_dir = _tmpdir("test_setup_inputs") 1113s 1113s package_base = "to/the/base" if with_package_base else "" 1113s package_base_dir = package_base + "/" if package_base else "" 1113s cmake_source_dir = package_base 1113s 1113s if cmake_source_dir and (has_cmake_package or has_cmake_module): 1113s pytest.skip( 1113s "unsupported configuration: " 1113s "python package fully generated by CMake does *NOT* work. " 1113s "At least __init__.py should be in the project source tree" 1113s ) 1113s 1113s # ------------------------------------------------------------------------- 1113s # Here is the "SOURCE" tree layout: 1113s # 1113s # ROOT/ 1113s # 1113s # setup.py 1113s # 1113s # [/] 1113s # 1113s # pureModule.py 1113s # 1113s # pure/ 1113s # __init__.py 1113s # pure.py 1113s # 1113s # data/ 1113s # pure.dat 1113s # 1113s # [/] 1113s # 1113s # hybrid/ 1113s # CMakeLists.txt 1113s # __init__.py 1113s # hybrid_pure.dat 1113s # hybrid_pure.py 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat 1113s # 1113s # hybrid_2/ 1113s # __init__.py 1113s # hybrid_2_pure.py 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py 1113s # hybrid_2_pure_1.py 1113s # hybrid_2_pure_2.py 1113s # 1113s # 1113s # ------------------------------------------------------------------------- 1113s # and here is the "BINARY" distribution layout: 1113s # 1113s # The comment "CMake" or "Setuptools" indicates which tool is responsible 1113s # for placing the file in the tree used to create the binary distribution. 1113s # 1113s # ROOT/ 1113s # 1113s # cmakeModule.py # CMake 1113s # 1113s # cmake/ 1113s # __init__.py # CMake 1113s # cmake.py # CMake 1113s # 1113s # hybrid/ 1113s # hybrid_cmake.dat # CMake 1113s # hybrid_cmake.py # CMake 1113s # hybrid_pure.dat # Setuptools 1113s # hybrid_pure.py # Setuptools 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat # CMake or Setuptools 1113s # hybrid_data_cmake.dat # CMake *NO TEST* 1113s # 1113s # hybrid_2/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure.py # CMake or Setuptools 1113s # hybrid_2_cmake.py # CMake 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure_1.py # CMake or Setuptools 1113s # hybrid_2_pure_2.py # CMake or Setuptools 1113s # 1113s # pureModule.py # Setuptools 1113s # 1113s # pure/ 1113s # __init__.py # Setuptools 1113s # pure.py # Setuptools 1113s # 1113s # data/ 1113s # pure.dat # Setuptools 1113s 1113s tmp_dir.join("setup.py").write( 1113s textwrap.dedent( 1113s """ 1113s from skbuild import setup 1113s #from setuptools import setup 1113s setup( 1113s name="test_hybrid_project", 1113s version="1.2.3", 1113s description=("an hybrid package mixing files installed by both " 1113s "CMake and setuptools"), 1113s author='The scikit-build team', 1113s license="MIT", 1113s cmake_source_dir='{cmake_source_dir}', 1113s cmake_install_dir='{cmake_install_dir}', 1113s # Arbitrary order of packages 1113s packages=[ 1113s {p_off} 'pure', 1113s {h_off} 'hybrid.hybrid_2', 1113s {h_off} 'hybrid', 1113s {c_off} 'cmake', 1113s {p_off} 'hybrid.hybrid_2_pure', 1113s ], 1113s py_modules=[ 1113s {pm_off} '{package_base}pureModule', 1113s {cm_off} '{package_base}cmakeModule', 1113s ], 1113s package_data={{ 1113s {p_off} 'pure': ['data/pure.dat'], 1113s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 1113s }}, 1113s # Arbitrary order of package_dir 1113s package_dir = {{ 1113s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 1113s {p_off} 'pure': '{package_base}pure', 1113s {h_off} 'hybrid': '{package_base}hybrid', 1113s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 1113s {c_off} 'cmake': '{package_base}cmake', 1113s }} 1113s ) 1113s """.format( 1113s cmake_source_dir=cmake_source_dir, 1113s cmake_install_dir=package_base, 1113s package_base=package_base_dir, 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s p_off="" if has_pure_package else "#", 1113s pm_off="" if has_pure_module else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s src_dir = tmp_dir.ensure(package_base, dir=1) 1113s 1113s src_dir.join("CMakeLists.txt").write( 1113s textwrap.dedent( 1113s """ 1113s cmake_minimum_required(VERSION 3.5.0) 1113s project(hybrid NONE) 1113s set(build_dir ${{CMAKE_BINARY_DIR}}) 1113s 1113s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 1113s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 1113s {c_off} install( 1113s {c_off} FILES 1113s {c_off} ${{build_dir}}/__init__.py 1113s {c_off} ${{build_dir}}/cmake.py 1113s {c_off} DESTINATION cmake 1113s {c_off} ) 1113s 1113s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 1113s {cm_off} install( 1113s {cm_off} FILES ${{build_dir}}/cmakeModule.py 1113s {cm_off} DESTINATION .) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 1113s {h_off} DESTINATION hybrid/data) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 1113s {h_off} DESTINATION hybrid/hybrid_2) 1113s 1113s install(CODE "message(STATUS \\\"Installation complete\\\")") 1113s """.format( 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 1113s path_types: Sequence[str] 1113s try: 1113s path_types = next( 1113s iter( 1113s zip( 1113s *filter( 1113s lambda i: i[1], 1113s [ 1113s ("c", has_cmake_package), 1113s ("cm", has_cmake_module), 1113s ("h", has_hybrid_package), 1113s ("p", has_pure_package), 1113s ("pm", has_pure_module), 1113s ], 1113s ) 1113s ) 1113s ) 1113s ) 1113s except StopIteration: 1113s path_types = [] 1113s 1113s def select_paths(annotated_paths): 1113s """Return a filtered list paths considering ``path_types``. 1113s 1113s `annotated_paths`` is list of tuple ``(type, path)`` where type 1113s is either `c`, 'cm', `h`, `p` or 'pm'. 1113s 1113s """ 1113s return filter(lambda i: i[0] in path_types, annotated_paths) 1113s 1113s # Commented paths are the one expected to be installed by CMake. For 1113s # this reason, corresponding files should NOT be created in the source 1113s # tree. 1113s for _type, path in select_paths( 1113s [ 1113s # ('c', 'cmake/__init__.py'), 1113s # ('c', 'cmake/cmake.py'), 1113s # ('cm', 'cmakeModule.py'), 1113s ("h", "hybrid/__init__.py"), 1113s # ('h', 'hybrid/hybrid_cmake.dat'), 1113s # ('h', 'hybrid/hybrid_cmake.py'), 1113s ("h", "hybrid/hybrid_pure.dat"), 1113s ("h", "hybrid/hybrid_pure.py"), 1113s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 1113s ("h", "hybrid/data/hybrid_data_pure.dat"), 1113s ("h", "hybrid/hybrid_2/__init__.py"), 1113s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 1113s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 1113s ("p", "hybrid/hybrid_2_pure/__init__.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 1113s ("pm", "pureModule.py"), 1113s ("p", "pure/__init__.py"), 1113s ("p", "pure/pure.py"), 1113s ("p", "pure/data/pure.dat"), 1113s ] 1113s ): 1113s assert _type in {"p", "pm", "h"} 1113s root = package_base if _type in {"p", "pm"} else cmake_source_dir 1113s tmp_dir.ensure(os.path.join(root, path)) 1113s 1113s # Do not call the real setup function. Instead, replace it with 1113s # a MagicMock allowing to check with which arguments it was invoked. 1113s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 1113s 1113s # Convenience print function 1113s def _pprint(desc, value=None): 1113s print( 1113s "-----------------\n" 1113s f"{desc}:\n" 1113s "\n" 1113s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 1113s ) 1113s 1113s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 1113s 1113s _pprint = ._pprint at 0xf72623fac220> 1113s _type = 'pm' 1113s cmake_source_dir = '' 1113s has_cmake_module = 1 1113s has_cmake_package = 1 1113s has_hybrid_package = 1 1113s has_pure_module = 1 1113s has_pure_package = 0 1113s mock_setup = 1113s mocker = 1113s package_base = '' 1113s package_base_dir = '' 1113s path = 'pureModule.py' 1113s path_types = ('c', 'cm', 'h', 'pm') 1113s root = '' 1113s select_paths = .select_paths at 0xf726240f3ba0> 1113s src_dir = local('/tmp/pytest-of-ubuntu/pytest-105/test_setup_inputs0') 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-105/test_setup_inputs0') 1113s with_package_base = 0 1113s 1113s tests/test_setup.py:849: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-105/test_setup_inputs0') 1113s setup_args = ['build'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-105/test_setup_inputs0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ________________________ test_setup_inputs[0-1-1-0-0-0] ________________________ 1113s 1113s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 0 1113s has_pure_package = 1, has_pure_module = 1, with_package_base = 0 1113s mocker = 1113s 1113s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 1113s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 1113s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_module", [0, 1]) 1113s @pytest.mark.parametrize("with_package_base", [0, 1]) 1113s def test_setup_inputs( 1113s has_cmake_package, 1113s has_cmake_module, 1113s has_hybrid_package, 1113s has_pure_package, 1113s has_pure_module, 1113s with_package_base, 1113s mocker, 1113s ): 1113s """This test that a project can have a package with some modules 1113s installed using setup.py and some other modules installed using CMake. 1113s """ 1113s 1113s tmp_dir = _tmpdir("test_setup_inputs") 1113s 1113s package_base = "to/the/base" if with_package_base else "" 1113s package_base_dir = package_base + "/" if package_base else "" 1113s cmake_source_dir = package_base 1113s 1113s if cmake_source_dir and (has_cmake_package or has_cmake_module): 1113s pytest.skip( 1113s "unsupported configuration: " 1113s "python package fully generated by CMake does *NOT* work. " 1113s "At least __init__.py should be in the project source tree" 1113s ) 1113s 1113s # ------------------------------------------------------------------------- 1113s # Here is the "SOURCE" tree layout: 1113s # 1113s # ROOT/ 1113s # 1113s # setup.py 1113s # 1113s # [/] 1113s # 1113s # pureModule.py 1113s # 1113s # pure/ 1113s # __init__.py 1113s # pure.py 1113s # 1113s # data/ 1113s # pure.dat 1113s # 1113s # [/] 1113s # 1113s # hybrid/ 1113s # CMakeLists.txt 1113s # __init__.py 1113s # hybrid_pure.dat 1113s # hybrid_pure.py 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat 1113s # 1113s # hybrid_2/ 1113s # __init__.py 1113s # hybrid_2_pure.py 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py 1113s # hybrid_2_pure_1.py 1113s # hybrid_2_pure_2.py 1113s # 1113s # 1113s # ------------------------------------------------------------------------- 1113s # and here is the "BINARY" distribution layout: 1113s # 1113s # The comment "CMake" or "Setuptools" indicates which tool is responsible 1113s # for placing the file in the tree used to create the binary distribution. 1113s # 1113s # ROOT/ 1113s # 1113s # cmakeModule.py # CMake 1113s # 1113s # cmake/ 1113s # __init__.py # CMake 1113s # cmake.py # CMake 1113s # 1113s # hybrid/ 1113s # hybrid_cmake.dat # CMake 1113s # hybrid_cmake.py # CMake 1113s # hybrid_pure.dat # Setuptools 1113s # hybrid_pure.py # Setuptools 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat # CMake or Setuptools 1113s # hybrid_data_cmake.dat # CMake *NO TEST* 1113s # 1113s # hybrid_2/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure.py # CMake or Setuptools 1113s # hybrid_2_cmake.py # CMake 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure_1.py # CMake or Setuptools 1113s # hybrid_2_pure_2.py # CMake or Setuptools 1113s # 1113s # pureModule.py # Setuptools 1113s # 1113s # pure/ 1113s # __init__.py # Setuptools 1113s # pure.py # Setuptools 1113s # 1113s # data/ 1113s # pure.dat # Setuptools 1113s 1113s tmp_dir.join("setup.py").write( 1113s textwrap.dedent( 1113s """ 1113s from skbuild import setup 1113s #from setuptools import setup 1113s setup( 1113s name="test_hybrid_project", 1113s version="1.2.3", 1113s description=("an hybrid package mixing files installed by both " 1113s "CMake and setuptools"), 1113s author='The scikit-build team', 1113s license="MIT", 1113s cmake_source_dir='{cmake_source_dir}', 1113s cmake_install_dir='{cmake_install_dir}', 1113s # Arbitrary order of packages 1113s packages=[ 1113s {p_off} 'pure', 1113s {h_off} 'hybrid.hybrid_2', 1113s {h_off} 'hybrid', 1113s {c_off} 'cmake', 1113s {p_off} 'hybrid.hybrid_2_pure', 1113s ], 1113s py_modules=[ 1113s {pm_off} '{package_base}pureModule', 1113s {cm_off} '{package_base}cmakeModule', 1113s ], 1113s package_data={{ 1113s {p_off} 'pure': ['data/pure.dat'], 1113s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 1113s }}, 1113s # Arbitrary order of package_dir 1113s package_dir = {{ 1113s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 1113s {p_off} 'pure': '{package_base}pure', 1113s {h_off} 'hybrid': '{package_base}hybrid', 1113s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 1113s {c_off} 'cmake': '{package_base}cmake', 1113s }} 1113s ) 1113s """.format( 1113s cmake_source_dir=cmake_source_dir, 1113s cmake_install_dir=package_base, 1113s package_base=package_base_dir, 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s p_off="" if has_pure_package else "#", 1113s pm_off="" if has_pure_module else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s src_dir = tmp_dir.ensure(package_base, dir=1) 1113s 1113s src_dir.join("CMakeLists.txt").write( 1113s textwrap.dedent( 1113s """ 1113s cmake_minimum_required(VERSION 3.5.0) 1113s project(hybrid NONE) 1113s set(build_dir ${{CMAKE_BINARY_DIR}}) 1113s 1113s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 1113s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 1113s {c_off} install( 1113s {c_off} FILES 1113s {c_off} ${{build_dir}}/__init__.py 1113s {c_off} ${{build_dir}}/cmake.py 1113s {c_off} DESTINATION cmake 1113s {c_off} ) 1113s 1113s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 1113s {cm_off} install( 1113s {cm_off} FILES ${{build_dir}}/cmakeModule.py 1113s {cm_off} DESTINATION .) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 1113s {h_off} DESTINATION hybrid/data) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 1113s {h_off} DESTINATION hybrid/hybrid_2) 1113s 1113s install(CODE "message(STATUS \\\"Installation complete\\\")") 1113s """.format( 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 1113s path_types: Sequence[str] 1113s try: 1113s path_types = next( 1113s iter( 1113s zip( 1113s *filter( 1113s lambda i: i[1], 1113s [ 1113s ("c", has_cmake_package), 1113s ("cm", has_cmake_module), 1113s ("h", has_hybrid_package), 1113s ("p", has_pure_package), 1113s ("pm", has_pure_module), 1113s ], 1113s ) 1113s ) 1113s ) 1113s ) 1113s except StopIteration: 1113s path_types = [] 1113s 1113s def select_paths(annotated_paths): 1113s """Return a filtered list paths considering ``path_types``. 1113s 1113s `annotated_paths`` is list of tuple ``(type, path)`` where type 1113s is either `c`, 'cm', `h`, `p` or 'pm'. 1113s 1113s """ 1113s return filter(lambda i: i[0] in path_types, annotated_paths) 1113s 1113s # Commented paths are the one expected to be installed by CMake. For 1113s # this reason, corresponding files should NOT be created in the source 1113s # tree. 1113s for _type, path in select_paths( 1113s [ 1113s # ('c', 'cmake/__init__.py'), 1113s # ('c', 'cmake/cmake.py'), 1113s # ('cm', 'cmakeModule.py'), 1113s ("h", "hybrid/__init__.py"), 1113s # ('h', 'hybrid/hybrid_cmake.dat'), 1113s # ('h', 'hybrid/hybrid_cmake.py'), 1113s ("h", "hybrid/hybrid_pure.dat"), 1113s ("h", "hybrid/hybrid_pure.py"), 1113s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 1113s ("h", "hybrid/data/hybrid_data_pure.dat"), 1113s ("h", "hybrid/hybrid_2/__init__.py"), 1113s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 1113s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 1113s ("p", "hybrid/hybrid_2_pure/__init__.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 1113s ("pm", "pureModule.py"), 1113s ("p", "pure/__init__.py"), 1113s ("p", "pure/pure.py"), 1113s ("p", "pure/data/pure.dat"), 1113s ] 1113s ): 1113s assert _type in {"p", "pm", "h"} 1113s root = package_base if _type in {"p", "pm"} else cmake_source_dir 1113s tmp_dir.ensure(os.path.join(root, path)) 1113s 1113s # Do not call the real setup function. Instead, replace it with 1113s # a MagicMock allowing to check with which arguments it was invoked. 1113s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 1113s 1113s # Convenience print function 1113s def _pprint(desc, value=None): 1113s print( 1113s "-----------------\n" 1113s f"{desc}:\n" 1113s "\n" 1113s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 1113s ) 1113s 1113s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 1113s 1113s _pprint = ._pprint at 0xf72623fac680> 1113s _type = 'p' 1113s cmake_source_dir = '' 1113s has_cmake_module = 0 1113s has_cmake_package = 0 1113s has_hybrid_package = 0 1113s has_pure_module = 1 1113s has_pure_package = 1 1113s mock_setup = 1113s mocker = 1113s package_base = '' 1113s package_base_dir = '' 1113s path = 'pure/data/pure.dat' 1113s path_types = ('p', 'pm') 1113s root = '' 1113s select_paths = .select_paths at 0xf72623fac400> 1113s src_dir = local('/tmp/pytest-of-ubuntu/pytest-106/test_setup_inputs0') 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-106/test_setup_inputs0') 1113s with_package_base = 0 1113s 1113s tests/test_setup.py:849: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-106/test_setup_inputs0') 1113s setup_args = ['build'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-106/test_setup_inputs0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ________________________ test_setup_inputs[0-1-1-0-0-1] ________________________ 1113s 1113s has_cmake_package = 1, has_cmake_module = 0, has_hybrid_package = 0 1113s has_pure_package = 1, has_pure_module = 1, with_package_base = 0 1113s mocker = 1113s 1113s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 1113s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 1113s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_module", [0, 1]) 1113s @pytest.mark.parametrize("with_package_base", [0, 1]) 1113s def test_setup_inputs( 1113s has_cmake_package, 1113s has_cmake_module, 1113s has_hybrid_package, 1113s has_pure_package, 1113s has_pure_module, 1113s with_package_base, 1113s mocker, 1113s ): 1113s """This test that a project can have a package with some modules 1113s installed using setup.py and some other modules installed using CMake. 1113s """ 1113s 1113s tmp_dir = _tmpdir("test_setup_inputs") 1113s 1113s package_base = "to/the/base" if with_package_base else "" 1113s package_base_dir = package_base + "/" if package_base else "" 1113s cmake_source_dir = package_base 1113s 1113s if cmake_source_dir and (has_cmake_package or has_cmake_module): 1113s pytest.skip( 1113s "unsupported configuration: " 1113s "python package fully generated by CMake does *NOT* work. " 1113s "At least __init__.py should be in the project source tree" 1113s ) 1113s 1113s # ------------------------------------------------------------------------- 1113s # Here is the "SOURCE" tree layout: 1113s # 1113s # ROOT/ 1113s # 1113s # setup.py 1113s # 1113s # [/] 1113s # 1113s # pureModule.py 1113s # 1113s # pure/ 1113s # __init__.py 1113s # pure.py 1113s # 1113s # data/ 1113s # pure.dat 1113s # 1113s # [/] 1113s # 1113s # hybrid/ 1113s # CMakeLists.txt 1113s # __init__.py 1113s # hybrid_pure.dat 1113s # hybrid_pure.py 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat 1113s # 1113s # hybrid_2/ 1113s # __init__.py 1113s # hybrid_2_pure.py 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py 1113s # hybrid_2_pure_1.py 1113s # hybrid_2_pure_2.py 1113s # 1113s # 1113s # ------------------------------------------------------------------------- 1113s # and here is the "BINARY" distribution layout: 1113s # 1113s # The comment "CMake" or "Setuptools" indicates which tool is responsible 1113s # for placing the file in the tree used to create the binary distribution. 1113s # 1113s # ROOT/ 1113s # 1113s # cmakeModule.py # CMake 1113s # 1113s # cmake/ 1113s # __init__.py # CMake 1113s # cmake.py # CMake 1113s # 1113s # hybrid/ 1113s # hybrid_cmake.dat # CMake 1113s # hybrid_cmake.py # CMake 1113s # hybrid_pure.dat # Setuptools 1113s # hybrid_pure.py # Setuptools 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat # CMake or Setuptools 1113s # hybrid_data_cmake.dat # CMake *NO TEST* 1113s # 1113s # hybrid_2/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure.py # CMake or Setuptools 1113s # hybrid_2_cmake.py # CMake 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure_1.py # CMake or Setuptools 1113s # hybrid_2_pure_2.py # CMake or Setuptools 1113s # 1113s # pureModule.py # Setuptools 1113s # 1113s # pure/ 1113s # __init__.py # Setuptools 1113s # pure.py # Setuptools 1113s # 1113s # data/ 1113s # pure.dat # Setuptools 1113s 1113s tmp_dir.join("setup.py").write( 1113s textwrap.dedent( 1113s """ 1113s from skbuild import setup 1113s #from setuptools import setup 1113s setup( 1113s name="test_hybrid_project", 1113s version="1.2.3", 1113s description=("an hybrid package mixing files installed by both " 1113s "CMake and setuptools"), 1113s author='The scikit-build team', 1113s license="MIT", 1113s cmake_source_dir='{cmake_source_dir}', 1113s cmake_install_dir='{cmake_install_dir}', 1113s # Arbitrary order of packages 1113s packages=[ 1113s {p_off} 'pure', 1113s {h_off} 'hybrid.hybrid_2', 1113s {h_off} 'hybrid', 1113s {c_off} 'cmake', 1113s {p_off} 'hybrid.hybrid_2_pure', 1113s ], 1113s py_modules=[ 1113s {pm_off} '{package_base}pureModule', 1113s {cm_off} '{package_base}cmakeModule', 1113s ], 1113s package_data={{ 1113s {p_off} 'pure': ['data/pure.dat'], 1113s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 1113s }}, 1113s # Arbitrary order of package_dir 1113s package_dir = {{ 1113s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 1113s {p_off} 'pure': '{package_base}pure', 1113s {h_off} 'hybrid': '{package_base}hybrid', 1113s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 1113s {c_off} 'cmake': '{package_base}cmake', 1113s }} 1113s ) 1113s """.format( 1113s cmake_source_dir=cmake_source_dir, 1113s cmake_install_dir=package_base, 1113s package_base=package_base_dir, 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s p_off="" if has_pure_package else "#", 1113s pm_off="" if has_pure_module else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s src_dir = tmp_dir.ensure(package_base, dir=1) 1113s 1113s src_dir.join("CMakeLists.txt").write( 1113s textwrap.dedent( 1113s """ 1113s cmake_minimum_required(VERSION 3.5.0) 1113s project(hybrid NONE) 1113s set(build_dir ${{CMAKE_BINARY_DIR}}) 1113s 1113s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 1113s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 1113s {c_off} install( 1113s {c_off} FILES 1113s {c_off} ${{build_dir}}/__init__.py 1113s {c_off} ${{build_dir}}/cmake.py 1113s {c_off} DESTINATION cmake 1113s {c_off} ) 1113s 1113s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 1113s {cm_off} install( 1113s {cm_off} FILES ${{build_dir}}/cmakeModule.py 1113s {cm_off} DESTINATION .) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 1113s {h_off} DESTINATION hybrid/data) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 1113s {h_off} DESTINATION hybrid/hybrid_2) 1113s 1113s install(CODE "message(STATUS \\\"Installation complete\\\")") 1113s """.format( 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 1113s path_types: Sequence[str] 1113s try: 1113s path_types = next( 1113s iter( 1113s zip( 1113s *filter( 1113s lambda i: i[1], 1113s [ 1113s ("c", has_cmake_package), 1113s ("cm", has_cmake_module), 1113s ("h", has_hybrid_package), 1113s ("p", has_pure_package), 1113s ("pm", has_pure_module), 1113s ], 1113s ) 1113s ) 1113s ) 1113s ) 1113s except StopIteration: 1113s path_types = [] 1113s 1113s def select_paths(annotated_paths): 1113s """Return a filtered list paths considering ``path_types``. 1113s 1113s `annotated_paths`` is list of tuple ``(type, path)`` where type 1113s is either `c`, 'cm', `h`, `p` or 'pm'. 1113s 1113s """ 1113s return filter(lambda i: i[0] in path_types, annotated_paths) 1113s 1113s # Commented paths are the one expected to be installed by CMake. For 1113s # this reason, corresponding files should NOT be created in the source 1113s # tree. 1113s for _type, path in select_paths( 1113s [ 1113s # ('c', 'cmake/__init__.py'), 1113s # ('c', 'cmake/cmake.py'), 1113s # ('cm', 'cmakeModule.py'), 1113s ("h", "hybrid/__init__.py"), 1113s # ('h', 'hybrid/hybrid_cmake.dat'), 1113s # ('h', 'hybrid/hybrid_cmake.py'), 1113s ("h", "hybrid/hybrid_pure.dat"), 1113s ("h", "hybrid/hybrid_pure.py"), 1113s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 1113s ("h", "hybrid/data/hybrid_data_pure.dat"), 1113s ("h", "hybrid/hybrid_2/__init__.py"), 1113s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 1113s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 1113s ("p", "hybrid/hybrid_2_pure/__init__.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 1113s ("pm", "pureModule.py"), 1113s ("p", "pure/__init__.py"), 1113s ("p", "pure/pure.py"), 1113s ("p", "pure/data/pure.dat"), 1113s ] 1113s ): 1113s assert _type in {"p", "pm", "h"} 1113s root = package_base if _type in {"p", "pm"} else cmake_source_dir 1113s tmp_dir.ensure(os.path.join(root, path)) 1113s 1113s # Do not call the real setup function. Instead, replace it with 1113s # a MagicMock allowing to check with which arguments it was invoked. 1113s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 1113s 1113s # Convenience print function 1113s def _pprint(desc, value=None): 1113s print( 1113s "-----------------\n" 1113s f"{desc}:\n" 1113s "\n" 1113s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 1113s ) 1113s 1113s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 1113s 1113s _pprint = ._pprint at 0xf726240f2fc0> 1113s _type = 'p' 1113s cmake_source_dir = '' 1113s has_cmake_module = 0 1113s has_cmake_package = 1 1113s has_hybrid_package = 0 1113s has_pure_module = 1 1113s has_pure_package = 1 1113s mock_setup = 1113s mocker = 1113s package_base = '' 1113s package_base_dir = '' 1113s path = 'pure/data/pure.dat' 1113s path_types = ('c', 'p', 'pm') 1113s root = '' 1113s select_paths = .select_paths at 0xf726240f3920> 1113s src_dir = local('/tmp/pytest-of-ubuntu/pytest-107/test_setup_inputs0') 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-107/test_setup_inputs0') 1113s with_package_base = 0 1113s 1113s tests/test_setup.py:849: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-107/test_setup_inputs0') 1113s setup_args = ['build'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-107/test_setup_inputs0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ________________________ test_setup_inputs[0-1-1-0-1-0] ________________________ 1113s 1113s has_cmake_package = 0, has_cmake_module = 1, has_hybrid_package = 0 1113s has_pure_package = 1, has_pure_module = 1, with_package_base = 0 1113s mocker = 1113s 1113s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 1113s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 1113s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_module", [0, 1]) 1113s @pytest.mark.parametrize("with_package_base", [0, 1]) 1113s def test_setup_inputs( 1113s has_cmake_package, 1113s has_cmake_module, 1113s has_hybrid_package, 1113s has_pure_package, 1113s has_pure_module, 1113s with_package_base, 1113s mocker, 1113s ): 1113s """This test that a project can have a package with some modules 1113s installed using setup.py and some other modules installed using CMake. 1113s """ 1113s 1113s tmp_dir = _tmpdir("test_setup_inputs") 1113s 1113s package_base = "to/the/base" if with_package_base else "" 1113s package_base_dir = package_base + "/" if package_base else "" 1113s cmake_source_dir = package_base 1113s 1113s if cmake_source_dir and (has_cmake_package or has_cmake_module): 1113s pytest.skip( 1113s "unsupported configuration: " 1113s "python package fully generated by CMake does *NOT* work. " 1113s "At least __init__.py should be in the project source tree" 1113s ) 1113s 1113s # ------------------------------------------------------------------------- 1113s # Here is the "SOURCE" tree layout: 1113s # 1113s # ROOT/ 1113s # 1113s # setup.py 1113s # 1113s # [/] 1113s # 1113s # pureModule.py 1113s # 1113s # pure/ 1113s # __init__.py 1113s # pure.py 1113s # 1113s # data/ 1113s # pure.dat 1113s # 1113s # [/] 1113s # 1113s # hybrid/ 1113s # CMakeLists.txt 1113s # __init__.py 1113s # hybrid_pure.dat 1113s # hybrid_pure.py 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat 1113s # 1113s # hybrid_2/ 1113s # __init__.py 1113s # hybrid_2_pure.py 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py 1113s # hybrid_2_pure_1.py 1113s # hybrid_2_pure_2.py 1113s # 1113s # 1113s # ------------------------------------------------------------------------- 1113s # and here is the "BINARY" distribution layout: 1113s # 1113s # The comment "CMake" or "Setuptools" indicates which tool is responsible 1113s # for placing the file in the tree used to create the binary distribution. 1113s # 1113s # ROOT/ 1113s # 1113s # cmakeModule.py # CMake 1113s # 1113s # cmake/ 1113s # __init__.py # CMake 1113s # cmake.py # CMake 1113s # 1113s # hybrid/ 1113s # hybrid_cmake.dat # CMake 1113s # hybrid_cmake.py # CMake 1113s # hybrid_pure.dat # Setuptools 1113s # hybrid_pure.py # Setuptools 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat # CMake or Setuptools 1113s # hybrid_data_cmake.dat # CMake *NO TEST* 1113s # 1113s # hybrid_2/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure.py # CMake or Setuptools 1113s # hybrid_2_cmake.py # CMake 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure_1.py # CMake or Setuptools 1113s # hybrid_2_pure_2.py # CMake or Setuptools 1113s # 1113s # pureModule.py # Setuptools 1113s # 1113s # pure/ 1113s # __init__.py # Setuptools 1113s # pure.py # Setuptools 1113s # 1113s # data/ 1113s # pure.dat # Setuptools 1113s 1113s tmp_dir.join("setup.py").write( 1113s textwrap.dedent( 1113s """ 1113s from skbuild import setup 1113s #from setuptools import setup 1113s setup( 1113s name="test_hybrid_project", 1113s version="1.2.3", 1113s description=("an hybrid package mixing files installed by both " 1113s "CMake and setuptools"), 1113s author='The scikit-build team', 1113s license="MIT", 1113s cmake_source_dir='{cmake_source_dir}', 1113s cmake_install_dir='{cmake_install_dir}', 1113s # Arbitrary order of packages 1113s packages=[ 1113s {p_off} 'pure', 1113s {h_off} 'hybrid.hybrid_2', 1113s {h_off} 'hybrid', 1113s {c_off} 'cmake', 1113s {p_off} 'hybrid.hybrid_2_pure', 1113s ], 1113s py_modules=[ 1113s {pm_off} '{package_base}pureModule', 1113s {cm_off} '{package_base}cmakeModule', 1113s ], 1113s package_data={{ 1113s {p_off} 'pure': ['data/pure.dat'], 1113s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 1113s }}, 1113s # Arbitrary order of package_dir 1113s package_dir = {{ 1113s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 1113s {p_off} 'pure': '{package_base}pure', 1113s {h_off} 'hybrid': '{package_base}hybrid', 1113s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 1113s {c_off} 'cmake': '{package_base}cmake', 1113s }} 1113s ) 1113s """.format( 1113s cmake_source_dir=cmake_source_dir, 1113s cmake_install_dir=package_base, 1113s package_base=package_base_dir, 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s p_off="" if has_pure_package else "#", 1113s pm_off="" if has_pure_module else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s src_dir = tmp_dir.ensure(package_base, dir=1) 1113s 1113s src_dir.join("CMakeLists.txt").write( 1113s textwrap.dedent( 1113s """ 1113s cmake_minimum_required(VERSION 3.5.0) 1113s project(hybrid NONE) 1113s set(build_dir ${{CMAKE_BINARY_DIR}}) 1113s 1113s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 1113s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 1113s {c_off} install( 1113s {c_off} FILES 1113s {c_off} ${{build_dir}}/__init__.py 1113s {c_off} ${{build_dir}}/cmake.py 1113s {c_off} DESTINATION cmake 1113s {c_off} ) 1113s 1113s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 1113s {cm_off} install( 1113s {cm_off} FILES ${{build_dir}}/cmakeModule.py 1113s {cm_off} DESTINATION .) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 1113s {h_off} DESTINATION hybrid/data) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 1113s {h_off} DESTINATION hybrid/hybrid_2) 1113s 1113s install(CODE "message(STATUS \\\"Installation complete\\\")") 1113s """.format( 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 1113s path_types: Sequence[str] 1113s try: 1113s path_types = next( 1113s iter( 1113s zip( 1113s *filter( 1113s lambda i: i[1], 1113s [ 1113s ("c", has_cmake_package), 1113s ("cm", has_cmake_module), 1113s ("h", has_hybrid_package), 1113s ("p", has_pure_package), 1113s ("pm", has_pure_module), 1113s ], 1113s ) 1113s ) 1113s ) 1113s ) 1113s except StopIteration: 1113s path_types = [] 1113s 1113s def select_paths(annotated_paths): 1113s """Return a filtered list paths considering ``path_types``. 1113s 1113s `annotated_paths`` is list of tuple ``(type, path)`` where type 1113s is either `c`, 'cm', `h`, `p` or 'pm'. 1113s 1113s """ 1113s return filter(lambda i: i[0] in path_types, annotated_paths) 1113s 1113s # Commented paths are the one expected to be installed by CMake. For 1113s # this reason, corresponding files should NOT be created in the source 1113s # tree. 1113s for _type, path in select_paths( 1113s [ 1113s # ('c', 'cmake/__init__.py'), 1113s # ('c', 'cmake/cmake.py'), 1113s # ('cm', 'cmakeModule.py'), 1113s ("h", "hybrid/__init__.py"), 1113s # ('h', 'hybrid/hybrid_cmake.dat'), 1113s # ('h', 'hybrid/hybrid_cmake.py'), 1113s ("h", "hybrid/hybrid_pure.dat"), 1113s ("h", "hybrid/hybrid_pure.py"), 1113s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 1113s ("h", "hybrid/data/hybrid_data_pure.dat"), 1113s ("h", "hybrid/hybrid_2/__init__.py"), 1113s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 1113s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 1113s ("p", "hybrid/hybrid_2_pure/__init__.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 1113s ("pm", "pureModule.py"), 1113s ("p", "pure/__init__.py"), 1113s ("p", "pure/pure.py"), 1113s ("p", "pure/data/pure.dat"), 1113s ] 1113s ): 1113s assert _type in {"p", "pm", "h"} 1113s root = package_base if _type in {"p", "pm"} else cmake_source_dir 1113s tmp_dir.ensure(os.path.join(root, path)) 1113s 1113s # Do not call the real setup function. Instead, replace it with 1113s # a MagicMock allowing to check with which arguments it was invoked. 1113s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 1113s 1113s # Convenience print function 1113s def _pprint(desc, value=None): 1113s print( 1113s "-----------------\n" 1113s f"{desc}:\n" 1113s "\n" 1113s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 1113s ) 1113s 1113s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 1113s 1113s _pprint = ._pprint at 0xf726240f1d00> 1113s _type = 'p' 1113s cmake_source_dir = '' 1113s has_cmake_module = 1 1113s has_cmake_package = 0 1113s has_hybrid_package = 0 1113s has_pure_module = 1 1113s has_pure_package = 1 1113s mock_setup = 1113s mocker = 1113s package_base = '' 1113s package_base_dir = '' 1113s path = 'pure/data/pure.dat' 1113s path_types = ('cm', 'p', 'pm') 1113s root = '' 1113s select_paths = .select_paths at 0xf726240f0220> 1113s src_dir = local('/tmp/pytest-of-ubuntu/pytest-108/test_setup_inputs0') 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-108/test_setup_inputs0') 1113s with_package_base = 0 1113s 1113s tests/test_setup.py:849: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-108/test_setup_inputs0') 1113s setup_args = ['build'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-108/test_setup_inputs0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ________________________ test_setup_inputs[0-1-1-0-1-1] ________________________ 1113s 1113s has_cmake_package = 1, has_cmake_module = 1, has_hybrid_package = 0 1113s has_pure_package = 1, has_pure_module = 1, with_package_base = 0 1113s mocker = 1113s 1113s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 1113s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 1113s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_module", [0, 1]) 1113s @pytest.mark.parametrize("with_package_base", [0, 1]) 1113s def test_setup_inputs( 1113s has_cmake_package, 1113s has_cmake_module, 1113s has_hybrid_package, 1113s has_pure_package, 1113s has_pure_module, 1113s with_package_base, 1113s mocker, 1113s ): 1113s """This test that a project can have a package with some modules 1113s installed using setup.py and some other modules installed using CMake. 1113s """ 1113s 1113s tmp_dir = _tmpdir("test_setup_inputs") 1113s 1113s package_base = "to/the/base" if with_package_base else "" 1113s package_base_dir = package_base + "/" if package_base else "" 1113s cmake_source_dir = package_base 1113s 1113s if cmake_source_dir and (has_cmake_package or has_cmake_module): 1113s pytest.skip( 1113s "unsupported configuration: " 1113s "python package fully generated by CMake does *NOT* work. " 1113s "At least __init__.py should be in the project source tree" 1113s ) 1113s 1113s # ------------------------------------------------------------------------- 1113s # Here is the "SOURCE" tree layout: 1113s # 1113s # ROOT/ 1113s # 1113s # setup.py 1113s # 1113s # [/] 1113s # 1113s # pureModule.py 1113s # 1113s # pure/ 1113s # __init__.py 1113s # pure.py 1113s # 1113s # data/ 1113s # pure.dat 1113s # 1113s # [/] 1113s # 1113s # hybrid/ 1113s # CMakeLists.txt 1113s # __init__.py 1113s # hybrid_pure.dat 1113s # hybrid_pure.py 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat 1113s # 1113s # hybrid_2/ 1113s # __init__.py 1113s # hybrid_2_pure.py 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py 1113s # hybrid_2_pure_1.py 1113s # hybrid_2_pure_2.py 1113s # 1113s # 1113s # ------------------------------------------------------------------------- 1113s # and here is the "BINARY" distribution layout: 1113s # 1113s # The comment "CMake" or "Setuptools" indicates which tool is responsible 1113s # for placing the file in the tree used to create the binary distribution. 1113s # 1113s # ROOT/ 1113s # 1113s # cmakeModule.py # CMake 1113s # 1113s # cmake/ 1113s # __init__.py # CMake 1113s # cmake.py # CMake 1113s # 1113s # hybrid/ 1113s # hybrid_cmake.dat # CMake 1113s # hybrid_cmake.py # CMake 1113s # hybrid_pure.dat # Setuptools 1113s # hybrid_pure.py # Setuptools 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat # CMake or Setuptools 1113s # hybrid_data_cmake.dat # CMake *NO TEST* 1113s # 1113s # hybrid_2/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure.py # CMake or Setuptools 1113s # hybrid_2_cmake.py # CMake 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure_1.py # CMake or Setuptools 1113s # hybrid_2_pure_2.py # CMake or Setuptools 1113s # 1113s # pureModule.py # Setuptools 1113s # 1113s # pure/ 1113s # __init__.py # Setuptools 1113s # pure.py # Setuptools 1113s # 1113s # data/ 1113s # pure.dat # Setuptools 1113s 1113s tmp_dir.join("setup.py").write( 1113s textwrap.dedent( 1113s """ 1113s from skbuild import setup 1113s #from setuptools import setup 1113s setup( 1113s name="test_hybrid_project", 1113s version="1.2.3", 1113s description=("an hybrid package mixing files installed by both " 1113s "CMake and setuptools"), 1113s author='The scikit-build team', 1113s license="MIT", 1113s cmake_source_dir='{cmake_source_dir}', 1113s cmake_install_dir='{cmake_install_dir}', 1113s # Arbitrary order of packages 1113s packages=[ 1113s {p_off} 'pure', 1113s {h_off} 'hybrid.hybrid_2', 1113s {h_off} 'hybrid', 1113s {c_off} 'cmake', 1113s {p_off} 'hybrid.hybrid_2_pure', 1113s ], 1113s py_modules=[ 1113s {pm_off} '{package_base}pureModule', 1113s {cm_off} '{package_base}cmakeModule', 1113s ], 1113s package_data={{ 1113s {p_off} 'pure': ['data/pure.dat'], 1113s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 1113s }}, 1113s # Arbitrary order of package_dir 1113s package_dir = {{ 1113s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 1113s {p_off} 'pure': '{package_base}pure', 1113s {h_off} 'hybrid': '{package_base}hybrid', 1113s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 1113s {c_off} 'cmake': '{package_base}cmake', 1113s }} 1113s ) 1113s """.format( 1113s cmake_source_dir=cmake_source_dir, 1113s cmake_install_dir=package_base, 1113s package_base=package_base_dir, 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s p_off="" if has_pure_package else "#", 1113s pm_off="" if has_pure_module else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s src_dir = tmp_dir.ensure(package_base, dir=1) 1113s 1113s src_dir.join("CMakeLists.txt").write( 1113s textwrap.dedent( 1113s """ 1113s cmake_minimum_required(VERSION 3.5.0) 1113s project(hybrid NONE) 1113s set(build_dir ${{CMAKE_BINARY_DIR}}) 1113s 1113s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 1113s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 1113s {c_off} install( 1113s {c_off} FILES 1113s {c_off} ${{build_dir}}/__init__.py 1113s {c_off} ${{build_dir}}/cmake.py 1113s {c_off} DESTINATION cmake 1113s {c_off} ) 1113s 1113s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 1113s {cm_off} install( 1113s {cm_off} FILES ${{build_dir}}/cmakeModule.py 1113s {cm_off} DESTINATION .) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 1113s {h_off} DESTINATION hybrid/data) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 1113s {h_off} DESTINATION hybrid/hybrid_2) 1113s 1113s install(CODE "message(STATUS \\\"Installation complete\\\")") 1113s """.format( 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 1113s path_types: Sequence[str] 1113s try: 1113s path_types = next( 1113s iter( 1113s zip( 1113s *filter( 1113s lambda i: i[1], 1113s [ 1113s ("c", has_cmake_package), 1113s ("cm", has_cmake_module), 1113s ("h", has_hybrid_package), 1113s ("p", has_pure_package), 1113s ("pm", has_pure_module), 1113s ], 1113s ) 1113s ) 1113s ) 1113s ) 1113s except StopIteration: 1113s path_types = [] 1113s 1113s def select_paths(annotated_paths): 1113s """Return a filtered list paths considering ``path_types``. 1113s 1113s `annotated_paths`` is list of tuple ``(type, path)`` where type 1113s is either `c`, 'cm', `h`, `p` or 'pm'. 1113s 1113s """ 1113s return filter(lambda i: i[0] in path_types, annotated_paths) 1113s 1113s # Commented paths are the one expected to be installed by CMake. For 1113s # this reason, corresponding files should NOT be created in the source 1113s # tree. 1113s for _type, path in select_paths( 1113s [ 1113s # ('c', 'cmake/__init__.py'), 1113s # ('c', 'cmake/cmake.py'), 1113s # ('cm', 'cmakeModule.py'), 1113s ("h", "hybrid/__init__.py"), 1113s # ('h', 'hybrid/hybrid_cmake.dat'), 1113s # ('h', 'hybrid/hybrid_cmake.py'), 1113s ("h", "hybrid/hybrid_pure.dat"), 1113s ("h", "hybrid/hybrid_pure.py"), 1113s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 1113s ("h", "hybrid/data/hybrid_data_pure.dat"), 1113s ("h", "hybrid/hybrid_2/__init__.py"), 1113s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 1113s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 1113s ("p", "hybrid/hybrid_2_pure/__init__.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 1113s ("pm", "pureModule.py"), 1113s ("p", "pure/__init__.py"), 1113s ("p", "pure/pure.py"), 1113s ("p", "pure/data/pure.dat"), 1113s ] 1113s ): 1113s assert _type in {"p", "pm", "h"} 1113s root = package_base if _type in {"p", "pm"} else cmake_source_dir 1113s tmp_dir.ensure(os.path.join(root, path)) 1113s 1113s # Do not call the real setup function. Instead, replace it with 1113s # a MagicMock allowing to check with which arguments it was invoked. 1113s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 1113s 1113s # Convenience print function 1113s def _pprint(desc, value=None): 1113s print( 1113s "-----------------\n" 1113s f"{desc}:\n" 1113s "\n" 1113s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 1113s ) 1113s 1113s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 1113s 1113s _pprint = ._pprint at 0xf72623fac720> 1113s _type = 'p' 1113s cmake_source_dir = '' 1113s has_cmake_module = 1 1113s has_cmake_package = 1 1113s has_hybrid_package = 0 1113s has_pure_module = 1 1113s has_pure_package = 1 1113s mock_setup = 1113s mocker = 1113s package_base = '' 1113s package_base_dir = '' 1113s path = 'pure/data/pure.dat' 1113s path_types = ('c', 'cm', 'p', 'pm') 1113s root = '' 1113s select_paths = .select_paths at 0xf72623fac540> 1113s src_dir = local('/tmp/pytest-of-ubuntu/pytest-109/test_setup_inputs0') 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-109/test_setup_inputs0') 1113s with_package_base = 0 1113s 1113s tests/test_setup.py:849: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-109/test_setup_inputs0') 1113s setup_args = ['build'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-109/test_setup_inputs0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ________________________ test_setup_inputs[0-1-1-1-0-0] ________________________ 1113s 1113s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 1 1113s has_pure_package = 1, has_pure_module = 1, with_package_base = 0 1113s mocker = 1113s 1113s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 1113s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 1113s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_module", [0, 1]) 1113s @pytest.mark.parametrize("with_package_base", [0, 1]) 1113s def test_setup_inputs( 1113s has_cmake_package, 1113s has_cmake_module, 1113s has_hybrid_package, 1113s has_pure_package, 1113s has_pure_module, 1113s with_package_base, 1113s mocker, 1113s ): 1113s """This test that a project can have a package with some modules 1113s installed using setup.py and some other modules installed using CMake. 1113s """ 1113s 1113s tmp_dir = _tmpdir("test_setup_inputs") 1113s 1113s package_base = "to/the/base" if with_package_base else "" 1113s package_base_dir = package_base + "/" if package_base else "" 1113s cmake_source_dir = package_base 1113s 1113s if cmake_source_dir and (has_cmake_package or has_cmake_module): 1113s pytest.skip( 1113s "unsupported configuration: " 1113s "python package fully generated by CMake does *NOT* work. " 1113s "At least __init__.py should be in the project source tree" 1113s ) 1113s 1113s # ------------------------------------------------------------------------- 1113s # Here is the "SOURCE" tree layout: 1113s # 1113s # ROOT/ 1113s # 1113s # setup.py 1113s # 1113s # [/] 1113s # 1113s # pureModule.py 1113s # 1113s # pure/ 1113s # __init__.py 1113s # pure.py 1113s # 1113s # data/ 1113s # pure.dat 1113s # 1113s # [/] 1113s # 1113s # hybrid/ 1113s # CMakeLists.txt 1113s # __init__.py 1113s # hybrid_pure.dat 1113s # hybrid_pure.py 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat 1113s # 1113s # hybrid_2/ 1113s # __init__.py 1113s # hybrid_2_pure.py 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py 1113s # hybrid_2_pure_1.py 1113s # hybrid_2_pure_2.py 1113s # 1113s # 1113s # ------------------------------------------------------------------------- 1113s # and here is the "BINARY" distribution layout: 1113s # 1113s # The comment "CMake" or "Setuptools" indicates which tool is responsible 1113s # for placing the file in the tree used to create the binary distribution. 1113s # 1113s # ROOT/ 1113s # 1113s # cmakeModule.py # CMake 1113s # 1113s # cmake/ 1113s # __init__.py # CMake 1113s # cmake.py # CMake 1113s # 1113s # hybrid/ 1113s # hybrid_cmake.dat # CMake 1113s # hybrid_cmake.py # CMake 1113s # hybrid_pure.dat # Setuptools 1113s # hybrid_pure.py # Setuptools 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat # CMake or Setuptools 1113s # hybrid_data_cmake.dat # CMake *NO TEST* 1113s # 1113s # hybrid_2/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure.py # CMake or Setuptools 1113s # hybrid_2_cmake.py # CMake 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure_1.py # CMake or Setuptools 1113s # hybrid_2_pure_2.py # CMake or Setuptools 1113s # 1113s # pureModule.py # Setuptools 1113s # 1113s # pure/ 1113s # __init__.py # Setuptools 1113s # pure.py # Setuptools 1113s # 1113s # data/ 1113s # pure.dat # Setuptools 1113s 1113s tmp_dir.join("setup.py").write( 1113s textwrap.dedent( 1113s """ 1113s from skbuild import setup 1113s #from setuptools import setup 1113s setup( 1113s name="test_hybrid_project", 1113s version="1.2.3", 1113s description=("an hybrid package mixing files installed by both " 1113s "CMake and setuptools"), 1113s author='The scikit-build team', 1113s license="MIT", 1113s cmake_source_dir='{cmake_source_dir}', 1113s cmake_install_dir='{cmake_install_dir}', 1113s # Arbitrary order of packages 1113s packages=[ 1113s {p_off} 'pure', 1113s {h_off} 'hybrid.hybrid_2', 1113s {h_off} 'hybrid', 1113s {c_off} 'cmake', 1113s {p_off} 'hybrid.hybrid_2_pure', 1113s ], 1113s py_modules=[ 1113s {pm_off} '{package_base}pureModule', 1113s {cm_off} '{package_base}cmakeModule', 1113s ], 1113s package_data={{ 1113s {p_off} 'pure': ['data/pure.dat'], 1113s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 1113s }}, 1113s # Arbitrary order of package_dir 1113s package_dir = {{ 1113s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 1113s {p_off} 'pure': '{package_base}pure', 1113s {h_off} 'hybrid': '{package_base}hybrid', 1113s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 1113s {c_off} 'cmake': '{package_base}cmake', 1113s }} 1113s ) 1113s """.format( 1113s cmake_source_dir=cmake_source_dir, 1113s cmake_install_dir=package_base, 1113s package_base=package_base_dir, 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s p_off="" if has_pure_package else "#", 1113s pm_off="" if has_pure_module else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s src_dir = tmp_dir.ensure(package_base, dir=1) 1113s 1113s src_dir.join("CMakeLists.txt").write( 1113s textwrap.dedent( 1113s """ 1113s cmake_minimum_required(VERSION 3.5.0) 1113s project(hybrid NONE) 1113s set(build_dir ${{CMAKE_BINARY_DIR}}) 1113s 1113s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 1113s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 1113s {c_off} install( 1113s {c_off} FILES 1113s {c_off} ${{build_dir}}/__init__.py 1113s {c_off} ${{build_dir}}/cmake.py 1113s {c_off} DESTINATION cmake 1113s {c_off} ) 1113s 1113s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 1113s {cm_off} install( 1113s {cm_off} FILES ${{build_dir}}/cmakeModule.py 1113s {cm_off} DESTINATION .) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 1113s {h_off} DESTINATION hybrid/data) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 1113s {h_off} DESTINATION hybrid/hybrid_2) 1113s 1113s install(CODE "message(STATUS \\\"Installation complete\\\")") 1113s """.format( 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 1113s path_types: Sequence[str] 1113s try: 1113s path_types = next( 1113s iter( 1113s zip( 1113s *filter( 1113s lambda i: i[1], 1113s [ 1113s ("c", has_cmake_package), 1113s ("cm", has_cmake_module), 1113s ("h", has_hybrid_package), 1113s ("p", has_pure_package), 1113s ("pm", has_pure_module), 1113s ], 1113s ) 1113s ) 1113s ) 1113s ) 1113s except StopIteration: 1113s path_types = [] 1113s 1113s def select_paths(annotated_paths): 1113s """Return a filtered list paths considering ``path_types``. 1113s 1113s `annotated_paths`` is list of tuple ``(type, path)`` where type 1113s is either `c`, 'cm', `h`, `p` or 'pm'. 1113s 1113s """ 1113s return filter(lambda i: i[0] in path_types, annotated_paths) 1113s 1113s # Commented paths are the one expected to be installed by CMake. For 1113s # this reason, corresponding files should NOT be created in the source 1113s # tree. 1113s for _type, path in select_paths( 1113s [ 1113s # ('c', 'cmake/__init__.py'), 1113s # ('c', 'cmake/cmake.py'), 1113s # ('cm', 'cmakeModule.py'), 1113s ("h", "hybrid/__init__.py"), 1113s # ('h', 'hybrid/hybrid_cmake.dat'), 1113s # ('h', 'hybrid/hybrid_cmake.py'), 1113s ("h", "hybrid/hybrid_pure.dat"), 1113s ("h", "hybrid/hybrid_pure.py"), 1113s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 1113s ("h", "hybrid/data/hybrid_data_pure.dat"), 1113s ("h", "hybrid/hybrid_2/__init__.py"), 1113s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 1113s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 1113s ("p", "hybrid/hybrid_2_pure/__init__.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 1113s ("pm", "pureModule.py"), 1113s ("p", "pure/__init__.py"), 1113s ("p", "pure/pure.py"), 1113s ("p", "pure/data/pure.dat"), 1113s ] 1113s ): 1113s assert _type in {"p", "pm", "h"} 1113s root = package_base if _type in {"p", "pm"} else cmake_source_dir 1113s tmp_dir.ensure(os.path.join(root, path)) 1113s 1113s # Do not call the real setup function. Instead, replace it with 1113s # a MagicMock allowing to check with which arguments it was invoked. 1113s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 1113s 1113s # Convenience print function 1113s def _pprint(desc, value=None): 1113s print( 1113s "-----------------\n" 1113s f"{desc}:\n" 1113s "\n" 1113s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 1113s ) 1113s 1113s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 1113s 1113s _pprint = ._pprint at 0xf72623fad300> 1113s _type = 'p' 1113s cmake_source_dir = '' 1113s has_cmake_module = 0 1113s has_cmake_package = 0 1113s has_hybrid_package = 1 1113s has_pure_module = 1 1113s has_pure_package = 1 1113s mock_setup = 1113s mocker = 1113s package_base = '' 1113s package_base_dir = '' 1113s path = 'pure/data/pure.dat' 1113s path_types = ('h', 'p', 'pm') 1113s root = '' 1113s select_paths = .select_paths at 0xf72623fad120> 1113s src_dir = local('/tmp/pytest-of-ubuntu/pytest-110/test_setup_inputs0') 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-110/test_setup_inputs0') 1113s with_package_base = 0 1113s 1113s tests/test_setup.py:849: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-110/test_setup_inputs0') 1113s setup_args = ['build'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-110/test_setup_inputs0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ________________________ test_setup_inputs[0-1-1-1-0-1] ________________________ 1113s 1113s has_cmake_package = 1, has_cmake_module = 0, has_hybrid_package = 1 1113s has_pure_package = 1, has_pure_module = 1, with_package_base = 0 1113s mocker = 1113s 1113s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 1113s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 1113s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_module", [0, 1]) 1113s @pytest.mark.parametrize("with_package_base", [0, 1]) 1113s def test_setup_inputs( 1113s has_cmake_package, 1113s has_cmake_module, 1113s has_hybrid_package, 1113s has_pure_package, 1113s has_pure_module, 1113s with_package_base, 1113s mocker, 1113s ): 1113s """This test that a project can have a package with some modules 1113s installed using setup.py and some other modules installed using CMake. 1113s """ 1113s 1113s tmp_dir = _tmpdir("test_setup_inputs") 1113s 1113s package_base = "to/the/base" if with_package_base else "" 1113s package_base_dir = package_base + "/" if package_base else "" 1113s cmake_source_dir = package_base 1113s 1113s if cmake_source_dir and (has_cmake_package or has_cmake_module): 1113s pytest.skip( 1113s "unsupported configuration: " 1113s "python package fully generated by CMake does *NOT* work. " 1113s "At least __init__.py should be in the project source tree" 1113s ) 1113s 1113s # ------------------------------------------------------------------------- 1113s # Here is the "SOURCE" tree layout: 1113s # 1113s # ROOT/ 1113s # 1113s # setup.py 1113s # 1113s # [/] 1113s # 1113s # pureModule.py 1113s # 1113s # pure/ 1113s # __init__.py 1113s # pure.py 1113s # 1113s # data/ 1113s # pure.dat 1113s # 1113s # [/] 1113s # 1113s # hybrid/ 1113s # CMakeLists.txt 1113s # __init__.py 1113s # hybrid_pure.dat 1113s # hybrid_pure.py 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat 1113s # 1113s # hybrid_2/ 1113s # __init__.py 1113s # hybrid_2_pure.py 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py 1113s # hybrid_2_pure_1.py 1113s # hybrid_2_pure_2.py 1113s # 1113s # 1113s # ------------------------------------------------------------------------- 1113s # and here is the "BINARY" distribution layout: 1113s # 1113s # The comment "CMake" or "Setuptools" indicates which tool is responsible 1113s # for placing the file in the tree used to create the binary distribution. 1113s # 1113s # ROOT/ 1113s # 1113s # cmakeModule.py # CMake 1113s # 1113s # cmake/ 1113s # __init__.py # CMake 1113s # cmake.py # CMake 1113s # 1113s # hybrid/ 1113s # hybrid_cmake.dat # CMake 1113s # hybrid_cmake.py # CMake 1113s # hybrid_pure.dat # Setuptools 1113s # hybrid_pure.py # Setuptools 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat # CMake or Setuptools 1113s # hybrid_data_cmake.dat # CMake *NO TEST* 1113s # 1113s # hybrid_2/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure.py # CMake or Setuptools 1113s # hybrid_2_cmake.py # CMake 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure_1.py # CMake or Setuptools 1113s # hybrid_2_pure_2.py # CMake or Setuptools 1113s # 1113s # pureModule.py # Setuptools 1113s # 1113s # pure/ 1113s # __init__.py # Setuptools 1113s # pure.py # Setuptools 1113s # 1113s # data/ 1113s # pure.dat # Setuptools 1113s 1113s tmp_dir.join("setup.py").write( 1113s textwrap.dedent( 1113s """ 1113s from skbuild import setup 1113s #from setuptools import setup 1113s setup( 1113s name="test_hybrid_project", 1113s version="1.2.3", 1113s description=("an hybrid package mixing files installed by both " 1113s "CMake and setuptools"), 1113s author='The scikit-build team', 1113s license="MIT", 1113s cmake_source_dir='{cmake_source_dir}', 1113s cmake_install_dir='{cmake_install_dir}', 1113s # Arbitrary order of packages 1113s packages=[ 1113s {p_off} 'pure', 1113s {h_off} 'hybrid.hybrid_2', 1113s {h_off} 'hybrid', 1113s {c_off} 'cmake', 1113s {p_off} 'hybrid.hybrid_2_pure', 1113s ], 1113s py_modules=[ 1113s {pm_off} '{package_base}pureModule', 1113s {cm_off} '{package_base}cmakeModule', 1113s ], 1113s package_data={{ 1113s {p_off} 'pure': ['data/pure.dat'], 1113s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 1113s }}, 1113s # Arbitrary order of package_dir 1113s package_dir = {{ 1113s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 1113s {p_off} 'pure': '{package_base}pure', 1113s {h_off} 'hybrid': '{package_base}hybrid', 1113s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 1113s {c_off} 'cmake': '{package_base}cmake', 1113s }} 1113s ) 1113s """.format( 1113s cmake_source_dir=cmake_source_dir, 1113s cmake_install_dir=package_base, 1113s package_base=package_base_dir, 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s p_off="" if has_pure_package else "#", 1113s pm_off="" if has_pure_module else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s src_dir = tmp_dir.ensure(package_base, dir=1) 1113s 1113s src_dir.join("CMakeLists.txt").write( 1113s textwrap.dedent( 1113s """ 1113s cmake_minimum_required(VERSION 3.5.0) 1113s project(hybrid NONE) 1113s set(build_dir ${{CMAKE_BINARY_DIR}}) 1113s 1113s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 1113s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 1113s {c_off} install( 1113s {c_off} FILES 1113s {c_off} ${{build_dir}}/__init__.py 1113s {c_off} ${{build_dir}}/cmake.py 1113s {c_off} DESTINATION cmake 1113s {c_off} ) 1113s 1113s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 1113s {cm_off} install( 1113s {cm_off} FILES ${{build_dir}}/cmakeModule.py 1113s {cm_off} DESTINATION .) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 1113s {h_off} DESTINATION hybrid/data) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 1113s {h_off} DESTINATION hybrid/hybrid_2) 1113s 1113s install(CODE "message(STATUS \\\"Installation complete\\\")") 1113s """.format( 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 1113s path_types: Sequence[str] 1113s try: 1113s path_types = next( 1113s iter( 1113s zip( 1113s *filter( 1113s lambda i: i[1], 1113s [ 1113s ("c", has_cmake_package), 1113s ("cm", has_cmake_module), 1113s ("h", has_hybrid_package), 1113s ("p", has_pure_package), 1113s ("pm", has_pure_module), 1113s ], 1113s ) 1113s ) 1113s ) 1113s ) 1113s except StopIteration: 1113s path_types = [] 1113s 1113s def select_paths(annotated_paths): 1113s """Return a filtered list paths considering ``path_types``. 1113s 1113s `annotated_paths`` is list of tuple ``(type, path)`` where type 1113s is either `c`, 'cm', `h`, `p` or 'pm'. 1113s 1113s """ 1113s return filter(lambda i: i[0] in path_types, annotated_paths) 1113s 1113s # Commented paths are the one expected to be installed by CMake. For 1113s # this reason, corresponding files should NOT be created in the source 1113s # tree. 1113s for _type, path in select_paths( 1113s [ 1113s # ('c', 'cmake/__init__.py'), 1113s # ('c', 'cmake/cmake.py'), 1113s # ('cm', 'cmakeModule.py'), 1113s ("h", "hybrid/__init__.py"), 1113s # ('h', 'hybrid/hybrid_cmake.dat'), 1113s # ('h', 'hybrid/hybrid_cmake.py'), 1113s ("h", "hybrid/hybrid_pure.dat"), 1113s ("h", "hybrid/hybrid_pure.py"), 1113s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 1113s ("h", "hybrid/data/hybrid_data_pure.dat"), 1113s ("h", "hybrid/hybrid_2/__init__.py"), 1113s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 1113s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 1113s ("p", "hybrid/hybrid_2_pure/__init__.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 1113s ("pm", "pureModule.py"), 1113s ("p", "pure/__init__.py"), 1113s ("p", "pure/pure.py"), 1113s ("p", "pure/data/pure.dat"), 1113s ] 1113s ): 1113s assert _type in {"p", "pm", "h"} 1113s root = package_base if _type in {"p", "pm"} else cmake_source_dir 1113s tmp_dir.ensure(os.path.join(root, path)) 1113s 1113s # Do not call the real setup function. Instead, replace it with 1113s # a MagicMock allowing to check with which arguments it was invoked. 1113s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 1113s 1113s # Convenience print function 1113s def _pprint(desc, value=None): 1113s print( 1113s "-----------------\n" 1113s f"{desc}:\n" 1113s "\n" 1113s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 1113s ) 1113s 1113s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 1113s 1113s _pprint = ._pprint at 0xf726240f0540> 1113s _type = 'p' 1113s cmake_source_dir = '' 1113s has_cmake_module = 0 1113s has_cmake_package = 1 1113s has_hybrid_package = 1 1113s has_pure_module = 1 1113s has_pure_package = 1 1113s mock_setup = 1113s mocker = 1113s package_base = '' 1113s package_base_dir = '' 1113s path = 'pure/data/pure.dat' 1113s path_types = ('c', 'h', 'p', 'pm') 1113s root = '' 1113s select_paths = .select_paths at 0xf726240f1d00> 1113s src_dir = local('/tmp/pytest-of-ubuntu/pytest-111/test_setup_inputs0') 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-111/test_setup_inputs0') 1113s with_package_base = 0 1113s 1113s tests/test_setup.py:849: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-111/test_setup_inputs0') 1113s setup_args = ['build'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-111/test_setup_inputs0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ________________________ test_setup_inputs[0-1-1-1-1-0] ________________________ 1113s 1113s has_cmake_package = 0, has_cmake_module = 1, has_hybrid_package = 1 1113s has_pure_package = 1, has_pure_module = 1, with_package_base = 0 1113s mocker = 1113s 1113s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 1113s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 1113s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_module", [0, 1]) 1113s @pytest.mark.parametrize("with_package_base", [0, 1]) 1113s def test_setup_inputs( 1113s has_cmake_package, 1113s has_cmake_module, 1113s has_hybrid_package, 1113s has_pure_package, 1113s has_pure_module, 1113s with_package_base, 1113s mocker, 1113s ): 1113s """This test that a project can have a package with some modules 1113s installed using setup.py and some other modules installed using CMake. 1113s """ 1113s 1113s tmp_dir = _tmpdir("test_setup_inputs") 1113s 1113s package_base = "to/the/base" if with_package_base else "" 1113s package_base_dir = package_base + "/" if package_base else "" 1113s cmake_source_dir = package_base 1113s 1113s if cmake_source_dir and (has_cmake_package or has_cmake_module): 1113s pytest.skip( 1113s "unsupported configuration: " 1113s "python package fully generated by CMake does *NOT* work. " 1113s "At least __init__.py should be in the project source tree" 1113s ) 1113s 1113s # ------------------------------------------------------------------------- 1113s # Here is the "SOURCE" tree layout: 1113s # 1113s # ROOT/ 1113s # 1113s # setup.py 1113s # 1113s # [/] 1113s # 1113s # pureModule.py 1113s # 1113s # pure/ 1113s # __init__.py 1113s # pure.py 1113s # 1113s # data/ 1113s # pure.dat 1113s # 1113s # [/] 1113s # 1113s # hybrid/ 1113s # CMakeLists.txt 1113s # __init__.py 1113s # hybrid_pure.dat 1113s # hybrid_pure.py 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat 1113s # 1113s # hybrid_2/ 1113s # __init__.py 1113s # hybrid_2_pure.py 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py 1113s # hybrid_2_pure_1.py 1113s # hybrid_2_pure_2.py 1113s # 1113s # 1113s # ------------------------------------------------------------------------- 1113s # and here is the "BINARY" distribution layout: 1113s # 1113s # The comment "CMake" or "Setuptools" indicates which tool is responsible 1113s # for placing the file in the tree used to create the binary distribution. 1113s # 1113s # ROOT/ 1113s # 1113s # cmakeModule.py # CMake 1113s # 1113s # cmake/ 1113s # __init__.py # CMake 1113s # cmake.py # CMake 1113s # 1113s # hybrid/ 1113s # hybrid_cmake.dat # CMake 1113s # hybrid_cmake.py # CMake 1113s # hybrid_pure.dat # Setuptools 1113s # hybrid_pure.py # Setuptools 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat # CMake or Setuptools 1113s # hybrid_data_cmake.dat # CMake *NO TEST* 1113s # 1113s # hybrid_2/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure.py # CMake or Setuptools 1113s # hybrid_2_cmake.py # CMake 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure_1.py # CMake or Setuptools 1113s # hybrid_2_pure_2.py # CMake or Setuptools 1113s # 1113s # pureModule.py # Setuptools 1113s # 1113s # pure/ 1113s # __init__.py # Setuptools 1113s # pure.py # Setuptools 1113s # 1113s # data/ 1113s # pure.dat # Setuptools 1113s 1113s tmp_dir.join("setup.py").write( 1113s textwrap.dedent( 1113s """ 1113s from skbuild import setup 1113s #from setuptools import setup 1113s setup( 1113s name="test_hybrid_project", 1113s version="1.2.3", 1113s description=("an hybrid package mixing files installed by both " 1113s "CMake and setuptools"), 1113s author='The scikit-build team', 1113s license="MIT", 1113s cmake_source_dir='{cmake_source_dir}', 1113s cmake_install_dir='{cmake_install_dir}', 1113s # Arbitrary order of packages 1113s packages=[ 1113s {p_off} 'pure', 1113s {h_off} 'hybrid.hybrid_2', 1113s {h_off} 'hybrid', 1113s {c_off} 'cmake', 1113s {p_off} 'hybrid.hybrid_2_pure', 1113s ], 1113s py_modules=[ 1113s {pm_off} '{package_base}pureModule', 1113s {cm_off} '{package_base}cmakeModule', 1113s ], 1113s package_data={{ 1113s {p_off} 'pure': ['data/pure.dat'], 1113s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 1113s }}, 1113s # Arbitrary order of package_dir 1113s package_dir = {{ 1113s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 1113s {p_off} 'pure': '{package_base}pure', 1113s {h_off} 'hybrid': '{package_base}hybrid', 1113s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 1113s {c_off} 'cmake': '{package_base}cmake', 1113s }} 1113s ) 1113s """.format( 1113s cmake_source_dir=cmake_source_dir, 1113s cmake_install_dir=package_base, 1113s package_base=package_base_dir, 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s p_off="" if has_pure_package else "#", 1113s pm_off="" if has_pure_module else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s src_dir = tmp_dir.ensure(package_base, dir=1) 1113s 1113s src_dir.join("CMakeLists.txt").write( 1113s textwrap.dedent( 1113s """ 1113s cmake_minimum_required(VERSION 3.5.0) 1113s project(hybrid NONE) 1113s set(build_dir ${{CMAKE_BINARY_DIR}}) 1113s 1113s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 1113s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 1113s {c_off} install( 1113s {c_off} FILES 1113s {c_off} ${{build_dir}}/__init__.py 1113s {c_off} ${{build_dir}}/cmake.py 1113s {c_off} DESTINATION cmake 1113s {c_off} ) 1113s 1113s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 1113s {cm_off} install( 1113s {cm_off} FILES ${{build_dir}}/cmakeModule.py 1113s {cm_off} DESTINATION .) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 1113s {h_off} DESTINATION hybrid/data) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 1113s {h_off} DESTINATION hybrid/hybrid_2) 1113s 1113s install(CODE "message(STATUS \\\"Installation complete\\\")") 1113s """.format( 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 1113s path_types: Sequence[str] 1113s try: 1113s path_types = next( 1113s iter( 1113s zip( 1113s *filter( 1113s lambda i: i[1], 1113s [ 1113s ("c", has_cmake_package), 1113s ("cm", has_cmake_module), 1113s ("h", has_hybrid_package), 1113s ("p", has_pure_package), 1113s ("pm", has_pure_module), 1113s ], 1113s ) 1113s ) 1113s ) 1113s ) 1113s except StopIteration: 1113s path_types = [] 1113s 1113s def select_paths(annotated_paths): 1113s """Return a filtered list paths considering ``path_types``. 1113s 1113s `annotated_paths`` is list of tuple ``(type, path)`` where type 1113s is either `c`, 'cm', `h`, `p` or 'pm'. 1113s 1113s """ 1113s return filter(lambda i: i[0] in path_types, annotated_paths) 1113s 1113s # Commented paths are the one expected to be installed by CMake. For 1113s # this reason, corresponding files should NOT be created in the source 1113s # tree. 1113s for _type, path in select_paths( 1113s [ 1113s # ('c', 'cmake/__init__.py'), 1113s # ('c', 'cmake/cmake.py'), 1113s # ('cm', 'cmakeModule.py'), 1113s ("h", "hybrid/__init__.py"), 1113s # ('h', 'hybrid/hybrid_cmake.dat'), 1113s # ('h', 'hybrid/hybrid_cmake.py'), 1113s ("h", "hybrid/hybrid_pure.dat"), 1113s ("h", "hybrid/hybrid_pure.py"), 1113s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 1113s ("h", "hybrid/data/hybrid_data_pure.dat"), 1113s ("h", "hybrid/hybrid_2/__init__.py"), 1113s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 1113s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 1113s ("p", "hybrid/hybrid_2_pure/__init__.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 1113s ("pm", "pureModule.py"), 1113s ("p", "pure/__init__.py"), 1113s ("p", "pure/pure.py"), 1113s ("p", "pure/data/pure.dat"), 1113s ] 1113s ): 1113s assert _type in {"p", "pm", "h"} 1113s root = package_base if _type in {"p", "pm"} else cmake_source_dir 1113s tmp_dir.ensure(os.path.join(root, path)) 1113s 1113s # Do not call the real setup function. Instead, replace it with 1113s # a MagicMock allowing to check with which arguments it was invoked. 1113s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 1113s 1113s # Convenience print function 1113s def _pprint(desc, value=None): 1113s print( 1113s "-----------------\n" 1113s f"{desc}:\n" 1113s "\n" 1113s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 1113s ) 1113s 1113s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 1113s 1113s _pprint = ._pprint at 0xf72623fad1c0> 1113s _type = 'p' 1113s cmake_source_dir = '' 1113s has_cmake_module = 1 1113s has_cmake_package = 0 1113s has_hybrid_package = 1 1113s has_pure_module = 1 1113s has_pure_package = 1 1113s mock_setup = 1113s mocker = 1113s package_base = '' 1113s package_base_dir = '' 1113s path = 'pure/data/pure.dat' 1113s path_types = ('cm', 'h', 'p', 'pm') 1113s root = '' 1113s select_paths = .select_paths at 0xf72623fad9e0> 1113s src_dir = local('/tmp/pytest-of-ubuntu/pytest-112/test_setup_inputs0') 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-112/test_setup_inputs0') 1113s with_package_base = 0 1113s 1113s tests/test_setup.py:849: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-112/test_setup_inputs0') 1113s setup_args = ['build'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-112/test_setup_inputs0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ________________________ test_setup_inputs[0-1-1-1-1-1] ________________________ 1113s 1113s has_cmake_package = 1, has_cmake_module = 1, has_hybrid_package = 1 1113s has_pure_package = 1, has_pure_module = 1, with_package_base = 0 1113s mocker = 1113s 1113s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 1113s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 1113s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_module", [0, 1]) 1113s @pytest.mark.parametrize("with_package_base", [0, 1]) 1113s def test_setup_inputs( 1113s has_cmake_package, 1113s has_cmake_module, 1113s has_hybrid_package, 1113s has_pure_package, 1113s has_pure_module, 1113s with_package_base, 1113s mocker, 1113s ): 1113s """This test that a project can have a package with some modules 1113s installed using setup.py and some other modules installed using CMake. 1113s """ 1113s 1113s tmp_dir = _tmpdir("test_setup_inputs") 1113s 1113s package_base = "to/the/base" if with_package_base else "" 1113s package_base_dir = package_base + "/" if package_base else "" 1113s cmake_source_dir = package_base 1113s 1113s if cmake_source_dir and (has_cmake_package or has_cmake_module): 1113s pytest.skip( 1113s "unsupported configuration: " 1113s "python package fully generated by CMake does *NOT* work. " 1113s "At least __init__.py should be in the project source tree" 1113s ) 1113s 1113s # ------------------------------------------------------------------------- 1113s # Here is the "SOURCE" tree layout: 1113s # 1113s # ROOT/ 1113s # 1113s # setup.py 1113s # 1113s # [/] 1113s # 1113s # pureModule.py 1113s # 1113s # pure/ 1113s # __init__.py 1113s # pure.py 1113s # 1113s # data/ 1113s # pure.dat 1113s # 1113s # [/] 1113s # 1113s # hybrid/ 1113s # CMakeLists.txt 1113s # __init__.py 1113s # hybrid_pure.dat 1113s # hybrid_pure.py 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat 1113s # 1113s # hybrid_2/ 1113s # __init__.py 1113s # hybrid_2_pure.py 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py 1113s # hybrid_2_pure_1.py 1113s # hybrid_2_pure_2.py 1113s # 1113s # 1113s # ------------------------------------------------------------------------- 1113s # and here is the "BINARY" distribution layout: 1113s # 1113s # The comment "CMake" or "Setuptools" indicates which tool is responsible 1113s # for placing the file in the tree used to create the binary distribution. 1113s # 1113s # ROOT/ 1113s # 1113s # cmakeModule.py # CMake 1113s # 1113s # cmake/ 1113s # __init__.py # CMake 1113s # cmake.py # CMake 1113s # 1113s # hybrid/ 1113s # hybrid_cmake.dat # CMake 1113s # hybrid_cmake.py # CMake 1113s # hybrid_pure.dat # Setuptools 1113s # hybrid_pure.py # Setuptools 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat # CMake or Setuptools 1113s # hybrid_data_cmake.dat # CMake *NO TEST* 1113s # 1113s # hybrid_2/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure.py # CMake or Setuptools 1113s # hybrid_2_cmake.py # CMake 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure_1.py # CMake or Setuptools 1113s # hybrid_2_pure_2.py # CMake or Setuptools 1113s # 1113s # pureModule.py # Setuptools 1113s # 1113s # pure/ 1113s # __init__.py # Setuptools 1113s # pure.py # Setuptools 1113s # 1113s # data/ 1113s # pure.dat # Setuptools 1113s 1113s tmp_dir.join("setup.py").write( 1113s textwrap.dedent( 1113s """ 1113s from skbuild import setup 1113s #from setuptools import setup 1113s setup( 1113s name="test_hybrid_project", 1113s version="1.2.3", 1113s description=("an hybrid package mixing files installed by both " 1113s "CMake and setuptools"), 1113s author='The scikit-build team', 1113s license="MIT", 1113s cmake_source_dir='{cmake_source_dir}', 1113s cmake_install_dir='{cmake_install_dir}', 1113s # Arbitrary order of packages 1113s packages=[ 1113s {p_off} 'pure', 1113s {h_off} 'hybrid.hybrid_2', 1113s {h_off} 'hybrid', 1113s {c_off} 'cmake', 1113s {p_off} 'hybrid.hybrid_2_pure', 1113s ], 1113s py_modules=[ 1113s {pm_off} '{package_base}pureModule', 1113s {cm_off} '{package_base}cmakeModule', 1113s ], 1113s package_data={{ 1113s {p_off} 'pure': ['data/pure.dat'], 1113s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 1113s }}, 1113s # Arbitrary order of package_dir 1113s package_dir = {{ 1113s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 1113s {p_off} 'pure': '{package_base}pure', 1113s {h_off} 'hybrid': '{package_base}hybrid', 1113s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 1113s {c_off} 'cmake': '{package_base}cmake', 1113s }} 1113s ) 1113s """.format( 1113s cmake_source_dir=cmake_source_dir, 1113s cmake_install_dir=package_base, 1113s package_base=package_base_dir, 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s p_off="" if has_pure_package else "#", 1113s pm_off="" if has_pure_module else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s src_dir = tmp_dir.ensure(package_base, dir=1) 1113s 1113s src_dir.join("CMakeLists.txt").write( 1113s textwrap.dedent( 1113s """ 1113s cmake_minimum_required(VERSION 3.5.0) 1113s project(hybrid NONE) 1113s set(build_dir ${{CMAKE_BINARY_DIR}}) 1113s 1113s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 1113s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 1113s {c_off} install( 1113s {c_off} FILES 1113s {c_off} ${{build_dir}}/__init__.py 1113s {c_off} ${{build_dir}}/cmake.py 1113s {c_off} DESTINATION cmake 1113s {c_off} ) 1113s 1113s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 1113s {cm_off} install( 1113s {cm_off} FILES ${{build_dir}}/cmakeModule.py 1113s {cm_off} DESTINATION .) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 1113s {h_off} DESTINATION hybrid/data) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 1113s {h_off} DESTINATION hybrid/hybrid_2) 1113s 1113s install(CODE "message(STATUS \\\"Installation complete\\\")") 1113s """.format( 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 1113s path_types: Sequence[str] 1113s try: 1113s path_types = next( 1113s iter( 1113s zip( 1113s *filter( 1113s lambda i: i[1], 1113s [ 1113s ("c", has_cmake_package), 1113s ("cm", has_cmake_module), 1113s ("h", has_hybrid_package), 1113s ("p", has_pure_package), 1113s ("pm", has_pure_module), 1113s ], 1113s ) 1113s ) 1113s ) 1113s ) 1113s except StopIteration: 1113s path_types = [] 1113s 1113s def select_paths(annotated_paths): 1113s """Return a filtered list paths considering ``path_types``. 1113s 1113s `annotated_paths`` is list of tuple ``(type, path)`` where type 1113s is either `c`, 'cm', `h`, `p` or 'pm'. 1113s 1113s """ 1113s return filter(lambda i: i[0] in path_types, annotated_paths) 1113s 1113s # Commented paths are the one expected to be installed by CMake. For 1113s # this reason, corresponding files should NOT be created in the source 1113s # tree. 1113s for _type, path in select_paths( 1113s [ 1113s # ('c', 'cmake/__init__.py'), 1113s # ('c', 'cmake/cmake.py'), 1113s # ('cm', 'cmakeModule.py'), 1113s ("h", "hybrid/__init__.py"), 1113s # ('h', 'hybrid/hybrid_cmake.dat'), 1113s # ('h', 'hybrid/hybrid_cmake.py'), 1113s ("h", "hybrid/hybrid_pure.dat"), 1113s ("h", "hybrid/hybrid_pure.py"), 1113s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 1113s ("h", "hybrid/data/hybrid_data_pure.dat"), 1113s ("h", "hybrid/hybrid_2/__init__.py"), 1113s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 1113s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 1113s ("p", "hybrid/hybrid_2_pure/__init__.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 1113s ("pm", "pureModule.py"), 1113s ("p", "pure/__init__.py"), 1113s ("p", "pure/pure.py"), 1113s ("p", "pure/data/pure.dat"), 1113s ] 1113s ): 1113s assert _type in {"p", "pm", "h"} 1113s root = package_base if _type in {"p", "pm"} else cmake_source_dir 1113s tmp_dir.ensure(os.path.join(root, path)) 1113s 1113s # Do not call the real setup function. Instead, replace it with 1113s # a MagicMock allowing to check with which arguments it was invoked. 1113s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 1113s 1113s # Convenience print function 1113s def _pprint(desc, value=None): 1113s print( 1113s "-----------------\n" 1113s f"{desc}:\n" 1113s "\n" 1113s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 1113s ) 1113s 1113s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 1113s 1113s _pprint = ._pprint at 0xf72623fad940> 1113s _type = 'p' 1113s cmake_source_dir = '' 1113s has_cmake_module = 1 1113s has_cmake_package = 1 1113s has_hybrid_package = 1 1113s has_pure_module = 1 1113s has_pure_package = 1 1113s mock_setup = 1113s mocker = 1113s package_base = '' 1113s package_base_dir = '' 1113s path = 'pure/data/pure.dat' 1113s path_types = ('c', 'cm', 'h', 'p', 'pm') 1113s root = '' 1113s select_paths = .select_paths at 0xf72623fad620> 1113s src_dir = local('/tmp/pytest-of-ubuntu/pytest-113/test_setup_inputs0') 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-113/test_setup_inputs0') 1113s with_package_base = 0 1113s 1113s tests/test_setup.py:849: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-113/test_setup_inputs0') 1113s setup_args = ['build'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-113/test_setup_inputs0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ________________________ test_setup_inputs[1-0-0-0-0-0] ________________________ 1113s 1113s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 0 1113s has_pure_package = 0, has_pure_module = 0, with_package_base = 1 1113s mocker = 1113s 1113s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 1113s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 1113s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_module", [0, 1]) 1113s @pytest.mark.parametrize("with_package_base", [0, 1]) 1113s def test_setup_inputs( 1113s has_cmake_package, 1113s has_cmake_module, 1113s has_hybrid_package, 1113s has_pure_package, 1113s has_pure_module, 1113s with_package_base, 1113s mocker, 1113s ): 1113s """This test that a project can have a package with some modules 1113s installed using setup.py and some other modules installed using CMake. 1113s """ 1113s 1113s tmp_dir = _tmpdir("test_setup_inputs") 1113s 1113s package_base = "to/the/base" if with_package_base else "" 1113s package_base_dir = package_base + "/" if package_base else "" 1113s cmake_source_dir = package_base 1113s 1113s if cmake_source_dir and (has_cmake_package or has_cmake_module): 1113s pytest.skip( 1113s "unsupported configuration: " 1113s "python package fully generated by CMake does *NOT* work. " 1113s "At least __init__.py should be in the project source tree" 1113s ) 1113s 1113s # ------------------------------------------------------------------------- 1113s # Here is the "SOURCE" tree layout: 1113s # 1113s # ROOT/ 1113s # 1113s # setup.py 1113s # 1113s # [/] 1113s # 1113s # pureModule.py 1113s # 1113s # pure/ 1113s # __init__.py 1113s # pure.py 1113s # 1113s # data/ 1113s # pure.dat 1113s # 1113s # [/] 1113s # 1113s # hybrid/ 1113s # CMakeLists.txt 1113s # __init__.py 1113s # hybrid_pure.dat 1113s # hybrid_pure.py 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat 1113s # 1113s # hybrid_2/ 1113s # __init__.py 1113s # hybrid_2_pure.py 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py 1113s # hybrid_2_pure_1.py 1113s # hybrid_2_pure_2.py 1113s # 1113s # 1113s # ------------------------------------------------------------------------- 1113s # and here is the "BINARY" distribution layout: 1113s # 1113s # The comment "CMake" or "Setuptools" indicates which tool is responsible 1113s # for placing the file in the tree used to create the binary distribution. 1113s # 1113s # ROOT/ 1113s # 1113s # cmakeModule.py # CMake 1113s # 1113s # cmake/ 1113s # __init__.py # CMake 1113s # cmake.py # CMake 1113s # 1113s # hybrid/ 1113s # hybrid_cmake.dat # CMake 1113s # hybrid_cmake.py # CMake 1113s # hybrid_pure.dat # Setuptools 1113s # hybrid_pure.py # Setuptools 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat # CMake or Setuptools 1113s # hybrid_data_cmake.dat # CMake *NO TEST* 1113s # 1113s # hybrid_2/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure.py # CMake or Setuptools 1113s # hybrid_2_cmake.py # CMake 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure_1.py # CMake or Setuptools 1113s # hybrid_2_pure_2.py # CMake or Setuptools 1113s # 1113s # pureModule.py # Setuptools 1113s # 1113s # pure/ 1113s # __init__.py # Setuptools 1113s # pure.py # Setuptools 1113s # 1113s # data/ 1113s # pure.dat # Setuptools 1113s 1113s tmp_dir.join("setup.py").write( 1113s textwrap.dedent( 1113s """ 1113s from skbuild import setup 1113s #from setuptools import setup 1113s setup( 1113s name="test_hybrid_project", 1113s version="1.2.3", 1113s description=("an hybrid package mixing files installed by both " 1113s "CMake and setuptools"), 1113s author='The scikit-build team', 1113s license="MIT", 1113s cmake_source_dir='{cmake_source_dir}', 1113s cmake_install_dir='{cmake_install_dir}', 1113s # Arbitrary order of packages 1113s packages=[ 1113s {p_off} 'pure', 1113s {h_off} 'hybrid.hybrid_2', 1113s {h_off} 'hybrid', 1113s {c_off} 'cmake', 1113s {p_off} 'hybrid.hybrid_2_pure', 1113s ], 1113s py_modules=[ 1113s {pm_off} '{package_base}pureModule', 1113s {cm_off} '{package_base}cmakeModule', 1113s ], 1113s package_data={{ 1113s {p_off} 'pure': ['data/pure.dat'], 1113s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 1113s }}, 1113s # Arbitrary order of package_dir 1113s package_dir = {{ 1113s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 1113s {p_off} 'pure': '{package_base}pure', 1113s {h_off} 'hybrid': '{package_base}hybrid', 1113s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 1113s {c_off} 'cmake': '{package_base}cmake', 1113s }} 1113s ) 1113s """.format( 1113s cmake_source_dir=cmake_source_dir, 1113s cmake_install_dir=package_base, 1113s package_base=package_base_dir, 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s p_off="" if has_pure_package else "#", 1113s pm_off="" if has_pure_module else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s src_dir = tmp_dir.ensure(package_base, dir=1) 1113s 1113s src_dir.join("CMakeLists.txt").write( 1113s textwrap.dedent( 1113s """ 1113s cmake_minimum_required(VERSION 3.5.0) 1113s project(hybrid NONE) 1113s set(build_dir ${{CMAKE_BINARY_DIR}}) 1113s 1113s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 1113s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 1113s {c_off} install( 1113s {c_off} FILES 1113s {c_off} ${{build_dir}}/__init__.py 1113s {c_off} ${{build_dir}}/cmake.py 1113s {c_off} DESTINATION cmake 1113s {c_off} ) 1113s 1113s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 1113s {cm_off} install( 1113s {cm_off} FILES ${{build_dir}}/cmakeModule.py 1113s {cm_off} DESTINATION .) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 1113s {h_off} DESTINATION hybrid/data) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 1113s {h_off} DESTINATION hybrid/hybrid_2) 1113s 1113s install(CODE "message(STATUS \\\"Installation complete\\\")") 1113s """.format( 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 1113s path_types: Sequence[str] 1113s try: 1113s path_types = next( 1113s iter( 1113s zip( 1113s *filter( 1113s lambda i: i[1], 1113s [ 1113s ("c", has_cmake_package), 1113s ("cm", has_cmake_module), 1113s ("h", has_hybrid_package), 1113s ("p", has_pure_package), 1113s ("pm", has_pure_module), 1113s ], 1113s ) 1113s ) 1113s ) 1113s ) 1113s except StopIteration: 1113s path_types = [] 1113s 1113s def select_paths(annotated_paths): 1113s """Return a filtered list paths considering ``path_types``. 1113s 1113s `annotated_paths`` is list of tuple ``(type, path)`` where type 1113s is either `c`, 'cm', `h`, `p` or 'pm'. 1113s 1113s """ 1113s return filter(lambda i: i[0] in path_types, annotated_paths) 1113s 1113s # Commented paths are the one expected to be installed by CMake. For 1113s # this reason, corresponding files should NOT be created in the source 1113s # tree. 1113s for _type, path in select_paths( 1113s [ 1113s # ('c', 'cmake/__init__.py'), 1113s # ('c', 'cmake/cmake.py'), 1113s # ('cm', 'cmakeModule.py'), 1113s ("h", "hybrid/__init__.py"), 1113s # ('h', 'hybrid/hybrid_cmake.dat'), 1113s # ('h', 'hybrid/hybrid_cmake.py'), 1113s ("h", "hybrid/hybrid_pure.dat"), 1113s ("h", "hybrid/hybrid_pure.py"), 1113s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 1113s ("h", "hybrid/data/hybrid_data_pure.dat"), 1113s ("h", "hybrid/hybrid_2/__init__.py"), 1113s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 1113s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 1113s ("p", "hybrid/hybrid_2_pure/__init__.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 1113s ("pm", "pureModule.py"), 1113s ("p", "pure/__init__.py"), 1113s ("p", "pure/pure.py"), 1113s ("p", "pure/data/pure.dat"), 1113s ] 1113s ): 1113s assert _type in {"p", "pm", "h"} 1113s root = package_base if _type in {"p", "pm"} else cmake_source_dir 1113s tmp_dir.ensure(os.path.join(root, path)) 1113s 1113s # Do not call the real setup function. Instead, replace it with 1113s # a MagicMock allowing to check with which arguments it was invoked. 1113s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 1113s 1113s # Convenience print function 1113s def _pprint(desc, value=None): 1113s print( 1113s "-----------------\n" 1113s f"{desc}:\n" 1113s "\n" 1113s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 1113s ) 1113s 1113s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 1113s 1113s _pprint = ._pprint at 0xf72623fac720> 1113s cmake_source_dir = 'to/the/base' 1113s has_cmake_module = 0 1113s has_cmake_package = 0 1113s has_hybrid_package = 0 1113s has_pure_module = 0 1113s has_pure_package = 0 1113s mock_setup = 1113s mocker = 1113s package_base = 'to/the/base' 1113s package_base_dir = 'to/the/base/' 1113s path_types = [] 1113s select_paths = .select_paths at 0xf72623fad080> 1113s src_dir = local('/tmp/pytest-of-ubuntu/pytest-114/test_setup_inputs0/to/the/base') 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-114/test_setup_inputs0') 1113s with_package_base = 1 1113s 1113s tests/test_setup.py:849: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-114/test_setup_inputs0') 1113s setup_args = ['build'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-114/test_setup_inputs0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ________________________ test_setup_inputs[1-0-0-1-0-0] ________________________ 1113s 1113s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 1 1113s has_pure_package = 0, has_pure_module = 0, with_package_base = 1 1113s mocker = 1113s 1113s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 1113s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 1113s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_module", [0, 1]) 1113s @pytest.mark.parametrize("with_package_base", [0, 1]) 1113s def test_setup_inputs( 1113s has_cmake_package, 1113s has_cmake_module, 1113s has_hybrid_package, 1113s has_pure_package, 1113s has_pure_module, 1113s with_package_base, 1113s mocker, 1113s ): 1113s """This test that a project can have a package with some modules 1113s installed using setup.py and some other modules installed using CMake. 1113s """ 1113s 1113s tmp_dir = _tmpdir("test_setup_inputs") 1113s 1113s package_base = "to/the/base" if with_package_base else "" 1113s package_base_dir = package_base + "/" if package_base else "" 1113s cmake_source_dir = package_base 1113s 1113s if cmake_source_dir and (has_cmake_package or has_cmake_module): 1113s pytest.skip( 1113s "unsupported configuration: " 1113s "python package fully generated by CMake does *NOT* work. " 1113s "At least __init__.py should be in the project source tree" 1113s ) 1113s 1113s # ------------------------------------------------------------------------- 1113s # Here is the "SOURCE" tree layout: 1113s # 1113s # ROOT/ 1113s # 1113s # setup.py 1113s # 1113s # [/] 1113s # 1113s # pureModule.py 1113s # 1113s # pure/ 1113s # __init__.py 1113s # pure.py 1113s # 1113s # data/ 1113s # pure.dat 1113s # 1113s # [/] 1113s # 1113s # hybrid/ 1113s # CMakeLists.txt 1113s # __init__.py 1113s # hybrid_pure.dat 1113s # hybrid_pure.py 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat 1113s # 1113s # hybrid_2/ 1113s # __init__.py 1113s # hybrid_2_pure.py 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py 1113s # hybrid_2_pure_1.py 1113s # hybrid_2_pure_2.py 1113s # 1113s # 1113s # ------------------------------------------------------------------------- 1113s # and here is the "BINARY" distribution layout: 1113s # 1113s # The comment "CMake" or "Setuptools" indicates which tool is responsible 1113s # for placing the file in the tree used to create the binary distribution. 1113s # 1113s # ROOT/ 1113s # 1113s # cmakeModule.py # CMake 1113s # 1113s # cmake/ 1113s # __init__.py # CMake 1113s # cmake.py # CMake 1113s # 1113s # hybrid/ 1113s # hybrid_cmake.dat # CMake 1113s # hybrid_cmake.py # CMake 1113s # hybrid_pure.dat # Setuptools 1113s # hybrid_pure.py # Setuptools 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat # CMake or Setuptools 1113s # hybrid_data_cmake.dat # CMake *NO TEST* 1113s # 1113s # hybrid_2/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure.py # CMake or Setuptools 1113s # hybrid_2_cmake.py # CMake 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure_1.py # CMake or Setuptools 1113s # hybrid_2_pure_2.py # CMake or Setuptools 1113s # 1113s # pureModule.py # Setuptools 1113s # 1113s # pure/ 1113s # __init__.py # Setuptools 1113s # pure.py # Setuptools 1113s # 1113s # data/ 1113s # pure.dat # Setuptools 1113s 1113s tmp_dir.join("setup.py").write( 1113s textwrap.dedent( 1113s """ 1113s from skbuild import setup 1113s #from setuptools import setup 1113s setup( 1113s name="test_hybrid_project", 1113s version="1.2.3", 1113s description=("an hybrid package mixing files installed by both " 1113s "CMake and setuptools"), 1113s author='The scikit-build team', 1113s license="MIT", 1113s cmake_source_dir='{cmake_source_dir}', 1113s cmake_install_dir='{cmake_install_dir}', 1113s # Arbitrary order of packages 1113s packages=[ 1113s {p_off} 'pure', 1113s {h_off} 'hybrid.hybrid_2', 1113s {h_off} 'hybrid', 1113s {c_off} 'cmake', 1113s {p_off} 'hybrid.hybrid_2_pure', 1113s ], 1113s py_modules=[ 1113s {pm_off} '{package_base}pureModule', 1113s {cm_off} '{package_base}cmakeModule', 1113s ], 1113s package_data={{ 1113s {p_off} 'pure': ['data/pure.dat'], 1113s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 1113s }}, 1113s # Arbitrary order of package_dir 1113s package_dir = {{ 1113s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 1113s {p_off} 'pure': '{package_base}pure', 1113s {h_off} 'hybrid': '{package_base}hybrid', 1113s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 1113s {c_off} 'cmake': '{package_base}cmake', 1113s }} 1113s ) 1113s """.format( 1113s cmake_source_dir=cmake_source_dir, 1113s cmake_install_dir=package_base, 1113s package_base=package_base_dir, 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s p_off="" if has_pure_package else "#", 1113s pm_off="" if has_pure_module else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s src_dir = tmp_dir.ensure(package_base, dir=1) 1113s 1113s src_dir.join("CMakeLists.txt").write( 1113s textwrap.dedent( 1113s """ 1113s cmake_minimum_required(VERSION 3.5.0) 1113s project(hybrid NONE) 1113s set(build_dir ${{CMAKE_BINARY_DIR}}) 1113s 1113s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 1113s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 1113s {c_off} install( 1113s {c_off} FILES 1113s {c_off} ${{build_dir}}/__init__.py 1113s {c_off} ${{build_dir}}/cmake.py 1113s {c_off} DESTINATION cmake 1113s {c_off} ) 1113s 1113s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 1113s {cm_off} install( 1113s {cm_off} FILES ${{build_dir}}/cmakeModule.py 1113s {cm_off} DESTINATION .) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 1113s {h_off} DESTINATION hybrid/data) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 1113s {h_off} DESTINATION hybrid/hybrid_2) 1113s 1113s install(CODE "message(STATUS \\\"Installation complete\\\")") 1113s """.format( 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 1113s path_types: Sequence[str] 1113s try: 1113s path_types = next( 1113s iter( 1113s zip( 1113s *filter( 1113s lambda i: i[1], 1113s [ 1113s ("c", has_cmake_package), 1113s ("cm", has_cmake_module), 1113s ("h", has_hybrid_package), 1113s ("p", has_pure_package), 1113s ("pm", has_pure_module), 1113s ], 1113s ) 1113s ) 1113s ) 1113s ) 1113s except StopIteration: 1113s path_types = [] 1113s 1113s def select_paths(annotated_paths): 1113s """Return a filtered list paths considering ``path_types``. 1113s 1113s `annotated_paths`` is list of tuple ``(type, path)`` where type 1113s is either `c`, 'cm', `h`, `p` or 'pm'. 1113s 1113s """ 1113s return filter(lambda i: i[0] in path_types, annotated_paths) 1113s 1113s # Commented paths are the one expected to be installed by CMake. For 1113s # this reason, corresponding files should NOT be created in the source 1113s # tree. 1113s for _type, path in select_paths( 1113s [ 1113s # ('c', 'cmake/__init__.py'), 1113s # ('c', 'cmake/cmake.py'), 1113s # ('cm', 'cmakeModule.py'), 1113s ("h", "hybrid/__init__.py"), 1113s # ('h', 'hybrid/hybrid_cmake.dat'), 1113s # ('h', 'hybrid/hybrid_cmake.py'), 1113s ("h", "hybrid/hybrid_pure.dat"), 1113s ("h", "hybrid/hybrid_pure.py"), 1113s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 1113s ("h", "hybrid/data/hybrid_data_pure.dat"), 1113s ("h", "hybrid/hybrid_2/__init__.py"), 1113s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 1113s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 1113s ("p", "hybrid/hybrid_2_pure/__init__.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 1113s ("pm", "pureModule.py"), 1113s ("p", "pure/__init__.py"), 1113s ("p", "pure/pure.py"), 1113s ("p", "pure/data/pure.dat"), 1113s ] 1113s ): 1113s assert _type in {"p", "pm", "h"} 1113s root = package_base if _type in {"p", "pm"} else cmake_source_dir 1113s tmp_dir.ensure(os.path.join(root, path)) 1113s 1113s # Do not call the real setup function. Instead, replace it with 1113s # a MagicMock allowing to check with which arguments it was invoked. 1113s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 1113s 1113s # Convenience print function 1113s def _pprint(desc, value=None): 1113s print( 1113s "-----------------\n" 1113s f"{desc}:\n" 1113s "\n" 1113s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 1113s ) 1113s 1113s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 1113s 1113s _pprint = ._pprint at 0xf726241607c0> 1113s _type = 'h' 1113s cmake_source_dir = 'to/the/base' 1113s has_cmake_module = 0 1113s has_cmake_package = 0 1113s has_hybrid_package = 1 1113s has_pure_module = 0 1113s has_pure_package = 0 1113s mock_setup = 1113s mocker = 1113s package_base = 'to/the/base' 1113s package_base_dir = 'to/the/base/' 1113s path = 'hybrid/hybrid_2/hybrid_2_pure.py' 1113s path_types = ('h',) 1113s root = 'to/the/base' 1113s select_paths = .select_paths at 0xf726240f2f20> 1113s src_dir = local('/tmp/pytest-of-ubuntu/pytest-118/test_setup_inputs0/to/the/base') 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-118/test_setup_inputs0') 1113s with_package_base = 1 1113s 1113s tests/test_setup.py:849: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-118/test_setup_inputs0') 1113s setup_args = ['build'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-118/test_setup_inputs0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ________________________ test_setup_inputs[1-0-1-0-0-0] ________________________ 1113s 1113s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 0 1113s has_pure_package = 1, has_pure_module = 0, with_package_base = 1 1113s mocker = 1113s 1113s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 1113s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 1113s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_module", [0, 1]) 1113s @pytest.mark.parametrize("with_package_base", [0, 1]) 1113s def test_setup_inputs( 1113s has_cmake_package, 1113s has_cmake_module, 1113s has_hybrid_package, 1113s has_pure_package, 1113s has_pure_module, 1113s with_package_base, 1113s mocker, 1113s ): 1113s """This test that a project can have a package with some modules 1113s installed using setup.py and some other modules installed using CMake. 1113s """ 1113s 1113s tmp_dir = _tmpdir("test_setup_inputs") 1113s 1113s package_base = "to/the/base" if with_package_base else "" 1113s package_base_dir = package_base + "/" if package_base else "" 1113s cmake_source_dir = package_base 1113s 1113s if cmake_source_dir and (has_cmake_package or has_cmake_module): 1113s pytest.skip( 1113s "unsupported configuration: " 1113s "python package fully generated by CMake does *NOT* work. " 1113s "At least __init__.py should be in the project source tree" 1113s ) 1113s 1113s # ------------------------------------------------------------------------- 1113s # Here is the "SOURCE" tree layout: 1113s # 1113s # ROOT/ 1113s # 1113s # setup.py 1113s # 1113s # [/] 1113s # 1113s # pureModule.py 1113s # 1113s # pure/ 1113s # __init__.py 1113s # pure.py 1113s # 1113s # data/ 1113s # pure.dat 1113s # 1113s # [/] 1113s # 1113s # hybrid/ 1113s # CMakeLists.txt 1113s # __init__.py 1113s # hybrid_pure.dat 1113s # hybrid_pure.py 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat 1113s # 1113s # hybrid_2/ 1113s # __init__.py 1113s # hybrid_2_pure.py 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py 1113s # hybrid_2_pure_1.py 1113s # hybrid_2_pure_2.py 1113s # 1113s # 1113s # ------------------------------------------------------------------------- 1113s # and here is the "BINARY" distribution layout: 1113s # 1113s # The comment "CMake" or "Setuptools" indicates which tool is responsible 1113s # for placing the file in the tree used to create the binary distribution. 1113s # 1113s # ROOT/ 1113s # 1113s # cmakeModule.py # CMake 1113s # 1113s # cmake/ 1113s # __init__.py # CMake 1113s # cmake.py # CMake 1113s # 1113s # hybrid/ 1113s # hybrid_cmake.dat # CMake 1113s # hybrid_cmake.py # CMake 1113s # hybrid_pure.dat # Setuptools 1113s # hybrid_pure.py # Setuptools 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat # CMake or Setuptools 1113s # hybrid_data_cmake.dat # CMake *NO TEST* 1113s # 1113s # hybrid_2/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure.py # CMake or Setuptools 1113s # hybrid_2_cmake.py # CMake 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure_1.py # CMake or Setuptools 1113s # hybrid_2_pure_2.py # CMake or Setuptools 1113s # 1113s # pureModule.py # Setuptools 1113s # 1113s # pure/ 1113s # __init__.py # Setuptools 1113s # pure.py # Setuptools 1113s # 1113s # data/ 1113s # pure.dat # Setuptools 1113s 1113s tmp_dir.join("setup.py").write( 1113s textwrap.dedent( 1113s """ 1113s from skbuild import setup 1113s #from setuptools import setup 1113s setup( 1113s name="test_hybrid_project", 1113s version="1.2.3", 1113s description=("an hybrid package mixing files installed by both " 1113s "CMake and setuptools"), 1113s author='The scikit-build team', 1113s license="MIT", 1113s cmake_source_dir='{cmake_source_dir}', 1113s cmake_install_dir='{cmake_install_dir}', 1113s # Arbitrary order of packages 1113s packages=[ 1113s {p_off} 'pure', 1113s {h_off} 'hybrid.hybrid_2', 1113s {h_off} 'hybrid', 1113s {c_off} 'cmake', 1113s {p_off} 'hybrid.hybrid_2_pure', 1113s ], 1113s py_modules=[ 1113s {pm_off} '{package_base}pureModule', 1113s {cm_off} '{package_base}cmakeModule', 1113s ], 1113s package_data={{ 1113s {p_off} 'pure': ['data/pure.dat'], 1113s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 1113s }}, 1113s # Arbitrary order of package_dir 1113s package_dir = {{ 1113s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 1113s {p_off} 'pure': '{package_base}pure', 1113s {h_off} 'hybrid': '{package_base}hybrid', 1113s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 1113s {c_off} 'cmake': '{package_base}cmake', 1113s }} 1113s ) 1113s """.format( 1113s cmake_source_dir=cmake_source_dir, 1113s cmake_install_dir=package_base, 1113s package_base=package_base_dir, 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s p_off="" if has_pure_package else "#", 1113s pm_off="" if has_pure_module else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s src_dir = tmp_dir.ensure(package_base, dir=1) 1113s 1113s src_dir.join("CMakeLists.txt").write( 1113s textwrap.dedent( 1113s """ 1113s cmake_minimum_required(VERSION 3.5.0) 1113s project(hybrid NONE) 1113s set(build_dir ${{CMAKE_BINARY_DIR}}) 1113s 1113s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 1113s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 1113s {c_off} install( 1113s {c_off} FILES 1113s {c_off} ${{build_dir}}/__init__.py 1113s {c_off} ${{build_dir}}/cmake.py 1113s {c_off} DESTINATION cmake 1113s {c_off} ) 1113s 1113s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 1113s {cm_off} install( 1113s {cm_off} FILES ${{build_dir}}/cmakeModule.py 1113s {cm_off} DESTINATION .) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 1113s {h_off} DESTINATION hybrid/data) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 1113s {h_off} DESTINATION hybrid/hybrid_2) 1113s 1113s install(CODE "message(STATUS \\\"Installation complete\\\")") 1113s """.format( 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 1113s path_types: Sequence[str] 1113s try: 1113s path_types = next( 1113s iter( 1113s zip( 1113s *filter( 1113s lambda i: i[1], 1113s [ 1113s ("c", has_cmake_package), 1113s ("cm", has_cmake_module), 1113s ("h", has_hybrid_package), 1113s ("p", has_pure_package), 1113s ("pm", has_pure_module), 1113s ], 1113s ) 1113s ) 1113s ) 1113s ) 1113s except StopIteration: 1113s path_types = [] 1113s 1113s def select_paths(annotated_paths): 1113s """Return a filtered list paths considering ``path_types``. 1113s 1113s `annotated_paths`` is list of tuple ``(type, path)`` where type 1113s is either `c`, 'cm', `h`, `p` or 'pm'. 1113s 1113s """ 1113s return filter(lambda i: i[0] in path_types, annotated_paths) 1113s 1113s # Commented paths are the one expected to be installed by CMake. For 1113s # this reason, corresponding files should NOT be created in the source 1113s # tree. 1113s for _type, path in select_paths( 1113s [ 1113s # ('c', 'cmake/__init__.py'), 1113s # ('c', 'cmake/cmake.py'), 1113s # ('cm', 'cmakeModule.py'), 1113s ("h", "hybrid/__init__.py"), 1113s # ('h', 'hybrid/hybrid_cmake.dat'), 1113s # ('h', 'hybrid/hybrid_cmake.py'), 1113s ("h", "hybrid/hybrid_pure.dat"), 1113s ("h", "hybrid/hybrid_pure.py"), 1113s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 1113s ("h", "hybrid/data/hybrid_data_pure.dat"), 1113s ("h", "hybrid/hybrid_2/__init__.py"), 1113s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 1113s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 1113s ("p", "hybrid/hybrid_2_pure/__init__.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 1113s ("pm", "pureModule.py"), 1113s ("p", "pure/__init__.py"), 1113s ("p", "pure/pure.py"), 1113s ("p", "pure/data/pure.dat"), 1113s ] 1113s ): 1113s assert _type in {"p", "pm", "h"} 1113s root = package_base if _type in {"p", "pm"} else cmake_source_dir 1113s tmp_dir.ensure(os.path.join(root, path)) 1113s 1113s # Do not call the real setup function. Instead, replace it with 1113s # a MagicMock allowing to check with which arguments it was invoked. 1113s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 1113s 1113s # Convenience print function 1113s def _pprint(desc, value=None): 1113s print( 1113s "-----------------\n" 1113s f"{desc}:\n" 1113s "\n" 1113s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 1113s ) 1113s 1113s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 1113s 1113s _pprint = ._pprint at 0xf726240f1940> 1113s _type = 'p' 1113s cmake_source_dir = 'to/the/base' 1113s has_cmake_module = 0 1113s has_cmake_package = 0 1113s has_hybrid_package = 0 1113s has_pure_module = 0 1113s has_pure_package = 1 1113s mock_setup = 1113s mocker = 1113s package_base = 'to/the/base' 1113s package_base_dir = 'to/the/base/' 1113s path = 'pure/data/pure.dat' 1113s path_types = ('p',) 1113s root = 'to/the/base' 1113s select_paths = .select_paths at 0xf726240f1620> 1113s src_dir = local('/tmp/pytest-of-ubuntu/pytest-122/test_setup_inputs0/to/the/base') 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-122/test_setup_inputs0') 1113s with_package_base = 1 1113s 1113s tests/test_setup.py:849: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-122/test_setup_inputs0') 1113s setup_args = ['build'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-122/test_setup_inputs0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ________________________ test_setup_inputs[1-0-1-1-0-0] ________________________ 1113s 1113s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 1 1113s has_pure_package = 1, has_pure_module = 0, with_package_base = 1 1113s mocker = 1113s 1113s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 1113s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 1113s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_module", [0, 1]) 1113s @pytest.mark.parametrize("with_package_base", [0, 1]) 1113s def test_setup_inputs( 1113s has_cmake_package, 1113s has_cmake_module, 1113s has_hybrid_package, 1113s has_pure_package, 1113s has_pure_module, 1113s with_package_base, 1113s mocker, 1113s ): 1113s """This test that a project can have a package with some modules 1113s installed using setup.py and some other modules installed using CMake. 1113s """ 1113s 1113s tmp_dir = _tmpdir("test_setup_inputs") 1113s 1113s package_base = "to/the/base" if with_package_base else "" 1113s package_base_dir = package_base + "/" if package_base else "" 1113s cmake_source_dir = package_base 1113s 1113s if cmake_source_dir and (has_cmake_package or has_cmake_module): 1113s pytest.skip( 1113s "unsupported configuration: " 1113s "python package fully generated by CMake does *NOT* work. " 1113s "At least __init__.py should be in the project source tree" 1113s ) 1113s 1113s # ------------------------------------------------------------------------- 1113s # Here is the "SOURCE" tree layout: 1113s # 1113s # ROOT/ 1113s # 1113s # setup.py 1113s # 1113s # [/] 1113s # 1113s # pureModule.py 1113s # 1113s # pure/ 1113s # __init__.py 1113s # pure.py 1113s # 1113s # data/ 1113s # pure.dat 1113s # 1113s # [/] 1113s # 1113s # hybrid/ 1113s # CMakeLists.txt 1113s # __init__.py 1113s # hybrid_pure.dat 1113s # hybrid_pure.py 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat 1113s # 1113s # hybrid_2/ 1113s # __init__.py 1113s # hybrid_2_pure.py 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py 1113s # hybrid_2_pure_1.py 1113s # hybrid_2_pure_2.py 1113s # 1113s # 1113s # ------------------------------------------------------------------------- 1113s # and here is the "BINARY" distribution layout: 1113s # 1113s # The comment "CMake" or "Setuptools" indicates which tool is responsible 1113s # for placing the file in the tree used to create the binary distribution. 1113s # 1113s # ROOT/ 1113s # 1113s # cmakeModule.py # CMake 1113s # 1113s # cmake/ 1113s # __init__.py # CMake 1113s # cmake.py # CMake 1113s # 1113s # hybrid/ 1113s # hybrid_cmake.dat # CMake 1113s # hybrid_cmake.py # CMake 1113s # hybrid_pure.dat # Setuptools 1113s # hybrid_pure.py # Setuptools 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat # CMake or Setuptools 1113s # hybrid_data_cmake.dat # CMake *NO TEST* 1113s # 1113s # hybrid_2/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure.py # CMake or Setuptools 1113s # hybrid_2_cmake.py # CMake 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure_1.py # CMake or Setuptools 1113s # hybrid_2_pure_2.py # CMake or Setuptools 1113s # 1113s # pureModule.py # Setuptools 1113s # 1113s # pure/ 1113s # __init__.py # Setuptools 1113s # pure.py # Setuptools 1113s # 1113s # data/ 1113s # pure.dat # Setuptools 1113s 1113s tmp_dir.join("setup.py").write( 1113s textwrap.dedent( 1113s """ 1113s from skbuild import setup 1113s #from setuptools import setup 1113s setup( 1113s name="test_hybrid_project", 1113s version="1.2.3", 1113s description=("an hybrid package mixing files installed by both " 1113s "CMake and setuptools"), 1113s author='The scikit-build team', 1113s license="MIT", 1113s cmake_source_dir='{cmake_source_dir}', 1113s cmake_install_dir='{cmake_install_dir}', 1113s # Arbitrary order of packages 1113s packages=[ 1113s {p_off} 'pure', 1113s {h_off} 'hybrid.hybrid_2', 1113s {h_off} 'hybrid', 1113s {c_off} 'cmake', 1113s {p_off} 'hybrid.hybrid_2_pure', 1113s ], 1113s py_modules=[ 1113s {pm_off} '{package_base}pureModule', 1113s {cm_off} '{package_base}cmakeModule', 1113s ], 1113s package_data={{ 1113s {p_off} 'pure': ['data/pure.dat'], 1113s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 1113s }}, 1113s # Arbitrary order of package_dir 1113s package_dir = {{ 1113s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 1113s {p_off} 'pure': '{package_base}pure', 1113s {h_off} 'hybrid': '{package_base}hybrid', 1113s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 1113s {c_off} 'cmake': '{package_base}cmake', 1113s }} 1113s ) 1113s """.format( 1113s cmake_source_dir=cmake_source_dir, 1113s cmake_install_dir=package_base, 1113s package_base=package_base_dir, 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s p_off="" if has_pure_package else "#", 1113s pm_off="" if has_pure_module else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s src_dir = tmp_dir.ensure(package_base, dir=1) 1113s 1113s src_dir.join("CMakeLists.txt").write( 1113s textwrap.dedent( 1113s """ 1113s cmake_minimum_required(VERSION 3.5.0) 1113s project(hybrid NONE) 1113s set(build_dir ${{CMAKE_BINARY_DIR}}) 1113s 1113s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 1113s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 1113s {c_off} install( 1113s {c_off} FILES 1113s {c_off} ${{build_dir}}/__init__.py 1113s {c_off} ${{build_dir}}/cmake.py 1113s {c_off} DESTINATION cmake 1113s {c_off} ) 1113s 1113s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 1113s {cm_off} install( 1113s {cm_off} FILES ${{build_dir}}/cmakeModule.py 1113s {cm_off} DESTINATION .) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 1113s {h_off} DESTINATION hybrid/data) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 1113s {h_off} DESTINATION hybrid/hybrid_2) 1113s 1113s install(CODE "message(STATUS \\\"Installation complete\\\")") 1113s """.format( 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 1113s path_types: Sequence[str] 1113s try: 1113s path_types = next( 1113s iter( 1113s zip( 1113s *filter( 1113s lambda i: i[1], 1113s [ 1113s ("c", has_cmake_package), 1113s ("cm", has_cmake_module), 1113s ("h", has_hybrid_package), 1113s ("p", has_pure_package), 1113s ("pm", has_pure_module), 1113s ], 1113s ) 1113s ) 1113s ) 1113s ) 1113s except StopIteration: 1113s path_types = [] 1113s 1113s def select_paths(annotated_paths): 1113s """Return a filtered list paths considering ``path_types``. 1113s 1113s `annotated_paths`` is list of tuple ``(type, path)`` where type 1113s is either `c`, 'cm', `h`, `p` or 'pm'. 1113s 1113s """ 1113s return filter(lambda i: i[0] in path_types, annotated_paths) 1113s 1113s # Commented paths are the one expected to be installed by CMake. For 1113s # this reason, corresponding files should NOT be created in the source 1113s # tree. 1113s for _type, path in select_paths( 1113s [ 1113s # ('c', 'cmake/__init__.py'), 1113s # ('c', 'cmake/cmake.py'), 1113s # ('cm', 'cmakeModule.py'), 1113s ("h", "hybrid/__init__.py"), 1113s # ('h', 'hybrid/hybrid_cmake.dat'), 1113s # ('h', 'hybrid/hybrid_cmake.py'), 1113s ("h", "hybrid/hybrid_pure.dat"), 1113s ("h", "hybrid/hybrid_pure.py"), 1113s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 1113s ("h", "hybrid/data/hybrid_data_pure.dat"), 1113s ("h", "hybrid/hybrid_2/__init__.py"), 1113s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 1113s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 1113s ("p", "hybrid/hybrid_2_pure/__init__.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 1113s ("pm", "pureModule.py"), 1113s ("p", "pure/__init__.py"), 1113s ("p", "pure/pure.py"), 1113s ("p", "pure/data/pure.dat"), 1113s ] 1113s ): 1113s assert _type in {"p", "pm", "h"} 1113s root = package_base if _type in {"p", "pm"} else cmake_source_dir 1113s tmp_dir.ensure(os.path.join(root, path)) 1113s 1113s # Do not call the real setup function. Instead, replace it with 1113s # a MagicMock allowing to check with which arguments it was invoked. 1113s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 1113s 1113s # Convenience print function 1113s def _pprint(desc, value=None): 1113s print( 1113s "-----------------\n" 1113s f"{desc}:\n" 1113s "\n" 1113s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 1113s ) 1113s 1113s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 1113s 1113s _pprint = ._pprint at 0xf726240f3600> 1113s _type = 'p' 1113s cmake_source_dir = 'to/the/base' 1113s has_cmake_module = 0 1113s has_cmake_package = 0 1113s has_hybrid_package = 1 1113s has_pure_module = 0 1113s has_pure_package = 1 1113s mock_setup = 1113s mocker = 1113s package_base = 'to/the/base' 1113s package_base_dir = 'to/the/base/' 1113s path = 'pure/data/pure.dat' 1113s path_types = ('h', 'p') 1113s root = 'to/the/base' 1113s select_paths = .select_paths at 0xf726240f2fc0> 1113s src_dir = local('/tmp/pytest-of-ubuntu/pytest-126/test_setup_inputs0/to/the/base') 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-126/test_setup_inputs0') 1113s with_package_base = 1 1113s 1113s tests/test_setup.py:849: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-126/test_setup_inputs0') 1113s setup_args = ['build'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-126/test_setup_inputs0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ________________________ test_setup_inputs[1-1-0-0-0-0] ________________________ 1113s 1113s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 0 1113s has_pure_package = 0, has_pure_module = 1, with_package_base = 1 1113s mocker = 1113s 1113s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 1113s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 1113s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_module", [0, 1]) 1113s @pytest.mark.parametrize("with_package_base", [0, 1]) 1113s def test_setup_inputs( 1113s has_cmake_package, 1113s has_cmake_module, 1113s has_hybrid_package, 1113s has_pure_package, 1113s has_pure_module, 1113s with_package_base, 1113s mocker, 1113s ): 1113s """This test that a project can have a package with some modules 1113s installed using setup.py and some other modules installed using CMake. 1113s """ 1113s 1113s tmp_dir = _tmpdir("test_setup_inputs") 1113s 1113s package_base = "to/the/base" if with_package_base else "" 1113s package_base_dir = package_base + "/" if package_base else "" 1113s cmake_source_dir = package_base 1113s 1113s if cmake_source_dir and (has_cmake_package or has_cmake_module): 1113s pytest.skip( 1113s "unsupported configuration: " 1113s "python package fully generated by CMake does *NOT* work. " 1113s "At least __init__.py should be in the project source tree" 1113s ) 1113s 1113s # ------------------------------------------------------------------------- 1113s # Here is the "SOURCE" tree layout: 1113s # 1113s # ROOT/ 1113s # 1113s # setup.py 1113s # 1113s # [/] 1113s # 1113s # pureModule.py 1113s # 1113s # pure/ 1113s # __init__.py 1113s # pure.py 1113s # 1113s # data/ 1113s # pure.dat 1113s # 1113s # [/] 1113s # 1113s # hybrid/ 1113s # CMakeLists.txt 1113s # __init__.py 1113s # hybrid_pure.dat 1113s # hybrid_pure.py 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat 1113s # 1113s # hybrid_2/ 1113s # __init__.py 1113s # hybrid_2_pure.py 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py 1113s # hybrid_2_pure_1.py 1113s # hybrid_2_pure_2.py 1113s # 1113s # 1113s # ------------------------------------------------------------------------- 1113s # and here is the "BINARY" distribution layout: 1113s # 1113s # The comment "CMake" or "Setuptools" indicates which tool is responsible 1113s # for placing the file in the tree used to create the binary distribution. 1113s # 1113s # ROOT/ 1113s # 1113s # cmakeModule.py # CMake 1113s # 1113s # cmake/ 1113s # __init__.py # CMake 1113s # cmake.py # CMake 1113s # 1113s # hybrid/ 1113s # hybrid_cmake.dat # CMake 1113s # hybrid_cmake.py # CMake 1113s # hybrid_pure.dat # Setuptools 1113s # hybrid_pure.py # Setuptools 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat # CMake or Setuptools 1113s # hybrid_data_cmake.dat # CMake *NO TEST* 1113s # 1113s # hybrid_2/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure.py # CMake or Setuptools 1113s # hybrid_2_cmake.py # CMake 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure_1.py # CMake or Setuptools 1113s # hybrid_2_pure_2.py # CMake or Setuptools 1113s # 1113s # pureModule.py # Setuptools 1113s # 1113s # pure/ 1113s # __init__.py # Setuptools 1113s # pure.py # Setuptools 1113s # 1113s # data/ 1113s # pure.dat # Setuptools 1113s 1113s tmp_dir.join("setup.py").write( 1113s textwrap.dedent( 1113s """ 1113s from skbuild import setup 1113s #from setuptools import setup 1113s setup( 1113s name="test_hybrid_project", 1113s version="1.2.3", 1113s description=("an hybrid package mixing files installed by both " 1113s "CMake and setuptools"), 1113s author='The scikit-build team', 1113s license="MIT", 1113s cmake_source_dir='{cmake_source_dir}', 1113s cmake_install_dir='{cmake_install_dir}', 1113s # Arbitrary order of packages 1113s packages=[ 1113s {p_off} 'pure', 1113s {h_off} 'hybrid.hybrid_2', 1113s {h_off} 'hybrid', 1113s {c_off} 'cmake', 1113s {p_off} 'hybrid.hybrid_2_pure', 1113s ], 1113s py_modules=[ 1113s {pm_off} '{package_base}pureModule', 1113s {cm_off} '{package_base}cmakeModule', 1113s ], 1113s package_data={{ 1113s {p_off} 'pure': ['data/pure.dat'], 1113s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 1113s }}, 1113s # Arbitrary order of package_dir 1113s package_dir = {{ 1113s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 1113s {p_off} 'pure': '{package_base}pure', 1113s {h_off} 'hybrid': '{package_base}hybrid', 1113s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 1113s {c_off} 'cmake': '{package_base}cmake', 1113s }} 1113s ) 1113s """.format( 1113s cmake_source_dir=cmake_source_dir, 1113s cmake_install_dir=package_base, 1113s package_base=package_base_dir, 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s p_off="" if has_pure_package else "#", 1113s pm_off="" if has_pure_module else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s src_dir = tmp_dir.ensure(package_base, dir=1) 1113s 1113s src_dir.join("CMakeLists.txt").write( 1113s textwrap.dedent( 1113s """ 1113s cmake_minimum_required(VERSION 3.5.0) 1113s project(hybrid NONE) 1113s set(build_dir ${{CMAKE_BINARY_DIR}}) 1113s 1113s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 1113s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 1113s {c_off} install( 1113s {c_off} FILES 1113s {c_off} ${{build_dir}}/__init__.py 1113s {c_off} ${{build_dir}}/cmake.py 1113s {c_off} DESTINATION cmake 1113s {c_off} ) 1113s 1113s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 1113s {cm_off} install( 1113s {cm_off} FILES ${{build_dir}}/cmakeModule.py 1113s {cm_off} DESTINATION .) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 1113s {h_off} DESTINATION hybrid/data) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 1113s {h_off} DESTINATION hybrid/hybrid_2) 1113s 1113s install(CODE "message(STATUS \\\"Installation complete\\\")") 1113s """.format( 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 1113s path_types: Sequence[str] 1113s try: 1113s path_types = next( 1113s iter( 1113s zip( 1113s *filter( 1113s lambda i: i[1], 1113s [ 1113s ("c", has_cmake_package), 1113s ("cm", has_cmake_module), 1113s ("h", has_hybrid_package), 1113s ("p", has_pure_package), 1113s ("pm", has_pure_module), 1113s ], 1113s ) 1113s ) 1113s ) 1113s ) 1113s except StopIteration: 1113s path_types = [] 1113s 1113s def select_paths(annotated_paths): 1113s """Return a filtered list paths considering ``path_types``. 1113s 1113s `annotated_paths`` is list of tuple ``(type, path)`` where type 1113s is either `c`, 'cm', `h`, `p` or 'pm'. 1113s 1113s """ 1113s return filter(lambda i: i[0] in path_types, annotated_paths) 1113s 1113s # Commented paths are the one expected to be installed by CMake. For 1113s # this reason, corresponding files should NOT be created in the source 1113s # tree. 1113s for _type, path in select_paths( 1113s [ 1113s # ('c', 'cmake/__init__.py'), 1113s # ('c', 'cmake/cmake.py'), 1113s # ('cm', 'cmakeModule.py'), 1113s ("h", "hybrid/__init__.py"), 1113s # ('h', 'hybrid/hybrid_cmake.dat'), 1113s # ('h', 'hybrid/hybrid_cmake.py'), 1113s ("h", "hybrid/hybrid_pure.dat"), 1113s ("h", "hybrid/hybrid_pure.py"), 1113s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 1113s ("h", "hybrid/data/hybrid_data_pure.dat"), 1113s ("h", "hybrid/hybrid_2/__init__.py"), 1113s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 1113s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 1113s ("p", "hybrid/hybrid_2_pure/__init__.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 1113s ("pm", "pureModule.py"), 1113s ("p", "pure/__init__.py"), 1113s ("p", "pure/pure.py"), 1113s ("p", "pure/data/pure.dat"), 1113s ] 1113s ): 1113s assert _type in {"p", "pm", "h"} 1113s root = package_base if _type in {"p", "pm"} else cmake_source_dir 1113s tmp_dir.ensure(os.path.join(root, path)) 1113s 1113s # Do not call the real setup function. Instead, replace it with 1113s # a MagicMock allowing to check with which arguments it was invoked. 1113s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 1113s 1113s # Convenience print function 1113s def _pprint(desc, value=None): 1113s print( 1113s "-----------------\n" 1113s f"{desc}:\n" 1113s "\n" 1113s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 1113s ) 1113s 1113s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 1113s 1113s _pprint = ._pprint at 0xf72623facfe0> 1113s _type = 'pm' 1113s cmake_source_dir = 'to/the/base' 1113s has_cmake_module = 0 1113s has_cmake_package = 0 1113s has_hybrid_package = 0 1113s has_pure_module = 1 1113s has_pure_package = 0 1113s mock_setup = 1113s mocker = 1113s package_base = 'to/the/base' 1113s package_base_dir = 'to/the/base/' 1113s path = 'pureModule.py' 1113s path_types = ('pm',) 1113s root = 'to/the/base' 1113s select_paths = .select_paths at 0xf72624161bc0> 1113s src_dir = local('/tmp/pytest-of-ubuntu/pytest-130/test_setup_inputs0/to/the/base') 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-130/test_setup_inputs0') 1113s with_package_base = 1 1113s 1113s tests/test_setup.py:849: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-130/test_setup_inputs0') 1113s setup_args = ['build'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-130/test_setup_inputs0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ________________________ test_setup_inputs[1-1-0-1-0-0] ________________________ 1113s 1113s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 1 1113s has_pure_package = 0, has_pure_module = 1, with_package_base = 1 1113s mocker = 1113s 1113s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 1113s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 1113s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_module", [0, 1]) 1113s @pytest.mark.parametrize("with_package_base", [0, 1]) 1113s def test_setup_inputs( 1113s has_cmake_package, 1113s has_cmake_module, 1113s has_hybrid_package, 1113s has_pure_package, 1113s has_pure_module, 1113s with_package_base, 1113s mocker, 1113s ): 1113s """This test that a project can have a package with some modules 1113s installed using setup.py and some other modules installed using CMake. 1113s """ 1113s 1113s tmp_dir = _tmpdir("test_setup_inputs") 1113s 1113s package_base = "to/the/base" if with_package_base else "" 1113s package_base_dir = package_base + "/" if package_base else "" 1113s cmake_source_dir = package_base 1113s 1113s if cmake_source_dir and (has_cmake_package or has_cmake_module): 1113s pytest.skip( 1113s "unsupported configuration: " 1113s "python package fully generated by CMake does *NOT* work. " 1113s "At least __init__.py should be in the project source tree" 1113s ) 1113s 1113s # ------------------------------------------------------------------------- 1113s # Here is the "SOURCE" tree layout: 1113s # 1113s # ROOT/ 1113s # 1113s # setup.py 1113s # 1113s # [/] 1113s # 1113s # pureModule.py 1113s # 1113s # pure/ 1113s # __init__.py 1113s # pure.py 1113s # 1113s # data/ 1113s # pure.dat 1113s # 1113s # [/] 1113s # 1113s # hybrid/ 1113s # CMakeLists.txt 1113s # __init__.py 1113s # hybrid_pure.dat 1113s # hybrid_pure.py 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat 1113s # 1113s # hybrid_2/ 1113s # __init__.py 1113s # hybrid_2_pure.py 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py 1113s # hybrid_2_pure_1.py 1113s # hybrid_2_pure_2.py 1113s # 1113s # 1113s # ------------------------------------------------------------------------- 1113s # and here is the "BINARY" distribution layout: 1113s # 1113s # The comment "CMake" or "Setuptools" indicates which tool is responsible 1113s # for placing the file in the tree used to create the binary distribution. 1113s # 1113s # ROOT/ 1113s # 1113s # cmakeModule.py # CMake 1113s # 1113s # cmake/ 1113s # __init__.py # CMake 1113s # cmake.py # CMake 1113s # 1113s # hybrid/ 1113s # hybrid_cmake.dat # CMake 1113s # hybrid_cmake.py # CMake 1113s # hybrid_pure.dat # Setuptools 1113s # hybrid_pure.py # Setuptools 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat # CMake or Setuptools 1113s # hybrid_data_cmake.dat # CMake *NO TEST* 1113s # 1113s # hybrid_2/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure.py # CMake or Setuptools 1113s # hybrid_2_cmake.py # CMake 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure_1.py # CMake or Setuptools 1113s # hybrid_2_pure_2.py # CMake or Setuptools 1113s # 1113s # pureModule.py # Setuptools 1113s # 1113s # pure/ 1113s # __init__.py # Setuptools 1113s # pure.py # Setuptools 1113s # 1113s # data/ 1113s # pure.dat # Setuptools 1113s 1113s tmp_dir.join("setup.py").write( 1113s textwrap.dedent( 1113s """ 1113s from skbuild import setup 1113s #from setuptools import setup 1113s setup( 1113s name="test_hybrid_project", 1113s version="1.2.3", 1113s description=("an hybrid package mixing files installed by both " 1113s "CMake and setuptools"), 1113s author='The scikit-build team', 1113s license="MIT", 1113s cmake_source_dir='{cmake_source_dir}', 1113s cmake_install_dir='{cmake_install_dir}', 1113s # Arbitrary order of packages 1113s packages=[ 1113s {p_off} 'pure', 1113s {h_off} 'hybrid.hybrid_2', 1113s {h_off} 'hybrid', 1113s {c_off} 'cmake', 1113s {p_off} 'hybrid.hybrid_2_pure', 1113s ], 1113s py_modules=[ 1113s {pm_off} '{package_base}pureModule', 1113s {cm_off} '{package_base}cmakeModule', 1113s ], 1113s package_data={{ 1113s {p_off} 'pure': ['data/pure.dat'], 1113s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 1113s }}, 1113s # Arbitrary order of package_dir 1113s package_dir = {{ 1113s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 1113s {p_off} 'pure': '{package_base}pure', 1113s {h_off} 'hybrid': '{package_base}hybrid', 1113s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 1113s {c_off} 'cmake': '{package_base}cmake', 1113s }} 1113s ) 1113s """.format( 1113s cmake_source_dir=cmake_source_dir, 1113s cmake_install_dir=package_base, 1113s package_base=package_base_dir, 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s p_off="" if has_pure_package else "#", 1113s pm_off="" if has_pure_module else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s src_dir = tmp_dir.ensure(package_base, dir=1) 1113s 1113s src_dir.join("CMakeLists.txt").write( 1113s textwrap.dedent( 1113s """ 1113s cmake_minimum_required(VERSION 3.5.0) 1113s project(hybrid NONE) 1113s set(build_dir ${{CMAKE_BINARY_DIR}}) 1113s 1113s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 1113s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 1113s {c_off} install( 1113s {c_off} FILES 1113s {c_off} ${{build_dir}}/__init__.py 1113s {c_off} ${{build_dir}}/cmake.py 1113s {c_off} DESTINATION cmake 1113s {c_off} ) 1113s 1113s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 1113s {cm_off} install( 1113s {cm_off} FILES ${{build_dir}}/cmakeModule.py 1113s {cm_off} DESTINATION .) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 1113s {h_off} DESTINATION hybrid/data) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 1113s {h_off} DESTINATION hybrid/hybrid_2) 1113s 1113s install(CODE "message(STATUS \\\"Installation complete\\\")") 1113s """.format( 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 1113s path_types: Sequence[str] 1113s try: 1113s path_types = next( 1113s iter( 1113s zip( 1113s *filter( 1113s lambda i: i[1], 1113s [ 1113s ("c", has_cmake_package), 1113s ("cm", has_cmake_module), 1113s ("h", has_hybrid_package), 1113s ("p", has_pure_package), 1113s ("pm", has_pure_module), 1113s ], 1113s ) 1113s ) 1113s ) 1113s ) 1113s except StopIteration: 1113s path_types = [] 1113s 1113s def select_paths(annotated_paths): 1113s """Return a filtered list paths considering ``path_types``. 1113s 1113s `annotated_paths`` is list of tuple ``(type, path)`` where type 1113s is either `c`, 'cm', `h`, `p` or 'pm'. 1113s 1113s """ 1113s return filter(lambda i: i[0] in path_types, annotated_paths) 1113s 1113s # Commented paths are the one expected to be installed by CMake. For 1113s # this reason, corresponding files should NOT be created in the source 1113s # tree. 1113s for _type, path in select_paths( 1113s [ 1113s # ('c', 'cmake/__init__.py'), 1113s # ('c', 'cmake/cmake.py'), 1113s # ('cm', 'cmakeModule.py'), 1113s ("h", "hybrid/__init__.py"), 1113s # ('h', 'hybrid/hybrid_cmake.dat'), 1113s # ('h', 'hybrid/hybrid_cmake.py'), 1113s ("h", "hybrid/hybrid_pure.dat"), 1113s ("h", "hybrid/hybrid_pure.py"), 1113s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 1113s ("h", "hybrid/data/hybrid_data_pure.dat"), 1113s ("h", "hybrid/hybrid_2/__init__.py"), 1113s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 1113s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 1113s ("p", "hybrid/hybrid_2_pure/__init__.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 1113s ("pm", "pureModule.py"), 1113s ("p", "pure/__init__.py"), 1113s ("p", "pure/pure.py"), 1113s ("p", "pure/data/pure.dat"), 1113s ] 1113s ): 1113s assert _type in {"p", "pm", "h"} 1113s root = package_base if _type in {"p", "pm"} else cmake_source_dir 1113s tmp_dir.ensure(os.path.join(root, path)) 1113s 1113s # Do not call the real setup function. Instead, replace it with 1113s # a MagicMock allowing to check with which arguments it was invoked. 1113s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 1113s 1113s # Convenience print function 1113s def _pprint(desc, value=None): 1113s print( 1113s "-----------------\n" 1113s f"{desc}:\n" 1113s "\n" 1113s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 1113s ) 1113s 1113s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 1113s 1113s _pprint = ._pprint at 0xf72623fac680> 1113s _type = 'pm' 1113s cmake_source_dir = 'to/the/base' 1113s has_cmake_module = 0 1113s has_cmake_package = 0 1113s has_hybrid_package = 1 1113s has_pure_module = 1 1113s has_pure_package = 0 1113s mock_setup = 1113s mocker = 1113s package_base = 'to/the/base' 1113s package_base_dir = 'to/the/base/' 1113s path = 'pureModule.py' 1113s path_types = ('h', 'pm') 1113s root = 'to/the/base' 1113s select_paths = .select_paths at 0xf72623faca40> 1113s src_dir = local('/tmp/pytest-of-ubuntu/pytest-134/test_setup_inputs0/to/the/base') 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-134/test_setup_inputs0') 1113s with_package_base = 1 1113s 1113s tests/test_setup.py:849: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-134/test_setup_inputs0') 1113s setup_args = ['build'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-134/test_setup_inputs0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ________________________ test_setup_inputs[1-1-1-0-0-0] ________________________ 1113s 1113s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 0 1113s has_pure_package = 1, has_pure_module = 1, with_package_base = 1 1113s mocker = 1113s 1113s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 1113s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 1113s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_module", [0, 1]) 1113s @pytest.mark.parametrize("with_package_base", [0, 1]) 1113s def test_setup_inputs( 1113s has_cmake_package, 1113s has_cmake_module, 1113s has_hybrid_package, 1113s has_pure_package, 1113s has_pure_module, 1113s with_package_base, 1113s mocker, 1113s ): 1113s """This test that a project can have a package with some modules 1113s installed using setup.py and some other modules installed using CMake. 1113s """ 1113s 1113s tmp_dir = _tmpdir("test_setup_inputs") 1113s 1113s package_base = "to/the/base" if with_package_base else "" 1113s package_base_dir = package_base + "/" if package_base else "" 1113s cmake_source_dir = package_base 1113s 1113s if cmake_source_dir and (has_cmake_package or has_cmake_module): 1113s pytest.skip( 1113s "unsupported configuration: " 1113s "python package fully generated by CMake does *NOT* work. " 1113s "At least __init__.py should be in the project source tree" 1113s ) 1113s 1113s # ------------------------------------------------------------------------- 1113s # Here is the "SOURCE" tree layout: 1113s # 1113s # ROOT/ 1113s # 1113s # setup.py 1113s # 1113s # [/] 1113s # 1113s # pureModule.py 1113s # 1113s # pure/ 1113s # __init__.py 1113s # pure.py 1113s # 1113s # data/ 1113s # pure.dat 1113s # 1113s # [/] 1113s # 1113s # hybrid/ 1113s # CMakeLists.txt 1113s # __init__.py 1113s # hybrid_pure.dat 1113s # hybrid_pure.py 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat 1113s # 1113s # hybrid_2/ 1113s # __init__.py 1113s # hybrid_2_pure.py 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py 1113s # hybrid_2_pure_1.py 1113s # hybrid_2_pure_2.py 1113s # 1113s # 1113s # ------------------------------------------------------------------------- 1113s # and here is the "BINARY" distribution layout: 1113s # 1113s # The comment "CMake" or "Setuptools" indicates which tool is responsible 1113s # for placing the file in the tree used to create the binary distribution. 1113s # 1113s # ROOT/ 1113s # 1113s # cmakeModule.py # CMake 1113s # 1113s # cmake/ 1113s # __init__.py # CMake 1113s # cmake.py # CMake 1113s # 1113s # hybrid/ 1113s # hybrid_cmake.dat # CMake 1113s # hybrid_cmake.py # CMake 1113s # hybrid_pure.dat # Setuptools 1113s # hybrid_pure.py # Setuptools 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat # CMake or Setuptools 1113s # hybrid_data_cmake.dat # CMake *NO TEST* 1113s # 1113s # hybrid_2/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure.py # CMake or Setuptools 1113s # hybrid_2_cmake.py # CMake 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure_1.py # CMake or Setuptools 1113s # hybrid_2_pure_2.py # CMake or Setuptools 1113s # 1113s # pureModule.py # Setuptools 1113s # 1113s # pure/ 1113s # __init__.py # Setuptools 1113s # pure.py # Setuptools 1113s # 1113s # data/ 1113s # pure.dat # Setuptools 1113s 1113s tmp_dir.join("setup.py").write( 1113s textwrap.dedent( 1113s """ 1113s from skbuild import setup 1113s #from setuptools import setup 1113s setup( 1113s name="test_hybrid_project", 1113s version="1.2.3", 1113s description=("an hybrid package mixing files installed by both " 1113s "CMake and setuptools"), 1113s author='The scikit-build team', 1113s license="MIT", 1113s cmake_source_dir='{cmake_source_dir}', 1113s cmake_install_dir='{cmake_install_dir}', 1113s # Arbitrary order of packages 1113s packages=[ 1113s {p_off} 'pure', 1113s {h_off} 'hybrid.hybrid_2', 1113s {h_off} 'hybrid', 1113s {c_off} 'cmake', 1113s {p_off} 'hybrid.hybrid_2_pure', 1113s ], 1113s py_modules=[ 1113s {pm_off} '{package_base}pureModule', 1113s {cm_off} '{package_base}cmakeModule', 1113s ], 1113s package_data={{ 1113s {p_off} 'pure': ['data/pure.dat'], 1113s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 1113s }}, 1113s # Arbitrary order of package_dir 1113s package_dir = {{ 1113s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 1113s {p_off} 'pure': '{package_base}pure', 1113s {h_off} 'hybrid': '{package_base}hybrid', 1113s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 1113s {c_off} 'cmake': '{package_base}cmake', 1113s }} 1113s ) 1113s """.format( 1113s cmake_source_dir=cmake_source_dir, 1113s cmake_install_dir=package_base, 1113s package_base=package_base_dir, 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s p_off="" if has_pure_package else "#", 1113s pm_off="" if has_pure_module else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s src_dir = tmp_dir.ensure(package_base, dir=1) 1113s 1113s src_dir.join("CMakeLists.txt").write( 1113s textwrap.dedent( 1113s """ 1113s cmake_minimum_required(VERSION 3.5.0) 1113s project(hybrid NONE) 1113s set(build_dir ${{CMAKE_BINARY_DIR}}) 1113s 1113s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 1113s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 1113s {c_off} install( 1113s {c_off} FILES 1113s {c_off} ${{build_dir}}/__init__.py 1113s {c_off} ${{build_dir}}/cmake.py 1113s {c_off} DESTINATION cmake 1113s {c_off} ) 1113s 1113s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 1113s {cm_off} install( 1113s {cm_off} FILES ${{build_dir}}/cmakeModule.py 1113s {cm_off} DESTINATION .) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 1113s {h_off} DESTINATION hybrid/data) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 1113s {h_off} DESTINATION hybrid/hybrid_2) 1113s 1113s install(CODE "message(STATUS \\\"Installation complete\\\")") 1113s """.format( 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 1113s path_types: Sequence[str] 1113s try: 1113s path_types = next( 1113s iter( 1113s zip( 1113s *filter( 1113s lambda i: i[1], 1113s [ 1113s ("c", has_cmake_package), 1113s ("cm", has_cmake_module), 1113s ("h", has_hybrid_package), 1113s ("p", has_pure_package), 1113s ("pm", has_pure_module), 1113s ], 1113s ) 1113s ) 1113s ) 1113s ) 1113s except StopIteration: 1113s path_types = [] 1113s 1113s def select_paths(annotated_paths): 1113s """Return a filtered list paths considering ``path_types``. 1113s 1113s `annotated_paths`` is list of tuple ``(type, path)`` where type 1113s is either `c`, 'cm', `h`, `p` or 'pm'. 1113s 1113s """ 1113s return filter(lambda i: i[0] in path_types, annotated_paths) 1113s 1113s # Commented paths are the one expected to be installed by CMake. For 1113s # this reason, corresponding files should NOT be created in the source 1113s # tree. 1113s for _type, path in select_paths( 1113s [ 1113s # ('c', 'cmake/__init__.py'), 1113s # ('c', 'cmake/cmake.py'), 1113s # ('cm', 'cmakeModule.py'), 1113s ("h", "hybrid/__init__.py"), 1113s # ('h', 'hybrid/hybrid_cmake.dat'), 1113s # ('h', 'hybrid/hybrid_cmake.py'), 1113s ("h", "hybrid/hybrid_pure.dat"), 1113s ("h", "hybrid/hybrid_pure.py"), 1113s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 1113s ("h", "hybrid/data/hybrid_data_pure.dat"), 1113s ("h", "hybrid/hybrid_2/__init__.py"), 1113s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 1113s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 1113s ("p", "hybrid/hybrid_2_pure/__init__.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 1113s ("pm", "pureModule.py"), 1113s ("p", "pure/__init__.py"), 1113s ("p", "pure/pure.py"), 1113s ("p", "pure/data/pure.dat"), 1113s ] 1113s ): 1113s assert _type in {"p", "pm", "h"} 1113s root = package_base if _type in {"p", "pm"} else cmake_source_dir 1113s tmp_dir.ensure(os.path.join(root, path)) 1113s 1113s # Do not call the real setup function. Instead, replace it with 1113s # a MagicMock allowing to check with which arguments it was invoked. 1113s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 1113s 1113s # Convenience print function 1113s def _pprint(desc, value=None): 1113s print( 1113s "-----------------\n" 1113s f"{desc}:\n" 1113s "\n" 1113s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 1113s ) 1113s 1113s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 1113s 1113s _pprint = ._pprint at 0xf72623fae5c0> 1113s _type = 'p' 1113s cmake_source_dir = 'to/the/base' 1113s has_cmake_module = 0 1113s has_cmake_package = 0 1113s has_hybrid_package = 0 1113s has_pure_module = 1 1113s has_pure_package = 1 1113s mock_setup = 1113s mocker = 1113s package_base = 'to/the/base' 1113s package_base_dir = 'to/the/base/' 1113s path = 'pure/data/pure.dat' 1113s path_types = ('p', 'pm') 1113s root = 'to/the/base' 1113s select_paths = .select_paths at 0xf72623fae340> 1113s src_dir = local('/tmp/pytest-of-ubuntu/pytest-138/test_setup_inputs0/to/the/base') 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-138/test_setup_inputs0') 1113s with_package_base = 1 1113s 1113s tests/test_setup.py:849: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-138/test_setup_inputs0') 1113s setup_args = ['build'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-138/test_setup_inputs0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ________________________ test_setup_inputs[1-1-1-1-0-0] ________________________ 1113s 1113s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 1 1113s has_pure_package = 1, has_pure_module = 1, with_package_base = 1 1113s mocker = 1113s 1113s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 1113s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 1113s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_package", [0, 1]) 1113s @pytest.mark.parametrize("has_pure_module", [0, 1]) 1113s @pytest.mark.parametrize("with_package_base", [0, 1]) 1113s def test_setup_inputs( 1113s has_cmake_package, 1113s has_cmake_module, 1113s has_hybrid_package, 1113s has_pure_package, 1113s has_pure_module, 1113s with_package_base, 1113s mocker, 1113s ): 1113s """This test that a project can have a package with some modules 1113s installed using setup.py and some other modules installed using CMake. 1113s """ 1113s 1113s tmp_dir = _tmpdir("test_setup_inputs") 1113s 1113s package_base = "to/the/base" if with_package_base else "" 1113s package_base_dir = package_base + "/" if package_base else "" 1113s cmake_source_dir = package_base 1113s 1113s if cmake_source_dir and (has_cmake_package or has_cmake_module): 1113s pytest.skip( 1113s "unsupported configuration: " 1113s "python package fully generated by CMake does *NOT* work. " 1113s "At least __init__.py should be in the project source tree" 1113s ) 1113s 1113s # ------------------------------------------------------------------------- 1113s # Here is the "SOURCE" tree layout: 1113s # 1113s # ROOT/ 1113s # 1113s # setup.py 1113s # 1113s # [/] 1113s # 1113s # pureModule.py 1113s # 1113s # pure/ 1113s # __init__.py 1113s # pure.py 1113s # 1113s # data/ 1113s # pure.dat 1113s # 1113s # [/] 1113s # 1113s # hybrid/ 1113s # CMakeLists.txt 1113s # __init__.py 1113s # hybrid_pure.dat 1113s # hybrid_pure.py 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat 1113s # 1113s # hybrid_2/ 1113s # __init__.py 1113s # hybrid_2_pure.py 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py 1113s # hybrid_2_pure_1.py 1113s # hybrid_2_pure_2.py 1113s # 1113s # 1113s # ------------------------------------------------------------------------- 1113s # and here is the "BINARY" distribution layout: 1113s # 1113s # The comment "CMake" or "Setuptools" indicates which tool is responsible 1113s # for placing the file in the tree used to create the binary distribution. 1113s # 1113s # ROOT/ 1113s # 1113s # cmakeModule.py # CMake 1113s # 1113s # cmake/ 1113s # __init__.py # CMake 1113s # cmake.py # CMake 1113s # 1113s # hybrid/ 1113s # hybrid_cmake.dat # CMake 1113s # hybrid_cmake.py # CMake 1113s # hybrid_pure.dat # Setuptools 1113s # hybrid_pure.py # Setuptools 1113s # 1113s # data/ 1113s # hybrid_data_pure.dat # CMake or Setuptools 1113s # hybrid_data_cmake.dat # CMake *NO TEST* 1113s # 1113s # hybrid_2/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure.py # CMake or Setuptools 1113s # hybrid_2_cmake.py # CMake 1113s # 1113s # hybrid_2_pure/ 1113s # __init__.py # CMake or Setuptools 1113s # hybrid_2_pure_1.py # CMake or Setuptools 1113s # hybrid_2_pure_2.py # CMake or Setuptools 1113s # 1113s # pureModule.py # Setuptools 1113s # 1113s # pure/ 1113s # __init__.py # Setuptools 1113s # pure.py # Setuptools 1113s # 1113s # data/ 1113s # pure.dat # Setuptools 1113s 1113s tmp_dir.join("setup.py").write( 1113s textwrap.dedent( 1113s """ 1113s from skbuild import setup 1113s #from setuptools import setup 1113s setup( 1113s name="test_hybrid_project", 1113s version="1.2.3", 1113s description=("an hybrid package mixing files installed by both " 1113s "CMake and setuptools"), 1113s author='The scikit-build team', 1113s license="MIT", 1113s cmake_source_dir='{cmake_source_dir}', 1113s cmake_install_dir='{cmake_install_dir}', 1113s # Arbitrary order of packages 1113s packages=[ 1113s {p_off} 'pure', 1113s {h_off} 'hybrid.hybrid_2', 1113s {h_off} 'hybrid', 1113s {c_off} 'cmake', 1113s {p_off} 'hybrid.hybrid_2_pure', 1113s ], 1113s py_modules=[ 1113s {pm_off} '{package_base}pureModule', 1113s {cm_off} '{package_base}cmakeModule', 1113s ], 1113s package_data={{ 1113s {p_off} 'pure': ['data/pure.dat'], 1113s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 1113s }}, 1113s # Arbitrary order of package_dir 1113s package_dir = {{ 1113s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 1113s {p_off} 'pure': '{package_base}pure', 1113s {h_off} 'hybrid': '{package_base}hybrid', 1113s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 1113s {c_off} 'cmake': '{package_base}cmake', 1113s }} 1113s ) 1113s """.format( 1113s cmake_source_dir=cmake_source_dir, 1113s cmake_install_dir=package_base, 1113s package_base=package_base_dir, 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s p_off="" if has_pure_package else "#", 1113s pm_off="" if has_pure_module else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s src_dir = tmp_dir.ensure(package_base, dir=1) 1113s 1113s src_dir.join("CMakeLists.txt").write( 1113s textwrap.dedent( 1113s """ 1113s cmake_minimum_required(VERSION 3.5.0) 1113s project(hybrid NONE) 1113s set(build_dir ${{CMAKE_BINARY_DIR}}) 1113s 1113s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 1113s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 1113s {c_off} install( 1113s {c_off} FILES 1113s {c_off} ${{build_dir}}/__init__.py 1113s {c_off} ${{build_dir}}/cmake.py 1113s {c_off} DESTINATION cmake 1113s {c_off} ) 1113s 1113s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 1113s {cm_off} install( 1113s {cm_off} FILES ${{build_dir}}/cmakeModule.py 1113s {cm_off} DESTINATION .) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 1113s {h_off} DESTINATION hybrid) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 1113s {h_off} DESTINATION hybrid/data) 1113s 1113s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 1113s {h_off} install( 1113s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 1113s {h_off} DESTINATION hybrid/hybrid_2) 1113s 1113s install(CODE "message(STATUS \\\"Installation complete\\\")") 1113s """.format( 1113s c_off="" if has_cmake_package else "#", 1113s cm_off="" if has_cmake_module else "#", 1113s h_off="" if has_hybrid_package else "#", 1113s ) 1113s ) 1113s ) 1113s 1113s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 1113s path_types: Sequence[str] 1113s try: 1113s path_types = next( 1113s iter( 1113s zip( 1113s *filter( 1113s lambda i: i[1], 1113s [ 1113s ("c", has_cmake_package), 1113s ("cm", has_cmake_module), 1113s ("h", has_hybrid_package), 1113s ("p", has_pure_package), 1113s ("pm", has_pure_module), 1113s ], 1113s ) 1113s ) 1113s ) 1113s ) 1113s except StopIteration: 1113s path_types = [] 1113s 1113s def select_paths(annotated_paths): 1113s """Return a filtered list paths considering ``path_types``. 1113s 1113s `annotated_paths`` is list of tuple ``(type, path)`` where type 1113s is either `c`, 'cm', `h`, `p` or 'pm'. 1113s 1113s """ 1113s return filter(lambda i: i[0] in path_types, annotated_paths) 1113s 1113s # Commented paths are the one expected to be installed by CMake. For 1113s # this reason, corresponding files should NOT be created in the source 1113s # tree. 1113s for _type, path in select_paths( 1113s [ 1113s # ('c', 'cmake/__init__.py'), 1113s # ('c', 'cmake/cmake.py'), 1113s # ('cm', 'cmakeModule.py'), 1113s ("h", "hybrid/__init__.py"), 1113s # ('h', 'hybrid/hybrid_cmake.dat'), 1113s # ('h', 'hybrid/hybrid_cmake.py'), 1113s ("h", "hybrid/hybrid_pure.dat"), 1113s ("h", "hybrid/hybrid_pure.py"), 1113s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 1113s ("h", "hybrid/data/hybrid_data_pure.dat"), 1113s ("h", "hybrid/hybrid_2/__init__.py"), 1113s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 1113s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 1113s ("p", "hybrid/hybrid_2_pure/__init__.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 1113s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 1113s ("pm", "pureModule.py"), 1113s ("p", "pure/__init__.py"), 1113s ("p", "pure/pure.py"), 1113s ("p", "pure/data/pure.dat"), 1113s ] 1113s ): 1113s assert _type in {"p", "pm", "h"} 1113s root = package_base if _type in {"p", "pm"} else cmake_source_dir 1113s tmp_dir.ensure(os.path.join(root, path)) 1113s 1113s # Do not call the real setup function. Instead, replace it with 1113s # a MagicMock allowing to check with which arguments it was invoked. 1113s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 1113s 1113s # Convenience print function 1113s def _pprint(desc, value=None): 1113s print( 1113s "-----------------\n" 1113s f"{desc}:\n" 1113s "\n" 1113s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 1113s ) 1113s 1113s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 1113s 1113s _pprint = ._pprint at 0xf72623facf40> 1113s _type = 'p' 1113s cmake_source_dir = 'to/the/base' 1113s has_cmake_module = 0 1113s has_cmake_package = 0 1113s has_hybrid_package = 1 1113s has_pure_module = 1 1113s has_pure_package = 1 1113s mock_setup = 1113s mocker = 1113s package_base = 'to/the/base' 1113s package_base_dir = 'to/the/base/' 1113s path = 'pure/data/pure.dat' 1113s path_types = ('h', 'p', 'pm') 1113s root = 'to/the/base' 1113s select_paths = .select_paths at 0xf72623fadee0> 1113s src_dir = local('/tmp/pytest-of-ubuntu/pytest-142/test_setup_inputs0/to/the/base') 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-142/test_setup_inputs0') 1113s with_package_base = 1 1113s 1113s tests/test_setup.py:849: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-142/test_setup_inputs0') 1113s setup_args = ['build'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-142/test_setup_inputs0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ___________________ test_cmake_install_into_pure_package[0] ____________________ 1113s 1113s with_cmake_source_dir = 0 1113s capsys = <_pytest.capture.CaptureFixture object at 0xf72623f87ad0> 1113s caplog = <_pytest.logging.LogCaptureFixture object at 0xf72623f876b0> 1113s 1113s @pytest.mark.parametrize("with_cmake_source_dir", [0, 1]) 1113s def test_cmake_install_into_pure_package(with_cmake_source_dir, capsys, caplog): 1113s # ------------------------------------------------------------------------- 1113s # "SOURCE" tree layout: 1113s # 1113s # (1) with_cmake_source_dir == 0 1113s # 1113s # ROOT/ 1113s # 1113s # CMakeLists.txt 1113s # setup.py 1113s # 1113s # fruits/ 1113s # __init__.py 1113s # 1113s # 1113s # (2) with_cmake_source_dir == 1 1113s # 1113s # ROOT/ 1113s # 1113s # setup.py 1113s # 1113s # fruits/ 1113s # __init__.py 1113s # 1113s # src/ 1113s # 1113s # CMakeLists.txt 1113s # 1113s # ------------------------------------------------------------------------- 1113s # "BINARY" distribution layout: 1113s # 1113s # ROOT/ 1113s # 1113s # fruits/ 1113s # 1113s # __init__.py 1113s # apple.py 1113s # banana.py 1113s # 1113s # data/ 1113s # 1113s # apple.dat 1113s # banana.dat 1113s # 1113s 1113s tmp_dir = _tmpdir("cmake_install_into_pure_package") 1113s 1113s cmake_source_dir = "src" if with_cmake_source_dir else "" 1113s 1113s tmp_dir.join("setup.py").write( 1113s textwrap.dedent( 1113s f""" 1113s from skbuild import setup 1113s setup( 1113s name="test_py_modules_keyword", 1113s version="1.2.3", 1113s description="a package testing use of py_modules keyword", 1113s author='The scikit-build team', 1113s license="MIT", 1113s packages=['fruits'], 1113s cmake_install_dir='fruits', 1113s cmake_source_dir='{cmake_source_dir}', 1113s ) 1113s """ 1113s ) 1113s ) 1113s 1113s cmake_src_dir = tmp_dir.ensure(cmake_source_dir, dir=1) 1113s cmake_src_dir.join("CMakeLists.txt").write( 1113s textwrap.dedent( 1113s """ 1113s cmake_minimum_required(VERSION 3.5.0) 1113s project(test NONE) 1113s file(WRITE "${CMAKE_BINARY_DIR}/apple.py" "# apple.py") 1113s file(WRITE "${CMAKE_BINARY_DIR}/banana.py" "# banana.py") 1113s install( 1113s FILES 1113s "${CMAKE_BINARY_DIR}/apple.py" 1113s "${CMAKE_BINARY_DIR}/banana.py" 1113s DESTINATION "." 1113s ) 1113s file(WRITE "${CMAKE_BINARY_DIR}/apple.dat" "# apple.dat") 1113s file(WRITE "${CMAKE_BINARY_DIR}/banana.dat" "# banana.dat") 1113s install( 1113s FILES 1113s "${CMAKE_BINARY_DIR}/apple.dat" 1113s "${CMAKE_BINARY_DIR}/banana.dat" 1113s DESTINATION "data" 1113s ) 1113s """ 1113s ) 1113s ) 1113s 1113s tmp_dir.ensure("fruits/__init__.py") 1113s 1113s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 1113s 1113s caplog = <_pytest.logging.LogCaptureFixture object at 0xf72623f876b0> 1113s capsys = <_pytest.capture.CaptureFixture object at 0xf72623f87ad0> 1113s cmake_source_dir = '' 1113s cmake_src_dir = local('/tmp/pytest-of-ubuntu/pytest-146/cmake_install_into_pure_packag0') 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-146/cmake_install_into_pure_packag0') 1113s with_cmake_source_dir = 0 1113s 1113s tests/test_setup.py:1031: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-146/cmake_install_into_pure_packag0') 1113s setup_args = ['build'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-146/cmake_install_into_pure_packag0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ___________________ test_cmake_install_into_pure_package[1] ____________________ 1113s 1113s with_cmake_source_dir = 1 1113s capsys = <_pytest.capture.CaptureFixture object at 0xf72624004f20> 1113s caplog = <_pytest.logging.LogCaptureFixture object at 0xf726240048c0> 1113s 1113s @pytest.mark.parametrize("with_cmake_source_dir", [0, 1]) 1113s def test_cmake_install_into_pure_package(with_cmake_source_dir, capsys, caplog): 1113s # ------------------------------------------------------------------------- 1113s # "SOURCE" tree layout: 1113s # 1113s # (1) with_cmake_source_dir == 0 1113s # 1113s # ROOT/ 1113s # 1113s # CMakeLists.txt 1113s # setup.py 1113s # 1113s # fruits/ 1113s # __init__.py 1113s # 1113s # 1113s # (2) with_cmake_source_dir == 1 1113s # 1113s # ROOT/ 1113s # 1113s # setup.py 1113s # 1113s # fruits/ 1113s # __init__.py 1113s # 1113s # src/ 1113s # 1113s # CMakeLists.txt 1113s # 1113s # ------------------------------------------------------------------------- 1113s # "BINARY" distribution layout: 1113s # 1113s # ROOT/ 1113s # 1113s # fruits/ 1113s # 1113s # __init__.py 1113s # apple.py 1113s # banana.py 1113s # 1113s # data/ 1113s # 1113s # apple.dat 1113s # banana.dat 1113s # 1113s 1113s tmp_dir = _tmpdir("cmake_install_into_pure_package") 1113s 1113s cmake_source_dir = "src" if with_cmake_source_dir else "" 1113s 1113s tmp_dir.join("setup.py").write( 1113s textwrap.dedent( 1113s f""" 1113s from skbuild import setup 1113s setup( 1113s name="test_py_modules_keyword", 1113s version="1.2.3", 1113s description="a package testing use of py_modules keyword", 1113s author='The scikit-build team', 1113s license="MIT", 1113s packages=['fruits'], 1113s cmake_install_dir='fruits', 1113s cmake_source_dir='{cmake_source_dir}', 1113s ) 1113s """ 1113s ) 1113s ) 1113s 1113s cmake_src_dir = tmp_dir.ensure(cmake_source_dir, dir=1) 1113s cmake_src_dir.join("CMakeLists.txt").write( 1113s textwrap.dedent( 1113s """ 1113s cmake_minimum_required(VERSION 3.5.0) 1113s project(test NONE) 1113s file(WRITE "${CMAKE_BINARY_DIR}/apple.py" "# apple.py") 1113s file(WRITE "${CMAKE_BINARY_DIR}/banana.py" "# banana.py") 1113s install( 1113s FILES 1113s "${CMAKE_BINARY_DIR}/apple.py" 1113s "${CMAKE_BINARY_DIR}/banana.py" 1113s DESTINATION "." 1113s ) 1113s file(WRITE "${CMAKE_BINARY_DIR}/apple.dat" "# apple.dat") 1113s file(WRITE "${CMAKE_BINARY_DIR}/banana.dat" "# banana.dat") 1113s install( 1113s FILES 1113s "${CMAKE_BINARY_DIR}/apple.dat" 1113s "${CMAKE_BINARY_DIR}/banana.dat" 1113s DESTINATION "data" 1113s ) 1113s """ 1113s ) 1113s ) 1113s 1113s tmp_dir.ensure("fruits/__init__.py") 1113s 1113s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 1113s 1113s caplog = <_pytest.logging.LogCaptureFixture object at 0xf726240048c0> 1113s capsys = <_pytest.capture.CaptureFixture object at 0xf72624004f20> 1113s cmake_source_dir = 'src' 1113s cmake_src_dir = local('/tmp/pytest-of-ubuntu/pytest-147/cmake_install_into_pure_packag0/src') 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-147/cmake_install_into_pure_packag0') 1113s with_cmake_source_dir = 1 1113s 1113s tests/test_setup.py:1031: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-147/cmake_install_into_pure_packag0') 1113s setup_args = ['build'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-147/cmake_install_into_pure_packag0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s _________________________ test_zip_safe_default[None] __________________________ 1113s 1113s zip_safe = None 1113s mocker = 1113s 1113s @pytest.mark.parametrize("zip_safe", [None, False, True]) 1113s def test_zip_safe_default(zip_safe, mocker): 1113s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 1113s 1113s tmp_dir = _tmpdir("zip_safe_default") 1113s 1113s setup_kwarg = "" 1113s if zip_safe is not None: 1113s setup_kwarg = f"zip_safe={zip_safe}" 1113s 1113s tmp_dir.join("setup.py").write( 1113s textwrap.dedent( 1113s f""" 1113s from skbuild import setup 1113s setup( 1113s name="zip_safe_default", 1113s version="1.2.3", 1113s description="a minimal example package", 1113s author='The scikit-build team', 1113s license="MIT", 1113s {setup_kwarg} 1113s ) 1113s """ 1113s ) 1113s ) 1113s tmp_dir.join("CMakeLists.txt").write( 1113s textwrap.dedent( 1113s """ 1113s cmake_minimum_required(VERSION 3.5.0) 1113s project(test NONE) 1113s install(CODE "execute_process( 1113s COMMAND \\${CMAKE_COMMAND} -E sleep 0)") 1113s """ 1113s ) 1113s ) 1113s 1113s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 1113s 1113s mock_setup = 1113s mocker = 1113s setup_kwarg = '' 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-148/zip_safe_default0') 1113s zip_safe = None 1113s 1113s tests/test_setup.py:1087: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-148/zip_safe_default0') 1113s setup_args = ['build'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-148/zip_safe_default0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s _________________________ test_zip_safe_default[False] _________________________ 1113s 1113s zip_safe = False 1113s mocker = 1113s 1113s @pytest.mark.parametrize("zip_safe", [None, False, True]) 1113s def test_zip_safe_default(zip_safe, mocker): 1113s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 1113s 1113s tmp_dir = _tmpdir("zip_safe_default") 1113s 1113s setup_kwarg = "" 1113s if zip_safe is not None: 1113s setup_kwarg = f"zip_safe={zip_safe}" 1113s 1113s tmp_dir.join("setup.py").write( 1113s textwrap.dedent( 1113s f""" 1113s from skbuild import setup 1113s setup( 1113s name="zip_safe_default", 1113s version="1.2.3", 1113s description="a minimal example package", 1113s author='The scikit-build team', 1113s license="MIT", 1113s {setup_kwarg} 1113s ) 1113s """ 1113s ) 1113s ) 1113s tmp_dir.join("CMakeLists.txt").write( 1113s textwrap.dedent( 1113s """ 1113s cmake_minimum_required(VERSION 3.5.0) 1113s project(test NONE) 1113s install(CODE "execute_process( 1113s COMMAND \\${CMAKE_COMMAND} -E sleep 0)") 1113s """ 1113s ) 1113s ) 1113s 1113s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 1113s 1113s mock_setup = 1113s mocker = 1113s setup_kwarg = 'zip_safe=False' 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-149/zip_safe_default0') 1113s zip_safe = False 1113s 1113s tests/test_setup.py:1087: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-149/zip_safe_default0') 1113s setup_args = ['build'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-149/zip_safe_default0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s _________________________ test_zip_safe_default[True] __________________________ 1113s 1113s zip_safe = True 1113s mocker = 1113s 1113s @pytest.mark.parametrize("zip_safe", [None, False, True]) 1113s def test_zip_safe_default(zip_safe, mocker): 1113s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 1113s 1113s tmp_dir = _tmpdir("zip_safe_default") 1113s 1113s setup_kwarg = "" 1113s if zip_safe is not None: 1113s setup_kwarg = f"zip_safe={zip_safe}" 1113s 1113s tmp_dir.join("setup.py").write( 1113s textwrap.dedent( 1113s f""" 1113s from skbuild import setup 1113s setup( 1113s name="zip_safe_default", 1113s version="1.2.3", 1113s description="a minimal example package", 1113s author='The scikit-build team', 1113s license="MIT", 1113s {setup_kwarg} 1113s ) 1113s """ 1113s ) 1113s ) 1113s tmp_dir.join("CMakeLists.txt").write( 1113s textwrap.dedent( 1113s """ 1113s cmake_minimum_required(VERSION 3.5.0) 1113s project(test NONE) 1113s install(CODE "execute_process( 1113s COMMAND \\${CMAKE_COMMAND} -E sleep 0)") 1113s """ 1113s ) 1113s ) 1113s 1113s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 1113s 1113s mock_setup = 1113s mocker = 1113s setup_kwarg = 'zip_safe=True' 1113s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-150/zip_safe_default0') 1113s zip_safe = True 1113s 1113s tests/test_setup.py:1087: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-150/zip_safe_default0') 1113s setup_args = ['build'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-150/zip_safe_default0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s _____________________ test_generator[Unix Makefiles-make] ______________________ 1113s 1113s generator = 'Unix Makefiles', expected_make_program = 'make' 1113s 1113s @pytest.mark.parametrize( 1113s ("generator", "expected_make_program"), [("NMake Makefiles", "nmake"), ("Unix Makefiles", "make")] 1113s ) 1113s def test_generator(generator, expected_make_program): 1113s generator_platform = {"NMake Makefiles": ["windows"], "Unix Makefiles": ["darwin", "linux"]} 1113s assert generator in generator_platform 1113s 1113s this_platform = platform.system().lower() 1113s if this_platform not in generator_platform[generator]: 1113s pytest.skip(f"{generator} generator is not available on {this_platform.title()}") 1113s 1113s if shutil.which(expected_make_program) is None: 1113s pytest.skip(f"{expected_make_program} not available") 1113s 1113s @project_setup_py_test("hello-cpp", ["build"], ret=True) 1113s def run_build(): 1113s pass 1113s 1113s with push_env(CMAKE_GENERATOR=generator): 1113s > tmp_dir = run_build()[0] 1113s 1113s expected_make_program = 'make' 1113s generator = 'Unix Makefiles' 1113s generator_platform = {'NMake Makefiles': ['windows'], 'Unix Makefiles': ['darwin', 'linux']} 1113s run_build = .run_build at 0xf72623fad9e0> 1113s this_platform = 'linux' 1113s 1113s tests/test_skbuild.py:94: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s tests/__init__.py:255: in wrapped 1113s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 1113s disable_languages_test = False 1113s fun = .run_build at 0xf72623fad580> 1113s iargs = () 1113s ikwargs = {} 1113s ret = True 1113s wrapped = .run_build at 0xf72623fad9e0> 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-151/run_build0') 1113s setup_args = ['build'], disable_languages_test = False 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = False 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-151/run_build0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ----------------------------- Captured stdout call ----------------------------- 1113s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-151/run_build0/.git/ 1113s [master (root-commit) 334f900] Initial commit 1113s 11 files changed, 115 insertions(+) 1113s create mode 100644 CMakeLists.txt 1113s create mode 100644 bonjour/__init__.py 1113s create mode 100644 bonjour/data/ciel.txt 1113s create mode 100644 bonjour/data/soleil.txt 1113s create mode 100644 bonjour/data/terre.txt 1113s create mode 100644 bonjourModule.py 1113s create mode 100644 hello/CMakeLists.txt 1113s create mode 100644 hello/__init__.py 1113s create mode 100644 hello/__main__.py 1113s create mode 100644 hello/_hello.cxx 1113s create mode 100644 setup.py 1113s ----------------------------- Captured stderr call ----------------------------- 1113s hint: Using 'master' as the name for the initial branch. This default branch name 1113s hint: is subject to change. To configure the initial branch name to use in all 1113s hint: of your new repositories, which will suppress this warning, call: 1113s hint: 1113s hint: git config --global init.defaultBranch 1113s hint: 1113s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 1113s hint: 'development'. The just-created branch can be renamed via this command: 1113s hint: 1113s hint: git branch -m 1113s ___________________ test_invalid_generator[generator_args0] ____________________ 1113s 1113s generator_args = ['-G', 'invalid'] 1113s 1113s @pytest.mark.parametrize( 1113s "generator_args", 1113s [ 1113s ["-G", "invalid"], 1113s ["--", "-G", "invalid"], 1113s ], 1113s ) 1113s def test_invalid_generator(generator_args): 1113s with push_dir(): 1113s build_args = ["build"] 1113s build_args.extend(generator_args) 1113s 1113s @project_setup_py_test("hello-no-language", build_args, disable_languages_test=True) 1113s def run(): 1113s pass 1113s 1113s failed = False 1113s message = "" 1113s try: 1113s > run() 1113s 1113s build_args = ['build', '-G', 'invalid'] 1113s failed = False 1113s generator_args = ['-G', 'invalid'] 1113s message = '' 1113s run = .run at 0xf72623faf380> 1113s 1113s tests/test_skbuild.py:121: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s tests/__init__.py:255: in wrapped 1113s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 1113s disable_languages_test = True 1113s fun = .run at 0xf72623faf240> 1113s iargs = () 1113s ikwargs = {} 1113s ret = False 1113s wrapped = .run at 0xf72623faf380> 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-152/run0') 1113s setup_args = ['build', '-G', 'invalid'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-152/run0') 1113s setup_args = ['build', '-G', 'invalid'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ----------------------------- Captured stdout call ----------------------------- 1113s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-152/run0/.git/ 1113s [master (root-commit) fd33fae] Initial commit 1113s 2 files changed, 16 insertions(+) 1113s create mode 100644 CMakeLists.txt 1113s create mode 100644 setup.py 1113s ----------------------------- Captured stderr call ----------------------------- 1113s hint: Using 'master' as the name for the initial branch. This default branch name 1113s hint: is subject to change. To configure the initial branch name to use in all 1113s hint: of your new repositories, which will suppress this warning, call: 1113s hint: 1113s hint: git config --global init.defaultBranch 1113s hint: 1113s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 1113s hint: 'development'. The just-created branch can be renamed via this command: 1113s hint: 1113s hint: git branch -m 1113s ___________________ test_invalid_generator[generator_args1] ____________________ 1113s 1113s generator_args = ['--', '-G', 'invalid'] 1113s 1113s @pytest.mark.parametrize( 1113s "generator_args", 1113s [ 1113s ["-G", "invalid"], 1113s ["--", "-G", "invalid"], 1113s ], 1113s ) 1113s def test_invalid_generator(generator_args): 1113s with push_dir(): 1113s build_args = ["build"] 1113s build_args.extend(generator_args) 1113s 1113s @project_setup_py_test("hello-no-language", build_args, disable_languages_test=True) 1113s def run(): 1113s pass 1113s 1113s failed = False 1113s message = "" 1113s try: 1113s > run() 1113s 1113s build_args = ['build', '--', '-G', 'invalid'] 1113s failed = False 1113s generator_args = ['--', '-G', 'invalid'] 1113s message = '' 1113s run = .run at 0xf72623fad9e0> 1113s 1113s tests/test_skbuild.py:121: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s tests/__init__.py:255: in wrapped 1113s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 1113s disable_languages_test = True 1113s fun = .run at 0xf72623faf420> 1113s iargs = () 1113s ikwargs = {} 1113s ret = False 1113s wrapped = .run at 0xf72623fad9e0> 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-153/run0') 1113s setup_args = ['build', '--', '-G', 'invalid'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-153/run0') 1113s setup_args = ['build', '--', '-G', 'invalid'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ----------------------------- Captured stdout call ----------------------------- 1113s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-153/run0/.git/ 1113s [master (root-commit) fd33fae] Initial commit 1113s 2 files changed, 16 insertions(+) 1113s create mode 100644 CMakeLists.txt 1113s create mode 100644 setup.py 1113s ----------------------------- Captured stderr call ----------------------------- 1113s hint: Using 'master' as the name for the initial branch. This default branch name 1113s hint: is subject to change. To configure the initial branch name to use in all 1113s hint: of your new repositories, which will suppress this warning, call: 1113s hint: 1113s hint: git config --global init.defaultBranch 1113s hint: 1113s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 1113s hint: 'development'. The just-created branch can be renamed via this command: 1113s hint: 1113s hint: git branch -m 1113s _________________________ test_skbuild_variable_builds _________________________ 1113s 1113s iargs = (), ikwargs = {} 1113s 1113s @functools.wraps(fun) 1113s def wrapped(*iargs, **ikwargs): 1113s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 1113s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 1113s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 1113s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 1113s 1113s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 1113s 1113s disable_languages_test = True 1113s fun = 1113s iargs = () 1113s ikwargs = {} 1113s ret = False 1113s wrapped = 1113s 1113s tests/__init__.py:255: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-154/test_skbuild_variable_builds0') 1113s setup_args = ['build'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-154/test_skbuild_variable_builds0') 1113s setup_args = ['build'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ----------------------------- Captured stdout call ----------------------------- 1113s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-154/test_skbuild_variable_builds0/.git/ 1113s [master (root-commit) 1be42e4] Initial commit 1113s 2 files changed, 20 insertions(+) 1113s create mode 100644 CMakeLists.txt 1113s create mode 100644 setup.py 1113s ----------------------------- Captured stderr call ----------------------------- 1113s hint: Using 'master' as the name for the initial branch. This default branch name 1113s hint: is subject to change. To configure the initial branch name to use in all 1113s hint: of your new repositories, which will suppress this warning, call: 1113s hint: 1113s hint: git config --global init.defaultBranch 1113s hint: 1113s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 1113s hint: 'development'. The just-created branch can be renamed via this command: 1113s hint: 1113s hint: git branch -m 1113s _________________________ test_skbuild_variable_sdist __________________________ 1113s 1113s iargs = (), ikwargs = {} 1113s 1113s @functools.wraps(fun) 1113s def wrapped(*iargs, **ikwargs): 1113s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 1113s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 1113s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 1113s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 1113s 1113s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 1113s 1113s disable_languages_test = True 1113s fun = 1113s iargs = () 1113s ikwargs = {} 1113s ret = False 1113s wrapped = 1113s 1113s tests/__init__.py:255: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-155/test_skbuild_variable_sdist0') 1113s setup_args = ['sdist'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-155/test_skbuild_variable_sdist0') 1113s setup_args = ['sdist'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ----------------------------- Captured stdout call ----------------------------- 1113s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-155/test_skbuild_variable_sdist0/.git/ 1113s [master (root-commit) 1be42e4] Initial commit 1113s 2 files changed, 20 insertions(+) 1113s create mode 100644 CMakeLists.txt 1113s create mode 100644 setup.py 1113s ----------------------------- Captured stderr call ----------------------------- 1113s hint: Using 'master' as the name for the initial branch. This default branch name 1113s hint: is subject to change. To configure the initial branch name to use in all 1113s hint: of your new repositories, which will suppress this warning, call: 1113s hint: 1113s hint: git config --global init.defaultBranch 1113s hint: 1113s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 1113s hint: 'development'. The just-created branch can be renamed via this command: 1113s hint: 1113s hint: git branch -m 1113s _________________________ test_skbuild_variable_wheel __________________________ 1113s 1113s iargs = (), ikwargs = {} 1113s 1113s @functools.wraps(fun) 1113s def wrapped(*iargs, **ikwargs): 1113s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 1113s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 1113s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 1113s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 1113s 1113s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 1113s 1113s disable_languages_test = True 1113s fun = 1113s iargs = () 1113s ikwargs = {} 1113s ret = False 1113s wrapped = 1113s 1113s tests/__init__.py:255: 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s /usr/lib/python3.12/contextlib.py:137: in __enter__ 1113s return next(self.gen) 1113s self = 1113s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 1113s 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-156/test_skbuild_variable_wheel0') 1113s setup_args = ['bdist_wheel'], disable_languages_test = True 1113s 1113s @contextmanager 1113s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 1113s """Context manager executing ``setup.py`` with the given arguments. 1113s 1113s It yields after changing the current working directory 1113s to ``project_dir``. 1113s """ 1113s 1113s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 1113s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 1113s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 1113s 1113s disable_languages_test = True 1113s project_dir = local('/tmp/pytest-of-ubuntu/pytest-156/test_skbuild_variable_wheel0') 1113s setup_args = ['bdist_wheel'] 1113s 1113s tests/__init__.py:218: AttributeError 1113s ----------------------------- Captured stdout call ----------------------------- 1113s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-156/test_skbuild_variable_wheel0/.git/ 1113s [master (root-commit) 1be42e4] Initial commit 1113s 2 files changed, 20 insertions(+) 1113s create mode 100644 CMakeLists.txt 1113s create mode 100644 setup.py 1113s ----------------------------- Captured stderr call ----------------------------- 1113s hint: Using 'master' as the name for the initial branch. This default branch name 1113s hint: is subject to change. To configure the initial branch name to use in all 1113s hint: of your new repositories, which will suppress this warning, call: 1113s hint: 1113s hint: git config --global init.defaultBranch 1113s hint: 1113s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 1113s hint: 'development'. The just-created branch can be renamed via this command: 1113s hint: 1113s hint: git branch -m 1113s =========================== short test summary info ============================ 1113s SKIPPED [1] tests/test_hello_fortran.py:19: could not import 'numpy': No module named 'numpy' 1113s SKIPPED [1] tests/test_platform.py:120: Requires Windows 1113s 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 1113s SKIPPED [1] tests/test_skbuild.py:84: NMake Makefiles generator is not available on Linux 1113s SKIPPED [3] tests/test_skbuild.py:130: Requires Windows 1113s SKIPPED [1] tests/test_skbuild.py:154: Requires Windows 1113s FAILED tests/test_broken_project.py::test_cmakelists_with_fatalerror_fails - ... 1113s FAILED tests/test_broken_project.py::test_cmakelists_with_syntaxerror_fails 1113s FAILED tests/test_broken_project.py::test_hello_with_compileerror_fails - Att... 1113s FAILED tests/test_broken_project.py::test_invalid_cmake[CalledProcessError] 1113s FAILED tests/test_broken_project.py::test_invalid_cmake[OSError] - AttributeE... 1113s FAILED tests/test_broken_project.py::test_first_invalid_generator - Attribute... 1113s FAILED tests/test_broken_project.py::test_invalid_generator - AttributeError:... 1113s FAILED tests/test_cmake_target.py::test_cmake_target_build - AttributeError: ... 1113s FAILED tests/test_cmakelists_not_in_top_level_dir.py::test_build - AttributeE... 1113s FAILED tests/test_cmakelists_not_in_top_level_dir.py::test_cmake_source_dir[invalid-True] 1113s FAILED tests/test_cmakelists_not_in_top_level_dir.py::test_cmake_source_dir[-False] 1113s FAILED tests/test_cmakelists_not_in_top_level_dir.py::test_cmake_source_dir[.-False] 1113s FAILED tests/test_command_line.py::test_help - AttributeError: module 'distut... 1113s FAILED tests/test_command_line.py::test_metadata_display - AttributeError: mo... 1113s FAILED tests/test_command_line.py::test_no_command - AttributeError: module '... 1113s FAILED tests/test_command_line.py::test_invalid_command - AttributeError: mod... 1113s FAILED tests/test_command_line.py::test_too_many_separators - AttributeError:... 1113s FAILED tests/test_command_line.py::test_cmake_initial_cache_as_global_option 1113s FAILED tests/test_command_line.py::test_cmake_executable_arg - AttributeError... 1113s FAILED tests/test_command_line.py::test_hide_listing[True-sdist] - AttributeE... 1113s FAILED tests/test_command_line.py::test_hide_listing[True-bdist_wheel] - Attr... 1113s FAILED tests/test_command_line.py::test_hide_listing[False-sdist] - Attribute... 1113s FAILED tests/test_command_line.py::test_hide_listing[False-bdist_wheel] - Att... 1113s FAILED tests/test_command_line.py::test_run_cmake_arg - AttributeError: modul... 1113s FAILED tests/test_command_line.py::test_skip_cmake_arg - AttributeError: modu... 1113s FAILED tests/test_cython_flags.py::test_hello_cython_builds - AttributeError:... 1113s FAILED tests/test_filter_manifest.py::test_bdist_wheel_command - AttributeErr... 1113s FAILED tests/test_hello_cpp.py::test_hello_builds - AttributeError: module 'd... 1113s FAILED tests/test_hello_cpp.py::test_hello_wheel - AttributeError: module 'di... 1113s FAILED tests/test_hello_cpp.py::test_hello_clean[with-dry-run] - AttributeErr... 1113s FAILED tests/test_hello_cpp.py::test_hello_clean[without-dry-run] - Attribute... 1113s FAILED tests/test_hello_cpp.py::test_hello_cleans - AttributeError: module 'd... 1113s FAILED tests/test_hello_cython.py::test_hello_cython_builds - AttributeError:... 1113s FAILED tests/test_hello_cython.py::test_hello_cython_sdist - AttributeError: ... 1113s FAILED tests/test_hello_cython.py::test_hello_cython_wheel - AttributeError: ... 1113s FAILED tests/test_hello_pure.py::test_hello_pure_builds - AttributeError: mod... 1113s FAILED tests/test_hello_pure.py::test_hello_pure_sdist - AttributeError: modu... 1113s FAILED tests/test_hello_pure.py::test_hello_pure_wheel - AttributeError: modu... 1113s FAILED tests/test_hello_pure.py::test_hello_clean - AttributeError: module 'd... 1113s FAILED tests/test_include_exclude_data.py::test_include_exclude_data - Attrib... 1113s FAILED tests/test_include_exclude_data.py::test_include_exclude_data_with_base 1113s FAILED tests/test_issue284_build_ext_inplace.py::test_build_ext_inplace_command 1113s FAILED tests/test_issue335_support_cmake_source_dir.py::test_bdist_wheel_command 1113s 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] 1113s 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] 1113s 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] 1113s 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] 1113s 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] 1113s 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] 1113s 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] 1113s 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] 1113s 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] 1113s FAILED tests/test_issue352_isolated_environment_support.py::test_isolated_env_trigger_reconfigure 1113s FAILED tests/test_issue668_symbol_visibility.py::test_symbol_visibility[ON] 1113s FAILED tests/test_issue668_symbol_visibility.py::test_symbol_visibility[OFF] 1113s FAILED tests/test_manifest_in.py::test_manifest_in_wheel - AttributeError: mo... 1113s FAILED tests/test_outside_project_root.py::test_outside_project_root_fails[None] 1113s FAILED tests/test_outside_project_root.py::test_outside_project_root_fails[-DINSTALL_FILE:BOOL=1] 1113s FAILED tests/test_outside_project_root.py::test_outside_project_root_fails[-DINSTALL_PROJECT:BOOL=1] 1113s FAILED tests/test_setup.py::test_cmake_args_keyword[cmake_args0] - AttributeE... 1113s FAILED tests/test_setup.py::test_cmake_args_keyword[cmake_args1] - AttributeE... 1113s FAILED tests/test_setup.py::test_cmake_install_dir_keyword[None-True-str] - A... 1113s FAILED tests/test_setup.py::test_cmake_install_dir_keyword[-True-str] - Attri... 1113s FAILED tests/test_setup.py::test_cmake_install_dir_keyword[/tmp/scikit-build-True-SKBuildError] 1113s FAILED tests/test_setup.py::test_cmake_install_dir_keyword[banana-False-str] 1113s FAILED tests/test_setup.py::test_cmake_with_sdist_keyword[True] - AttributeEr... 1113s FAILED tests/test_setup.py::test_cmake_with_sdist_keyword[False] - AttributeE... 1113s FAILED tests/test_setup.py::test_cmake_minimum_required_version_keyword - Att... 1113s FAILED tests/test_setup.py::test_setup_requires_keyword_include_cmake - Attri... 1113s FAILED tests/test_setup.py::test_script_keyword[pure] - AttributeError: modul... 1113s FAILED tests/test_setup.py::test_script_keyword[skbuild] - AttributeError: mo... 1113s FAILED tests/test_setup.py::test_py_modules_keyword[pure] - AttributeError: m... 1113s FAILED tests/test_setup.py::test_py_modules_keyword[skbuild] - AttributeError... 1113s FAILED tests/test_setup.py::test_setup_inputs[0-0-0-0-0-0] - AttributeError: ... 1113s FAILED tests/test_setup.py::test_setup_inputs[0-0-0-0-0-1] - AttributeError: ... 1113s FAILED tests/test_setup.py::test_setup_inputs[0-0-0-0-1-0] - AttributeError: ... 1113s FAILED tests/test_setup.py::test_setup_inputs[0-0-0-0-1-1] - AttributeError: ... 1113s FAILED tests/test_setup.py::test_setup_inputs[0-0-0-1-0-0] - AttributeError: ... 1113s FAILED tests/test_setup.py::test_setup_inputs[0-0-0-1-0-1] - AttributeError: ... 1113s FAILED tests/test_setup.py::test_setup_inputs[0-0-0-1-1-0] - AttributeError: ... 1113s FAILED tests/test_setup.py::test_setup_inputs[0-0-0-1-1-1] - AttributeError: ... 1113s FAILED tests/test_setup.py::test_setup_inputs[0-0-1-0-0-0] - AttributeError: ... 1113s FAILED tests/test_setup.py::test_setup_inputs[0-0-1-0-0-1] - AttributeError: ... 1113s FAILED tests/test_setup.py::test_setup_inputs[0-0-1-0-1-0] - AttributeError: ... 1113s FAILED tests/test_setup.py::test_setup_inputs[0-0-1-0-1-1] - AttributeError: ... 1113s FAILED tests/test_setup.py::test_setup_inputs[0-0-1-1-0-0] - AttributeError: ... 1113s FAILED tests/test_setup.py::test_setup_inputs[0-0-1-1-0-1] - AttributeError: ... 1113s FAILED tests/test_setup.py::test_setup_inputs[0-0-1-1-1-0] - AttributeError: ... 1113s FAILED tests/test_setup.py::test_setup_inputs[0-0-1-1-1-1] - AttributeError: ... 1113s FAILED tests/test_setup.py::test_setup_inputs[0-1-0-0-0-0] - AttributeError: ... 1113s FAILED tests/test_setup.py::test_setup_inputs[0-1-0-0-0-1] - AttributeError: ... 1113s FAILED tests/test_setup.py::test_setup_inputs[0-1-0-0-1-0] - AttributeError: ... 1113s FAILED tests/test_setup.py::test_setup_inputs[0-1-0-0-1-1] - AttributeError: ... 1113s FAILED tests/test_setup.py::test_setup_inputs[0-1-0-1-0-0] - AttributeError: ... 1113s FAILED tests/test_setup.py::test_setup_inputs[0-1-0-1-0-1] - AttributeError: ... 1113s FAILED tests/test_setup.py::test_setup_inputs[0-1-0-1-1-0] - AttributeError: ... 1113s FAILED tests/test_setup.py::test_setup_inputs[0-1-0-1-1-1] - AttributeError: ... 1113s FAILED tests/test_setup.py::test_setup_inputs[0-1-1-0-0-0] - AttributeError: ... 1113s FAILED tests/test_setup.py::test_setup_inputs[0-1-1-0-0-1] - AttributeError: ... 1113s FAILED tests/test_setup.py::test_setup_inputs[0-1-1-0-1-0] - AttributeError: ... 1113s FAILED tests/test_setup.py::test_setup_inputs[0-1-1-0-1-1] - AttributeError: ... 1113s FAILED tests/test_setup.py::test_setup_inputs[0-1-1-1-0-0] - AttributeError: ... 1113s FAILED tests/test_setup.py::test_setup_inputs[0-1-1-1-0-1] - AttributeError: ... 1113s FAILED tests/test_setup.py::test_setup_inputs[0-1-1-1-1-0] - AttributeError: ... 1113s FAILED tests/test_setup.py::test_setup_inputs[0-1-1-1-1-1] - AttributeError: ... 1113s FAILED tests/test_setup.py::test_setup_inputs[1-0-0-0-0-0] - AttributeError: ... 1113s FAILED tests/test_setup.py::test_setup_inputs[1-0-0-1-0-0] - AttributeError: ... 1113s FAILED tests/test_setup.py::test_setup_inputs[1-0-1-0-0-0] - AttributeError: ... 1113s FAILED tests/test_setup.py::test_setup_inputs[1-0-1-1-0-0] - AttributeError: ... 1113s FAILED tests/test_setup.py::test_setup_inputs[1-1-0-0-0-0] - AttributeError: ... 1113s FAILED tests/test_setup.py::test_setup_inputs[1-1-0-1-0-0] - AttributeError: ... 1113s FAILED tests/test_setup.py::test_setup_inputs[1-1-1-0-0-0] - AttributeError: ... 1113s FAILED tests/test_setup.py::test_setup_inputs[1-1-1-1-0-0] - AttributeError: ... 1113s FAILED tests/test_setup.py::test_cmake_install_into_pure_package[0] - Attribu... 1113s FAILED tests/test_setup.py::test_cmake_install_into_pure_package[1] - Attribu... 1113s FAILED tests/test_setup.py::test_zip_safe_default[None] - AttributeError: mod... 1113s FAILED tests/test_setup.py::test_zip_safe_default[False] - AttributeError: mo... 1113s FAILED tests/test_setup.py::test_zip_safe_default[True] - AttributeError: mod... 1113s FAILED tests/test_skbuild.py::test_generator[Unix Makefiles-make] - Attribute... 1113s FAILED tests/test_skbuild.py::test_invalid_generator[generator_args0] - Attri... 1113s FAILED tests/test_skbuild.py::test_invalid_generator[generator_args1] - Attri... 1113s FAILED tests/test_skbuild_variable.py::test_skbuild_variable_builds - Attribu... 1113s FAILED tests/test_skbuild_variable.py::test_skbuild_variable_sdist - Attribut... 1113s FAILED tests/test_skbuild_variable.py::test_skbuild_variable_wheel - Attribut... 1113s ========== 124 failed, 67 passed, 31 skipped, 17 deselected in 11.42s ========== 1113s autopkgtest [15:43:17]: test testsuite: -----------------------] 1114s autopkgtest [15:43:18]: test testsuite: - - - - - - - - - - results - - - - - - - - - - 1114s testsuite FAIL non-zero exit status 1 1114s autopkgtest [15:43:18]: @@@@@@@@@@@@@@@@@@@@ summary 1114s testsuite FAIL non-zero exit status 1 1118s nova [W] Skipping flock in bos03-arm64 1118s Creating nova instance adt-plucky-arm64-scikit-build-20241109-152444-juju-7f2275-prod-proposed-migration-environment-15-b8c188b1-cd97-4268-b298-22dfb84c7bee from image adt/ubuntu-plucky-arm64-server-20241108.img (UUID 078531dc-7060-4700-ae1a-b631769d5369)...