0s autopkgtest [10:37:00]: starting date and time: 2024-10-30 10:37:00+0000 0s autopkgtest [10:37:00]: git checkout: 6f3be7a8 Fix armhf LXD image generation for plucky 0s autopkgtest [10:37:00]: host juju-7f2275-prod-proposed-migration-environment-9; command line: /home/ubuntu/autopkgtest/runner/autopkgtest --output-dir /tmp/autopkgtest-work.7mlyew1y/out --timeout-copy=6000 --setup-commands 'ln -s /dev/null /etc/systemd/system/bluetooth.service; printf "http_proxy=http://squid.internal:3128\nhttps_proxy=http://squid.internal:3128\nno_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\n" >> /etc/environment' --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 -- lxd -r lxd-armhf-10.145.243.115 lxd-armhf-10.145.243.115:autopkgtest/ubuntu/plucky/armhf 56s autopkgtest [10:37:56]: testbed dpkg architecture: armhf 58s autopkgtest [10:37:58]: testbed apt version: 2.9.8 58s autopkgtest [10:37:58]: @@@@@@@@@@@@@@@@@@@@ test bed setup 67s Get:1 http://ftpmaster.internal/ubuntu plucky-proposed InRelease [73.9 kB] 67s Get:2 http://ftpmaster.internal/ubuntu plucky-proposed/main Sources [30.5 kB] 67s Get:3 http://ftpmaster.internal/ubuntu plucky-proposed/universe Sources [213 kB] 67s Get:4 http://ftpmaster.internal/ubuntu plucky-proposed/multiverse Sources [2840 B] 67s Get:5 http://ftpmaster.internal/ubuntu plucky-proposed/restricted Sources [7016 B] 67s Get:6 http://ftpmaster.internal/ubuntu plucky-proposed/main armhf Packages [38.0 kB] 67s Get:7 http://ftpmaster.internal/ubuntu plucky-proposed/universe armhf Packages [236 kB] 67s Fetched 601 kB in 1s (858 kB/s) 67s Reading package lists... 87s tee: /proc/self/fd/2: Permission denied 108s Hit:1 http://ftpmaster.internal/ubuntu plucky-proposed InRelease 108s Hit:2 http://ftpmaster.internal/ubuntu plucky InRelease 108s Hit:3 http://ftpmaster.internal/ubuntu plucky-updates InRelease 108s Hit:4 http://ftpmaster.internal/ubuntu plucky-security InRelease 109s Reading package lists... 109s Reading package lists... 110s Building dependency tree... 110s Reading state information... 110s Calculating upgrade... 111s The following packages were automatically installed and are no longer required: 111s libperl5.38t64 perl-modules-5.38 111s Use 'apt autoremove' to remove them. 111s The following NEW packages will be installed: 111s libperl5.40 perl-modules-5.40 python3-jaraco.text 111s The following packages will be upgraded: 111s base-files distro-info-data fwupd gcc-14-base info install-info iproute2 111s libatomic1 libdw1t64 libelf1t64 libfwupd2 libgcc-s1 libkeyutils1 111s liblocale-gettext-perl libsgutils2-1.46-2 libstdc++6 libtext-charwidth-perl 111s libtext-iconv-perl motd-news-config perl perl-base python3-pkg-resources 111s python3-setuptools sg3-utils sg3-utils-udev vim-common vim-tiny xxd 111s 28 upgraded, 3 newly installed, 0 to remove and 0 not upgraded. 111s Need to get 19.2 MB of archives. 111s After this operation, 42.7 MB of additional disk space will be used. 111s Get:1 http://ftpmaster.internal/ubuntu plucky/main armhf motd-news-config all 13.5ubuntu2 [5274 B] 111s Get:2 http://ftpmaster.internal/ubuntu plucky/main armhf base-files armhf 13.5ubuntu2 [68.6 kB] 111s Get:3 http://ftpmaster.internal/ubuntu plucky/main armhf perl-modules-5.40 all 5.40.0-6 [3214 kB] 111s Get:4 http://ftpmaster.internal/ubuntu plucky/main armhf libperl5.40 armhf 5.40.0-6 [4140 kB] 112s Get:5 http://ftpmaster.internal/ubuntu plucky/main armhf perl armhf 5.40.0-6 [262 kB] 112s Get:6 http://ftpmaster.internal/ubuntu plucky/main armhf perl-base armhf 5.40.0-6 [1674 kB] 112s Get:7 http://ftpmaster.internal/ubuntu plucky/main armhf liblocale-gettext-perl armhf 1.07-7build1 [15.0 kB] 112s Get:8 http://ftpmaster.internal/ubuntu plucky/main armhf libtext-iconv-perl armhf 1.7-8build4 [12.8 kB] 112s Get:9 http://ftpmaster.internal/ubuntu plucky/main armhf libtext-charwidth-perl armhf 0.04-11build4 [9128 B] 112s Get:10 http://ftpmaster.internal/ubuntu plucky/main armhf libatomic1 armhf 14.2.0-7ubuntu1 [7842 B] 112s Get:11 http://ftpmaster.internal/ubuntu plucky/main armhf gcc-14-base armhf 14.2.0-7ubuntu1 [51.2 kB] 112s Get:12 http://ftpmaster.internal/ubuntu plucky/main armhf libstdc++6 armhf 14.2.0-7ubuntu1 [711 kB] 112s Get:13 http://ftpmaster.internal/ubuntu plucky/main armhf libgcc-s1 armhf 14.2.0-7ubuntu1 [40.8 kB] 112s Get:14 http://ftpmaster.internal/ubuntu plucky/main armhf install-info armhf 7.1.1-1 [61.4 kB] 112s Get:15 http://ftpmaster.internal/ubuntu plucky/main armhf distro-info-data all 0.63 [6588 B] 112s Get:16 http://ftpmaster.internal/ubuntu plucky/main armhf libdw1t64 armhf 0.192-4 [243 kB] 112s Get:17 http://ftpmaster.internal/ubuntu plucky/main armhf libelf1t64 armhf 0.192-4 [50.2 kB] 112s Get:18 http://ftpmaster.internal/ubuntu plucky/main armhf iproute2 armhf 6.10.0-2ubuntu1 [1082 kB] 112s Get:19 http://ftpmaster.internal/ubuntu plucky/main armhf libkeyutils1 armhf 1.6.3-4ubuntu2 [8712 B] 112s Get:20 http://ftpmaster.internal/ubuntu plucky/main armhf vim-tiny armhf 2:9.1.0777-1ubuntu1 [693 kB] 112s Get:21 http://ftpmaster.internal/ubuntu plucky/main armhf vim-common all 2:9.1.0777-1ubuntu1 [394 kB] 112s Get:22 http://ftpmaster.internal/ubuntu plucky/main armhf xxd armhf 2:9.1.0777-1ubuntu1 [66.8 kB] 112s Get:23 http://ftpmaster.internal/ubuntu plucky/main armhf info armhf 7.1.1-1 [126 kB] 112s Get:24 http://ftpmaster.internal/ubuntu plucky/main armhf libfwupd2 armhf 1.9.26-2 [125 kB] 112s Get:25 http://ftpmaster.internal/ubuntu plucky/main armhf fwupd armhf 1.9.26-2 [4404 kB] 112s Get:26 http://ftpmaster.internal/ubuntu plucky/main armhf libsgutils2-1.46-2 armhf 1.46-3ubuntu5 [82.5 kB] 112s Get:27 http://ftpmaster.internal/ubuntu plucky/main armhf python3-jaraco.text all 4.0.0-1 [11.5 kB] 112s Get:28 http://ftpmaster.internal/ubuntu plucky-proposed/main armhf python3-pkg-resources all 75.2.0-1 [134 kB] 112s Get:29 http://ftpmaster.internal/ubuntu plucky-proposed/main armhf python3-setuptools all 75.2.0-1 [657 kB] 112s Get:30 http://ftpmaster.internal/ubuntu plucky/main armhf sg3-utils armhf 1.46-3ubuntu5 [816 kB] 112s Get:31 http://ftpmaster.internal/ubuntu plucky/main armhf sg3-utils-udev all 1.46-3ubuntu5 [5916 B] 112s Preconfiguring packages ... 112s Fetched 19.2 MB in 1s (15.3 MB/s) 112s (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 ... 59386 files and directories currently installed.) 112s Preparing to unpack .../motd-news-config_13.5ubuntu2_all.deb ... 112s Unpacking motd-news-config (13.5ubuntu2) over (13.3ubuntu6) ... 113s Preparing to unpack .../base-files_13.5ubuntu2_armhf.deb ... 113s Unpacking base-files (13.5ubuntu2) over (13.3ubuntu6) ... 113s Setting up base-files (13.5ubuntu2) ... 113s Installing new version of config file /etc/issue ... 113s Installing new version of config file /etc/issue.net ... 113s Installing new version of config file /etc/lsb-release ... 113s motd-news.service is a disabled or a static unit not running, not starting it. 113s (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 ... 59386 files and directories currently installed.) 113s Preparing to unpack .../perl_5.40.0-6_armhf.deb ... 113s Unpacking perl (5.40.0-6) over (5.38.2-5) ... 113s Selecting previously unselected package perl-modules-5.40. 113s Preparing to unpack .../perl-modules-5.40_5.40.0-6_all.deb ... 113s Unpacking perl-modules-5.40 (5.40.0-6) ... 114s Selecting previously unselected package libperl5.40:armhf. 114s Preparing to unpack .../libperl5.40_5.40.0-6_armhf.deb ... 114s Unpacking libperl5.40:armhf (5.40.0-6) ... 114s Preparing to unpack .../perl-base_5.40.0-6_armhf.deb ... 114s Unpacking perl-base (5.40.0-6) over (5.38.2-5) ... 114s Setting up perl-base (5.40.0-6) ... 114s (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 ... 61462 files and directories currently installed.) 114s Preparing to unpack .../liblocale-gettext-perl_1.07-7build1_armhf.deb ... 114s Unpacking liblocale-gettext-perl (1.07-7build1) over (1.07-7) ... 114s Preparing to unpack .../libtext-iconv-perl_1.7-8build4_armhf.deb ... 114s Unpacking libtext-iconv-perl:armhf (1.7-8build4) over (1.7-8build3) ... 114s Preparing to unpack .../libtext-charwidth-perl_0.04-11build4_armhf.deb ... 114s Unpacking libtext-charwidth-perl:armhf (0.04-11build4) over (0.04-11build3) ... 114s Preparing to unpack .../libatomic1_14.2.0-7ubuntu1_armhf.deb ... 114s Unpacking libatomic1:armhf (14.2.0-7ubuntu1) over (14.2.0-4ubuntu2) ... 114s Preparing to unpack .../gcc-14-base_14.2.0-7ubuntu1_armhf.deb ... 114s Unpacking gcc-14-base:armhf (14.2.0-7ubuntu1) over (14.2.0-4ubuntu2) ... 115s Setting up gcc-14-base:armhf (14.2.0-7ubuntu1) ... 115s (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 ... 61462 files and directories currently installed.) 115s Preparing to unpack .../libstdc++6_14.2.0-7ubuntu1_armhf.deb ... 115s Unpacking libstdc++6:armhf (14.2.0-7ubuntu1) over (14.2.0-4ubuntu2) ... 115s Setting up libstdc++6:armhf (14.2.0-7ubuntu1) ... 115s (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 ... 61462 files and directories currently installed.) 115s Preparing to unpack .../libgcc-s1_14.2.0-7ubuntu1_armhf.deb ... 115s Unpacking libgcc-s1:armhf (14.2.0-7ubuntu1) over (14.2.0-4ubuntu2) ... 115s Setting up libgcc-s1:armhf (14.2.0-7ubuntu1) ... 115s (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 ... 61462 files and directories currently installed.) 115s Preparing to unpack .../install-info_7.1.1-1_armhf.deb ... 115s Unpacking install-info (7.1.1-1) over (7.1-3build2) ... 115s Setting up install-info (7.1.1-1) ... 115s (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 ... 61462 files and directories currently installed.) 115s Preparing to unpack .../00-distro-info-data_0.63_all.deb ... 115s Unpacking distro-info-data (0.63) over (0.62) ... 115s Preparing to unpack .../01-libdw1t64_0.192-4_armhf.deb ... 115s Unpacking libdw1t64:armhf (0.192-4) over (0.191-2) ... 115s Preparing to unpack .../02-libelf1t64_0.192-4_armhf.deb ... 115s Unpacking libelf1t64:armhf (0.192-4) over (0.191-2) ... 115s Preparing to unpack .../03-iproute2_6.10.0-2ubuntu1_armhf.deb ... 115s Unpacking iproute2 (6.10.0-2ubuntu1) over (6.10.0-2) ... 115s Preparing to unpack .../04-libkeyutils1_1.6.3-4ubuntu2_armhf.deb ... 115s Unpacking libkeyutils1:armhf (1.6.3-4ubuntu2) over (1.6.3-3build1) ... 116s Preparing to unpack .../05-vim-tiny_2%3a9.1.0777-1ubuntu1_armhf.deb ... 116s Unpacking vim-tiny (2:9.1.0777-1ubuntu1) over (2:9.1.0496-1ubuntu6) ... 116s Preparing to unpack .../06-vim-common_2%3a9.1.0777-1ubuntu1_all.deb ... 116s Unpacking vim-common (2:9.1.0777-1ubuntu1) over (2:9.1.0496-1ubuntu6) ... 116s Preparing to unpack .../07-xxd_2%3a9.1.0777-1ubuntu1_armhf.deb ... 116s Unpacking xxd (2:9.1.0777-1ubuntu1) over (2:9.1.0496-1ubuntu6) ... 116s Preparing to unpack .../08-info_7.1.1-1_armhf.deb ... 116s Unpacking info (7.1.1-1) over (7.1-3build2) ... 116s Preparing to unpack .../09-libfwupd2_1.9.26-2_armhf.deb ... 116s Unpacking libfwupd2:armhf (1.9.26-2) over (1.9.24-1) ... 116s Preparing to unpack .../10-fwupd_1.9.26-2_armhf.deb ... 116s Unpacking fwupd (1.9.26-2) over (1.9.24-1) ... 116s Preparing to unpack .../11-libsgutils2-1.46-2_1.46-3ubuntu5_armhf.deb ... 116s Unpacking libsgutils2-1.46-2:armhf (1.46-3ubuntu5) over (1.46-3ubuntu4) ... 116s Selecting previously unselected package python3-jaraco.text. 116s Preparing to unpack .../12-python3-jaraco.text_4.0.0-1_all.deb ... 116s Unpacking python3-jaraco.text (4.0.0-1) ... 116s Preparing to unpack .../13-python3-pkg-resources_75.2.0-1_all.deb ... 116s Unpacking python3-pkg-resources (75.2.0-1) over (74.1.2-1) ... 116s Preparing to unpack .../14-python3-setuptools_75.2.0-1_all.deb ... 116s Unpacking python3-setuptools (75.2.0-1) over (74.1.2-1) ... 117s Preparing to unpack .../15-sg3-utils_1.46-3ubuntu5_armhf.deb ... 117s Unpacking sg3-utils (1.46-3ubuntu5) over (1.46-3ubuntu4) ... 117s Preparing to unpack .../16-sg3-utils-udev_1.46-3ubuntu5_all.deb ... 117s Unpacking sg3-utils-udev (1.46-3ubuntu5) over (1.46-3ubuntu4) ... 117s Setting up python3-pkg-resources (75.2.0-1) ... 117s Setting up motd-news-config (13.5ubuntu2) ... 117s Setting up libtext-iconv-perl:armhf (1.7-8build4) ... 117s Setting up libtext-charwidth-perl:armhf (0.04-11build4) ... 117s Setting up libkeyutils1:armhf (1.6.3-4ubuntu2) ... 117s Setting up distro-info-data (0.63) ... 117s Setting up libfwupd2:armhf (1.9.26-2) ... 117s Setting up libsgutils2-1.46-2:armhf (1.46-3ubuntu5) ... 117s Setting up xxd (2:9.1.0777-1ubuntu1) ... 117s Setting up libelf1t64:armhf (0.192-4) ... 117s Setting up libdw1t64:armhf (0.192-4) ... 117s Setting up vim-common (2:9.1.0777-1ubuntu1) ... 117s Installing new version of config file /etc/vim/vimrc ... 117s Setting up python3-jaraco.text (4.0.0-1) ... 117s Setting up libatomic1:armhf (14.2.0-7ubuntu1) ... 117s Setting up perl-modules-5.40 (5.40.0-6) ... 117s Setting up fwupd (1.9.26-2) ... 118s fwupd-offline-update.service is a disabled or a static unit not running, not starting it. 118s fwupd-refresh.service is a disabled or a static unit not running, not starting it. 118s fwupd.service is a disabled or a static unit not running, not starting it. 118s Setting up info (7.1.1-1) ... 118s Setting up liblocale-gettext-perl (1.07-7build1) ... 118s Setting up sg3-utils (1.46-3ubuntu5) ... 118s Setting up python3-setuptools (75.2.0-1) ... 118s Setting up iproute2 (6.10.0-2ubuntu1) ... 119s Setting up vim-tiny (2:9.1.0777-1ubuntu1) ... 119s Setting up sg3-utils-udev (1.46-3ubuntu5) ... 119s update-initramfs: deferring update (trigger activated) 119s Setting up libperl5.40:armhf (5.40.0-6) ... 119s Setting up perl (5.40.0-6) ... 119s Processing triggers for dbus (1.14.10-4ubuntu5) ... 119s Processing triggers for install-info (7.1.1-1) ... 119s Processing triggers for initramfs-tools (0.142ubuntu34) ... 119s Processing triggers for libc-bin (2.40-1ubuntu3) ... 119s Processing triggers for man-db (2.12.1-3) ... 120s Processing triggers for plymouth-theme-ubuntu-text (24.004.60-1ubuntu10) ... 121s update-initramfs: deferring update (trigger activated) 121s Processing triggers for initramfs-tools (0.142ubuntu34) ... 121s Reading package lists... 121s Building dependency tree... 121s Reading state information... 122s The following packages will be REMOVED: 122s libperl5.38t64* perl-modules-5.38* 122s 0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded. 122s After this operation, 41.6 MB disk space will be freed. 122s (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 ... 61471 files and directories currently installed.) 122s Removing libperl5.38t64:armhf (5.38.2-5) ... 122s Removing perl-modules-5.38 (5.38.2-5) ... 122s Processing triggers for man-db (2.12.1-3) ... 122s Processing triggers for libc-bin (2.40-1ubuntu3) ... 125s autopkgtest [10:39:05]: rebooting testbed after setup commands that affected boot 197s autopkgtest [10:40:17]: testbed running kernel: Linux 6.8.0-47-generic #47~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Oct 2 16:39:14 UTC 2 228s autopkgtest [10:40:48]: @@@@@@@@@@@@@@@@@@@@ apt-source scikit-build 245s Get:1 http://ftpmaster.internal/ubuntu plucky/universe scikit-build 0.18.1-1 (dsc) [2733 B] 245s Get:2 http://ftpmaster.internal/ubuntu plucky/universe scikit-build 0.18.1-1 (tar) [273 kB] 245s Get:3 http://ftpmaster.internal/ubuntu plucky/universe scikit-build 0.18.1-1 (diff) [5768 B] 245s gpgv: Signature made Fri Aug 30 01:03:13 2024 UTC 245s gpgv: using RSA key 13796755BBC72BB8ABE2AEB5FA9DEC5DE11C63F1 245s gpgv: issuer "eamanu@debian.org" 245s gpgv: Can't check signature: No public key 245s dpkg-source: warning: cannot verify inline signature for ./scikit-build_0.18.1-1.dsc: no acceptable signature found 245s autopkgtest [10:41:05]: testing package scikit-build version 0.18.1-1 247s autopkgtest [10:41:07]: build not needed 249s autopkgtest [10:41:09]: test testsuite: preparing testbed 260s Reading package lists... 260s Building dependency tree... 260s Reading state information... 261s Starting pkgProblemResolver with broken count: 0 261s Starting 2 pkgProblemResolver with broken count: 0 261s Done 261s The following additional packages will be installed: 261s build-essential cmake cmake-data cpp cpp-14 cpp-14-arm-linux-gnueabihf 261s cpp-arm-linux-gnueabihf cython3 fonts-font-awesome fonts-lato g++ g++-14 261s g++-14-arm-linux-gnueabihf g++-arm-linux-gnueabihf gcc gcc-14 261s gcc-14-arm-linux-gnueabihf gcc-arm-linux-gnueabihf git git-man libasan8 261s libc-dev-bin libc6-dev libcc1-0 libcrypt-dev liberror-perl libexpat1-dev 261s libgcc-14-dev libgomp1 libisl23 libjs-jquery libjs-sphinxdoc 261s libjs-underscore libjsoncpp25 libmpc3 libpython3-all-dev libpython3-dev 261s libpython3.12-dev libpython3.12t64 librhash0 libstdc++-14-dev libubsan1 261s linux-libc-dev python-skbuild-doc python3-all python3-all-dev python3-build 261s python3-dev python3-distlib python3-filelock python3-iniconfig 261s python3-packaging python3-pip python3-pip-whl python3-platformdirs 262s python3-pluggy python3-pyproject-hooks python3-pytest python3-pytest-mock 262s python3-setuptools-whl python3-skbuild python3-toml python3-virtualenv 262s python3-wheel python3-wheel-whl python3.12-dev rpcsvc-proto 262s sphinx-rtd-theme-common zlib1g-dev 262s Suggested packages: 262s cmake-doc cmake-format elpa-cmake-mode ninja-build cpp-doc gcc-14-locales 262s cpp-14-doc cython-doc gcc-14-doc gcc-multilib manpages-dev autoconf automake 262s libtool flex bison gdb gcc-doc gdb-arm-linux-gnueabihf git-daemon-run 262s | git-daemon-sysvinit git-doc git-email git-gui gitk gitweb git-cvs 262s git-mediawiki git-svn libc-devtools glibc-doc libstdc++-14-doc python3-venv 262s python-build-doc python-pytest-mock-doc 262s Recommended packages: 262s manpages manpages-dev javascript-common libssl3 262s The following NEW packages will be installed: 262s autopkgtest-satdep build-essential cmake cmake-data cpp cpp-14 262s cpp-14-arm-linux-gnueabihf cpp-arm-linux-gnueabihf cython3 262s fonts-font-awesome fonts-lato g++ g++-14 g++-14-arm-linux-gnueabihf 262s g++-arm-linux-gnueabihf gcc gcc-14 gcc-14-arm-linux-gnueabihf 262s gcc-arm-linux-gnueabihf git git-man libasan8 libc-dev-bin libc6-dev libcc1-0 262s libcrypt-dev liberror-perl libexpat1-dev libgcc-14-dev libgomp1 libisl23 262s libjs-jquery libjs-sphinxdoc libjs-underscore libjsoncpp25 libmpc3 262s libpython3-all-dev libpython3-dev libpython3.12-dev libpython3.12t64 262s librhash0 libstdc++-14-dev libubsan1 linux-libc-dev python-skbuild-doc 262s python3-all python3-all-dev python3-build python3-dev python3-distlib 262s python3-filelock python3-iniconfig python3-packaging python3-pip 262s python3-pip-whl python3-platformdirs python3-pluggy python3-pyproject-hooks 262s python3-pytest python3-pytest-mock python3-setuptools-whl python3-skbuild 262s python3-toml python3-virtualenv python3-wheel python3-wheel-whl 262s python3.12-dev rpcsvc-proto sphinx-rtd-theme-common zlib1g-dev 262s 0 upgraded, 70 newly installed, 0 to remove and 0 not upgraded. 262s Need to get 84.5 MB/84.5 MB of archives. 262s After this operation, 279 MB of additional disk space will be used. 262s Get:1 /tmp/autopkgtest.PZgfUf/1-autopkgtest-satdep.deb autopkgtest-satdep armhf 0 [784 B] 262s Get:2 http://ftpmaster.internal/ubuntu plucky/main armhf fonts-lato all 2.015-1 [2781 kB] 262s Get:3 http://ftpmaster.internal/ubuntu plucky/main armhf libc-dev-bin armhf 2.40-1ubuntu3 [19.2 kB] 262s Get:4 http://ftpmaster.internal/ubuntu plucky/main armhf linux-libc-dev armhf 6.11.0-8.8 [1628 kB] 262s Get:5 http://ftpmaster.internal/ubuntu plucky/main armhf libcrypt-dev armhf 1:4.4.36-4build1 [120 kB] 262s Get:6 http://ftpmaster.internal/ubuntu plucky/main armhf rpcsvc-proto armhf 1.4.2-0ubuntu7 [62.2 kB] 262s Get:7 http://ftpmaster.internal/ubuntu plucky/main armhf libc6-dev armhf 2.40-1ubuntu3 [1370 kB] 262s Get:8 http://ftpmaster.internal/ubuntu plucky/main armhf libisl23 armhf 0.27-1 [546 kB] 262s Get:9 http://ftpmaster.internal/ubuntu plucky/main armhf libmpc3 armhf 1.3.1-1build2 [47.1 kB] 262s Get:10 http://ftpmaster.internal/ubuntu plucky/main armhf cpp-14-arm-linux-gnueabihf armhf 14.2.0-7ubuntu1 [9219 kB] 263s Get:11 http://ftpmaster.internal/ubuntu plucky/main armhf cpp-14 armhf 14.2.0-7ubuntu1 [1030 B] 263s Get:12 http://ftpmaster.internal/ubuntu plucky/main armhf cpp-arm-linux-gnueabihf armhf 4:14.1.0-2ubuntu1 [5464 B] 263s Get:13 http://ftpmaster.internal/ubuntu plucky/main armhf cpp armhf 4:14.1.0-2ubuntu1 [22.4 kB] 263s Get:14 http://ftpmaster.internal/ubuntu plucky/main armhf libcc1-0 armhf 14.2.0-7ubuntu1 [43.3 kB] 263s Get:15 http://ftpmaster.internal/ubuntu plucky/main armhf libgomp1 armhf 14.2.0-7ubuntu1 [125 kB] 263s Get:16 http://ftpmaster.internal/ubuntu plucky/main armhf libasan8 armhf 14.2.0-7ubuntu1 [2901 kB] 263s Get:17 http://ftpmaster.internal/ubuntu plucky/main armhf libubsan1 armhf 14.2.0-7ubuntu1 [1150 kB] 263s Get:18 http://ftpmaster.internal/ubuntu plucky/main armhf libgcc-14-dev armhf 14.2.0-7ubuntu1 [897 kB] 263s Get:19 http://ftpmaster.internal/ubuntu plucky/main armhf gcc-14-arm-linux-gnueabihf armhf 14.2.0-7ubuntu1 [18.0 MB] 264s Get:20 http://ftpmaster.internal/ubuntu plucky/main armhf gcc-14 armhf 14.2.0-7ubuntu1 [495 kB] 264s Get:21 http://ftpmaster.internal/ubuntu plucky/main armhf gcc-arm-linux-gnueabihf armhf 4:14.1.0-2ubuntu1 [1222 B] 264s Get:22 http://ftpmaster.internal/ubuntu plucky/main armhf gcc armhf 4:14.1.0-2ubuntu1 [5002 B] 264s Get:23 http://ftpmaster.internal/ubuntu plucky/main armhf libstdc++-14-dev armhf 14.2.0-7ubuntu1 [2567 kB] 264s Get:24 http://ftpmaster.internal/ubuntu plucky/main armhf g++-14-arm-linux-gnueabihf armhf 14.2.0-7ubuntu1 [10.5 MB] 264s Get:25 http://ftpmaster.internal/ubuntu plucky/main armhf g++-14 armhf 14.2.0-7ubuntu1 [19.8 kB] 264s Get:26 http://ftpmaster.internal/ubuntu plucky/main armhf g++-arm-linux-gnueabihf armhf 4:14.1.0-2ubuntu1 [968 B] 264s Get:27 http://ftpmaster.internal/ubuntu plucky/main armhf g++ armhf 4:14.1.0-2ubuntu1 [1084 B] 264s Get:28 http://ftpmaster.internal/ubuntu plucky/main armhf build-essential armhf 12.10ubuntu1 [4928 B] 264s Get:29 http://ftpmaster.internal/ubuntu plucky/main armhf libjsoncpp25 armhf 1.9.5-6build1 [75.3 kB] 264s Get:30 http://ftpmaster.internal/ubuntu plucky/main armhf librhash0 armhf 1.4.3-3build1 [143 kB] 264s Get:31 http://ftpmaster.internal/ubuntu plucky/main armhf cmake-data all 3.30.3-1 [2246 kB] 265s Get:32 http://ftpmaster.internal/ubuntu plucky/main armhf cmake armhf 3.30.3-1 [6319 kB] 265s Get:33 http://ftpmaster.internal/ubuntu plucky/universe armhf cython3 armhf 3.0.11+dfsg-1ubuntu1 [2391 kB] 265s Get:34 http://ftpmaster.internal/ubuntu plucky/main armhf fonts-font-awesome all 5.0.10+really4.7.0~dfsg-4.1 [516 kB] 265s Get:35 http://ftpmaster.internal/ubuntu plucky/main armhf liberror-perl all 0.17029-2 [25.6 kB] 265s Get:36 http://ftpmaster.internal/ubuntu plucky/main armhf git-man all 1:2.45.2-1ubuntu1 [1122 kB] 265s Get:37 http://ftpmaster.internal/ubuntu plucky/main armhf git armhf 1:2.45.2-1ubuntu1 [4504 kB] 265s Get:38 http://ftpmaster.internal/ubuntu plucky/main armhf libexpat1-dev armhf 2.6.2-2 [121 kB] 265s Get:39 http://ftpmaster.internal/ubuntu plucky/main armhf libjs-jquery all 3.6.1+dfsg+~3.5.14-1 [328 kB] 265s Get:40 http://ftpmaster.internal/ubuntu plucky/main armhf libjs-underscore all 1.13.4~dfsg+~1.11.4-3 [118 kB] 265s Get:41 http://ftpmaster.internal/ubuntu plucky/main armhf libjs-sphinxdoc all 7.4.7-3 [157 kB] 265s Get:42 http://ftpmaster.internal/ubuntu plucky/main armhf libpython3.12t64 armhf 3.12.7-1 [2076 kB] 265s Get:43 http://ftpmaster.internal/ubuntu plucky/main armhf zlib1g-dev armhf 1:1.3.dfsg+really1.3.1-1ubuntu1 [880 kB] 265s Get:44 http://ftpmaster.internal/ubuntu plucky/main armhf libpython3.12-dev armhf 3.12.7-1 [4344 kB] 265s Get:45 http://ftpmaster.internal/ubuntu plucky/main armhf libpython3-dev armhf 3.12.6-0ubuntu1 [10.2 kB] 265s Get:46 http://ftpmaster.internal/ubuntu plucky/main armhf libpython3-all-dev armhf 3.12.6-0ubuntu1 [914 B] 265s Get:47 http://ftpmaster.internal/ubuntu plucky/main armhf sphinx-rtd-theme-common all 2.0.0+dfsg-2 [1012 kB] 265s Get:48 http://ftpmaster.internal/ubuntu plucky/universe armhf python-skbuild-doc all 0.18.1-1 [136 kB] 265s Get:49 http://ftpmaster.internal/ubuntu plucky/main armhf python3-all armhf 3.12.6-0ubuntu1 [886 B] 265s Get:50 http://ftpmaster.internal/ubuntu plucky/main armhf python3.12-dev armhf 3.12.7-1 [504 kB] 265s Get:51 http://ftpmaster.internal/ubuntu plucky/main armhf python3-dev armhf 3.12.6-0ubuntu1 [26.7 kB] 265s Get:52 http://ftpmaster.internal/ubuntu plucky/main armhf python3-all-dev armhf 3.12.6-0ubuntu1 [908 B] 265s Get:53 http://ftpmaster.internal/ubuntu plucky/main armhf python3-packaging all 24.1-1 [41.4 kB] 265s Get:54 http://ftpmaster.internal/ubuntu plucky/universe armhf python3-pyproject-hooks all 1.1.0-2 [9916 B] 265s Get:55 http://ftpmaster.internal/ubuntu plucky/universe armhf python3-toml all 0.10.2-1 [16.5 kB] 266s Get:56 http://ftpmaster.internal/ubuntu plucky/universe armhf python3-wheel all 0.44.0-1 [54.2 kB] 266s Get:57 http://ftpmaster.internal/ubuntu plucky/universe armhf python3-build all 1.2.1-1 [29.7 kB] 266s Get:58 http://ftpmaster.internal/ubuntu plucky/universe armhf python3-distlib all 0.3.8-1 [318 kB] 266s Get:59 http://ftpmaster.internal/ubuntu plucky/universe armhf python3-filelock all 3.15.4-1 [12.8 kB] 266s Get:60 http://ftpmaster.internal/ubuntu plucky/universe armhf python3-iniconfig all 1.1.1-2 [6024 B] 266s Get:61 http://ftpmaster.internal/ubuntu plucky/universe armhf python3-pip all 24.2+dfsg-1 [1398 kB] 266s Get:62 http://ftpmaster.internal/ubuntu plucky/universe armhf python3-pip-whl all 24.2+dfsg-1 [1420 kB] 266s Get:63 http://ftpmaster.internal/ubuntu plucky/main armhf python3-platformdirs all 4.2.2-1 [16.6 kB] 266s Get:64 http://ftpmaster.internal/ubuntu plucky/universe armhf python3-pluggy all 1.5.0-1 [21.0 kB] 266s Get:65 http://ftpmaster.internal/ubuntu plucky/universe armhf python3-pytest all 8.3.2-1 [251 kB] 266s Get:66 http://ftpmaster.internal/ubuntu plucky/universe armhf python3-pytest-mock all 3.14.0-1 [11.6 kB] 266s Get:67 http://ftpmaster.internal/ubuntu plucky-proposed/universe armhf python3-setuptools-whl all 75.2.0-1 [1158 kB] 266s Get:68 http://ftpmaster.internal/ubuntu plucky/universe armhf python3-skbuild all 0.18.1-1 [60.3 kB] 266s Get:69 http://ftpmaster.internal/ubuntu plucky/universe armhf python3-wheel-whl all 0.44.0-1 [69.5 kB] 266s Get:70 http://ftpmaster.internal/ubuntu plucky/universe armhf python3-virtualenv all 20.26.2+ds-1 [71.6 kB] 266s Fetched 84.5 MB in 4s (20.6 MB/s) 266s Selecting previously unselected package fonts-lato. 266s (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 ... 59541 files and directories currently installed.) 266s Preparing to unpack .../00-fonts-lato_2.015-1_all.deb ... 266s Unpacking fonts-lato (2.015-1) ... 266s Selecting previously unselected package libc-dev-bin. 266s Preparing to unpack .../01-libc-dev-bin_2.40-1ubuntu3_armhf.deb ... 266s Unpacking libc-dev-bin (2.40-1ubuntu3) ... 266s Selecting previously unselected package linux-libc-dev:armhf. 266s Preparing to unpack .../02-linux-libc-dev_6.11.0-8.8_armhf.deb ... 266s Unpacking linux-libc-dev:armhf (6.11.0-8.8) ... 267s Selecting previously unselected package libcrypt-dev:armhf. 267s Preparing to unpack .../03-libcrypt-dev_1%3a4.4.36-4build1_armhf.deb ... 267s Unpacking libcrypt-dev:armhf (1:4.4.36-4build1) ... 267s Selecting previously unselected package rpcsvc-proto. 267s Preparing to unpack .../04-rpcsvc-proto_1.4.2-0ubuntu7_armhf.deb ... 267s Unpacking rpcsvc-proto (1.4.2-0ubuntu7) ... 267s Selecting previously unselected package libc6-dev:armhf. 267s Preparing to unpack .../05-libc6-dev_2.40-1ubuntu3_armhf.deb ... 267s Unpacking libc6-dev:armhf (2.40-1ubuntu3) ... 267s Selecting previously unselected package libisl23:armhf. 267s Preparing to unpack .../06-libisl23_0.27-1_armhf.deb ... 267s Unpacking libisl23:armhf (0.27-1) ... 267s Selecting previously unselected package libmpc3:armhf. 267s Preparing to unpack .../07-libmpc3_1.3.1-1build2_armhf.deb ... 267s Unpacking libmpc3:armhf (1.3.1-1build2) ... 267s Selecting previously unselected package cpp-14-arm-linux-gnueabihf. 267s Preparing to unpack .../08-cpp-14-arm-linux-gnueabihf_14.2.0-7ubuntu1_armhf.deb ... 267s Unpacking cpp-14-arm-linux-gnueabihf (14.2.0-7ubuntu1) ... 267s Selecting previously unselected package cpp-14. 267s Preparing to unpack .../09-cpp-14_14.2.0-7ubuntu1_armhf.deb ... 267s Unpacking cpp-14 (14.2.0-7ubuntu1) ... 267s Selecting previously unselected package cpp-arm-linux-gnueabihf. 267s Preparing to unpack .../10-cpp-arm-linux-gnueabihf_4%3a14.1.0-2ubuntu1_armhf.deb ... 267s Unpacking cpp-arm-linux-gnueabihf (4:14.1.0-2ubuntu1) ... 267s Selecting previously unselected package cpp. 267s Preparing to unpack .../11-cpp_4%3a14.1.0-2ubuntu1_armhf.deb ... 267s Unpacking cpp (4:14.1.0-2ubuntu1) ... 267s Selecting previously unselected package libcc1-0:armhf. 267s Preparing to unpack .../12-libcc1-0_14.2.0-7ubuntu1_armhf.deb ... 267s Unpacking libcc1-0:armhf (14.2.0-7ubuntu1) ... 267s Selecting previously unselected package libgomp1:armhf. 267s Preparing to unpack .../13-libgomp1_14.2.0-7ubuntu1_armhf.deb ... 267s Unpacking libgomp1:armhf (14.2.0-7ubuntu1) ... 267s Selecting previously unselected package libasan8:armhf. 267s Preparing to unpack .../14-libasan8_14.2.0-7ubuntu1_armhf.deb ... 267s Unpacking libasan8:armhf (14.2.0-7ubuntu1) ... 267s Selecting previously unselected package libubsan1:armhf. 267s Preparing to unpack .../15-libubsan1_14.2.0-7ubuntu1_armhf.deb ... 267s Unpacking libubsan1:armhf (14.2.0-7ubuntu1) ... 267s Selecting previously unselected package libgcc-14-dev:armhf. 267s Preparing to unpack .../16-libgcc-14-dev_14.2.0-7ubuntu1_armhf.deb ... 267s Unpacking libgcc-14-dev:armhf (14.2.0-7ubuntu1) ... 267s Selecting previously unselected package gcc-14-arm-linux-gnueabihf. 267s Preparing to unpack .../17-gcc-14-arm-linux-gnueabihf_14.2.0-7ubuntu1_armhf.deb ... 267s Unpacking gcc-14-arm-linux-gnueabihf (14.2.0-7ubuntu1) ... 268s Selecting previously unselected package gcc-14. 268s Preparing to unpack .../18-gcc-14_14.2.0-7ubuntu1_armhf.deb ... 268s Unpacking gcc-14 (14.2.0-7ubuntu1) ... 268s Selecting previously unselected package gcc-arm-linux-gnueabihf. 268s Preparing to unpack .../19-gcc-arm-linux-gnueabihf_4%3a14.1.0-2ubuntu1_armhf.deb ... 268s Unpacking gcc-arm-linux-gnueabihf (4:14.1.0-2ubuntu1) ... 268s Selecting previously unselected package gcc. 268s Preparing to unpack .../20-gcc_4%3a14.1.0-2ubuntu1_armhf.deb ... 268s Unpacking gcc (4:14.1.0-2ubuntu1) ... 268s Selecting previously unselected package libstdc++-14-dev:armhf. 268s Preparing to unpack .../21-libstdc++-14-dev_14.2.0-7ubuntu1_armhf.deb ... 268s Unpacking libstdc++-14-dev:armhf (14.2.0-7ubuntu1) ... 268s Selecting previously unselected package g++-14-arm-linux-gnueabihf. 268s Preparing to unpack .../22-g++-14-arm-linux-gnueabihf_14.2.0-7ubuntu1_armhf.deb ... 268s Unpacking g++-14-arm-linux-gnueabihf (14.2.0-7ubuntu1) ... 268s Selecting previously unselected package g++-14. 268s Preparing to unpack .../23-g++-14_14.2.0-7ubuntu1_armhf.deb ... 268s Unpacking g++-14 (14.2.0-7ubuntu1) ... 268s Selecting previously unselected package g++-arm-linux-gnueabihf. 268s Preparing to unpack .../24-g++-arm-linux-gnueabihf_4%3a14.1.0-2ubuntu1_armhf.deb ... 268s Unpacking g++-arm-linux-gnueabihf (4:14.1.0-2ubuntu1) ... 268s Selecting previously unselected package g++. 268s Preparing to unpack .../25-g++_4%3a14.1.0-2ubuntu1_armhf.deb ... 268s Unpacking g++ (4:14.1.0-2ubuntu1) ... 268s Selecting previously unselected package build-essential. 268s Preparing to unpack .../26-build-essential_12.10ubuntu1_armhf.deb ... 268s Unpacking build-essential (12.10ubuntu1) ... 268s Selecting previously unselected package libjsoncpp25:armhf. 268s Preparing to unpack .../27-libjsoncpp25_1.9.5-6build1_armhf.deb ... 268s Unpacking libjsoncpp25:armhf (1.9.5-6build1) ... 268s Selecting previously unselected package librhash0:armhf. 268s Preparing to unpack .../28-librhash0_1.4.3-3build1_armhf.deb ... 268s Unpacking librhash0:armhf (1.4.3-3build1) ... 268s Selecting previously unselected package cmake-data. 268s Preparing to unpack .../29-cmake-data_3.30.3-1_all.deb ... 268s Unpacking cmake-data (3.30.3-1) ... 269s Selecting previously unselected package cmake. 269s Preparing to unpack .../30-cmake_3.30.3-1_armhf.deb ... 269s Unpacking cmake (3.30.3-1) ... 269s Selecting previously unselected package cython3. 269s Preparing to unpack .../31-cython3_3.0.11+dfsg-1ubuntu1_armhf.deb ... 269s Unpacking cython3 (3.0.11+dfsg-1ubuntu1) ... 269s Selecting previously unselected package fonts-font-awesome. 269s Preparing to unpack .../32-fonts-font-awesome_5.0.10+really4.7.0~dfsg-4.1_all.deb ... 269s Unpacking fonts-font-awesome (5.0.10+really4.7.0~dfsg-4.1) ... 269s Selecting previously unselected package liberror-perl. 269s Preparing to unpack .../33-liberror-perl_0.17029-2_all.deb ... 269s Unpacking liberror-perl (0.17029-2) ... 269s Selecting previously unselected package git-man. 269s Preparing to unpack .../34-git-man_1%3a2.45.2-1ubuntu1_all.deb ... 269s Unpacking git-man (1:2.45.2-1ubuntu1) ... 269s Selecting previously unselected package git. 269s Preparing to unpack .../35-git_1%3a2.45.2-1ubuntu1_armhf.deb ... 269s Unpacking git (1:2.45.2-1ubuntu1) ... 270s Selecting previously unselected package libexpat1-dev:armhf. 270s Preparing to unpack .../36-libexpat1-dev_2.6.2-2_armhf.deb ... 270s Unpacking libexpat1-dev:armhf (2.6.2-2) ... 270s Selecting previously unselected package libjs-jquery. 270s Preparing to unpack .../37-libjs-jquery_3.6.1+dfsg+~3.5.14-1_all.deb ... 270s Unpacking libjs-jquery (3.6.1+dfsg+~3.5.14-1) ... 270s Selecting previously unselected package libjs-underscore. 270s Preparing to unpack .../38-libjs-underscore_1.13.4~dfsg+~1.11.4-3_all.deb ... 270s Unpacking libjs-underscore (1.13.4~dfsg+~1.11.4-3) ... 270s Selecting previously unselected package libjs-sphinxdoc. 270s Preparing to unpack .../39-libjs-sphinxdoc_7.4.7-3_all.deb ... 270s Unpacking libjs-sphinxdoc (7.4.7-3) ... 270s Selecting previously unselected package libpython3.12t64:armhf. 270s Preparing to unpack .../40-libpython3.12t64_3.12.7-1_armhf.deb ... 270s Unpacking libpython3.12t64:armhf (3.12.7-1) ... 270s Selecting previously unselected package zlib1g-dev:armhf. 270s Preparing to unpack .../41-zlib1g-dev_1%3a1.3.dfsg+really1.3.1-1ubuntu1_armhf.deb ... 270s Unpacking zlib1g-dev:armhf (1:1.3.dfsg+really1.3.1-1ubuntu1) ... 270s Selecting previously unselected package libpython3.12-dev:armhf. 270s Preparing to unpack .../42-libpython3.12-dev_3.12.7-1_armhf.deb ... 270s Unpacking libpython3.12-dev:armhf (3.12.7-1) ... 270s Selecting previously unselected package libpython3-dev:armhf. 270s Preparing to unpack .../43-libpython3-dev_3.12.6-0ubuntu1_armhf.deb ... 270s Unpacking libpython3-dev:armhf (3.12.6-0ubuntu1) ... 270s Selecting previously unselected package libpython3-all-dev:armhf. 270s Preparing to unpack .../44-libpython3-all-dev_3.12.6-0ubuntu1_armhf.deb ... 270s Unpacking libpython3-all-dev:armhf (3.12.6-0ubuntu1) ... 270s Selecting previously unselected package sphinx-rtd-theme-common. 270s Preparing to unpack .../45-sphinx-rtd-theme-common_2.0.0+dfsg-2_all.deb ... 270s Unpacking sphinx-rtd-theme-common (2.0.0+dfsg-2) ... 270s Selecting previously unselected package python-skbuild-doc. 270s Preparing to unpack .../46-python-skbuild-doc_0.18.1-1_all.deb ... 270s Unpacking python-skbuild-doc (0.18.1-1) ... 270s Selecting previously unselected package python3-all. 270s Preparing to unpack .../47-python3-all_3.12.6-0ubuntu1_armhf.deb ... 270s Unpacking python3-all (3.12.6-0ubuntu1) ... 270s Selecting previously unselected package python3.12-dev. 270s Preparing to unpack .../48-python3.12-dev_3.12.7-1_armhf.deb ... 270s Unpacking python3.12-dev (3.12.7-1) ... 270s Selecting previously unselected package python3-dev. 270s Preparing to unpack .../49-python3-dev_3.12.6-0ubuntu1_armhf.deb ... 270s Unpacking python3-dev (3.12.6-0ubuntu1) ... 270s Selecting previously unselected package python3-all-dev. 270s Preparing to unpack .../50-python3-all-dev_3.12.6-0ubuntu1_armhf.deb ... 270s Unpacking python3-all-dev (3.12.6-0ubuntu1) ... 270s Selecting previously unselected package python3-packaging. 270s Preparing to unpack .../51-python3-packaging_24.1-1_all.deb ... 270s Unpacking python3-packaging (24.1-1) ... 270s Selecting previously unselected package python3-pyproject-hooks. 270s Preparing to unpack .../52-python3-pyproject-hooks_1.1.0-2_all.deb ... 270s Unpacking python3-pyproject-hooks (1.1.0-2) ... 270s Selecting previously unselected package python3-toml. 270s Preparing to unpack .../53-python3-toml_0.10.2-1_all.deb ... 270s Unpacking python3-toml (0.10.2-1) ... 270s Selecting previously unselected package python3-wheel. 270s Preparing to unpack .../54-python3-wheel_0.44.0-1_all.deb ... 270s Unpacking python3-wheel (0.44.0-1) ... 270s Selecting previously unselected package python3-build. 270s Preparing to unpack .../55-python3-build_1.2.1-1_all.deb ... 270s Unpacking python3-build (1.2.1-1) ... 270s Selecting previously unselected package python3-distlib. 270s Preparing to unpack .../56-python3-distlib_0.3.8-1_all.deb ... 270s Unpacking python3-distlib (0.3.8-1) ... 270s Selecting previously unselected package python3-filelock. 270s Preparing to unpack .../57-python3-filelock_3.15.4-1_all.deb ... 270s Unpacking python3-filelock (3.15.4-1) ... 271s Selecting previously unselected package python3-iniconfig. 271s Preparing to unpack .../58-python3-iniconfig_1.1.1-2_all.deb ... 271s Unpacking python3-iniconfig (1.1.1-2) ... 271s Selecting previously unselected package python3-pip. 271s Preparing to unpack .../59-python3-pip_24.2+dfsg-1_all.deb ... 271s Unpacking python3-pip (24.2+dfsg-1) ... 271s Selecting previously unselected package python3-pip-whl. 271s Preparing to unpack .../60-python3-pip-whl_24.2+dfsg-1_all.deb ... 271s Unpacking python3-pip-whl (24.2+dfsg-1) ... 271s Selecting previously unselected package python3-platformdirs. 271s Preparing to unpack .../61-python3-platformdirs_4.2.2-1_all.deb ... 271s Unpacking python3-platformdirs (4.2.2-1) ... 271s Selecting previously unselected package python3-pluggy. 271s Preparing to unpack .../62-python3-pluggy_1.5.0-1_all.deb ... 271s Unpacking python3-pluggy (1.5.0-1) ... 271s Selecting previously unselected package python3-pytest. 271s Preparing to unpack .../63-python3-pytest_8.3.2-1_all.deb ... 271s Unpacking python3-pytest (8.3.2-1) ... 271s Selecting previously unselected package python3-pytest-mock. 271s Preparing to unpack .../64-python3-pytest-mock_3.14.0-1_all.deb ... 271s Unpacking python3-pytest-mock (3.14.0-1) ... 271s Selecting previously unselected package python3-setuptools-whl. 271s Preparing to unpack .../65-python3-setuptools-whl_75.2.0-1_all.deb ... 271s Unpacking python3-setuptools-whl (75.2.0-1) ... 271s Selecting previously unselected package python3-skbuild. 271s Preparing to unpack .../66-python3-skbuild_0.18.1-1_all.deb ... 271s Unpacking python3-skbuild (0.18.1-1) ... 271s Selecting previously unselected package python3-wheel-whl. 271s Preparing to unpack .../67-python3-wheel-whl_0.44.0-1_all.deb ... 271s Unpacking python3-wheel-whl (0.44.0-1) ... 271s Selecting previously unselected package python3-virtualenv. 271s Preparing to unpack .../68-python3-virtualenv_20.26.2+ds-1_all.deb ... 271s Unpacking python3-virtualenv (20.26.2+ds-1) ... 271s Selecting previously unselected package autopkgtest-satdep. 271s Preparing to unpack .../69-1-autopkgtest-satdep.deb ... 271s Unpacking autopkgtest-satdep (0) ... 271s Setting up python3-iniconfig (1.1.1-2) ... 271s Setting up python3-setuptools-whl (75.2.0-1) ... 271s Setting up python3-filelock (3.15.4-1) ... 271s Setting up fonts-lato (2.015-1) ... 271s Setting up python3-pip-whl (24.2+dfsg-1) ... 271s Setting up linux-libc-dev:armhf (6.11.0-8.8) ... 271s Setting up python3-all (3.12.6-0ubuntu1) ... 271s Setting up python3-distlib (0.3.8-1) ... 271s Setting up libgomp1:armhf (14.2.0-7ubuntu1) ... 271s Setting up python3-wheel (0.44.0-1) ... 272s Setting up python3-platformdirs (4.2.2-1) ... 272s Setting up liberror-perl (0.17029-2) ... 272s Setting up libpython3.12t64:armhf (3.12.7-1) ... 272s Setting up python3-packaging (24.1-1) ... 272s Setting up rpcsvc-proto (1.4.2-0ubuntu7) ... 272s Setting up python3-pyproject-hooks (1.1.0-2) ... 272s Setting up libmpc3:armhf (1.3.1-1build2) ... 272s Setting up cython3 (3.0.11+dfsg-1ubuntu1) ... 273s Setting up libjsoncpp25:armhf (1.9.5-6build1) ... 273s Setting up python3-pip (24.2+dfsg-1) ... 274s Setting up python3-toml (0.10.2-1) ... 274s Setting up python3-pluggy (1.5.0-1) ... 274s Setting up libubsan1:armhf (14.2.0-7ubuntu1) ... 274s Setting up librhash0:armhf (1.4.3-3build1) ... 274s Setting up libcrypt-dev:armhf (1:4.4.36-4build1) ... 274s Setting up libasan8:armhf (14.2.0-7ubuntu1) ... 274s Setting up git-man (1:2.45.2-1ubuntu1) ... 274s Setting up cmake-data (3.30.3-1) ... 274s Setting up libjs-jquery (3.6.1+dfsg+~3.5.14-1) ... 274s Setting up libgcc-14-dev:armhf (14.2.0-7ubuntu1) ... 274s Setting up libisl23:armhf (0.27-1) ... 274s Setting up python3-build (1.2.1-1) ... 274s Setting up libc-dev-bin (2.40-1ubuntu3) ... 274s Setting up python3-wheel-whl (0.44.0-1) ... 274s Setting up fonts-font-awesome (5.0.10+really4.7.0~dfsg-4.1) ... 274s Setting up sphinx-rtd-theme-common (2.0.0+dfsg-2) ... 274s Setting up libcc1-0:armhf (14.2.0-7ubuntu1) ... 274s Setting up cpp-14-arm-linux-gnueabihf (14.2.0-7ubuntu1) ... 274s Setting up libjs-underscore (1.13.4~dfsg+~1.11.4-3) ... 274s Setting up python3-pytest (8.3.2-1) ... 275s Setting up python3-virtualenv (20.26.2+ds-1) ... 275s Setting up gcc-14-arm-linux-gnueabihf (14.2.0-7ubuntu1) ... 275s Setting up git (1:2.45.2-1ubuntu1) ... 275s Setting up libjs-sphinxdoc (7.4.7-3) ... 275s Setting up cpp-14 (14.2.0-7ubuntu1) ... 275s Setting up python3-pytest-mock (3.14.0-1) ... 275s Setting up cmake (3.30.3-1) ... 275s Setting up libc6-dev:armhf (2.40-1ubuntu3) ... 275s Setting up libstdc++-14-dev:armhf (14.2.0-7ubuntu1) ... 275s Setting up cpp-arm-linux-gnueabihf (4:14.1.0-2ubuntu1) ... 275s Setting up gcc-arm-linux-gnueabihf (4:14.1.0-2ubuntu1) ... 275s Setting up g++-14-arm-linux-gnueabihf (14.2.0-7ubuntu1) ... 275s Setting up python-skbuild-doc (0.18.1-1) ... 275s Setting up python3-skbuild (0.18.1-1) ... 275s Setting up gcc-14 (14.2.0-7ubuntu1) ... 275s Setting up libexpat1-dev:armhf (2.6.2-2) ... 275s Setting up zlib1g-dev:armhf (1:1.3.dfsg+really1.3.1-1ubuntu1) ... 275s Setting up cpp (4:14.1.0-2ubuntu1) ... 275s Setting up g++-14 (14.2.0-7ubuntu1) ... 275s Setting up g++-arm-linux-gnueabihf (4:14.1.0-2ubuntu1) ... 275s Setting up libpython3.12-dev:armhf (3.12.7-1) ... 275s Setting up gcc (4:14.1.0-2ubuntu1) ... 275s Setting up python3.12-dev (3.12.7-1) ... 275s Setting up g++ (4:14.1.0-2ubuntu1) ... 275s update-alternatives: using /usr/bin/g++ to provide /usr/bin/c++ (c++) in auto mode 275s Setting up build-essential (12.10ubuntu1) ... 275s Setting up libpython3-dev:armhf (3.12.6-0ubuntu1) ... 275s Setting up libpython3-all-dev:armhf (3.12.6-0ubuntu1) ... 275s Setting up python3-dev (3.12.6-0ubuntu1) ... 275s Setting up python3-all-dev (3.12.6-0ubuntu1) ... 275s Setting up autopkgtest-satdep (0) ... 275s Processing triggers for man-db (2.12.1-3) ... 276s Processing triggers for libc-bin (2.40-1ubuntu3) ... 293s (Reading database ... 69132 files and directories currently installed.) 293s Removing autopkgtest-satdep (0) ... 299s autopkgtest [10:41:59]: test testsuite: [----------------------- 301s + cp -r tests /tmp/autopkgtest.PZgfUf/autopkgtest_tmp 301s + cp pyproject.toml /tmp/autopkgtest.PZgfUf/autopkgtest_tmp 301s + cd /tmp/autopkgtest.PZgfUf/autopkgtest_tmp 301s + py3versions -s 301s + 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 303s ============================= test session starts ============================== 303s platform linux -- Python 3.12.7, pytest-8.3.2, pluggy-1.5.0 303s installed packages of interest: build==1.2.1 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 303s No cmake3 executable found on PATH 303s /usr/bin/cmake: cmake version 3.30.3 303s No ninja executable found on PATH 303s rootdir: /tmp/autopkgtest.PZgfUf/autopkgtest_tmp 303s configfile: pyproject.toml 303s testpaths: tests 303s plugins: typeguard-4.3.0, mock-3.14.0 303s collected 238 items / 17 deselected / 1 skipped / 221 selected 303s 303s tests/test_broken_project.py FFFFFFF [ 3%] 303s tests/test_cmake_target.py F [ 3%] 303s tests/test_cmakelists_not_in_top_level_dir.py FFFF [ 5%] 308s tests/test_cmaker.py ............... [ 12%] 308s tests/test_command_line.py FFFFFFFFFFFFF [ 18%] 308s tests/test_constants.py . [ 18%] 308s tests/test_cython_flags.py F [ 19%] 308s tests/test_filter_manifest.py F [ 19%] 309s tests/test_hello_cpp.py FFFFF [ 21%] 309s tests/test_hello_cython.py FFF [ 23%] 309s tests/test_hello_pure.py FFFF [ 24%] 309s tests/test_include_exclude_data.py FF [ 25%] 309s tests/test_issue284_build_ext_inplace.py F [ 26%] 309s tests/test_issue335_support_cmake_source_dir.py F [ 26%] 309s tests/test_issue342_cmake_osx_args_in_setup.py FFFFFFFFF [ 30%] 309s tests/test_issue352_isolated_environment_support.py F [ 31%] 309s tests/test_issue668_symbol_visibility.py FF [ 32%] 309s tests/test_logging.py .. [ 33%] 310s tests/test_manifest_in.py F [ 33%] 310s tests/test_outside_project_root.py FFF [ 34%] 310s tests/test_platform.py .............s [ 41%] 312s tests/test_setup.py ....FFFFFFFFFFFFFF..........FFFFFFFFFFFFFFFFFFFFFFFF [ 64%] 313s FFFFFFFFFsssFsssFsssFsssFsssFsssFsssFsssFFFFF [ 85%] 313s tests/test_skbuild.py .sFFFssss [ 89%] 314s tests/test_skbuild_variable.py FFF [ 90%] 314s tests/test_utils.py ..................... [100%] 314s 314s =================================== FAILURES =================================== 314s ____________________ test_cmakelists_with_fatalerror_fails _____________________ 314s 314s capfd = <_pytest.capture.CaptureFixture object at 0xf3568fc0> 314s 314s def test_cmakelists_with_fatalerror_fails(capfd): 314s with push_dir(): 314s 314s @project_setup_py_test("fail-with-fatal-error-cmakelists", ["build"], disable_languages_test=True) 314s def should_fail(): 314s pass 314s 314s with pytest.raises(SystemExit) as excinfo: 314s > should_fail() 314s 314s capfd = <_pytest.capture.CaptureFixture object at 0xf3568fc0> 314s excinfo = 314s should_fail = .should_fail at 0xf34b06b8> 314s 314s tests/test_broken_project.py:31: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s tests/__init__.py:255: in wrapped 314s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 314s disable_languages_test = True 314s fun = .should_fail at 0xf34b0618> 314s iargs = () 314s ikwargs = {} 314s ret = False 314s wrapped = .should_fail at 0xf34b06b8> 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-0/should_fail0') 314s setup_args = ['build'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-0/should_fail0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s ----------------------------- Captured stdout call ----------------------------- 314s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-0/should_fail0/.git/ 314s [master (root-commit) 74523e2] Initial commit 314s 2 files changed, 20 insertions(+) 314s create mode 100644 CMakeLists.txt 314s create mode 100644 setup.py 314s ----------------------------- Captured stderr call ----------------------------- 314s hint: Using 'master' as the name for the initial branch. This default branch name 314s hint: is subject to change. To configure the initial branch name to use in all 314s hint: of your new repositories, which will suppress this warning, call: 314s hint: 314s hint: git config --global init.defaultBranch 314s hint: 314s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 314s hint: 'development'. The just-created branch can be renamed via this command: 314s hint: 314s hint: git branch -m 314s ____________________ test_cmakelists_with_syntaxerror_fails ____________________ 314s 314s capfd = <_pytest.capture.CaptureFixture object at 0xf354d8d0> 314s 314s def test_cmakelists_with_syntaxerror_fails(capfd): 314s with push_dir(): 314s 314s @project_setup_py_test("fail-with-syntax-error-cmakelists", ["build"], disable_languages_test=True) 314s def should_fail(): 314s pass 314s 314s with pytest.raises(SystemExit) as excinfo: 314s > should_fail() 314s 314s capfd = <_pytest.capture.CaptureFixture object at 0xf354d8d0> 314s excinfo = 314s should_fail = .should_fail at 0xf34c5a28> 314s 314s tests/test_broken_project.py:49: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s tests/__init__.py:255: in wrapped 314s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 314s disable_languages_test = True 314s fun = .should_fail at 0xf34c59d8> 314s iargs = () 314s ikwargs = {} 314s ret = False 314s wrapped = .should_fail at 0xf34c5a28> 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-1/should_fail0') 314s setup_args = ['build'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-1/should_fail0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s ----------------------------- Captured stdout call ----------------------------- 314s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-1/should_fail0/.git/ 314s [master (root-commit) 1a92c6e] Initial commit 314s 2 files changed, 20 insertions(+) 314s create mode 100644 CMakeLists.txt 314s create mode 100644 setup.py 314s ----------------------------- Captured stderr call ----------------------------- 314s hint: Using 'master' as the name for the initial branch. This default branch name 314s hint: is subject to change. To configure the initial branch name to use in all 314s hint: of your new repositories, which will suppress this warning, call: 314s hint: 314s hint: git config --global init.defaultBranch 314s hint: 314s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 314s hint: 'development'. The just-created branch can be renamed via this command: 314s hint: 314s hint: git branch -m 314s ______________________ test_hello_with_compileerror_fails ______________________ 314s 314s capfd = <_pytest.capture.CaptureFixture object at 0xf354d1b0> 314s 314s def test_hello_with_compileerror_fails(capfd): 314s with push_dir(): 314s 314s @project_setup_py_test("fail-hello-with-compile-error", ["build"]) 314s def should_fail(): 314s pass 314s 314s with pytest.raises(SystemExit) as excinfo: 314s > should_fail() 314s 314s capfd = <_pytest.capture.CaptureFixture object at 0xf354d1b0> 314s excinfo = 314s should_fail = .should_fail at 0xf3461258> 314s 314s tests/test_broken_project.py:67: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s tests/__init__.py:255: in wrapped 314s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 314s disable_languages_test = False 314s fun = .should_fail at 0xf3461208> 314s iargs = () 314s ikwargs = {} 314s ret = False 314s wrapped = .should_fail at 0xf3461258> 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-2/should_fail0') 314s setup_args = ['build'], disable_languages_test = False 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = False 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-2/should_fail0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s ----------------------------- Captured stdout call ----------------------------- 314s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-2/should_fail0/.git/ 314s [master (root-commit) 40b268f] Initial commit 314s 6 files changed, 97 insertions(+) 314s create mode 100644 CMakeLists.txt 314s create mode 100644 hello/CMakeLists.txt 314s create mode 100644 hello/__init__.py 314s create mode 100644 hello/__main__.py 314s create mode 100644 hello/_hello.cxx 314s create mode 100644 setup.py 314s ----------------------------- Captured stderr call ----------------------------- 314s hint: Using 'master' as the name for the initial branch. This default branch name 314s hint: is subject to change. To configure the initial branch name to use in all 314s hint: of your new repositories, which will suppress this warning, call: 314s hint: 314s hint: git config --global init.defaultBranch 314s hint: 314s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 314s hint: 'development'. The just-created branch can be renamed via this command: 314s hint: 314s hint: git branch -m 314s ____________________ test_invalid_cmake[CalledProcessError] ____________________ 314s 314s exception = 314s mocker = 314s 314s @pytest.mark.parametrize("exception", [CalledProcessError, OSError]) 314s def test_invalid_cmake(exception, mocker): 314s exceptions = { 314s OSError: OSError("Unknown error"), 314s CalledProcessError: CalledProcessError(1, [CMAKE_DEFAULT_EXECUTABLE, "--version"]), 314s } 314s 314s run_original = run 314s 314s def run_mock(*args, **kwargs): 314s if args[0] == [CMAKE_DEFAULT_EXECUTABLE, "--version"]: 314s raise exceptions[exception] 314s return run_original(*args, **kwargs) 314s 314s mocker.patch("skbuild.cmaker.subprocess.run", new=run_mock) 314s 314s with push_dir(): 314s 314s @project_setup_py_test("hello-no-language", ["build"], disable_languages_test=True) 314s def should_fail(): 314s pass 314s 314s with pytest.raises(SystemExit) as excinfo: 314s > should_fail() 314s 314s exception = 314s exceptions = {: OSError('Unknown error'), : CalledProcessError(1, ['/usr/bin/cmake', '--version'])} 314s excinfo = 314s mocker = 314s run_mock = .run_mock at 0xf3461398> 314s run_original = 314s should_fail = .should_fail at 0xf3461b18> 314s 314s tests/test_broken_project.py:100: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s tests/__init__.py:255: in wrapped 314s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 314s disable_languages_test = True 314s fun = .should_fail at 0xf3461618> 314s iargs = () 314s ikwargs = {} 314s ret = False 314s wrapped = .should_fail at 0xf3461b18> 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-3/should_fail0') 314s setup_args = ['build'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-3/should_fail0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s ----------------------------- Captured stdout call ----------------------------- 314s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-3/should_fail0/.git/ 314s [master (root-commit) 08f9ddf] Initial commit 314s 2 files changed, 16 insertions(+) 314s create mode 100644 CMakeLists.txt 314s create mode 100644 setup.py 314s ----------------------------- Captured stderr call ----------------------------- 314s hint: Using 'master' as the name for the initial branch. This default branch name 314s hint: is subject to change. To configure the initial branch name to use in all 314s hint: of your new repositories, which will suppress this warning, call: 314s hint: 314s hint: git config --global init.defaultBranch 314s hint: 314s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 314s hint: 'development'. The just-created branch can be renamed via this command: 314s hint: 314s hint: git branch -m 314s _________________________ test_invalid_cmake[OSError] __________________________ 314s 314s exception = 314s mocker = 314s 314s @pytest.mark.parametrize("exception", [CalledProcessError, OSError]) 314s def test_invalid_cmake(exception, mocker): 314s exceptions = { 314s OSError: OSError("Unknown error"), 314s CalledProcessError: CalledProcessError(1, [CMAKE_DEFAULT_EXECUTABLE, "--version"]), 314s } 314s 314s run_original = run 314s 314s def run_mock(*args, **kwargs): 314s if args[0] == [CMAKE_DEFAULT_EXECUTABLE, "--version"]: 314s raise exceptions[exception] 314s return run_original(*args, **kwargs) 314s 314s mocker.patch("skbuild.cmaker.subprocess.run", new=run_mock) 314s 314s with push_dir(): 314s 314s @project_setup_py_test("hello-no-language", ["build"], disable_languages_test=True) 314s def should_fail(): 314s pass 314s 314s with pytest.raises(SystemExit) as excinfo: 314s > should_fail() 314s 314s exception = 314s exceptions = {: OSError('Unknown error'), : CalledProcessError(1, ['/usr/bin/cmake', '--version'])} 314s excinfo = 314s mocker = 314s run_mock = .run_mock at 0xf3461ed8> 314s run_original = 314s should_fail = .should_fail at 0xf34617a8> 314s 314s tests/test_broken_project.py:100: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s tests/__init__.py:255: in wrapped 314s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 314s disable_languages_test = True 314s fun = .should_fail at 0xf3461758> 314s iargs = () 314s ikwargs = {} 314s ret = False 314s wrapped = .should_fail at 0xf34617a8> 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-4/should_fail0') 314s setup_args = ['build'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-4/should_fail0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s ----------------------------- Captured stdout call ----------------------------- 314s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-4/should_fail0/.git/ 314s [master (root-commit) 08f9ddf] Initial commit 314s 2 files changed, 16 insertions(+) 314s create mode 100644 CMakeLists.txt 314s create mode 100644 setup.py 314s ----------------------------- Captured stderr call ----------------------------- 314s hint: Using 'master' as the name for the initial branch. This default branch name 314s hint: is subject to change. To configure the initial branch name to use in all 314s hint: of your new repositories, which will suppress this warning, call: 314s hint: 314s hint: git config --global init.defaultBranch 314s hint: 314s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 314s hint: 'development'. The just-created branch can be renamed via this command: 314s hint: 314s hint: git branch -m 314s _________________________ test_first_invalid_generator _________________________ 314s 314s mocker = 314s capfd = <_pytest.capture.CaptureFixture object at 0xf354be10> 314s 314s def test_first_invalid_generator(mocker, capfd): 314s platform = get_platform() 314s default_generators = [CMakeGenerator("Invalid")] 314s default_generators.extend(platform.default_generators) 314s mocker.patch.object( 314s type(platform), "default_generators", new_callable=mocker.PropertyMock, return_value=default_generators 314s ) 314s 314s mocker.patch("skbuild.cmaker.get_platform", return_value=platform) 314s 314s with push_dir(), push_env(CMAKE_GENERATOR=None): 314s 314s @project_setup_py_test("hello-no-language", ["build"]) 314s def run_build(): 314s pass 314s 314s > run_build() 314s 314s capfd = <_pytest.capture.CaptureFixture object at 0xf354be10> 314s default_generators = [, , ] 314s mocker = 314s platform = 314s run_build = .run_build at 0xf3461c58> 314s 314s tests/test_broken_project.py:124: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s tests/__init__.py:255: in wrapped 314s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 314s disable_languages_test = False 314s fun = .run_build at 0xf34615c8> 314s iargs = () 314s ikwargs = {} 314s ret = False 314s wrapped = .run_build at 0xf3461c58> 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-5/run_build0') 314s setup_args = ['build'], disable_languages_test = False 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = False 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-5/run_build0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s ----------------------------- Captured stdout call ----------------------------- 314s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-5/run_build0/.git/ 314s [master (root-commit) 08f9ddf] Initial commit 314s 2 files changed, 16 insertions(+) 314s create mode 100644 CMakeLists.txt 314s create mode 100644 setup.py 314s ----------------------------- Captured stderr call ----------------------------- 314s hint: Using 'master' as the name for the initial branch. This default branch name 314s hint: is subject to change. To configure the initial branch name to use in all 314s hint: of your new repositories, which will suppress this warning, call: 314s hint: 314s hint: git config --global init.defaultBranch 314s hint: 314s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 314s hint: 'development'. The just-created branch can be renamed via this command: 314s hint: 314s hint: git branch -m 314s ____________________________ test_invalid_generator ____________________________ 314s 314s mocker = 314s capfd = <_pytest.capture.CaptureFixture object at 0xf3421270> 314s 314s def test_invalid_generator(mocker, capfd): 314s platform = get_platform() 314s mocker.patch.object( 314s type(platform), "default_generators", new_callable=mocker.PropertyMock, return_value=[CMakeGenerator("Invalid")] 314s ) 314s mocker.patch("skbuild.cmaker.get_platform", return_value=platform) 314s 314s with push_dir(), push_env(CMAKE_GENERATOR=None): 314s 314s @project_setup_py_test("hello-no-language", ["build"]) 314s def should_fail(): 314s pass 314s 314s with pytest.raises(SystemExit) as excinfo: 314s > should_fail() 314s 314s capfd = <_pytest.capture.CaptureFixture object at 0xf3421270> 314s excinfo = 314s mocker = 314s platform = 314s should_fail = .should_fail at 0xf341b4d8> 314s 314s tests/test_broken_project.py:144: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s tests/__init__.py:255: in wrapped 314s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 314s disable_languages_test = False 314s fun = .should_fail at 0xf341b5c8> 314s iargs = () 314s ikwargs = {} 314s ret = False 314s wrapped = .should_fail at 0xf341b4d8> 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-6/should_fail0') 314s setup_args = ['build'], disable_languages_test = False 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = False 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-6/should_fail0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s ----------------------------- Captured stdout call ----------------------------- 314s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-6/should_fail0/.git/ 314s [master (root-commit) 08f9ddf] Initial commit 314s 2 files changed, 16 insertions(+) 314s create mode 100644 CMakeLists.txt 314s create mode 100644 setup.py 314s ----------------------------- Captured stderr call ----------------------------- 314s hint: Using 'master' as the name for the initial branch. This default branch name 314s hint: is subject to change. To configure the initial branch name to use in all 314s hint: of your new repositories, which will suppress this warning, call: 314s hint: 314s hint: git config --global init.defaultBranch 314s hint: 314s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 314s hint: 'development'. The just-created branch can be renamed via this command: 314s hint: 314s hint: git branch -m 314s ___________________________ test_cmake_target_build ____________________________ 314s 314s iargs = () 314s ikwargs = {'capsys': <_pytest.capture.CaptureFixture object at 0xf344ee28>} 314s 314s @functools.wraps(fun) 314s def wrapped(*iargs, **ikwargs): 314s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 314s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 314s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 314s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 314s 314s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 314s 314s disable_languages_test = True 314s fun = 314s iargs = () 314s ikwargs = {'capsys': <_pytest.capture.CaptureFixture object at 0xf344ee28>} 314s ret = False 314s wrapped = 314s 314s tests/__init__.py:255: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-7/test_cmake_target_build0') 314s setup_args = ['build'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-7/test_cmake_target_build0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s ----------------------------- Captured stdout call ----------------------------- 314s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-7/test_cmake_target_build0/.git/ 314s [master (root-commit) 7e4ca19] Initial commit 314s 2 files changed, 26 insertions(+) 314s create mode 100644 CMakeLists.txt 314s create mode 100644 setup.py 314s ----------------------------- Captured stderr call ----------------------------- 314s hint: Using 'master' as the name for the initial branch. This default branch name 314s hint: is subject to change. To configure the initial branch name to use in all 314s hint: of your new repositories, which will suppress this warning, call: 314s hint: 314s hint: git config --global init.defaultBranch 314s hint: 314s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 314s hint: 'development'. The just-created branch can be renamed via this command: 314s hint: 314s hint: git branch -m 314s __________________________________ test_build __________________________________ 314s 314s iargs = () 314s ikwargs = {'capsys': <_pytest.capture.CaptureFixture object at 0xf344e318>} 314s 314s @functools.wraps(fun) 314s def wrapped(*iargs, **ikwargs): 314s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 314s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 314s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 314s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 314s 314s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 314s 314s disable_languages_test = True 314s fun = 314s iargs = () 314s ikwargs = {'capsys': <_pytest.capture.CaptureFixture object at 0xf344e318>} 314s ret = False 314s wrapped = 314s 314s tests/__init__.py:255: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-8/test_build0') 314s setup_args = ['build'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-8/test_build0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s ----------------------------- Captured stdout call ----------------------------- 314s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-8/test_build0/.git/ 314s [master (root-commit) ede8cb4] Initial commit 314s 5 files changed, 94 insertions(+) 314s create mode 100644 hello/CMakeLists.txt 314s create mode 100644 hello/__init__.py 314s create mode 100644 hello/__main__.py 314s create mode 100644 hello/_hello.cxx 314s create mode 100644 setup.py 314s ----------------------------- Captured stderr call ----------------------------- 314s hint: Using 'master' as the name for the initial branch. This default branch name 314s hint: is subject to change. To configure the initial branch name to use in all 314s hint: of your new repositories, which will suppress this warning, call: 314s hint: 314s hint: git config --global init.defaultBranch 314s hint: 314s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 314s hint: 'development'. The just-created branch can be renamed via this command: 314s hint: 314s hint: git branch -m 314s _____________________ test_cmake_source_dir[invalid-True] ______________________ 314s 314s cmake_source_dir = 'invalid', expected_failed = True 314s 314s @pytest.mark.parametrize( 314s ("cmake_source_dir", "expected_failed"), 314s [ 314s ("invalid", True), 314s ("", False), 314s (".", False), 314s ], 314s ) 314s def test_cmake_source_dir(cmake_source_dir, expected_failed): 314s tmp_dir = _tmpdir("test_cmake_source_dir") 314s 314s tmp_dir.join("setup.py").write( 314s textwrap.dedent( 314s f""" 314s from skbuild import setup 314s setup( 314s name="test_cmake_source_dir", 314s version="1.2.3", 314s description="a minimal example package", 314s author='The scikit-build team', 314s license="MIT", 314s cmake_source_dir="{cmake_source_dir}" 314s ) 314s """ 314s ) 314s ) 314s 314s failed = False 314s message = "" 314s try: 314s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 314s 314s cmake_source_dir = 'invalid' 314s expected_failed = True 314s failed = False 314s message = '' 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-9/test_cmake_source_dir0') 314s 314s tests/test_cmakelists_not_in_top_level_dir.py:60: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-9/test_cmake_source_dir0') 314s setup_args = ['build'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-9/test_cmake_source_dir0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s ________________________ test_cmake_source_dir[-False] _________________________ 314s 314s cmake_source_dir = '', expected_failed = False 314s 314s @pytest.mark.parametrize( 314s ("cmake_source_dir", "expected_failed"), 314s [ 314s ("invalid", True), 314s ("", False), 314s (".", False), 314s ], 314s ) 314s def test_cmake_source_dir(cmake_source_dir, expected_failed): 314s tmp_dir = _tmpdir("test_cmake_source_dir") 314s 314s tmp_dir.join("setup.py").write( 314s textwrap.dedent( 314s f""" 314s from skbuild import setup 314s setup( 314s name="test_cmake_source_dir", 314s version="1.2.3", 314s description="a minimal example package", 314s author='The scikit-build team', 314s license="MIT", 314s cmake_source_dir="{cmake_source_dir}" 314s ) 314s """ 314s ) 314s ) 314s 314s failed = False 314s message = "" 314s try: 314s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 314s 314s cmake_source_dir = '' 314s expected_failed = False 314s failed = False 314s message = '' 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-10/test_cmake_source_dir0') 314s 314s tests/test_cmakelists_not_in_top_level_dir.py:60: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-10/test_cmake_source_dir0') 314s setup_args = ['build'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-10/test_cmake_source_dir0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s ________________________ test_cmake_source_dir[.-False] ________________________ 314s 314s cmake_source_dir = '.', expected_failed = False 314s 314s @pytest.mark.parametrize( 314s ("cmake_source_dir", "expected_failed"), 314s [ 314s ("invalid", True), 314s ("", False), 314s (".", False), 314s ], 314s ) 314s def test_cmake_source_dir(cmake_source_dir, expected_failed): 314s tmp_dir = _tmpdir("test_cmake_source_dir") 314s 314s tmp_dir.join("setup.py").write( 314s textwrap.dedent( 314s f""" 314s from skbuild import setup 314s setup( 314s name="test_cmake_source_dir", 314s version="1.2.3", 314s description="a minimal example package", 314s author='The scikit-build team', 314s license="MIT", 314s cmake_source_dir="{cmake_source_dir}" 314s ) 314s """ 314s ) 314s ) 314s 314s failed = False 314s message = "" 314s try: 314s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 314s 314s cmake_source_dir = '.' 314s expected_failed = False 314s failed = False 314s message = '' 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-11/test_cmake_source_dir0') 314s 314s tests/test_cmakelists_not_in_top_level_dir.py:60: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-11/test_cmake_source_dir0') 314s setup_args = ['build'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-11/test_cmake_source_dir0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s __________________________________ test_help ___________________________________ 314s 314s iargs = () 314s ikwargs = {'capsys': <_pytest.capture.CaptureFixture object at 0xf3437af8>} 314s 314s @functools.wraps(fun) 314s def wrapped(*iargs, **ikwargs): 314s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 314s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 314s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 314s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 314s 314s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 314s 314s disable_languages_test = True 314s fun = 314s iargs = () 314s ikwargs = {'capsys': <_pytest.capture.CaptureFixture object at 0xf3437af8>} 314s ret = False 314s wrapped = 314s 314s tests/__init__.py:255: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-22/test_help0') 314s setup_args = ['--help'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-22/test_help0') 314s setup_args = ['--help'] 314s 314s tests/__init__.py:218: AttributeError 314s ----------------------------- Captured stdout call ----------------------------- 314s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-22/test_help0/.git/ 314s [master (root-commit) d9ba1af] Initial commit 314s 2 files changed, 16 insertions(+) 314s create mode 100644 CMakeLists.txt 314s create mode 100644 setup.py 314s ----------------------------- Captured stderr call ----------------------------- 314s hint: Using 'master' as the name for the initial branch. This default branch name 314s hint: is subject to change. To configure the initial branch name to use in all 314s hint: of your new repositories, which will suppress this warning, call: 314s hint: 314s hint: git config --global init.defaultBranch 314s hint: 314s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 314s hint: 'development'. The just-created branch can be renamed via this command: 314s hint: 314s hint: git branch -m 314s ____________________________ test_metadata_display _____________________________ 314s 314s iargs = () 314s ikwargs = {'capsys': <_pytest.capture.CaptureFixture object at 0xf34f3a98>} 314s 314s @functools.wraps(fun) 314s def wrapped(*iargs, **ikwargs): 314s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 314s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 314s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 314s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 314s 314s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 314s 314s disable_languages_test = True 314s fun = 314s iargs = () 314s ikwargs = {'capsys': <_pytest.capture.CaptureFixture object at 0xf34f3a98>} 314s ret = False 314s wrapped = 314s 314s tests/__init__.py:255: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-23/test_metadata_display0') 314s setup_args = ['--author', '--name'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-23/test_metadata_display0') 314s setup_args = ['--author', '--name'] 314s 314s tests/__init__.py:218: AttributeError 314s ----------------------------- Captured stdout call ----------------------------- 314s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-23/test_metadata_display0/.git/ 314s [master (root-commit) d9ba1af] Initial commit 314s 2 files changed, 16 insertions(+) 314s create mode 100644 CMakeLists.txt 314s create mode 100644 setup.py 314s ----------------------------- Captured stderr call ----------------------------- 314s hint: Using 'master' as the name for the initial branch. This default branch name 314s hint: is subject to change. To configure the initial branch name to use in all 314s hint: of your new repositories, which will suppress this warning, call: 314s hint: 314s hint: git config --global init.defaultBranch 314s hint: 314s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 314s hint: 'development'. The just-created branch can be renamed via this command: 314s hint: 314s hint: git branch -m 314s _______________________________ test_no_command ________________________________ 314s 314s def test_no_command(): 314s with push_dir(): 314s 314s @project_setup_py_test("hello-no-language", [], disable_languages_test=True) 314s def run(): 314s pass 314s 314s failed = False 314s try: 314s > run() 314s 314s failed = False 314s run = .run at 0xf341b898> 314s 314s tests/test_command_line.py:62: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s tests/__init__.py:255: in wrapped 314s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 314s disable_languages_test = True 314s fun = .run at 0xf341b8e8> 314s iargs = () 314s ikwargs = {} 314s ret = False 314s wrapped = .run at 0xf341b898> 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-24/run0'), setup_args = [] 314s disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-24/run0') 314s setup_args = [] 314s 314s tests/__init__.py:218: AttributeError 314s ----------------------------- Captured stdout call ----------------------------- 314s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-24/run0/.git/ 314s [master (root-commit) d9ba1af] Initial commit 314s 2 files changed, 16 insertions(+) 314s create mode 100644 CMakeLists.txt 314s create mode 100644 setup.py 314s ----------------------------- Captured stderr call ----------------------------- 314s hint: Using 'master' as the name for the initial branch. This default branch name 314s hint: is subject to change. To configure the initial branch name to use in all 314s hint: of your new repositories, which will suppress this warning, call: 314s hint: 314s hint: git config --global init.defaultBranch 314s hint: 314s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 314s hint: 'development'. The just-created branch can be renamed via this command: 314s hint: 314s hint: git branch -m 314s _____________________________ test_invalid_command _____________________________ 314s 314s def test_invalid_command(): 314s with push_dir(): 314s 314s @project_setup_py_test("hello-no-language", ["unknown"], disable_languages_test=True) 314s def run(): 314s pass 314s 314s failed = False 314s try: 314s > run() 314s 314s failed = False 314s run = .run at 0xf341b758> 314s 314s tests/test_command_line.py:79: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s tests/__init__.py:255: in wrapped 314s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 314s disable_languages_test = True 314s fun = .run at 0xf341b528> 314s iargs = () 314s ikwargs = {} 314s ret = False 314s wrapped = .run at 0xf341b758> 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-25/run0') 314s setup_args = ['unknown'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-25/run0') 314s setup_args = ['unknown'] 314s 314s tests/__init__.py:218: AttributeError 314s ----------------------------- Captured stdout call ----------------------------- 314s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-25/run0/.git/ 314s [master (root-commit) d9ba1af] Initial commit 314s 2 files changed, 16 insertions(+) 314s create mode 100644 CMakeLists.txt 314s create mode 100644 setup.py 314s ----------------------------- Captured stderr call ----------------------------- 314s hint: Using 'master' as the name for the initial branch. This default branch name 314s hint: is subject to change. To configure the initial branch name to use in all 314s hint: of your new repositories, which will suppress this warning, call: 314s hint: 314s hint: git config --global init.defaultBranch 314s hint: 314s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 314s hint: 'development'. The just-created branch can be renamed via this command: 314s hint: 314s hint: git branch -m 314s ___________________________ test_too_many_separators ___________________________ 314s 314s def test_too_many_separators(): 314s with push_dir(): 314s 314s @project_setup_py_test("hello-no-language", ["--"] * 3, disable_languages_test=True) 314s def run(): 314s pass 314s 314s failed = False 314s try: 314s > run() 314s 314s failed = False 314s run = .run at 0xf3461618> 314s 314s tests/test_command_line.py:96: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s tests/__init__.py:255: in wrapped 314s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 314s disable_languages_test = True 314s fun = .run at 0xf3461258> 314s iargs = () 314s ikwargs = {} 314s ret = False 314s wrapped = .run at 0xf3461618> 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-26/run0') 314s setup_args = ['--', '--', '--'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-26/run0') 314s setup_args = ['--', '--', '--'] 314s 314s tests/__init__.py:218: AttributeError 314s ----------------------------- Captured stdout call ----------------------------- 314s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-26/run0/.git/ 314s [master (root-commit) d9ba1af] Initial commit 314s 2 files changed, 16 insertions(+) 314s create mode 100644 CMakeLists.txt 314s create mode 100644 setup.py 314s ----------------------------- Captured stderr call ----------------------------- 314s hint: Using 'master' as the name for the initial branch. This default branch name 314s hint: is subject to change. To configure the initial branch name to use in all 314s hint: of your new repositories, which will suppress this warning, call: 314s hint: 314s hint: git config --global init.defaultBranch 314s hint: 314s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 314s hint: 'development'. The just-created branch can be renamed via this command: 314s hint: 314s hint: git branch -m 314s __________________ test_cmake_initial_cache_as_global_option ___________________ 314s 314s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-21/test_cmake_initial_cache_as_gl0') 314s 314s def test_cmake_initial_cache_as_global_option(tmpdir): 314s project = "hello-no-language" 314s prepare_project(project, tmpdir) 314s initialize_git_repo_and_commit(tmpdir, verbose=True) 314s 314s initial_cache = tmpdir.join("initial-cache.txt") 314s initial_cache.write("""set(MY_CMAKE_VARIABLE "1" CACHE BOOL "My cache variable")""") 314s 314s try: 314s > with execute_setup_py(tmpdir, [f"-C{initial_cache}", "build"], disable_languages_test=True): 314s 314s initial_cache = local('/tmp/pytest-of-ubuntu/pytest-21/test_cmake_initial_cache_as_gl0/initial-cache.txt') 314s project = 'hello-no-language' 314s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-21/test_cmake_initial_cache_as_gl0') 314s 314s tests/test_command_line.py:112: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-21/test_cmake_initial_cache_as_gl0') 314s setup_args = ['-C/tmp/pytest-of-ubuntu/pytest-21/test_cmake_initial_cache_as_gl0/initial-cache.txt', 'build'] 314s disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-21/test_cmake_initial_cache_as_gl0') 314s setup_args = ['-C/tmp/pytest-of-ubuntu/pytest-21/test_cmake_initial_cache_as_gl0/initial-cache.txt', 'build'] 314s 314s tests/__init__.py:218: AttributeError 314s ----------------------------- Captured stdout call ----------------------------- 314s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-21/test_cmake_initial_cache_as_gl0/.git/ 314s [master (root-commit) d9ba1af] Initial commit 314s 2 files changed, 16 insertions(+) 314s create mode 100644 CMakeLists.txt 314s create mode 100644 setup.py 314s ----------------------------- Captured stderr call ----------------------------- 314s hint: Using 'master' as the name for the initial branch. This default branch name 314s hint: is subject to change. To configure the initial branch name to use in all 314s hint: of your new repositories, which will suppress this warning, call: 314s hint: 314s hint: git config --global init.defaultBranch 314s hint: 314s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 314s hint: 'development'. The just-created branch can be renamed via this command: 314s hint: 314s hint: git branch -m 314s __________________________ test_cmake_executable_arg ___________________________ 314s 314s def test_cmake_executable_arg(): 314s cmake_executable = "/path/to/invalid/cmake" 314s 314s @project_setup_py_test( 314s "hello-no-language", ["--cmake-executable", cmake_executable, "build"], disable_languages_test=True 314s ) 314s def should_fail(): 314s pass 314s 314s failed = False 314s message = "" 314s try: 314s > should_fail() 314s 314s cmake_executable = '/path/to/invalid/cmake' 314s failed = False 314s message = '' 314s should_fail = .should_fail at 0xf3461c58> 314s 314s tests/test_command_line.py:134: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s tests/__init__.py:255: in wrapped 314s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 314s disable_languages_test = True 314s fun = .should_fail at 0xf3461e88> 314s iargs = () 314s ikwargs = {} 314s ret = False 314s wrapped = .should_fail at 0xf3461c58> 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-27/should_fail0') 314s setup_args = ['--cmake-executable', '/path/to/invalid/cmake', 'build'] 314s disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-27/should_fail0') 314s setup_args = ['--cmake-executable', '/path/to/invalid/cmake', 'build'] 314s 314s tests/__init__.py:218: AttributeError 314s ----------------------------- Captured stdout call ----------------------------- 314s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-27/should_fail0/.git/ 314s [master (root-commit) d9ba1af] Initial commit 314s 2 files changed, 16 insertions(+) 314s create mode 100644 CMakeLists.txt 314s create mode 100644 setup.py 314s ----------------------------- Captured stderr call ----------------------------- 314s hint: Using 'master' as the name for the initial branch. This default branch name 314s hint: is subject to change. To configure the initial branch name to use in all 314s hint: of your new repositories, which will suppress this warning, call: 314s hint: 314s hint: git config --global init.defaultBranch 314s hint: 314s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 314s hint: 'development'. The just-created branch can be renamed via this command: 314s hint: 314s hint: git branch -m 314s ________________________ test_hide_listing[True-sdist] _________________________ 314s 314s action = 'sdist', hide_listing = True 314s capfd = <_pytest.capture.CaptureFixture object at 0xf35bab88> 314s caplog = <_pytest.logging.LogCaptureFixture object at 0xf35cf378> 314s 314s @pytest.mark.parametrize("action", ["sdist", "bdist_wheel"]) 314s @pytest.mark.parametrize("hide_listing", [True, False]) 314s def test_hide_listing(action, hide_listing, capfd, caplog): 314s cmd = [action] 314s if hide_listing: 314s cmd.insert(0, "--hide-listing") 314s 314s @project_setup_py_test("test-hide-listing", cmd, verbose_git=False, disable_languages_test=True) 314s def run(): 314s pass 314s 314s > run() 314s 314s action = 'sdist' 314s capfd = <_pytest.capture.CaptureFixture object at 0xf35bab88> 314s caplog = <_pytest.logging.LogCaptureFixture object at 0xf35cf378> 314s cmd = ['--hide-listing', 'sdist'] 314s hide_listing = True 314s run = .run at 0xf3461618> 314s 314s tests/test_command_line.py:154: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s tests/__init__.py:255: in wrapped 314s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 314s disable_languages_test = True 314s fun = .run at 0xf3461758> 314s iargs = () 314s ikwargs = {} 314s ret = False 314s wrapped = .run at 0xf3461618> 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-28/run0') 314s setup_args = ['--hide-listing', 'sdist'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-28/run0') 314s setup_args = ['--hide-listing', 'sdist'] 314s 314s tests/__init__.py:218: AttributeError 314s ----------------------------- Captured stderr call ----------------------------- 314s hint: Using 'master' as the name for the initial branch. This default branch name 314s hint: is subject to change. To configure the initial branch name to use in all 314s hint: of your new repositories, which will suppress this warning, call: 314s hint: 314s hint: git config --global init.defaultBranch 314s hint: 314s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 314s hint: 'development'. The just-created branch can be renamed via this command: 314s hint: 314s hint: git branch -m 314s _____________________ test_hide_listing[True-bdist_wheel] ______________________ 314s 314s action = 'bdist_wheel', hide_listing = True 314s capfd = <_pytest.capture.CaptureFixture object at 0xf35ba930> 314s caplog = <_pytest.logging.LogCaptureFixture object at 0xf34217c8> 314s 314s @pytest.mark.parametrize("action", ["sdist", "bdist_wheel"]) 314s @pytest.mark.parametrize("hide_listing", [True, False]) 314s def test_hide_listing(action, hide_listing, capfd, caplog): 314s cmd = [action] 314s if hide_listing: 314s cmd.insert(0, "--hide-listing") 314s 314s @project_setup_py_test("test-hide-listing", cmd, verbose_git=False, disable_languages_test=True) 314s def run(): 314s pass 314s 314s > run() 314s 314s action = 'bdist_wheel' 314s capfd = <_pytest.capture.CaptureFixture object at 0xf35ba930> 314s caplog = <_pytest.logging.LogCaptureFixture object at 0xf34217c8> 314s cmd = ['--hide-listing', 'bdist_wheel'] 314s hide_listing = True 314s run = .run at 0xf341bc08> 314s 314s tests/test_command_line.py:154: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s tests/__init__.py:255: in wrapped 314s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 314s disable_languages_test = True 314s fun = .run at 0xf3c801b8> 314s iargs = () 314s ikwargs = {} 314s ret = False 314s wrapped = .run at 0xf341bc08> 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-29/run0') 314s setup_args = ['--hide-listing', 'bdist_wheel'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-29/run0') 314s setup_args = ['--hide-listing', 'bdist_wheel'] 314s 314s tests/__init__.py:218: AttributeError 314s ----------------------------- Captured stderr call ----------------------------- 314s hint: Using 'master' as the name for the initial branch. This default branch name 314s hint: is subject to change. To configure the initial branch name to use in all 314s hint: of your new repositories, which will suppress this warning, call: 314s hint: 314s hint: git config --global init.defaultBranch 314s hint: 314s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 314s hint: 'development'. The just-created branch can be renamed via this command: 314s hint: 314s hint: git branch -m 314s ________________________ test_hide_listing[False-sdist] ________________________ 314s 314s action = 'sdist', hide_listing = False 314s capfd = <_pytest.capture.CaptureFixture object at 0xf3421c48> 314s caplog = <_pytest.logging.LogCaptureFixture object at 0xf3421a38> 314s 314s @pytest.mark.parametrize("action", ["sdist", "bdist_wheel"]) 314s @pytest.mark.parametrize("hide_listing", [True, False]) 314s def test_hide_listing(action, hide_listing, capfd, caplog): 314s cmd = [action] 314s if hide_listing: 314s cmd.insert(0, "--hide-listing") 314s 314s @project_setup_py_test("test-hide-listing", cmd, verbose_git=False, disable_languages_test=True) 314s def run(): 314s pass 314s 314s > run() 314s 314s action = 'sdist' 314s capfd = <_pytest.capture.CaptureFixture object at 0xf3421c48> 314s caplog = <_pytest.logging.LogCaptureFixture object at 0xf3421a38> 314s cmd = ['sdist'] 314s hide_listing = False 314s run = .run at 0xf35b3f28> 314s 314s tests/test_command_line.py:154: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s tests/__init__.py:255: in wrapped 314s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 314s disable_languages_test = True 314s fun = .run at 0xf35b36b8> 314s iargs = () 314s ikwargs = {} 314s ret = False 314s wrapped = .run at 0xf35b3f28> 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-30/run0') 314s setup_args = ['sdist'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-30/run0') 314s setup_args = ['sdist'] 314s 314s tests/__init__.py:218: AttributeError 314s ----------------------------- Captured stderr call ----------------------------- 314s hint: Using 'master' as the name for the initial branch. This default branch name 314s hint: is subject to change. To configure the initial branch name to use in all 314s hint: of your new repositories, which will suppress this warning, call: 314s hint: 314s hint: git config --global init.defaultBranch 314s hint: 314s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 314s hint: 'development'. The just-created branch can be renamed via this command: 314s hint: 314s hint: git branch -m 314s _____________________ test_hide_listing[False-bdist_wheel] _____________________ 314s 314s action = 'bdist_wheel', hide_listing = False 314s capfd = <_pytest.capture.CaptureFixture object at 0xf357fee8> 314s caplog = <_pytest.logging.LogCaptureFixture object at 0xf35baa68> 314s 314s @pytest.mark.parametrize("action", ["sdist", "bdist_wheel"]) 314s @pytest.mark.parametrize("hide_listing", [True, False]) 314s def test_hide_listing(action, hide_listing, capfd, caplog): 314s cmd = [action] 314s if hide_listing: 314s cmd.insert(0, "--hide-listing") 314s 314s @project_setup_py_test("test-hide-listing", cmd, verbose_git=False, disable_languages_test=True) 314s def run(): 314s pass 314s 314s > run() 314s 314s action = 'bdist_wheel' 314s capfd = <_pytest.capture.CaptureFixture object at 0xf357fee8> 314s caplog = <_pytest.logging.LogCaptureFixture object at 0xf35baa68> 314s cmd = ['bdist_wheel'] 314s hide_listing = False 314s run = .run at 0xf3c801b8> 314s 314s tests/test_command_line.py:154: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s tests/__init__.py:255: in wrapped 314s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 314s disable_languages_test = True 314s fun = .run at 0xf35b3398> 314s iargs = () 314s ikwargs = {} 314s ret = False 314s wrapped = .run at 0xf3c801b8> 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-31/run0') 314s setup_args = ['bdist_wheel'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-31/run0') 314s setup_args = ['bdist_wheel'] 314s 314s tests/__init__.py:218: AttributeError 314s ----------------------------- Captured stderr call ----------------------------- 314s hint: Using 'master' as the name for the initial branch. This default branch name 314s hint: is subject to change. To configure the initial branch name to use in all 314s hint: of your new repositories, which will suppress this warning, call: 314s hint: 314s hint: git config --global init.defaultBranch 314s hint: 314s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 314s hint: 'development'. The just-created branch can be renamed via this command: 314s hint: 314s hint: git branch -m 314s ______________________________ test_run_cmake_arg ______________________________ 314s 314s iargs = () 314s ikwargs = {'capfd': <_pytest.capture.CaptureFixture object at 0xf3421198>} 314s 314s @functools.wraps(fun) 314s def wrapped(*iargs, **ikwargs): 314s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 314s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 314s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 314s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 314s 314s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 314s 314s disable_languages_test = True 314s fun = 314s iargs = () 314s ikwargs = {'capfd': <_pytest.capture.CaptureFixture object at 0xf3421198>} 314s ret = False 314s wrapped = 314s 314s tests/__init__.py:255: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-32/test_run_cmake_arg0') 314s setup_args = ['--force-cmake', '--help'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-32/test_run_cmake_arg0') 314s setup_args = ['--force-cmake', '--help'] 314s 314s tests/__init__.py:218: AttributeError 314s ----------------------------- Captured stdout call ----------------------------- 314s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-32/test_run_cmake_arg0/.git/ 314s [master (root-commit) d9ba1af] Initial commit 314s 2 files changed, 16 insertions(+) 314s create mode 100644 CMakeLists.txt 314s create mode 100644 setup.py 314s ----------------------------- Captured stderr call ----------------------------- 314s hint: Using 'master' as the name for the initial branch. This default branch name 314s hint: is subject to change. To configure the initial branch name to use in all 314s hint: of your new repositories, which will suppress this warning, call: 314s hint: 314s hint: git config --global init.defaultBranch 314s hint: 314s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 314s hint: 'development'. The just-created branch can be renamed via this command: 314s hint: 314s hint: git branch -m 314s _____________________________ test_skip_cmake_arg ______________________________ 314s 314s iargs = () 314s ikwargs = {'capfd': <_pytest.capture.CaptureFixture object at 0xf3568408>} 314s 314s @functools.wraps(fun) 314s def wrapped(*iargs, **ikwargs): 314s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 314s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 314s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 314s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 314s 314s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 314s 314s disable_languages_test = True 314s fun = 314s iargs = () 314s ikwargs = {'capfd': <_pytest.capture.CaptureFixture object at 0xf3568408>} 314s ret = False 314s wrapped = 314s 314s tests/__init__.py:255: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-33/test_skip_cmake_arg0') 314s setup_args = ['--skip-cmake', 'build'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-33/test_skip_cmake_arg0') 314s setup_args = ['--skip-cmake', 'build'] 314s 314s tests/__init__.py:218: AttributeError 314s ----------------------------- Captured stdout call ----------------------------- 314s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-33/test_skip_cmake_arg0/.git/ 314s [master (root-commit) d9ba1af] Initial commit 314s 2 files changed, 16 insertions(+) 314s create mode 100644 CMakeLists.txt 314s create mode 100644 setup.py 314s ----------------------------- Captured stderr call ----------------------------- 314s hint: Using 'master' as the name for the initial branch. This default branch name 314s hint: is subject to change. To configure the initial branch name to use in all 314s hint: of your new repositories, which will suppress this warning, call: 314s hint: 314s hint: git config --global init.defaultBranch 314s hint: 314s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 314s hint: 'development'. The just-created branch can be renamed via this command: 314s hint: 314s hint: git branch -m 314s ___________________________ test_hello_cython_builds ___________________________ 314s 314s iargs = (), ikwargs = {} 314s 314s @functools.wraps(fun) 314s def wrapped(*iargs, **ikwargs): 314s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 314s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 314s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 314s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 314s 314s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 314s 314s disable_languages_test = False 314s fun = 314s iargs = () 314s ikwargs = {} 314s ret = False 314s wrapped = 314s 314s tests/__init__.py:255: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-34/test_hello_cython_builds0') 314s setup_args = ['build'], disable_languages_test = False 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = False 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-34/test_hello_cython_builds0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s ----------------------------- Captured stdout call ----------------------------- 314s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-34/test_hello_cython_builds0/.git/ 314s [master (root-commit) 59f9853] Initial commit 314s 6 files changed, 40 insertions(+) 314s create mode 100644 CMakeLists.txt 314s create mode 100644 hello/CMakeLists.txt 314s create mode 100644 hello/__init__.py 314s create mode 100644 hello/__main__.py 314s create mode 100644 hello/_hello.pyx 314s create mode 100644 setup.py 314s ----------------------------- Captured stderr call ----------------------------- 314s hint: Using 'master' as the name for the initial branch. This default branch name 314s hint: is subject to change. To configure the initial branch name to use in all 314s hint: of your new repositories, which will suppress this warning, call: 314s hint: 314s hint: git config --global init.defaultBranch 314s hint: 314s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 314s hint: 'development'. The just-created branch can be renamed via this command: 314s hint: 314s hint: git branch -m 314s ___________________________ test_bdist_wheel_command ___________________________ 314s 314s def test_bdist_wheel_command(): 314s project = "test-filter-manifest" 314s 314s expected_content = [ 314s "hello/__init__.py", 314s "hello/swig_mwe.py", 314s "hello/_swig_mwe.pyd", 314s "hello-1.2.3.data/data/bin/hello", 314s ] 314s 314s expected_distribution_name = "hello-1.2.3" 314s 314s tmp_dir = _tmpdir("test_bdist_wheel_command") 314s prepare_project(project, tmp_dir) 314s initialize_git_repo_and_commit(tmp_dir, verbose=True) 314s 314s relative_setup_path = "wrapping/python/" 314s 314s > with execute_setup_py(tmp_dir.join(relative_setup_path), ["bdist_wheel"]): 314s 314s expected_content = ['hello/__init__.py', 'hello/swig_mwe.py', 'hello/_swig_mwe.pyd', 'hello-1.2.3.data/data/bin/hello'] 314s expected_distribution_name = 'hello-1.2.3' 314s project = 'test-filter-manifest' 314s relative_setup_path = 'wrapping/python/' 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-35/test_bdist_wheel_command0') 314s 314s tests/test_filter_manifest.py:27: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-35/test_bdist_wheel_command0/wrapping/python') 314s setup_args = ['bdist_wheel'], disable_languages_test = False 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = False 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-35/test_bdist_wheel_command0/wrapping/python') 314s setup_args = ['bdist_wheel'] 314s 314s tests/__init__.py:218: AttributeError 314s ----------------------------- Captured stdout call ----------------------------- 314s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-35/test_bdist_wheel_command0/.git/ 314s [master (root-commit) 30295b4] Initial commit 314s 4 files changed, 59 insertions(+) 314s create mode 100644 CMakeLists.txt 314s create mode 100644 wrapping/python/CMakeLists.txt 314s create mode 100644 wrapping/python/hello/__init__.py 314s create mode 100644 wrapping/python/setup.py 314s ----------------------------- Captured stderr call ----------------------------- 314s hint: Using 'master' as the name for the initial branch. This default branch name 314s hint: is subject to change. To configure the initial branch name to use in all 314s hint: of your new repositories, which will suppress this warning, call: 314s hint: 314s hint: git config --global init.defaultBranch 314s hint: 314s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 314s hint: 'development'. The just-created branch can be renamed via this command: 314s hint: 314s hint: git branch -m 314s ______________________________ test_hello_builds _______________________________ 314s 314s def test_hello_builds(): 314s with push_dir(): 314s 314s @project_setup_py_test("hello-cpp", ["build"], ret=True) 314s def run(): 314s pass 314s 314s # Check that a project can be build twice in a row 314s # See issue scikit-build#120 314s > tmp_dir = run()[0] 314s 314s run = .run at 0xf34826b8> 314s 314s tests/test_hello_cpp.py:30: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s tests/__init__.py:255: in wrapped 314s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 314s disable_languages_test = False 314s fun = .run at 0xf3482a78> 314s iargs = () 314s ikwargs = {} 314s ret = True 314s wrapped = .run at 0xf34826b8> 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-36/run0') 314s setup_args = ['build'], disable_languages_test = False 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = False 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-36/run0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s ----------------------------- Captured stdout call ----------------------------- 314s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-36/run0/.git/ 314s [master (root-commit) 2f096f8] Initial commit 314s 11 files changed, 115 insertions(+) 314s create mode 100644 CMakeLists.txt 314s create mode 100644 bonjour/__init__.py 314s create mode 100644 bonjour/data/ciel.txt 314s create mode 100644 bonjour/data/soleil.txt 314s create mode 100644 bonjour/data/terre.txt 314s create mode 100644 bonjourModule.py 314s create mode 100644 hello/CMakeLists.txt 314s create mode 100644 hello/__init__.py 314s create mode 100644 hello/__main__.py 314s create mode 100644 hello/_hello.cxx 314s create mode 100644 setup.py 314s ----------------------------- Captured stderr call ----------------------------- 314s hint: Using 'master' as the name for the initial branch. This default branch name 314s hint: is subject to change. To configure the initial branch name to use in all 314s hint: of your new repositories, which will suppress this warning, call: 314s hint: 314s hint: git config --global init.defaultBranch 314s hint: 314s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 314s hint: 'development'. The just-created branch can be renamed via this command: 314s hint: 314s hint: git branch -m 314s _______________________________ test_hello_wheel _______________________________ 314s 314s def test_hello_wheel(): 314s expected_content = [ 314s f"hello/_hello{get_ext_suffix()}", 314s "hello/__init__.py", 314s "hello/__main__.py", 314s "hello/world.py", 314s "helloModule.py", 314s "bonjour/__init__.py", 314s "bonjour/data/ciel.txt", 314s "bonjour/data/soleil.txt", 314s "bonjour/data/terre.txt", 314s "bonjourModule.py", 314s ] 314s 314s expected_distribution_name = "hello-1.2.3" 314s 314s @project_setup_py_test("hello-cpp", ["bdist_wheel"], ret=True) 314s def build_wheel(): 314s whls = glob.glob("dist/*.whl") 314s assert len(whls) == 1 314s check_wheel_content(whls[0], expected_distribution_name, expected_content) 314s os.remove(whls[0]) 314s assert not os.path.exists(whls[0]) 314s 314s assert os.path.exists(os.path.join(CMAKE_BUILD_DIR(), "CMakeCache.txt")) 314s os.remove(os.path.join(CMAKE_BUILD_DIR(), "CMakeCache.txt")) 314s 314s > tmp_dir = build_wheel()[0] 314s 314s build_wheel = .build_wheel at 0xf3482708> 314s expected_content = ['hello/_hello.cpython-312-arm-linux-gnueabihf.so', 'hello/__init__.py', 'hello/__main__.py', 'hello/world.py', 'helloModule.py', 'bonjour/__init__.py', ...] 314s expected_distribution_name = 'hello-1.2.3' 314s 314s tests/test_hello_cpp.py:93: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s tests/__init__.py:255: in wrapped 314s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 314s disable_languages_test = False 314s fun = .build_wheel at 0xf3482848> 314s iargs = () 314s ikwargs = {} 314s ret = True 314s wrapped = .build_wheel at 0xf3482708> 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-37/build_wheel0') 314s setup_args = ['bdist_wheel'], disable_languages_test = False 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = False 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-37/build_wheel0') 314s setup_args = ['bdist_wheel'] 314s 314s tests/__init__.py:218: AttributeError 314s ----------------------------- Captured stdout call ----------------------------- 314s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-37/build_wheel0/.git/ 314s [master (root-commit) 18f4719] Initial commit 314s 11 files changed, 115 insertions(+) 314s create mode 100644 CMakeLists.txt 314s create mode 100644 bonjour/__init__.py 314s create mode 100644 bonjour/data/ciel.txt 314s create mode 100644 bonjour/data/soleil.txt 314s create mode 100644 bonjour/data/terre.txt 314s create mode 100644 bonjourModule.py 314s create mode 100644 hello/CMakeLists.txt 314s create mode 100644 hello/__init__.py 314s create mode 100644 hello/__main__.py 314s create mode 100644 hello/_hello.cxx 314s create mode 100644 setup.py 314s ----------------------------- Captured stderr call ----------------------------- 314s hint: Using 'master' as the name for the initial branch. This default branch name 314s hint: is subject to change. To configure the initial branch name to use in all 314s hint: of your new repositories, which will suppress this warning, call: 314s hint: 314s hint: git config --global init.defaultBranch 314s hint: 314s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 314s hint: 'development'. The just-created branch can be renamed via this command: 314s hint: 314s hint: git branch -m 314s ________________________ test_hello_clean[with-dry-run] ________________________ 314s 314s dry_run = True, capfd = <_pytest.capture.CaptureFixture object at 0xf357fbe8> 314s 314s @pytest.mark.parametrize("dry_run", ["with-dry-run", "without-dry-run"]) 314s def test_hello_clean(dry_run, capfd): 314s with push_dir(): 314s dry_run = dry_run == "with-dry-run" 314s 314s @project_setup_py_test("hello-cpp", ["build"], ret=True) 314s def run_build(): 314s pass 314s 314s > tmp_dir = run_build()[0] 314s 314s capfd = <_pytest.capture.CaptureFixture object at 0xf357fbe8> 314s dry_run = True 314s run_build = .run_build at 0xf3482078> 314s 314s tests/test_hello_cpp.py:114: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s tests/__init__.py:255: in wrapped 314s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 314s disable_languages_test = False 314s fun = .run_build at 0xf3482208> 314s iargs = () 314s ikwargs = {} 314s ret = True 314s wrapped = .run_build at 0xf3482078> 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-38/run_build0') 314s setup_args = ['build'], disable_languages_test = False 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = False 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-38/run_build0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s ----------------------------- Captured stdout call ----------------------------- 314s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-38/run_build0/.git/ 314s [master (root-commit) 18f4719] Initial commit 314s 11 files changed, 115 insertions(+) 314s create mode 100644 CMakeLists.txt 314s create mode 100644 bonjour/__init__.py 314s create mode 100644 bonjour/data/ciel.txt 314s create mode 100644 bonjour/data/soleil.txt 314s create mode 100644 bonjour/data/terre.txt 314s create mode 100644 bonjourModule.py 314s create mode 100644 hello/CMakeLists.txt 314s create mode 100644 hello/__init__.py 314s create mode 100644 hello/__main__.py 314s create mode 100644 hello/_hello.cxx 314s create mode 100644 setup.py 314s ----------------------------- Captured stderr call ----------------------------- 314s hint: Using 'master' as the name for the initial branch. This default branch name 314s hint: is subject to change. To configure the initial branch name to use in all 314s hint: of your new repositories, which will suppress this warning, call: 314s hint: 314s hint: git config --global init.defaultBranch 314s hint: 314s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 314s hint: 'development'. The just-created branch can be renamed via this command: 314s hint: 314s hint: git branch -m 314s ______________________ test_hello_clean[without-dry-run] _______________________ 314s 314s dry_run = False, capfd = <_pytest.capture.CaptureFixture object at 0xf347d5e8> 314s 314s @pytest.mark.parametrize("dry_run", ["with-dry-run", "without-dry-run"]) 314s def test_hello_clean(dry_run, capfd): 314s with push_dir(): 314s dry_run = dry_run == "with-dry-run" 314s 314s @project_setup_py_test("hello-cpp", ["build"], ret=True) 314s def run_build(): 314s pass 314s 314s > tmp_dir = run_build()[0] 314s 314s capfd = <_pytest.capture.CaptureFixture object at 0xf347d5e8> 314s dry_run = False 314s run_build = .run_build at 0xf3482cf8> 314s 314s tests/test_hello_cpp.py:114: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s tests/__init__.py:255: in wrapped 314s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 314s disable_languages_test = False 314s fun = .run_build at 0xf34820c8> 314s iargs = () 314s ikwargs = {} 314s ret = True 314s wrapped = .run_build at 0xf3482cf8> 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-39/run_build0') 314s setup_args = ['build'], disable_languages_test = False 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = False 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-39/run_build0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s ----------------------------- Captured stdout call ----------------------------- 314s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-39/run_build0/.git/ 314s [master (root-commit) 18f4719] Initial commit 314s 11 files changed, 115 insertions(+) 314s create mode 100644 CMakeLists.txt 314s create mode 100644 bonjour/__init__.py 314s create mode 100644 bonjour/data/ciel.txt 314s create mode 100644 bonjour/data/soleil.txt 314s create mode 100644 bonjour/data/terre.txt 314s create mode 100644 bonjourModule.py 314s create mode 100644 hello/CMakeLists.txt 314s create mode 100644 hello/__init__.py 314s create mode 100644 hello/__main__.py 314s create mode 100644 hello/_hello.cxx 314s create mode 100644 setup.py 314s ----------------------------- Captured stderr call ----------------------------- 314s hint: Using 'master' as the name for the initial branch. This default branch name 314s hint: is subject to change. To configure the initial branch name to use in all 314s hint: of your new repositories, which will suppress this warning, call: 314s hint: 314s hint: git config --global init.defaultBranch 314s hint: 314s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 314s hint: 'development'. The just-created branch can be renamed via this command: 314s hint: 314s hint: git branch -m 314s ______________________________ test_hello_cleans _______________________________ 314s 314s capfd = <_pytest.capture.CaptureFixture object at 0xf3421f00> 314s caplog = <_pytest.logging.LogCaptureFixture object at 0xf3421168> 314s 314s def test_hello_cleans(capfd, caplog): 314s with push_dir(): 314s tmp_dir = _tmpdir("test_hello_cleans") 314s 314s _copy_dir(tmp_dir, os.path.join(SAMPLES_DIR, "hello-cpp")) 314s 314s @project_setup_py_test("hello-cpp", ["build"], tmp_dir=tmp_dir) 314s def run_build(): 314s pass 314s 314s @project_setup_py_test("hello-cpp", ["clean"], tmp_dir=tmp_dir) 314s def run_clean(): 314s pass 314s 314s # Check that a project can be cleaned twice in a row 314s > run_build() 314s 314s capfd = <_pytest.capture.CaptureFixture object at 0xf3421f00> 314s caplog = <_pytest.logging.LogCaptureFixture object at 0xf3421168> 314s run_build = .run_build at 0xf35b3398> 314s run_clean = .run_clean at 0xf3482528> 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-40/test_hello_cleans0') 314s 314s tests/test_hello_cpp.py:158: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s tests/__init__.py:255: in wrapped 314s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 314s disable_languages_test = False 314s fun = .run_build at 0xf35b3b18> 314s iargs = () 314s ikwargs = {} 314s ret = False 314s wrapped = .run_build at 0xf35b3398> 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-40/test_hello_cleans0') 314s setup_args = ['build'], disable_languages_test = False 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = False 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-40/test_hello_cleans0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s ___________________________ test_hello_cython_builds ___________________________ 314s 314s iargs = (), ikwargs = {} 314s 314s @functools.wraps(fun) 314s def wrapped(*iargs, **ikwargs): 314s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 314s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 314s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 314s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 314s 314s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 314s 314s disable_languages_test = False 314s fun = 314s iargs = () 314s ikwargs = {} 314s ret = False 314s wrapped = 314s 314s tests/__init__.py:255: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-41/test_hello_cython_builds0') 314s setup_args = ['build'], disable_languages_test = False 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = False 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-41/test_hello_cython_builds0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s ----------------------------- Captured stdout call ----------------------------- 314s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-41/test_hello_cython_builds0/.git/ 314s [master (root-commit) 1e40fb5] Initial commit 314s 6 files changed, 42 insertions(+) 314s create mode 100644 CMakeLists.txt 314s create mode 100644 hello/CMakeLists.txt 314s create mode 100644 hello/__init__.py 314s create mode 100644 hello/__main__.py 314s create mode 100644 hello/_hello.pyx 314s create mode 100644 setup.py 314s ----------------------------- Captured stderr call ----------------------------- 314s hint: Using 'master' as the name for the initial branch. This default branch name 314s hint: is subject to change. To configure the initial branch name to use in all 314s hint: of your new repositories, which will suppress this warning, call: 314s hint: 314s hint: git config --global init.defaultBranch 314s hint: 314s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 314s hint: 'development'. The just-created branch can be renamed via this command: 314s hint: 314s hint: git branch -m 314s ___________________________ test_hello_cython_sdist ____________________________ 314s 314s iargs = (), ikwargs = {} 314s 314s @functools.wraps(fun) 314s def wrapped(*iargs, **ikwargs): 314s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 314s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 314s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 314s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 314s 314s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 314s 314s disable_languages_test = False 314s fun = 314s iargs = () 314s ikwargs = {} 314s ret = False 314s wrapped = 314s 314s tests/__init__.py:255: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-42/test_hello_cython_sdist0') 314s setup_args = ['sdist'], disable_languages_test = False 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = False 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-42/test_hello_cython_sdist0') 314s setup_args = ['sdist'] 314s 314s tests/__init__.py:218: AttributeError 314s ----------------------------- Captured stdout call ----------------------------- 314s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-42/test_hello_cython_sdist0/.git/ 314s [master (root-commit) 1e40fb5] Initial commit 314s 6 files changed, 42 insertions(+) 314s create mode 100644 CMakeLists.txt 314s create mode 100644 hello/CMakeLists.txt 314s create mode 100644 hello/__init__.py 314s create mode 100644 hello/__main__.py 314s create mode 100644 hello/_hello.pyx 314s create mode 100644 setup.py 314s ----------------------------- Captured stderr call ----------------------------- 314s hint: Using 'master' as the name for the initial branch. This default branch name 314s hint: is subject to change. To configure the initial branch name to use in all 314s hint: of your new repositories, which will suppress this warning, call: 314s hint: 314s hint: git config --global init.defaultBranch 314s hint: 314s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 314s hint: 'development'. The just-created branch can be renamed via this command: 314s hint: 314s hint: git branch -m 314s ___________________________ test_hello_cython_wheel ____________________________ 314s 314s iargs = (), ikwargs = {} 314s 314s @functools.wraps(fun) 314s def wrapped(*iargs, **ikwargs): 314s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 314s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 314s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 314s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 314s 314s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 314s 314s disable_languages_test = False 314s fun = 314s iargs = () 314s ikwargs = {} 314s ret = False 314s wrapped = 314s 314s tests/__init__.py:255: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-43/test_hello_cython_wheel0') 314s setup_args = ['bdist_wheel'], disable_languages_test = False 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = False 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-43/test_hello_cython_wheel0') 314s setup_args = ['bdist_wheel'] 314s 314s tests/__init__.py:218: AttributeError 314s ----------------------------- Captured stdout call ----------------------------- 314s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-43/test_hello_cython_wheel0/.git/ 314s [master (root-commit) 1e40fb5] Initial commit 314s 6 files changed, 42 insertions(+) 314s create mode 100644 CMakeLists.txt 314s create mode 100644 hello/CMakeLists.txt 314s create mode 100644 hello/__init__.py 314s create mode 100644 hello/__main__.py 314s create mode 100644 hello/_hello.pyx 314s create mode 100644 setup.py 314s ----------------------------- Captured stderr call ----------------------------- 314s hint: Using 'master' as the name for the initial branch. This default branch name 314s hint: is subject to change. To configure the initial branch name to use in all 314s hint: of your new repositories, which will suppress this warning, call: 314s hint: 314s hint: git config --global init.defaultBranch 314s hint: 314s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 314s hint: 'development'. The just-created branch can be renamed via this command: 314s hint: 314s hint: git branch -m 314s ____________________________ test_hello_pure_builds ____________________________ 314s 314s iargs = () 314s ikwargs = {'capsys': <_pytest.capture.CaptureFixture object at 0xf3468b70>} 314s 314s @functools.wraps(fun) 314s def wrapped(*iargs, **ikwargs): 314s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 314s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 314s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 314s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 314s 314s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 314s 314s disable_languages_test = True 314s fun = 314s iargs = () 314s ikwargs = {'capsys': <_pytest.capture.CaptureFixture object at 0xf3468b70>} 314s ret = False 314s wrapped = 314s 314s tests/__init__.py:255: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-44/test_hello_pure_builds0') 314s setup_args = ['build'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-44/test_hello_pure_builds0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s ----------------------------- Captured stdout call ----------------------------- 314s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-44/test_hello_pure_builds0/.git/ 314s [master (root-commit) fa7d543] Initial commit 314s 2 files changed, 12 insertions(+) 314s create mode 100644 hello/__init__.py 314s create mode 100644 setup.py 314s ----------------------------- Captured stderr call ----------------------------- 314s hint: Using 'master' as the name for the initial branch. This default branch name 314s hint: is subject to change. To configure the initial branch name to use in all 314s hint: of your new repositories, which will suppress this warning, call: 314s hint: 314s hint: git config --global init.defaultBranch 314s hint: 314s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 314s hint: 'development'. The just-created branch can be renamed via this command: 314s hint: 314s hint: git branch -m 314s ____________________________ test_hello_pure_sdist _____________________________ 314s 314s iargs = (), ikwargs = {} 314s 314s @functools.wraps(fun) 314s def wrapped(*iargs, **ikwargs): 314s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 314s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 314s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 314s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 314s 314s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 314s 314s disable_languages_test = True 314s fun = 314s iargs = () 314s ikwargs = {} 314s ret = False 314s wrapped = 314s 314s tests/__init__.py:255: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-45/test_hello_pure_sdist0') 314s setup_args = ['sdist'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-45/test_hello_pure_sdist0') 314s setup_args = ['sdist'] 314s 314s tests/__init__.py:218: AttributeError 314s ----------------------------- Captured stdout call ----------------------------- 314s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-45/test_hello_pure_sdist0/.git/ 314s [master (root-commit) fa7d543] Initial commit 314s 2 files changed, 12 insertions(+) 314s create mode 100644 hello/__init__.py 314s create mode 100644 setup.py 314s ----------------------------- Captured stderr call ----------------------------- 314s hint: Using 'master' as the name for the initial branch. This default branch name 314s hint: is subject to change. To configure the initial branch name to use in all 314s hint: of your new repositories, which will suppress this warning, call: 314s hint: 314s hint: git config --global init.defaultBranch 314s hint: 314s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 314s hint: 'development'. The just-created branch can be renamed via this command: 314s hint: 314s hint: git branch -m 314s ____________________________ test_hello_pure_wheel _____________________________ 314s 314s iargs = (), ikwargs = {} 314s 314s @functools.wraps(fun) 314s def wrapped(*iargs, **ikwargs): 314s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 314s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 314s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 314s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 314s 314s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 314s 314s disable_languages_test = True 314s fun = 314s iargs = () 314s ikwargs = {} 314s ret = False 314s wrapped = 314s 314s tests/__init__.py:255: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-46/test_hello_pure_wheel0') 314s setup_args = ['bdist_wheel'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-46/test_hello_pure_wheel0') 314s setup_args = ['bdist_wheel'] 314s 314s tests/__init__.py:218: AttributeError 314s ----------------------------- Captured stdout call ----------------------------- 314s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-46/test_hello_pure_wheel0/.git/ 314s [master (root-commit) fa7d543] Initial commit 314s 2 files changed, 12 insertions(+) 314s create mode 100644 hello/__init__.py 314s create mode 100644 setup.py 314s ----------------------------- Captured stderr call ----------------------------- 314s hint: Using 'master' as the name for the initial branch. This default branch name 314s hint: is subject to change. To configure the initial branch name to use in all 314s hint: of your new repositories, which will suppress this warning, call: 314s hint: 314s hint: git config --global init.defaultBranch 314s hint: 314s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 314s hint: 'development'. The just-created branch can be renamed via this command: 314s hint: 314s hint: git branch -m 314s _______________________________ test_hello_clean _______________________________ 314s 314s capfd = <_pytest.capture.CaptureFixture object at 0xf344eb40> 314s 314s def test_hello_clean(capfd): 314s with push_dir(): 314s 314s @project_setup_py_test("hello-pure", ["build"], disable_languages_test=True, ret=True) 314s def run_build(): 314s pass 314s 314s > tmp_dir = run_build()[0] 314s 314s capfd = <_pytest.capture.CaptureFixture object at 0xf344eb40> 314s run_build = .run_build at 0xf345d3e8> 314s 314s tests/test_hello_pure.py:65: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s tests/__init__.py:255: in wrapped 314s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 314s disable_languages_test = True 314s fun = .run_build at 0xf345d0c8> 314s iargs = () 314s ikwargs = {} 314s ret = True 314s wrapped = .run_build at 0xf345d3e8> 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-47/run_build0') 314s setup_args = ['build'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-47/run_build0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s ----------------------------- Captured stdout call ----------------------------- 314s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-47/run_build0/.git/ 314s [master (root-commit) fa7d543] Initial commit 314s 2 files changed, 12 insertions(+) 314s create mode 100644 hello/__init__.py 314s create mode 100644 setup.py 314s ----------------------------- Captured stderr call ----------------------------- 314s hint: Using 'master' as the name for the initial branch. This default branch name 314s hint: is subject to change. To configure the initial branch name to use in all 314s hint: of your new repositories, which will suppress this warning, call: 314s hint: 314s hint: git config --global init.defaultBranch 314s hint: 314s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 314s hint: 'development'. The just-created branch can be renamed via this command: 314s hint: 314s hint: git branch -m 314s __________________________ test_include_exclude_data ___________________________ 314s 314s iargs = (), ikwargs = {} 314s 314s @functools.wraps(fun) 314s def wrapped(*iargs, **ikwargs): 314s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 314s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 314s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 314s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 314s 314s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 314s 314s disable_languages_test = False 314s fun = 314s iargs = () 314s ikwargs = {} 314s ret = False 314s wrapped = 314s 314s tests/__init__.py:255: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-48/test_include_exclude_data0') 314s setup_args = ['bdist_wheel'], disable_languages_test = False 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = False 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-48/test_include_exclude_data0') 314s setup_args = ['bdist_wheel'] 314s 314s tests/__init__.py:218: AttributeError 314s ----------------------------- Captured stdout call ----------------------------- 314s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-48/test_include_exclude_data0/.git/ 314s [master (root-commit) ef29777] Initial commit 314s 15 files changed, 79 insertions(+) 314s create mode 100644 CMakeLists.txt 314s create mode 100644 MANIFEST.in 314s create mode 100644 hello/__init__.py 314s create mode 100644 hello/data/subdata/hello_data1_include_from_manifest.txt 314s create mode 100644 hello/data/subdata/hello_data2_include_from_manifest.txt 314s create mode 100644 hello/data/subdata/hello_data3_include_from_manifest_and_exclude_from_manifest.txt 314s create mode 100644 hello/data/subdata/hello_data4_include_from_manifest_and_exclude_from_setup.txt 314s create mode 100644 hello/hello_include_from_manifest.txt 314s create mode 100644 hello2/__init__.py 314s create mode 100644 hello2/data2/subdata2/hello2_data1_include_from_manifest.txt 314s create mode 100644 hello2/data2/subdata2/hello2_data2_include_from_manifest.txt 314s create mode 100644 hello2/data2/subdata2/hello2_data3_include_from_manifest_and_exclude_from_manifest.txt 314s create mode 100644 hello2/data2/subdata2/hello2_data4_include_from_manifest_and_exclude_from_setup.txt 314s create mode 100644 hello2/hello2_include_from_manifest.txt 314s create mode 100644 setup.py 314s ----------------------------- Captured stderr call ----------------------------- 314s hint: Using 'master' as the name for the initial branch. This default branch name 314s hint: is subject to change. To configure the initial branch name to use in all 314s hint: of your new repositories, which will suppress this warning, call: 314s hint: 314s hint: git config --global init.defaultBranch 314s hint: 314s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 314s hint: 'development'. The just-created branch can be renamed via this command: 314s hint: 314s hint: git branch -m 314s _____________________ test_include_exclude_data_with_base ______________________ 314s 314s iargs = (), ikwargs = {} 314s 314s @functools.wraps(fun) 314s def wrapped(*iargs, **ikwargs): 314s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 314s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 314s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 314s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 314s 314s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 314s 314s disable_languages_test = False 314s fun = 314s iargs = () 314s ikwargs = {} 314s ret = False 314s wrapped = 314s 314s tests/__init__.py:255: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-49/test_include_exclude_data_with0') 314s setup_args = ['bdist_wheel'], disable_languages_test = False 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = False 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-49/test_include_exclude_data_with0') 314s setup_args = ['bdist_wheel'] 314s 314s tests/__init__.py:218: AttributeError 314s ----------------------------- Captured stdout call ----------------------------- 314s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-49/test_include_exclude_data_with0/.git/ 314s [master (root-commit) e861bcc] Initial commit 314s 15 files changed, 80 insertions(+) 314s create mode 100644 CMakeLists.txt 314s create mode 100644 MANIFEST.in 314s create mode 100644 setup.py 314s create mode 100644 src/hello/__init__.py 314s create mode 100644 src/hello/data/subdata/hello_data1_include_from_manifest.txt 314s create mode 100644 src/hello/data/subdata/hello_data2_include_from_manifest.txt 314s create mode 100644 src/hello/data/subdata/hello_data3_include_from_manifest_and_exclude_from_manifest.txt 314s create mode 100644 src/hello/data/subdata/hello_data4_include_from_manifest_and_exclude_from_setup.txt 314s create mode 100644 src/hello/hello_include_from_manifest.txt 314s create mode 100644 src/hello2/__init__.py 314s create mode 100644 src/hello2/data2/subdata2/hello2_data1_include_from_manifest.txt 314s create mode 100644 src/hello2/data2/subdata2/hello2_data2_include_from_manifest.txt 314s create mode 100644 src/hello2/data2/subdata2/hello2_data3_include_from_manifest_and_exclude_from_manifest.txt 314s create mode 100644 src/hello2/data2/subdata2/hello2_data4_include_from_manifest_and_exclude_from_setup.txt 314s create mode 100644 src/hello2/hello2_include_from_manifest.txt 314s ----------------------------- Captured stderr call ----------------------------- 314s hint: Using 'master' as the name for the initial branch. This default branch name 314s hint: is subject to change. To configure the initial branch name to use in all 314s hint: of your new repositories, which will suppress this warning, call: 314s hint: 314s hint: git config --global init.defaultBranch 314s hint: 314s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 314s hint: 'development'. The just-created branch can be renamed via this command: 314s hint: 314s hint: git branch -m 314s ________________________ test_build_ext_inplace_command ________________________ 314s 314s iargs = (), ikwargs = {} 314s 314s @functools.wraps(fun) 314s def wrapped(*iargs, **ikwargs): 314s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 314s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 314s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 314s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 314s 314s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 314s 314s disable_languages_test = True 314s fun = 314s iargs = () 314s ikwargs = {} 314s ret = False 314s wrapped = 314s 314s tests/__init__.py:255: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-50/test_build_ext_inplace_command0') 314s setup_args = ['build_ext', '--inplace'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-50/test_build_ext_inplace_command0') 314s setup_args = ['build_ext', '--inplace'] 314s 314s tests/__init__.py:218: AttributeError 314s ----------------------------- Captured stdout call ----------------------------- 314s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-50/test_build_ext_inplace_command0/.git/ 314s [master (root-commit) 999755b] Initial commit 314s 5 files changed, 160 insertions(+) 314s create mode 100644 CMakeLists.txt 314s create mode 100644 hello/__init__.py 314s create mode 100644 hello/_hello_ext.cxx 314s create mode 100644 hello/_hello_sk.cxx 314s create mode 100644 setup.py 314s ----------------------------- Captured stderr call ----------------------------- 314s hint: Using 'master' as the name for the initial branch. This default branch name 314s hint: is subject to change. To configure the initial branch name to use in all 314s hint: of your new repositories, which will suppress this warning, call: 314s hint: 314s hint: git config --global init.defaultBranch 314s hint: 314s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 314s hint: 'development'. The just-created branch can be renamed via this command: 314s hint: 314s hint: git branch -m 314s ___________________________ test_bdist_wheel_command ___________________________ 314s 314s def test_bdist_wheel_command(): 314s project = "issue-335-support-cmake-source-dir" 314s 314s expected_content = [ 314s "hello/__init__.py", 314s "hello/swig_mwe.py", 314s "hello/_swig_mwe.pyd", 314s "hello-1.2.3.data/data/bin/hello", 314s "hello-1.2.3.data/data/lib/static/libbar.a", 314s "hello-1.2.3.data/data/lib/static/libfoo.a", 314s "hello-1.2.3.data/data/include/bar.h", 314s "hello-1.2.3.data/data/include/foo.h", 314s ] 314s 314s expected_distribution_name = "hello-1.2.3" 314s 314s tmp_dir = _tmpdir("test_bdist_wheel_command") 314s prepare_project(project, tmp_dir) 314s initialize_git_repo_and_commit(tmp_dir, verbose=True) 314s 314s relative_setup_path = "wrapping/python/" 314s 314s > with execute_setup_py(tmp_dir.join(relative_setup_path), ["bdist_wheel"]): 314s 314s 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', ...] 314s expected_distribution_name = 'hello-1.2.3' 314s project = 'issue-335-support-cmake-source-dir' 314s relative_setup_path = 'wrapping/python/' 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-51/test_bdist_wheel_command0') 314s 314s tests/test_issue335_support_cmake_source_dir.py:31: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-51/test_bdist_wheel_command0/wrapping/python') 314s setup_args = ['bdist_wheel'], disable_languages_test = False 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = False 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-51/test_bdist_wheel_command0/wrapping/python') 314s setup_args = ['bdist_wheel'] 314s 314s tests/__init__.py:218: AttributeError 314s ----------------------------- Captured stdout call ----------------------------- 314s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-51/test_bdist_wheel_command0/.git/ 314s [master (root-commit) f00b882] Initial commit 314s 4 files changed, 52 insertions(+) 314s create mode 100644 CMakeLists.txt 314s create mode 100644 wrapping/python/CMakeLists.txt 314s create mode 100644 wrapping/python/hello/__init__.py 314s create mode 100644 wrapping/python/setup.py 314s ----------------------------- Captured stderr call ----------------------------- 314s hint: Using 'master' as the name for the initial branch. This default branch name 314s hint: is subject to change. To configure the initial branch name to use in all 314s hint: of your new repositories, which will suppress this warning, call: 314s hint: 314s hint: git config --global init.defaultBranch 314s hint: 314s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 314s hint: 'development'. The just-created branch can be renamed via this command: 314s hint: 314s hint: git branch -m 314s _ test_cmake_args_keyword_osx_default[None-cli_setup_args0-keyword_cmake_args0-cli_cmake_args0-10.9] _ 314s 314s osx_deployment_target_env_var = None, cli_setup_args = [] 314s keyword_cmake_args = [], cli_cmake_args = [] 314s expected_cmake_osx_deployment_target = '10.9' 314s mocker = 314s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0xf3570b28> 314s 314s @pytest.mark.parametrize( 314s params, 314s [ 314s # default plat_name is 'macosx-10.9-x86_64' 314s ( 314s # osx_deployment_target_env_var 314s None, 314s # cli_setup_args 314s [], 314s # keyword_cmake_args 314s [], 314s # cli_cmake_args 314s [], 314s # expected_cmake_osx_deployment_target 314s "10.9", 314s ), 314s ( 314s # osx_deployment_target_env_var 314s "10.7", 314s # cli_setup_args 314s [], 314s # keyword_cmake_args 314s [], 314s # cli_cmake_args 314s [], 314s # expected_cmake_osx_deployment_target 314s "10.7", 314s ), 314s ( 314s # osx_deployment_target_env_var 314s "10.7", 314s # cli_setup_args 314s ["--plat-name", "macosx-10.9-x86_64"], 314s # keyword_cmake_args 314s [], 314s # cli_cmake_args 314s [], 314s # expected_cmake_osx_deployment_target 314s "10.9", 314s ), 314s ( 314s # osx_deployment_target_env_var 314s None, 314s # cli_setup_args 314s ["--plat-name", "macosx-10.6-x86_64"], 314s # keyword_cmake_args 314s [], 314s # cli_cmake_args 314s [], 314s # expected_cmake_osx_deployment_target 314s "10.6", 314s ), 314s ( 314s # osx_deployment_target_env_var 314s None, 314s # cli_setup_args 314s ["--plat-name", "macosx-10.7-x86_64"], 314s # keyword_cmake_args 314s [], 314s # cli_cmake_args 314s [], 314s # expected_cmake_osx_deployment_target 314s "10.7", 314s ), 314s ( 314s # osx_deployment_target_env_var 314s None, 314s # cli_setup_args 314s [], 314s # keyword_cmake_args 314s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 314s # cli_cmake_args 314s [], 314s # expected_cmake_osx_deployment_target 314s "10.7", 314s ), 314s ( 314s # osx_deployment_target_env_var 314s None, 314s # cli_setup_args 314s ["--plat-name", "macosx-10.12-x86_64"], 314s # keyword_cmake_args 314s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 314s # cli_cmake_args 314s [], 314s # expected_cmake_osx_deployment_target 314s "10.7", 314s ), 314s ( 314s # osx_deployment_target_env_var 314s None, 314s # cli_setup_args 314s [], 314s # keyword_cmake_args 314s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 314s # cli_cmake_args 314s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 314s # expected_cmake_osx_deployment_target 314s "10.8", 314s ), 314s ( 314s # osx_deployment_target_env_var 314s None, 314s # cli_setup_args 314s ["--plat-name", "macosx-10.12-x86_64"], 314s # keyword_cmake_args 314s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 314s # cli_cmake_args 314s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 314s # expected_cmake_osx_deployment_target 314s "10.8", 314s ), 314s ], 314s ) 314s def test_cmake_args_keyword_osx_default( 314s osx_deployment_target_env_var, 314s cli_setup_args, 314s keyword_cmake_args, 314s cli_cmake_args, 314s expected_cmake_osx_deployment_target, 314s mocker, 314s monkeypatch, 314s ): 314s tmp_dir = _tmpdir("cmake_args_keyword_osx_default") 314s 314s tmp_dir.join("setup.py").write( 314s textwrap.dedent( 314s """ 314s from skbuild import setup 314s setup( 314s name="test_cmake_args_keyword_osx_default", 314s version="1.2.3", 314s description="A minimal example package", 314s author="The scikit-build team", 314s license="MIT", 314s cmake_args=[{cmake_args}] 314s ) 314s """.format(cmake_args=",".join([f"'{arg}'" for arg in keyword_cmake_args])) 314s ) 314s ) 314s tmp_dir.join("CMakeLists.txt").write( 314s textwrap.dedent( 314s """ 314s message(FATAL_ERROR "This error message should not be displayed") 314s """ 314s ) 314s ) 314s 314s mock_configure = mocker.patch("skbuild.cmaker.CMaker.configure", side_effect=RuntimeError("exit skbuild")) 314s 314s monkeypatch.setattr(platform, "mac_ver", lambda: ("10.9", None, "x84_64")) 314s monkeypatch.setattr(platform, "machine", lambda: "x86_64") 314s monkeypatch.setattr(sys, "platform", "darwin") 314s 314s with push_env(MACOSX_DEPLOYMENT_TARGET=osx_deployment_target_env_var): 314s monkeypatch.setattr(skbuild.constants, "_SKBUILD_PLAT_NAME", skbuild.constants._default_skbuild_plat_name()) 314s with pytest.raises(RuntimeError, match="exit skbuild"): 314s > with execute_setup_py(tmp_dir, ["build", *cli_setup_args, "--", *cli_cmake_args]): 314s 314s cli_cmake_args = [] 314s cli_setup_args = [] 314s expected_cmake_osx_deployment_target = '10.9' 314s keyword_cmake_args = [] 314s mock_configure = 314s mocker = 314s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0xf3570b28> 314s osx_deployment_target_env_var = None 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-52/cmake_args_keyword_osx_default0') 314s 314s tests/test_issue342_cmake_osx_args_in_setup.py:176: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-52/cmake_args_keyword_osx_default0') 314s setup_args = ['build', '--'], disable_languages_test = False 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = False 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-52/cmake_args_keyword_osx_default0') 314s setup_args = ['build', '--'] 314s 314s tests/__init__.py:218: AttributeError 314s _ test_cmake_args_keyword_osx_default[10.7-cli_setup_args1-keyword_cmake_args1-cli_cmake_args1-10.7] _ 314s 314s osx_deployment_target_env_var = '10.7', cli_setup_args = [] 314s keyword_cmake_args = [], cli_cmake_args = [] 314s expected_cmake_osx_deployment_target = '10.7' 314s mocker = 314s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0xf3407060> 314s 314s @pytest.mark.parametrize( 314s params, 314s [ 314s # default plat_name is 'macosx-10.9-x86_64' 314s ( 314s # osx_deployment_target_env_var 314s None, 314s # cli_setup_args 314s [], 314s # keyword_cmake_args 314s [], 314s # cli_cmake_args 314s [], 314s # expected_cmake_osx_deployment_target 314s "10.9", 314s ), 314s ( 314s # osx_deployment_target_env_var 314s "10.7", 314s # cli_setup_args 314s [], 314s # keyword_cmake_args 314s [], 314s # cli_cmake_args 314s [], 314s # expected_cmake_osx_deployment_target 314s "10.7", 314s ), 314s ( 314s # osx_deployment_target_env_var 314s "10.7", 314s # cli_setup_args 314s ["--plat-name", "macosx-10.9-x86_64"], 314s # keyword_cmake_args 314s [], 314s # cli_cmake_args 314s [], 314s # expected_cmake_osx_deployment_target 314s "10.9", 314s ), 314s ( 314s # osx_deployment_target_env_var 314s None, 314s # cli_setup_args 314s ["--plat-name", "macosx-10.6-x86_64"], 314s # keyword_cmake_args 314s [], 314s # cli_cmake_args 314s [], 314s # expected_cmake_osx_deployment_target 314s "10.6", 314s ), 314s ( 314s # osx_deployment_target_env_var 314s None, 314s # cli_setup_args 314s ["--plat-name", "macosx-10.7-x86_64"], 314s # keyword_cmake_args 314s [], 314s # cli_cmake_args 314s [], 314s # expected_cmake_osx_deployment_target 314s "10.7", 314s ), 314s ( 314s # osx_deployment_target_env_var 314s None, 314s # cli_setup_args 314s [], 314s # keyword_cmake_args 314s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 314s # cli_cmake_args 314s [], 314s # expected_cmake_osx_deployment_target 314s "10.7", 314s ), 314s ( 314s # osx_deployment_target_env_var 314s None, 314s # cli_setup_args 314s ["--plat-name", "macosx-10.12-x86_64"], 314s # keyword_cmake_args 314s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 314s # cli_cmake_args 314s [], 314s # expected_cmake_osx_deployment_target 314s "10.7", 314s ), 314s ( 314s # osx_deployment_target_env_var 314s None, 314s # cli_setup_args 314s [], 314s # keyword_cmake_args 314s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 314s # cli_cmake_args 314s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 314s # expected_cmake_osx_deployment_target 314s "10.8", 314s ), 314s ( 314s # osx_deployment_target_env_var 314s None, 314s # cli_setup_args 314s ["--plat-name", "macosx-10.12-x86_64"], 314s # keyword_cmake_args 314s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 314s # cli_cmake_args 314s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 314s # expected_cmake_osx_deployment_target 314s "10.8", 314s ), 314s ], 314s ) 314s def test_cmake_args_keyword_osx_default( 314s osx_deployment_target_env_var, 314s cli_setup_args, 314s keyword_cmake_args, 314s cli_cmake_args, 314s expected_cmake_osx_deployment_target, 314s mocker, 314s monkeypatch, 314s ): 314s tmp_dir = _tmpdir("cmake_args_keyword_osx_default") 314s 314s tmp_dir.join("setup.py").write( 314s textwrap.dedent( 314s """ 314s from skbuild import setup 314s setup( 314s name="test_cmake_args_keyword_osx_default", 314s version="1.2.3", 314s description="A minimal example package", 314s author="The scikit-build team", 314s license="MIT", 314s cmake_args=[{cmake_args}] 314s ) 314s """.format(cmake_args=",".join([f"'{arg}'" for arg in keyword_cmake_args])) 314s ) 314s ) 314s tmp_dir.join("CMakeLists.txt").write( 314s textwrap.dedent( 314s """ 314s message(FATAL_ERROR "This error message should not be displayed") 314s """ 314s ) 314s ) 314s 314s mock_configure = mocker.patch("skbuild.cmaker.CMaker.configure", side_effect=RuntimeError("exit skbuild")) 314s 314s monkeypatch.setattr(platform, "mac_ver", lambda: ("10.9", None, "x84_64")) 314s monkeypatch.setattr(platform, "machine", lambda: "x86_64") 314s monkeypatch.setattr(sys, "platform", "darwin") 314s 314s with push_env(MACOSX_DEPLOYMENT_TARGET=osx_deployment_target_env_var): 314s monkeypatch.setattr(skbuild.constants, "_SKBUILD_PLAT_NAME", skbuild.constants._default_skbuild_plat_name()) 314s with pytest.raises(RuntimeError, match="exit skbuild"): 314s > with execute_setup_py(tmp_dir, ["build", *cli_setup_args, "--", *cli_cmake_args]): 314s 314s cli_cmake_args = [] 314s cli_setup_args = [] 314s expected_cmake_osx_deployment_target = '10.7' 314s keyword_cmake_args = [] 314s mock_configure = 314s mocker = 314s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0xf3407060> 314s osx_deployment_target_env_var = '10.7' 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-53/cmake_args_keyword_osx_default0') 314s 314s tests/test_issue342_cmake_osx_args_in_setup.py:176: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-53/cmake_args_keyword_osx_default0') 314s setup_args = ['build', '--'], disable_languages_test = False 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = False 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-53/cmake_args_keyword_osx_default0') 314s setup_args = ['build', '--'] 314s 314s tests/__init__.py:218: AttributeError 314s _ test_cmake_args_keyword_osx_default[10.7-cli_setup_args2-keyword_cmake_args2-cli_cmake_args2-10.9] _ 314s 314s osx_deployment_target_env_var = '10.7' 314s cli_setup_args = ['--plat-name', 'macosx-10.9-x86_64'], keyword_cmake_args = [] 314s cli_cmake_args = [], expected_cmake_osx_deployment_target = '10.9' 314s mocker = 314s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0xf340b4b0> 314s 314s @pytest.mark.parametrize( 314s params, 314s [ 314s # default plat_name is 'macosx-10.9-x86_64' 314s ( 314s # osx_deployment_target_env_var 314s None, 314s # cli_setup_args 314s [], 314s # keyword_cmake_args 314s [], 314s # cli_cmake_args 314s [], 314s # expected_cmake_osx_deployment_target 314s "10.9", 314s ), 314s ( 314s # osx_deployment_target_env_var 314s "10.7", 314s # cli_setup_args 314s [], 314s # keyword_cmake_args 314s [], 314s # cli_cmake_args 314s [], 314s # expected_cmake_osx_deployment_target 314s "10.7", 314s ), 314s ( 314s # osx_deployment_target_env_var 314s "10.7", 314s # cli_setup_args 314s ["--plat-name", "macosx-10.9-x86_64"], 314s # keyword_cmake_args 314s [], 314s # cli_cmake_args 314s [], 314s # expected_cmake_osx_deployment_target 314s "10.9", 314s ), 314s ( 314s # osx_deployment_target_env_var 314s None, 314s # cli_setup_args 314s ["--plat-name", "macosx-10.6-x86_64"], 314s # keyword_cmake_args 314s [], 314s # cli_cmake_args 314s [], 314s # expected_cmake_osx_deployment_target 314s "10.6", 314s ), 314s ( 314s # osx_deployment_target_env_var 314s None, 314s # cli_setup_args 314s ["--plat-name", "macosx-10.7-x86_64"], 314s # keyword_cmake_args 314s [], 314s # cli_cmake_args 314s [], 314s # expected_cmake_osx_deployment_target 314s "10.7", 314s ), 314s ( 314s # osx_deployment_target_env_var 314s None, 314s # cli_setup_args 314s [], 314s # keyword_cmake_args 314s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 314s # cli_cmake_args 314s [], 314s # expected_cmake_osx_deployment_target 314s "10.7", 314s ), 314s ( 314s # osx_deployment_target_env_var 314s None, 314s # cli_setup_args 314s ["--plat-name", "macosx-10.12-x86_64"], 314s # keyword_cmake_args 314s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 314s # cli_cmake_args 314s [], 314s # expected_cmake_osx_deployment_target 314s "10.7", 314s ), 314s ( 314s # osx_deployment_target_env_var 314s None, 314s # cli_setup_args 314s [], 314s # keyword_cmake_args 314s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 314s # cli_cmake_args 314s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 314s # expected_cmake_osx_deployment_target 314s "10.8", 314s ), 314s ( 314s # osx_deployment_target_env_var 314s None, 314s # cli_setup_args 314s ["--plat-name", "macosx-10.12-x86_64"], 314s # keyword_cmake_args 314s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 314s # cli_cmake_args 314s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 314s # expected_cmake_osx_deployment_target 314s "10.8", 314s ), 314s ], 314s ) 314s def test_cmake_args_keyword_osx_default( 314s osx_deployment_target_env_var, 314s cli_setup_args, 314s keyword_cmake_args, 314s cli_cmake_args, 314s expected_cmake_osx_deployment_target, 314s mocker, 314s monkeypatch, 314s ): 314s tmp_dir = _tmpdir("cmake_args_keyword_osx_default") 314s 314s tmp_dir.join("setup.py").write( 314s textwrap.dedent( 314s """ 314s from skbuild import setup 314s setup( 314s name="test_cmake_args_keyword_osx_default", 314s version="1.2.3", 314s description="A minimal example package", 314s author="The scikit-build team", 314s license="MIT", 314s cmake_args=[{cmake_args}] 314s ) 314s """.format(cmake_args=",".join([f"'{arg}'" for arg in keyword_cmake_args])) 314s ) 314s ) 314s tmp_dir.join("CMakeLists.txt").write( 314s textwrap.dedent( 314s """ 314s message(FATAL_ERROR "This error message should not be displayed") 314s """ 314s ) 314s ) 314s 314s mock_configure = mocker.patch("skbuild.cmaker.CMaker.configure", side_effect=RuntimeError("exit skbuild")) 314s 314s monkeypatch.setattr(platform, "mac_ver", lambda: ("10.9", None, "x84_64")) 314s monkeypatch.setattr(platform, "machine", lambda: "x86_64") 314s monkeypatch.setattr(sys, "platform", "darwin") 314s 314s with push_env(MACOSX_DEPLOYMENT_TARGET=osx_deployment_target_env_var): 314s monkeypatch.setattr(skbuild.constants, "_SKBUILD_PLAT_NAME", skbuild.constants._default_skbuild_plat_name()) 314s with pytest.raises(RuntimeError, match="exit skbuild"): 314s > with execute_setup_py(tmp_dir, ["build", *cli_setup_args, "--", *cli_cmake_args]): 314s 314s cli_cmake_args = [] 314s cli_setup_args = ['--plat-name', 'macosx-10.9-x86_64'] 314s expected_cmake_osx_deployment_target = '10.9' 314s keyword_cmake_args = [] 314s mock_configure = 314s mocker = 314s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0xf340b4b0> 314s osx_deployment_target_env_var = '10.7' 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-54/cmake_args_keyword_osx_default0') 314s 314s tests/test_issue342_cmake_osx_args_in_setup.py:176: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-54/cmake_args_keyword_osx_default0') 314s setup_args = ['build', '--plat-name', 'macosx-10.9-x86_64', '--'] 314s disable_languages_test = False 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = False 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-54/cmake_args_keyword_osx_default0') 314s setup_args = ['build', '--plat-name', 'macosx-10.9-x86_64', '--'] 314s 314s tests/__init__.py:218: AttributeError 314s _ test_cmake_args_keyword_osx_default[None-cli_setup_args3-keyword_cmake_args3-cli_cmake_args3-10.6] _ 314s 314s osx_deployment_target_env_var = None 314s cli_setup_args = ['--plat-name', 'macosx-10.6-x86_64'], keyword_cmake_args = [] 314s cli_cmake_args = [], expected_cmake_osx_deployment_target = '10.6' 314s mocker = 314s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0xf33f4a38> 314s 314s @pytest.mark.parametrize( 314s params, 314s [ 314s # default plat_name is 'macosx-10.9-x86_64' 314s ( 314s # osx_deployment_target_env_var 314s None, 314s # cli_setup_args 314s [], 314s # keyword_cmake_args 314s [], 314s # cli_cmake_args 314s [], 314s # expected_cmake_osx_deployment_target 314s "10.9", 314s ), 314s ( 314s # osx_deployment_target_env_var 314s "10.7", 314s # cli_setup_args 314s [], 314s # keyword_cmake_args 314s [], 314s # cli_cmake_args 314s [], 314s # expected_cmake_osx_deployment_target 314s "10.7", 314s ), 314s ( 314s # osx_deployment_target_env_var 314s "10.7", 314s # cli_setup_args 314s ["--plat-name", "macosx-10.9-x86_64"], 314s # keyword_cmake_args 314s [], 314s # cli_cmake_args 314s [], 314s # expected_cmake_osx_deployment_target 314s "10.9", 314s ), 314s ( 314s # osx_deployment_target_env_var 314s None, 314s # cli_setup_args 314s ["--plat-name", "macosx-10.6-x86_64"], 314s # keyword_cmake_args 314s [], 314s # cli_cmake_args 314s [], 314s # expected_cmake_osx_deployment_target 314s "10.6", 314s ), 314s ( 314s # osx_deployment_target_env_var 314s None, 314s # cli_setup_args 314s ["--plat-name", "macosx-10.7-x86_64"], 314s # keyword_cmake_args 314s [], 314s # cli_cmake_args 314s [], 314s # expected_cmake_osx_deployment_target 314s "10.7", 314s ), 314s ( 314s # osx_deployment_target_env_var 314s None, 314s # cli_setup_args 314s [], 314s # keyword_cmake_args 314s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 314s # cli_cmake_args 314s [], 314s # expected_cmake_osx_deployment_target 314s "10.7", 314s ), 314s ( 314s # osx_deployment_target_env_var 314s None, 314s # cli_setup_args 314s ["--plat-name", "macosx-10.12-x86_64"], 314s # keyword_cmake_args 314s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 314s # cli_cmake_args 314s [], 314s # expected_cmake_osx_deployment_target 314s "10.7", 314s ), 314s ( 314s # osx_deployment_target_env_var 314s None, 314s # cli_setup_args 314s [], 314s # keyword_cmake_args 314s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 314s # cli_cmake_args 314s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 314s # expected_cmake_osx_deployment_target 314s "10.8", 314s ), 314s ( 314s # osx_deployment_target_env_var 314s None, 314s # cli_setup_args 314s ["--plat-name", "macosx-10.12-x86_64"], 314s # keyword_cmake_args 314s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 314s # cli_cmake_args 314s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 314s # expected_cmake_osx_deployment_target 314s "10.8", 314s ), 314s ], 314s ) 314s def test_cmake_args_keyword_osx_default( 314s osx_deployment_target_env_var, 314s cli_setup_args, 314s keyword_cmake_args, 314s cli_cmake_args, 314s expected_cmake_osx_deployment_target, 314s mocker, 314s monkeypatch, 314s ): 314s tmp_dir = _tmpdir("cmake_args_keyword_osx_default") 314s 314s tmp_dir.join("setup.py").write( 314s textwrap.dedent( 314s """ 314s from skbuild import setup 314s setup( 314s name="test_cmake_args_keyword_osx_default", 314s version="1.2.3", 314s description="A minimal example package", 314s author="The scikit-build team", 314s license="MIT", 314s cmake_args=[{cmake_args}] 314s ) 314s """.format(cmake_args=",".join([f"'{arg}'" for arg in keyword_cmake_args])) 314s ) 314s ) 314s tmp_dir.join("CMakeLists.txt").write( 314s textwrap.dedent( 314s """ 314s message(FATAL_ERROR "This error message should not be displayed") 314s """ 314s ) 314s ) 314s 314s mock_configure = mocker.patch("skbuild.cmaker.CMaker.configure", side_effect=RuntimeError("exit skbuild")) 314s 314s monkeypatch.setattr(platform, "mac_ver", lambda: ("10.9", None, "x84_64")) 314s monkeypatch.setattr(platform, "machine", lambda: "x86_64") 314s monkeypatch.setattr(sys, "platform", "darwin") 314s 314s with push_env(MACOSX_DEPLOYMENT_TARGET=osx_deployment_target_env_var): 314s monkeypatch.setattr(skbuild.constants, "_SKBUILD_PLAT_NAME", skbuild.constants._default_skbuild_plat_name()) 314s with pytest.raises(RuntimeError, match="exit skbuild"): 314s > with execute_setup_py(tmp_dir, ["build", *cli_setup_args, "--", *cli_cmake_args]): 314s 314s cli_cmake_args = [] 314s cli_setup_args = ['--plat-name', 'macosx-10.6-x86_64'] 314s expected_cmake_osx_deployment_target = '10.6' 314s keyword_cmake_args = [] 314s mock_configure = 314s mocker = 314s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0xf33f4a38> 314s osx_deployment_target_env_var = None 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-55/cmake_args_keyword_osx_default0') 314s 314s tests/test_issue342_cmake_osx_args_in_setup.py:176: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-55/cmake_args_keyword_osx_default0') 314s setup_args = ['build', '--plat-name', 'macosx-10.6-x86_64', '--'] 314s disable_languages_test = False 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = False 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-55/cmake_args_keyword_osx_default0') 314s setup_args = ['build', '--plat-name', 'macosx-10.6-x86_64', '--'] 314s 314s tests/__init__.py:218: AttributeError 314s _ test_cmake_args_keyword_osx_default[None-cli_setup_args4-keyword_cmake_args4-cli_cmake_args4-10.7] _ 314s 314s osx_deployment_target_env_var = None 314s cli_setup_args = ['--plat-name', 'macosx-10.7-x86_64'], keyword_cmake_args = [] 314s cli_cmake_args = [], expected_cmake_osx_deployment_target = '10.7' 314s mocker = 314s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0xf3414bd0> 314s 314s @pytest.mark.parametrize( 314s params, 314s [ 314s # default plat_name is 'macosx-10.9-x86_64' 314s ( 314s # osx_deployment_target_env_var 314s None, 314s # cli_setup_args 314s [], 314s # keyword_cmake_args 314s [], 314s # cli_cmake_args 314s [], 314s # expected_cmake_osx_deployment_target 314s "10.9", 314s ), 314s ( 314s # osx_deployment_target_env_var 314s "10.7", 314s # cli_setup_args 314s [], 314s # keyword_cmake_args 314s [], 314s # cli_cmake_args 314s [], 314s # expected_cmake_osx_deployment_target 314s "10.7", 314s ), 314s ( 314s # osx_deployment_target_env_var 314s "10.7", 314s # cli_setup_args 314s ["--plat-name", "macosx-10.9-x86_64"], 314s # keyword_cmake_args 314s [], 314s # cli_cmake_args 314s [], 314s # expected_cmake_osx_deployment_target 314s "10.9", 314s ), 314s ( 314s # osx_deployment_target_env_var 314s None, 314s # cli_setup_args 314s ["--plat-name", "macosx-10.6-x86_64"], 314s # keyword_cmake_args 314s [], 314s # cli_cmake_args 314s [], 314s # expected_cmake_osx_deployment_target 314s "10.6", 314s ), 314s ( 314s # osx_deployment_target_env_var 314s None, 314s # cli_setup_args 314s ["--plat-name", "macosx-10.7-x86_64"], 314s # keyword_cmake_args 314s [], 314s # cli_cmake_args 314s [], 314s # expected_cmake_osx_deployment_target 314s "10.7", 314s ), 314s ( 314s # osx_deployment_target_env_var 314s None, 314s # cli_setup_args 314s [], 314s # keyword_cmake_args 314s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 314s # cli_cmake_args 314s [], 314s # expected_cmake_osx_deployment_target 314s "10.7", 314s ), 314s ( 314s # osx_deployment_target_env_var 314s None, 314s # cli_setup_args 314s ["--plat-name", "macosx-10.12-x86_64"], 314s # keyword_cmake_args 314s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 314s # cli_cmake_args 314s [], 314s # expected_cmake_osx_deployment_target 314s "10.7", 314s ), 314s ( 314s # osx_deployment_target_env_var 314s None, 314s # cli_setup_args 314s [], 314s # keyword_cmake_args 314s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 314s # cli_cmake_args 314s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 314s # expected_cmake_osx_deployment_target 314s "10.8", 314s ), 314s ( 314s # osx_deployment_target_env_var 314s None, 314s # cli_setup_args 314s ["--plat-name", "macosx-10.12-x86_64"], 314s # keyword_cmake_args 314s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 314s # cli_cmake_args 314s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 314s # expected_cmake_osx_deployment_target 314s "10.8", 314s ), 314s ], 314s ) 314s def test_cmake_args_keyword_osx_default( 314s osx_deployment_target_env_var, 314s cli_setup_args, 314s keyword_cmake_args, 314s cli_cmake_args, 314s expected_cmake_osx_deployment_target, 314s mocker, 314s monkeypatch, 314s ): 314s tmp_dir = _tmpdir("cmake_args_keyword_osx_default") 314s 314s tmp_dir.join("setup.py").write( 314s textwrap.dedent( 314s """ 314s from skbuild import setup 314s setup( 314s name="test_cmake_args_keyword_osx_default", 314s version="1.2.3", 314s description="A minimal example package", 314s author="The scikit-build team", 314s license="MIT", 314s cmake_args=[{cmake_args}] 314s ) 314s """.format(cmake_args=",".join([f"'{arg}'" for arg in keyword_cmake_args])) 314s ) 314s ) 314s tmp_dir.join("CMakeLists.txt").write( 314s textwrap.dedent( 314s """ 314s message(FATAL_ERROR "This error message should not be displayed") 314s """ 314s ) 314s ) 314s 314s mock_configure = mocker.patch("skbuild.cmaker.CMaker.configure", side_effect=RuntimeError("exit skbuild")) 314s 314s monkeypatch.setattr(platform, "mac_ver", lambda: ("10.9", None, "x84_64")) 314s monkeypatch.setattr(platform, "machine", lambda: "x86_64") 314s monkeypatch.setattr(sys, "platform", "darwin") 314s 314s with push_env(MACOSX_DEPLOYMENT_TARGET=osx_deployment_target_env_var): 314s monkeypatch.setattr(skbuild.constants, "_SKBUILD_PLAT_NAME", skbuild.constants._default_skbuild_plat_name()) 314s with pytest.raises(RuntimeError, match="exit skbuild"): 314s > with execute_setup_py(tmp_dir, ["build", *cli_setup_args, "--", *cli_cmake_args]): 314s 314s cli_cmake_args = [] 314s cli_setup_args = ['--plat-name', 'macosx-10.7-x86_64'] 314s expected_cmake_osx_deployment_target = '10.7' 314s keyword_cmake_args = [] 314s mock_configure = 314s mocker = 314s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0xf3414bd0> 314s osx_deployment_target_env_var = None 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-56/cmake_args_keyword_osx_default0') 314s 314s tests/test_issue342_cmake_osx_args_in_setup.py:176: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-56/cmake_args_keyword_osx_default0') 314s setup_args = ['build', '--plat-name', 'macosx-10.7-x86_64', '--'] 314s disable_languages_test = False 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = False 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-56/cmake_args_keyword_osx_default0') 314s setup_args = ['build', '--plat-name', 'macosx-10.7-x86_64', '--'] 314s 314s tests/__init__.py:218: AttributeError 314s _ test_cmake_args_keyword_osx_default[None-cli_setup_args5-keyword_cmake_args5-cli_cmake_args5-10.7] _ 314s 314s osx_deployment_target_env_var = None, cli_setup_args = [] 314s keyword_cmake_args = ['-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7'] 314s cli_cmake_args = [], expected_cmake_osx_deployment_target = '10.7' 314s mocker = 314s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0xf340bfd8> 314s 314s @pytest.mark.parametrize( 314s params, 314s [ 314s # default plat_name is 'macosx-10.9-x86_64' 314s ( 314s # osx_deployment_target_env_var 314s None, 314s # cli_setup_args 314s [], 314s # keyword_cmake_args 314s [], 314s # cli_cmake_args 314s [], 314s # expected_cmake_osx_deployment_target 314s "10.9", 314s ), 314s ( 314s # osx_deployment_target_env_var 314s "10.7", 314s # cli_setup_args 314s [], 314s # keyword_cmake_args 314s [], 314s # cli_cmake_args 314s [], 314s # expected_cmake_osx_deployment_target 314s "10.7", 314s ), 314s ( 314s # osx_deployment_target_env_var 314s "10.7", 314s # cli_setup_args 314s ["--plat-name", "macosx-10.9-x86_64"], 314s # keyword_cmake_args 314s [], 314s # cli_cmake_args 314s [], 314s # expected_cmake_osx_deployment_target 314s "10.9", 314s ), 314s ( 314s # osx_deployment_target_env_var 314s None, 314s # cli_setup_args 314s ["--plat-name", "macosx-10.6-x86_64"], 314s # keyword_cmake_args 314s [], 314s # cli_cmake_args 314s [], 314s # expected_cmake_osx_deployment_target 314s "10.6", 314s ), 314s ( 314s # osx_deployment_target_env_var 314s None, 314s # cli_setup_args 314s ["--plat-name", "macosx-10.7-x86_64"], 314s # keyword_cmake_args 314s [], 314s # cli_cmake_args 314s [], 314s # expected_cmake_osx_deployment_target 314s "10.7", 314s ), 314s ( 314s # osx_deployment_target_env_var 314s None, 314s # cli_setup_args 314s [], 314s # keyword_cmake_args 314s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 314s # cli_cmake_args 314s [], 314s # expected_cmake_osx_deployment_target 314s "10.7", 314s ), 314s ( 314s # osx_deployment_target_env_var 314s None, 314s # cli_setup_args 314s ["--plat-name", "macosx-10.12-x86_64"], 314s # keyword_cmake_args 314s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 314s # cli_cmake_args 314s [], 314s # expected_cmake_osx_deployment_target 314s "10.7", 314s ), 314s ( 314s # osx_deployment_target_env_var 314s None, 314s # cli_setup_args 314s [], 314s # keyword_cmake_args 314s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 314s # cli_cmake_args 314s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 314s # expected_cmake_osx_deployment_target 314s "10.8", 314s ), 314s ( 314s # osx_deployment_target_env_var 314s None, 314s # cli_setup_args 314s ["--plat-name", "macosx-10.12-x86_64"], 314s # keyword_cmake_args 314s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 314s # cli_cmake_args 314s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 314s # expected_cmake_osx_deployment_target 314s "10.8", 314s ), 314s ], 314s ) 314s def test_cmake_args_keyword_osx_default( 314s osx_deployment_target_env_var, 314s cli_setup_args, 314s keyword_cmake_args, 314s cli_cmake_args, 314s expected_cmake_osx_deployment_target, 314s mocker, 314s monkeypatch, 314s ): 314s tmp_dir = _tmpdir("cmake_args_keyword_osx_default") 314s 314s tmp_dir.join("setup.py").write( 314s textwrap.dedent( 314s """ 314s from skbuild import setup 314s setup( 314s name="test_cmake_args_keyword_osx_default", 314s version="1.2.3", 314s description="A minimal example package", 314s author="The scikit-build team", 314s license="MIT", 314s cmake_args=[{cmake_args}] 314s ) 314s """.format(cmake_args=",".join([f"'{arg}'" for arg in keyword_cmake_args])) 314s ) 314s ) 314s tmp_dir.join("CMakeLists.txt").write( 314s textwrap.dedent( 314s """ 314s message(FATAL_ERROR "This error message should not be displayed") 314s """ 314s ) 314s ) 314s 314s mock_configure = mocker.patch("skbuild.cmaker.CMaker.configure", side_effect=RuntimeError("exit skbuild")) 314s 314s monkeypatch.setattr(platform, "mac_ver", lambda: ("10.9", None, "x84_64")) 314s monkeypatch.setattr(platform, "machine", lambda: "x86_64") 314s monkeypatch.setattr(sys, "platform", "darwin") 314s 314s with push_env(MACOSX_DEPLOYMENT_TARGET=osx_deployment_target_env_var): 314s monkeypatch.setattr(skbuild.constants, "_SKBUILD_PLAT_NAME", skbuild.constants._default_skbuild_plat_name()) 314s with pytest.raises(RuntimeError, match="exit skbuild"): 314s > with execute_setup_py(tmp_dir, ["build", *cli_setup_args, "--", *cli_cmake_args]): 314s 314s cli_cmake_args = [] 314s cli_setup_args = [] 314s expected_cmake_osx_deployment_target = '10.7' 314s keyword_cmake_args = ['-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7'] 314s mock_configure = 314s mocker = 314s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0xf340bfd8> 314s osx_deployment_target_env_var = None 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-57/cmake_args_keyword_osx_default0') 314s 314s tests/test_issue342_cmake_osx_args_in_setup.py:176: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-57/cmake_args_keyword_osx_default0') 314s setup_args = ['build', '--'], disable_languages_test = False 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = False 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-57/cmake_args_keyword_osx_default0') 314s setup_args = ['build', '--'] 314s 314s tests/__init__.py:218: AttributeError 314s _ test_cmake_args_keyword_osx_default[None-cli_setup_args6-keyword_cmake_args6-cli_cmake_args6-10.7] _ 314s 314s osx_deployment_target_env_var = None 314s cli_setup_args = ['--plat-name', 'macosx-10.12-x86_64'] 314s keyword_cmake_args = ['-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7'] 314s cli_cmake_args = [], expected_cmake_osx_deployment_target = '10.7' 314s mocker = 314s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0xf34680d8> 314s 314s @pytest.mark.parametrize( 314s params, 314s [ 314s # default plat_name is 'macosx-10.9-x86_64' 314s ( 314s # osx_deployment_target_env_var 314s None, 314s # cli_setup_args 314s [], 314s # keyword_cmake_args 314s [], 314s # cli_cmake_args 314s [], 314s # expected_cmake_osx_deployment_target 314s "10.9", 314s ), 314s ( 314s # osx_deployment_target_env_var 314s "10.7", 314s # cli_setup_args 314s [], 314s # keyword_cmake_args 314s [], 314s # cli_cmake_args 314s [], 314s # expected_cmake_osx_deployment_target 314s "10.7", 314s ), 314s ( 314s # osx_deployment_target_env_var 314s "10.7", 314s # cli_setup_args 314s ["--plat-name", "macosx-10.9-x86_64"], 314s # keyword_cmake_args 314s [], 314s # cli_cmake_args 314s [], 314s # expected_cmake_osx_deployment_target 314s "10.9", 314s ), 314s ( 314s # osx_deployment_target_env_var 314s None, 314s # cli_setup_args 314s ["--plat-name", "macosx-10.6-x86_64"], 314s # keyword_cmake_args 314s [], 314s # cli_cmake_args 314s [], 314s # expected_cmake_osx_deployment_target 314s "10.6", 314s ), 314s ( 314s # osx_deployment_target_env_var 314s None, 314s # cli_setup_args 314s ["--plat-name", "macosx-10.7-x86_64"], 314s # keyword_cmake_args 314s [], 314s # cli_cmake_args 314s [], 314s # expected_cmake_osx_deployment_target 314s "10.7", 314s ), 314s ( 314s # osx_deployment_target_env_var 314s None, 314s # cli_setup_args 314s [], 314s # keyword_cmake_args 314s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 314s # cli_cmake_args 314s [], 314s # expected_cmake_osx_deployment_target 314s "10.7", 314s ), 314s ( 314s # osx_deployment_target_env_var 314s None, 314s # cli_setup_args 314s ["--plat-name", "macosx-10.12-x86_64"], 314s # keyword_cmake_args 314s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 314s # cli_cmake_args 314s [], 314s # expected_cmake_osx_deployment_target 314s "10.7", 314s ), 314s ( 314s # osx_deployment_target_env_var 314s None, 314s # cli_setup_args 314s [], 314s # keyword_cmake_args 314s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 314s # cli_cmake_args 314s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 314s # expected_cmake_osx_deployment_target 314s "10.8", 314s ), 314s ( 314s # osx_deployment_target_env_var 314s None, 314s # cli_setup_args 314s ["--plat-name", "macosx-10.12-x86_64"], 314s # keyword_cmake_args 314s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 314s # cli_cmake_args 314s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 314s # expected_cmake_osx_deployment_target 314s "10.8", 314s ), 314s ], 314s ) 314s def test_cmake_args_keyword_osx_default( 314s osx_deployment_target_env_var, 314s cli_setup_args, 314s keyword_cmake_args, 314s cli_cmake_args, 314s expected_cmake_osx_deployment_target, 314s mocker, 314s monkeypatch, 314s ): 314s tmp_dir = _tmpdir("cmake_args_keyword_osx_default") 314s 314s tmp_dir.join("setup.py").write( 314s textwrap.dedent( 314s """ 314s from skbuild import setup 314s setup( 314s name="test_cmake_args_keyword_osx_default", 314s version="1.2.3", 314s description="A minimal example package", 314s author="The scikit-build team", 314s license="MIT", 314s cmake_args=[{cmake_args}] 314s ) 314s """.format(cmake_args=",".join([f"'{arg}'" for arg in keyword_cmake_args])) 314s ) 314s ) 314s tmp_dir.join("CMakeLists.txt").write( 314s textwrap.dedent( 314s """ 314s message(FATAL_ERROR "This error message should not be displayed") 314s """ 314s ) 314s ) 314s 314s mock_configure = mocker.patch("skbuild.cmaker.CMaker.configure", side_effect=RuntimeError("exit skbuild")) 314s 314s monkeypatch.setattr(platform, "mac_ver", lambda: ("10.9", None, "x84_64")) 314s monkeypatch.setattr(platform, "machine", lambda: "x86_64") 314s monkeypatch.setattr(sys, "platform", "darwin") 314s 314s with push_env(MACOSX_DEPLOYMENT_TARGET=osx_deployment_target_env_var): 314s monkeypatch.setattr(skbuild.constants, "_SKBUILD_PLAT_NAME", skbuild.constants._default_skbuild_plat_name()) 314s with pytest.raises(RuntimeError, match="exit skbuild"): 314s > with execute_setup_py(tmp_dir, ["build", *cli_setup_args, "--", *cli_cmake_args]): 314s 314s cli_cmake_args = [] 314s cli_setup_args = ['--plat-name', 'macosx-10.12-x86_64'] 314s expected_cmake_osx_deployment_target = '10.7' 314s keyword_cmake_args = ['-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7'] 314s mock_configure = 314s mocker = 314s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0xf34680d8> 314s osx_deployment_target_env_var = None 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-58/cmake_args_keyword_osx_default0') 314s 314s tests/test_issue342_cmake_osx_args_in_setup.py:176: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-58/cmake_args_keyword_osx_default0') 314s setup_args = ['build', '--plat-name', 'macosx-10.12-x86_64', '--'] 314s disable_languages_test = False 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = False 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-58/cmake_args_keyword_osx_default0') 314s setup_args = ['build', '--plat-name', 'macosx-10.12-x86_64', '--'] 314s 314s tests/__init__.py:218: AttributeError 314s _ test_cmake_args_keyword_osx_default[None-cli_setup_args7-keyword_cmake_args7-cli_cmake_args7-10.8] _ 314s 314s osx_deployment_target_env_var = None, cli_setup_args = [] 314s keyword_cmake_args = ['-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7'] 314s cli_cmake_args = ['-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8'] 314s expected_cmake_osx_deployment_target = '10.8' 314s mocker = 314s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0xf33de1f8> 314s 314s @pytest.mark.parametrize( 314s params, 314s [ 314s # default plat_name is 'macosx-10.9-x86_64' 314s ( 314s # osx_deployment_target_env_var 314s None, 314s # cli_setup_args 314s [], 314s # keyword_cmake_args 314s [], 314s # cli_cmake_args 314s [], 314s # expected_cmake_osx_deployment_target 314s "10.9", 314s ), 314s ( 314s # osx_deployment_target_env_var 314s "10.7", 314s # cli_setup_args 314s [], 314s # keyword_cmake_args 314s [], 314s # cli_cmake_args 314s [], 314s # expected_cmake_osx_deployment_target 314s "10.7", 314s ), 314s ( 314s # osx_deployment_target_env_var 314s "10.7", 314s # cli_setup_args 314s ["--plat-name", "macosx-10.9-x86_64"], 314s # keyword_cmake_args 314s [], 314s # cli_cmake_args 314s [], 314s # expected_cmake_osx_deployment_target 314s "10.9", 314s ), 314s ( 314s # osx_deployment_target_env_var 314s None, 314s # cli_setup_args 314s ["--plat-name", "macosx-10.6-x86_64"], 314s # keyword_cmake_args 314s [], 314s # cli_cmake_args 314s [], 314s # expected_cmake_osx_deployment_target 314s "10.6", 314s ), 314s ( 314s # osx_deployment_target_env_var 314s None, 314s # cli_setup_args 314s ["--plat-name", "macosx-10.7-x86_64"], 314s # keyword_cmake_args 314s [], 314s # cli_cmake_args 314s [], 314s # expected_cmake_osx_deployment_target 314s "10.7", 314s ), 314s ( 314s # osx_deployment_target_env_var 314s None, 314s # cli_setup_args 314s [], 314s # keyword_cmake_args 314s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 314s # cli_cmake_args 314s [], 314s # expected_cmake_osx_deployment_target 314s "10.7", 314s ), 314s ( 314s # osx_deployment_target_env_var 314s None, 314s # cli_setup_args 314s ["--plat-name", "macosx-10.12-x86_64"], 314s # keyword_cmake_args 314s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 314s # cli_cmake_args 314s [], 314s # expected_cmake_osx_deployment_target 314s "10.7", 314s ), 314s ( 314s # osx_deployment_target_env_var 314s None, 314s # cli_setup_args 314s [], 314s # keyword_cmake_args 314s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 314s # cli_cmake_args 314s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 314s # expected_cmake_osx_deployment_target 314s "10.8", 314s ), 314s ( 314s # osx_deployment_target_env_var 314s None, 314s # cli_setup_args 314s ["--plat-name", "macosx-10.12-x86_64"], 314s # keyword_cmake_args 314s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 314s # cli_cmake_args 314s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 314s # expected_cmake_osx_deployment_target 314s "10.8", 314s ), 314s ], 314s ) 314s def test_cmake_args_keyword_osx_default( 314s osx_deployment_target_env_var, 314s cli_setup_args, 314s keyword_cmake_args, 314s cli_cmake_args, 314s expected_cmake_osx_deployment_target, 314s mocker, 314s monkeypatch, 314s ): 314s tmp_dir = _tmpdir("cmake_args_keyword_osx_default") 314s 314s tmp_dir.join("setup.py").write( 314s textwrap.dedent( 314s """ 314s from skbuild import setup 314s setup( 314s name="test_cmake_args_keyword_osx_default", 314s version="1.2.3", 314s description="A minimal example package", 314s author="The scikit-build team", 314s license="MIT", 314s cmake_args=[{cmake_args}] 314s ) 314s """.format(cmake_args=",".join([f"'{arg}'" for arg in keyword_cmake_args])) 314s ) 314s ) 314s tmp_dir.join("CMakeLists.txt").write( 314s textwrap.dedent( 314s """ 314s message(FATAL_ERROR "This error message should not be displayed") 314s """ 314s ) 314s ) 314s 314s mock_configure = mocker.patch("skbuild.cmaker.CMaker.configure", side_effect=RuntimeError("exit skbuild")) 314s 314s monkeypatch.setattr(platform, "mac_ver", lambda: ("10.9", None, "x84_64")) 314s monkeypatch.setattr(platform, "machine", lambda: "x86_64") 314s monkeypatch.setattr(sys, "platform", "darwin") 314s 314s with push_env(MACOSX_DEPLOYMENT_TARGET=osx_deployment_target_env_var): 314s monkeypatch.setattr(skbuild.constants, "_SKBUILD_PLAT_NAME", skbuild.constants._default_skbuild_plat_name()) 314s with pytest.raises(RuntimeError, match="exit skbuild"): 314s > with execute_setup_py(tmp_dir, ["build", *cli_setup_args, "--", *cli_cmake_args]): 314s 314s cli_cmake_args = ['-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8'] 314s cli_setup_args = [] 314s expected_cmake_osx_deployment_target = '10.8' 314s keyword_cmake_args = ['-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7'] 314s mock_configure = 314s mocker = 314s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0xf33de1f8> 314s osx_deployment_target_env_var = None 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-59/cmake_args_keyword_osx_default0') 314s 314s tests/test_issue342_cmake_osx_args_in_setup.py:176: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-59/cmake_args_keyword_osx_default0') 314s setup_args = ['build', '--', '-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8'] 314s disable_languages_test = False 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = False 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-59/cmake_args_keyword_osx_default0') 314s setup_args = ['build', '--', '-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8'] 314s 314s tests/__init__.py:218: AttributeError 314s _ test_cmake_args_keyword_osx_default[None-cli_setup_args8-keyword_cmake_args8-cli_cmake_args8-10.8] _ 314s 314s osx_deployment_target_env_var = None 314s cli_setup_args = ['--plat-name', 'macosx-10.12-x86_64'] 314s keyword_cmake_args = ['-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7'] 314s cli_cmake_args = ['-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8'] 314s expected_cmake_osx_deployment_target = '10.8' 314s mocker = 314s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0xf349ab28> 314s 314s @pytest.mark.parametrize( 314s params, 314s [ 314s # default plat_name is 'macosx-10.9-x86_64' 314s ( 314s # osx_deployment_target_env_var 314s None, 314s # cli_setup_args 314s [], 314s # keyword_cmake_args 314s [], 314s # cli_cmake_args 314s [], 314s # expected_cmake_osx_deployment_target 314s "10.9", 314s ), 314s ( 314s # osx_deployment_target_env_var 314s "10.7", 314s # cli_setup_args 314s [], 314s # keyword_cmake_args 314s [], 314s # cli_cmake_args 314s [], 314s # expected_cmake_osx_deployment_target 314s "10.7", 314s ), 314s ( 314s # osx_deployment_target_env_var 314s "10.7", 314s # cli_setup_args 314s ["--plat-name", "macosx-10.9-x86_64"], 314s # keyword_cmake_args 314s [], 314s # cli_cmake_args 314s [], 314s # expected_cmake_osx_deployment_target 314s "10.9", 314s ), 314s ( 314s # osx_deployment_target_env_var 314s None, 314s # cli_setup_args 314s ["--plat-name", "macosx-10.6-x86_64"], 314s # keyword_cmake_args 314s [], 314s # cli_cmake_args 314s [], 314s # expected_cmake_osx_deployment_target 314s "10.6", 314s ), 314s ( 314s # osx_deployment_target_env_var 314s None, 314s # cli_setup_args 314s ["--plat-name", "macosx-10.7-x86_64"], 314s # keyword_cmake_args 314s [], 314s # cli_cmake_args 314s [], 314s # expected_cmake_osx_deployment_target 314s "10.7", 314s ), 314s ( 314s # osx_deployment_target_env_var 314s None, 314s # cli_setup_args 314s [], 314s # keyword_cmake_args 314s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 314s # cli_cmake_args 314s [], 314s # expected_cmake_osx_deployment_target 314s "10.7", 314s ), 314s ( 314s # osx_deployment_target_env_var 314s None, 314s # cli_setup_args 314s ["--plat-name", "macosx-10.12-x86_64"], 314s # keyword_cmake_args 314s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 314s # cli_cmake_args 314s [], 314s # expected_cmake_osx_deployment_target 314s "10.7", 314s ), 314s ( 314s # osx_deployment_target_env_var 314s None, 314s # cli_setup_args 314s [], 314s # keyword_cmake_args 314s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 314s # cli_cmake_args 314s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 314s # expected_cmake_osx_deployment_target 314s "10.8", 314s ), 314s ( 314s # osx_deployment_target_env_var 314s None, 314s # cli_setup_args 314s ["--plat-name", "macosx-10.12-x86_64"], 314s # keyword_cmake_args 314s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 314s # cli_cmake_args 314s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 314s # expected_cmake_osx_deployment_target 314s "10.8", 314s ), 314s ], 314s ) 314s def test_cmake_args_keyword_osx_default( 314s osx_deployment_target_env_var, 314s cli_setup_args, 314s keyword_cmake_args, 314s cli_cmake_args, 314s expected_cmake_osx_deployment_target, 314s mocker, 314s monkeypatch, 314s ): 314s tmp_dir = _tmpdir("cmake_args_keyword_osx_default") 314s 314s tmp_dir.join("setup.py").write( 314s textwrap.dedent( 314s """ 314s from skbuild import setup 314s setup( 314s name="test_cmake_args_keyword_osx_default", 314s version="1.2.3", 314s description="A minimal example package", 314s author="The scikit-build team", 314s license="MIT", 314s cmake_args=[{cmake_args}] 314s ) 314s """.format(cmake_args=",".join([f"'{arg}'" for arg in keyword_cmake_args])) 314s ) 314s ) 314s tmp_dir.join("CMakeLists.txt").write( 314s textwrap.dedent( 314s """ 314s message(FATAL_ERROR "This error message should not be displayed") 314s """ 314s ) 314s ) 314s 314s mock_configure = mocker.patch("skbuild.cmaker.CMaker.configure", side_effect=RuntimeError("exit skbuild")) 314s 314s monkeypatch.setattr(platform, "mac_ver", lambda: ("10.9", None, "x84_64")) 314s monkeypatch.setattr(platform, "machine", lambda: "x86_64") 314s monkeypatch.setattr(sys, "platform", "darwin") 314s 314s with push_env(MACOSX_DEPLOYMENT_TARGET=osx_deployment_target_env_var): 314s monkeypatch.setattr(skbuild.constants, "_SKBUILD_PLAT_NAME", skbuild.constants._default_skbuild_plat_name()) 314s with pytest.raises(RuntimeError, match="exit skbuild"): 314s > with execute_setup_py(tmp_dir, ["build", *cli_setup_args, "--", *cli_cmake_args]): 314s 314s cli_cmake_args = ['-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8'] 314s cli_setup_args = ['--plat-name', 'macosx-10.12-x86_64'] 314s expected_cmake_osx_deployment_target = '10.8' 314s keyword_cmake_args = ['-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7'] 314s mock_configure = 314s mocker = 314s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0xf349ab28> 314s osx_deployment_target_env_var = None 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-60/cmake_args_keyword_osx_default0') 314s 314s tests/test_issue342_cmake_osx_args_in_setup.py:176: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-60/cmake_args_keyword_osx_default0') 314s setup_args = ['build', '--plat-name', 'macosx-10.12-x86_64', '--', '-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8'] 314s disable_languages_test = False 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = False 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-60/cmake_args_keyword_osx_default0') 314s setup_args = ['build', '--plat-name', 'macosx-10.12-x86_64', '--', '-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8'] 314s 314s tests/__init__.py:218: AttributeError 314s ____________________ test_isolated_env_trigger_reconfigure _____________________ 314s 314s mocker = 314s 314s def test_isolated_env_trigger_reconfigure(mocker): 314s tmp_dir = _tmpdir("isolated_env_trigger_reconfigure") 314s 314s tmp_dir.join("setup.py").write( 314s textwrap.dedent( 314s """ 314s from skbuild import setup 314s setup( 314s name="test_isolated_env_trigger_reconfigure", 314s version="1.2.3", 314s description="A minimal example package", 314s author="The scikit-build team", 314s license="MIT", 314s ) 314s """ 314s ) 314s ) 314s tmp_dir.join("CMakeLists.txt").write( 314s textwrap.dedent( 314s """ 314s message(FATAL_ERROR "This error message should not be displayed") 314s """ 314s ) 314s ) 314s 314s # 314s # mock configure 314s # 314s def fake_configure(*args, **kwargs): 314s # Simulate a successful configuration creating a CMakeCache.txt 314s tmp_dir.ensure(CMAKE_BUILD_DIR(), dir=1).join("CMakeCache.txt").write( 314s textwrap.dedent( 314s """ 314s //Name of generator. 314s CMAKE_GENERATOR:INTERNAL=Ninja 314s """ 314s ) 314s ) 314s 314s # Skip real configuration creating the CMakeCache.txt expected by 314s # "skbuild.setuptools_wrap._load_cmake_spec()" function 314s mocker.patch("skbuild.cmaker.CMaker.configure", new=fake_configure) 314s 314s # 314s # mock _save_cmake_spec 314s # 314s _save_cmake_spec_original = skbuild.setuptools_wrap._save_cmake_spec 314s 314s exit_after_saving_cmake_spec = "exit skbuild saving cmake spec" 314s 314s def _save_cmake_spec_mock(args): 314s _save_cmake_spec_original(args) 314s raise RuntimeError(exit_after_saving_cmake_spec) 314s 314s mocker.patch("skbuild.setuptools_wrap._save_cmake_spec", new=_save_cmake_spec_mock) 314s 314s # 314s # mock make 314s # 314s exit_before_running_cmake = "exit skbuild running make" 314s mocker.patch("skbuild.cmaker.CMaker.make", side_effect=RuntimeError(exit_before_running_cmake)) 314s 314s # first build: "configure" and "_save_cmake_spec" are expected to be called 314s with pytest.raises(RuntimeError, match=exit_after_saving_cmake_spec): 314s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 314s 314s _save_cmake_spec_mock = ._save_cmake_spec_mock at 0xf345d758> 314s _save_cmake_spec_original = 314s exit_after_saving_cmake_spec = 'exit skbuild saving cmake spec' 314s exit_before_running_cmake = 'exit skbuild running make' 314s fake_configure = .fake_configure at 0xf3408d98> 314s mocker = 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-61/isolated_env_trigger_reconfigu0') 314s 314s tests/test_issue352_isolated_environment_support.py:78: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-61/isolated_env_trigger_reconfigu0') 314s setup_args = ['build'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-61/isolated_env_trigger_reconfigu0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s __________________________ test_symbol_visibility[ON] __________________________ 314s 314s skip_override = 'ON' 314s 314s @pytest.mark.skipif( 314s platform.system().lower() not in ["linux"], reason="Executable and Linkable Format (ELF) is specific to Linux" 314s ) 314s @pytest.mark.parametrize("skip_override", ["ON", "OFF"]) 314s def test_symbol_visibility(skip_override): 314s with push_dir(): 314s tmp_dir = _tmpdir("test_issue668_symbol_visibility") 314s project = "issue-668-symbol-visibility" 314s prepare_project(project, tmp_dir) 314s initialize_git_repo_and_commit(tmp_dir, verbose=True) 314s 314s > with execute_setup_py( 314s tmp_dir, ["build", f"-DSKBUILD_GNU_SKIP_LOCAL_SYMBOL_EXPORT_OVERRIDE:BOOL={skip_override}"] 314s ): 314s 314s project = 'issue-668-symbol-visibility' 314s skip_override = 'ON' 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-62/test_issue668_symbol_visibilit0') 314s 314s tests/test_issue668_symbol_visibility.py:32: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-62/test_issue668_symbol_visibilit0') 314s setup_args = ['build', '-DSKBUILD_GNU_SKIP_LOCAL_SYMBOL_EXPORT_OVERRIDE:BOOL=ON'] 314s disable_languages_test = False 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = False 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-62/test_issue668_symbol_visibilit0') 314s setup_args = ['build', '-DSKBUILD_GNU_SKIP_LOCAL_SYMBOL_EXPORT_OVERRIDE:BOOL=ON'] 314s 314s tests/__init__.py:218: AttributeError 314s ----------------------------- Captured stdout call ----------------------------- 314s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-62/test_issue668_symbol_visibilit0/.git/ 314s [master (root-commit) 4325bdd] Initial commit 314s 5 files changed, 121 insertions(+) 314s create mode 100644 CMakeLists.txt 314s create mode 100644 hello/__init__.py 314s create mode 100644 hello/_hello.cxx 314s create mode 100644 pyproject.toml 314s create mode 100644 setup.py 314s ----------------------------- Captured stderr call ----------------------------- 314s hint: Using 'master' as the name for the initial branch. This default branch name 314s hint: is subject to change. To configure the initial branch name to use in all 314s hint: of your new repositories, which will suppress this warning, call: 314s hint: 314s hint: git config --global init.defaultBranch 314s hint: 314s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 314s hint: 'development'. The just-created branch can be renamed via this command: 314s hint: 314s hint: git branch -m 314s _________________________ test_symbol_visibility[OFF] __________________________ 314s 314s skip_override = 'OFF' 314s 314s @pytest.mark.skipif( 314s platform.system().lower() not in ["linux"], reason="Executable and Linkable Format (ELF) is specific to Linux" 314s ) 314s @pytest.mark.parametrize("skip_override", ["ON", "OFF"]) 314s def test_symbol_visibility(skip_override): 314s with push_dir(): 314s tmp_dir = _tmpdir("test_issue668_symbol_visibility") 314s project = "issue-668-symbol-visibility" 314s prepare_project(project, tmp_dir) 314s initialize_git_repo_and_commit(tmp_dir, verbose=True) 314s 314s > with execute_setup_py( 314s tmp_dir, ["build", f"-DSKBUILD_GNU_SKIP_LOCAL_SYMBOL_EXPORT_OVERRIDE:BOOL={skip_override}"] 314s ): 314s 314s project = 'issue-668-symbol-visibility' 314s skip_override = 'OFF' 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-63/test_issue668_symbol_visibilit0') 314s 314s tests/test_issue668_symbol_visibility.py:32: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-63/test_issue668_symbol_visibilit0') 314s setup_args = ['build', '-DSKBUILD_GNU_SKIP_LOCAL_SYMBOL_EXPORT_OVERRIDE:BOOL=OFF'] 314s disable_languages_test = False 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = False 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-63/test_issue668_symbol_visibilit0') 314s setup_args = ['build', '-DSKBUILD_GNU_SKIP_LOCAL_SYMBOL_EXPORT_OVERRIDE:BOOL=OFF'] 314s 314s tests/__init__.py:218: AttributeError 314s ----------------------------- Captured stdout call ----------------------------- 314s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-63/test_issue668_symbol_visibilit0/.git/ 314s [master (root-commit) 4325bdd] Initial commit 314s 5 files changed, 121 insertions(+) 314s create mode 100644 CMakeLists.txt 314s create mode 100644 hello/__init__.py 314s create mode 100644 hello/_hello.cxx 314s create mode 100644 pyproject.toml 314s create mode 100644 setup.py 314s ----------------------------- Captured stderr call ----------------------------- 314s hint: Using 'master' as the name for the initial branch. This default branch name 314s hint: is subject to change. To configure the initial branch name to use in all 314s hint: of your new repositories, which will suppress this warning, call: 314s hint: 314s hint: git config --global init.defaultBranch 314s hint: 314s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 314s hint: 'development'. The just-created branch can be renamed via this command: 314s hint: 314s hint: git branch -m 314s ____________________________ test_manifest_in_wheel ____________________________ 314s 314s iargs = (), ikwargs = {} 314s 314s @functools.wraps(fun) 314s def wrapped(*iargs, **ikwargs): 314s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 314s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 314s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 314s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 314s 314s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 314s 314s disable_languages_test = True 314s fun = 314s iargs = () 314s ikwargs = {} 314s ret = False 314s wrapped = 314s 314s tests/__init__.py:255: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-64/test_manifest_in_wheel0') 314s setup_args = ['bdist_wheel'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-64/test_manifest_in_wheel0') 314s setup_args = ['bdist_wheel'] 314s 314s tests/__init__.py:218: AttributeError 314s ----------------------------- Captured stdout call ----------------------------- 314s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-64/test_manifest_in_wheel0/.git/ 314s [master (root-commit) 1bfb031] Initial commit 314s 4 files changed, 14 insertions(+) 314s create mode 100644 MANIFEST.in 314s create mode 100644 hello/__init__.py 314s create mode 100644 not_included.txt 314s create mode 100644 setup.py 314s ----------------------------- Captured stderr call ----------------------------- 314s hint: Using 'master' as the name for the initial branch. This default branch name 314s hint: is subject to change. To configure the initial branch name to use in all 314s hint: of your new repositories, which will suppress this warning, call: 314s hint: 314s hint: git config --global init.defaultBranch 314s hint: 314s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 314s hint: 'development'. The just-created branch can be renamed via this command: 314s hint: 314s hint: git branch -m 314s ____________________ test_outside_project_root_fails[None] _____________________ 314s 314s option = None 314s 314s @pytest.mark.parametrize("option", [None, "-DINSTALL_FILE:BOOL=1", "-DINSTALL_PROJECT:BOOL=1"]) 314s def test_outside_project_root_fails(option): 314s with push_dir(): 314s expected_failure = False 314s 314s cmd = ["install"] 314s if option is not None: 314s expected_failure = True 314s cmd.extend(["--", option]) 314s 314s @project_setup_py_test("fail-outside-project-root", cmd, disable_languages_test=True) 314s def should_fail(): 314s pass 314s 314s failed = False 314s msg = "" 314s try: 314s > should_fail() 314s 314s cmd = ['install'] 314s expected_failure = False 314s failed = False 314s msg = '' 314s option = None 314s should_fail = .should_fail at 0xf3408cf8> 314s 314s tests/test_outside_project_root.py:36: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s tests/__init__.py:255: in wrapped 314s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 314s disable_languages_test = True 314s fun = .should_fail at 0xf3408d98> 314s iargs = () 314s ikwargs = {} 314s ret = False 314s wrapped = .should_fail at 0xf3408cf8> 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-65/should_fail0') 314s setup_args = ['install'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-65/should_fail0') 314s setup_args = ['install'] 314s 314s tests/__init__.py:218: AttributeError 314s ----------------------------- Captured stdout call ----------------------------- 314s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-65/should_fail0/.git/ 314s [master (root-commit) c687041] Initial commit 314s 4 files changed, 51 insertions(+) 314s create mode 100644 CMakeLists.txt 314s create mode 100644 dummy 314s create mode 100644 other_project/CMakeLists.txt 314s create mode 100644 setup.py 314s ----------------------------- Captured stderr call ----------------------------- 314s hint: Using 'master' as the name for the initial branch. This default branch name 314s hint: is subject to change. To configure the initial branch name to use in all 314s hint: of your new repositories, which will suppress this warning, call: 314s hint: 314s hint: git config --global init.defaultBranch 314s hint: 314s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 314s hint: 'development'. The just-created branch can be renamed via this command: 314s hint: 314s hint: git branch -m 314s ____________ test_outside_project_root_fails[-DINSTALL_FILE:BOOL=1] ____________ 314s 314s option = '-DINSTALL_FILE:BOOL=1' 314s 314s @pytest.mark.parametrize("option", [None, "-DINSTALL_FILE:BOOL=1", "-DINSTALL_PROJECT:BOOL=1"]) 314s def test_outside_project_root_fails(option): 314s with push_dir(): 314s expected_failure = False 314s 314s cmd = ["install"] 314s if option is not None: 314s expected_failure = True 314s cmd.extend(["--", option]) 314s 314s @project_setup_py_test("fail-outside-project-root", cmd, disable_languages_test=True) 314s def should_fail(): 314s pass 314s 314s failed = False 314s msg = "" 314s try: 314s > should_fail() 314s 314s cmd = ['install', '--', '-DINSTALL_FILE:BOOL=1'] 314s expected_failure = True 314s failed = False 314s msg = '' 314s option = '-DINSTALL_FILE:BOOL=1' 314s should_fail = .should_fail at 0xf33df938> 314s 314s tests/test_outside_project_root.py:36: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s tests/__init__.py:255: in wrapped 314s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 314s disable_languages_test = True 314s fun = .should_fail at 0xf33dfbb8> 314s iargs = () 314s ikwargs = {} 314s ret = False 314s wrapped = .should_fail at 0xf33df938> 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-66/should_fail0') 314s setup_args = ['install', '--', '-DINSTALL_FILE:BOOL=1'] 314s disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-66/should_fail0') 314s setup_args = ['install', '--', '-DINSTALL_FILE:BOOL=1'] 314s 314s tests/__init__.py:218: AttributeError 314s ----------------------------- Captured stdout call ----------------------------- 314s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-66/should_fail0/.git/ 314s [master (root-commit) 8dab166] Initial commit 314s 4 files changed, 51 insertions(+) 314s create mode 100644 CMakeLists.txt 314s create mode 100644 dummy 314s create mode 100644 other_project/CMakeLists.txt 314s create mode 100644 setup.py 314s ----------------------------- Captured stderr call ----------------------------- 314s hint: Using 'master' as the name for the initial branch. This default branch name 314s hint: is subject to change. To configure the initial branch name to use in all 314s hint: of your new repositories, which will suppress this warning, call: 314s hint: 314s hint: git config --global init.defaultBranch 314s hint: 314s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 314s hint: 'development'. The just-created branch can be renamed via this command: 314s hint: 314s hint: git branch -m 314s __________ test_outside_project_root_fails[-DINSTALL_PROJECT:BOOL=1] ___________ 314s 314s option = '-DINSTALL_PROJECT:BOOL=1' 314s 314s @pytest.mark.parametrize("option", [None, "-DINSTALL_FILE:BOOL=1", "-DINSTALL_PROJECT:BOOL=1"]) 314s def test_outside_project_root_fails(option): 314s with push_dir(): 314s expected_failure = False 314s 314s cmd = ["install"] 314s if option is not None: 314s expected_failure = True 314s cmd.extend(["--", option]) 314s 314s @project_setup_py_test("fail-outside-project-root", cmd, disable_languages_test=True) 314s def should_fail(): 314s pass 314s 314s failed = False 314s msg = "" 314s try: 314s > should_fail() 314s 314s cmd = ['install', '--', '-DINSTALL_PROJECT:BOOL=1'] 314s expected_failure = True 314s failed = False 314s msg = '' 314s option = '-DINSTALL_PROJECT:BOOL=1' 314s should_fail = .should_fail at 0xf33dfac8> 314s 314s tests/test_outside_project_root.py:36: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s tests/__init__.py:255: in wrapped 314s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 314s disable_languages_test = True 314s fun = .should_fail at 0xf33dfd48> 314s iargs = () 314s ikwargs = {} 314s ret = False 314s wrapped = .should_fail at 0xf33dfac8> 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-67/should_fail0') 314s setup_args = ['install', '--', '-DINSTALL_PROJECT:BOOL=1'] 314s disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-67/should_fail0') 314s setup_args = ['install', '--', '-DINSTALL_PROJECT:BOOL=1'] 314s 314s tests/__init__.py:218: AttributeError 314s ----------------------------- Captured stdout call ----------------------------- 314s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-67/should_fail0/.git/ 314s [master (root-commit) 8dab166] Initial commit 314s 4 files changed, 51 insertions(+) 314s create mode 100644 CMakeLists.txt 314s create mode 100644 dummy 314s create mode 100644 other_project/CMakeLists.txt 314s create mode 100644 setup.py 314s ----------------------------- Captured stderr call ----------------------------- 314s hint: Using 'master' as the name for the initial branch. This default branch name 314s hint: is subject to change. To configure the initial branch name to use in all 314s hint: of your new repositories, which will suppress this warning, call: 314s hint: 314s hint: git config --global init.defaultBranch 314s hint: 314s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 314s hint: 'development'. The just-created branch can be renamed via this command: 314s hint: 314s hint: git branch -m 314s _____________________ test_cmake_args_keyword[cmake_args0] _____________________ 314s 314s cmake_args = [], capfd = <_pytest.capture.CaptureFixture object at 0xf339f288> 314s 314s @pytest.mark.parametrize("cmake_args", [[], ["--", "-DVAR:STRING=43", "-DVAR_WITH_SPACE:STRING=Ciao Mondo"]]) 314s def test_cmake_args_keyword(cmake_args, capfd): 314s tmp_dir = _tmpdir("cmake_args_keyword") 314s 314s tmp_dir.join("setup.py").write( 314s textwrap.dedent( 314s """ 314s from skbuild import setup 314s setup( 314s name="test_cmake_args_keyword", 314s version="1.2.3", 314s description="a minimal example package", 314s author='The scikit-build team', 314s license="MIT", 314s cmake_args=[ 314s "-DVAR:STRING=42", 314s "-DVAR_WITH_SPACE:STRING=Hello World" 314s ] 314s 314s ) 314s """ 314s ) 314s ) 314s tmp_dir.join("CMakeLists.txt").write( 314s textwrap.dedent( 314s """ 314s cmake_minimum_required(VERSION 3.5.0) 314s project(test NONE) 314s message(STATUS "VAR[${VAR}]") 314s message(STATUS "VAR_WITH_SPACE[${VAR_WITH_SPACE}]") 314s install(CODE "execute_process( 314s COMMAND \\${CMAKE_COMMAND} -E sleep 0)") 314s """ 314s ) 314s ) 314s 314s > with execute_setup_py(tmp_dir, ["build", *cmake_args], disable_languages_test=True): 314s 314s capfd = <_pytest.capture.CaptureFixture object at 0xf339f288> 314s cmake_args = [] 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-68/cmake_args_keyword0') 314s 314s tests/test_setup.py:127: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-68/cmake_args_keyword0') 314s setup_args = ['build'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-68/cmake_args_keyword0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s _____________________ test_cmake_args_keyword[cmake_args1] _____________________ 314s 314s cmake_args = ['--', '-DVAR:STRING=43', '-DVAR_WITH_SPACE:STRING=Ciao Mondo'] 314s capfd = <_pytest.capture.CaptureFixture object at 0xf339fca8> 314s 314s @pytest.mark.parametrize("cmake_args", [[], ["--", "-DVAR:STRING=43", "-DVAR_WITH_SPACE:STRING=Ciao Mondo"]]) 314s def test_cmake_args_keyword(cmake_args, capfd): 314s tmp_dir = _tmpdir("cmake_args_keyword") 314s 314s tmp_dir.join("setup.py").write( 314s textwrap.dedent( 314s """ 314s from skbuild import setup 314s setup( 314s name="test_cmake_args_keyword", 314s version="1.2.3", 314s description="a minimal example package", 314s author='The scikit-build team', 314s license="MIT", 314s cmake_args=[ 314s "-DVAR:STRING=42", 314s "-DVAR_WITH_SPACE:STRING=Hello World" 314s ] 314s 314s ) 314s """ 314s ) 314s ) 314s tmp_dir.join("CMakeLists.txt").write( 314s textwrap.dedent( 314s """ 314s cmake_minimum_required(VERSION 3.5.0) 314s project(test NONE) 314s message(STATUS "VAR[${VAR}]") 314s message(STATUS "VAR_WITH_SPACE[${VAR_WITH_SPACE}]") 314s install(CODE "execute_process( 314s COMMAND \\${CMAKE_COMMAND} -E sleep 0)") 314s """ 314s ) 314s ) 314s 314s > with execute_setup_py(tmp_dir, ["build", *cmake_args], disable_languages_test=True): 314s 314s capfd = <_pytest.capture.CaptureFixture object at 0xf339fca8> 314s cmake_args = ['--', '-DVAR:STRING=43', '-DVAR_WITH_SPACE:STRING=Ciao Mondo'] 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-69/cmake_args_keyword0') 314s 314s tests/test_setup.py:127: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-69/cmake_args_keyword0') 314s setup_args = ['build', '--', '-DVAR:STRING=43', '-DVAR_WITH_SPACE:STRING=Ciao Mondo'] 314s disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-69/cmake_args_keyword0') 314s setup_args = ['build', '--', '-DVAR:STRING=43', '-DVAR_WITH_SPACE:STRING=Ciao Mondo'] 314s 314s tests/__init__.py:218: AttributeError 314s ________________ test_cmake_install_dir_keyword[None-True-str] _________________ 314s 314s cmake_install_dir = None, expected_failed = True 314s error_code_type = 314s capsys = <_pytest.capture.CaptureFixture object at 0xf339f180> 314s caplog = <_pytest.logging.LogCaptureFixture object at 0xf33de930> 314s 314s @pytest.mark.parametrize( 314s ("cmake_install_dir", "expected_failed", "error_code_type"), 314s [ 314s (None, True, str), 314s ("", True, str), 314s (str(py.path.local.get_temproot().join("scikit-build")), True, SKBuildError), 314s ("banana", False, str), 314s ], 314s ) 314s def test_cmake_install_dir_keyword(cmake_install_dir, expected_failed, error_code_type, capsys, caplog): 314s # ------------------------------------------------------------------------- 314s # "SOURCE" tree layout: 314s # 314s # ROOT/ 314s # 314s # CMakeLists.txt 314s # setup.py 314s # 314s # apple/ 314s # __init__.py 314s # 314s # ------------------------------------------------------------------------- 314s # "BINARY" distribution layout 314s # 314s # ROOT/ 314s # 314s # apple/ 314s # __init__.py 314s # 314s 314s tmp_dir = _tmpdir("cmake_install_dir_keyword") 314s 314s setup_kwarg = "" 314s if cmake_install_dir is not None: 314s setup_kwarg = f"cmake_install_dir={str(cmake_install_dir)!r}" 314s 314s tmp_dir.join("setup.py").write( 314s textwrap.dedent( 314s f""" 314s from skbuild import setup 314s setup( 314s name="test_cmake_install_dir", 314s version="1.2.3", 314s description="a package testing use of cmake_install_dir", 314s author='The scikit-build team', 314s license="MIT", 314s packages=['apple', 'banana'], 314s {setup_kwarg} 314s ) 314s """ 314s ) 314s ) 314s 314s # Install location purposely set to "." so that we can test 314s # usage of "cmake_install_dir" skbuild.setup keyword. 314s tmp_dir.join("CMakeLists.txt").write( 314s textwrap.dedent( 314s """ 314s cmake_minimum_required(VERSION 3.5.0) 314s project(banana NONE) 314s file(WRITE "${CMAKE_BINARY_DIR}/__init__.py" "") 314s install(FILES "${CMAKE_BINARY_DIR}/__init__.py" DESTINATION ".") 314s """ 314s ) 314s ) 314s 314s tmp_dir.ensure("apple", "__init__.py") 314s 314s failed = False 314s message = "" 314s try: 314s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 314s 314s caplog = <_pytest.logging.LogCaptureFixture object at 0xf33de930> 314s capsys = <_pytest.capture.CaptureFixture object at 0xf339f180> 314s cmake_install_dir = None 314s error_code_type = 314s expected_failed = True 314s failed = False 314s message = '' 314s setup_kwarg = '' 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-70/cmake_install_dir_keyword0') 314s 314s tests/test_setup.py:211: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-70/cmake_install_dir_keyword0') 314s setup_args = ['build'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-70/cmake_install_dir_keyword0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s __________________ test_cmake_install_dir_keyword[-True-str] ___________________ 314s 314s cmake_install_dir = '', expected_failed = True, error_code_type = 314s capsys = <_pytest.capture.CaptureFixture object at 0xf339fbd0> 314s caplog = <_pytest.logging.LogCaptureFixture object at 0xf339f660> 314s 314s @pytest.mark.parametrize( 314s ("cmake_install_dir", "expected_failed", "error_code_type"), 314s [ 314s (None, True, str), 314s ("", True, str), 314s (str(py.path.local.get_temproot().join("scikit-build")), True, SKBuildError), 314s ("banana", False, str), 314s ], 314s ) 314s def test_cmake_install_dir_keyword(cmake_install_dir, expected_failed, error_code_type, capsys, caplog): 314s # ------------------------------------------------------------------------- 314s # "SOURCE" tree layout: 314s # 314s # ROOT/ 314s # 314s # CMakeLists.txt 314s # setup.py 314s # 314s # apple/ 314s # __init__.py 314s # 314s # ------------------------------------------------------------------------- 314s # "BINARY" distribution layout 314s # 314s # ROOT/ 314s # 314s # apple/ 314s # __init__.py 314s # 314s 314s tmp_dir = _tmpdir("cmake_install_dir_keyword") 314s 314s setup_kwarg = "" 314s if cmake_install_dir is not None: 314s setup_kwarg = f"cmake_install_dir={str(cmake_install_dir)!r}" 314s 314s tmp_dir.join("setup.py").write( 314s textwrap.dedent( 314s f""" 314s from skbuild import setup 314s setup( 314s name="test_cmake_install_dir", 314s version="1.2.3", 314s description="a package testing use of cmake_install_dir", 314s author='The scikit-build team', 314s license="MIT", 314s packages=['apple', 'banana'], 314s {setup_kwarg} 314s ) 314s """ 314s ) 314s ) 314s 314s # Install location purposely set to "." so that we can test 314s # usage of "cmake_install_dir" skbuild.setup keyword. 314s tmp_dir.join("CMakeLists.txt").write( 314s textwrap.dedent( 314s """ 314s cmake_minimum_required(VERSION 3.5.0) 314s project(banana NONE) 314s file(WRITE "${CMAKE_BINARY_DIR}/__init__.py" "") 314s install(FILES "${CMAKE_BINARY_DIR}/__init__.py" DESTINATION ".") 314s """ 314s ) 314s ) 314s 314s tmp_dir.ensure("apple", "__init__.py") 314s 314s failed = False 314s message = "" 314s try: 314s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 314s 314s caplog = <_pytest.logging.LogCaptureFixture object at 0xf339f660> 314s capsys = <_pytest.capture.CaptureFixture object at 0xf339fbd0> 314s cmake_install_dir = '' 314s error_code_type = 314s expected_failed = True 314s failed = False 314s message = '' 314s setup_kwarg = "cmake_install_dir=''" 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-71/cmake_install_dir_keyword0') 314s 314s tests/test_setup.py:211: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-71/cmake_install_dir_keyword0') 314s setup_args = ['build'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-71/cmake_install_dir_keyword0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s _____ test_cmake_install_dir_keyword[/tmp/scikit-build-True-SKBuildError] ______ 314s 314s cmake_install_dir = '/tmp/scikit-build', expected_failed = True 314s error_code_type = 314s capsys = <_pytest.capture.CaptureFixture object at 0xf33dd198> 314s caplog = <_pytest.logging.LogCaptureFixture object at 0xf33ddbe8> 314s 314s @pytest.mark.parametrize( 314s ("cmake_install_dir", "expected_failed", "error_code_type"), 314s [ 314s (None, True, str), 314s ("", True, str), 314s (str(py.path.local.get_temproot().join("scikit-build")), True, SKBuildError), 314s ("banana", False, str), 314s ], 314s ) 314s def test_cmake_install_dir_keyword(cmake_install_dir, expected_failed, error_code_type, capsys, caplog): 314s # ------------------------------------------------------------------------- 314s # "SOURCE" tree layout: 314s # 314s # ROOT/ 314s # 314s # CMakeLists.txt 314s # setup.py 314s # 314s # apple/ 314s # __init__.py 314s # 314s # ------------------------------------------------------------------------- 314s # "BINARY" distribution layout 314s # 314s # ROOT/ 314s # 314s # apple/ 314s # __init__.py 314s # 314s 314s tmp_dir = _tmpdir("cmake_install_dir_keyword") 314s 314s setup_kwarg = "" 314s if cmake_install_dir is not None: 314s setup_kwarg = f"cmake_install_dir={str(cmake_install_dir)!r}" 314s 314s tmp_dir.join("setup.py").write( 314s textwrap.dedent( 314s f""" 314s from skbuild import setup 314s setup( 314s name="test_cmake_install_dir", 314s version="1.2.3", 314s description="a package testing use of cmake_install_dir", 314s author='The scikit-build team', 314s license="MIT", 314s packages=['apple', 'banana'], 314s {setup_kwarg} 314s ) 314s """ 314s ) 314s ) 314s 314s # Install location purposely set to "." so that we can test 314s # usage of "cmake_install_dir" skbuild.setup keyword. 314s tmp_dir.join("CMakeLists.txt").write( 314s textwrap.dedent( 314s """ 314s cmake_minimum_required(VERSION 3.5.0) 314s project(banana NONE) 314s file(WRITE "${CMAKE_BINARY_DIR}/__init__.py" "") 314s install(FILES "${CMAKE_BINARY_DIR}/__init__.py" DESTINATION ".") 314s """ 314s ) 314s ) 314s 314s tmp_dir.ensure("apple", "__init__.py") 314s 314s failed = False 314s message = "" 314s try: 314s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 314s 314s caplog = <_pytest.logging.LogCaptureFixture object at 0xf33ddbe8> 314s capsys = <_pytest.capture.CaptureFixture object at 0xf33dd198> 314s cmake_install_dir = '/tmp/scikit-build' 314s error_code_type = 314s expected_failed = True 314s failed = False 314s message = '' 314s setup_kwarg = "cmake_install_dir='/tmp/scikit-build'" 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-72/cmake_install_dir_keyword0') 314s 314s tests/test_setup.py:211: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-72/cmake_install_dir_keyword0') 314s setup_args = ['build'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-72/cmake_install_dir_keyword0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s _______________ test_cmake_install_dir_keyword[banana-False-str] _______________ 314s 314s cmake_install_dir = 'banana', expected_failed = False 314s error_code_type = 314s capsys = <_pytest.capture.CaptureFixture object at 0xf33def60> 314s caplog = <_pytest.logging.LogCaptureFixture object at 0xf33ded68> 314s 314s @pytest.mark.parametrize( 314s ("cmake_install_dir", "expected_failed", "error_code_type"), 314s [ 314s (None, True, str), 314s ("", True, str), 314s (str(py.path.local.get_temproot().join("scikit-build")), True, SKBuildError), 314s ("banana", False, str), 314s ], 314s ) 314s def test_cmake_install_dir_keyword(cmake_install_dir, expected_failed, error_code_type, capsys, caplog): 314s # ------------------------------------------------------------------------- 314s # "SOURCE" tree layout: 314s # 314s # ROOT/ 314s # 314s # CMakeLists.txt 314s # setup.py 314s # 314s # apple/ 314s # __init__.py 314s # 314s # ------------------------------------------------------------------------- 314s # "BINARY" distribution layout 314s # 314s # ROOT/ 314s # 314s # apple/ 314s # __init__.py 314s # 314s 314s tmp_dir = _tmpdir("cmake_install_dir_keyword") 314s 314s setup_kwarg = "" 314s if cmake_install_dir is not None: 314s setup_kwarg = f"cmake_install_dir={str(cmake_install_dir)!r}" 314s 314s tmp_dir.join("setup.py").write( 314s textwrap.dedent( 314s f""" 314s from skbuild import setup 314s setup( 314s name="test_cmake_install_dir", 314s version="1.2.3", 314s description="a package testing use of cmake_install_dir", 314s author='The scikit-build team', 314s license="MIT", 314s packages=['apple', 'banana'], 314s {setup_kwarg} 314s ) 314s """ 314s ) 314s ) 314s 314s # Install location purposely set to "." so that we can test 314s # usage of "cmake_install_dir" skbuild.setup keyword. 314s tmp_dir.join("CMakeLists.txt").write( 314s textwrap.dedent( 314s """ 314s cmake_minimum_required(VERSION 3.5.0) 314s project(banana NONE) 314s file(WRITE "${CMAKE_BINARY_DIR}/__init__.py" "") 314s install(FILES "${CMAKE_BINARY_DIR}/__init__.py" DESTINATION ".") 314s """ 314s ) 314s ) 314s 314s tmp_dir.ensure("apple", "__init__.py") 314s 314s failed = False 314s message = "" 314s try: 314s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 314s 314s caplog = <_pytest.logging.LogCaptureFixture object at 0xf33ded68> 314s capsys = <_pytest.capture.CaptureFixture object at 0xf33def60> 314s cmake_install_dir = 'banana' 314s error_code_type = 314s expected_failed = False 314s failed = False 314s message = '' 314s setup_kwarg = "cmake_install_dir='banana'" 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-73/cmake_install_dir_keyword0') 314s 314s tests/test_setup.py:211: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-73/cmake_install_dir_keyword0') 314s setup_args = ['build'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-73/cmake_install_dir_keyword0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s _____________________ test_cmake_with_sdist_keyword[True] ______________________ 314s 314s cmake_with_sdist = True 314s capfd = <_pytest.capture.CaptureFixture object at 0xf33de708> 314s 314s @pytest.mark.parametrize("cmake_with_sdist", [True, False]) 314s def test_cmake_with_sdist_keyword(cmake_with_sdist, capfd): 314s tmp_dir = _tmpdir("cmake_with_sdist") 314s 314s tmp_dir.join("setup.py").write( 314s textwrap.dedent( 314s f""" 314s from skbuild import setup 314s setup( 314s name="cmake_with_sdist_keyword", 314s version="1.2.3", 314s description="a minimal example package", 314s author='The scikit-build team', 314s license="MIT", 314s cmake_with_sdist={cmake_with_sdist} 314s ) 314s """ 314s ) 314s ) 314s tmp_dir.join("CMakeLists.txt").write( 314s textwrap.dedent( 314s """ 314s cmake_minimum_required(VERSION 3.5.0) 314s project(test NONE) 314s install(CODE "execute_process( 314s COMMAND \\${CMAKE_COMMAND} -E sleep 0)") 314s """ 314s ) 314s ) 314s 314s initialize_git_repo_and_commit(tmp_dir) 314s 314s > with execute_setup_py(tmp_dir, ["sdist"], disable_languages_test=True): 314s 314s capfd = <_pytest.capture.CaptureFixture object at 0xf33de708> 314s cmake_with_sdist = True 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-74/cmake_with_sdist0') 314s 314s tests/test_setup.py:267: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-74/cmake_with_sdist0') 314s setup_args = ['sdist'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-74/cmake_with_sdist0') 314s setup_args = ['sdist'] 314s 314s tests/__init__.py:218: AttributeError 314s ----------------------------- Captured stdout call ----------------------------- 314s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-74/cmake_with_sdist0/.git/ 314s [master (root-commit) d8c3e95] Initial commit 314s 2 files changed, 15 insertions(+) 314s create mode 100644 CMakeLists.txt 314s create mode 100644 setup.py 314s ----------------------------- Captured stderr call ----------------------------- 314s hint: Using 'master' as the name for the initial branch. This default branch name 314s hint: is subject to change. To configure the initial branch name to use in all 314s hint: of your new repositories, which will suppress this warning, call: 314s hint: 314s hint: git config --global init.defaultBranch 314s hint: 314s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 314s hint: 'development'. The just-created branch can be renamed via this command: 314s hint: 314s hint: git branch -m 314s _____________________ test_cmake_with_sdist_keyword[False] _____________________ 314s 314s cmake_with_sdist = False 314s capfd = <_pytest.capture.CaptureFixture object at 0xf33deb58> 314s 314s @pytest.mark.parametrize("cmake_with_sdist", [True, False]) 314s def test_cmake_with_sdist_keyword(cmake_with_sdist, capfd): 314s tmp_dir = _tmpdir("cmake_with_sdist") 314s 314s tmp_dir.join("setup.py").write( 314s textwrap.dedent( 314s f""" 314s from skbuild import setup 314s setup( 314s name="cmake_with_sdist_keyword", 314s version="1.2.3", 314s description="a minimal example package", 314s author='The scikit-build team', 314s license="MIT", 314s cmake_with_sdist={cmake_with_sdist} 314s ) 314s """ 314s ) 314s ) 314s tmp_dir.join("CMakeLists.txt").write( 314s textwrap.dedent( 314s """ 314s cmake_minimum_required(VERSION 3.5.0) 314s project(test NONE) 314s install(CODE "execute_process( 314s COMMAND \\${CMAKE_COMMAND} -E sleep 0)") 314s """ 314s ) 314s ) 314s 314s initialize_git_repo_and_commit(tmp_dir) 314s 314s > with execute_setup_py(tmp_dir, ["sdist"], disable_languages_test=True): 314s 314s capfd = <_pytest.capture.CaptureFixture object at 0xf33deb58> 314s cmake_with_sdist = False 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-75/cmake_with_sdist0') 314s 314s tests/test_setup.py:267: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-75/cmake_with_sdist0') 314s setup_args = ['sdist'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-75/cmake_with_sdist0') 314s setup_args = ['sdist'] 314s 314s tests/__init__.py:218: AttributeError 314s ----------------------------- Captured stdout call ----------------------------- 314s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-75/cmake_with_sdist0/.git/ 314s [master (root-commit) 76ec43e] Initial commit 314s 2 files changed, 15 insertions(+) 314s create mode 100644 CMakeLists.txt 314s create mode 100644 setup.py 314s ----------------------------- Captured stderr call ----------------------------- 314s hint: Using 'master' as the name for the initial branch. This default branch name 314s hint: is subject to change. To configure the initial branch name to use in all 314s hint: of your new repositories, which will suppress this warning, call: 314s hint: 314s hint: git config --global init.defaultBranch 314s hint: 314s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 314s hint: 'development'. The just-created branch can be renamed via this command: 314s hint: 314s hint: git branch -m 314s _________________ test_cmake_minimum_required_version_keyword __________________ 314s 314s def test_cmake_minimum_required_version_keyword(): 314s tmp_dir = _tmpdir("cmake_minimum_required_version") 314s 314s tmp_dir.join("setup.py").write( 314s textwrap.dedent( 314s """ 314s from skbuild import setup 314s setup( 314s name="cmake_with_sdist_keyword", 314s version="1.2.3", 314s description="a minimal example package", 314s author='The scikit-build team', 314s license="MIT", 314s cmake_minimum_required_version='99.98.97' 314s ) 314s """ 314s ) 314s ) 314s tmp_dir.join("CMakeLists.txt").write( 314s textwrap.dedent( 314s """ 314s cmake_minimum_required(VERSION 3.5.0) 314s project(test NONE) 314s install(CODE "execute_process( 314s COMMAND \\${CMAKE_COMMAND} -E sleep 0)") 314s """ 314s ) 314s ) 314s 314s try: 314s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 314s 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-76/cmake_minimum_required_version0') 314s 314s tests/test_setup.py:308: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-76/cmake_minimum_required_version0') 314s setup_args = ['build'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-76/cmake_minimum_required_version0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s __________________ test_setup_requires_keyword_include_cmake ___________________ 314s 314s mocker = 314s capsys = <_pytest.capture.CaptureFixture object at 0xf3402a68> 314s 314s @pytest.mark.deprecated() 314s @pytest.mark.filterwarnings("ignore:setuptools.installer is deprecated:Warning") 314s @pytest.mark.skipif( 314s os.environ.get("CONDA_BUILD", "0") == "1", 314s reason="running tests expecting network connection in Conda is not possible. " 314s "See https://github.com/conda/conda/issues/508", 314s ) 314s @pytest.mark.skipif(not is_site_reachable("https://pypi.org/simple/cmake/"), reason="pypi.org website not reachable") 314s @pytest.mark.xfail( 314s sys.platform.startswith("cygwin"), strict=False, reason="Cygwin needs a release of scikit-build first" 314s ) 314s def test_setup_requires_keyword_include_cmake(mocker, capsys): 314s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 314s 314s tmp_dir = _tmpdir("setup_requires_keyword_include_cmake") 314s 314s setup_requires = ["cmake>=3.10"] 314s 314s tmp_dir.join("setup.py").write( 314s textwrap.dedent( 314s """ 314s from skbuild import setup 314s setup( 314s name="cmake_with_sdist_keyword", 314s version="1.2.3", 314s description="a minimal example package", 314s author='The scikit-build team', 314s license="MIT", 314s setup_requires=[{setup_requires}] 314s ) 314s """.format(setup_requires=",".join([f"'{package}'" for package in setup_requires])) 314s ) 314s ) 314s tmp_dir.join("CMakeLists.txt").write( 314s textwrap.dedent( 314s """ 314s cmake_minimum_required(VERSION 3.5.0) 314s project(test NONE) 314s install(CODE "execute_process( 314s COMMAND \\${CMAKE_COMMAND} -E sleep 0)") 314s """ 314s ) 314s ) 314s 314s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 314s 314s capsys = <_pytest.capture.CaptureFixture object at 0xf3402a68> 314s mock_setup = 314s mocker = 314s setup_requires = ['cmake>=3.10'] 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-77/setup_requires_keyword_include0') 314s 314s tests/test_setup.py:363: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-77/setup_requires_keyword_include0') 314s setup_args = ['build'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-77/setup_requires_keyword_include0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s __________________________ test_script_keyword[pure] ___________________________ 314s 314s distribution_type = 'pure' 314s capsys = <_pytest.capture.CaptureFixture object at 0xf33bd048> 314s caplog = <_pytest.logging.LogCaptureFixture object at 0xf33bd7f8> 314s 314s @pytest.mark.parametrize("distribution_type", ["pure", "skbuild"]) 314s def test_script_keyword(distribution_type, capsys, caplog): 314s # ------------------------------------------------------------------------- 314s # 314s # "SOURCE" tree layout for "pure" distribution: 314s # 314s # ROOT/ 314s # setup.py 314s # foo.py 314s # bar.py 314s # 314s # "SOURCE" tree layout for "pure" distribution: 314s # 314s # ROOT/ 314s # setup.py 314s # CMakeLists.txt 314s # 314s # ------------------------------------------------------------------------- 314s # "BINARY" distribution layout is identical for both 314s # 314s # ROOT/ 314s # foo.py 314s # bar.py 314s # 314s 314s tmp_dir = _tmpdir("script_keyword") 314s 314s tmp_dir.join("setup.py").write( 314s textwrap.dedent( 314s """ 314s from skbuild import setup 314s setup( 314s name="test_script_keyword", 314s version="1.2.3", 314s description="a package testing use of script keyword", 314s author='The scikit-build team', 314s license="MIT", 314s scripts=['foo.py', 'bar.py'], 314s packages=[], 314s ) 314s """ 314s ) 314s ) 314s 314s if distribution_type == "skbuild": 314s tmp_dir.join("CMakeLists.txt").write( 314s textwrap.dedent( 314s """ 314s cmake_minimum_required(VERSION 3.5.0) 314s project(foo NONE) 314s file(WRITE "${CMAKE_BINARY_DIR}/foo.py" "# foo.py") 314s file(WRITE "${CMAKE_BINARY_DIR}/bar.py" "# bar.py") 314s install( 314s FILES 314s "${CMAKE_BINARY_DIR}/foo.py" 314s "${CMAKE_BINARY_DIR}/bar.py" 314s DESTINATION "." 314s ) 314s """ 314s ) 314s ) 314s 314s messages = [ 314s f"copying {CMAKE_INSTALL_DIR()}/{module}.py -> {SKBUILD_DIR()}/setuptools/scripts-" 314s for module in ["foo", "bar"] 314s ] 314s 314s elif distribution_type == "pure": 314s tmp_dir.join("foo.py").write("# foo.py") 314s tmp_dir.join("bar.py").write("# bar.py") 314s 314s messages = [f"copying {module}.py -> {SKBUILD_DIR()}/setuptools/scripts-" for module in ["foo", "bar"]] 314s 314s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 314s 314s caplog = <_pytest.logging.LogCaptureFixture object at 0xf33bd7f8> 314s capsys = <_pytest.capture.CaptureFixture object at 0xf33bd048> 314s distribution_type = 'pure' 314s messages = ['copying foo.py -> _skbuild/linux-armv7l-3.12/setuptools/scripts-', 'copying bar.py -> _skbuild/linux-armv7l-3.12/setuptools/scripts-'] 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-78/script_keyword0') 314s 314s tests/test_setup.py:448: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-78/script_keyword0') 314s setup_args = ['build'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-78/script_keyword0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s _________________________ test_script_keyword[skbuild] _________________________ 314s 314s distribution_type = 'skbuild' 314s capsys = <_pytest.capture.CaptureFixture object at 0xf33c8db0> 314s caplog = <_pytest.logging.LogCaptureFixture object at 0xf33c88e8> 314s 314s @pytest.mark.parametrize("distribution_type", ["pure", "skbuild"]) 314s def test_script_keyword(distribution_type, capsys, caplog): 314s # ------------------------------------------------------------------------- 314s # 314s # "SOURCE" tree layout for "pure" distribution: 314s # 314s # ROOT/ 314s # setup.py 314s # foo.py 314s # bar.py 314s # 314s # "SOURCE" tree layout for "pure" distribution: 314s # 314s # ROOT/ 314s # setup.py 314s # CMakeLists.txt 314s # 314s # ------------------------------------------------------------------------- 314s # "BINARY" distribution layout is identical for both 314s # 314s # ROOT/ 314s # foo.py 314s # bar.py 314s # 314s 314s tmp_dir = _tmpdir("script_keyword") 314s 314s tmp_dir.join("setup.py").write( 314s textwrap.dedent( 314s """ 314s from skbuild import setup 314s setup( 314s name="test_script_keyword", 314s version="1.2.3", 314s description="a package testing use of script keyword", 314s author='The scikit-build team', 314s license="MIT", 314s scripts=['foo.py', 'bar.py'], 314s packages=[], 314s ) 314s """ 314s ) 314s ) 314s 314s if distribution_type == "skbuild": 314s tmp_dir.join("CMakeLists.txt").write( 314s textwrap.dedent( 314s """ 314s cmake_minimum_required(VERSION 3.5.0) 314s project(foo NONE) 314s file(WRITE "${CMAKE_BINARY_DIR}/foo.py" "# foo.py") 314s file(WRITE "${CMAKE_BINARY_DIR}/bar.py" "# bar.py") 314s install( 314s FILES 314s "${CMAKE_BINARY_DIR}/foo.py" 314s "${CMAKE_BINARY_DIR}/bar.py" 314s DESTINATION "." 314s ) 314s """ 314s ) 314s ) 314s 314s messages = [ 314s f"copying {CMAKE_INSTALL_DIR()}/{module}.py -> {SKBUILD_DIR()}/setuptools/scripts-" 314s for module in ["foo", "bar"] 314s ] 314s 314s elif distribution_type == "pure": 314s tmp_dir.join("foo.py").write("# foo.py") 314s tmp_dir.join("bar.py").write("# bar.py") 314s 314s messages = [f"copying {module}.py -> {SKBUILD_DIR()}/setuptools/scripts-" for module in ["foo", "bar"]] 314s 314s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 314s 314s caplog = <_pytest.logging.LogCaptureFixture object at 0xf33c88e8> 314s capsys = <_pytest.capture.CaptureFixture object at 0xf33c8db0> 314s distribution_type = 'skbuild' 314s messages = ['copying _skbuild/linux-armv7l-3.12/cmake-install/foo.py -> _skbuild/linux-armv7l-3.12/setuptools/scripts-', 'copying _skbuild/linux-armv7l-3.12/cmake-install/bar.py -> _skbuild/linux-armv7l-3.12/setuptools/scripts-'] 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-79/script_keyword0') 314s 314s tests/test_setup.py:448: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-79/script_keyword0') 314s setup_args = ['build'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-79/script_keyword0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s ________________________ test_py_modules_keyword[pure] _________________________ 314s 314s distribution_type = 'pure' 314s capsys = <_pytest.capture.CaptureFixture object at 0xf33c8f90> 314s caplog = <_pytest.logging.LogCaptureFixture object at 0xf33c8150> 314s 314s @pytest.mark.parametrize("distribution_type", ["pure", "skbuild"]) 314s def test_py_modules_keyword(distribution_type, capsys, caplog): 314s # ------------------------------------------------------------------------- 314s # 314s # "SOURCE" tree layout for "pure" distribution: 314s # 314s # ROOT/ 314s # setup.py 314s # foo.py 314s # bar.py 314s # 314s # "SOURCE" tree layout for "skbuild" distribution: 314s # 314s # ROOT/ 314s # setup.py 314s # CMakeLists.txt 314s # 314s # ------------------------------------------------------------------------- 314s # "BINARY" distribution layout is identical for both 314s # 314s # ROOT/ 314s # foo.py 314s # bar.py 314s # 314s 314s tmp_dir = _tmpdir("py_modules_keyword") 314s 314s tmp_dir.join("setup.py").write( 314s textwrap.dedent( 314s """ 314s from skbuild import setup 314s setup( 314s name="test_py_modules_keyword", 314s version="1.2.3", 314s description="a package testing use of py_modules keyword", 314s author='The scikit-build team', 314s license="MIT", 314s py_modules=['foo', 'bar'] 314s ) 314s """ 314s ) 314s ) 314s 314s if distribution_type == "skbuild": 314s tmp_dir.join("CMakeLists.txt").write( 314s textwrap.dedent( 314s """ 314s cmake_minimum_required(VERSION 3.5.0) 314s project(foobar NONE) 314s file(WRITE "${CMAKE_BINARY_DIR}/foo.py" "# foo.py") 314s file(WRITE "${CMAKE_BINARY_DIR}/bar.py" "# bar.py") 314s install( 314s FILES 314s "${CMAKE_BINARY_DIR}/foo.py" 314s "${CMAKE_BINARY_DIR}/bar.py" 314s DESTINATION "." 314s ) 314s """ 314s ) 314s ) 314s 314s messages = [ 314s f"copying {CMAKE_INSTALL_DIR()}/{module}.py -> {SKBUILD_DIR()}/setuptools/lib" for module in ["foo", "bar"] 314s ] 314s 314s elif distribution_type == "pure": 314s tmp_dir.join("foo.py").write("# foo.py") 314s tmp_dir.join("bar.py").write("# bar.py") 314s 314s messages = [f"copying {module}.py -> {SKBUILD_DIR()}/setuptools/lib" for module in ["foo", "bar"]] 314s 314s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 314s 314s caplog = <_pytest.logging.LogCaptureFixture object at 0xf33c8150> 314s capsys = <_pytest.capture.CaptureFixture object at 0xf33c8f90> 314s distribution_type = 'pure' 314s messages = ['copying foo.py -> _skbuild/linux-armv7l-3.12/setuptools/lib', 'copying bar.py -> _skbuild/linux-armv7l-3.12/setuptools/lib'] 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-80/py_modules_keyword0') 314s 314s tests/test_setup.py:528: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-80/py_modules_keyword0') 314s setup_args = ['build'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-80/py_modules_keyword0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s _______________________ test_py_modules_keyword[skbuild] _______________________ 314s 314s distribution_type = 'skbuild' 314s capsys = <_pytest.capture.CaptureFixture object at 0xf343cc00> 314s caplog = <_pytest.logging.LogCaptureFixture object at 0xf3402a98> 314s 314s @pytest.mark.parametrize("distribution_type", ["pure", "skbuild"]) 314s def test_py_modules_keyword(distribution_type, capsys, caplog): 314s # ------------------------------------------------------------------------- 314s # 314s # "SOURCE" tree layout for "pure" distribution: 314s # 314s # ROOT/ 314s # setup.py 314s # foo.py 314s # bar.py 314s # 314s # "SOURCE" tree layout for "skbuild" distribution: 314s # 314s # ROOT/ 314s # setup.py 314s # CMakeLists.txt 314s # 314s # ------------------------------------------------------------------------- 314s # "BINARY" distribution layout is identical for both 314s # 314s # ROOT/ 314s # foo.py 314s # bar.py 314s # 314s 314s tmp_dir = _tmpdir("py_modules_keyword") 314s 314s tmp_dir.join("setup.py").write( 314s textwrap.dedent( 314s """ 314s from skbuild import setup 314s setup( 314s name="test_py_modules_keyword", 314s version="1.2.3", 314s description="a package testing use of py_modules keyword", 314s author='The scikit-build team', 314s license="MIT", 314s py_modules=['foo', 'bar'] 314s ) 314s """ 314s ) 314s ) 314s 314s if distribution_type == "skbuild": 314s tmp_dir.join("CMakeLists.txt").write( 314s textwrap.dedent( 314s """ 314s cmake_minimum_required(VERSION 3.5.0) 314s project(foobar NONE) 314s file(WRITE "${CMAKE_BINARY_DIR}/foo.py" "# foo.py") 314s file(WRITE "${CMAKE_BINARY_DIR}/bar.py" "# bar.py") 314s install( 314s FILES 314s "${CMAKE_BINARY_DIR}/foo.py" 314s "${CMAKE_BINARY_DIR}/bar.py" 314s DESTINATION "." 314s ) 314s """ 314s ) 314s ) 314s 314s messages = [ 314s f"copying {CMAKE_INSTALL_DIR()}/{module}.py -> {SKBUILD_DIR()}/setuptools/lib" for module in ["foo", "bar"] 314s ] 314s 314s elif distribution_type == "pure": 314s tmp_dir.join("foo.py").write("# foo.py") 314s tmp_dir.join("bar.py").write("# bar.py") 314s 314s messages = [f"copying {module}.py -> {SKBUILD_DIR()}/setuptools/lib" for module in ["foo", "bar"]] 314s 314s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 314s 314s caplog = <_pytest.logging.LogCaptureFixture object at 0xf3402a98> 314s capsys = <_pytest.capture.CaptureFixture object at 0xf343cc00> 314s distribution_type = 'skbuild' 314s messages = ['copying _skbuild/linux-armv7l-3.12/cmake-install/foo.py -> _skbuild/linux-armv7l-3.12/setuptools/lib', 'copying _skbuild/linux-armv7l-3.12/cmake-install/bar.py -> _skbuild/linux-armv7l-3.12/setuptools/lib'] 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-81/py_modules_keyword0') 314s 314s tests/test_setup.py:528: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-81/py_modules_keyword0') 314s setup_args = ['build'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-81/py_modules_keyword0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s ________________________ test_setup_inputs[0-0-0-0-0-0] ________________________ 314s 314s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 0 314s has_pure_package = 0, has_pure_module = 0, with_package_base = 0 314s mocker = 314s 314s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 314s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 314s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_module", [0, 1]) 314s @pytest.mark.parametrize("with_package_base", [0, 1]) 314s def test_setup_inputs( 314s has_cmake_package, 314s has_cmake_module, 314s has_hybrid_package, 314s has_pure_package, 314s has_pure_module, 314s with_package_base, 314s mocker, 314s ): 314s """This test that a project can have a package with some modules 314s installed using setup.py and some other modules installed using CMake. 314s """ 314s 314s tmp_dir = _tmpdir("test_setup_inputs") 314s 314s package_base = "to/the/base" if with_package_base else "" 314s package_base_dir = package_base + "/" if package_base else "" 314s cmake_source_dir = package_base 314s 314s if cmake_source_dir and (has_cmake_package or has_cmake_module): 314s pytest.skip( 314s "unsupported configuration: " 314s "python package fully generated by CMake does *NOT* work. " 314s "At least __init__.py should be in the project source tree" 314s ) 314s 314s # ------------------------------------------------------------------------- 314s # Here is the "SOURCE" tree layout: 314s # 314s # ROOT/ 314s # 314s # setup.py 314s # 314s # [/] 314s # 314s # pureModule.py 314s # 314s # pure/ 314s # __init__.py 314s # pure.py 314s # 314s # data/ 314s # pure.dat 314s # 314s # [/] 314s # 314s # hybrid/ 314s # CMakeLists.txt 314s # __init__.py 314s # hybrid_pure.dat 314s # hybrid_pure.py 314s # 314s # data/ 314s # hybrid_data_pure.dat 314s # 314s # hybrid_2/ 314s # __init__.py 314s # hybrid_2_pure.py 314s # 314s # hybrid_2_pure/ 314s # __init__.py 314s # hybrid_2_pure_1.py 314s # hybrid_2_pure_2.py 314s # 314s # 314s # ------------------------------------------------------------------------- 314s # and here is the "BINARY" distribution layout: 314s # 314s # The comment "CMake" or "Setuptools" indicates which tool is responsible 314s # for placing the file in the tree used to create the binary distribution. 314s # 314s # ROOT/ 314s # 314s # cmakeModule.py # CMake 314s # 314s # cmake/ 314s # __init__.py # CMake 314s # cmake.py # CMake 314s # 314s # hybrid/ 314s # hybrid_cmake.dat # CMake 314s # hybrid_cmake.py # CMake 314s # hybrid_pure.dat # Setuptools 314s # hybrid_pure.py # Setuptools 314s # 314s # data/ 314s # hybrid_data_pure.dat # CMake or Setuptools 314s # hybrid_data_cmake.dat # CMake *NO TEST* 314s # 314s # hybrid_2/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure.py # CMake or Setuptools 314s # hybrid_2_cmake.py # CMake 314s # 314s # hybrid_2_pure/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure_1.py # CMake or Setuptools 314s # hybrid_2_pure_2.py # CMake or Setuptools 314s # 314s # pureModule.py # Setuptools 314s # 314s # pure/ 314s # __init__.py # Setuptools 314s # pure.py # Setuptools 314s # 314s # data/ 314s # pure.dat # Setuptools 314s 314s tmp_dir.join("setup.py").write( 314s textwrap.dedent( 314s """ 314s from skbuild import setup 314s #from setuptools import setup 314s setup( 314s name="test_hybrid_project", 314s version="1.2.3", 314s description=("an hybrid package mixing files installed by both " 314s "CMake and setuptools"), 314s author='The scikit-build team', 314s license="MIT", 314s cmake_source_dir='{cmake_source_dir}', 314s cmake_install_dir='{cmake_install_dir}', 314s # Arbitrary order of packages 314s packages=[ 314s {p_off} 'pure', 314s {h_off} 'hybrid.hybrid_2', 314s {h_off} 'hybrid', 314s {c_off} 'cmake', 314s {p_off} 'hybrid.hybrid_2_pure', 314s ], 314s py_modules=[ 314s {pm_off} '{package_base}pureModule', 314s {cm_off} '{package_base}cmakeModule', 314s ], 314s package_data={{ 314s {p_off} 'pure': ['data/pure.dat'], 314s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 314s }}, 314s # Arbitrary order of package_dir 314s package_dir = {{ 314s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 314s {p_off} 'pure': '{package_base}pure', 314s {h_off} 'hybrid': '{package_base}hybrid', 314s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 314s {c_off} 'cmake': '{package_base}cmake', 314s }} 314s ) 314s """.format( 314s cmake_source_dir=cmake_source_dir, 314s cmake_install_dir=package_base, 314s package_base=package_base_dir, 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s p_off="" if has_pure_package else "#", 314s pm_off="" if has_pure_module else "#", 314s ) 314s ) 314s ) 314s 314s src_dir = tmp_dir.ensure(package_base, dir=1) 314s 314s src_dir.join("CMakeLists.txt").write( 314s textwrap.dedent( 314s """ 314s cmake_minimum_required(VERSION 3.5.0) 314s project(hybrid NONE) 314s set(build_dir ${{CMAKE_BINARY_DIR}}) 314s 314s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 314s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 314s {c_off} install( 314s {c_off} FILES 314s {c_off} ${{build_dir}}/__init__.py 314s {c_off} ${{build_dir}}/cmake.py 314s {c_off} DESTINATION cmake 314s {c_off} ) 314s 314s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 314s {cm_off} install( 314s {cm_off} FILES ${{build_dir}}/cmakeModule.py 314s {cm_off} DESTINATION .) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 314s {h_off} DESTINATION hybrid/data) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 314s {h_off} DESTINATION hybrid/hybrid_2) 314s 314s install(CODE "message(STATUS \\\"Installation complete\\\")") 314s """.format( 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s ) 314s ) 314s ) 314s 314s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 314s path_types: Sequence[str] 314s try: 314s path_types = next( 314s iter( 314s zip( 314s *filter( 314s lambda i: i[1], 314s [ 314s ("c", has_cmake_package), 314s ("cm", has_cmake_module), 314s ("h", has_hybrid_package), 314s ("p", has_pure_package), 314s ("pm", has_pure_module), 314s ], 314s ) 314s ) 314s ) 314s ) 314s except StopIteration: 314s path_types = [] 314s 314s def select_paths(annotated_paths): 314s """Return a filtered list paths considering ``path_types``. 314s 314s `annotated_paths`` is list of tuple ``(type, path)`` where type 314s is either `c`, 'cm', `h`, `p` or 'pm'. 314s 314s """ 314s return filter(lambda i: i[0] in path_types, annotated_paths) 314s 314s # Commented paths are the one expected to be installed by CMake. For 314s # this reason, corresponding files should NOT be created in the source 314s # tree. 314s for _type, path in select_paths( 314s [ 314s # ('c', 'cmake/__init__.py'), 314s # ('c', 'cmake/cmake.py'), 314s # ('cm', 'cmakeModule.py'), 314s ("h", "hybrid/__init__.py"), 314s # ('h', 'hybrid/hybrid_cmake.dat'), 314s # ('h', 'hybrid/hybrid_cmake.py'), 314s ("h", "hybrid/hybrid_pure.dat"), 314s ("h", "hybrid/hybrid_pure.py"), 314s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 314s ("h", "hybrid/data/hybrid_data_pure.dat"), 314s ("h", "hybrid/hybrid_2/__init__.py"), 314s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 314s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 314s ("p", "hybrid/hybrid_2_pure/__init__.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 314s ("pm", "pureModule.py"), 314s ("p", "pure/__init__.py"), 314s ("p", "pure/pure.py"), 314s ("p", "pure/data/pure.dat"), 314s ] 314s ): 314s assert _type in {"p", "pm", "h"} 314s root = package_base if _type in {"p", "pm"} else cmake_source_dir 314s tmp_dir.ensure(os.path.join(root, path)) 314s 314s # Do not call the real setup function. Instead, replace it with 314s # a MagicMock allowing to check with which arguments it was invoked. 314s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 314s 314s # Convenience print function 314s def _pprint(desc, value=None): 314s print( 314s "-----------------\n" 314s f"{desc}:\n" 314s "\n" 314s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 314s ) 314s 314s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 314s 314s _pprint = ._pprint at 0xf33ce5c8> 314s cmake_source_dir = '' 314s has_cmake_module = 0 314s has_cmake_package = 0 314s has_hybrid_package = 0 314s has_pure_module = 0 314s has_pure_package = 0 314s mock_setup = 314s mocker = 314s package_base = '' 314s package_base_dir = '' 314s path_types = [] 314s select_paths = .select_paths at 0xf33ce898> 314s src_dir = local('/tmp/pytest-of-ubuntu/pytest-82/test_setup_inputs0') 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-82/test_setup_inputs0') 314s with_package_base = 0 314s 314s tests/test_setup.py:849: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-82/test_setup_inputs0') 314s setup_args = ['build'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-82/test_setup_inputs0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s ________________________ test_setup_inputs[0-0-0-0-0-1] ________________________ 314s 314s has_cmake_package = 1, has_cmake_module = 0, has_hybrid_package = 0 314s has_pure_package = 0, has_pure_module = 0, with_package_base = 0 314s mocker = 314s 314s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 314s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 314s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_module", [0, 1]) 314s @pytest.mark.parametrize("with_package_base", [0, 1]) 314s def test_setup_inputs( 314s has_cmake_package, 314s has_cmake_module, 314s has_hybrid_package, 314s has_pure_package, 314s has_pure_module, 314s with_package_base, 314s mocker, 314s ): 314s """This test that a project can have a package with some modules 314s installed using setup.py and some other modules installed using CMake. 314s """ 314s 314s tmp_dir = _tmpdir("test_setup_inputs") 314s 314s package_base = "to/the/base" if with_package_base else "" 314s package_base_dir = package_base + "/" if package_base else "" 314s cmake_source_dir = package_base 314s 314s if cmake_source_dir and (has_cmake_package or has_cmake_module): 314s pytest.skip( 314s "unsupported configuration: " 314s "python package fully generated by CMake does *NOT* work. " 314s "At least __init__.py should be in the project source tree" 314s ) 314s 314s # ------------------------------------------------------------------------- 314s # Here is the "SOURCE" tree layout: 314s # 314s # ROOT/ 314s # 314s # setup.py 314s # 314s # [/] 314s # 314s # pureModule.py 314s # 314s # pure/ 314s # __init__.py 314s # pure.py 314s # 314s # data/ 314s # pure.dat 314s # 314s # [/] 314s # 314s # hybrid/ 314s # CMakeLists.txt 314s # __init__.py 314s # hybrid_pure.dat 314s # hybrid_pure.py 314s # 314s # data/ 314s # hybrid_data_pure.dat 314s # 314s # hybrid_2/ 314s # __init__.py 314s # hybrid_2_pure.py 314s # 314s # hybrid_2_pure/ 314s # __init__.py 314s # hybrid_2_pure_1.py 314s # hybrid_2_pure_2.py 314s # 314s # 314s # ------------------------------------------------------------------------- 314s # and here is the "BINARY" distribution layout: 314s # 314s # The comment "CMake" or "Setuptools" indicates which tool is responsible 314s # for placing the file in the tree used to create the binary distribution. 314s # 314s # ROOT/ 314s # 314s # cmakeModule.py # CMake 314s # 314s # cmake/ 314s # __init__.py # CMake 314s # cmake.py # CMake 314s # 314s # hybrid/ 314s # hybrid_cmake.dat # CMake 314s # hybrid_cmake.py # CMake 314s # hybrid_pure.dat # Setuptools 314s # hybrid_pure.py # Setuptools 314s # 314s # data/ 314s # hybrid_data_pure.dat # CMake or Setuptools 314s # hybrid_data_cmake.dat # CMake *NO TEST* 314s # 314s # hybrid_2/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure.py # CMake or Setuptools 314s # hybrid_2_cmake.py # CMake 314s # 314s # hybrid_2_pure/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure_1.py # CMake or Setuptools 314s # hybrid_2_pure_2.py # CMake or Setuptools 314s # 314s # pureModule.py # Setuptools 314s # 314s # pure/ 314s # __init__.py # Setuptools 314s # pure.py # Setuptools 314s # 314s # data/ 314s # pure.dat # Setuptools 314s 314s tmp_dir.join("setup.py").write( 314s textwrap.dedent( 314s """ 314s from skbuild import setup 314s #from setuptools import setup 314s setup( 314s name="test_hybrid_project", 314s version="1.2.3", 314s description=("an hybrid package mixing files installed by both " 314s "CMake and setuptools"), 314s author='The scikit-build team', 314s license="MIT", 314s cmake_source_dir='{cmake_source_dir}', 314s cmake_install_dir='{cmake_install_dir}', 314s # Arbitrary order of packages 314s packages=[ 314s {p_off} 'pure', 314s {h_off} 'hybrid.hybrid_2', 314s {h_off} 'hybrid', 314s {c_off} 'cmake', 314s {p_off} 'hybrid.hybrid_2_pure', 314s ], 314s py_modules=[ 314s {pm_off} '{package_base}pureModule', 314s {cm_off} '{package_base}cmakeModule', 314s ], 314s package_data={{ 314s {p_off} 'pure': ['data/pure.dat'], 314s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 314s }}, 314s # Arbitrary order of package_dir 314s package_dir = {{ 314s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 314s {p_off} 'pure': '{package_base}pure', 314s {h_off} 'hybrid': '{package_base}hybrid', 314s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 314s {c_off} 'cmake': '{package_base}cmake', 314s }} 314s ) 314s """.format( 314s cmake_source_dir=cmake_source_dir, 314s cmake_install_dir=package_base, 314s package_base=package_base_dir, 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s p_off="" if has_pure_package else "#", 314s pm_off="" if has_pure_module else "#", 314s ) 314s ) 314s ) 314s 314s src_dir = tmp_dir.ensure(package_base, dir=1) 314s 314s src_dir.join("CMakeLists.txt").write( 314s textwrap.dedent( 314s """ 314s cmake_minimum_required(VERSION 3.5.0) 314s project(hybrid NONE) 314s set(build_dir ${{CMAKE_BINARY_DIR}}) 314s 314s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 314s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 314s {c_off} install( 314s {c_off} FILES 314s {c_off} ${{build_dir}}/__init__.py 314s {c_off} ${{build_dir}}/cmake.py 314s {c_off} DESTINATION cmake 314s {c_off} ) 314s 314s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 314s {cm_off} install( 314s {cm_off} FILES ${{build_dir}}/cmakeModule.py 314s {cm_off} DESTINATION .) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 314s {h_off} DESTINATION hybrid/data) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 314s {h_off} DESTINATION hybrid/hybrid_2) 314s 314s install(CODE "message(STATUS \\\"Installation complete\\\")") 314s """.format( 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s ) 314s ) 314s ) 314s 314s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 314s path_types: Sequence[str] 314s try: 314s path_types = next( 314s iter( 314s zip( 314s *filter( 314s lambda i: i[1], 314s [ 314s ("c", has_cmake_package), 314s ("cm", has_cmake_module), 314s ("h", has_hybrid_package), 314s ("p", has_pure_package), 314s ("pm", has_pure_module), 314s ], 314s ) 314s ) 314s ) 314s ) 314s except StopIteration: 314s path_types = [] 314s 314s def select_paths(annotated_paths): 314s """Return a filtered list paths considering ``path_types``. 314s 314s `annotated_paths`` is list of tuple ``(type, path)`` where type 314s is either `c`, 'cm', `h`, `p` or 'pm'. 314s 314s """ 314s return filter(lambda i: i[0] in path_types, annotated_paths) 314s 314s # Commented paths are the one expected to be installed by CMake. For 314s # this reason, corresponding files should NOT be created in the source 314s # tree. 314s for _type, path in select_paths( 314s [ 314s # ('c', 'cmake/__init__.py'), 314s # ('c', 'cmake/cmake.py'), 314s # ('cm', 'cmakeModule.py'), 314s ("h", "hybrid/__init__.py"), 314s # ('h', 'hybrid/hybrid_cmake.dat'), 314s # ('h', 'hybrid/hybrid_cmake.py'), 314s ("h", "hybrid/hybrid_pure.dat"), 314s ("h", "hybrid/hybrid_pure.py"), 314s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 314s ("h", "hybrid/data/hybrid_data_pure.dat"), 314s ("h", "hybrid/hybrid_2/__init__.py"), 314s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 314s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 314s ("p", "hybrid/hybrid_2_pure/__init__.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 314s ("pm", "pureModule.py"), 314s ("p", "pure/__init__.py"), 314s ("p", "pure/pure.py"), 314s ("p", "pure/data/pure.dat"), 314s ] 314s ): 314s assert _type in {"p", "pm", "h"} 314s root = package_base if _type in {"p", "pm"} else cmake_source_dir 314s tmp_dir.ensure(os.path.join(root, path)) 314s 314s # Do not call the real setup function. Instead, replace it with 314s # a MagicMock allowing to check with which arguments it was invoked. 314s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 314s 314s # Convenience print function 314s def _pprint(desc, value=None): 314s print( 314s "-----------------\n" 314s f"{desc}:\n" 314s "\n" 314s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 314s ) 314s 314s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 314s 314s _pprint = ._pprint at 0xf33ce438> 314s cmake_source_dir = '' 314s has_cmake_module = 0 314s has_cmake_package = 1 314s has_hybrid_package = 0 314s has_pure_module = 0 314s has_pure_package = 0 314s mock_setup = 314s mocker = 314s package_base = '' 314s package_base_dir = '' 314s path_types = ('c',) 314s select_paths = .select_paths at 0xf33ceac8> 314s src_dir = local('/tmp/pytest-of-ubuntu/pytest-83/test_setup_inputs0') 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-83/test_setup_inputs0') 314s with_package_base = 0 314s 314s tests/test_setup.py:849: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-83/test_setup_inputs0') 314s setup_args = ['build'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-83/test_setup_inputs0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s ________________________ test_setup_inputs[0-0-0-0-1-0] ________________________ 314s 314s has_cmake_package = 0, has_cmake_module = 1, has_hybrid_package = 0 314s has_pure_package = 0, has_pure_module = 0, with_package_base = 0 314s mocker = 314s 314s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 314s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 314s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_module", [0, 1]) 314s @pytest.mark.parametrize("with_package_base", [0, 1]) 314s def test_setup_inputs( 314s has_cmake_package, 314s has_cmake_module, 314s has_hybrid_package, 314s has_pure_package, 314s has_pure_module, 314s with_package_base, 314s mocker, 314s ): 314s """This test that a project can have a package with some modules 314s installed using setup.py and some other modules installed using CMake. 314s """ 314s 314s tmp_dir = _tmpdir("test_setup_inputs") 314s 314s package_base = "to/the/base" if with_package_base else "" 314s package_base_dir = package_base + "/" if package_base else "" 314s cmake_source_dir = package_base 314s 314s if cmake_source_dir and (has_cmake_package or has_cmake_module): 314s pytest.skip( 314s "unsupported configuration: " 314s "python package fully generated by CMake does *NOT* work. " 314s "At least __init__.py should be in the project source tree" 314s ) 314s 314s # ------------------------------------------------------------------------- 314s # Here is the "SOURCE" tree layout: 314s # 314s # ROOT/ 314s # 314s # setup.py 314s # 314s # [/] 314s # 314s # pureModule.py 314s # 314s # pure/ 314s # __init__.py 314s # pure.py 314s # 314s # data/ 314s # pure.dat 314s # 314s # [/] 314s # 314s # hybrid/ 314s # CMakeLists.txt 314s # __init__.py 314s # hybrid_pure.dat 314s # hybrid_pure.py 314s # 314s # data/ 314s # hybrid_data_pure.dat 314s # 314s # hybrid_2/ 314s # __init__.py 314s # hybrid_2_pure.py 314s # 314s # hybrid_2_pure/ 314s # __init__.py 314s # hybrid_2_pure_1.py 314s # hybrid_2_pure_2.py 314s # 314s # 314s # ------------------------------------------------------------------------- 314s # and here is the "BINARY" distribution layout: 314s # 314s # The comment "CMake" or "Setuptools" indicates which tool is responsible 314s # for placing the file in the tree used to create the binary distribution. 314s # 314s # ROOT/ 314s # 314s # cmakeModule.py # CMake 314s # 314s # cmake/ 314s # __init__.py # CMake 314s # cmake.py # CMake 314s # 314s # hybrid/ 314s # hybrid_cmake.dat # CMake 314s # hybrid_cmake.py # CMake 314s # hybrid_pure.dat # Setuptools 314s # hybrid_pure.py # Setuptools 314s # 314s # data/ 314s # hybrid_data_pure.dat # CMake or Setuptools 314s # hybrid_data_cmake.dat # CMake *NO TEST* 314s # 314s # hybrid_2/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure.py # CMake or Setuptools 314s # hybrid_2_cmake.py # CMake 314s # 314s # hybrid_2_pure/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure_1.py # CMake or Setuptools 314s # hybrid_2_pure_2.py # CMake or Setuptools 314s # 314s # pureModule.py # Setuptools 314s # 314s # pure/ 314s # __init__.py # Setuptools 314s # pure.py # Setuptools 314s # 314s # data/ 314s # pure.dat # Setuptools 314s 314s tmp_dir.join("setup.py").write( 314s textwrap.dedent( 314s """ 314s from skbuild import setup 314s #from setuptools import setup 314s setup( 314s name="test_hybrid_project", 314s version="1.2.3", 314s description=("an hybrid package mixing files installed by both " 314s "CMake and setuptools"), 314s author='The scikit-build team', 314s license="MIT", 314s cmake_source_dir='{cmake_source_dir}', 314s cmake_install_dir='{cmake_install_dir}', 314s # Arbitrary order of packages 314s packages=[ 314s {p_off} 'pure', 314s {h_off} 'hybrid.hybrid_2', 314s {h_off} 'hybrid', 314s {c_off} 'cmake', 314s {p_off} 'hybrid.hybrid_2_pure', 314s ], 314s py_modules=[ 314s {pm_off} '{package_base}pureModule', 314s {cm_off} '{package_base}cmakeModule', 314s ], 314s package_data={{ 314s {p_off} 'pure': ['data/pure.dat'], 314s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 314s }}, 314s # Arbitrary order of package_dir 314s package_dir = {{ 314s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 314s {p_off} 'pure': '{package_base}pure', 314s {h_off} 'hybrid': '{package_base}hybrid', 314s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 314s {c_off} 'cmake': '{package_base}cmake', 314s }} 314s ) 314s """.format( 314s cmake_source_dir=cmake_source_dir, 314s cmake_install_dir=package_base, 314s package_base=package_base_dir, 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s p_off="" if has_pure_package else "#", 314s pm_off="" if has_pure_module else "#", 314s ) 314s ) 314s ) 314s 314s src_dir = tmp_dir.ensure(package_base, dir=1) 314s 314s src_dir.join("CMakeLists.txt").write( 314s textwrap.dedent( 314s """ 314s cmake_minimum_required(VERSION 3.5.0) 314s project(hybrid NONE) 314s set(build_dir ${{CMAKE_BINARY_DIR}}) 314s 314s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 314s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 314s {c_off} install( 314s {c_off} FILES 314s {c_off} ${{build_dir}}/__init__.py 314s {c_off} ${{build_dir}}/cmake.py 314s {c_off} DESTINATION cmake 314s {c_off} ) 314s 314s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 314s {cm_off} install( 314s {cm_off} FILES ${{build_dir}}/cmakeModule.py 314s {cm_off} DESTINATION .) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 314s {h_off} DESTINATION hybrid/data) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 314s {h_off} DESTINATION hybrid/hybrid_2) 314s 314s install(CODE "message(STATUS \\\"Installation complete\\\")") 314s """.format( 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s ) 314s ) 314s ) 314s 314s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 314s path_types: Sequence[str] 314s try: 314s path_types = next( 314s iter( 314s zip( 314s *filter( 314s lambda i: i[1], 314s [ 314s ("c", has_cmake_package), 314s ("cm", has_cmake_module), 314s ("h", has_hybrid_package), 314s ("p", has_pure_package), 314s ("pm", has_pure_module), 314s ], 314s ) 314s ) 314s ) 314s ) 314s except StopIteration: 314s path_types = [] 314s 314s def select_paths(annotated_paths): 314s """Return a filtered list paths considering ``path_types``. 314s 314s `annotated_paths`` is list of tuple ``(type, path)`` where type 314s is either `c`, 'cm', `h`, `p` or 'pm'. 314s 314s """ 314s return filter(lambda i: i[0] in path_types, annotated_paths) 314s 314s # Commented paths are the one expected to be installed by CMake. For 314s # this reason, corresponding files should NOT be created in the source 314s # tree. 314s for _type, path in select_paths( 314s [ 314s # ('c', 'cmake/__init__.py'), 314s # ('c', 'cmake/cmake.py'), 314s # ('cm', 'cmakeModule.py'), 314s ("h", "hybrid/__init__.py"), 314s # ('h', 'hybrid/hybrid_cmake.dat'), 314s # ('h', 'hybrid/hybrid_cmake.py'), 314s ("h", "hybrid/hybrid_pure.dat"), 314s ("h", "hybrid/hybrid_pure.py"), 314s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 314s ("h", "hybrid/data/hybrid_data_pure.dat"), 314s ("h", "hybrid/hybrid_2/__init__.py"), 314s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 314s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 314s ("p", "hybrid/hybrid_2_pure/__init__.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 314s ("pm", "pureModule.py"), 314s ("p", "pure/__init__.py"), 314s ("p", "pure/pure.py"), 314s ("p", "pure/data/pure.dat"), 314s ] 314s ): 314s assert _type in {"p", "pm", "h"} 314s root = package_base if _type in {"p", "pm"} else cmake_source_dir 314s tmp_dir.ensure(os.path.join(root, path)) 314s 314s # Do not call the real setup function. Instead, replace it with 314s # a MagicMock allowing to check with which arguments it was invoked. 314s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 314s 314s # Convenience print function 314s def _pprint(desc, value=None): 314s print( 314s "-----------------\n" 314s f"{desc}:\n" 314s "\n" 314s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 314s ) 314s 314s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 314s 314s _pprint = ._pprint at 0xf33ce528> 314s cmake_source_dir = '' 314s has_cmake_module = 1 314s has_cmake_package = 0 314s has_hybrid_package = 0 314s has_pure_module = 0 314s has_pure_package = 0 314s mock_setup = 314s mocker = 314s package_base = '' 314s package_base_dir = '' 314s path_types = ('cm',) 314s select_paths = .select_paths at 0xf33ceca8> 314s src_dir = local('/tmp/pytest-of-ubuntu/pytest-84/test_setup_inputs0') 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-84/test_setup_inputs0') 314s with_package_base = 0 314s 314s tests/test_setup.py:849: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-84/test_setup_inputs0') 314s setup_args = ['build'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-84/test_setup_inputs0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s ________________________ test_setup_inputs[0-0-0-0-1-1] ________________________ 314s 314s has_cmake_package = 1, has_cmake_module = 1, has_hybrid_package = 0 314s has_pure_package = 0, has_pure_module = 0, with_package_base = 0 314s mocker = 314s 314s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 314s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 314s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_module", [0, 1]) 314s @pytest.mark.parametrize("with_package_base", [0, 1]) 314s def test_setup_inputs( 314s has_cmake_package, 314s has_cmake_module, 314s has_hybrid_package, 314s has_pure_package, 314s has_pure_module, 314s with_package_base, 314s mocker, 314s ): 314s """This test that a project can have a package with some modules 314s installed using setup.py and some other modules installed using CMake. 314s """ 314s 314s tmp_dir = _tmpdir("test_setup_inputs") 314s 314s package_base = "to/the/base" if with_package_base else "" 314s package_base_dir = package_base + "/" if package_base else "" 314s cmake_source_dir = package_base 314s 314s if cmake_source_dir and (has_cmake_package or has_cmake_module): 314s pytest.skip( 314s "unsupported configuration: " 314s "python package fully generated by CMake does *NOT* work. " 314s "At least __init__.py should be in the project source tree" 314s ) 314s 314s # ------------------------------------------------------------------------- 314s # Here is the "SOURCE" tree layout: 314s # 314s # ROOT/ 314s # 314s # setup.py 314s # 314s # [/] 314s # 314s # pureModule.py 314s # 314s # pure/ 314s # __init__.py 314s # pure.py 314s # 314s # data/ 314s # pure.dat 314s # 314s # [/] 314s # 314s # hybrid/ 314s # CMakeLists.txt 314s # __init__.py 314s # hybrid_pure.dat 314s # hybrid_pure.py 314s # 314s # data/ 314s # hybrid_data_pure.dat 314s # 314s # hybrid_2/ 314s # __init__.py 314s # hybrid_2_pure.py 314s # 314s # hybrid_2_pure/ 314s # __init__.py 314s # hybrid_2_pure_1.py 314s # hybrid_2_pure_2.py 314s # 314s # 314s # ------------------------------------------------------------------------- 314s # and here is the "BINARY" distribution layout: 314s # 314s # The comment "CMake" or "Setuptools" indicates which tool is responsible 314s # for placing the file in the tree used to create the binary distribution. 314s # 314s # ROOT/ 314s # 314s # cmakeModule.py # CMake 314s # 314s # cmake/ 314s # __init__.py # CMake 314s # cmake.py # CMake 314s # 314s # hybrid/ 314s # hybrid_cmake.dat # CMake 314s # hybrid_cmake.py # CMake 314s # hybrid_pure.dat # Setuptools 314s # hybrid_pure.py # Setuptools 314s # 314s # data/ 314s # hybrid_data_pure.dat # CMake or Setuptools 314s # hybrid_data_cmake.dat # CMake *NO TEST* 314s # 314s # hybrid_2/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure.py # CMake or Setuptools 314s # hybrid_2_cmake.py # CMake 314s # 314s # hybrid_2_pure/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure_1.py # CMake or Setuptools 314s # hybrid_2_pure_2.py # CMake or Setuptools 314s # 314s # pureModule.py # Setuptools 314s # 314s # pure/ 314s # __init__.py # Setuptools 314s # pure.py # Setuptools 314s # 314s # data/ 314s # pure.dat # Setuptools 314s 314s tmp_dir.join("setup.py").write( 314s textwrap.dedent( 314s """ 314s from skbuild import setup 314s #from setuptools import setup 314s setup( 314s name="test_hybrid_project", 314s version="1.2.3", 314s description=("an hybrid package mixing files installed by both " 314s "CMake and setuptools"), 314s author='The scikit-build team', 314s license="MIT", 314s cmake_source_dir='{cmake_source_dir}', 314s cmake_install_dir='{cmake_install_dir}', 314s # Arbitrary order of packages 314s packages=[ 314s {p_off} 'pure', 314s {h_off} 'hybrid.hybrid_2', 314s {h_off} 'hybrid', 314s {c_off} 'cmake', 314s {p_off} 'hybrid.hybrid_2_pure', 314s ], 314s py_modules=[ 314s {pm_off} '{package_base}pureModule', 314s {cm_off} '{package_base}cmakeModule', 314s ], 314s package_data={{ 314s {p_off} 'pure': ['data/pure.dat'], 314s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 314s }}, 314s # Arbitrary order of package_dir 314s package_dir = {{ 314s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 314s {p_off} 'pure': '{package_base}pure', 314s {h_off} 'hybrid': '{package_base}hybrid', 314s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 314s {c_off} 'cmake': '{package_base}cmake', 314s }} 314s ) 314s """.format( 314s cmake_source_dir=cmake_source_dir, 314s cmake_install_dir=package_base, 314s package_base=package_base_dir, 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s p_off="" if has_pure_package else "#", 314s pm_off="" if has_pure_module else "#", 314s ) 314s ) 314s ) 314s 314s src_dir = tmp_dir.ensure(package_base, dir=1) 314s 314s src_dir.join("CMakeLists.txt").write( 314s textwrap.dedent( 314s """ 314s cmake_minimum_required(VERSION 3.5.0) 314s project(hybrid NONE) 314s set(build_dir ${{CMAKE_BINARY_DIR}}) 314s 314s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 314s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 314s {c_off} install( 314s {c_off} FILES 314s {c_off} ${{build_dir}}/__init__.py 314s {c_off} ${{build_dir}}/cmake.py 314s {c_off} DESTINATION cmake 314s {c_off} ) 314s 314s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 314s {cm_off} install( 314s {cm_off} FILES ${{build_dir}}/cmakeModule.py 314s {cm_off} DESTINATION .) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 314s {h_off} DESTINATION hybrid/data) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 314s {h_off} DESTINATION hybrid/hybrid_2) 314s 314s install(CODE "message(STATUS \\\"Installation complete\\\")") 314s """.format( 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s ) 314s ) 314s ) 314s 314s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 314s path_types: Sequence[str] 314s try: 314s path_types = next( 314s iter( 314s zip( 314s *filter( 314s lambda i: i[1], 314s [ 314s ("c", has_cmake_package), 314s ("cm", has_cmake_module), 314s ("h", has_hybrid_package), 314s ("p", has_pure_package), 314s ("pm", has_pure_module), 314s ], 314s ) 314s ) 314s ) 314s ) 314s except StopIteration: 314s path_types = [] 314s 314s def select_paths(annotated_paths): 314s """Return a filtered list paths considering ``path_types``. 314s 314s `annotated_paths`` is list of tuple ``(type, path)`` where type 314s is either `c`, 'cm', `h`, `p` or 'pm'. 314s 314s """ 314s return filter(lambda i: i[0] in path_types, annotated_paths) 314s 314s # Commented paths are the one expected to be installed by CMake. For 314s # this reason, corresponding files should NOT be created in the source 314s # tree. 314s for _type, path in select_paths( 314s [ 314s # ('c', 'cmake/__init__.py'), 314s # ('c', 'cmake/cmake.py'), 314s # ('cm', 'cmakeModule.py'), 314s ("h", "hybrid/__init__.py"), 314s # ('h', 'hybrid/hybrid_cmake.dat'), 314s # ('h', 'hybrid/hybrid_cmake.py'), 314s ("h", "hybrid/hybrid_pure.dat"), 314s ("h", "hybrid/hybrid_pure.py"), 314s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 314s ("h", "hybrid/data/hybrid_data_pure.dat"), 314s ("h", "hybrid/hybrid_2/__init__.py"), 314s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 314s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 314s ("p", "hybrid/hybrid_2_pure/__init__.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 314s ("pm", "pureModule.py"), 314s ("p", "pure/__init__.py"), 314s ("p", "pure/pure.py"), 314s ("p", "pure/data/pure.dat"), 314s ] 314s ): 314s assert _type in {"p", "pm", "h"} 314s root = package_base if _type in {"p", "pm"} else cmake_source_dir 314s tmp_dir.ensure(os.path.join(root, path)) 314s 314s # Do not call the real setup function. Instead, replace it with 314s # a MagicMock allowing to check with which arguments it was invoked. 314s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 314s 314s # Convenience print function 314s def _pprint(desc, value=None): 314s print( 314s "-----------------\n" 314s f"{desc}:\n" 314s "\n" 314s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 314s ) 314s 314s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 314s 314s _pprint = ._pprint at 0xf33cee88> 314s cmake_source_dir = '' 314s has_cmake_module = 1 314s has_cmake_package = 1 314s has_hybrid_package = 0 314s has_pure_module = 0 314s has_pure_package = 0 314s mock_setup = 314s mocker = 314s package_base = '' 314s package_base_dir = '' 314s path_types = ('c', 'cm') 314s select_paths = .select_paths at 0xf33dfcf8> 314s src_dir = local('/tmp/pytest-of-ubuntu/pytest-85/test_setup_inputs0') 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-85/test_setup_inputs0') 314s with_package_base = 0 314s 314s tests/test_setup.py:849: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-85/test_setup_inputs0') 314s setup_args = ['build'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-85/test_setup_inputs0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s ________________________ test_setup_inputs[0-0-0-1-0-0] ________________________ 314s 314s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 1 314s has_pure_package = 0, has_pure_module = 0, with_package_base = 0 314s mocker = 314s 314s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 314s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 314s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_module", [0, 1]) 314s @pytest.mark.parametrize("with_package_base", [0, 1]) 314s def test_setup_inputs( 314s has_cmake_package, 314s has_cmake_module, 314s has_hybrid_package, 314s has_pure_package, 314s has_pure_module, 314s with_package_base, 314s mocker, 314s ): 314s """This test that a project can have a package with some modules 314s installed using setup.py and some other modules installed using CMake. 314s """ 314s 314s tmp_dir = _tmpdir("test_setup_inputs") 314s 314s package_base = "to/the/base" if with_package_base else "" 314s package_base_dir = package_base + "/" if package_base else "" 314s cmake_source_dir = package_base 314s 314s if cmake_source_dir and (has_cmake_package or has_cmake_module): 314s pytest.skip( 314s "unsupported configuration: " 314s "python package fully generated by CMake does *NOT* work. " 314s "At least __init__.py should be in the project source tree" 314s ) 314s 314s # ------------------------------------------------------------------------- 314s # Here is the "SOURCE" tree layout: 314s # 314s # ROOT/ 314s # 314s # setup.py 314s # 314s # [/] 314s # 314s # pureModule.py 314s # 314s # pure/ 314s # __init__.py 314s # pure.py 314s # 314s # data/ 314s # pure.dat 314s # 314s # [/] 314s # 314s # hybrid/ 314s # CMakeLists.txt 314s # __init__.py 314s # hybrid_pure.dat 314s # hybrid_pure.py 314s # 314s # data/ 314s # hybrid_data_pure.dat 314s # 314s # hybrid_2/ 314s # __init__.py 314s # hybrid_2_pure.py 314s # 314s # hybrid_2_pure/ 314s # __init__.py 314s # hybrid_2_pure_1.py 314s # hybrid_2_pure_2.py 314s # 314s # 314s # ------------------------------------------------------------------------- 314s # and here is the "BINARY" distribution layout: 314s # 314s # The comment "CMake" or "Setuptools" indicates which tool is responsible 314s # for placing the file in the tree used to create the binary distribution. 314s # 314s # ROOT/ 314s # 314s # cmakeModule.py # CMake 314s # 314s # cmake/ 314s # __init__.py # CMake 314s # cmake.py # CMake 314s # 314s # hybrid/ 314s # hybrid_cmake.dat # CMake 314s # hybrid_cmake.py # CMake 314s # hybrid_pure.dat # Setuptools 314s # hybrid_pure.py # Setuptools 314s # 314s # data/ 314s # hybrid_data_pure.dat # CMake or Setuptools 314s # hybrid_data_cmake.dat # CMake *NO TEST* 314s # 314s # hybrid_2/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure.py # CMake or Setuptools 314s # hybrid_2_cmake.py # CMake 314s # 314s # hybrid_2_pure/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure_1.py # CMake or Setuptools 314s # hybrid_2_pure_2.py # CMake or Setuptools 314s # 314s # pureModule.py # Setuptools 314s # 314s # pure/ 314s # __init__.py # Setuptools 314s # pure.py # Setuptools 314s # 314s # data/ 314s # pure.dat # Setuptools 314s 314s tmp_dir.join("setup.py").write( 314s textwrap.dedent( 314s """ 314s from skbuild import setup 314s #from setuptools import setup 314s setup( 314s name="test_hybrid_project", 314s version="1.2.3", 314s description=("an hybrid package mixing files installed by both " 314s "CMake and setuptools"), 314s author='The scikit-build team', 314s license="MIT", 314s cmake_source_dir='{cmake_source_dir}', 314s cmake_install_dir='{cmake_install_dir}', 314s # Arbitrary order of packages 314s packages=[ 314s {p_off} 'pure', 314s {h_off} 'hybrid.hybrid_2', 314s {h_off} 'hybrid', 314s {c_off} 'cmake', 314s {p_off} 'hybrid.hybrid_2_pure', 314s ], 314s py_modules=[ 314s {pm_off} '{package_base}pureModule', 314s {cm_off} '{package_base}cmakeModule', 314s ], 314s package_data={{ 314s {p_off} 'pure': ['data/pure.dat'], 314s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 314s }}, 314s # Arbitrary order of package_dir 314s package_dir = {{ 314s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 314s {p_off} 'pure': '{package_base}pure', 314s {h_off} 'hybrid': '{package_base}hybrid', 314s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 314s {c_off} 'cmake': '{package_base}cmake', 314s }} 314s ) 314s """.format( 314s cmake_source_dir=cmake_source_dir, 314s cmake_install_dir=package_base, 314s package_base=package_base_dir, 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s p_off="" if has_pure_package else "#", 314s pm_off="" if has_pure_module else "#", 314s ) 314s ) 314s ) 314s 314s src_dir = tmp_dir.ensure(package_base, dir=1) 314s 314s src_dir.join("CMakeLists.txt").write( 314s textwrap.dedent( 314s """ 314s cmake_minimum_required(VERSION 3.5.0) 314s project(hybrid NONE) 314s set(build_dir ${{CMAKE_BINARY_DIR}}) 314s 314s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 314s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 314s {c_off} install( 314s {c_off} FILES 314s {c_off} ${{build_dir}}/__init__.py 314s {c_off} ${{build_dir}}/cmake.py 314s {c_off} DESTINATION cmake 314s {c_off} ) 314s 314s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 314s {cm_off} install( 314s {cm_off} FILES ${{build_dir}}/cmakeModule.py 314s {cm_off} DESTINATION .) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 314s {h_off} DESTINATION hybrid/data) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 314s {h_off} DESTINATION hybrid/hybrid_2) 314s 314s install(CODE "message(STATUS \\\"Installation complete\\\")") 314s """.format( 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s ) 314s ) 314s ) 314s 314s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 314s path_types: Sequence[str] 314s try: 314s path_types = next( 314s iter( 314s zip( 314s *filter( 314s lambda i: i[1], 314s [ 314s ("c", has_cmake_package), 314s ("cm", has_cmake_module), 314s ("h", has_hybrid_package), 314s ("p", has_pure_package), 314s ("pm", has_pure_module), 314s ], 314s ) 314s ) 314s ) 314s ) 314s except StopIteration: 314s path_types = [] 314s 314s def select_paths(annotated_paths): 314s """Return a filtered list paths considering ``path_types``. 314s 314s `annotated_paths`` is list of tuple ``(type, path)`` where type 314s is either `c`, 'cm', `h`, `p` or 'pm'. 314s 314s """ 314s return filter(lambda i: i[0] in path_types, annotated_paths) 314s 314s # Commented paths are the one expected to be installed by CMake. For 314s # this reason, corresponding files should NOT be created in the source 314s # tree. 314s for _type, path in select_paths( 314s [ 314s # ('c', 'cmake/__init__.py'), 314s # ('c', 'cmake/cmake.py'), 314s # ('cm', 'cmakeModule.py'), 314s ("h", "hybrid/__init__.py"), 314s # ('h', 'hybrid/hybrid_cmake.dat'), 314s # ('h', 'hybrid/hybrid_cmake.py'), 314s ("h", "hybrid/hybrid_pure.dat"), 314s ("h", "hybrid/hybrid_pure.py"), 314s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 314s ("h", "hybrid/data/hybrid_data_pure.dat"), 314s ("h", "hybrid/hybrid_2/__init__.py"), 314s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 314s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 314s ("p", "hybrid/hybrid_2_pure/__init__.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 314s ("pm", "pureModule.py"), 314s ("p", "pure/__init__.py"), 314s ("p", "pure/pure.py"), 314s ("p", "pure/data/pure.dat"), 314s ] 314s ): 314s assert _type in {"p", "pm", "h"} 314s root = package_base if _type in {"p", "pm"} else cmake_source_dir 314s tmp_dir.ensure(os.path.join(root, path)) 314s 314s # Do not call the real setup function. Instead, replace it with 314s # a MagicMock allowing to check with which arguments it was invoked. 314s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 314s 314s # Convenience print function 314s def _pprint(desc, value=None): 314s print( 314s "-----------------\n" 314s f"{desc}:\n" 314s "\n" 314s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 314s ) 314s 314s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 314s 314s _pprint = ._pprint at 0xf33cebb8> 314s _type = 'h' 314s cmake_source_dir = '' 314s has_cmake_module = 0 314s has_cmake_package = 0 314s has_hybrid_package = 1 314s has_pure_module = 0 314s has_pure_package = 0 314s mock_setup = 314s mocker = 314s package_base = '' 314s package_base_dir = '' 314s path = 'hybrid/hybrid_2/hybrid_2_pure.py' 314s path_types = ('h',) 314s root = '' 314s select_paths = .select_paths at 0xf33ce488> 314s src_dir = local('/tmp/pytest-of-ubuntu/pytest-86/test_setup_inputs0') 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-86/test_setup_inputs0') 314s with_package_base = 0 314s 314s tests/test_setup.py:849: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-86/test_setup_inputs0') 314s setup_args = ['build'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-86/test_setup_inputs0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s ________________________ test_setup_inputs[0-0-0-1-0-1] ________________________ 314s 314s has_cmake_package = 1, has_cmake_module = 0, has_hybrid_package = 1 314s has_pure_package = 0, has_pure_module = 0, with_package_base = 0 314s mocker = 314s 314s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 314s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 314s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_module", [0, 1]) 314s @pytest.mark.parametrize("with_package_base", [0, 1]) 314s def test_setup_inputs( 314s has_cmake_package, 314s has_cmake_module, 314s has_hybrid_package, 314s has_pure_package, 314s has_pure_module, 314s with_package_base, 314s mocker, 314s ): 314s """This test that a project can have a package with some modules 314s installed using setup.py and some other modules installed using CMake. 314s """ 314s 314s tmp_dir = _tmpdir("test_setup_inputs") 314s 314s package_base = "to/the/base" if with_package_base else "" 314s package_base_dir = package_base + "/" if package_base else "" 314s cmake_source_dir = package_base 314s 314s if cmake_source_dir and (has_cmake_package or has_cmake_module): 314s pytest.skip( 314s "unsupported configuration: " 314s "python package fully generated by CMake does *NOT* work. " 314s "At least __init__.py should be in the project source tree" 314s ) 314s 314s # ------------------------------------------------------------------------- 314s # Here is the "SOURCE" tree layout: 314s # 314s # ROOT/ 314s # 314s # setup.py 314s # 314s # [/] 314s # 314s # pureModule.py 314s # 314s # pure/ 314s # __init__.py 314s # pure.py 314s # 314s # data/ 314s # pure.dat 314s # 314s # [/] 314s # 314s # hybrid/ 314s # CMakeLists.txt 314s # __init__.py 314s # hybrid_pure.dat 314s # hybrid_pure.py 314s # 314s # data/ 314s # hybrid_data_pure.dat 314s # 314s # hybrid_2/ 314s # __init__.py 314s # hybrid_2_pure.py 314s # 314s # hybrid_2_pure/ 314s # __init__.py 314s # hybrid_2_pure_1.py 314s # hybrid_2_pure_2.py 314s # 314s # 314s # ------------------------------------------------------------------------- 314s # and here is the "BINARY" distribution layout: 314s # 314s # The comment "CMake" or "Setuptools" indicates which tool is responsible 314s # for placing the file in the tree used to create the binary distribution. 314s # 314s # ROOT/ 314s # 314s # cmakeModule.py # CMake 314s # 314s # cmake/ 314s # __init__.py # CMake 314s # cmake.py # CMake 314s # 314s # hybrid/ 314s # hybrid_cmake.dat # CMake 314s # hybrid_cmake.py # CMake 314s # hybrid_pure.dat # Setuptools 314s # hybrid_pure.py # Setuptools 314s # 314s # data/ 314s # hybrid_data_pure.dat # CMake or Setuptools 314s # hybrid_data_cmake.dat # CMake *NO TEST* 314s # 314s # hybrid_2/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure.py # CMake or Setuptools 314s # hybrid_2_cmake.py # CMake 314s # 314s # hybrid_2_pure/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure_1.py # CMake or Setuptools 314s # hybrid_2_pure_2.py # CMake or Setuptools 314s # 314s # pureModule.py # Setuptools 314s # 314s # pure/ 314s # __init__.py # Setuptools 314s # pure.py # Setuptools 314s # 314s # data/ 314s # pure.dat # Setuptools 314s 314s tmp_dir.join("setup.py").write( 314s textwrap.dedent( 314s """ 314s from skbuild import setup 314s #from setuptools import setup 314s setup( 314s name="test_hybrid_project", 314s version="1.2.3", 314s description=("an hybrid package mixing files installed by both " 314s "CMake and setuptools"), 314s author='The scikit-build team', 314s license="MIT", 314s cmake_source_dir='{cmake_source_dir}', 314s cmake_install_dir='{cmake_install_dir}', 314s # Arbitrary order of packages 314s packages=[ 314s {p_off} 'pure', 314s {h_off} 'hybrid.hybrid_2', 314s {h_off} 'hybrid', 314s {c_off} 'cmake', 314s {p_off} 'hybrid.hybrid_2_pure', 314s ], 314s py_modules=[ 314s {pm_off} '{package_base}pureModule', 314s {cm_off} '{package_base}cmakeModule', 314s ], 314s package_data={{ 314s {p_off} 'pure': ['data/pure.dat'], 314s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 314s }}, 314s # Arbitrary order of package_dir 314s package_dir = {{ 314s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 314s {p_off} 'pure': '{package_base}pure', 314s {h_off} 'hybrid': '{package_base}hybrid', 314s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 314s {c_off} 'cmake': '{package_base}cmake', 314s }} 314s ) 314s """.format( 314s cmake_source_dir=cmake_source_dir, 314s cmake_install_dir=package_base, 314s package_base=package_base_dir, 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s p_off="" if has_pure_package else "#", 314s pm_off="" if has_pure_module else "#", 314s ) 314s ) 314s ) 314s 314s src_dir = tmp_dir.ensure(package_base, dir=1) 314s 314s src_dir.join("CMakeLists.txt").write( 314s textwrap.dedent( 314s """ 314s cmake_minimum_required(VERSION 3.5.0) 314s project(hybrid NONE) 314s set(build_dir ${{CMAKE_BINARY_DIR}}) 314s 314s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 314s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 314s {c_off} install( 314s {c_off} FILES 314s {c_off} ${{build_dir}}/__init__.py 314s {c_off} ${{build_dir}}/cmake.py 314s {c_off} DESTINATION cmake 314s {c_off} ) 314s 314s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 314s {cm_off} install( 314s {cm_off} FILES ${{build_dir}}/cmakeModule.py 314s {cm_off} DESTINATION .) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 314s {h_off} DESTINATION hybrid/data) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 314s {h_off} DESTINATION hybrid/hybrid_2) 314s 314s install(CODE "message(STATUS \\\"Installation complete\\\")") 314s """.format( 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s ) 314s ) 314s ) 314s 314s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 314s path_types: Sequence[str] 314s try: 314s path_types = next( 314s iter( 314s zip( 314s *filter( 314s lambda i: i[1], 314s [ 314s ("c", has_cmake_package), 314s ("cm", has_cmake_module), 314s ("h", has_hybrid_package), 314s ("p", has_pure_package), 314s ("pm", has_pure_module), 314s ], 314s ) 314s ) 314s ) 314s ) 314s except StopIteration: 314s path_types = [] 314s 314s def select_paths(annotated_paths): 314s """Return a filtered list paths considering ``path_types``. 314s 314s `annotated_paths`` is list of tuple ``(type, path)`` where type 314s is either `c`, 'cm', `h`, `p` or 'pm'. 314s 314s """ 314s return filter(lambda i: i[0] in path_types, annotated_paths) 314s 314s # Commented paths are the one expected to be installed by CMake. For 314s # this reason, corresponding files should NOT be created in the source 314s # tree. 314s for _type, path in select_paths( 314s [ 314s # ('c', 'cmake/__init__.py'), 314s # ('c', 'cmake/cmake.py'), 314s # ('cm', 'cmakeModule.py'), 314s ("h", "hybrid/__init__.py"), 314s # ('h', 'hybrid/hybrid_cmake.dat'), 314s # ('h', 'hybrid/hybrid_cmake.py'), 314s ("h", "hybrid/hybrid_pure.dat"), 314s ("h", "hybrid/hybrid_pure.py"), 314s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 314s ("h", "hybrid/data/hybrid_data_pure.dat"), 314s ("h", "hybrid/hybrid_2/__init__.py"), 314s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 314s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 314s ("p", "hybrid/hybrid_2_pure/__init__.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 314s ("pm", "pureModule.py"), 314s ("p", "pure/__init__.py"), 314s ("p", "pure/pure.py"), 314s ("p", "pure/data/pure.dat"), 314s ] 314s ): 314s assert _type in {"p", "pm", "h"} 314s root = package_base if _type in {"p", "pm"} else cmake_source_dir 314s tmp_dir.ensure(os.path.join(root, path)) 314s 314s # Do not call the real setup function. Instead, replace it with 314s # a MagicMock allowing to check with which arguments it was invoked. 314s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 314s 314s # Convenience print function 314s def _pprint(desc, value=None): 314s print( 314s "-----------------\n" 314s f"{desc}:\n" 314s "\n" 314s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 314s ) 314s 314s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 314s 314s _pprint = ._pprint at 0xf32aded8> 314s _type = 'h' 314s cmake_source_dir = '' 314s has_cmake_module = 0 314s has_cmake_package = 1 314s has_hybrid_package = 1 314s has_pure_module = 0 314s has_pure_package = 0 314s mock_setup = 314s mocker = 314s package_base = '' 314s package_base_dir = '' 314s path = 'hybrid/hybrid_2/hybrid_2_pure.py' 314s path_types = ('c', 'h') 314s root = '' 314s select_paths = .select_paths at 0xf33b3d48> 314s src_dir = local('/tmp/pytest-of-ubuntu/pytest-87/test_setup_inputs0') 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-87/test_setup_inputs0') 314s with_package_base = 0 314s 314s tests/test_setup.py:849: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-87/test_setup_inputs0') 314s setup_args = ['build'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-87/test_setup_inputs0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s ________________________ test_setup_inputs[0-0-0-1-1-0] ________________________ 314s 314s has_cmake_package = 0, has_cmake_module = 1, has_hybrid_package = 1 314s has_pure_package = 0, has_pure_module = 0, with_package_base = 0 314s mocker = 314s 314s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 314s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 314s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_module", [0, 1]) 314s @pytest.mark.parametrize("with_package_base", [0, 1]) 314s def test_setup_inputs( 314s has_cmake_package, 314s has_cmake_module, 314s has_hybrid_package, 314s has_pure_package, 314s has_pure_module, 314s with_package_base, 314s mocker, 314s ): 314s """This test that a project can have a package with some modules 314s installed using setup.py and some other modules installed using CMake. 314s """ 314s 314s tmp_dir = _tmpdir("test_setup_inputs") 314s 314s package_base = "to/the/base" if with_package_base else "" 314s package_base_dir = package_base + "/" if package_base else "" 314s cmake_source_dir = package_base 314s 314s if cmake_source_dir and (has_cmake_package or has_cmake_module): 314s pytest.skip( 314s "unsupported configuration: " 314s "python package fully generated by CMake does *NOT* work. " 314s "At least __init__.py should be in the project source tree" 314s ) 314s 314s # ------------------------------------------------------------------------- 314s # Here is the "SOURCE" tree layout: 314s # 314s # ROOT/ 314s # 314s # setup.py 314s # 314s # [/] 314s # 314s # pureModule.py 314s # 314s # pure/ 314s # __init__.py 314s # pure.py 314s # 314s # data/ 314s # pure.dat 314s # 314s # [/] 314s # 314s # hybrid/ 314s # CMakeLists.txt 314s # __init__.py 314s # hybrid_pure.dat 314s # hybrid_pure.py 314s # 314s # data/ 314s # hybrid_data_pure.dat 314s # 314s # hybrid_2/ 314s # __init__.py 314s # hybrid_2_pure.py 314s # 314s # hybrid_2_pure/ 314s # __init__.py 314s # hybrid_2_pure_1.py 314s # hybrid_2_pure_2.py 314s # 314s # 314s # ------------------------------------------------------------------------- 314s # and here is the "BINARY" distribution layout: 314s # 314s # The comment "CMake" or "Setuptools" indicates which tool is responsible 314s # for placing the file in the tree used to create the binary distribution. 314s # 314s # ROOT/ 314s # 314s # cmakeModule.py # CMake 314s # 314s # cmake/ 314s # __init__.py # CMake 314s # cmake.py # CMake 314s # 314s # hybrid/ 314s # hybrid_cmake.dat # CMake 314s # hybrid_cmake.py # CMake 314s # hybrid_pure.dat # Setuptools 314s # hybrid_pure.py # Setuptools 314s # 314s # data/ 314s # hybrid_data_pure.dat # CMake or Setuptools 314s # hybrid_data_cmake.dat # CMake *NO TEST* 314s # 314s # hybrid_2/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure.py # CMake or Setuptools 314s # hybrid_2_cmake.py # CMake 314s # 314s # hybrid_2_pure/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure_1.py # CMake or Setuptools 314s # hybrid_2_pure_2.py # CMake or Setuptools 314s # 314s # pureModule.py # Setuptools 314s # 314s # pure/ 314s # __init__.py # Setuptools 314s # pure.py # Setuptools 314s # 314s # data/ 314s # pure.dat # Setuptools 314s 314s tmp_dir.join("setup.py").write( 314s textwrap.dedent( 314s """ 314s from skbuild import setup 314s #from setuptools import setup 314s setup( 314s name="test_hybrid_project", 314s version="1.2.3", 314s description=("an hybrid package mixing files installed by both " 314s "CMake and setuptools"), 314s author='The scikit-build team', 314s license="MIT", 314s cmake_source_dir='{cmake_source_dir}', 314s cmake_install_dir='{cmake_install_dir}', 314s # Arbitrary order of packages 314s packages=[ 314s {p_off} 'pure', 314s {h_off} 'hybrid.hybrid_2', 314s {h_off} 'hybrid', 314s {c_off} 'cmake', 314s {p_off} 'hybrid.hybrid_2_pure', 314s ], 314s py_modules=[ 314s {pm_off} '{package_base}pureModule', 314s {cm_off} '{package_base}cmakeModule', 314s ], 314s package_data={{ 314s {p_off} 'pure': ['data/pure.dat'], 314s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 314s }}, 314s # Arbitrary order of package_dir 314s package_dir = {{ 314s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 314s {p_off} 'pure': '{package_base}pure', 314s {h_off} 'hybrid': '{package_base}hybrid', 314s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 314s {c_off} 'cmake': '{package_base}cmake', 314s }} 314s ) 314s """.format( 314s cmake_source_dir=cmake_source_dir, 314s cmake_install_dir=package_base, 314s package_base=package_base_dir, 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s p_off="" if has_pure_package else "#", 314s pm_off="" if has_pure_module else "#", 314s ) 314s ) 314s ) 314s 314s src_dir = tmp_dir.ensure(package_base, dir=1) 314s 314s src_dir.join("CMakeLists.txt").write( 314s textwrap.dedent( 314s """ 314s cmake_minimum_required(VERSION 3.5.0) 314s project(hybrid NONE) 314s set(build_dir ${{CMAKE_BINARY_DIR}}) 314s 314s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 314s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 314s {c_off} install( 314s {c_off} FILES 314s {c_off} ${{build_dir}}/__init__.py 314s {c_off} ${{build_dir}}/cmake.py 314s {c_off} DESTINATION cmake 314s {c_off} ) 314s 314s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 314s {cm_off} install( 314s {cm_off} FILES ${{build_dir}}/cmakeModule.py 314s {cm_off} DESTINATION .) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 314s {h_off} DESTINATION hybrid/data) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 314s {h_off} DESTINATION hybrid/hybrid_2) 314s 314s install(CODE "message(STATUS \\\"Installation complete\\\")") 314s """.format( 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s ) 314s ) 314s ) 314s 314s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 314s path_types: Sequence[str] 314s try: 314s path_types = next( 314s iter( 314s zip( 314s *filter( 314s lambda i: i[1], 314s [ 314s ("c", has_cmake_package), 314s ("cm", has_cmake_module), 314s ("h", has_hybrid_package), 314s ("p", has_pure_package), 314s ("pm", has_pure_module), 314s ], 314s ) 314s ) 314s ) 314s ) 314s except StopIteration: 314s path_types = [] 314s 314s def select_paths(annotated_paths): 314s """Return a filtered list paths considering ``path_types``. 314s 314s `annotated_paths`` is list of tuple ``(type, path)`` where type 314s is either `c`, 'cm', `h`, `p` or 'pm'. 314s 314s """ 314s return filter(lambda i: i[0] in path_types, annotated_paths) 314s 314s # Commented paths are the one expected to be installed by CMake. For 314s # this reason, corresponding files should NOT be created in the source 314s # tree. 314s for _type, path in select_paths( 314s [ 314s # ('c', 'cmake/__init__.py'), 314s # ('c', 'cmake/cmake.py'), 314s # ('cm', 'cmakeModule.py'), 314s ("h", "hybrid/__init__.py"), 314s # ('h', 'hybrid/hybrid_cmake.dat'), 314s # ('h', 'hybrid/hybrid_cmake.py'), 314s ("h", "hybrid/hybrid_pure.dat"), 314s ("h", "hybrid/hybrid_pure.py"), 314s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 314s ("h", "hybrid/data/hybrid_data_pure.dat"), 314s ("h", "hybrid/hybrid_2/__init__.py"), 314s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 314s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 314s ("p", "hybrid/hybrid_2_pure/__init__.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 314s ("pm", "pureModule.py"), 314s ("p", "pure/__init__.py"), 314s ("p", "pure/pure.py"), 314s ("p", "pure/data/pure.dat"), 314s ] 314s ): 314s assert _type in {"p", "pm", "h"} 314s root = package_base if _type in {"p", "pm"} else cmake_source_dir 314s tmp_dir.ensure(os.path.join(root, path)) 314s 314s # Do not call the real setup function. Instead, replace it with 314s # a MagicMock allowing to check with which arguments it was invoked. 314s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 314s 314s # Convenience print function 314s def _pprint(desc, value=None): 314s print( 314s "-----------------\n" 314s f"{desc}:\n" 314s "\n" 314s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 314s ) 314s 314s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 314s 314s _pprint = ._pprint at 0xf33b9e38> 314s _type = 'h' 314s cmake_source_dir = '' 314s has_cmake_module = 1 314s has_cmake_package = 0 314s has_hybrid_package = 1 314s has_pure_module = 0 314s has_pure_package = 0 314s mock_setup = 314s mocker = 314s package_base = '' 314s package_base_dir = '' 314s path = 'hybrid/hybrid_2/hybrid_2_pure.py' 314s path_types = ('cm', 'h') 314s root = '' 314s select_paths = .select_paths at 0xf32adc08> 314s src_dir = local('/tmp/pytest-of-ubuntu/pytest-88/test_setup_inputs0') 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-88/test_setup_inputs0') 314s with_package_base = 0 314s 314s tests/test_setup.py:849: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-88/test_setup_inputs0') 314s setup_args = ['build'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-88/test_setup_inputs0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s ________________________ test_setup_inputs[0-0-0-1-1-1] ________________________ 314s 314s has_cmake_package = 1, has_cmake_module = 1, has_hybrid_package = 1 314s has_pure_package = 0, has_pure_module = 0, with_package_base = 0 314s mocker = 314s 314s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 314s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 314s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_module", [0, 1]) 314s @pytest.mark.parametrize("with_package_base", [0, 1]) 314s def test_setup_inputs( 314s has_cmake_package, 314s has_cmake_module, 314s has_hybrid_package, 314s has_pure_package, 314s has_pure_module, 314s with_package_base, 314s mocker, 314s ): 314s """This test that a project can have a package with some modules 314s installed using setup.py and some other modules installed using CMake. 314s """ 314s 314s tmp_dir = _tmpdir("test_setup_inputs") 314s 314s package_base = "to/the/base" if with_package_base else "" 314s package_base_dir = package_base + "/" if package_base else "" 314s cmake_source_dir = package_base 314s 314s if cmake_source_dir and (has_cmake_package or has_cmake_module): 314s pytest.skip( 314s "unsupported configuration: " 314s "python package fully generated by CMake does *NOT* work. " 314s "At least __init__.py should be in the project source tree" 314s ) 314s 314s # ------------------------------------------------------------------------- 314s # Here is the "SOURCE" tree layout: 314s # 314s # ROOT/ 314s # 314s # setup.py 314s # 314s # [/] 314s # 314s # pureModule.py 314s # 314s # pure/ 314s # __init__.py 314s # pure.py 314s # 314s # data/ 314s # pure.dat 314s # 314s # [/] 314s # 314s # hybrid/ 314s # CMakeLists.txt 314s # __init__.py 314s # hybrid_pure.dat 314s # hybrid_pure.py 314s # 314s # data/ 314s # hybrid_data_pure.dat 314s # 314s # hybrid_2/ 314s # __init__.py 314s # hybrid_2_pure.py 314s # 314s # hybrid_2_pure/ 314s # __init__.py 314s # hybrid_2_pure_1.py 314s # hybrid_2_pure_2.py 314s # 314s # 314s # ------------------------------------------------------------------------- 314s # and here is the "BINARY" distribution layout: 314s # 314s # The comment "CMake" or "Setuptools" indicates which tool is responsible 314s # for placing the file in the tree used to create the binary distribution. 314s # 314s # ROOT/ 314s # 314s # cmakeModule.py # CMake 314s # 314s # cmake/ 314s # __init__.py # CMake 314s # cmake.py # CMake 314s # 314s # hybrid/ 314s # hybrid_cmake.dat # CMake 314s # hybrid_cmake.py # CMake 314s # hybrid_pure.dat # Setuptools 314s # hybrid_pure.py # Setuptools 314s # 314s # data/ 314s # hybrid_data_pure.dat # CMake or Setuptools 314s # hybrid_data_cmake.dat # CMake *NO TEST* 314s # 314s # hybrid_2/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure.py # CMake or Setuptools 314s # hybrid_2_cmake.py # CMake 314s # 314s # hybrid_2_pure/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure_1.py # CMake or Setuptools 314s # hybrid_2_pure_2.py # CMake or Setuptools 314s # 314s # pureModule.py # Setuptools 314s # 314s # pure/ 314s # __init__.py # Setuptools 314s # pure.py # Setuptools 314s # 314s # data/ 314s # pure.dat # Setuptools 314s 314s tmp_dir.join("setup.py").write( 314s textwrap.dedent( 314s """ 314s from skbuild import setup 314s #from setuptools import setup 314s setup( 314s name="test_hybrid_project", 314s version="1.2.3", 314s description=("an hybrid package mixing files installed by both " 314s "CMake and setuptools"), 314s author='The scikit-build team', 314s license="MIT", 314s cmake_source_dir='{cmake_source_dir}', 314s cmake_install_dir='{cmake_install_dir}', 314s # Arbitrary order of packages 314s packages=[ 314s {p_off} 'pure', 314s {h_off} 'hybrid.hybrid_2', 314s {h_off} 'hybrid', 314s {c_off} 'cmake', 314s {p_off} 'hybrid.hybrid_2_pure', 314s ], 314s py_modules=[ 314s {pm_off} '{package_base}pureModule', 314s {cm_off} '{package_base}cmakeModule', 314s ], 314s package_data={{ 314s {p_off} 'pure': ['data/pure.dat'], 314s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 314s }}, 314s # Arbitrary order of package_dir 314s package_dir = {{ 314s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 314s {p_off} 'pure': '{package_base}pure', 314s {h_off} 'hybrid': '{package_base}hybrid', 314s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 314s {c_off} 'cmake': '{package_base}cmake', 314s }} 314s ) 314s """.format( 314s cmake_source_dir=cmake_source_dir, 314s cmake_install_dir=package_base, 314s package_base=package_base_dir, 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s p_off="" if has_pure_package else "#", 314s pm_off="" if has_pure_module else "#", 314s ) 314s ) 314s ) 314s 314s src_dir = tmp_dir.ensure(package_base, dir=1) 314s 314s src_dir.join("CMakeLists.txt").write( 314s textwrap.dedent( 314s """ 314s cmake_minimum_required(VERSION 3.5.0) 314s project(hybrid NONE) 314s set(build_dir ${{CMAKE_BINARY_DIR}}) 314s 314s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 314s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 314s {c_off} install( 314s {c_off} FILES 314s {c_off} ${{build_dir}}/__init__.py 314s {c_off} ${{build_dir}}/cmake.py 314s {c_off} DESTINATION cmake 314s {c_off} ) 314s 314s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 314s {cm_off} install( 314s {cm_off} FILES ${{build_dir}}/cmakeModule.py 314s {cm_off} DESTINATION .) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 314s {h_off} DESTINATION hybrid/data) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 314s {h_off} DESTINATION hybrid/hybrid_2) 314s 314s install(CODE "message(STATUS \\\"Installation complete\\\")") 314s """.format( 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s ) 314s ) 314s ) 314s 314s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 314s path_types: Sequence[str] 314s try: 314s path_types = next( 314s iter( 314s zip( 314s *filter( 314s lambda i: i[1], 314s [ 314s ("c", has_cmake_package), 314s ("cm", has_cmake_module), 314s ("h", has_hybrid_package), 314s ("p", has_pure_package), 314s ("pm", has_pure_module), 314s ], 314s ) 314s ) 314s ) 314s ) 314s except StopIteration: 314s path_types = [] 314s 314s def select_paths(annotated_paths): 314s """Return a filtered list paths considering ``path_types``. 314s 314s `annotated_paths`` is list of tuple ``(type, path)`` where type 314s is either `c`, 'cm', `h`, `p` or 'pm'. 314s 314s """ 314s return filter(lambda i: i[0] in path_types, annotated_paths) 314s 314s # Commented paths are the one expected to be installed by CMake. For 314s # this reason, corresponding files should NOT be created in the source 314s # tree. 314s for _type, path in select_paths( 314s [ 314s # ('c', 'cmake/__init__.py'), 314s # ('c', 'cmake/cmake.py'), 314s # ('cm', 'cmakeModule.py'), 314s ("h", "hybrid/__init__.py"), 314s # ('h', 'hybrid/hybrid_cmake.dat'), 314s # ('h', 'hybrid/hybrid_cmake.py'), 314s ("h", "hybrid/hybrid_pure.dat"), 314s ("h", "hybrid/hybrid_pure.py"), 314s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 314s ("h", "hybrid/data/hybrid_data_pure.dat"), 314s ("h", "hybrid/hybrid_2/__init__.py"), 314s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 314s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 314s ("p", "hybrid/hybrid_2_pure/__init__.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 314s ("pm", "pureModule.py"), 314s ("p", "pure/__init__.py"), 314s ("p", "pure/pure.py"), 314s ("p", "pure/data/pure.dat"), 314s ] 314s ): 314s assert _type in {"p", "pm", "h"} 314s root = package_base if _type in {"p", "pm"} else cmake_source_dir 314s tmp_dir.ensure(os.path.join(root, path)) 314s 314s # Do not call the real setup function. Instead, replace it with 314s # a MagicMock allowing to check with which arguments it was invoked. 314s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 314s 314s # Convenience print function 314s def _pprint(desc, value=None): 314s print( 314s "-----------------\n" 314s f"{desc}:\n" 314s "\n" 314s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 314s ) 314s 314s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 314s 314s _pprint = ._pprint at 0xf32b6ed8> 314s _type = 'h' 314s cmake_source_dir = '' 314s has_cmake_module = 1 314s has_cmake_package = 1 314s has_hybrid_package = 1 314s has_pure_module = 0 314s has_pure_package = 0 314s mock_setup = 314s mocker = 314s package_base = '' 314s package_base_dir = '' 314s path = 'hybrid/hybrid_2/hybrid_2_pure.py' 314s path_types = ('c', 'cm', 'h') 314s root = '' 314s select_paths = .select_paths at 0xf32adbb8> 314s src_dir = local('/tmp/pytest-of-ubuntu/pytest-89/test_setup_inputs0') 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-89/test_setup_inputs0') 314s with_package_base = 0 314s 314s tests/test_setup.py:849: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-89/test_setup_inputs0') 314s setup_args = ['build'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-89/test_setup_inputs0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s ________________________ test_setup_inputs[0-0-1-0-0-0] ________________________ 314s 314s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 0 314s has_pure_package = 1, has_pure_module = 0, with_package_base = 0 314s mocker = 314s 314s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 314s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 314s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_module", [0, 1]) 314s @pytest.mark.parametrize("with_package_base", [0, 1]) 314s def test_setup_inputs( 314s has_cmake_package, 314s has_cmake_module, 314s has_hybrid_package, 314s has_pure_package, 314s has_pure_module, 314s with_package_base, 314s mocker, 314s ): 314s """This test that a project can have a package with some modules 314s installed using setup.py and some other modules installed using CMake. 314s """ 314s 314s tmp_dir = _tmpdir("test_setup_inputs") 314s 314s package_base = "to/the/base" if with_package_base else "" 314s package_base_dir = package_base + "/" if package_base else "" 314s cmake_source_dir = package_base 314s 314s if cmake_source_dir and (has_cmake_package or has_cmake_module): 314s pytest.skip( 314s "unsupported configuration: " 314s "python package fully generated by CMake does *NOT* work. " 314s "At least __init__.py should be in the project source tree" 314s ) 314s 314s # ------------------------------------------------------------------------- 314s # Here is the "SOURCE" tree layout: 314s # 314s # ROOT/ 314s # 314s # setup.py 314s # 314s # [/] 314s # 314s # pureModule.py 314s # 314s # pure/ 314s # __init__.py 314s # pure.py 314s # 314s # data/ 314s # pure.dat 314s # 314s # [/] 314s # 314s # hybrid/ 314s # CMakeLists.txt 314s # __init__.py 314s # hybrid_pure.dat 314s # hybrid_pure.py 314s # 314s # data/ 314s # hybrid_data_pure.dat 314s # 314s # hybrid_2/ 314s # __init__.py 314s # hybrid_2_pure.py 314s # 314s # hybrid_2_pure/ 314s # __init__.py 314s # hybrid_2_pure_1.py 314s # hybrid_2_pure_2.py 314s # 314s # 314s # ------------------------------------------------------------------------- 314s # and here is the "BINARY" distribution layout: 314s # 314s # The comment "CMake" or "Setuptools" indicates which tool is responsible 314s # for placing the file in the tree used to create the binary distribution. 314s # 314s # ROOT/ 314s # 314s # cmakeModule.py # CMake 314s # 314s # cmake/ 314s # __init__.py # CMake 314s # cmake.py # CMake 314s # 314s # hybrid/ 314s # hybrid_cmake.dat # CMake 314s # hybrid_cmake.py # CMake 314s # hybrid_pure.dat # Setuptools 314s # hybrid_pure.py # Setuptools 314s # 314s # data/ 314s # hybrid_data_pure.dat # CMake or Setuptools 314s # hybrid_data_cmake.dat # CMake *NO TEST* 314s # 314s # hybrid_2/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure.py # CMake or Setuptools 314s # hybrid_2_cmake.py # CMake 314s # 314s # hybrid_2_pure/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure_1.py # CMake or Setuptools 314s # hybrid_2_pure_2.py # CMake or Setuptools 314s # 314s # pureModule.py # Setuptools 314s # 314s # pure/ 314s # __init__.py # Setuptools 314s # pure.py # Setuptools 314s # 314s # data/ 314s # pure.dat # Setuptools 314s 314s tmp_dir.join("setup.py").write( 314s textwrap.dedent( 314s """ 314s from skbuild import setup 314s #from setuptools import setup 314s setup( 314s name="test_hybrid_project", 314s version="1.2.3", 314s description=("an hybrid package mixing files installed by both " 314s "CMake and setuptools"), 314s author='The scikit-build team', 314s license="MIT", 314s cmake_source_dir='{cmake_source_dir}', 314s cmake_install_dir='{cmake_install_dir}', 314s # Arbitrary order of packages 314s packages=[ 314s {p_off} 'pure', 314s {h_off} 'hybrid.hybrid_2', 314s {h_off} 'hybrid', 314s {c_off} 'cmake', 314s {p_off} 'hybrid.hybrid_2_pure', 314s ], 314s py_modules=[ 314s {pm_off} '{package_base}pureModule', 314s {cm_off} '{package_base}cmakeModule', 314s ], 314s package_data={{ 314s {p_off} 'pure': ['data/pure.dat'], 314s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 314s }}, 314s # Arbitrary order of package_dir 314s package_dir = {{ 314s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 314s {p_off} 'pure': '{package_base}pure', 314s {h_off} 'hybrid': '{package_base}hybrid', 314s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 314s {c_off} 'cmake': '{package_base}cmake', 314s }} 314s ) 314s """.format( 314s cmake_source_dir=cmake_source_dir, 314s cmake_install_dir=package_base, 314s package_base=package_base_dir, 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s p_off="" if has_pure_package else "#", 314s pm_off="" if has_pure_module else "#", 314s ) 314s ) 314s ) 314s 314s src_dir = tmp_dir.ensure(package_base, dir=1) 314s 314s src_dir.join("CMakeLists.txt").write( 314s textwrap.dedent( 314s """ 314s cmake_minimum_required(VERSION 3.5.0) 314s project(hybrid NONE) 314s set(build_dir ${{CMAKE_BINARY_DIR}}) 314s 314s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 314s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 314s {c_off} install( 314s {c_off} FILES 314s {c_off} ${{build_dir}}/__init__.py 314s {c_off} ${{build_dir}}/cmake.py 314s {c_off} DESTINATION cmake 314s {c_off} ) 314s 314s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 314s {cm_off} install( 314s {cm_off} FILES ${{build_dir}}/cmakeModule.py 314s {cm_off} DESTINATION .) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 314s {h_off} DESTINATION hybrid/data) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 314s {h_off} DESTINATION hybrid/hybrid_2) 314s 314s install(CODE "message(STATUS \\\"Installation complete\\\")") 314s """.format( 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s ) 314s ) 314s ) 314s 314s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 314s path_types: Sequence[str] 314s try: 314s path_types = next( 314s iter( 314s zip( 314s *filter( 314s lambda i: i[1], 314s [ 314s ("c", has_cmake_package), 314s ("cm", has_cmake_module), 314s ("h", has_hybrid_package), 314s ("p", has_pure_package), 314s ("pm", has_pure_module), 314s ], 314s ) 314s ) 314s ) 314s ) 314s except StopIteration: 314s path_types = [] 314s 314s def select_paths(annotated_paths): 314s """Return a filtered list paths considering ``path_types``. 314s 314s `annotated_paths`` is list of tuple ``(type, path)`` where type 314s is either `c`, 'cm', `h`, `p` or 'pm'. 314s 314s """ 314s return filter(lambda i: i[0] in path_types, annotated_paths) 314s 314s # Commented paths are the one expected to be installed by CMake. For 314s # this reason, corresponding files should NOT be created in the source 314s # tree. 314s for _type, path in select_paths( 314s [ 314s # ('c', 'cmake/__init__.py'), 314s # ('c', 'cmake/cmake.py'), 314s # ('cm', 'cmakeModule.py'), 314s ("h", "hybrid/__init__.py"), 314s # ('h', 'hybrid/hybrid_cmake.dat'), 314s # ('h', 'hybrid/hybrid_cmake.py'), 314s ("h", "hybrid/hybrid_pure.dat"), 314s ("h", "hybrid/hybrid_pure.py"), 314s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 314s ("h", "hybrid/data/hybrid_data_pure.dat"), 314s ("h", "hybrid/hybrid_2/__init__.py"), 314s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 314s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 314s ("p", "hybrid/hybrid_2_pure/__init__.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 314s ("pm", "pureModule.py"), 314s ("p", "pure/__init__.py"), 314s ("p", "pure/pure.py"), 314s ("p", "pure/data/pure.dat"), 314s ] 314s ): 314s assert _type in {"p", "pm", "h"} 314s root = package_base if _type in {"p", "pm"} else cmake_source_dir 314s tmp_dir.ensure(os.path.join(root, path)) 314s 314s # Do not call the real setup function. Instead, replace it with 314s # a MagicMock allowing to check with which arguments it was invoked. 314s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 314s 314s # Convenience print function 314s def _pprint(desc, value=None): 314s print( 314s "-----------------\n" 314s f"{desc}:\n" 314s "\n" 314s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 314s ) 314s 314s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 314s 314s _pprint = ._pprint at 0xf329fc08> 314s _type = 'p' 314s cmake_source_dir = '' 314s has_cmake_module = 0 314s has_cmake_package = 0 314s has_hybrid_package = 0 314s has_pure_module = 0 314s has_pure_package = 1 314s mock_setup = 314s mocker = 314s package_base = '' 314s package_base_dir = '' 314s path = 'pure/data/pure.dat' 314s path_types = ('p',) 314s root = '' 314s select_paths = .select_paths at 0xf329ef28> 314s src_dir = local('/tmp/pytest-of-ubuntu/pytest-90/test_setup_inputs0') 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-90/test_setup_inputs0') 314s with_package_base = 0 314s 314s tests/test_setup.py:849: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-90/test_setup_inputs0') 314s setup_args = ['build'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-90/test_setup_inputs0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s ________________________ test_setup_inputs[0-0-1-0-0-1] ________________________ 314s 314s has_cmake_package = 1, has_cmake_module = 0, has_hybrid_package = 0 314s has_pure_package = 1, has_pure_module = 0, with_package_base = 0 314s mocker = 314s 314s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 314s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 314s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_module", [0, 1]) 314s @pytest.mark.parametrize("with_package_base", [0, 1]) 314s def test_setup_inputs( 314s has_cmake_package, 314s has_cmake_module, 314s has_hybrid_package, 314s has_pure_package, 314s has_pure_module, 314s with_package_base, 314s mocker, 314s ): 314s """This test that a project can have a package with some modules 314s installed using setup.py and some other modules installed using CMake. 314s """ 314s 314s tmp_dir = _tmpdir("test_setup_inputs") 314s 314s package_base = "to/the/base" if with_package_base else "" 314s package_base_dir = package_base + "/" if package_base else "" 314s cmake_source_dir = package_base 314s 314s if cmake_source_dir and (has_cmake_package or has_cmake_module): 314s pytest.skip( 314s "unsupported configuration: " 314s "python package fully generated by CMake does *NOT* work. " 314s "At least __init__.py should be in the project source tree" 314s ) 314s 314s # ------------------------------------------------------------------------- 314s # Here is the "SOURCE" tree layout: 314s # 314s # ROOT/ 314s # 314s # setup.py 314s # 314s # [/] 314s # 314s # pureModule.py 314s # 314s # pure/ 314s # __init__.py 314s # pure.py 314s # 314s # data/ 314s # pure.dat 314s # 314s # [/] 314s # 314s # hybrid/ 314s # CMakeLists.txt 314s # __init__.py 314s # hybrid_pure.dat 314s # hybrid_pure.py 314s # 314s # data/ 314s # hybrid_data_pure.dat 314s # 314s # hybrid_2/ 314s # __init__.py 314s # hybrid_2_pure.py 314s # 314s # hybrid_2_pure/ 314s # __init__.py 314s # hybrid_2_pure_1.py 314s # hybrid_2_pure_2.py 314s # 314s # 314s # ------------------------------------------------------------------------- 314s # and here is the "BINARY" distribution layout: 314s # 314s # The comment "CMake" or "Setuptools" indicates which tool is responsible 314s # for placing the file in the tree used to create the binary distribution. 314s # 314s # ROOT/ 314s # 314s # cmakeModule.py # CMake 314s # 314s # cmake/ 314s # __init__.py # CMake 314s # cmake.py # CMake 314s # 314s # hybrid/ 314s # hybrid_cmake.dat # CMake 314s # hybrid_cmake.py # CMake 314s # hybrid_pure.dat # Setuptools 314s # hybrid_pure.py # Setuptools 314s # 314s # data/ 314s # hybrid_data_pure.dat # CMake or Setuptools 314s # hybrid_data_cmake.dat # CMake *NO TEST* 314s # 314s # hybrid_2/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure.py # CMake or Setuptools 314s # hybrid_2_cmake.py # CMake 314s # 314s # hybrid_2_pure/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure_1.py # CMake or Setuptools 314s # hybrid_2_pure_2.py # CMake or Setuptools 314s # 314s # pureModule.py # Setuptools 314s # 314s # pure/ 314s # __init__.py # Setuptools 314s # pure.py # Setuptools 314s # 314s # data/ 314s # pure.dat # Setuptools 314s 314s tmp_dir.join("setup.py").write( 314s textwrap.dedent( 314s """ 314s from skbuild import setup 314s #from setuptools import setup 314s setup( 314s name="test_hybrid_project", 314s version="1.2.3", 314s description=("an hybrid package mixing files installed by both " 314s "CMake and setuptools"), 314s author='The scikit-build team', 314s license="MIT", 314s cmake_source_dir='{cmake_source_dir}', 314s cmake_install_dir='{cmake_install_dir}', 314s # Arbitrary order of packages 314s packages=[ 314s {p_off} 'pure', 314s {h_off} 'hybrid.hybrid_2', 314s {h_off} 'hybrid', 314s {c_off} 'cmake', 314s {p_off} 'hybrid.hybrid_2_pure', 314s ], 314s py_modules=[ 314s {pm_off} '{package_base}pureModule', 314s {cm_off} '{package_base}cmakeModule', 314s ], 314s package_data={{ 314s {p_off} 'pure': ['data/pure.dat'], 314s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 314s }}, 314s # Arbitrary order of package_dir 314s package_dir = {{ 314s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 314s {p_off} 'pure': '{package_base}pure', 314s {h_off} 'hybrid': '{package_base}hybrid', 314s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 314s {c_off} 'cmake': '{package_base}cmake', 314s }} 314s ) 314s """.format( 314s cmake_source_dir=cmake_source_dir, 314s cmake_install_dir=package_base, 314s package_base=package_base_dir, 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s p_off="" if has_pure_package else "#", 314s pm_off="" if has_pure_module else "#", 314s ) 314s ) 314s ) 314s 314s src_dir = tmp_dir.ensure(package_base, dir=1) 314s 314s src_dir.join("CMakeLists.txt").write( 314s textwrap.dedent( 314s """ 314s cmake_minimum_required(VERSION 3.5.0) 314s project(hybrid NONE) 314s set(build_dir ${{CMAKE_BINARY_DIR}}) 314s 314s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 314s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 314s {c_off} install( 314s {c_off} FILES 314s {c_off} ${{build_dir}}/__init__.py 314s {c_off} ${{build_dir}}/cmake.py 314s {c_off} DESTINATION cmake 314s {c_off} ) 314s 314s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 314s {cm_off} install( 314s {cm_off} FILES ${{build_dir}}/cmakeModule.py 314s {cm_off} DESTINATION .) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 314s {h_off} DESTINATION hybrid/data) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 314s {h_off} DESTINATION hybrid/hybrid_2) 314s 314s install(CODE "message(STATUS \\\"Installation complete\\\")") 314s """.format( 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s ) 314s ) 314s ) 314s 314s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 314s path_types: Sequence[str] 314s try: 314s path_types = next( 314s iter( 314s zip( 314s *filter( 314s lambda i: i[1], 314s [ 314s ("c", has_cmake_package), 314s ("cm", has_cmake_module), 314s ("h", has_hybrid_package), 314s ("p", has_pure_package), 314s ("pm", has_pure_module), 314s ], 314s ) 314s ) 314s ) 314s ) 314s except StopIteration: 314s path_types = [] 314s 314s def select_paths(annotated_paths): 314s """Return a filtered list paths considering ``path_types``. 314s 314s `annotated_paths`` is list of tuple ``(type, path)`` where type 314s is either `c`, 'cm', `h`, `p` or 'pm'. 314s 314s """ 314s return filter(lambda i: i[0] in path_types, annotated_paths) 314s 314s # Commented paths are the one expected to be installed by CMake. For 314s # this reason, corresponding files should NOT be created in the source 314s # tree. 314s for _type, path in select_paths( 314s [ 314s # ('c', 'cmake/__init__.py'), 314s # ('c', 'cmake/cmake.py'), 314s # ('cm', 'cmakeModule.py'), 314s ("h", "hybrid/__init__.py"), 314s # ('h', 'hybrid/hybrid_cmake.dat'), 314s # ('h', 'hybrid/hybrid_cmake.py'), 314s ("h", "hybrid/hybrid_pure.dat"), 314s ("h", "hybrid/hybrid_pure.py"), 314s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 314s ("h", "hybrid/data/hybrid_data_pure.dat"), 314s ("h", "hybrid/hybrid_2/__init__.py"), 314s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 314s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 314s ("p", "hybrid/hybrid_2_pure/__init__.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 314s ("pm", "pureModule.py"), 314s ("p", "pure/__init__.py"), 314s ("p", "pure/pure.py"), 314s ("p", "pure/data/pure.dat"), 314s ] 314s ): 314s assert _type in {"p", "pm", "h"} 314s root = package_base if _type in {"p", "pm"} else cmake_source_dir 314s tmp_dir.ensure(os.path.join(root, path)) 314s 314s # Do not call the real setup function. Instead, replace it with 314s # a MagicMock allowing to check with which arguments it was invoked. 314s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 314s 314s # Convenience print function 314s def _pprint(desc, value=None): 314s print( 314s "-----------------\n" 314s f"{desc}:\n" 314s "\n" 314s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 314s ) 314s 314s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 314s 314s _pprint = ._pprint at 0xf33cee88> 314s _type = 'p' 314s cmake_source_dir = '' 314s has_cmake_module = 0 314s has_cmake_package = 1 314s has_hybrid_package = 0 314s has_pure_module = 0 314s has_pure_package = 1 314s mock_setup = 314s mocker = 314s package_base = '' 314s package_base_dir = '' 314s path = 'pure/data/pure.dat' 314s path_types = ('c', 'p') 314s root = '' 314s select_paths = .select_paths at 0xf3482a78> 314s src_dir = local('/tmp/pytest-of-ubuntu/pytest-91/test_setup_inputs0') 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-91/test_setup_inputs0') 314s with_package_base = 0 314s 314s tests/test_setup.py:849: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-91/test_setup_inputs0') 314s setup_args = ['build'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-91/test_setup_inputs0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s ________________________ test_setup_inputs[0-0-1-0-1-0] ________________________ 314s 314s has_cmake_package = 0, has_cmake_module = 1, has_hybrid_package = 0 314s has_pure_package = 1, has_pure_module = 0, with_package_base = 0 314s mocker = 314s 314s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 314s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 314s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_module", [0, 1]) 314s @pytest.mark.parametrize("with_package_base", [0, 1]) 314s def test_setup_inputs( 314s has_cmake_package, 314s has_cmake_module, 314s has_hybrid_package, 314s has_pure_package, 314s has_pure_module, 314s with_package_base, 314s mocker, 314s ): 314s """This test that a project can have a package with some modules 314s installed using setup.py and some other modules installed using CMake. 314s """ 314s 314s tmp_dir = _tmpdir("test_setup_inputs") 314s 314s package_base = "to/the/base" if with_package_base else "" 314s package_base_dir = package_base + "/" if package_base else "" 314s cmake_source_dir = package_base 314s 314s if cmake_source_dir and (has_cmake_package or has_cmake_module): 314s pytest.skip( 314s "unsupported configuration: " 314s "python package fully generated by CMake does *NOT* work. " 314s "At least __init__.py should be in the project source tree" 314s ) 314s 314s # ------------------------------------------------------------------------- 314s # Here is the "SOURCE" tree layout: 314s # 314s # ROOT/ 314s # 314s # setup.py 314s # 314s # [/] 314s # 314s # pureModule.py 314s # 314s # pure/ 314s # __init__.py 314s # pure.py 314s # 314s # data/ 314s # pure.dat 314s # 314s # [/] 314s # 314s # hybrid/ 314s # CMakeLists.txt 314s # __init__.py 314s # hybrid_pure.dat 314s # hybrid_pure.py 314s # 314s # data/ 314s # hybrid_data_pure.dat 314s # 314s # hybrid_2/ 314s # __init__.py 314s # hybrid_2_pure.py 314s # 314s # hybrid_2_pure/ 314s # __init__.py 314s # hybrid_2_pure_1.py 314s # hybrid_2_pure_2.py 314s # 314s # 314s # ------------------------------------------------------------------------- 314s # and here is the "BINARY" distribution layout: 314s # 314s # The comment "CMake" or "Setuptools" indicates which tool is responsible 314s # for placing the file in the tree used to create the binary distribution. 314s # 314s # ROOT/ 314s # 314s # cmakeModule.py # CMake 314s # 314s # cmake/ 314s # __init__.py # CMake 314s # cmake.py # CMake 314s # 314s # hybrid/ 314s # hybrid_cmake.dat # CMake 314s # hybrid_cmake.py # CMake 314s # hybrid_pure.dat # Setuptools 314s # hybrid_pure.py # Setuptools 314s # 314s # data/ 314s # hybrid_data_pure.dat # CMake or Setuptools 314s # hybrid_data_cmake.dat # CMake *NO TEST* 314s # 314s # hybrid_2/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure.py # CMake or Setuptools 314s # hybrid_2_cmake.py # CMake 314s # 314s # hybrid_2_pure/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure_1.py # CMake or Setuptools 314s # hybrid_2_pure_2.py # CMake or Setuptools 314s # 314s # pureModule.py # Setuptools 314s # 314s # pure/ 314s # __init__.py # Setuptools 314s # pure.py # Setuptools 314s # 314s # data/ 314s # pure.dat # Setuptools 314s 314s tmp_dir.join("setup.py").write( 314s textwrap.dedent( 314s """ 314s from skbuild import setup 314s #from setuptools import setup 314s setup( 314s name="test_hybrid_project", 314s version="1.2.3", 314s description=("an hybrid package mixing files installed by both " 314s "CMake and setuptools"), 314s author='The scikit-build team', 314s license="MIT", 314s cmake_source_dir='{cmake_source_dir}', 314s cmake_install_dir='{cmake_install_dir}', 314s # Arbitrary order of packages 314s packages=[ 314s {p_off} 'pure', 314s {h_off} 'hybrid.hybrid_2', 314s {h_off} 'hybrid', 314s {c_off} 'cmake', 314s {p_off} 'hybrid.hybrid_2_pure', 314s ], 314s py_modules=[ 314s {pm_off} '{package_base}pureModule', 314s {cm_off} '{package_base}cmakeModule', 314s ], 314s package_data={{ 314s {p_off} 'pure': ['data/pure.dat'], 314s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 314s }}, 314s # Arbitrary order of package_dir 314s package_dir = {{ 314s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 314s {p_off} 'pure': '{package_base}pure', 314s {h_off} 'hybrid': '{package_base}hybrid', 314s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 314s {c_off} 'cmake': '{package_base}cmake', 314s }} 314s ) 314s """.format( 314s cmake_source_dir=cmake_source_dir, 314s cmake_install_dir=package_base, 314s package_base=package_base_dir, 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s p_off="" if has_pure_package else "#", 314s pm_off="" if has_pure_module else "#", 314s ) 314s ) 314s ) 314s 314s src_dir = tmp_dir.ensure(package_base, dir=1) 314s 314s src_dir.join("CMakeLists.txt").write( 314s textwrap.dedent( 314s """ 314s cmake_minimum_required(VERSION 3.5.0) 314s project(hybrid NONE) 314s set(build_dir ${{CMAKE_BINARY_DIR}}) 314s 314s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 314s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 314s {c_off} install( 314s {c_off} FILES 314s {c_off} ${{build_dir}}/__init__.py 314s {c_off} ${{build_dir}}/cmake.py 314s {c_off} DESTINATION cmake 314s {c_off} ) 314s 314s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 314s {cm_off} install( 314s {cm_off} FILES ${{build_dir}}/cmakeModule.py 314s {cm_off} DESTINATION .) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 314s {h_off} DESTINATION hybrid/data) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 314s {h_off} DESTINATION hybrid/hybrid_2) 314s 314s install(CODE "message(STATUS \\\"Installation complete\\\")") 314s """.format( 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s ) 314s ) 314s ) 314s 314s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 314s path_types: Sequence[str] 314s try: 314s path_types = next( 314s iter( 314s zip( 314s *filter( 314s lambda i: i[1], 314s [ 314s ("c", has_cmake_package), 314s ("cm", has_cmake_module), 314s ("h", has_hybrid_package), 314s ("p", has_pure_package), 314s ("pm", has_pure_module), 314s ], 314s ) 314s ) 314s ) 314s ) 314s except StopIteration: 314s path_types = [] 314s 314s def select_paths(annotated_paths): 314s """Return a filtered list paths considering ``path_types``. 314s 314s `annotated_paths`` is list of tuple ``(type, path)`` where type 314s is either `c`, 'cm', `h`, `p` or 'pm'. 314s 314s """ 314s return filter(lambda i: i[0] in path_types, annotated_paths) 314s 314s # Commented paths are the one expected to be installed by CMake. For 314s # this reason, corresponding files should NOT be created in the source 314s # tree. 314s for _type, path in select_paths( 314s [ 314s # ('c', 'cmake/__init__.py'), 314s # ('c', 'cmake/cmake.py'), 314s # ('cm', 'cmakeModule.py'), 314s ("h", "hybrid/__init__.py"), 314s # ('h', 'hybrid/hybrid_cmake.dat'), 314s # ('h', 'hybrid/hybrid_cmake.py'), 314s ("h", "hybrid/hybrid_pure.dat"), 314s ("h", "hybrid/hybrid_pure.py"), 314s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 314s ("h", "hybrid/data/hybrid_data_pure.dat"), 314s ("h", "hybrid/hybrid_2/__init__.py"), 314s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 314s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 314s ("p", "hybrid/hybrid_2_pure/__init__.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 314s ("pm", "pureModule.py"), 314s ("p", "pure/__init__.py"), 314s ("p", "pure/pure.py"), 314s ("p", "pure/data/pure.dat"), 314s ] 314s ): 314s assert _type in {"p", "pm", "h"} 314s root = package_base if _type in {"p", "pm"} else cmake_source_dir 314s tmp_dir.ensure(os.path.join(root, path)) 314s 314s # Do not call the real setup function. Instead, replace it with 314s # a MagicMock allowing to check with which arguments it was invoked. 314s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 314s 314s # Convenience print function 314s def _pprint(desc, value=None): 314s print( 314s "-----------------\n" 314s f"{desc}:\n" 314s "\n" 314s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 314s ) 314s 314s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 314s 314s _pprint = ._pprint at 0xf33ce848> 314s _type = 'p' 314s cmake_source_dir = '' 314s has_cmake_module = 1 314s has_cmake_package = 0 314s has_hybrid_package = 0 314s has_pure_module = 0 314s has_pure_package = 1 314s mock_setup = 314s mocker = 314s package_base = '' 314s package_base_dir = '' 314s path = 'pure/data/pure.dat' 314s path_types = ('cm', 'p') 314s root = '' 314s select_paths = .select_paths at 0xf33cee38> 314s src_dir = local('/tmp/pytest-of-ubuntu/pytest-92/test_setup_inputs0') 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-92/test_setup_inputs0') 314s with_package_base = 0 314s 314s tests/test_setup.py:849: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-92/test_setup_inputs0') 314s setup_args = ['build'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-92/test_setup_inputs0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s ________________________ test_setup_inputs[0-0-1-0-1-1] ________________________ 314s 314s has_cmake_package = 1, has_cmake_module = 1, has_hybrid_package = 0 314s has_pure_package = 1, has_pure_module = 0, with_package_base = 0 314s mocker = 314s 314s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 314s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 314s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_module", [0, 1]) 314s @pytest.mark.parametrize("with_package_base", [0, 1]) 314s def test_setup_inputs( 314s has_cmake_package, 314s has_cmake_module, 314s has_hybrid_package, 314s has_pure_package, 314s has_pure_module, 314s with_package_base, 314s mocker, 314s ): 314s """This test that a project can have a package with some modules 314s installed using setup.py and some other modules installed using CMake. 314s """ 314s 314s tmp_dir = _tmpdir("test_setup_inputs") 314s 314s package_base = "to/the/base" if with_package_base else "" 314s package_base_dir = package_base + "/" if package_base else "" 314s cmake_source_dir = package_base 314s 314s if cmake_source_dir and (has_cmake_package or has_cmake_module): 314s pytest.skip( 314s "unsupported configuration: " 314s "python package fully generated by CMake does *NOT* work. " 314s "At least __init__.py should be in the project source tree" 314s ) 314s 314s # ------------------------------------------------------------------------- 314s # Here is the "SOURCE" tree layout: 314s # 314s # ROOT/ 314s # 314s # setup.py 314s # 314s # [/] 314s # 314s # pureModule.py 314s # 314s # pure/ 314s # __init__.py 314s # pure.py 314s # 314s # data/ 314s # pure.dat 314s # 314s # [/] 314s # 314s # hybrid/ 314s # CMakeLists.txt 314s # __init__.py 314s # hybrid_pure.dat 314s # hybrid_pure.py 314s # 314s # data/ 314s # hybrid_data_pure.dat 314s # 314s # hybrid_2/ 314s # __init__.py 314s # hybrid_2_pure.py 314s # 314s # hybrid_2_pure/ 314s # __init__.py 314s # hybrid_2_pure_1.py 314s # hybrid_2_pure_2.py 314s # 314s # 314s # ------------------------------------------------------------------------- 314s # and here is the "BINARY" distribution layout: 314s # 314s # The comment "CMake" or "Setuptools" indicates which tool is responsible 314s # for placing the file in the tree used to create the binary distribution. 314s # 314s # ROOT/ 314s # 314s # cmakeModule.py # CMake 314s # 314s # cmake/ 314s # __init__.py # CMake 314s # cmake.py # CMake 314s # 314s # hybrid/ 314s # hybrid_cmake.dat # CMake 314s # hybrid_cmake.py # CMake 314s # hybrid_pure.dat # Setuptools 314s # hybrid_pure.py # Setuptools 314s # 314s # data/ 314s # hybrid_data_pure.dat # CMake or Setuptools 314s # hybrid_data_cmake.dat # CMake *NO TEST* 314s # 314s # hybrid_2/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure.py # CMake or Setuptools 314s # hybrid_2_cmake.py # CMake 314s # 314s # hybrid_2_pure/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure_1.py # CMake or Setuptools 314s # hybrid_2_pure_2.py # CMake or Setuptools 314s # 314s # pureModule.py # Setuptools 314s # 314s # pure/ 314s # __init__.py # Setuptools 314s # pure.py # Setuptools 314s # 314s # data/ 314s # pure.dat # Setuptools 314s 314s tmp_dir.join("setup.py").write( 314s textwrap.dedent( 314s """ 314s from skbuild import setup 314s #from setuptools import setup 314s setup( 314s name="test_hybrid_project", 314s version="1.2.3", 314s description=("an hybrid package mixing files installed by both " 314s "CMake and setuptools"), 314s author='The scikit-build team', 314s license="MIT", 314s cmake_source_dir='{cmake_source_dir}', 314s cmake_install_dir='{cmake_install_dir}', 314s # Arbitrary order of packages 314s packages=[ 314s {p_off} 'pure', 314s {h_off} 'hybrid.hybrid_2', 314s {h_off} 'hybrid', 314s {c_off} 'cmake', 314s {p_off} 'hybrid.hybrid_2_pure', 314s ], 314s py_modules=[ 314s {pm_off} '{package_base}pureModule', 314s {cm_off} '{package_base}cmakeModule', 314s ], 314s package_data={{ 314s {p_off} 'pure': ['data/pure.dat'], 314s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 314s }}, 314s # Arbitrary order of package_dir 314s package_dir = {{ 314s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 314s {p_off} 'pure': '{package_base}pure', 314s {h_off} 'hybrid': '{package_base}hybrid', 314s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 314s {c_off} 'cmake': '{package_base}cmake', 314s }} 314s ) 314s """.format( 314s cmake_source_dir=cmake_source_dir, 314s cmake_install_dir=package_base, 314s package_base=package_base_dir, 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s p_off="" if has_pure_package else "#", 314s pm_off="" if has_pure_module else "#", 314s ) 314s ) 314s ) 314s 314s src_dir = tmp_dir.ensure(package_base, dir=1) 314s 314s src_dir.join("CMakeLists.txt").write( 314s textwrap.dedent( 314s """ 314s cmake_minimum_required(VERSION 3.5.0) 314s project(hybrid NONE) 314s set(build_dir ${{CMAKE_BINARY_DIR}}) 314s 314s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 314s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 314s {c_off} install( 314s {c_off} FILES 314s {c_off} ${{build_dir}}/__init__.py 314s {c_off} ${{build_dir}}/cmake.py 314s {c_off} DESTINATION cmake 314s {c_off} ) 314s 314s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 314s {cm_off} install( 314s {cm_off} FILES ${{build_dir}}/cmakeModule.py 314s {cm_off} DESTINATION .) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 314s {h_off} DESTINATION hybrid/data) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 314s {h_off} DESTINATION hybrid/hybrid_2) 314s 314s install(CODE "message(STATUS \\\"Installation complete\\\")") 314s """.format( 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s ) 314s ) 314s ) 314s 314s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 314s path_types: Sequence[str] 314s try: 314s path_types = next( 314s iter( 314s zip( 314s *filter( 314s lambda i: i[1], 314s [ 314s ("c", has_cmake_package), 314s ("cm", has_cmake_module), 314s ("h", has_hybrid_package), 314s ("p", has_pure_package), 314s ("pm", has_pure_module), 314s ], 314s ) 314s ) 314s ) 314s ) 314s except StopIteration: 314s path_types = [] 314s 314s def select_paths(annotated_paths): 314s """Return a filtered list paths considering ``path_types``. 314s 314s `annotated_paths`` is list of tuple ``(type, path)`` where type 314s is either `c`, 'cm', `h`, `p` or 'pm'. 314s 314s """ 314s return filter(lambda i: i[0] in path_types, annotated_paths) 314s 314s # Commented paths are the one expected to be installed by CMake. For 314s # this reason, corresponding files should NOT be created in the source 314s # tree. 314s for _type, path in select_paths( 314s [ 314s # ('c', 'cmake/__init__.py'), 314s # ('c', 'cmake/cmake.py'), 314s # ('cm', 'cmakeModule.py'), 314s ("h", "hybrid/__init__.py"), 314s # ('h', 'hybrid/hybrid_cmake.dat'), 314s # ('h', 'hybrid/hybrid_cmake.py'), 314s ("h", "hybrid/hybrid_pure.dat"), 314s ("h", "hybrid/hybrid_pure.py"), 314s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 314s ("h", "hybrid/data/hybrid_data_pure.dat"), 314s ("h", "hybrid/hybrid_2/__init__.py"), 314s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 314s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 314s ("p", "hybrid/hybrid_2_pure/__init__.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 314s ("pm", "pureModule.py"), 314s ("p", "pure/__init__.py"), 314s ("p", "pure/pure.py"), 314s ("p", "pure/data/pure.dat"), 314s ] 314s ): 314s assert _type in {"p", "pm", "h"} 314s root = package_base if _type in {"p", "pm"} else cmake_source_dir 314s tmp_dir.ensure(os.path.join(root, path)) 314s 314s # Do not call the real setup function. Instead, replace it with 314s # a MagicMock allowing to check with which arguments it was invoked. 314s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 314s 314s # Convenience print function 314s def _pprint(desc, value=None): 314s print( 314s "-----------------\n" 314s f"{desc}:\n" 314s "\n" 314s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 314s ) 314s 314s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 314s 314s _pprint = ._pprint at 0xf32c8c58> 314s _type = 'p' 314s cmake_source_dir = '' 314s has_cmake_module = 1 314s has_cmake_package = 1 314s has_hybrid_package = 0 314s has_pure_module = 0 314s has_pure_package = 1 314s mock_setup = 314s mocker = 314s package_base = '' 314s package_base_dir = '' 314s path = 'pure/data/pure.dat' 314s path_types = ('c', 'cm', 'p') 314s root = '' 314s select_paths = .select_paths at 0xf33ceb18> 314s src_dir = local('/tmp/pytest-of-ubuntu/pytest-93/test_setup_inputs0') 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-93/test_setup_inputs0') 314s with_package_base = 0 314s 314s tests/test_setup.py:849: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-93/test_setup_inputs0') 314s setup_args = ['build'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-93/test_setup_inputs0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s ________________________ test_setup_inputs[0-0-1-1-0-0] ________________________ 314s 314s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 1 314s has_pure_package = 1, has_pure_module = 0, with_package_base = 0 314s mocker = 314s 314s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 314s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 314s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_module", [0, 1]) 314s @pytest.mark.parametrize("with_package_base", [0, 1]) 314s def test_setup_inputs( 314s has_cmake_package, 314s has_cmake_module, 314s has_hybrid_package, 314s has_pure_package, 314s has_pure_module, 314s with_package_base, 314s mocker, 314s ): 314s """This test that a project can have a package with some modules 314s installed using setup.py and some other modules installed using CMake. 314s """ 314s 314s tmp_dir = _tmpdir("test_setup_inputs") 314s 314s package_base = "to/the/base" if with_package_base else "" 314s package_base_dir = package_base + "/" if package_base else "" 314s cmake_source_dir = package_base 314s 314s if cmake_source_dir and (has_cmake_package or has_cmake_module): 314s pytest.skip( 314s "unsupported configuration: " 314s "python package fully generated by CMake does *NOT* work. " 314s "At least __init__.py should be in the project source tree" 314s ) 314s 314s # ------------------------------------------------------------------------- 314s # Here is the "SOURCE" tree layout: 314s # 314s # ROOT/ 314s # 314s # setup.py 314s # 314s # [/] 314s # 314s # pureModule.py 314s # 314s # pure/ 314s # __init__.py 314s # pure.py 314s # 314s # data/ 314s # pure.dat 314s # 314s # [/] 314s # 314s # hybrid/ 314s # CMakeLists.txt 314s # __init__.py 314s # hybrid_pure.dat 314s # hybrid_pure.py 314s # 314s # data/ 314s # hybrid_data_pure.dat 314s # 314s # hybrid_2/ 314s # __init__.py 314s # hybrid_2_pure.py 314s # 314s # hybrid_2_pure/ 314s # __init__.py 314s # hybrid_2_pure_1.py 314s # hybrid_2_pure_2.py 314s # 314s # 314s # ------------------------------------------------------------------------- 314s # and here is the "BINARY" distribution layout: 314s # 314s # The comment "CMake" or "Setuptools" indicates which tool is responsible 314s # for placing the file in the tree used to create the binary distribution. 314s # 314s # ROOT/ 314s # 314s # cmakeModule.py # CMake 314s # 314s # cmake/ 314s # __init__.py # CMake 314s # cmake.py # CMake 314s # 314s # hybrid/ 314s # hybrid_cmake.dat # CMake 314s # hybrid_cmake.py # CMake 314s # hybrid_pure.dat # Setuptools 314s # hybrid_pure.py # Setuptools 314s # 314s # data/ 314s # hybrid_data_pure.dat # CMake or Setuptools 314s # hybrid_data_cmake.dat # CMake *NO TEST* 314s # 314s # hybrid_2/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure.py # CMake or Setuptools 314s # hybrid_2_cmake.py # CMake 314s # 314s # hybrid_2_pure/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure_1.py # CMake or Setuptools 314s # hybrid_2_pure_2.py # CMake or Setuptools 314s # 314s # pureModule.py # Setuptools 314s # 314s # pure/ 314s # __init__.py # Setuptools 314s # pure.py # Setuptools 314s # 314s # data/ 314s # pure.dat # Setuptools 314s 314s tmp_dir.join("setup.py").write( 314s textwrap.dedent( 314s """ 314s from skbuild import setup 314s #from setuptools import setup 314s setup( 314s name="test_hybrid_project", 314s version="1.2.3", 314s description=("an hybrid package mixing files installed by both " 314s "CMake and setuptools"), 314s author='The scikit-build team', 314s license="MIT", 314s cmake_source_dir='{cmake_source_dir}', 314s cmake_install_dir='{cmake_install_dir}', 314s # Arbitrary order of packages 314s packages=[ 314s {p_off} 'pure', 314s {h_off} 'hybrid.hybrid_2', 314s {h_off} 'hybrid', 314s {c_off} 'cmake', 314s {p_off} 'hybrid.hybrid_2_pure', 314s ], 314s py_modules=[ 314s {pm_off} '{package_base}pureModule', 314s {cm_off} '{package_base}cmakeModule', 314s ], 314s package_data={{ 314s {p_off} 'pure': ['data/pure.dat'], 314s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 314s }}, 314s # Arbitrary order of package_dir 314s package_dir = {{ 314s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 314s {p_off} 'pure': '{package_base}pure', 314s {h_off} 'hybrid': '{package_base}hybrid', 314s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 314s {c_off} 'cmake': '{package_base}cmake', 314s }} 314s ) 314s """.format( 314s cmake_source_dir=cmake_source_dir, 314s cmake_install_dir=package_base, 314s package_base=package_base_dir, 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s p_off="" if has_pure_package else "#", 314s pm_off="" if has_pure_module else "#", 314s ) 314s ) 314s ) 314s 314s src_dir = tmp_dir.ensure(package_base, dir=1) 314s 314s src_dir.join("CMakeLists.txt").write( 314s textwrap.dedent( 314s """ 314s cmake_minimum_required(VERSION 3.5.0) 314s project(hybrid NONE) 314s set(build_dir ${{CMAKE_BINARY_DIR}}) 314s 314s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 314s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 314s {c_off} install( 314s {c_off} FILES 314s {c_off} ${{build_dir}}/__init__.py 314s {c_off} ${{build_dir}}/cmake.py 314s {c_off} DESTINATION cmake 314s {c_off} ) 314s 314s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 314s {cm_off} install( 314s {cm_off} FILES ${{build_dir}}/cmakeModule.py 314s {cm_off} DESTINATION .) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 314s {h_off} DESTINATION hybrid/data) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 314s {h_off} DESTINATION hybrid/hybrid_2) 314s 314s install(CODE "message(STATUS \\\"Installation complete\\\")") 314s """.format( 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s ) 314s ) 314s ) 314s 314s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 314s path_types: Sequence[str] 314s try: 314s path_types = next( 314s iter( 314s zip( 314s *filter( 314s lambda i: i[1], 314s [ 314s ("c", has_cmake_package), 314s ("cm", has_cmake_module), 314s ("h", has_hybrid_package), 314s ("p", has_pure_package), 314s ("pm", has_pure_module), 314s ], 314s ) 314s ) 314s ) 314s ) 314s except StopIteration: 314s path_types = [] 314s 314s def select_paths(annotated_paths): 314s """Return a filtered list paths considering ``path_types``. 314s 314s `annotated_paths`` is list of tuple ``(type, path)`` where type 314s is either `c`, 'cm', `h`, `p` or 'pm'. 314s 314s """ 314s return filter(lambda i: i[0] in path_types, annotated_paths) 314s 314s # Commented paths are the one expected to be installed by CMake. For 314s # this reason, corresponding files should NOT be created in the source 314s # tree. 314s for _type, path in select_paths( 314s [ 314s # ('c', 'cmake/__init__.py'), 314s # ('c', 'cmake/cmake.py'), 314s # ('cm', 'cmakeModule.py'), 314s ("h", "hybrid/__init__.py"), 314s # ('h', 'hybrid/hybrid_cmake.dat'), 314s # ('h', 'hybrid/hybrid_cmake.py'), 314s ("h", "hybrid/hybrid_pure.dat"), 314s ("h", "hybrid/hybrid_pure.py"), 314s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 314s ("h", "hybrid/data/hybrid_data_pure.dat"), 314s ("h", "hybrid/hybrid_2/__init__.py"), 314s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 314s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 314s ("p", "hybrid/hybrid_2_pure/__init__.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 314s ("pm", "pureModule.py"), 314s ("p", "pure/__init__.py"), 314s ("p", "pure/pure.py"), 314s ("p", "pure/data/pure.dat"), 314s ] 314s ): 314s assert _type in {"p", "pm", "h"} 314s root = package_base if _type in {"p", "pm"} else cmake_source_dir 314s tmp_dir.ensure(os.path.join(root, path)) 314s 314s # Do not call the real setup function. Instead, replace it with 314s # a MagicMock allowing to check with which arguments it was invoked. 314s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 314s 314s # Convenience print function 314s def _pprint(desc, value=None): 314s print( 314s "-----------------\n" 314s f"{desc}:\n" 314s "\n" 314s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 314s ) 314s 314s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 314s 314s _pprint = ._pprint at 0xf32bcf78> 314s _type = 'p' 314s cmake_source_dir = '' 314s has_cmake_module = 0 314s has_cmake_package = 0 314s has_hybrid_package = 1 314s has_pure_module = 0 314s has_pure_package = 1 314s mock_setup = 314s mocker = 314s package_base = '' 314s package_base_dir = '' 314s path = 'pure/data/pure.dat' 314s path_types = ('h', 'p') 314s root = '' 314s select_paths = .select_paths at 0xf33ced98> 314s src_dir = local('/tmp/pytest-of-ubuntu/pytest-94/test_setup_inputs0') 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-94/test_setup_inputs0') 314s with_package_base = 0 314s 314s tests/test_setup.py:849: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-94/test_setup_inputs0') 314s setup_args = ['build'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-94/test_setup_inputs0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s ________________________ test_setup_inputs[0-0-1-1-0-1] ________________________ 314s 314s has_cmake_package = 1, has_cmake_module = 0, has_hybrid_package = 1 314s has_pure_package = 1, has_pure_module = 0, with_package_base = 0 314s mocker = 314s 314s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 314s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 314s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_module", [0, 1]) 314s @pytest.mark.parametrize("with_package_base", [0, 1]) 314s def test_setup_inputs( 314s has_cmake_package, 314s has_cmake_module, 314s has_hybrid_package, 314s has_pure_package, 314s has_pure_module, 314s with_package_base, 314s mocker, 314s ): 314s """This test that a project can have a package with some modules 314s installed using setup.py and some other modules installed using CMake. 314s """ 314s 314s tmp_dir = _tmpdir("test_setup_inputs") 314s 314s package_base = "to/the/base" if with_package_base else "" 314s package_base_dir = package_base + "/" if package_base else "" 314s cmake_source_dir = package_base 314s 314s if cmake_source_dir and (has_cmake_package or has_cmake_module): 314s pytest.skip( 314s "unsupported configuration: " 314s "python package fully generated by CMake does *NOT* work. " 314s "At least __init__.py should be in the project source tree" 314s ) 314s 314s # ------------------------------------------------------------------------- 314s # Here is the "SOURCE" tree layout: 314s # 314s # ROOT/ 314s # 314s # setup.py 314s # 314s # [/] 314s # 314s # pureModule.py 314s # 314s # pure/ 314s # __init__.py 314s # pure.py 314s # 314s # data/ 314s # pure.dat 314s # 314s # [/] 314s # 314s # hybrid/ 314s # CMakeLists.txt 314s # __init__.py 314s # hybrid_pure.dat 314s # hybrid_pure.py 314s # 314s # data/ 314s # hybrid_data_pure.dat 314s # 314s # hybrid_2/ 314s # __init__.py 314s # hybrid_2_pure.py 314s # 314s # hybrid_2_pure/ 314s # __init__.py 314s # hybrid_2_pure_1.py 314s # hybrid_2_pure_2.py 314s # 314s # 314s # ------------------------------------------------------------------------- 314s # and here is the "BINARY" distribution layout: 314s # 314s # The comment "CMake" or "Setuptools" indicates which tool is responsible 314s # for placing the file in the tree used to create the binary distribution. 314s # 314s # ROOT/ 314s # 314s # cmakeModule.py # CMake 314s # 314s # cmake/ 314s # __init__.py # CMake 314s # cmake.py # CMake 314s # 314s # hybrid/ 314s # hybrid_cmake.dat # CMake 314s # hybrid_cmake.py # CMake 314s # hybrid_pure.dat # Setuptools 314s # hybrid_pure.py # Setuptools 314s # 314s # data/ 314s # hybrid_data_pure.dat # CMake or Setuptools 314s # hybrid_data_cmake.dat # CMake *NO TEST* 314s # 314s # hybrid_2/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure.py # CMake or Setuptools 314s # hybrid_2_cmake.py # CMake 314s # 314s # hybrid_2_pure/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure_1.py # CMake or Setuptools 314s # hybrid_2_pure_2.py # CMake or Setuptools 314s # 314s # pureModule.py # Setuptools 314s # 314s # pure/ 314s # __init__.py # Setuptools 314s # pure.py # Setuptools 314s # 314s # data/ 314s # pure.dat # Setuptools 314s 314s tmp_dir.join("setup.py").write( 314s textwrap.dedent( 314s """ 314s from skbuild import setup 314s #from setuptools import setup 314s setup( 314s name="test_hybrid_project", 314s version="1.2.3", 314s description=("an hybrid package mixing files installed by both " 314s "CMake and setuptools"), 314s author='The scikit-build team', 314s license="MIT", 314s cmake_source_dir='{cmake_source_dir}', 314s cmake_install_dir='{cmake_install_dir}', 314s # Arbitrary order of packages 314s packages=[ 314s {p_off} 'pure', 314s {h_off} 'hybrid.hybrid_2', 314s {h_off} 'hybrid', 314s {c_off} 'cmake', 314s {p_off} 'hybrid.hybrid_2_pure', 314s ], 314s py_modules=[ 314s {pm_off} '{package_base}pureModule', 314s {cm_off} '{package_base}cmakeModule', 314s ], 314s package_data={{ 314s {p_off} 'pure': ['data/pure.dat'], 314s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 314s }}, 314s # Arbitrary order of package_dir 314s package_dir = {{ 314s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 314s {p_off} 'pure': '{package_base}pure', 314s {h_off} 'hybrid': '{package_base}hybrid', 314s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 314s {c_off} 'cmake': '{package_base}cmake', 314s }} 314s ) 314s """.format( 314s cmake_source_dir=cmake_source_dir, 314s cmake_install_dir=package_base, 314s package_base=package_base_dir, 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s p_off="" if has_pure_package else "#", 314s pm_off="" if has_pure_module else "#", 314s ) 314s ) 314s ) 314s 314s src_dir = tmp_dir.ensure(package_base, dir=1) 314s 314s src_dir.join("CMakeLists.txt").write( 314s textwrap.dedent( 314s """ 314s cmake_minimum_required(VERSION 3.5.0) 314s project(hybrid NONE) 314s set(build_dir ${{CMAKE_BINARY_DIR}}) 314s 314s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 314s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 314s {c_off} install( 314s {c_off} FILES 314s {c_off} ${{build_dir}}/__init__.py 314s {c_off} ${{build_dir}}/cmake.py 314s {c_off} DESTINATION cmake 314s {c_off} ) 314s 314s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 314s {cm_off} install( 314s {cm_off} FILES ${{build_dir}}/cmakeModule.py 314s {cm_off} DESTINATION .) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 314s {h_off} DESTINATION hybrid/data) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 314s {h_off} DESTINATION hybrid/hybrid_2) 314s 314s install(CODE "message(STATUS \\\"Installation complete\\\")") 314s """.format( 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s ) 314s ) 314s ) 314s 314s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 314s path_types: Sequence[str] 314s try: 314s path_types = next( 314s iter( 314s zip( 314s *filter( 314s lambda i: i[1], 314s [ 314s ("c", has_cmake_package), 314s ("cm", has_cmake_module), 314s ("h", has_hybrid_package), 314s ("p", has_pure_package), 314s ("pm", has_pure_module), 314s ], 314s ) 314s ) 314s ) 314s ) 314s except StopIteration: 314s path_types = [] 314s 314s def select_paths(annotated_paths): 314s """Return a filtered list paths considering ``path_types``. 314s 314s `annotated_paths`` is list of tuple ``(type, path)`` where type 314s is either `c`, 'cm', `h`, `p` or 'pm'. 314s 314s """ 314s return filter(lambda i: i[0] in path_types, annotated_paths) 314s 314s # Commented paths are the one expected to be installed by CMake. For 314s # this reason, corresponding files should NOT be created in the source 314s # tree. 314s for _type, path in select_paths( 314s [ 314s # ('c', 'cmake/__init__.py'), 314s # ('c', 'cmake/cmake.py'), 314s # ('cm', 'cmakeModule.py'), 314s ("h", "hybrid/__init__.py"), 314s # ('h', 'hybrid/hybrid_cmake.dat'), 314s # ('h', 'hybrid/hybrid_cmake.py'), 314s ("h", "hybrid/hybrid_pure.dat"), 314s ("h", "hybrid/hybrid_pure.py"), 314s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 314s ("h", "hybrid/data/hybrid_data_pure.dat"), 314s ("h", "hybrid/hybrid_2/__init__.py"), 314s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 314s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 314s ("p", "hybrid/hybrid_2_pure/__init__.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 314s ("pm", "pureModule.py"), 314s ("p", "pure/__init__.py"), 314s ("p", "pure/pure.py"), 314s ("p", "pure/data/pure.dat"), 314s ] 314s ): 314s assert _type in {"p", "pm", "h"} 314s root = package_base if _type in {"p", "pm"} else cmake_source_dir 314s tmp_dir.ensure(os.path.join(root, path)) 314s 314s # Do not call the real setup function. Instead, replace it with 314s # a MagicMock allowing to check with which arguments it was invoked. 314s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 314s 314s # Convenience print function 314s def _pprint(desc, value=None): 314s print( 314s "-----------------\n" 314s f"{desc}:\n" 314s "\n" 314s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 314s ) 314s 314s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 314s 314s _pprint = ._pprint at 0xf32b2708> 314s _type = 'p' 314s cmake_source_dir = '' 314s has_cmake_module = 0 314s has_cmake_package = 1 314s has_hybrid_package = 1 314s has_pure_module = 0 314s has_pure_package = 1 314s mock_setup = 314s mocker = 314s package_base = '' 314s package_base_dir = '' 314s path = 'pure/data/pure.dat' 314s path_types = ('c', 'h', 'p') 314s root = '' 314s select_paths = .select_paths at 0xf32bcd98> 314s src_dir = local('/tmp/pytest-of-ubuntu/pytest-95/test_setup_inputs0') 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-95/test_setup_inputs0') 314s with_package_base = 0 314s 314s tests/test_setup.py:849: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-95/test_setup_inputs0') 314s setup_args = ['build'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-95/test_setup_inputs0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s ________________________ test_setup_inputs[0-0-1-1-1-0] ________________________ 314s 314s has_cmake_package = 0, has_cmake_module = 1, has_hybrid_package = 1 314s has_pure_package = 1, has_pure_module = 0, with_package_base = 0 314s mocker = 314s 314s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 314s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 314s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_module", [0, 1]) 314s @pytest.mark.parametrize("with_package_base", [0, 1]) 314s def test_setup_inputs( 314s has_cmake_package, 314s has_cmake_module, 314s has_hybrid_package, 314s has_pure_package, 314s has_pure_module, 314s with_package_base, 314s mocker, 314s ): 314s """This test that a project can have a package with some modules 314s installed using setup.py and some other modules installed using CMake. 314s """ 314s 314s tmp_dir = _tmpdir("test_setup_inputs") 314s 314s package_base = "to/the/base" if with_package_base else "" 314s package_base_dir = package_base + "/" if package_base else "" 314s cmake_source_dir = package_base 314s 314s if cmake_source_dir and (has_cmake_package or has_cmake_module): 314s pytest.skip( 314s "unsupported configuration: " 314s "python package fully generated by CMake does *NOT* work. " 314s "At least __init__.py should be in the project source tree" 314s ) 314s 314s # ------------------------------------------------------------------------- 314s # Here is the "SOURCE" tree layout: 314s # 314s # ROOT/ 314s # 314s # setup.py 314s # 314s # [/] 314s # 314s # pureModule.py 314s # 314s # pure/ 314s # __init__.py 314s # pure.py 314s # 314s # data/ 314s # pure.dat 314s # 314s # [/] 314s # 314s # hybrid/ 314s # CMakeLists.txt 314s # __init__.py 314s # hybrid_pure.dat 314s # hybrid_pure.py 314s # 314s # data/ 314s # hybrid_data_pure.dat 314s # 314s # hybrid_2/ 314s # __init__.py 314s # hybrid_2_pure.py 314s # 314s # hybrid_2_pure/ 314s # __init__.py 314s # hybrid_2_pure_1.py 314s # hybrid_2_pure_2.py 314s # 314s # 314s # ------------------------------------------------------------------------- 314s # and here is the "BINARY" distribution layout: 314s # 314s # The comment "CMake" or "Setuptools" indicates which tool is responsible 314s # for placing the file in the tree used to create the binary distribution. 314s # 314s # ROOT/ 314s # 314s # cmakeModule.py # CMake 314s # 314s # cmake/ 314s # __init__.py # CMake 314s # cmake.py # CMake 314s # 314s # hybrid/ 314s # hybrid_cmake.dat # CMake 314s # hybrid_cmake.py # CMake 314s # hybrid_pure.dat # Setuptools 314s # hybrid_pure.py # Setuptools 314s # 314s # data/ 314s # hybrid_data_pure.dat # CMake or Setuptools 314s # hybrid_data_cmake.dat # CMake *NO TEST* 314s # 314s # hybrid_2/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure.py # CMake or Setuptools 314s # hybrid_2_cmake.py # CMake 314s # 314s # hybrid_2_pure/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure_1.py # CMake or Setuptools 314s # hybrid_2_pure_2.py # CMake or Setuptools 314s # 314s # pureModule.py # Setuptools 314s # 314s # pure/ 314s # __init__.py # Setuptools 314s # pure.py # Setuptools 314s # 314s # data/ 314s # pure.dat # Setuptools 314s 314s tmp_dir.join("setup.py").write( 314s textwrap.dedent( 314s """ 314s from skbuild import setup 314s #from setuptools import setup 314s setup( 314s name="test_hybrid_project", 314s version="1.2.3", 314s description=("an hybrid package mixing files installed by both " 314s "CMake and setuptools"), 314s author='The scikit-build team', 314s license="MIT", 314s cmake_source_dir='{cmake_source_dir}', 314s cmake_install_dir='{cmake_install_dir}', 314s # Arbitrary order of packages 314s packages=[ 314s {p_off} 'pure', 314s {h_off} 'hybrid.hybrid_2', 314s {h_off} 'hybrid', 314s {c_off} 'cmake', 314s {p_off} 'hybrid.hybrid_2_pure', 314s ], 314s py_modules=[ 314s {pm_off} '{package_base}pureModule', 314s {cm_off} '{package_base}cmakeModule', 314s ], 314s package_data={{ 314s {p_off} 'pure': ['data/pure.dat'], 314s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 314s }}, 314s # Arbitrary order of package_dir 314s package_dir = {{ 314s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 314s {p_off} 'pure': '{package_base}pure', 314s {h_off} 'hybrid': '{package_base}hybrid', 314s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 314s {c_off} 'cmake': '{package_base}cmake', 314s }} 314s ) 314s """.format( 314s cmake_source_dir=cmake_source_dir, 314s cmake_install_dir=package_base, 314s package_base=package_base_dir, 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s p_off="" if has_pure_package else "#", 314s pm_off="" if has_pure_module else "#", 314s ) 314s ) 314s ) 314s 314s src_dir = tmp_dir.ensure(package_base, dir=1) 314s 314s src_dir.join("CMakeLists.txt").write( 314s textwrap.dedent( 314s """ 314s cmake_minimum_required(VERSION 3.5.0) 314s project(hybrid NONE) 314s set(build_dir ${{CMAKE_BINARY_DIR}}) 314s 314s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 314s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 314s {c_off} install( 314s {c_off} FILES 314s {c_off} ${{build_dir}}/__init__.py 314s {c_off} ${{build_dir}}/cmake.py 314s {c_off} DESTINATION cmake 314s {c_off} ) 314s 314s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 314s {cm_off} install( 314s {cm_off} FILES ${{build_dir}}/cmakeModule.py 314s {cm_off} DESTINATION .) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 314s {h_off} DESTINATION hybrid/data) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 314s {h_off} DESTINATION hybrid/hybrid_2) 314s 314s install(CODE "message(STATUS \\\"Installation complete\\\")") 314s """.format( 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s ) 314s ) 314s ) 314s 314s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 314s path_types: Sequence[str] 314s try: 314s path_types = next( 314s iter( 314s zip( 314s *filter( 314s lambda i: i[1], 314s [ 314s ("c", has_cmake_package), 314s ("cm", has_cmake_module), 314s ("h", has_hybrid_package), 314s ("p", has_pure_package), 314s ("pm", has_pure_module), 314s ], 314s ) 314s ) 314s ) 314s ) 314s except StopIteration: 314s path_types = [] 314s 314s def select_paths(annotated_paths): 314s """Return a filtered list paths considering ``path_types``. 314s 314s `annotated_paths`` is list of tuple ``(type, path)`` where type 314s is either `c`, 'cm', `h`, `p` or 'pm'. 314s 314s """ 314s return filter(lambda i: i[0] in path_types, annotated_paths) 314s 314s # Commented paths are the one expected to be installed by CMake. For 314s # this reason, corresponding files should NOT be created in the source 314s # tree. 314s for _type, path in select_paths( 314s [ 314s # ('c', 'cmake/__init__.py'), 314s # ('c', 'cmake/cmake.py'), 314s # ('cm', 'cmakeModule.py'), 314s ("h", "hybrid/__init__.py"), 314s # ('h', 'hybrid/hybrid_cmake.dat'), 314s # ('h', 'hybrid/hybrid_cmake.py'), 314s ("h", "hybrid/hybrid_pure.dat"), 314s ("h", "hybrid/hybrid_pure.py"), 314s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 314s ("h", "hybrid/data/hybrid_data_pure.dat"), 314s ("h", "hybrid/hybrid_2/__init__.py"), 314s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 314s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 314s ("p", "hybrid/hybrid_2_pure/__init__.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 314s ("pm", "pureModule.py"), 314s ("p", "pure/__init__.py"), 314s ("p", "pure/pure.py"), 314s ("p", "pure/data/pure.dat"), 314s ] 314s ): 314s assert _type in {"p", "pm", "h"} 314s root = package_base if _type in {"p", "pm"} else cmake_source_dir 314s tmp_dir.ensure(os.path.join(root, path)) 314s 314s # Do not call the real setup function. Instead, replace it with 314s # a MagicMock allowing to check with which arguments it was invoked. 314s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 314s 314s # Convenience print function 314s def _pprint(desc, value=None): 314s print( 314s "-----------------\n" 314s f"{desc}:\n" 314s "\n" 314s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 314s ) 314s 314s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 314s 314s _pprint = ._pprint at 0xf32b2a78> 314s _type = 'p' 314s cmake_source_dir = '' 314s has_cmake_module = 1 314s has_cmake_package = 0 314s has_hybrid_package = 1 314s has_pure_module = 0 314s has_pure_package = 1 314s mock_setup = 314s mocker = 314s package_base = '' 314s package_base_dir = '' 314s path = 'pure/data/pure.dat' 314s path_types = ('cm', 'h', 'p') 314s root = '' 314s select_paths = .select_paths at 0xf33b9e88> 314s src_dir = local('/tmp/pytest-of-ubuntu/pytest-96/test_setup_inputs0') 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-96/test_setup_inputs0') 314s with_package_base = 0 314s 314s tests/test_setup.py:849: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-96/test_setup_inputs0') 314s setup_args = ['build'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-96/test_setup_inputs0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s ________________________ test_setup_inputs[0-0-1-1-1-1] ________________________ 314s 314s has_cmake_package = 1, has_cmake_module = 1, has_hybrid_package = 1 314s has_pure_package = 1, has_pure_module = 0, with_package_base = 0 314s mocker = 314s 314s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 314s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 314s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_module", [0, 1]) 314s @pytest.mark.parametrize("with_package_base", [0, 1]) 314s def test_setup_inputs( 314s has_cmake_package, 314s has_cmake_module, 314s has_hybrid_package, 314s has_pure_package, 314s has_pure_module, 314s with_package_base, 314s mocker, 314s ): 314s """This test that a project can have a package with some modules 314s installed using setup.py and some other modules installed using CMake. 314s """ 314s 314s tmp_dir = _tmpdir("test_setup_inputs") 314s 314s package_base = "to/the/base" if with_package_base else "" 314s package_base_dir = package_base + "/" if package_base else "" 314s cmake_source_dir = package_base 314s 314s if cmake_source_dir and (has_cmake_package or has_cmake_module): 314s pytest.skip( 314s "unsupported configuration: " 314s "python package fully generated by CMake does *NOT* work. " 314s "At least __init__.py should be in the project source tree" 314s ) 314s 314s # ------------------------------------------------------------------------- 314s # Here is the "SOURCE" tree layout: 314s # 314s # ROOT/ 314s # 314s # setup.py 314s # 314s # [/] 314s # 314s # pureModule.py 314s # 314s # pure/ 314s # __init__.py 314s # pure.py 314s # 314s # data/ 314s # pure.dat 314s # 314s # [/] 314s # 314s # hybrid/ 314s # CMakeLists.txt 314s # __init__.py 314s # hybrid_pure.dat 314s # hybrid_pure.py 314s # 314s # data/ 314s # hybrid_data_pure.dat 314s # 314s # hybrid_2/ 314s # __init__.py 314s # hybrid_2_pure.py 314s # 314s # hybrid_2_pure/ 314s # __init__.py 314s # hybrid_2_pure_1.py 314s # hybrid_2_pure_2.py 314s # 314s # 314s # ------------------------------------------------------------------------- 314s # and here is the "BINARY" distribution layout: 314s # 314s # The comment "CMake" or "Setuptools" indicates which tool is responsible 314s # for placing the file in the tree used to create the binary distribution. 314s # 314s # ROOT/ 314s # 314s # cmakeModule.py # CMake 314s # 314s # cmake/ 314s # __init__.py # CMake 314s # cmake.py # CMake 314s # 314s # hybrid/ 314s # hybrid_cmake.dat # CMake 314s # hybrid_cmake.py # CMake 314s # hybrid_pure.dat # Setuptools 314s # hybrid_pure.py # Setuptools 314s # 314s # data/ 314s # hybrid_data_pure.dat # CMake or Setuptools 314s # hybrid_data_cmake.dat # CMake *NO TEST* 314s # 314s # hybrid_2/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure.py # CMake or Setuptools 314s # hybrid_2_cmake.py # CMake 314s # 314s # hybrid_2_pure/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure_1.py # CMake or Setuptools 314s # hybrid_2_pure_2.py # CMake or Setuptools 314s # 314s # pureModule.py # Setuptools 314s # 314s # pure/ 314s # __init__.py # Setuptools 314s # pure.py # Setuptools 314s # 314s # data/ 314s # pure.dat # Setuptools 314s 314s tmp_dir.join("setup.py").write( 314s textwrap.dedent( 314s """ 314s from skbuild import setup 314s #from setuptools import setup 314s setup( 314s name="test_hybrid_project", 314s version="1.2.3", 314s description=("an hybrid package mixing files installed by both " 314s "CMake and setuptools"), 314s author='The scikit-build team', 314s license="MIT", 314s cmake_source_dir='{cmake_source_dir}', 314s cmake_install_dir='{cmake_install_dir}', 314s # Arbitrary order of packages 314s packages=[ 314s {p_off} 'pure', 314s {h_off} 'hybrid.hybrid_2', 314s {h_off} 'hybrid', 314s {c_off} 'cmake', 314s {p_off} 'hybrid.hybrid_2_pure', 314s ], 314s py_modules=[ 314s {pm_off} '{package_base}pureModule', 314s {cm_off} '{package_base}cmakeModule', 314s ], 314s package_data={{ 314s {p_off} 'pure': ['data/pure.dat'], 314s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 314s }}, 314s # Arbitrary order of package_dir 314s package_dir = {{ 314s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 314s {p_off} 'pure': '{package_base}pure', 314s {h_off} 'hybrid': '{package_base}hybrid', 314s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 314s {c_off} 'cmake': '{package_base}cmake', 314s }} 314s ) 314s """.format( 314s cmake_source_dir=cmake_source_dir, 314s cmake_install_dir=package_base, 314s package_base=package_base_dir, 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s p_off="" if has_pure_package else "#", 314s pm_off="" if has_pure_module else "#", 314s ) 314s ) 314s ) 314s 314s src_dir = tmp_dir.ensure(package_base, dir=1) 314s 314s src_dir.join("CMakeLists.txt").write( 314s textwrap.dedent( 314s """ 314s cmake_minimum_required(VERSION 3.5.0) 314s project(hybrid NONE) 314s set(build_dir ${{CMAKE_BINARY_DIR}}) 314s 314s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 314s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 314s {c_off} install( 314s {c_off} FILES 314s {c_off} ${{build_dir}}/__init__.py 314s {c_off} ${{build_dir}}/cmake.py 314s {c_off} DESTINATION cmake 314s {c_off} ) 314s 314s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 314s {cm_off} install( 314s {cm_off} FILES ${{build_dir}}/cmakeModule.py 314s {cm_off} DESTINATION .) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 314s {h_off} DESTINATION hybrid/data) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 314s {h_off} DESTINATION hybrid/hybrid_2) 314s 314s install(CODE "message(STATUS \\\"Installation complete\\\")") 314s """.format( 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s ) 314s ) 314s ) 314s 314s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 314s path_types: Sequence[str] 314s try: 314s path_types = next( 314s iter( 314s zip( 314s *filter( 314s lambda i: i[1], 314s [ 314s ("c", has_cmake_package), 314s ("cm", has_cmake_module), 314s ("h", has_hybrid_package), 314s ("p", has_pure_package), 314s ("pm", has_pure_module), 314s ], 314s ) 314s ) 314s ) 314s ) 314s except StopIteration: 314s path_types = [] 314s 314s def select_paths(annotated_paths): 314s """Return a filtered list paths considering ``path_types``. 314s 314s `annotated_paths`` is list of tuple ``(type, path)`` where type 314s is either `c`, 'cm', `h`, `p` or 'pm'. 314s 314s """ 314s return filter(lambda i: i[0] in path_types, annotated_paths) 314s 314s # Commented paths are the one expected to be installed by CMake. For 314s # this reason, corresponding files should NOT be created in the source 314s # tree. 314s for _type, path in select_paths( 314s [ 314s # ('c', 'cmake/__init__.py'), 314s # ('c', 'cmake/cmake.py'), 314s # ('cm', 'cmakeModule.py'), 314s ("h", "hybrid/__init__.py"), 314s # ('h', 'hybrid/hybrid_cmake.dat'), 314s # ('h', 'hybrid/hybrid_cmake.py'), 314s ("h", "hybrid/hybrid_pure.dat"), 314s ("h", "hybrid/hybrid_pure.py"), 314s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 314s ("h", "hybrid/data/hybrid_data_pure.dat"), 314s ("h", "hybrid/hybrid_2/__init__.py"), 314s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 314s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 314s ("p", "hybrid/hybrid_2_pure/__init__.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 314s ("pm", "pureModule.py"), 314s ("p", "pure/__init__.py"), 314s ("p", "pure/pure.py"), 314s ("p", "pure/data/pure.dat"), 314s ] 314s ): 314s assert _type in {"p", "pm", "h"} 314s root = package_base if _type in {"p", "pm"} else cmake_source_dir 314s tmp_dir.ensure(os.path.join(root, path)) 314s 314s # Do not call the real setup function. Instead, replace it with 314s # a MagicMock allowing to check with which arguments it was invoked. 314s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 314s 314s # Convenience print function 314s def _pprint(desc, value=None): 314s print( 314s "-----------------\n" 314s f"{desc}:\n" 314s "\n" 314s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 314s ) 314s 314s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 314s 314s _pprint = ._pprint at 0xf32b0708> 314s _type = 'p' 314s cmake_source_dir = '' 314s has_cmake_module = 1 314s has_cmake_package = 1 314s has_hybrid_package = 1 314s has_pure_module = 0 314s has_pure_package = 1 314s mock_setup = 314s mocker = 314s package_base = '' 314s package_base_dir = '' 314s path = 'pure/data/pure.dat' 314s path_types = ('c', 'cm', 'h', 'p') 314s root = '' 314s select_paths = .select_paths at 0xf32b09d8> 314s src_dir = local('/tmp/pytest-of-ubuntu/pytest-97/test_setup_inputs0') 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-97/test_setup_inputs0') 314s with_package_base = 0 314s 314s tests/test_setup.py:849: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-97/test_setup_inputs0') 314s setup_args = ['build'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-97/test_setup_inputs0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s ________________________ test_setup_inputs[0-1-0-0-0-0] ________________________ 314s 314s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 0 314s has_pure_package = 0, has_pure_module = 1, with_package_base = 0 314s mocker = 314s 314s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 314s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 314s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_module", [0, 1]) 314s @pytest.mark.parametrize("with_package_base", [0, 1]) 314s def test_setup_inputs( 314s has_cmake_package, 314s has_cmake_module, 314s has_hybrid_package, 314s has_pure_package, 314s has_pure_module, 314s with_package_base, 314s mocker, 314s ): 314s """This test that a project can have a package with some modules 314s installed using setup.py and some other modules installed using CMake. 314s """ 314s 314s tmp_dir = _tmpdir("test_setup_inputs") 314s 314s package_base = "to/the/base" if with_package_base else "" 314s package_base_dir = package_base + "/" if package_base else "" 314s cmake_source_dir = package_base 314s 314s if cmake_source_dir and (has_cmake_package or has_cmake_module): 314s pytest.skip( 314s "unsupported configuration: " 314s "python package fully generated by CMake does *NOT* work. " 314s "At least __init__.py should be in the project source tree" 314s ) 314s 314s # ------------------------------------------------------------------------- 314s # Here is the "SOURCE" tree layout: 314s # 314s # ROOT/ 314s # 314s # setup.py 314s # 314s # [/] 314s # 314s # pureModule.py 314s # 314s # pure/ 314s # __init__.py 314s # pure.py 314s # 314s # data/ 314s # pure.dat 314s # 314s # [/] 314s # 314s # hybrid/ 314s # CMakeLists.txt 314s # __init__.py 314s # hybrid_pure.dat 314s # hybrid_pure.py 314s # 314s # data/ 314s # hybrid_data_pure.dat 314s # 314s # hybrid_2/ 314s # __init__.py 314s # hybrid_2_pure.py 314s # 314s # hybrid_2_pure/ 314s # __init__.py 314s # hybrid_2_pure_1.py 314s # hybrid_2_pure_2.py 314s # 314s # 314s # ------------------------------------------------------------------------- 314s # and here is the "BINARY" distribution layout: 314s # 314s # The comment "CMake" or "Setuptools" indicates which tool is responsible 314s # for placing the file in the tree used to create the binary distribution. 314s # 314s # ROOT/ 314s # 314s # cmakeModule.py # CMake 314s # 314s # cmake/ 314s # __init__.py # CMake 314s # cmake.py # CMake 314s # 314s # hybrid/ 314s # hybrid_cmake.dat # CMake 314s # hybrid_cmake.py # CMake 314s # hybrid_pure.dat # Setuptools 314s # hybrid_pure.py # Setuptools 314s # 314s # data/ 314s # hybrid_data_pure.dat # CMake or Setuptools 314s # hybrid_data_cmake.dat # CMake *NO TEST* 314s # 314s # hybrid_2/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure.py # CMake or Setuptools 314s # hybrid_2_cmake.py # CMake 314s # 314s # hybrid_2_pure/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure_1.py # CMake or Setuptools 314s # hybrid_2_pure_2.py # CMake or Setuptools 314s # 314s # pureModule.py # Setuptools 314s # 314s # pure/ 314s # __init__.py # Setuptools 314s # pure.py # Setuptools 314s # 314s # data/ 314s # pure.dat # Setuptools 314s 314s tmp_dir.join("setup.py").write( 314s textwrap.dedent( 314s """ 314s from skbuild import setup 314s #from setuptools import setup 314s setup( 314s name="test_hybrid_project", 314s version="1.2.3", 314s description=("an hybrid package mixing files installed by both " 314s "CMake and setuptools"), 314s author='The scikit-build team', 314s license="MIT", 314s cmake_source_dir='{cmake_source_dir}', 314s cmake_install_dir='{cmake_install_dir}', 314s # Arbitrary order of packages 314s packages=[ 314s {p_off} 'pure', 314s {h_off} 'hybrid.hybrid_2', 314s {h_off} 'hybrid', 314s {c_off} 'cmake', 314s {p_off} 'hybrid.hybrid_2_pure', 314s ], 314s py_modules=[ 314s {pm_off} '{package_base}pureModule', 314s {cm_off} '{package_base}cmakeModule', 314s ], 314s package_data={{ 314s {p_off} 'pure': ['data/pure.dat'], 314s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 314s }}, 314s # Arbitrary order of package_dir 314s package_dir = {{ 314s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 314s {p_off} 'pure': '{package_base}pure', 314s {h_off} 'hybrid': '{package_base}hybrid', 314s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 314s {c_off} 'cmake': '{package_base}cmake', 314s }} 314s ) 314s """.format( 314s cmake_source_dir=cmake_source_dir, 314s cmake_install_dir=package_base, 314s package_base=package_base_dir, 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s p_off="" if has_pure_package else "#", 314s pm_off="" if has_pure_module else "#", 314s ) 314s ) 314s ) 314s 314s src_dir = tmp_dir.ensure(package_base, dir=1) 314s 314s src_dir.join("CMakeLists.txt").write( 314s textwrap.dedent( 314s """ 314s cmake_minimum_required(VERSION 3.5.0) 314s project(hybrid NONE) 314s set(build_dir ${{CMAKE_BINARY_DIR}}) 314s 314s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 314s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 314s {c_off} install( 314s {c_off} FILES 314s {c_off} ${{build_dir}}/__init__.py 314s {c_off} ${{build_dir}}/cmake.py 314s {c_off} DESTINATION cmake 314s {c_off} ) 314s 314s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 314s {cm_off} install( 314s {cm_off} FILES ${{build_dir}}/cmakeModule.py 314s {cm_off} DESTINATION .) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 314s {h_off} DESTINATION hybrid/data) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 314s {h_off} DESTINATION hybrid/hybrid_2) 314s 314s install(CODE "message(STATUS \\\"Installation complete\\\")") 314s """.format( 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s ) 314s ) 314s ) 314s 314s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 314s path_types: Sequence[str] 314s try: 314s path_types = next( 314s iter( 314s zip( 314s *filter( 314s lambda i: i[1], 314s [ 314s ("c", has_cmake_package), 314s ("cm", has_cmake_module), 314s ("h", has_hybrid_package), 314s ("p", has_pure_package), 314s ("pm", has_pure_module), 314s ], 314s ) 314s ) 314s ) 314s ) 314s except StopIteration: 314s path_types = [] 314s 314s def select_paths(annotated_paths): 314s """Return a filtered list paths considering ``path_types``. 314s 314s `annotated_paths`` is list of tuple ``(type, path)`` where type 314s is either `c`, 'cm', `h`, `p` or 'pm'. 314s 314s """ 314s return filter(lambda i: i[0] in path_types, annotated_paths) 314s 314s # Commented paths are the one expected to be installed by CMake. For 314s # this reason, corresponding files should NOT be created in the source 314s # tree. 314s for _type, path in select_paths( 314s [ 314s # ('c', 'cmake/__init__.py'), 314s # ('c', 'cmake/cmake.py'), 314s # ('cm', 'cmakeModule.py'), 314s ("h", "hybrid/__init__.py"), 314s # ('h', 'hybrid/hybrid_cmake.dat'), 314s # ('h', 'hybrid/hybrid_cmake.py'), 314s ("h", "hybrid/hybrid_pure.dat"), 314s ("h", "hybrid/hybrid_pure.py"), 314s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 314s ("h", "hybrid/data/hybrid_data_pure.dat"), 314s ("h", "hybrid/hybrid_2/__init__.py"), 314s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 314s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 314s ("p", "hybrid/hybrid_2_pure/__init__.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 314s ("pm", "pureModule.py"), 314s ("p", "pure/__init__.py"), 314s ("p", "pure/pure.py"), 314s ("p", "pure/data/pure.dat"), 314s ] 314s ): 314s assert _type in {"p", "pm", "h"} 314s root = package_base if _type in {"p", "pm"} else cmake_source_dir 314s tmp_dir.ensure(os.path.join(root, path)) 314s 314s # Do not call the real setup function. Instead, replace it with 314s # a MagicMock allowing to check with which arguments it was invoked. 314s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 314s 314s # Convenience print function 314s def _pprint(desc, value=None): 314s print( 314s "-----------------\n" 314s f"{desc}:\n" 314s "\n" 314s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 314s ) 314s 314s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 314s 314s _pprint = ._pprint at 0xf32cdbb8> 314s _type = 'pm' 314s cmake_source_dir = '' 314s has_cmake_module = 0 314s has_cmake_package = 0 314s has_hybrid_package = 0 314s has_pure_module = 1 314s has_pure_package = 0 314s mock_setup = 314s mocker = 314s package_base = '' 314s package_base_dir = '' 314s path = 'pureModule.py' 314s path_types = ('pm',) 314s root = '' 314s select_paths = .select_paths at 0xf329fb68> 314s src_dir = local('/tmp/pytest-of-ubuntu/pytest-98/test_setup_inputs0') 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-98/test_setup_inputs0') 314s with_package_base = 0 314s 314s tests/test_setup.py:849: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-98/test_setup_inputs0') 314s setup_args = ['build'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-98/test_setup_inputs0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s ________________________ test_setup_inputs[0-1-0-0-0-1] ________________________ 314s 314s has_cmake_package = 1, has_cmake_module = 0, has_hybrid_package = 0 314s has_pure_package = 0, has_pure_module = 1, with_package_base = 0 314s mocker = 314s 314s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 314s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 314s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_module", [0, 1]) 314s @pytest.mark.parametrize("with_package_base", [0, 1]) 314s def test_setup_inputs( 314s has_cmake_package, 314s has_cmake_module, 314s has_hybrid_package, 314s has_pure_package, 314s has_pure_module, 314s with_package_base, 314s mocker, 314s ): 314s """This test that a project can have a package with some modules 314s installed using setup.py and some other modules installed using CMake. 314s """ 314s 314s tmp_dir = _tmpdir("test_setup_inputs") 314s 314s package_base = "to/the/base" if with_package_base else "" 314s package_base_dir = package_base + "/" if package_base else "" 314s cmake_source_dir = package_base 314s 314s if cmake_source_dir and (has_cmake_package or has_cmake_module): 314s pytest.skip( 314s "unsupported configuration: " 314s "python package fully generated by CMake does *NOT* work. " 314s "At least __init__.py should be in the project source tree" 314s ) 314s 314s # ------------------------------------------------------------------------- 314s # Here is the "SOURCE" tree layout: 314s # 314s # ROOT/ 314s # 314s # setup.py 314s # 314s # [/] 314s # 314s # pureModule.py 314s # 314s # pure/ 314s # __init__.py 314s # pure.py 314s # 314s # data/ 314s # pure.dat 314s # 314s # [/] 314s # 314s # hybrid/ 314s # CMakeLists.txt 314s # __init__.py 314s # hybrid_pure.dat 314s # hybrid_pure.py 314s # 314s # data/ 314s # hybrid_data_pure.dat 314s # 314s # hybrid_2/ 314s # __init__.py 314s # hybrid_2_pure.py 314s # 314s # hybrid_2_pure/ 314s # __init__.py 314s # hybrid_2_pure_1.py 314s # hybrid_2_pure_2.py 314s # 314s # 314s # ------------------------------------------------------------------------- 314s # and here is the "BINARY" distribution layout: 314s # 314s # The comment "CMake" or "Setuptools" indicates which tool is responsible 314s # for placing the file in the tree used to create the binary distribution. 314s # 314s # ROOT/ 314s # 314s # cmakeModule.py # CMake 314s # 314s # cmake/ 314s # __init__.py # CMake 314s # cmake.py # CMake 314s # 314s # hybrid/ 314s # hybrid_cmake.dat # CMake 314s # hybrid_cmake.py # CMake 314s # hybrid_pure.dat # Setuptools 314s # hybrid_pure.py # Setuptools 314s # 314s # data/ 314s # hybrid_data_pure.dat # CMake or Setuptools 314s # hybrid_data_cmake.dat # CMake *NO TEST* 314s # 314s # hybrid_2/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure.py # CMake or Setuptools 314s # hybrid_2_cmake.py # CMake 314s # 314s # hybrid_2_pure/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure_1.py # CMake or Setuptools 314s # hybrid_2_pure_2.py # CMake or Setuptools 314s # 314s # pureModule.py # Setuptools 314s # 314s # pure/ 314s # __init__.py # Setuptools 314s # pure.py # Setuptools 314s # 314s # data/ 314s # pure.dat # Setuptools 314s 314s tmp_dir.join("setup.py").write( 314s textwrap.dedent( 314s """ 314s from skbuild import setup 314s #from setuptools import setup 314s setup( 314s name="test_hybrid_project", 314s version="1.2.3", 314s description=("an hybrid package mixing files installed by both " 314s "CMake and setuptools"), 314s author='The scikit-build team', 314s license="MIT", 314s cmake_source_dir='{cmake_source_dir}', 314s cmake_install_dir='{cmake_install_dir}', 314s # Arbitrary order of packages 314s packages=[ 314s {p_off} 'pure', 314s {h_off} 'hybrid.hybrid_2', 314s {h_off} 'hybrid', 314s {c_off} 'cmake', 314s {p_off} 'hybrid.hybrid_2_pure', 314s ], 314s py_modules=[ 314s {pm_off} '{package_base}pureModule', 314s {cm_off} '{package_base}cmakeModule', 314s ], 314s package_data={{ 314s {p_off} 'pure': ['data/pure.dat'], 314s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 314s }}, 314s # Arbitrary order of package_dir 314s package_dir = {{ 314s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 314s {p_off} 'pure': '{package_base}pure', 314s {h_off} 'hybrid': '{package_base}hybrid', 314s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 314s {c_off} 'cmake': '{package_base}cmake', 314s }} 314s ) 314s """.format( 314s cmake_source_dir=cmake_source_dir, 314s cmake_install_dir=package_base, 314s package_base=package_base_dir, 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s p_off="" if has_pure_package else "#", 314s pm_off="" if has_pure_module else "#", 314s ) 314s ) 314s ) 314s 314s src_dir = tmp_dir.ensure(package_base, dir=1) 314s 314s src_dir.join("CMakeLists.txt").write( 314s textwrap.dedent( 314s """ 314s cmake_minimum_required(VERSION 3.5.0) 314s project(hybrid NONE) 314s set(build_dir ${{CMAKE_BINARY_DIR}}) 314s 314s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 314s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 314s {c_off} install( 314s {c_off} FILES 314s {c_off} ${{build_dir}}/__init__.py 314s {c_off} ${{build_dir}}/cmake.py 314s {c_off} DESTINATION cmake 314s {c_off} ) 314s 314s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 314s {cm_off} install( 314s {cm_off} FILES ${{build_dir}}/cmakeModule.py 314s {cm_off} DESTINATION .) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 314s {h_off} DESTINATION hybrid/data) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 314s {h_off} DESTINATION hybrid/hybrid_2) 314s 314s install(CODE "message(STATUS \\\"Installation complete\\\")") 314s """.format( 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s ) 314s ) 314s ) 314s 314s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 314s path_types: Sequence[str] 314s try: 314s path_types = next( 314s iter( 314s zip( 314s *filter( 314s lambda i: i[1], 314s [ 314s ("c", has_cmake_package), 314s ("cm", has_cmake_module), 314s ("h", has_hybrid_package), 314s ("p", has_pure_package), 314s ("pm", has_pure_module), 314s ], 314s ) 314s ) 314s ) 314s ) 314s except StopIteration: 314s path_types = [] 314s 314s def select_paths(annotated_paths): 314s """Return a filtered list paths considering ``path_types``. 314s 314s `annotated_paths`` is list of tuple ``(type, path)`` where type 314s is either `c`, 'cm', `h`, `p` or 'pm'. 314s 314s """ 314s return filter(lambda i: i[0] in path_types, annotated_paths) 314s 314s # Commented paths are the one expected to be installed by CMake. For 314s # this reason, corresponding files should NOT be created in the source 314s # tree. 314s for _type, path in select_paths( 314s [ 314s # ('c', 'cmake/__init__.py'), 314s # ('c', 'cmake/cmake.py'), 314s # ('cm', 'cmakeModule.py'), 314s ("h", "hybrid/__init__.py"), 314s # ('h', 'hybrid/hybrid_cmake.dat'), 314s # ('h', 'hybrid/hybrid_cmake.py'), 314s ("h", "hybrid/hybrid_pure.dat"), 314s ("h", "hybrid/hybrid_pure.py"), 314s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 314s ("h", "hybrid/data/hybrid_data_pure.dat"), 314s ("h", "hybrid/hybrid_2/__init__.py"), 314s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 314s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 314s ("p", "hybrid/hybrid_2_pure/__init__.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 314s ("pm", "pureModule.py"), 314s ("p", "pure/__init__.py"), 314s ("p", "pure/pure.py"), 314s ("p", "pure/data/pure.dat"), 314s ] 314s ): 314s assert _type in {"p", "pm", "h"} 314s root = package_base if _type in {"p", "pm"} else cmake_source_dir 314s tmp_dir.ensure(os.path.join(root, path)) 314s 314s # Do not call the real setup function. Instead, replace it with 314s # a MagicMock allowing to check with which arguments it was invoked. 314s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 314s 314s # Convenience print function 314s def _pprint(desc, value=None): 314s print( 314s "-----------------\n" 314s f"{desc}:\n" 314s "\n" 314s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 314s ) 314s 314s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 314s 314s _pprint = ._pprint at 0xf32b8ac8> 314s _type = 'pm' 314s cmake_source_dir = '' 314s has_cmake_module = 0 314s has_cmake_package = 1 314s has_hybrid_package = 0 314s has_pure_module = 1 314s has_pure_package = 0 314s mock_setup = 314s mocker = 314s package_base = '' 314s package_base_dir = '' 314s path = 'pureModule.py' 314s path_types = ('c', 'pm') 314s root = '' 314s select_paths = .select_paths at 0xf32cd528> 314s src_dir = local('/tmp/pytest-of-ubuntu/pytest-99/test_setup_inputs0') 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-99/test_setup_inputs0') 314s with_package_base = 0 314s 314s tests/test_setup.py:849: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-99/test_setup_inputs0') 314s setup_args = ['build'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-99/test_setup_inputs0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s ________________________ test_setup_inputs[0-1-0-0-1-0] ________________________ 314s 314s has_cmake_package = 0, has_cmake_module = 1, has_hybrid_package = 0 314s has_pure_package = 0, has_pure_module = 1, with_package_base = 0 314s mocker = 314s 314s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 314s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 314s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_module", [0, 1]) 314s @pytest.mark.parametrize("with_package_base", [0, 1]) 314s def test_setup_inputs( 314s has_cmake_package, 314s has_cmake_module, 314s has_hybrid_package, 314s has_pure_package, 314s has_pure_module, 314s with_package_base, 314s mocker, 314s ): 314s """This test that a project can have a package with some modules 314s installed using setup.py and some other modules installed using CMake. 314s """ 314s 314s tmp_dir = _tmpdir("test_setup_inputs") 314s 314s package_base = "to/the/base" if with_package_base else "" 314s package_base_dir = package_base + "/" if package_base else "" 314s cmake_source_dir = package_base 314s 314s if cmake_source_dir and (has_cmake_package or has_cmake_module): 314s pytest.skip( 314s "unsupported configuration: " 314s "python package fully generated by CMake does *NOT* work. " 314s "At least __init__.py should be in the project source tree" 314s ) 314s 314s # ------------------------------------------------------------------------- 314s # Here is the "SOURCE" tree layout: 314s # 314s # ROOT/ 314s # 314s # setup.py 314s # 314s # [/] 314s # 314s # pureModule.py 314s # 314s # pure/ 314s # __init__.py 314s # pure.py 314s # 314s # data/ 314s # pure.dat 314s # 314s # [/] 314s # 314s # hybrid/ 314s # CMakeLists.txt 314s # __init__.py 314s # hybrid_pure.dat 314s # hybrid_pure.py 314s # 314s # data/ 314s # hybrid_data_pure.dat 314s # 314s # hybrid_2/ 314s # __init__.py 314s # hybrid_2_pure.py 314s # 314s # hybrid_2_pure/ 314s # __init__.py 314s # hybrid_2_pure_1.py 314s # hybrid_2_pure_2.py 314s # 314s # 314s # ------------------------------------------------------------------------- 314s # and here is the "BINARY" distribution layout: 314s # 314s # The comment "CMake" or "Setuptools" indicates which tool is responsible 314s # for placing the file in the tree used to create the binary distribution. 314s # 314s # ROOT/ 314s # 314s # cmakeModule.py # CMake 314s # 314s # cmake/ 314s # __init__.py # CMake 314s # cmake.py # CMake 314s # 314s # hybrid/ 314s # hybrid_cmake.dat # CMake 314s # hybrid_cmake.py # CMake 314s # hybrid_pure.dat # Setuptools 314s # hybrid_pure.py # Setuptools 314s # 314s # data/ 314s # hybrid_data_pure.dat # CMake or Setuptools 314s # hybrid_data_cmake.dat # CMake *NO TEST* 314s # 314s # hybrid_2/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure.py # CMake or Setuptools 314s # hybrid_2_cmake.py # CMake 314s # 314s # hybrid_2_pure/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure_1.py # CMake or Setuptools 314s # hybrid_2_pure_2.py # CMake or Setuptools 314s # 314s # pureModule.py # Setuptools 314s # 314s # pure/ 314s # __init__.py # Setuptools 314s # pure.py # Setuptools 314s # 314s # data/ 314s # pure.dat # Setuptools 314s 314s tmp_dir.join("setup.py").write( 314s textwrap.dedent( 314s """ 314s from skbuild import setup 314s #from setuptools import setup 314s setup( 314s name="test_hybrid_project", 314s version="1.2.3", 314s description=("an hybrid package mixing files installed by both " 314s "CMake and setuptools"), 314s author='The scikit-build team', 314s license="MIT", 314s cmake_source_dir='{cmake_source_dir}', 314s cmake_install_dir='{cmake_install_dir}', 314s # Arbitrary order of packages 314s packages=[ 314s {p_off} 'pure', 314s {h_off} 'hybrid.hybrid_2', 314s {h_off} 'hybrid', 314s {c_off} 'cmake', 314s {p_off} 'hybrid.hybrid_2_pure', 314s ], 314s py_modules=[ 314s {pm_off} '{package_base}pureModule', 314s {cm_off} '{package_base}cmakeModule', 314s ], 314s package_data={{ 314s {p_off} 'pure': ['data/pure.dat'], 314s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 314s }}, 314s # Arbitrary order of package_dir 314s package_dir = {{ 314s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 314s {p_off} 'pure': '{package_base}pure', 314s {h_off} 'hybrid': '{package_base}hybrid', 314s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 314s {c_off} 'cmake': '{package_base}cmake', 314s }} 314s ) 314s """.format( 314s cmake_source_dir=cmake_source_dir, 314s cmake_install_dir=package_base, 314s package_base=package_base_dir, 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s p_off="" if has_pure_package else "#", 314s pm_off="" if has_pure_module else "#", 314s ) 314s ) 314s ) 314s 314s src_dir = tmp_dir.ensure(package_base, dir=1) 314s 314s src_dir.join("CMakeLists.txt").write( 314s textwrap.dedent( 314s """ 314s cmake_minimum_required(VERSION 3.5.0) 314s project(hybrid NONE) 314s set(build_dir ${{CMAKE_BINARY_DIR}}) 314s 314s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 314s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 314s {c_off} install( 314s {c_off} FILES 314s {c_off} ${{build_dir}}/__init__.py 314s {c_off} ${{build_dir}}/cmake.py 314s {c_off} DESTINATION cmake 314s {c_off} ) 314s 314s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 314s {cm_off} install( 314s {cm_off} FILES ${{build_dir}}/cmakeModule.py 314s {cm_off} DESTINATION .) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 314s {h_off} DESTINATION hybrid/data) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 314s {h_off} DESTINATION hybrid/hybrid_2) 314s 314s install(CODE "message(STATUS \\\"Installation complete\\\")") 314s """.format( 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s ) 314s ) 314s ) 314s 314s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 314s path_types: Sequence[str] 314s try: 314s path_types = next( 314s iter( 314s zip( 314s *filter( 314s lambda i: i[1], 314s [ 314s ("c", has_cmake_package), 314s ("cm", has_cmake_module), 314s ("h", has_hybrid_package), 314s ("p", has_pure_package), 314s ("pm", has_pure_module), 314s ], 314s ) 314s ) 314s ) 314s ) 314s except StopIteration: 314s path_types = [] 314s 314s def select_paths(annotated_paths): 314s """Return a filtered list paths considering ``path_types``. 314s 314s `annotated_paths`` is list of tuple ``(type, path)`` where type 314s is either `c`, 'cm', `h`, `p` or 'pm'. 314s 314s """ 314s return filter(lambda i: i[0] in path_types, annotated_paths) 314s 314s # Commented paths are the one expected to be installed by CMake. For 314s # this reason, corresponding files should NOT be created in the source 314s # tree. 314s for _type, path in select_paths( 314s [ 314s # ('c', 'cmake/__init__.py'), 314s # ('c', 'cmake/cmake.py'), 314s # ('cm', 'cmakeModule.py'), 314s ("h", "hybrid/__init__.py"), 314s # ('h', 'hybrid/hybrid_cmake.dat'), 314s # ('h', 'hybrid/hybrid_cmake.py'), 314s ("h", "hybrid/hybrid_pure.dat"), 314s ("h", "hybrid/hybrid_pure.py"), 314s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 314s ("h", "hybrid/data/hybrid_data_pure.dat"), 314s ("h", "hybrid/hybrid_2/__init__.py"), 314s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 314s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 314s ("p", "hybrid/hybrid_2_pure/__init__.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 314s ("pm", "pureModule.py"), 314s ("p", "pure/__init__.py"), 314s ("p", "pure/pure.py"), 314s ("p", "pure/data/pure.dat"), 314s ] 314s ): 314s assert _type in {"p", "pm", "h"} 314s root = package_base if _type in {"p", "pm"} else cmake_source_dir 314s tmp_dir.ensure(os.path.join(root, path)) 314s 314s # Do not call the real setup function. Instead, replace it with 314s # a MagicMock allowing to check with which arguments it was invoked. 314s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 314s 314s # Convenience print function 314s def _pprint(desc, value=None): 314s print( 314s "-----------------\n" 314s f"{desc}:\n" 314s "\n" 314s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 314s ) 314s 314s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 314s 314s _pprint = ._pprint at 0xf32b8e38> 314s _type = 'pm' 314s cmake_source_dir = '' 314s has_cmake_module = 1 314s has_cmake_package = 0 314s has_hybrid_package = 0 314s has_pure_module = 1 314s has_pure_package = 0 314s mock_setup = 314s mocker = 314s package_base = '' 314s package_base_dir = '' 314s path = 'pureModule.py' 314s path_types = ('cm', 'pm') 314s root = '' 314s select_paths = .select_paths at 0xf329ef78> 314s src_dir = local('/tmp/pytest-of-ubuntu/pytest-100/test_setup_inputs0') 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-100/test_setup_inputs0') 314s with_package_base = 0 314s 314s tests/test_setup.py:849: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-100/test_setup_inputs0') 314s setup_args = ['build'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-100/test_setup_inputs0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s ________________________ test_setup_inputs[0-1-0-0-1-1] ________________________ 314s 314s has_cmake_package = 1, has_cmake_module = 1, has_hybrid_package = 0 314s has_pure_package = 0, has_pure_module = 1, with_package_base = 0 314s mocker = 314s 314s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 314s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 314s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_module", [0, 1]) 314s @pytest.mark.parametrize("with_package_base", [0, 1]) 314s def test_setup_inputs( 314s has_cmake_package, 314s has_cmake_module, 314s has_hybrid_package, 314s has_pure_package, 314s has_pure_module, 314s with_package_base, 314s mocker, 314s ): 314s """This test that a project can have a package with some modules 314s installed using setup.py and some other modules installed using CMake. 314s """ 314s 314s tmp_dir = _tmpdir("test_setup_inputs") 314s 314s package_base = "to/the/base" if with_package_base else "" 314s package_base_dir = package_base + "/" if package_base else "" 314s cmake_source_dir = package_base 314s 314s if cmake_source_dir and (has_cmake_package or has_cmake_module): 314s pytest.skip( 314s "unsupported configuration: " 314s "python package fully generated by CMake does *NOT* work. " 314s "At least __init__.py should be in the project source tree" 314s ) 314s 314s # ------------------------------------------------------------------------- 314s # Here is the "SOURCE" tree layout: 314s # 314s # ROOT/ 314s # 314s # setup.py 314s # 314s # [/] 314s # 314s # pureModule.py 314s # 314s # pure/ 314s # __init__.py 314s # pure.py 314s # 314s # data/ 314s # pure.dat 314s # 314s # [/] 314s # 314s # hybrid/ 314s # CMakeLists.txt 314s # __init__.py 314s # hybrid_pure.dat 314s # hybrid_pure.py 314s # 314s # data/ 314s # hybrid_data_pure.dat 314s # 314s # hybrid_2/ 314s # __init__.py 314s # hybrid_2_pure.py 314s # 314s # hybrid_2_pure/ 314s # __init__.py 314s # hybrid_2_pure_1.py 314s # hybrid_2_pure_2.py 314s # 314s # 314s # ------------------------------------------------------------------------- 314s # and here is the "BINARY" distribution layout: 314s # 314s # The comment "CMake" or "Setuptools" indicates which tool is responsible 314s # for placing the file in the tree used to create the binary distribution. 314s # 314s # ROOT/ 314s # 314s # cmakeModule.py # CMake 314s # 314s # cmake/ 314s # __init__.py # CMake 314s # cmake.py # CMake 314s # 314s # hybrid/ 314s # hybrid_cmake.dat # CMake 314s # hybrid_cmake.py # CMake 314s # hybrid_pure.dat # Setuptools 314s # hybrid_pure.py # Setuptools 314s # 314s # data/ 314s # hybrid_data_pure.dat # CMake or Setuptools 314s # hybrid_data_cmake.dat # CMake *NO TEST* 314s # 314s # hybrid_2/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure.py # CMake or Setuptools 314s # hybrid_2_cmake.py # CMake 314s # 314s # hybrid_2_pure/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure_1.py # CMake or Setuptools 314s # hybrid_2_pure_2.py # CMake or Setuptools 314s # 314s # pureModule.py # Setuptools 314s # 314s # pure/ 314s # __init__.py # Setuptools 314s # pure.py # Setuptools 314s # 314s # data/ 314s # pure.dat # Setuptools 314s 314s tmp_dir.join("setup.py").write( 314s textwrap.dedent( 314s """ 314s from skbuild import setup 314s #from setuptools import setup 314s setup( 314s name="test_hybrid_project", 314s version="1.2.3", 314s description=("an hybrid package mixing files installed by both " 314s "CMake and setuptools"), 314s author='The scikit-build team', 314s license="MIT", 314s cmake_source_dir='{cmake_source_dir}', 314s cmake_install_dir='{cmake_install_dir}', 314s # Arbitrary order of packages 314s packages=[ 314s {p_off} 'pure', 314s {h_off} 'hybrid.hybrid_2', 314s {h_off} 'hybrid', 314s {c_off} 'cmake', 314s {p_off} 'hybrid.hybrid_2_pure', 314s ], 314s py_modules=[ 314s {pm_off} '{package_base}pureModule', 314s {cm_off} '{package_base}cmakeModule', 314s ], 314s package_data={{ 314s {p_off} 'pure': ['data/pure.dat'], 314s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 314s }}, 314s # Arbitrary order of package_dir 314s package_dir = {{ 314s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 314s {p_off} 'pure': '{package_base}pure', 314s {h_off} 'hybrid': '{package_base}hybrid', 314s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 314s {c_off} 'cmake': '{package_base}cmake', 314s }} 314s ) 314s """.format( 314s cmake_source_dir=cmake_source_dir, 314s cmake_install_dir=package_base, 314s package_base=package_base_dir, 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s p_off="" if has_pure_package else "#", 314s pm_off="" if has_pure_module else "#", 314s ) 314s ) 314s ) 314s 314s src_dir = tmp_dir.ensure(package_base, dir=1) 314s 314s src_dir.join("CMakeLists.txt").write( 314s textwrap.dedent( 314s """ 314s cmake_minimum_required(VERSION 3.5.0) 314s project(hybrid NONE) 314s set(build_dir ${{CMAKE_BINARY_DIR}}) 314s 314s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 314s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 314s {c_off} install( 314s {c_off} FILES 314s {c_off} ${{build_dir}}/__init__.py 314s {c_off} ${{build_dir}}/cmake.py 314s {c_off} DESTINATION cmake 314s {c_off} ) 314s 314s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 314s {cm_off} install( 314s {cm_off} FILES ${{build_dir}}/cmakeModule.py 314s {cm_off} DESTINATION .) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 314s {h_off} DESTINATION hybrid/data) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 314s {h_off} DESTINATION hybrid/hybrid_2) 314s 314s install(CODE "message(STATUS \\\"Installation complete\\\")") 314s """.format( 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s ) 314s ) 314s ) 314s 314s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 314s path_types: Sequence[str] 314s try: 314s path_types = next( 314s iter( 314s zip( 314s *filter( 314s lambda i: i[1], 314s [ 314s ("c", has_cmake_package), 314s ("cm", has_cmake_module), 314s ("h", has_hybrid_package), 314s ("p", has_pure_package), 314s ("pm", has_pure_module), 314s ], 314s ) 314s ) 314s ) 314s ) 314s except StopIteration: 314s path_types = [] 314s 314s def select_paths(annotated_paths): 314s """Return a filtered list paths considering ``path_types``. 314s 314s `annotated_paths`` is list of tuple ``(type, path)`` where type 314s is either `c`, 'cm', `h`, `p` or 'pm'. 314s 314s """ 314s return filter(lambda i: i[0] in path_types, annotated_paths) 314s 314s # Commented paths are the one expected to be installed by CMake. For 314s # this reason, corresponding files should NOT be created in the source 314s # tree. 314s for _type, path in select_paths( 314s [ 314s # ('c', 'cmake/__init__.py'), 314s # ('c', 'cmake/cmake.py'), 314s # ('cm', 'cmakeModule.py'), 314s ("h", "hybrid/__init__.py"), 314s # ('h', 'hybrid/hybrid_cmake.dat'), 314s # ('h', 'hybrid/hybrid_cmake.py'), 314s ("h", "hybrid/hybrid_pure.dat"), 314s ("h", "hybrid/hybrid_pure.py"), 314s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 314s ("h", "hybrid/data/hybrid_data_pure.dat"), 314s ("h", "hybrid/hybrid_2/__init__.py"), 314s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 314s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 314s ("p", "hybrid/hybrid_2_pure/__init__.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 314s ("pm", "pureModule.py"), 314s ("p", "pure/__init__.py"), 314s ("p", "pure/pure.py"), 314s ("p", "pure/data/pure.dat"), 314s ] 314s ): 314s assert _type in {"p", "pm", "h"} 314s root = package_base if _type in {"p", "pm"} else cmake_source_dir 314s tmp_dir.ensure(os.path.join(root, path)) 314s 314s # Do not call the real setup function. Instead, replace it with 314s # a MagicMock allowing to check with which arguments it was invoked. 314s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 314s 314s # Convenience print function 314s def _pprint(desc, value=None): 314s print( 314s "-----------------\n" 314s f"{desc}:\n" 314s "\n" 314s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 314s ) 314s 314s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 314s 314s _pprint = ._pprint at 0xf33639d8> 314s _type = 'pm' 314s cmake_source_dir = '' 314s has_cmake_module = 1 314s has_cmake_package = 1 314s has_hybrid_package = 0 314s has_pure_module = 1 314s has_pure_package = 0 314s mock_setup = 314s mocker = 314s package_base = '' 314s package_base_dir = '' 314s path = 'pureModule.py' 314s path_types = ('c', 'cm', 'pm') 314s root = '' 314s select_paths = .select_paths at 0xf33ceb18> 314s src_dir = local('/tmp/pytest-of-ubuntu/pytest-101/test_setup_inputs0') 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-101/test_setup_inputs0') 314s with_package_base = 0 314s 314s tests/test_setup.py:849: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-101/test_setup_inputs0') 314s setup_args = ['build'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-101/test_setup_inputs0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s ________________________ test_setup_inputs[0-1-0-1-0-0] ________________________ 314s 314s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 1 314s has_pure_package = 0, has_pure_module = 1, with_package_base = 0 314s mocker = 314s 314s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 314s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 314s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_module", [0, 1]) 314s @pytest.mark.parametrize("with_package_base", [0, 1]) 314s def test_setup_inputs( 314s has_cmake_package, 314s has_cmake_module, 314s has_hybrid_package, 314s has_pure_package, 314s has_pure_module, 314s with_package_base, 314s mocker, 314s ): 314s """This test that a project can have a package with some modules 314s installed using setup.py and some other modules installed using CMake. 314s """ 314s 314s tmp_dir = _tmpdir("test_setup_inputs") 314s 314s package_base = "to/the/base" if with_package_base else "" 314s package_base_dir = package_base + "/" if package_base else "" 314s cmake_source_dir = package_base 314s 314s if cmake_source_dir and (has_cmake_package or has_cmake_module): 314s pytest.skip( 314s "unsupported configuration: " 314s "python package fully generated by CMake does *NOT* work. " 314s "At least __init__.py should be in the project source tree" 314s ) 314s 314s # ------------------------------------------------------------------------- 314s # Here is the "SOURCE" tree layout: 314s # 314s # ROOT/ 314s # 314s # setup.py 314s # 314s # [/] 314s # 314s # pureModule.py 314s # 314s # pure/ 314s # __init__.py 314s # pure.py 314s # 314s # data/ 314s # pure.dat 314s # 314s # [/] 314s # 314s # hybrid/ 314s # CMakeLists.txt 314s # __init__.py 314s # hybrid_pure.dat 314s # hybrid_pure.py 314s # 314s # data/ 314s # hybrid_data_pure.dat 314s # 314s # hybrid_2/ 314s # __init__.py 314s # hybrid_2_pure.py 314s # 314s # hybrid_2_pure/ 314s # __init__.py 314s # hybrid_2_pure_1.py 314s # hybrid_2_pure_2.py 314s # 314s # 314s # ------------------------------------------------------------------------- 314s # and here is the "BINARY" distribution layout: 314s # 314s # The comment "CMake" or "Setuptools" indicates which tool is responsible 314s # for placing the file in the tree used to create the binary distribution. 314s # 314s # ROOT/ 314s # 314s # cmakeModule.py # CMake 314s # 314s # cmake/ 314s # __init__.py # CMake 314s # cmake.py # CMake 314s # 314s # hybrid/ 314s # hybrid_cmake.dat # CMake 314s # hybrid_cmake.py # CMake 314s # hybrid_pure.dat # Setuptools 314s # hybrid_pure.py # Setuptools 314s # 314s # data/ 314s # hybrid_data_pure.dat # CMake or Setuptools 314s # hybrid_data_cmake.dat # CMake *NO TEST* 314s # 314s # hybrid_2/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure.py # CMake or Setuptools 314s # hybrid_2_cmake.py # CMake 314s # 314s # hybrid_2_pure/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure_1.py # CMake or Setuptools 314s # hybrid_2_pure_2.py # CMake or Setuptools 314s # 314s # pureModule.py # Setuptools 314s # 314s # pure/ 314s # __init__.py # Setuptools 314s # pure.py # Setuptools 314s # 314s # data/ 314s # pure.dat # Setuptools 314s 314s tmp_dir.join("setup.py").write( 314s textwrap.dedent( 314s """ 314s from skbuild import setup 314s #from setuptools import setup 314s setup( 314s name="test_hybrid_project", 314s version="1.2.3", 314s description=("an hybrid package mixing files installed by both " 314s "CMake and setuptools"), 314s author='The scikit-build team', 314s license="MIT", 314s cmake_source_dir='{cmake_source_dir}', 314s cmake_install_dir='{cmake_install_dir}', 314s # Arbitrary order of packages 314s packages=[ 314s {p_off} 'pure', 314s {h_off} 'hybrid.hybrid_2', 314s {h_off} 'hybrid', 314s {c_off} 'cmake', 314s {p_off} 'hybrid.hybrid_2_pure', 314s ], 314s py_modules=[ 314s {pm_off} '{package_base}pureModule', 314s {cm_off} '{package_base}cmakeModule', 314s ], 314s package_data={{ 314s {p_off} 'pure': ['data/pure.dat'], 314s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 314s }}, 314s # Arbitrary order of package_dir 314s package_dir = {{ 314s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 314s {p_off} 'pure': '{package_base}pure', 314s {h_off} 'hybrid': '{package_base}hybrid', 314s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 314s {c_off} 'cmake': '{package_base}cmake', 314s }} 314s ) 314s """.format( 314s cmake_source_dir=cmake_source_dir, 314s cmake_install_dir=package_base, 314s package_base=package_base_dir, 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s p_off="" if has_pure_package else "#", 314s pm_off="" if has_pure_module else "#", 314s ) 314s ) 314s ) 314s 314s src_dir = tmp_dir.ensure(package_base, dir=1) 314s 314s src_dir.join("CMakeLists.txt").write( 314s textwrap.dedent( 314s """ 314s cmake_minimum_required(VERSION 3.5.0) 314s project(hybrid NONE) 314s set(build_dir ${{CMAKE_BINARY_DIR}}) 314s 314s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 314s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 314s {c_off} install( 314s {c_off} FILES 314s {c_off} ${{build_dir}}/__init__.py 314s {c_off} ${{build_dir}}/cmake.py 314s {c_off} DESTINATION cmake 314s {c_off} ) 314s 314s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 314s {cm_off} install( 314s {cm_off} FILES ${{build_dir}}/cmakeModule.py 314s {cm_off} DESTINATION .) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 314s {h_off} DESTINATION hybrid/data) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 314s {h_off} DESTINATION hybrid/hybrid_2) 314s 314s install(CODE "message(STATUS \\\"Installation complete\\\")") 314s """.format( 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s ) 314s ) 314s ) 314s 314s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 314s path_types: Sequence[str] 314s try: 314s path_types = next( 314s iter( 314s zip( 314s *filter( 314s lambda i: i[1], 314s [ 314s ("c", has_cmake_package), 314s ("cm", has_cmake_module), 314s ("h", has_hybrid_package), 314s ("p", has_pure_package), 314s ("pm", has_pure_module), 314s ], 314s ) 314s ) 314s ) 314s ) 314s except StopIteration: 314s path_types = [] 314s 314s def select_paths(annotated_paths): 314s """Return a filtered list paths considering ``path_types``. 314s 314s `annotated_paths`` is list of tuple ``(type, path)`` where type 314s is either `c`, 'cm', `h`, `p` or 'pm'. 314s 314s """ 314s return filter(lambda i: i[0] in path_types, annotated_paths) 314s 314s # Commented paths are the one expected to be installed by CMake. For 314s # this reason, corresponding files should NOT be created in the source 314s # tree. 314s for _type, path in select_paths( 314s [ 314s # ('c', 'cmake/__init__.py'), 314s # ('c', 'cmake/cmake.py'), 314s # ('cm', 'cmakeModule.py'), 314s ("h", "hybrid/__init__.py"), 314s # ('h', 'hybrid/hybrid_cmake.dat'), 314s # ('h', 'hybrid/hybrid_cmake.py'), 314s ("h", "hybrid/hybrid_pure.dat"), 314s ("h", "hybrid/hybrid_pure.py"), 314s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 314s ("h", "hybrid/data/hybrid_data_pure.dat"), 314s ("h", "hybrid/hybrid_2/__init__.py"), 314s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 314s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 314s ("p", "hybrid/hybrid_2_pure/__init__.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 314s ("pm", "pureModule.py"), 314s ("p", "pure/__init__.py"), 314s ("p", "pure/pure.py"), 314s ("p", "pure/data/pure.dat"), 314s ] 314s ): 314s assert _type in {"p", "pm", "h"} 314s root = package_base if _type in {"p", "pm"} else cmake_source_dir 314s tmp_dir.ensure(os.path.join(root, path)) 314s 314s # Do not call the real setup function. Instead, replace it with 314s # a MagicMock allowing to check with which arguments it was invoked. 314s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 314s 314s # Convenience print function 314s def _pprint(desc, value=None): 314s print( 314s "-----------------\n" 314s f"{desc}:\n" 314s "\n" 314s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 314s ) 314s 314s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 314s 314s _pprint = ._pprint at 0xf3389bb8> 314s _type = 'pm' 314s cmake_source_dir = '' 314s has_cmake_module = 0 314s has_cmake_package = 0 314s has_hybrid_package = 1 314s has_pure_module = 1 314s has_pure_package = 0 314s mock_setup = 314s mocker = 314s package_base = '' 314s package_base_dir = '' 314s path = 'pureModule.py' 314s path_types = ('h', 'pm') 314s root = '' 314s select_paths = .select_paths at 0xf3363d48> 314s src_dir = local('/tmp/pytest-of-ubuntu/pytest-102/test_setup_inputs0') 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-102/test_setup_inputs0') 314s with_package_base = 0 314s 314s tests/test_setup.py:849: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-102/test_setup_inputs0') 314s setup_args = ['build'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-102/test_setup_inputs0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s ________________________ test_setup_inputs[0-1-0-1-0-1] ________________________ 314s 314s has_cmake_package = 1, has_cmake_module = 0, has_hybrid_package = 1 314s has_pure_package = 0, has_pure_module = 1, with_package_base = 0 314s mocker = 314s 314s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 314s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 314s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_module", [0, 1]) 314s @pytest.mark.parametrize("with_package_base", [0, 1]) 314s def test_setup_inputs( 314s has_cmake_package, 314s has_cmake_module, 314s has_hybrid_package, 314s has_pure_package, 314s has_pure_module, 314s with_package_base, 314s mocker, 314s ): 314s """This test that a project can have a package with some modules 314s installed using setup.py and some other modules installed using CMake. 314s """ 314s 314s tmp_dir = _tmpdir("test_setup_inputs") 314s 314s package_base = "to/the/base" if with_package_base else "" 314s package_base_dir = package_base + "/" if package_base else "" 314s cmake_source_dir = package_base 314s 314s if cmake_source_dir and (has_cmake_package or has_cmake_module): 314s pytest.skip( 314s "unsupported configuration: " 314s "python package fully generated by CMake does *NOT* work. " 314s "At least __init__.py should be in the project source tree" 314s ) 314s 314s # ------------------------------------------------------------------------- 314s # Here is the "SOURCE" tree layout: 314s # 314s # ROOT/ 314s # 314s # setup.py 314s # 314s # [/] 314s # 314s # pureModule.py 314s # 314s # pure/ 314s # __init__.py 314s # pure.py 314s # 314s # data/ 314s # pure.dat 314s # 314s # [/] 314s # 314s # hybrid/ 314s # CMakeLists.txt 314s # __init__.py 314s # hybrid_pure.dat 314s # hybrid_pure.py 314s # 314s # data/ 314s # hybrid_data_pure.dat 314s # 314s # hybrid_2/ 314s # __init__.py 314s # hybrid_2_pure.py 314s # 314s # hybrid_2_pure/ 314s # __init__.py 314s # hybrid_2_pure_1.py 314s # hybrid_2_pure_2.py 314s # 314s # 314s # ------------------------------------------------------------------------- 314s # and here is the "BINARY" distribution layout: 314s # 314s # The comment "CMake" or "Setuptools" indicates which tool is responsible 314s # for placing the file in the tree used to create the binary distribution. 314s # 314s # ROOT/ 314s # 314s # cmakeModule.py # CMake 314s # 314s # cmake/ 314s # __init__.py # CMake 314s # cmake.py # CMake 314s # 314s # hybrid/ 314s # hybrid_cmake.dat # CMake 314s # hybrid_cmake.py # CMake 314s # hybrid_pure.dat # Setuptools 314s # hybrid_pure.py # Setuptools 314s # 314s # data/ 314s # hybrid_data_pure.dat # CMake or Setuptools 314s # hybrid_data_cmake.dat # CMake *NO TEST* 314s # 314s # hybrid_2/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure.py # CMake or Setuptools 314s # hybrid_2_cmake.py # CMake 314s # 314s # hybrid_2_pure/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure_1.py # CMake or Setuptools 314s # hybrid_2_pure_2.py # CMake or Setuptools 314s # 314s # pureModule.py # Setuptools 314s # 314s # pure/ 314s # __init__.py # Setuptools 314s # pure.py # Setuptools 314s # 314s # data/ 314s # pure.dat # Setuptools 314s 314s tmp_dir.join("setup.py").write( 314s textwrap.dedent( 314s """ 314s from skbuild import setup 314s #from setuptools import setup 314s setup( 314s name="test_hybrid_project", 314s version="1.2.3", 314s description=("an hybrid package mixing files installed by both " 314s "CMake and setuptools"), 314s author='The scikit-build team', 314s license="MIT", 314s cmake_source_dir='{cmake_source_dir}', 314s cmake_install_dir='{cmake_install_dir}', 314s # Arbitrary order of packages 314s packages=[ 314s {p_off} 'pure', 314s {h_off} 'hybrid.hybrid_2', 314s {h_off} 'hybrid', 314s {c_off} 'cmake', 314s {p_off} 'hybrid.hybrid_2_pure', 314s ], 314s py_modules=[ 314s {pm_off} '{package_base}pureModule', 314s {cm_off} '{package_base}cmakeModule', 314s ], 314s package_data={{ 314s {p_off} 'pure': ['data/pure.dat'], 314s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 314s }}, 314s # Arbitrary order of package_dir 314s package_dir = {{ 314s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 314s {p_off} 'pure': '{package_base}pure', 314s {h_off} 'hybrid': '{package_base}hybrid', 314s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 314s {c_off} 'cmake': '{package_base}cmake', 314s }} 314s ) 314s """.format( 314s cmake_source_dir=cmake_source_dir, 314s cmake_install_dir=package_base, 314s package_base=package_base_dir, 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s p_off="" if has_pure_package else "#", 314s pm_off="" if has_pure_module else "#", 314s ) 314s ) 314s ) 314s 314s src_dir = tmp_dir.ensure(package_base, dir=1) 314s 314s src_dir.join("CMakeLists.txt").write( 314s textwrap.dedent( 314s """ 314s cmake_minimum_required(VERSION 3.5.0) 314s project(hybrid NONE) 314s set(build_dir ${{CMAKE_BINARY_DIR}}) 314s 314s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 314s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 314s {c_off} install( 314s {c_off} FILES 314s {c_off} ${{build_dir}}/__init__.py 314s {c_off} ${{build_dir}}/cmake.py 314s {c_off} DESTINATION cmake 314s {c_off} ) 314s 314s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 314s {cm_off} install( 314s {cm_off} FILES ${{build_dir}}/cmakeModule.py 314s {cm_off} DESTINATION .) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 314s {h_off} DESTINATION hybrid/data) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 314s {h_off} DESTINATION hybrid/hybrid_2) 314s 314s install(CODE "message(STATUS \\\"Installation complete\\\")") 314s """.format( 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s ) 314s ) 314s ) 314s 314s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 314s path_types: Sequence[str] 314s try: 314s path_types = next( 314s iter( 314s zip( 314s *filter( 314s lambda i: i[1], 314s [ 314s ("c", has_cmake_package), 314s ("cm", has_cmake_module), 314s ("h", has_hybrid_package), 314s ("p", has_pure_package), 314s ("pm", has_pure_module), 314s ], 314s ) 314s ) 314s ) 314s ) 314s except StopIteration: 314s path_types = [] 314s 314s def select_paths(annotated_paths): 314s """Return a filtered list paths considering ``path_types``. 314s 314s `annotated_paths`` is list of tuple ``(type, path)`` where type 314s is either `c`, 'cm', `h`, `p` or 'pm'. 314s 314s """ 314s return filter(lambda i: i[0] in path_types, annotated_paths) 314s 314s # Commented paths are the one expected to be installed by CMake. For 314s # this reason, corresponding files should NOT be created in the source 314s # tree. 314s for _type, path in select_paths( 314s [ 314s # ('c', 'cmake/__init__.py'), 314s # ('c', 'cmake/cmake.py'), 314s # ('cm', 'cmakeModule.py'), 314s ("h", "hybrid/__init__.py"), 314s # ('h', 'hybrid/hybrid_cmake.dat'), 314s # ('h', 'hybrid/hybrid_cmake.py'), 314s ("h", "hybrid/hybrid_pure.dat"), 314s ("h", "hybrid/hybrid_pure.py"), 314s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 314s ("h", "hybrid/data/hybrid_data_pure.dat"), 314s ("h", "hybrid/hybrid_2/__init__.py"), 314s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 314s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 314s ("p", "hybrid/hybrid_2_pure/__init__.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 314s ("pm", "pureModule.py"), 314s ("p", "pure/__init__.py"), 314s ("p", "pure/pure.py"), 314s ("p", "pure/data/pure.dat"), 314s ] 314s ): 314s assert _type in {"p", "pm", "h"} 314s root = package_base if _type in {"p", "pm"} else cmake_source_dir 314s tmp_dir.ensure(os.path.join(root, path)) 314s 314s # Do not call the real setup function. Instead, replace it with 314s # a MagicMock allowing to check with which arguments it was invoked. 314s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 314s 314s # Convenience print function 314s def _pprint(desc, value=None): 314s print( 314s "-----------------\n" 314s f"{desc}:\n" 314s "\n" 314s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 314s ) 314s 314s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 314s 314s _pprint = ._pprint at 0xf3377a78> 314s _type = 'pm' 314s cmake_source_dir = '' 314s has_cmake_module = 0 314s has_cmake_package = 1 314s has_hybrid_package = 1 314s has_pure_module = 1 314s has_pure_package = 0 314s mock_setup = 314s mocker = 314s package_base = '' 314s package_base_dir = '' 314s path = 'pureModule.py' 314s path_types = ('c', 'h', 'pm') 314s root = '' 314s select_paths = .select_paths at 0xf3389c58> 314s src_dir = local('/tmp/pytest-of-ubuntu/pytest-103/test_setup_inputs0') 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-103/test_setup_inputs0') 314s with_package_base = 0 314s 314s tests/test_setup.py:849: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-103/test_setup_inputs0') 314s setup_args = ['build'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-103/test_setup_inputs0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s ________________________ test_setup_inputs[0-1-0-1-1-0] ________________________ 314s 314s has_cmake_package = 0, has_cmake_module = 1, has_hybrid_package = 1 314s has_pure_package = 0, has_pure_module = 1, with_package_base = 0 314s mocker = 314s 314s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 314s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 314s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_module", [0, 1]) 314s @pytest.mark.parametrize("with_package_base", [0, 1]) 314s def test_setup_inputs( 314s has_cmake_package, 314s has_cmake_module, 314s has_hybrid_package, 314s has_pure_package, 314s has_pure_module, 314s with_package_base, 314s mocker, 314s ): 314s """This test that a project can have a package with some modules 314s installed using setup.py and some other modules installed using CMake. 314s """ 314s 314s tmp_dir = _tmpdir("test_setup_inputs") 314s 314s package_base = "to/the/base" if with_package_base else "" 314s package_base_dir = package_base + "/" if package_base else "" 314s cmake_source_dir = package_base 314s 314s if cmake_source_dir and (has_cmake_package or has_cmake_module): 314s pytest.skip( 314s "unsupported configuration: " 314s "python package fully generated by CMake does *NOT* work. " 314s "At least __init__.py should be in the project source tree" 314s ) 314s 314s # ------------------------------------------------------------------------- 314s # Here is the "SOURCE" tree layout: 314s # 314s # ROOT/ 314s # 314s # setup.py 314s # 314s # [/] 314s # 314s # pureModule.py 314s # 314s # pure/ 314s # __init__.py 314s # pure.py 314s # 314s # data/ 314s # pure.dat 314s # 314s # [/] 314s # 314s # hybrid/ 314s # CMakeLists.txt 314s # __init__.py 314s # hybrid_pure.dat 314s # hybrid_pure.py 314s # 314s # data/ 314s # hybrid_data_pure.dat 314s # 314s # hybrid_2/ 314s # __init__.py 314s # hybrid_2_pure.py 314s # 314s # hybrid_2_pure/ 314s # __init__.py 314s # hybrid_2_pure_1.py 314s # hybrid_2_pure_2.py 314s # 314s # 314s # ------------------------------------------------------------------------- 314s # and here is the "BINARY" distribution layout: 314s # 314s # The comment "CMake" or "Setuptools" indicates which tool is responsible 314s # for placing the file in the tree used to create the binary distribution. 314s # 314s # ROOT/ 314s # 314s # cmakeModule.py # CMake 314s # 314s # cmake/ 314s # __init__.py # CMake 314s # cmake.py # CMake 314s # 314s # hybrid/ 314s # hybrid_cmake.dat # CMake 314s # hybrid_cmake.py # CMake 314s # hybrid_pure.dat # Setuptools 314s # hybrid_pure.py # Setuptools 314s # 314s # data/ 314s # hybrid_data_pure.dat # CMake or Setuptools 314s # hybrid_data_cmake.dat # CMake *NO TEST* 314s # 314s # hybrid_2/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure.py # CMake or Setuptools 314s # hybrid_2_cmake.py # CMake 314s # 314s # hybrid_2_pure/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure_1.py # CMake or Setuptools 314s # hybrid_2_pure_2.py # CMake or Setuptools 314s # 314s # pureModule.py # Setuptools 314s # 314s # pure/ 314s # __init__.py # Setuptools 314s # pure.py # Setuptools 314s # 314s # data/ 314s # pure.dat # Setuptools 314s 314s tmp_dir.join("setup.py").write( 314s textwrap.dedent( 314s """ 314s from skbuild import setup 314s #from setuptools import setup 314s setup( 314s name="test_hybrid_project", 314s version="1.2.3", 314s description=("an hybrid package mixing files installed by both " 314s "CMake and setuptools"), 314s author='The scikit-build team', 314s license="MIT", 314s cmake_source_dir='{cmake_source_dir}', 314s cmake_install_dir='{cmake_install_dir}', 314s # Arbitrary order of packages 314s packages=[ 314s {p_off} 'pure', 314s {h_off} 'hybrid.hybrid_2', 314s {h_off} 'hybrid', 314s {c_off} 'cmake', 314s {p_off} 'hybrid.hybrid_2_pure', 314s ], 314s py_modules=[ 314s {pm_off} '{package_base}pureModule', 314s {cm_off} '{package_base}cmakeModule', 314s ], 314s package_data={{ 314s {p_off} 'pure': ['data/pure.dat'], 314s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 314s }}, 314s # Arbitrary order of package_dir 314s package_dir = {{ 314s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 314s {p_off} 'pure': '{package_base}pure', 314s {h_off} 'hybrid': '{package_base}hybrid', 314s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 314s {c_off} 'cmake': '{package_base}cmake', 314s }} 314s ) 314s """.format( 314s cmake_source_dir=cmake_source_dir, 314s cmake_install_dir=package_base, 314s package_base=package_base_dir, 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s p_off="" if has_pure_package else "#", 314s pm_off="" if has_pure_module else "#", 314s ) 314s ) 314s ) 314s 314s src_dir = tmp_dir.ensure(package_base, dir=1) 314s 314s src_dir.join("CMakeLists.txt").write( 314s textwrap.dedent( 314s """ 314s cmake_minimum_required(VERSION 3.5.0) 314s project(hybrid NONE) 314s set(build_dir ${{CMAKE_BINARY_DIR}}) 314s 314s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 314s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 314s {c_off} install( 314s {c_off} FILES 314s {c_off} ${{build_dir}}/__init__.py 314s {c_off} ${{build_dir}}/cmake.py 314s {c_off} DESTINATION cmake 314s {c_off} ) 314s 314s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 314s {cm_off} install( 314s {cm_off} FILES ${{build_dir}}/cmakeModule.py 314s {cm_off} DESTINATION .) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 314s {h_off} DESTINATION hybrid/data) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 314s {h_off} DESTINATION hybrid/hybrid_2) 314s 314s install(CODE "message(STATUS \\\"Installation complete\\\")") 314s """.format( 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s ) 314s ) 314s ) 314s 314s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 314s path_types: Sequence[str] 314s try: 314s path_types = next( 314s iter( 314s zip( 314s *filter( 314s lambda i: i[1], 314s [ 314s ("c", has_cmake_package), 314s ("cm", has_cmake_module), 314s ("h", has_hybrid_package), 314s ("p", has_pure_package), 314s ("pm", has_pure_module), 314s ], 314s ) 314s ) 314s ) 314s ) 314s except StopIteration: 314s path_types = [] 314s 314s def select_paths(annotated_paths): 314s """Return a filtered list paths considering ``path_types``. 314s 314s `annotated_paths`` is list of tuple ``(type, path)`` where type 314s is either `c`, 'cm', `h`, `p` or 'pm'. 314s 314s """ 314s return filter(lambda i: i[0] in path_types, annotated_paths) 314s 314s # Commented paths are the one expected to be installed by CMake. For 314s # this reason, corresponding files should NOT be created in the source 314s # tree. 314s for _type, path in select_paths( 314s [ 314s # ('c', 'cmake/__init__.py'), 314s # ('c', 'cmake/cmake.py'), 314s # ('cm', 'cmakeModule.py'), 314s ("h", "hybrid/__init__.py"), 314s # ('h', 'hybrid/hybrid_cmake.dat'), 314s # ('h', 'hybrid/hybrid_cmake.py'), 314s ("h", "hybrid/hybrid_pure.dat"), 314s ("h", "hybrid/hybrid_pure.py"), 314s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 314s ("h", "hybrid/data/hybrid_data_pure.dat"), 314s ("h", "hybrid/hybrid_2/__init__.py"), 314s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 314s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 314s ("p", "hybrid/hybrid_2_pure/__init__.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 314s ("pm", "pureModule.py"), 314s ("p", "pure/__init__.py"), 314s ("p", "pure/pure.py"), 314s ("p", "pure/data/pure.dat"), 314s ] 314s ): 314s assert _type in {"p", "pm", "h"} 314s root = package_base if _type in {"p", "pm"} else cmake_source_dir 314s tmp_dir.ensure(os.path.join(root, path)) 314s 314s # Do not call the real setup function. Instead, replace it with 314s # a MagicMock allowing to check with which arguments it was invoked. 314s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 314s 314s # Convenience print function 314s def _pprint(desc, value=None): 314s print( 314s "-----------------\n" 314s f"{desc}:\n" 314s "\n" 314s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 314s ) 314s 314s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 314s 314s _pprint = ._pprint at 0xf3377ac8> 314s _type = 'pm' 314s cmake_source_dir = '' 314s has_cmake_module = 1 314s has_cmake_package = 0 314s has_hybrid_package = 1 314s has_pure_module = 1 314s has_pure_package = 0 314s mock_setup = 314s mocker = 314s package_base = '' 314s package_base_dir = '' 314s path = 'pureModule.py' 314s path_types = ('cm', 'h', 'pm') 314s root = '' 314s select_paths = .select_paths at 0xf3377b18> 314s src_dir = local('/tmp/pytest-of-ubuntu/pytest-104/test_setup_inputs0') 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-104/test_setup_inputs0') 314s with_package_base = 0 314s 314s tests/test_setup.py:849: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-104/test_setup_inputs0') 314s setup_args = ['build'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-104/test_setup_inputs0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s ________________________ test_setup_inputs[0-1-0-1-1-1] ________________________ 314s 314s has_cmake_package = 1, has_cmake_module = 1, has_hybrid_package = 1 314s has_pure_package = 0, has_pure_module = 1, with_package_base = 0 314s mocker = 314s 314s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 314s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 314s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_module", [0, 1]) 314s @pytest.mark.parametrize("with_package_base", [0, 1]) 314s def test_setup_inputs( 314s has_cmake_package, 314s has_cmake_module, 314s has_hybrid_package, 314s has_pure_package, 314s has_pure_module, 314s with_package_base, 314s mocker, 314s ): 314s """This test that a project can have a package with some modules 314s installed using setup.py and some other modules installed using CMake. 314s """ 314s 314s tmp_dir = _tmpdir("test_setup_inputs") 314s 314s package_base = "to/the/base" if with_package_base else "" 314s package_base_dir = package_base + "/" if package_base else "" 314s cmake_source_dir = package_base 314s 314s if cmake_source_dir and (has_cmake_package or has_cmake_module): 314s pytest.skip( 314s "unsupported configuration: " 314s "python package fully generated by CMake does *NOT* work. " 314s "At least __init__.py should be in the project source tree" 314s ) 314s 314s # ------------------------------------------------------------------------- 314s # Here is the "SOURCE" tree layout: 314s # 314s # ROOT/ 314s # 314s # setup.py 314s # 314s # [/] 314s # 314s # pureModule.py 314s # 314s # pure/ 314s # __init__.py 314s # pure.py 314s # 314s # data/ 314s # pure.dat 314s # 314s # [/] 314s # 314s # hybrid/ 314s # CMakeLists.txt 314s # __init__.py 314s # hybrid_pure.dat 314s # hybrid_pure.py 314s # 314s # data/ 314s # hybrid_data_pure.dat 314s # 314s # hybrid_2/ 314s # __init__.py 314s # hybrid_2_pure.py 314s # 314s # hybrid_2_pure/ 314s # __init__.py 314s # hybrid_2_pure_1.py 314s # hybrid_2_pure_2.py 314s # 314s # 314s # ------------------------------------------------------------------------- 314s # and here is the "BINARY" distribution layout: 314s # 314s # The comment "CMake" or "Setuptools" indicates which tool is responsible 314s # for placing the file in the tree used to create the binary distribution. 314s # 314s # ROOT/ 314s # 314s # cmakeModule.py # CMake 314s # 314s # cmake/ 314s # __init__.py # CMake 314s # cmake.py # CMake 314s # 314s # hybrid/ 314s # hybrid_cmake.dat # CMake 314s # hybrid_cmake.py # CMake 314s # hybrid_pure.dat # Setuptools 314s # hybrid_pure.py # Setuptools 314s # 314s # data/ 314s # hybrid_data_pure.dat # CMake or Setuptools 314s # hybrid_data_cmake.dat # CMake *NO TEST* 314s # 314s # hybrid_2/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure.py # CMake or Setuptools 314s # hybrid_2_cmake.py # CMake 314s # 314s # hybrid_2_pure/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure_1.py # CMake or Setuptools 314s # hybrid_2_pure_2.py # CMake or Setuptools 314s # 314s # pureModule.py # Setuptools 314s # 314s # pure/ 314s # __init__.py # Setuptools 314s # pure.py # Setuptools 314s # 314s # data/ 314s # pure.dat # Setuptools 314s 314s tmp_dir.join("setup.py").write( 314s textwrap.dedent( 314s """ 314s from skbuild import setup 314s #from setuptools import setup 314s setup( 314s name="test_hybrid_project", 314s version="1.2.3", 314s description=("an hybrid package mixing files installed by both " 314s "CMake and setuptools"), 314s author='The scikit-build team', 314s license="MIT", 314s cmake_source_dir='{cmake_source_dir}', 314s cmake_install_dir='{cmake_install_dir}', 314s # Arbitrary order of packages 314s packages=[ 314s {p_off} 'pure', 314s {h_off} 'hybrid.hybrid_2', 314s {h_off} 'hybrid', 314s {c_off} 'cmake', 314s {p_off} 'hybrid.hybrid_2_pure', 314s ], 314s py_modules=[ 314s {pm_off} '{package_base}pureModule', 314s {cm_off} '{package_base}cmakeModule', 314s ], 314s package_data={{ 314s {p_off} 'pure': ['data/pure.dat'], 314s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 314s }}, 314s # Arbitrary order of package_dir 314s package_dir = {{ 314s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 314s {p_off} 'pure': '{package_base}pure', 314s {h_off} 'hybrid': '{package_base}hybrid', 314s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 314s {c_off} 'cmake': '{package_base}cmake', 314s }} 314s ) 314s """.format( 314s cmake_source_dir=cmake_source_dir, 314s cmake_install_dir=package_base, 314s package_base=package_base_dir, 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s p_off="" if has_pure_package else "#", 314s pm_off="" if has_pure_module else "#", 314s ) 314s ) 314s ) 314s 314s src_dir = tmp_dir.ensure(package_base, dir=1) 314s 314s src_dir.join("CMakeLists.txt").write( 314s textwrap.dedent( 314s """ 314s cmake_minimum_required(VERSION 3.5.0) 314s project(hybrid NONE) 314s set(build_dir ${{CMAKE_BINARY_DIR}}) 314s 314s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 314s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 314s {c_off} install( 314s {c_off} FILES 314s {c_off} ${{build_dir}}/__init__.py 314s {c_off} ${{build_dir}}/cmake.py 314s {c_off} DESTINATION cmake 314s {c_off} ) 314s 314s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 314s {cm_off} install( 314s {cm_off} FILES ${{build_dir}}/cmakeModule.py 314s {cm_off} DESTINATION .) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 314s {h_off} DESTINATION hybrid/data) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 314s {h_off} DESTINATION hybrid/hybrid_2) 314s 314s install(CODE "message(STATUS \\\"Installation complete\\\")") 314s """.format( 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s ) 314s ) 314s ) 314s 314s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 314s path_types: Sequence[str] 314s try: 314s path_types = next( 314s iter( 314s zip( 314s *filter( 314s lambda i: i[1], 314s [ 314s ("c", has_cmake_package), 314s ("cm", has_cmake_module), 314s ("h", has_hybrid_package), 314s ("p", has_pure_package), 314s ("pm", has_pure_module), 314s ], 314s ) 314s ) 314s ) 314s ) 314s except StopIteration: 314s path_types = [] 314s 314s def select_paths(annotated_paths): 314s """Return a filtered list paths considering ``path_types``. 314s 314s `annotated_paths`` is list of tuple ``(type, path)`` where type 314s is either `c`, 'cm', `h`, `p` or 'pm'. 314s 314s """ 314s return filter(lambda i: i[0] in path_types, annotated_paths) 314s 314s # Commented paths are the one expected to be installed by CMake. For 314s # this reason, corresponding files should NOT be created in the source 314s # tree. 314s for _type, path in select_paths( 314s [ 314s # ('c', 'cmake/__init__.py'), 314s # ('c', 'cmake/cmake.py'), 314s # ('cm', 'cmakeModule.py'), 314s ("h", "hybrid/__init__.py"), 314s # ('h', 'hybrid/hybrid_cmake.dat'), 314s # ('h', 'hybrid/hybrid_cmake.py'), 314s ("h", "hybrid/hybrid_pure.dat"), 314s ("h", "hybrid/hybrid_pure.py"), 314s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 314s ("h", "hybrid/data/hybrid_data_pure.dat"), 314s ("h", "hybrid/hybrid_2/__init__.py"), 314s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 314s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 314s ("p", "hybrid/hybrid_2_pure/__init__.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 314s ("pm", "pureModule.py"), 314s ("p", "pure/__init__.py"), 314s ("p", "pure/pure.py"), 314s ("p", "pure/data/pure.dat"), 314s ] 314s ): 314s assert _type in {"p", "pm", "h"} 314s root = package_base if _type in {"p", "pm"} else cmake_source_dir 314s tmp_dir.ensure(os.path.join(root, path)) 314s 314s # Do not call the real setup function. Instead, replace it with 314s # a MagicMock allowing to check with which arguments it was invoked. 314s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 314s 314s # Convenience print function 314s def _pprint(desc, value=None): 314s print( 314s "-----------------\n" 314s f"{desc}:\n" 314s "\n" 314s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 314s ) 314s 314s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 314s 314s _pprint = ._pprint at 0xf335bd98> 314s _type = 'pm' 314s cmake_source_dir = '' 314s has_cmake_module = 1 314s has_cmake_package = 1 314s has_hybrid_package = 1 314s has_pure_module = 1 314s has_pure_package = 0 314s mock_setup = 314s mocker = 314s package_base = '' 314s package_base_dir = '' 314s path = 'pureModule.py' 314s path_types = ('c', 'cm', 'h', 'pm') 314s root = '' 314s select_paths = .select_paths at 0xf337fca8> 314s src_dir = local('/tmp/pytest-of-ubuntu/pytest-105/test_setup_inputs0') 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-105/test_setup_inputs0') 314s with_package_base = 0 314s 314s tests/test_setup.py:849: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-105/test_setup_inputs0') 314s setup_args = ['build'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-105/test_setup_inputs0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s ________________________ test_setup_inputs[0-1-1-0-0-0] ________________________ 314s 314s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 0 314s has_pure_package = 1, has_pure_module = 1, with_package_base = 0 314s mocker = 314s 314s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 314s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 314s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_module", [0, 1]) 314s @pytest.mark.parametrize("with_package_base", [0, 1]) 314s def test_setup_inputs( 314s has_cmake_package, 314s has_cmake_module, 314s has_hybrid_package, 314s has_pure_package, 314s has_pure_module, 314s with_package_base, 314s mocker, 314s ): 314s """This test that a project can have a package with some modules 314s installed using setup.py and some other modules installed using CMake. 314s """ 314s 314s tmp_dir = _tmpdir("test_setup_inputs") 314s 314s package_base = "to/the/base" if with_package_base else "" 314s package_base_dir = package_base + "/" if package_base else "" 314s cmake_source_dir = package_base 314s 314s if cmake_source_dir and (has_cmake_package or has_cmake_module): 314s pytest.skip( 314s "unsupported configuration: " 314s "python package fully generated by CMake does *NOT* work. " 314s "At least __init__.py should be in the project source tree" 314s ) 314s 314s # ------------------------------------------------------------------------- 314s # Here is the "SOURCE" tree layout: 314s # 314s # ROOT/ 314s # 314s # setup.py 314s # 314s # [/] 314s # 314s # pureModule.py 314s # 314s # pure/ 314s # __init__.py 314s # pure.py 314s # 314s # data/ 314s # pure.dat 314s # 314s # [/] 314s # 314s # hybrid/ 314s # CMakeLists.txt 314s # __init__.py 314s # hybrid_pure.dat 314s # hybrid_pure.py 314s # 314s # data/ 314s # hybrid_data_pure.dat 314s # 314s # hybrid_2/ 314s # __init__.py 314s # hybrid_2_pure.py 314s # 314s # hybrid_2_pure/ 314s # __init__.py 314s # hybrid_2_pure_1.py 314s # hybrid_2_pure_2.py 314s # 314s # 314s # ------------------------------------------------------------------------- 314s # and here is the "BINARY" distribution layout: 314s # 314s # The comment "CMake" or "Setuptools" indicates which tool is responsible 314s # for placing the file in the tree used to create the binary distribution. 314s # 314s # ROOT/ 314s # 314s # cmakeModule.py # CMake 314s # 314s # cmake/ 314s # __init__.py # CMake 314s # cmake.py # CMake 314s # 314s # hybrid/ 314s # hybrid_cmake.dat # CMake 314s # hybrid_cmake.py # CMake 314s # hybrid_pure.dat # Setuptools 314s # hybrid_pure.py # Setuptools 314s # 314s # data/ 314s # hybrid_data_pure.dat # CMake or Setuptools 314s # hybrid_data_cmake.dat # CMake *NO TEST* 314s # 314s # hybrid_2/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure.py # CMake or Setuptools 314s # hybrid_2_cmake.py # CMake 314s # 314s # hybrid_2_pure/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure_1.py # CMake or Setuptools 314s # hybrid_2_pure_2.py # CMake or Setuptools 314s # 314s # pureModule.py # Setuptools 314s # 314s # pure/ 314s # __init__.py # Setuptools 314s # pure.py # Setuptools 314s # 314s # data/ 314s # pure.dat # Setuptools 314s 314s tmp_dir.join("setup.py").write( 314s textwrap.dedent( 314s """ 314s from skbuild import setup 314s #from setuptools import setup 314s setup( 314s name="test_hybrid_project", 314s version="1.2.3", 314s description=("an hybrid package mixing files installed by both " 314s "CMake and setuptools"), 314s author='The scikit-build team', 314s license="MIT", 314s cmake_source_dir='{cmake_source_dir}', 314s cmake_install_dir='{cmake_install_dir}', 314s # Arbitrary order of packages 314s packages=[ 314s {p_off} 'pure', 314s {h_off} 'hybrid.hybrid_2', 314s {h_off} 'hybrid', 314s {c_off} 'cmake', 314s {p_off} 'hybrid.hybrid_2_pure', 314s ], 314s py_modules=[ 314s {pm_off} '{package_base}pureModule', 314s {cm_off} '{package_base}cmakeModule', 314s ], 314s package_data={{ 314s {p_off} 'pure': ['data/pure.dat'], 314s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 314s }}, 314s # Arbitrary order of package_dir 314s package_dir = {{ 314s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 314s {p_off} 'pure': '{package_base}pure', 314s {h_off} 'hybrid': '{package_base}hybrid', 314s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 314s {c_off} 'cmake': '{package_base}cmake', 314s }} 314s ) 314s """.format( 314s cmake_source_dir=cmake_source_dir, 314s cmake_install_dir=package_base, 314s package_base=package_base_dir, 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s p_off="" if has_pure_package else "#", 314s pm_off="" if has_pure_module else "#", 314s ) 314s ) 314s ) 314s 314s src_dir = tmp_dir.ensure(package_base, dir=1) 314s 314s src_dir.join("CMakeLists.txt").write( 314s textwrap.dedent( 314s """ 314s cmake_minimum_required(VERSION 3.5.0) 314s project(hybrid NONE) 314s set(build_dir ${{CMAKE_BINARY_DIR}}) 314s 314s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 314s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 314s {c_off} install( 314s {c_off} FILES 314s {c_off} ${{build_dir}}/__init__.py 314s {c_off} ${{build_dir}}/cmake.py 314s {c_off} DESTINATION cmake 314s {c_off} ) 314s 314s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 314s {cm_off} install( 314s {cm_off} FILES ${{build_dir}}/cmakeModule.py 314s {cm_off} DESTINATION .) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 314s {h_off} DESTINATION hybrid/data) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 314s {h_off} DESTINATION hybrid/hybrid_2) 314s 314s install(CODE "message(STATUS \\\"Installation complete\\\")") 314s """.format( 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s ) 314s ) 314s ) 314s 314s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 314s path_types: Sequence[str] 314s try: 314s path_types = next( 314s iter( 314s zip( 314s *filter( 314s lambda i: i[1], 314s [ 314s ("c", has_cmake_package), 314s ("cm", has_cmake_module), 314s ("h", has_hybrid_package), 314s ("p", has_pure_package), 314s ("pm", has_pure_module), 314s ], 314s ) 314s ) 314s ) 314s ) 314s except StopIteration: 314s path_types = [] 314s 314s def select_paths(annotated_paths): 314s """Return a filtered list paths considering ``path_types``. 314s 314s `annotated_paths`` is list of tuple ``(type, path)`` where type 314s is either `c`, 'cm', `h`, `p` or 'pm'. 314s 314s """ 314s return filter(lambda i: i[0] in path_types, annotated_paths) 314s 314s # Commented paths are the one expected to be installed by CMake. For 314s # this reason, corresponding files should NOT be created in the source 314s # tree. 314s for _type, path in select_paths( 314s [ 314s # ('c', 'cmake/__init__.py'), 314s # ('c', 'cmake/cmake.py'), 314s # ('cm', 'cmakeModule.py'), 314s ("h", "hybrid/__init__.py"), 314s # ('h', 'hybrid/hybrid_cmake.dat'), 314s # ('h', 'hybrid/hybrid_cmake.py'), 314s ("h", "hybrid/hybrid_pure.dat"), 314s ("h", "hybrid/hybrid_pure.py"), 314s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 314s ("h", "hybrid/data/hybrid_data_pure.dat"), 314s ("h", "hybrid/hybrid_2/__init__.py"), 314s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 314s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 314s ("p", "hybrid/hybrid_2_pure/__init__.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 314s ("pm", "pureModule.py"), 314s ("p", "pure/__init__.py"), 314s ("p", "pure/pure.py"), 314s ("p", "pure/data/pure.dat"), 314s ] 314s ): 314s assert _type in {"p", "pm", "h"} 314s root = package_base if _type in {"p", "pm"} else cmake_source_dir 314s tmp_dir.ensure(os.path.join(root, path)) 314s 314s # Do not call the real setup function. Instead, replace it with 314s # a MagicMock allowing to check with which arguments it was invoked. 314s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 314s 314s # Convenience print function 314s def _pprint(desc, value=None): 314s print( 314s "-----------------\n" 314s f"{desc}:\n" 314s "\n" 314s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 314s ) 314s 314s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 314s 314s _pprint = ._pprint at 0xf335bac8> 314s _type = 'p' 314s cmake_source_dir = '' 314s has_cmake_module = 0 314s has_cmake_package = 0 314s has_hybrid_package = 0 314s has_pure_module = 1 314s has_pure_package = 1 314s mock_setup = 314s mocker = 314s package_base = '' 314s package_base_dir = '' 314s path = 'pure/data/pure.dat' 314s path_types = ('p', 'pm') 314s root = '' 314s select_paths = .select_paths at 0xf335be38> 314s src_dir = local('/tmp/pytest-of-ubuntu/pytest-106/test_setup_inputs0') 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-106/test_setup_inputs0') 314s with_package_base = 0 314s 314s tests/test_setup.py:849: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-106/test_setup_inputs0') 314s setup_args = ['build'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-106/test_setup_inputs0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s ________________________ test_setup_inputs[0-1-1-0-0-1] ________________________ 314s 314s has_cmake_package = 1, has_cmake_module = 0, has_hybrid_package = 0 314s has_pure_package = 1, has_pure_module = 1, with_package_base = 0 314s mocker = 314s 314s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 314s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 314s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_module", [0, 1]) 314s @pytest.mark.parametrize("with_package_base", [0, 1]) 314s def test_setup_inputs( 314s has_cmake_package, 314s has_cmake_module, 314s has_hybrid_package, 314s has_pure_package, 314s has_pure_module, 314s with_package_base, 314s mocker, 314s ): 314s """This test that a project can have a package with some modules 314s installed using setup.py and some other modules installed using CMake. 314s """ 314s 314s tmp_dir = _tmpdir("test_setup_inputs") 314s 314s package_base = "to/the/base" if with_package_base else "" 314s package_base_dir = package_base + "/" if package_base else "" 314s cmake_source_dir = package_base 314s 314s if cmake_source_dir and (has_cmake_package or has_cmake_module): 314s pytest.skip( 314s "unsupported configuration: " 314s "python package fully generated by CMake does *NOT* work. " 314s "At least __init__.py should be in the project source tree" 314s ) 314s 314s # ------------------------------------------------------------------------- 314s # Here is the "SOURCE" tree layout: 314s # 314s # ROOT/ 314s # 314s # setup.py 314s # 314s # [/] 314s # 314s # pureModule.py 314s # 314s # pure/ 314s # __init__.py 314s # pure.py 314s # 314s # data/ 314s # pure.dat 314s # 314s # [/] 314s # 314s # hybrid/ 314s # CMakeLists.txt 314s # __init__.py 314s # hybrid_pure.dat 314s # hybrid_pure.py 314s # 314s # data/ 314s # hybrid_data_pure.dat 314s # 314s # hybrid_2/ 314s # __init__.py 314s # hybrid_2_pure.py 314s # 314s # hybrid_2_pure/ 314s # __init__.py 314s # hybrid_2_pure_1.py 314s # hybrid_2_pure_2.py 314s # 314s # 314s # ------------------------------------------------------------------------- 314s # and here is the "BINARY" distribution layout: 314s # 314s # The comment "CMake" or "Setuptools" indicates which tool is responsible 314s # for placing the file in the tree used to create the binary distribution. 314s # 314s # ROOT/ 314s # 314s # cmakeModule.py # CMake 314s # 314s # cmake/ 314s # __init__.py # CMake 314s # cmake.py # CMake 314s # 314s # hybrid/ 314s # hybrid_cmake.dat # CMake 314s # hybrid_cmake.py # CMake 314s # hybrid_pure.dat # Setuptools 314s # hybrid_pure.py # Setuptools 314s # 314s # data/ 314s # hybrid_data_pure.dat # CMake or Setuptools 314s # hybrid_data_cmake.dat # CMake *NO TEST* 314s # 314s # hybrid_2/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure.py # CMake or Setuptools 314s # hybrid_2_cmake.py # CMake 314s # 314s # hybrid_2_pure/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure_1.py # CMake or Setuptools 314s # hybrid_2_pure_2.py # CMake or Setuptools 314s # 314s # pureModule.py # Setuptools 314s # 314s # pure/ 314s # __init__.py # Setuptools 314s # pure.py # Setuptools 314s # 314s # data/ 314s # pure.dat # Setuptools 314s 314s tmp_dir.join("setup.py").write( 314s textwrap.dedent( 314s """ 314s from skbuild import setup 314s #from setuptools import setup 314s setup( 314s name="test_hybrid_project", 314s version="1.2.3", 314s description=("an hybrid package mixing files installed by both " 314s "CMake and setuptools"), 314s author='The scikit-build team', 314s license="MIT", 314s cmake_source_dir='{cmake_source_dir}', 314s cmake_install_dir='{cmake_install_dir}', 314s # Arbitrary order of packages 314s packages=[ 314s {p_off} 'pure', 314s {h_off} 'hybrid.hybrid_2', 314s {h_off} 'hybrid', 314s {c_off} 'cmake', 314s {p_off} 'hybrid.hybrid_2_pure', 314s ], 314s py_modules=[ 314s {pm_off} '{package_base}pureModule', 314s {cm_off} '{package_base}cmakeModule', 314s ], 314s package_data={{ 314s {p_off} 'pure': ['data/pure.dat'], 314s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 314s }}, 314s # Arbitrary order of package_dir 314s package_dir = {{ 314s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 314s {p_off} 'pure': '{package_base}pure', 314s {h_off} 'hybrid': '{package_base}hybrid', 314s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 314s {c_off} 'cmake': '{package_base}cmake', 314s }} 314s ) 314s """.format( 314s cmake_source_dir=cmake_source_dir, 314s cmake_install_dir=package_base, 314s package_base=package_base_dir, 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s p_off="" if has_pure_package else "#", 314s pm_off="" if has_pure_module else "#", 314s ) 314s ) 314s ) 314s 314s src_dir = tmp_dir.ensure(package_base, dir=1) 314s 314s src_dir.join("CMakeLists.txt").write( 314s textwrap.dedent( 314s """ 314s cmake_minimum_required(VERSION 3.5.0) 314s project(hybrid NONE) 314s set(build_dir ${{CMAKE_BINARY_DIR}}) 314s 314s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 314s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 314s {c_off} install( 314s {c_off} FILES 314s {c_off} ${{build_dir}}/__init__.py 314s {c_off} ${{build_dir}}/cmake.py 314s {c_off} DESTINATION cmake 314s {c_off} ) 314s 314s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 314s {cm_off} install( 314s {cm_off} FILES ${{build_dir}}/cmakeModule.py 314s {cm_off} DESTINATION .) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 314s {h_off} DESTINATION hybrid/data) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 314s {h_off} DESTINATION hybrid/hybrid_2) 314s 314s install(CODE "message(STATUS \\\"Installation complete\\\")") 314s """.format( 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s ) 314s ) 314s ) 314s 314s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 314s path_types: Sequence[str] 314s try: 314s path_types = next( 314s iter( 314s zip( 314s *filter( 314s lambda i: i[1], 314s [ 314s ("c", has_cmake_package), 314s ("cm", has_cmake_module), 314s ("h", has_hybrid_package), 314s ("p", has_pure_package), 314s ("pm", has_pure_module), 314s ], 314s ) 314s ) 314s ) 314s ) 314s except StopIteration: 314s path_types = [] 314s 314s def select_paths(annotated_paths): 314s """Return a filtered list paths considering ``path_types``. 314s 314s `annotated_paths`` is list of tuple ``(type, path)`` where type 314s is either `c`, 'cm', `h`, `p` or 'pm'. 314s 314s """ 314s return filter(lambda i: i[0] in path_types, annotated_paths) 314s 314s # Commented paths are the one expected to be installed by CMake. For 314s # this reason, corresponding files should NOT be created in the source 314s # tree. 314s for _type, path in select_paths( 314s [ 314s # ('c', 'cmake/__init__.py'), 314s # ('c', 'cmake/cmake.py'), 314s # ('cm', 'cmakeModule.py'), 314s ("h", "hybrid/__init__.py"), 314s # ('h', 'hybrid/hybrid_cmake.dat'), 314s # ('h', 'hybrid/hybrid_cmake.py'), 314s ("h", "hybrid/hybrid_pure.dat"), 314s ("h", "hybrid/hybrid_pure.py"), 314s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 314s ("h", "hybrid/data/hybrid_data_pure.dat"), 314s ("h", "hybrid/hybrid_2/__init__.py"), 314s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 314s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 314s ("p", "hybrid/hybrid_2_pure/__init__.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 314s ("pm", "pureModule.py"), 314s ("p", "pure/__init__.py"), 314s ("p", "pure/pure.py"), 314s ("p", "pure/data/pure.dat"), 314s ] 314s ): 314s assert _type in {"p", "pm", "h"} 314s root = package_base if _type in {"p", "pm"} else cmake_source_dir 314s tmp_dir.ensure(os.path.join(root, path)) 314s 314s # Do not call the real setup function. Instead, replace it with 314s # a MagicMock allowing to check with which arguments it was invoked. 314s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 314s 314s # Convenience print function 314s def _pprint(desc, value=None): 314s print( 314s "-----------------\n" 314s f"{desc}:\n" 314s "\n" 314s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 314s ) 314s 314s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 314s 314s _pprint = ._pprint at 0xf3386cf8> 314s _type = 'p' 314s cmake_source_dir = '' 314s has_cmake_module = 0 314s has_cmake_package = 1 314s has_hybrid_package = 0 314s has_pure_module = 1 314s has_pure_package = 1 314s mock_setup = 314s mocker = 314s package_base = '' 314s package_base_dir = '' 314s path = 'pure/data/pure.dat' 314s path_types = ('c', 'p', 'pm') 314s root = '' 314s select_paths = .select_paths at 0xf3386c58> 314s src_dir = local('/tmp/pytest-of-ubuntu/pytest-107/test_setup_inputs0') 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-107/test_setup_inputs0') 314s with_package_base = 0 314s 314s tests/test_setup.py:849: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-107/test_setup_inputs0') 314s setup_args = ['build'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-107/test_setup_inputs0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s ________________________ test_setup_inputs[0-1-1-0-1-0] ________________________ 314s 314s has_cmake_package = 0, has_cmake_module = 1, has_hybrid_package = 0 314s has_pure_package = 1, has_pure_module = 1, with_package_base = 0 314s mocker = 314s 314s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 314s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 314s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_module", [0, 1]) 314s @pytest.mark.parametrize("with_package_base", [0, 1]) 314s def test_setup_inputs( 314s has_cmake_package, 314s has_cmake_module, 314s has_hybrid_package, 314s has_pure_package, 314s has_pure_module, 314s with_package_base, 314s mocker, 314s ): 314s """This test that a project can have a package with some modules 314s installed using setup.py and some other modules installed using CMake. 314s """ 314s 314s tmp_dir = _tmpdir("test_setup_inputs") 314s 314s package_base = "to/the/base" if with_package_base else "" 314s package_base_dir = package_base + "/" if package_base else "" 314s cmake_source_dir = package_base 314s 314s if cmake_source_dir and (has_cmake_package or has_cmake_module): 314s pytest.skip( 314s "unsupported configuration: " 314s "python package fully generated by CMake does *NOT* work. " 314s "At least __init__.py should be in the project source tree" 314s ) 314s 314s # ------------------------------------------------------------------------- 314s # Here is the "SOURCE" tree layout: 314s # 314s # ROOT/ 314s # 314s # setup.py 314s # 314s # [/] 314s # 314s # pureModule.py 314s # 314s # pure/ 314s # __init__.py 314s # pure.py 314s # 314s # data/ 314s # pure.dat 314s # 314s # [/] 314s # 314s # hybrid/ 314s # CMakeLists.txt 314s # __init__.py 314s # hybrid_pure.dat 314s # hybrid_pure.py 314s # 314s # data/ 314s # hybrid_data_pure.dat 314s # 314s # hybrid_2/ 314s # __init__.py 314s # hybrid_2_pure.py 314s # 314s # hybrid_2_pure/ 314s # __init__.py 314s # hybrid_2_pure_1.py 314s # hybrid_2_pure_2.py 314s # 314s # 314s # ------------------------------------------------------------------------- 314s # and here is the "BINARY" distribution layout: 314s # 314s # The comment "CMake" or "Setuptools" indicates which tool is responsible 314s # for placing the file in the tree used to create the binary distribution. 314s # 314s # ROOT/ 314s # 314s # cmakeModule.py # CMake 314s # 314s # cmake/ 314s # __init__.py # CMake 314s # cmake.py # CMake 314s # 314s # hybrid/ 314s # hybrid_cmake.dat # CMake 314s # hybrid_cmake.py # CMake 314s # hybrid_pure.dat # Setuptools 314s # hybrid_pure.py # Setuptools 314s # 314s # data/ 314s # hybrid_data_pure.dat # CMake or Setuptools 314s # hybrid_data_cmake.dat # CMake *NO TEST* 314s # 314s # hybrid_2/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure.py # CMake or Setuptools 314s # hybrid_2_cmake.py # CMake 314s # 314s # hybrid_2_pure/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure_1.py # CMake or Setuptools 314s # hybrid_2_pure_2.py # CMake or Setuptools 314s # 314s # pureModule.py # Setuptools 314s # 314s # pure/ 314s # __init__.py # Setuptools 314s # pure.py # Setuptools 314s # 314s # data/ 314s # pure.dat # Setuptools 314s 314s tmp_dir.join("setup.py").write( 314s textwrap.dedent( 314s """ 314s from skbuild import setup 314s #from setuptools import setup 314s setup( 314s name="test_hybrid_project", 314s version="1.2.3", 314s description=("an hybrid package mixing files installed by both " 314s "CMake and setuptools"), 314s author='The scikit-build team', 314s license="MIT", 314s cmake_source_dir='{cmake_source_dir}', 314s cmake_install_dir='{cmake_install_dir}', 314s # Arbitrary order of packages 314s packages=[ 314s {p_off} 'pure', 314s {h_off} 'hybrid.hybrid_2', 314s {h_off} 'hybrid', 314s {c_off} 'cmake', 314s {p_off} 'hybrid.hybrid_2_pure', 314s ], 314s py_modules=[ 314s {pm_off} '{package_base}pureModule', 314s {cm_off} '{package_base}cmakeModule', 314s ], 314s package_data={{ 314s {p_off} 'pure': ['data/pure.dat'], 314s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 314s }}, 314s # Arbitrary order of package_dir 314s package_dir = {{ 314s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 314s {p_off} 'pure': '{package_base}pure', 314s {h_off} 'hybrid': '{package_base}hybrid', 314s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 314s {c_off} 'cmake': '{package_base}cmake', 314s }} 314s ) 314s """.format( 314s cmake_source_dir=cmake_source_dir, 314s cmake_install_dir=package_base, 314s package_base=package_base_dir, 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s p_off="" if has_pure_package else "#", 314s pm_off="" if has_pure_module else "#", 314s ) 314s ) 314s ) 314s 314s src_dir = tmp_dir.ensure(package_base, dir=1) 314s 314s src_dir.join("CMakeLists.txt").write( 314s textwrap.dedent( 314s """ 314s cmake_minimum_required(VERSION 3.5.0) 314s project(hybrid NONE) 314s set(build_dir ${{CMAKE_BINARY_DIR}}) 314s 314s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 314s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 314s {c_off} install( 314s {c_off} FILES 314s {c_off} ${{build_dir}}/__init__.py 314s {c_off} ${{build_dir}}/cmake.py 314s {c_off} DESTINATION cmake 314s {c_off} ) 314s 314s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 314s {cm_off} install( 314s {cm_off} FILES ${{build_dir}}/cmakeModule.py 314s {cm_off} DESTINATION .) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 314s {h_off} DESTINATION hybrid/data) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 314s {h_off} DESTINATION hybrid/hybrid_2) 314s 314s install(CODE "message(STATUS \\\"Installation complete\\\")") 314s """.format( 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s ) 314s ) 314s ) 314s 314s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 314s path_types: Sequence[str] 314s try: 314s path_types = next( 314s iter( 314s zip( 314s *filter( 314s lambda i: i[1], 314s [ 314s ("c", has_cmake_package), 314s ("cm", has_cmake_module), 314s ("h", has_hybrid_package), 314s ("p", has_pure_package), 314s ("pm", has_pure_module), 314s ], 314s ) 314s ) 314s ) 314s ) 314s except StopIteration: 314s path_types = [] 314s 314s def select_paths(annotated_paths): 314s """Return a filtered list paths considering ``path_types``. 314s 314s `annotated_paths`` is list of tuple ``(type, path)`` where type 314s is either `c`, 'cm', `h`, `p` or 'pm'. 314s 314s """ 314s return filter(lambda i: i[0] in path_types, annotated_paths) 314s 314s # Commented paths are the one expected to be installed by CMake. For 314s # this reason, corresponding files should NOT be created in the source 314s # tree. 314s for _type, path in select_paths( 314s [ 314s # ('c', 'cmake/__init__.py'), 314s # ('c', 'cmake/cmake.py'), 314s # ('cm', 'cmakeModule.py'), 314s ("h", "hybrid/__init__.py"), 314s # ('h', 'hybrid/hybrid_cmake.dat'), 314s # ('h', 'hybrid/hybrid_cmake.py'), 314s ("h", "hybrid/hybrid_pure.dat"), 314s ("h", "hybrid/hybrid_pure.py"), 314s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 314s ("h", "hybrid/data/hybrid_data_pure.dat"), 314s ("h", "hybrid/hybrid_2/__init__.py"), 314s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 314s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 314s ("p", "hybrid/hybrid_2_pure/__init__.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 314s ("pm", "pureModule.py"), 314s ("p", "pure/__init__.py"), 314s ("p", "pure/pure.py"), 314s ("p", "pure/data/pure.dat"), 314s ] 314s ): 314s assert _type in {"p", "pm", "h"} 314s root = package_base if _type in {"p", "pm"} else cmake_source_dir 314s tmp_dir.ensure(os.path.join(root, path)) 314s 314s # Do not call the real setup function. Instead, replace it with 314s # a MagicMock allowing to check with which arguments it was invoked. 314s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 314s 314s # Convenience print function 314s def _pprint(desc, value=None): 314s print( 314s "-----------------\n" 314s f"{desc}:\n" 314s "\n" 314s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 314s ) 314s 314s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 314s 314s _pprint = ._pprint at 0xf3342e38> 314s _type = 'p' 314s cmake_source_dir = '' 314s has_cmake_module = 1 314s has_cmake_package = 0 314s has_hybrid_package = 0 314s has_pure_module = 1 314s has_pure_package = 1 314s mock_setup = 314s mocker = 314s package_base = '' 314s package_base_dir = '' 314s path = 'pure/data/pure.dat' 314s path_types = ('cm', 'p', 'pm') 314s root = '' 314s select_paths = .select_paths at 0xf329ef78> 314s src_dir = local('/tmp/pytest-of-ubuntu/pytest-108/test_setup_inputs0') 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-108/test_setup_inputs0') 314s with_package_base = 0 314s 314s tests/test_setup.py:849: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-108/test_setup_inputs0') 314s setup_args = ['build'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-108/test_setup_inputs0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s ________________________ test_setup_inputs[0-1-1-0-1-1] ________________________ 314s 314s has_cmake_package = 1, has_cmake_module = 1, has_hybrid_package = 0 314s has_pure_package = 1, has_pure_module = 1, with_package_base = 0 314s mocker = 314s 314s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 314s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 314s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_module", [0, 1]) 314s @pytest.mark.parametrize("with_package_base", [0, 1]) 314s def test_setup_inputs( 314s has_cmake_package, 314s has_cmake_module, 314s has_hybrid_package, 314s has_pure_package, 314s has_pure_module, 314s with_package_base, 314s mocker, 314s ): 314s """This test that a project can have a package with some modules 314s installed using setup.py and some other modules installed using CMake. 314s """ 314s 314s tmp_dir = _tmpdir("test_setup_inputs") 314s 314s package_base = "to/the/base" if with_package_base else "" 314s package_base_dir = package_base + "/" if package_base else "" 314s cmake_source_dir = package_base 314s 314s if cmake_source_dir and (has_cmake_package or has_cmake_module): 314s pytest.skip( 314s "unsupported configuration: " 314s "python package fully generated by CMake does *NOT* work. " 314s "At least __init__.py should be in the project source tree" 314s ) 314s 314s # ------------------------------------------------------------------------- 314s # Here is the "SOURCE" tree layout: 314s # 314s # ROOT/ 314s # 314s # setup.py 314s # 314s # [/] 314s # 314s # pureModule.py 314s # 314s # pure/ 314s # __init__.py 314s # pure.py 314s # 314s # data/ 314s # pure.dat 314s # 314s # [/] 314s # 314s # hybrid/ 314s # CMakeLists.txt 314s # __init__.py 314s # hybrid_pure.dat 314s # hybrid_pure.py 314s # 314s # data/ 314s # hybrid_data_pure.dat 314s # 314s # hybrid_2/ 314s # __init__.py 314s # hybrid_2_pure.py 314s # 314s # hybrid_2_pure/ 314s # __init__.py 314s # hybrid_2_pure_1.py 314s # hybrid_2_pure_2.py 314s # 314s # 314s # ------------------------------------------------------------------------- 314s # and here is the "BINARY" distribution layout: 314s # 314s # The comment "CMake" or "Setuptools" indicates which tool is responsible 314s # for placing the file in the tree used to create the binary distribution. 314s # 314s # ROOT/ 314s # 314s # cmakeModule.py # CMake 314s # 314s # cmake/ 314s # __init__.py # CMake 314s # cmake.py # CMake 314s # 314s # hybrid/ 314s # hybrid_cmake.dat # CMake 314s # hybrid_cmake.py # CMake 314s # hybrid_pure.dat # Setuptools 314s # hybrid_pure.py # Setuptools 314s # 314s # data/ 314s # hybrid_data_pure.dat # CMake or Setuptools 314s # hybrid_data_cmake.dat # CMake *NO TEST* 314s # 314s # hybrid_2/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure.py # CMake or Setuptools 314s # hybrid_2_cmake.py # CMake 314s # 314s # hybrid_2_pure/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure_1.py # CMake or Setuptools 314s # hybrid_2_pure_2.py # CMake or Setuptools 314s # 314s # pureModule.py # Setuptools 314s # 314s # pure/ 314s # __init__.py # Setuptools 314s # pure.py # Setuptools 314s # 314s # data/ 314s # pure.dat # Setuptools 314s 314s tmp_dir.join("setup.py").write( 314s textwrap.dedent( 314s """ 314s from skbuild import setup 314s #from setuptools import setup 314s setup( 314s name="test_hybrid_project", 314s version="1.2.3", 314s description=("an hybrid package mixing files installed by both " 314s "CMake and setuptools"), 314s author='The scikit-build team', 314s license="MIT", 314s cmake_source_dir='{cmake_source_dir}', 314s cmake_install_dir='{cmake_install_dir}', 314s # Arbitrary order of packages 314s packages=[ 314s {p_off} 'pure', 314s {h_off} 'hybrid.hybrid_2', 314s {h_off} 'hybrid', 314s {c_off} 'cmake', 314s {p_off} 'hybrid.hybrid_2_pure', 314s ], 314s py_modules=[ 314s {pm_off} '{package_base}pureModule', 314s {cm_off} '{package_base}cmakeModule', 314s ], 314s package_data={{ 314s {p_off} 'pure': ['data/pure.dat'], 314s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 314s }}, 314s # Arbitrary order of package_dir 314s package_dir = {{ 314s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 314s {p_off} 'pure': '{package_base}pure', 314s {h_off} 'hybrid': '{package_base}hybrid', 314s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 314s {c_off} 'cmake': '{package_base}cmake', 314s }} 314s ) 314s """.format( 314s cmake_source_dir=cmake_source_dir, 314s cmake_install_dir=package_base, 314s package_base=package_base_dir, 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s p_off="" if has_pure_package else "#", 314s pm_off="" if has_pure_module else "#", 314s ) 314s ) 314s ) 314s 314s src_dir = tmp_dir.ensure(package_base, dir=1) 314s 314s src_dir.join("CMakeLists.txt").write( 314s textwrap.dedent( 314s """ 314s cmake_minimum_required(VERSION 3.5.0) 314s project(hybrid NONE) 314s set(build_dir ${{CMAKE_BINARY_DIR}}) 314s 314s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 314s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 314s {c_off} install( 314s {c_off} FILES 314s {c_off} ${{build_dir}}/__init__.py 314s {c_off} ${{build_dir}}/cmake.py 314s {c_off} DESTINATION cmake 314s {c_off} ) 314s 314s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 314s {cm_off} install( 314s {cm_off} FILES ${{build_dir}}/cmakeModule.py 314s {cm_off} DESTINATION .) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 314s {h_off} DESTINATION hybrid/data) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 314s {h_off} DESTINATION hybrid/hybrid_2) 314s 314s install(CODE "message(STATUS \\\"Installation complete\\\")") 314s """.format( 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s ) 314s ) 314s ) 314s 314s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 314s path_types: Sequence[str] 314s try: 314s path_types = next( 314s iter( 314s zip( 314s *filter( 314s lambda i: i[1], 314s [ 314s ("c", has_cmake_package), 314s ("cm", has_cmake_module), 314s ("h", has_hybrid_package), 314s ("p", has_pure_package), 314s ("pm", has_pure_module), 314s ], 314s ) 314s ) 314s ) 314s ) 314s except StopIteration: 314s path_types = [] 314s 314s def select_paths(annotated_paths): 314s """Return a filtered list paths considering ``path_types``. 314s 314s `annotated_paths`` is list of tuple ``(type, path)`` where type 314s is either `c`, 'cm', `h`, `p` or 'pm'. 314s 314s """ 314s return filter(lambda i: i[0] in path_types, annotated_paths) 314s 314s # Commented paths are the one expected to be installed by CMake. For 314s # this reason, corresponding files should NOT be created in the source 314s # tree. 314s for _type, path in select_paths( 314s [ 314s # ('c', 'cmake/__init__.py'), 314s # ('c', 'cmake/cmake.py'), 314s # ('cm', 'cmakeModule.py'), 314s ("h", "hybrid/__init__.py"), 314s # ('h', 'hybrid/hybrid_cmake.dat'), 314s # ('h', 'hybrid/hybrid_cmake.py'), 314s ("h", "hybrid/hybrid_pure.dat"), 314s ("h", "hybrid/hybrid_pure.py"), 314s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 314s ("h", "hybrid/data/hybrid_data_pure.dat"), 314s ("h", "hybrid/hybrid_2/__init__.py"), 314s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 314s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 314s ("p", "hybrid/hybrid_2_pure/__init__.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 314s ("pm", "pureModule.py"), 314s ("p", "pure/__init__.py"), 314s ("p", "pure/pure.py"), 314s ("p", "pure/data/pure.dat"), 314s ] 314s ): 314s assert _type in {"p", "pm", "h"} 314s root = package_base if _type in {"p", "pm"} else cmake_source_dir 314s tmp_dir.ensure(os.path.join(root, path)) 314s 314s # Do not call the real setup function. Instead, replace it with 314s # a MagicMock allowing to check with which arguments it was invoked. 314s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 314s 314s # Convenience print function 314s def _pprint(desc, value=None): 314s print( 314s "-----------------\n" 314s f"{desc}:\n" 314s "\n" 314s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 314s ) 314s 314s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 314s 314s _pprint = ._pprint at 0xf3363a78> 314s _type = 'p' 314s cmake_source_dir = '' 314s has_cmake_module = 1 314s has_cmake_package = 1 314s has_hybrid_package = 0 314s has_pure_module = 1 314s has_pure_package = 1 314s mock_setup = 314s mocker = 314s package_base = '' 314s package_base_dir = '' 314s path = 'pure/data/pure.dat' 314s path_types = ('c', 'cm', 'p', 'pm') 314s root = '' 314s select_paths = .select_paths at 0xf33ceb18> 314s src_dir = local('/tmp/pytest-of-ubuntu/pytest-109/test_setup_inputs0') 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-109/test_setup_inputs0') 314s with_package_base = 0 314s 314s tests/test_setup.py:849: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-109/test_setup_inputs0') 314s setup_args = ['build'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-109/test_setup_inputs0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s ________________________ test_setup_inputs[0-1-1-1-0-0] ________________________ 314s 314s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 1 314s has_pure_package = 1, has_pure_module = 1, with_package_base = 0 314s mocker = 314s 314s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 314s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 314s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_module", [0, 1]) 314s @pytest.mark.parametrize("with_package_base", [0, 1]) 314s def test_setup_inputs( 314s has_cmake_package, 314s has_cmake_module, 314s has_hybrid_package, 314s has_pure_package, 314s has_pure_module, 314s with_package_base, 314s mocker, 314s ): 314s """This test that a project can have a package with some modules 314s installed using setup.py and some other modules installed using CMake. 314s """ 314s 314s tmp_dir = _tmpdir("test_setup_inputs") 314s 314s package_base = "to/the/base" if with_package_base else "" 314s package_base_dir = package_base + "/" if package_base else "" 314s cmake_source_dir = package_base 314s 314s if cmake_source_dir and (has_cmake_package or has_cmake_module): 314s pytest.skip( 314s "unsupported configuration: " 314s "python package fully generated by CMake does *NOT* work. " 314s "At least __init__.py should be in the project source tree" 314s ) 314s 314s # ------------------------------------------------------------------------- 314s # Here is the "SOURCE" tree layout: 314s # 314s # ROOT/ 314s # 314s # setup.py 314s # 314s # [/] 314s # 314s # pureModule.py 314s # 314s # pure/ 314s # __init__.py 314s # pure.py 314s # 314s # data/ 314s # pure.dat 314s # 314s # [/] 314s # 314s # hybrid/ 314s # CMakeLists.txt 314s # __init__.py 314s # hybrid_pure.dat 314s # hybrid_pure.py 314s # 314s # data/ 314s # hybrid_data_pure.dat 314s # 314s # hybrid_2/ 314s # __init__.py 314s # hybrid_2_pure.py 314s # 314s # hybrid_2_pure/ 314s # __init__.py 314s # hybrid_2_pure_1.py 314s # hybrid_2_pure_2.py 314s # 314s # 314s # ------------------------------------------------------------------------- 314s # and here is the "BINARY" distribution layout: 314s # 314s # The comment "CMake" or "Setuptools" indicates which tool is responsible 314s # for placing the file in the tree used to create the binary distribution. 314s # 314s # ROOT/ 314s # 314s # cmakeModule.py # CMake 314s # 314s # cmake/ 314s # __init__.py # CMake 314s # cmake.py # CMake 314s # 314s # hybrid/ 314s # hybrid_cmake.dat # CMake 314s # hybrid_cmake.py # CMake 314s # hybrid_pure.dat # Setuptools 314s # hybrid_pure.py # Setuptools 314s # 314s # data/ 314s # hybrid_data_pure.dat # CMake or Setuptools 314s # hybrid_data_cmake.dat # CMake *NO TEST* 314s # 314s # hybrid_2/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure.py # CMake or Setuptools 314s # hybrid_2_cmake.py # CMake 314s # 314s # hybrid_2_pure/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure_1.py # CMake or Setuptools 314s # hybrid_2_pure_2.py # CMake or Setuptools 314s # 314s # pureModule.py # Setuptools 314s # 314s # pure/ 314s # __init__.py # Setuptools 314s # pure.py # Setuptools 314s # 314s # data/ 314s # pure.dat # Setuptools 314s 314s tmp_dir.join("setup.py").write( 314s textwrap.dedent( 314s """ 314s from skbuild import setup 314s #from setuptools import setup 314s setup( 314s name="test_hybrid_project", 314s version="1.2.3", 314s description=("an hybrid package mixing files installed by both " 314s "CMake and setuptools"), 314s author='The scikit-build team', 314s license="MIT", 314s cmake_source_dir='{cmake_source_dir}', 314s cmake_install_dir='{cmake_install_dir}', 314s # Arbitrary order of packages 314s packages=[ 314s {p_off} 'pure', 314s {h_off} 'hybrid.hybrid_2', 314s {h_off} 'hybrid', 314s {c_off} 'cmake', 314s {p_off} 'hybrid.hybrid_2_pure', 314s ], 314s py_modules=[ 314s {pm_off} '{package_base}pureModule', 314s {cm_off} '{package_base}cmakeModule', 314s ], 314s package_data={{ 314s {p_off} 'pure': ['data/pure.dat'], 314s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 314s }}, 314s # Arbitrary order of package_dir 314s package_dir = {{ 314s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 314s {p_off} 'pure': '{package_base}pure', 314s {h_off} 'hybrid': '{package_base}hybrid', 314s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 314s {c_off} 'cmake': '{package_base}cmake', 314s }} 314s ) 314s """.format( 314s cmake_source_dir=cmake_source_dir, 314s cmake_install_dir=package_base, 314s package_base=package_base_dir, 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s p_off="" if has_pure_package else "#", 314s pm_off="" if has_pure_module else "#", 314s ) 314s ) 314s ) 314s 314s src_dir = tmp_dir.ensure(package_base, dir=1) 314s 314s src_dir.join("CMakeLists.txt").write( 314s textwrap.dedent( 314s """ 314s cmake_minimum_required(VERSION 3.5.0) 314s project(hybrid NONE) 314s set(build_dir ${{CMAKE_BINARY_DIR}}) 314s 314s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 314s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 314s {c_off} install( 314s {c_off} FILES 314s {c_off} ${{build_dir}}/__init__.py 314s {c_off} ${{build_dir}}/cmake.py 314s {c_off} DESTINATION cmake 314s {c_off} ) 314s 314s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 314s {cm_off} install( 314s {cm_off} FILES ${{build_dir}}/cmakeModule.py 314s {cm_off} DESTINATION .) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 314s {h_off} DESTINATION hybrid/data) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 314s {h_off} DESTINATION hybrid/hybrid_2) 314s 314s install(CODE "message(STATUS \\\"Installation complete\\\")") 314s """.format( 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s ) 314s ) 314s ) 314s 314s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 314s path_types: Sequence[str] 314s try: 314s path_types = next( 314s iter( 314s zip( 314s *filter( 314s lambda i: i[1], 314s [ 314s ("c", has_cmake_package), 314s ("cm", has_cmake_module), 314s ("h", has_hybrid_package), 314s ("p", has_pure_package), 314s ("pm", has_pure_module), 314s ], 314s ) 314s ) 314s ) 314s ) 314s except StopIteration: 314s path_types = [] 314s 314s def select_paths(annotated_paths): 314s """Return a filtered list paths considering ``path_types``. 314s 314s `annotated_paths`` is list of tuple ``(type, path)`` where type 314s is either `c`, 'cm', `h`, `p` or 'pm'. 314s 314s """ 314s return filter(lambda i: i[0] in path_types, annotated_paths) 314s 314s # Commented paths are the one expected to be installed by CMake. For 314s # this reason, corresponding files should NOT be created in the source 314s # tree. 314s for _type, path in select_paths( 314s [ 314s # ('c', 'cmake/__init__.py'), 314s # ('c', 'cmake/cmake.py'), 314s # ('cm', 'cmakeModule.py'), 314s ("h", "hybrid/__init__.py"), 314s # ('h', 'hybrid/hybrid_cmake.dat'), 314s # ('h', 'hybrid/hybrid_cmake.py'), 314s ("h", "hybrid/hybrid_pure.dat"), 314s ("h", "hybrid/hybrid_pure.py"), 314s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 314s ("h", "hybrid/data/hybrid_data_pure.dat"), 314s ("h", "hybrid/hybrid_2/__init__.py"), 314s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 314s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 314s ("p", "hybrid/hybrid_2_pure/__init__.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 314s ("pm", "pureModule.py"), 314s ("p", "pure/__init__.py"), 314s ("p", "pure/pure.py"), 314s ("p", "pure/data/pure.dat"), 314s ] 314s ): 314s assert _type in {"p", "pm", "h"} 314s root = package_base if _type in {"p", "pm"} else cmake_source_dir 314s tmp_dir.ensure(os.path.join(root, path)) 314s 314s # Do not call the real setup function. Instead, replace it with 314s # a MagicMock allowing to check with which arguments it was invoked. 314s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 314s 314s # Convenience print function 314s def _pprint(desc, value=None): 314s print( 314s "-----------------\n" 314s f"{desc}:\n" 314s "\n" 314s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 314s ) 314s 314s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 314s 314s _pprint = ._pprint at 0xf3330de8> 314s _type = 'p' 314s cmake_source_dir = '' 314s has_cmake_module = 0 314s has_cmake_package = 0 314s has_hybrid_package = 1 314s has_pure_module = 1 314s has_pure_package = 1 314s mock_setup = 314s mocker = 314s package_base = '' 314s package_base_dir = '' 314s path = 'pure/data/pure.dat' 314s path_types = ('h', 'p', 'pm') 314s root = '' 314s select_paths = .select_paths at 0xf3330d98> 314s src_dir = local('/tmp/pytest-of-ubuntu/pytest-110/test_setup_inputs0') 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-110/test_setup_inputs0') 314s with_package_base = 0 314s 314s tests/test_setup.py:849: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-110/test_setup_inputs0') 314s setup_args = ['build'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-110/test_setup_inputs0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s ________________________ test_setup_inputs[0-1-1-1-0-1] ________________________ 314s 314s has_cmake_package = 1, has_cmake_module = 0, has_hybrid_package = 1 314s has_pure_package = 1, has_pure_module = 1, with_package_base = 0 314s mocker = 314s 314s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 314s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 314s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_module", [0, 1]) 314s @pytest.mark.parametrize("with_package_base", [0, 1]) 314s def test_setup_inputs( 314s has_cmake_package, 314s has_cmake_module, 314s has_hybrid_package, 314s has_pure_package, 314s has_pure_module, 314s with_package_base, 314s mocker, 314s ): 314s """This test that a project can have a package with some modules 314s installed using setup.py and some other modules installed using CMake. 314s """ 314s 314s tmp_dir = _tmpdir("test_setup_inputs") 314s 314s package_base = "to/the/base" if with_package_base else "" 314s package_base_dir = package_base + "/" if package_base else "" 314s cmake_source_dir = package_base 314s 314s if cmake_source_dir and (has_cmake_package or has_cmake_module): 314s pytest.skip( 314s "unsupported configuration: " 314s "python package fully generated by CMake does *NOT* work. " 314s "At least __init__.py should be in the project source tree" 314s ) 314s 314s # ------------------------------------------------------------------------- 314s # Here is the "SOURCE" tree layout: 314s # 314s # ROOT/ 314s # 314s # setup.py 314s # 314s # [/] 314s # 314s # pureModule.py 314s # 314s # pure/ 314s # __init__.py 314s # pure.py 314s # 314s # data/ 314s # pure.dat 314s # 314s # [/] 314s # 314s # hybrid/ 314s # CMakeLists.txt 314s # __init__.py 314s # hybrid_pure.dat 314s # hybrid_pure.py 314s # 314s # data/ 314s # hybrid_data_pure.dat 314s # 314s # hybrid_2/ 314s # __init__.py 314s # hybrid_2_pure.py 314s # 314s # hybrid_2_pure/ 314s # __init__.py 314s # hybrid_2_pure_1.py 314s # hybrid_2_pure_2.py 314s # 314s # 314s # ------------------------------------------------------------------------- 314s # and here is the "BINARY" distribution layout: 314s # 314s # The comment "CMake" or "Setuptools" indicates which tool is responsible 314s # for placing the file in the tree used to create the binary distribution. 314s # 314s # ROOT/ 314s # 314s # cmakeModule.py # CMake 314s # 314s # cmake/ 314s # __init__.py # CMake 314s # cmake.py # CMake 314s # 314s # hybrid/ 314s # hybrid_cmake.dat # CMake 314s # hybrid_cmake.py # CMake 314s # hybrid_pure.dat # Setuptools 314s # hybrid_pure.py # Setuptools 314s # 314s # data/ 314s # hybrid_data_pure.dat # CMake or Setuptools 314s # hybrid_data_cmake.dat # CMake *NO TEST* 314s # 314s # hybrid_2/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure.py # CMake or Setuptools 314s # hybrid_2_cmake.py # CMake 314s # 314s # hybrid_2_pure/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure_1.py # CMake or Setuptools 314s # hybrid_2_pure_2.py # CMake or Setuptools 314s # 314s # pureModule.py # Setuptools 314s # 314s # pure/ 314s # __init__.py # Setuptools 314s # pure.py # Setuptools 314s # 314s # data/ 314s # pure.dat # Setuptools 314s 314s tmp_dir.join("setup.py").write( 314s textwrap.dedent( 314s """ 314s from skbuild import setup 314s #from setuptools import setup 314s setup( 314s name="test_hybrid_project", 314s version="1.2.3", 314s description=("an hybrid package mixing files installed by both " 314s "CMake and setuptools"), 314s author='The scikit-build team', 314s license="MIT", 314s cmake_source_dir='{cmake_source_dir}', 314s cmake_install_dir='{cmake_install_dir}', 314s # Arbitrary order of packages 314s packages=[ 314s {p_off} 'pure', 314s {h_off} 'hybrid.hybrid_2', 314s {h_off} 'hybrid', 314s {c_off} 'cmake', 314s {p_off} 'hybrid.hybrid_2_pure', 314s ], 314s py_modules=[ 314s {pm_off} '{package_base}pureModule', 314s {cm_off} '{package_base}cmakeModule', 314s ], 314s package_data={{ 314s {p_off} 'pure': ['data/pure.dat'], 314s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 314s }}, 314s # Arbitrary order of package_dir 314s package_dir = {{ 314s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 314s {p_off} 'pure': '{package_base}pure', 314s {h_off} 'hybrid': '{package_base}hybrid', 314s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 314s {c_off} 'cmake': '{package_base}cmake', 314s }} 314s ) 314s """.format( 314s cmake_source_dir=cmake_source_dir, 314s cmake_install_dir=package_base, 314s package_base=package_base_dir, 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s p_off="" if has_pure_package else "#", 314s pm_off="" if has_pure_module else "#", 314s ) 314s ) 314s ) 314s 314s src_dir = tmp_dir.ensure(package_base, dir=1) 314s 314s src_dir.join("CMakeLists.txt").write( 314s textwrap.dedent( 314s """ 314s cmake_minimum_required(VERSION 3.5.0) 314s project(hybrid NONE) 314s set(build_dir ${{CMAKE_BINARY_DIR}}) 314s 314s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 314s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 314s {c_off} install( 314s {c_off} FILES 314s {c_off} ${{build_dir}}/__init__.py 314s {c_off} ${{build_dir}}/cmake.py 314s {c_off} DESTINATION cmake 314s {c_off} ) 314s 314s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 314s {cm_off} install( 314s {cm_off} FILES ${{build_dir}}/cmakeModule.py 314s {cm_off} DESTINATION .) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 314s {h_off} DESTINATION hybrid/data) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 314s {h_off} DESTINATION hybrid/hybrid_2) 314s 314s install(CODE "message(STATUS \\\"Installation complete\\\")") 314s """.format( 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s ) 314s ) 314s ) 314s 314s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 314s path_types: Sequence[str] 314s try: 314s path_types = next( 314s iter( 314s zip( 314s *filter( 314s lambda i: i[1], 314s [ 314s ("c", has_cmake_package), 314s ("cm", has_cmake_module), 314s ("h", has_hybrid_package), 314s ("p", has_pure_package), 314s ("pm", has_pure_module), 314s ], 314s ) 314s ) 314s ) 314s ) 314s except StopIteration: 314s path_types = [] 314s 314s def select_paths(annotated_paths): 314s """Return a filtered list paths considering ``path_types``. 314s 314s `annotated_paths`` is list of tuple ``(type, path)`` where type 314s is either `c`, 'cm', `h`, `p` or 'pm'. 314s 314s """ 314s return filter(lambda i: i[0] in path_types, annotated_paths) 314s 314s # Commented paths are the one expected to be installed by CMake. For 314s # this reason, corresponding files should NOT be created in the source 314s # tree. 314s for _type, path in select_paths( 314s [ 314s # ('c', 'cmake/__init__.py'), 314s # ('c', 'cmake/cmake.py'), 314s # ('cm', 'cmakeModule.py'), 314s ("h", "hybrid/__init__.py"), 314s # ('h', 'hybrid/hybrid_cmake.dat'), 314s # ('h', 'hybrid/hybrid_cmake.py'), 314s ("h", "hybrid/hybrid_pure.dat"), 314s ("h", "hybrid/hybrid_pure.py"), 314s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 314s ("h", "hybrid/data/hybrid_data_pure.dat"), 314s ("h", "hybrid/hybrid_2/__init__.py"), 314s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 314s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 314s ("p", "hybrid/hybrid_2_pure/__init__.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 314s ("pm", "pureModule.py"), 314s ("p", "pure/__init__.py"), 314s ("p", "pure/pure.py"), 314s ("p", "pure/data/pure.dat"), 314s ] 314s ): 314s assert _type in {"p", "pm", "h"} 314s root = package_base if _type in {"p", "pm"} else cmake_source_dir 314s tmp_dir.ensure(os.path.join(root, path)) 314s 314s # Do not call the real setup function. Instead, replace it with 314s # a MagicMock allowing to check with which arguments it was invoked. 314s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 314s 314s # Convenience print function 314s def _pprint(desc, value=None): 314s print( 314s "-----------------\n" 314s f"{desc}:\n" 314s "\n" 314s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 314s ) 314s 314s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 314s 314s _pprint = ._pprint at 0xf3331ed8> 314s _type = 'p' 314s cmake_source_dir = '' 314s has_cmake_module = 0 314s has_cmake_package = 1 314s has_hybrid_package = 1 314s has_pure_module = 1 314s has_pure_package = 1 314s mock_setup = 314s mocker = 314s package_base = '' 314s package_base_dir = '' 314s path = 'pure/data/pure.dat' 314s path_types = ('c', 'h', 'p', 'pm') 314s root = '' 314s select_paths = .select_paths at 0xf333aac8> 314s src_dir = local('/tmp/pytest-of-ubuntu/pytest-111/test_setup_inputs0') 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-111/test_setup_inputs0') 314s with_package_base = 0 314s 314s tests/test_setup.py:849: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-111/test_setup_inputs0') 314s setup_args = ['build'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-111/test_setup_inputs0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s ________________________ test_setup_inputs[0-1-1-1-1-0] ________________________ 314s 314s has_cmake_package = 0, has_cmake_module = 1, has_hybrid_package = 1 314s has_pure_package = 1, has_pure_module = 1, with_package_base = 0 314s mocker = 314s 314s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 314s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 314s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_module", [0, 1]) 314s @pytest.mark.parametrize("with_package_base", [0, 1]) 314s def test_setup_inputs( 314s has_cmake_package, 314s has_cmake_module, 314s has_hybrid_package, 314s has_pure_package, 314s has_pure_module, 314s with_package_base, 314s mocker, 314s ): 314s """This test that a project can have a package with some modules 314s installed using setup.py and some other modules installed using CMake. 314s """ 314s 314s tmp_dir = _tmpdir("test_setup_inputs") 314s 314s package_base = "to/the/base" if with_package_base else "" 314s package_base_dir = package_base + "/" if package_base else "" 314s cmake_source_dir = package_base 314s 314s if cmake_source_dir and (has_cmake_package or has_cmake_module): 314s pytest.skip( 314s "unsupported configuration: " 314s "python package fully generated by CMake does *NOT* work. " 314s "At least __init__.py should be in the project source tree" 314s ) 314s 314s # ------------------------------------------------------------------------- 314s # Here is the "SOURCE" tree layout: 314s # 314s # ROOT/ 314s # 314s # setup.py 314s # 314s # [/] 314s # 314s # pureModule.py 314s # 314s # pure/ 314s # __init__.py 314s # pure.py 314s # 314s # data/ 314s # pure.dat 314s # 314s # [/] 314s # 314s # hybrid/ 314s # CMakeLists.txt 314s # __init__.py 314s # hybrid_pure.dat 314s # hybrid_pure.py 314s # 314s # data/ 314s # hybrid_data_pure.dat 314s # 314s # hybrid_2/ 314s # __init__.py 314s # hybrid_2_pure.py 314s # 314s # hybrid_2_pure/ 314s # __init__.py 314s # hybrid_2_pure_1.py 314s # hybrid_2_pure_2.py 314s # 314s # 314s # ------------------------------------------------------------------------- 314s # and here is the "BINARY" distribution layout: 314s # 314s # The comment "CMake" or "Setuptools" indicates which tool is responsible 314s # for placing the file in the tree used to create the binary distribution. 314s # 314s # ROOT/ 314s # 314s # cmakeModule.py # CMake 314s # 314s # cmake/ 314s # __init__.py # CMake 314s # cmake.py # CMake 314s # 314s # hybrid/ 314s # hybrid_cmake.dat # CMake 314s # hybrid_cmake.py # CMake 314s # hybrid_pure.dat # Setuptools 314s # hybrid_pure.py # Setuptools 314s # 314s # data/ 314s # hybrid_data_pure.dat # CMake or Setuptools 314s # hybrid_data_cmake.dat # CMake *NO TEST* 314s # 314s # hybrid_2/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure.py # CMake or Setuptools 314s # hybrid_2_cmake.py # CMake 314s # 314s # hybrid_2_pure/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure_1.py # CMake or Setuptools 314s # hybrid_2_pure_2.py # CMake or Setuptools 314s # 314s # pureModule.py # Setuptools 314s # 314s # pure/ 314s # __init__.py # Setuptools 314s # pure.py # Setuptools 314s # 314s # data/ 314s # pure.dat # Setuptools 314s 314s tmp_dir.join("setup.py").write( 314s textwrap.dedent( 314s """ 314s from skbuild import setup 314s #from setuptools import setup 314s setup( 314s name="test_hybrid_project", 314s version="1.2.3", 314s description=("an hybrid package mixing files installed by both " 314s "CMake and setuptools"), 314s author='The scikit-build team', 314s license="MIT", 314s cmake_source_dir='{cmake_source_dir}', 314s cmake_install_dir='{cmake_install_dir}', 314s # Arbitrary order of packages 314s packages=[ 314s {p_off} 'pure', 314s {h_off} 'hybrid.hybrid_2', 314s {h_off} 'hybrid', 314s {c_off} 'cmake', 314s {p_off} 'hybrid.hybrid_2_pure', 314s ], 314s py_modules=[ 314s {pm_off} '{package_base}pureModule', 314s {cm_off} '{package_base}cmakeModule', 314s ], 314s package_data={{ 314s {p_off} 'pure': ['data/pure.dat'], 314s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 314s }}, 314s # Arbitrary order of package_dir 314s package_dir = {{ 314s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 314s {p_off} 'pure': '{package_base}pure', 314s {h_off} 'hybrid': '{package_base}hybrid', 314s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 314s {c_off} 'cmake': '{package_base}cmake', 314s }} 314s ) 314s """.format( 314s cmake_source_dir=cmake_source_dir, 314s cmake_install_dir=package_base, 314s package_base=package_base_dir, 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s p_off="" if has_pure_package else "#", 314s pm_off="" if has_pure_module else "#", 314s ) 314s ) 314s ) 314s 314s src_dir = tmp_dir.ensure(package_base, dir=1) 314s 314s src_dir.join("CMakeLists.txt").write( 314s textwrap.dedent( 314s """ 314s cmake_minimum_required(VERSION 3.5.0) 314s project(hybrid NONE) 314s set(build_dir ${{CMAKE_BINARY_DIR}}) 314s 314s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 314s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 314s {c_off} install( 314s {c_off} FILES 314s {c_off} ${{build_dir}}/__init__.py 314s {c_off} ${{build_dir}}/cmake.py 314s {c_off} DESTINATION cmake 314s {c_off} ) 314s 314s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 314s {cm_off} install( 314s {cm_off} FILES ${{build_dir}}/cmakeModule.py 314s {cm_off} DESTINATION .) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 314s {h_off} DESTINATION hybrid/data) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 314s {h_off} DESTINATION hybrid/hybrid_2) 314s 314s install(CODE "message(STATUS \\\"Installation complete\\\")") 314s """.format( 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s ) 314s ) 314s ) 314s 314s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 314s path_types: Sequence[str] 314s try: 314s path_types = next( 314s iter( 314s zip( 314s *filter( 314s lambda i: i[1], 314s [ 314s ("c", has_cmake_package), 314s ("cm", has_cmake_module), 314s ("h", has_hybrid_package), 314s ("p", has_pure_package), 314s ("pm", has_pure_module), 314s ], 314s ) 314s ) 314s ) 314s ) 314s except StopIteration: 314s path_types = [] 314s 314s def select_paths(annotated_paths): 314s """Return a filtered list paths considering ``path_types``. 314s 314s `annotated_paths`` is list of tuple ``(type, path)`` where type 314s is either `c`, 'cm', `h`, `p` or 'pm'. 314s 314s """ 314s return filter(lambda i: i[0] in path_types, annotated_paths) 314s 314s # Commented paths are the one expected to be installed by CMake. For 314s # this reason, corresponding files should NOT be created in the source 314s # tree. 314s for _type, path in select_paths( 314s [ 314s # ('c', 'cmake/__init__.py'), 314s # ('c', 'cmake/cmake.py'), 314s # ('cm', 'cmakeModule.py'), 314s ("h", "hybrid/__init__.py"), 314s # ('h', 'hybrid/hybrid_cmake.dat'), 314s # ('h', 'hybrid/hybrid_cmake.py'), 314s ("h", "hybrid/hybrid_pure.dat"), 314s ("h", "hybrid/hybrid_pure.py"), 314s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 314s ("h", "hybrid/data/hybrid_data_pure.dat"), 314s ("h", "hybrid/hybrid_2/__init__.py"), 314s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 314s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 314s ("p", "hybrid/hybrid_2_pure/__init__.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 314s ("pm", "pureModule.py"), 314s ("p", "pure/__init__.py"), 314s ("p", "pure/pure.py"), 314s ("p", "pure/data/pure.dat"), 314s ] 314s ): 314s assert _type in {"p", "pm", "h"} 314s root = package_base if _type in {"p", "pm"} else cmake_source_dir 314s tmp_dir.ensure(os.path.join(root, path)) 314s 314s # Do not call the real setup function. Instead, replace it with 314s # a MagicMock allowing to check with which arguments it was invoked. 314s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 314s 314s # Convenience print function 314s def _pprint(desc, value=None): 314s print( 314s "-----------------\n" 314s f"{desc}:\n" 314s "\n" 314s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 314s ) 314s 314s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 314s 314s _pprint = ._pprint at 0xf3328e38> 314s _type = 'p' 314s cmake_source_dir = '' 314s has_cmake_module = 1 314s has_cmake_package = 0 314s has_hybrid_package = 1 314s has_pure_module = 1 314s has_pure_package = 1 314s mock_setup = 314s mocker = 314s package_base = '' 314s package_base_dir = '' 314s path = 'pure/data/pure.dat' 314s path_types = ('cm', 'h', 'p', 'pm') 314s root = '' 314s select_paths = .select_paths at 0xf3328d98> 314s src_dir = local('/tmp/pytest-of-ubuntu/pytest-112/test_setup_inputs0') 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-112/test_setup_inputs0') 314s with_package_base = 0 314s 314s tests/test_setup.py:849: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-112/test_setup_inputs0') 314s setup_args = ['build'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-112/test_setup_inputs0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s ________________________ test_setup_inputs[0-1-1-1-1-1] ________________________ 314s 314s has_cmake_package = 1, has_cmake_module = 1, has_hybrid_package = 1 314s has_pure_package = 1, has_pure_module = 1, with_package_base = 0 314s mocker = 314s 314s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 314s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 314s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_module", [0, 1]) 314s @pytest.mark.parametrize("with_package_base", [0, 1]) 314s def test_setup_inputs( 314s has_cmake_package, 314s has_cmake_module, 314s has_hybrid_package, 314s has_pure_package, 314s has_pure_module, 314s with_package_base, 314s mocker, 314s ): 314s """This test that a project can have a package with some modules 314s installed using setup.py and some other modules installed using CMake. 314s """ 314s 314s tmp_dir = _tmpdir("test_setup_inputs") 314s 314s package_base = "to/the/base" if with_package_base else "" 314s package_base_dir = package_base + "/" if package_base else "" 314s cmake_source_dir = package_base 314s 314s if cmake_source_dir and (has_cmake_package or has_cmake_module): 314s pytest.skip( 314s "unsupported configuration: " 314s "python package fully generated by CMake does *NOT* work. " 314s "At least __init__.py should be in the project source tree" 314s ) 314s 314s # ------------------------------------------------------------------------- 314s # Here is the "SOURCE" tree layout: 314s # 314s # ROOT/ 314s # 314s # setup.py 314s # 314s # [/] 314s # 314s # pureModule.py 314s # 314s # pure/ 314s # __init__.py 314s # pure.py 314s # 314s # data/ 314s # pure.dat 314s # 314s # [/] 314s # 314s # hybrid/ 314s # CMakeLists.txt 314s # __init__.py 314s # hybrid_pure.dat 314s # hybrid_pure.py 314s # 314s # data/ 314s # hybrid_data_pure.dat 314s # 314s # hybrid_2/ 314s # __init__.py 314s # hybrid_2_pure.py 314s # 314s # hybrid_2_pure/ 314s # __init__.py 314s # hybrid_2_pure_1.py 314s # hybrid_2_pure_2.py 314s # 314s # 314s # ------------------------------------------------------------------------- 314s # and here is the "BINARY" distribution layout: 314s # 314s # The comment "CMake" or "Setuptools" indicates which tool is responsible 314s # for placing the file in the tree used to create the binary distribution. 314s # 314s # ROOT/ 314s # 314s # cmakeModule.py # CMake 314s # 314s # cmake/ 314s # __init__.py # CMake 314s # cmake.py # CMake 314s # 314s # hybrid/ 314s # hybrid_cmake.dat # CMake 314s # hybrid_cmake.py # CMake 314s # hybrid_pure.dat # Setuptools 314s # hybrid_pure.py # Setuptools 314s # 314s # data/ 314s # hybrid_data_pure.dat # CMake or Setuptools 314s # hybrid_data_cmake.dat # CMake *NO TEST* 314s # 314s # hybrid_2/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure.py # CMake or Setuptools 314s # hybrid_2_cmake.py # CMake 314s # 314s # hybrid_2_pure/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure_1.py # CMake or Setuptools 314s # hybrid_2_pure_2.py # CMake or Setuptools 314s # 314s # pureModule.py # Setuptools 314s # 314s # pure/ 314s # __init__.py # Setuptools 314s # pure.py # Setuptools 314s # 314s # data/ 314s # pure.dat # Setuptools 314s 314s tmp_dir.join("setup.py").write( 314s textwrap.dedent( 314s """ 314s from skbuild import setup 314s #from setuptools import setup 314s setup( 314s name="test_hybrid_project", 314s version="1.2.3", 314s description=("an hybrid package mixing files installed by both " 314s "CMake and setuptools"), 314s author='The scikit-build team', 314s license="MIT", 314s cmake_source_dir='{cmake_source_dir}', 314s cmake_install_dir='{cmake_install_dir}', 314s # Arbitrary order of packages 314s packages=[ 314s {p_off} 'pure', 314s {h_off} 'hybrid.hybrid_2', 314s {h_off} 'hybrid', 314s {c_off} 'cmake', 314s {p_off} 'hybrid.hybrid_2_pure', 314s ], 314s py_modules=[ 314s {pm_off} '{package_base}pureModule', 314s {cm_off} '{package_base}cmakeModule', 314s ], 314s package_data={{ 314s {p_off} 'pure': ['data/pure.dat'], 314s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 314s }}, 314s # Arbitrary order of package_dir 314s package_dir = {{ 314s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 314s {p_off} 'pure': '{package_base}pure', 314s {h_off} 'hybrid': '{package_base}hybrid', 314s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 314s {c_off} 'cmake': '{package_base}cmake', 314s }} 314s ) 314s """.format( 314s cmake_source_dir=cmake_source_dir, 314s cmake_install_dir=package_base, 314s package_base=package_base_dir, 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s p_off="" if has_pure_package else "#", 314s pm_off="" if has_pure_module else "#", 314s ) 314s ) 314s ) 314s 314s src_dir = tmp_dir.ensure(package_base, dir=1) 314s 314s src_dir.join("CMakeLists.txt").write( 314s textwrap.dedent( 314s """ 314s cmake_minimum_required(VERSION 3.5.0) 314s project(hybrid NONE) 314s set(build_dir ${{CMAKE_BINARY_DIR}}) 314s 314s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 314s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 314s {c_off} install( 314s {c_off} FILES 314s {c_off} ${{build_dir}}/__init__.py 314s {c_off} ${{build_dir}}/cmake.py 314s {c_off} DESTINATION cmake 314s {c_off} ) 314s 314s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 314s {cm_off} install( 314s {cm_off} FILES ${{build_dir}}/cmakeModule.py 314s {cm_off} DESTINATION .) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 314s {h_off} DESTINATION hybrid/data) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 314s {h_off} DESTINATION hybrid/hybrid_2) 314s 314s install(CODE "message(STATUS \\\"Installation complete\\\")") 314s """.format( 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s ) 314s ) 314s ) 314s 314s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 314s path_types: Sequence[str] 314s try: 314s path_types = next( 314s iter( 314s zip( 314s *filter( 314s lambda i: i[1], 314s [ 314s ("c", has_cmake_package), 314s ("cm", has_cmake_module), 314s ("h", has_hybrid_package), 314s ("p", has_pure_package), 314s ("pm", has_pure_module), 314s ], 314s ) 314s ) 314s ) 314s ) 314s except StopIteration: 314s path_types = [] 314s 314s def select_paths(annotated_paths): 314s """Return a filtered list paths considering ``path_types``. 314s 314s `annotated_paths`` is list of tuple ``(type, path)`` where type 314s is either `c`, 'cm', `h`, `p` or 'pm'. 314s 314s """ 314s return filter(lambda i: i[0] in path_types, annotated_paths) 314s 314s # Commented paths are the one expected to be installed by CMake. For 314s # this reason, corresponding files should NOT be created in the source 314s # tree. 314s for _type, path in select_paths( 314s [ 314s # ('c', 'cmake/__init__.py'), 314s # ('c', 'cmake/cmake.py'), 314s # ('cm', 'cmakeModule.py'), 314s ("h", "hybrid/__init__.py"), 314s # ('h', 'hybrid/hybrid_cmake.dat'), 314s # ('h', 'hybrid/hybrid_cmake.py'), 314s ("h", "hybrid/hybrid_pure.dat"), 314s ("h", "hybrid/hybrid_pure.py"), 314s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 314s ("h", "hybrid/data/hybrid_data_pure.dat"), 314s ("h", "hybrid/hybrid_2/__init__.py"), 314s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 314s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 314s ("p", "hybrid/hybrid_2_pure/__init__.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 314s ("pm", "pureModule.py"), 314s ("p", "pure/__init__.py"), 314s ("p", "pure/pure.py"), 314s ("p", "pure/data/pure.dat"), 314s ] 314s ): 314s assert _type in {"p", "pm", "h"} 314s root = package_base if _type in {"p", "pm"} else cmake_source_dir 314s tmp_dir.ensure(os.path.join(root, path)) 314s 314s # Do not call the real setup function. Instead, replace it with 314s # a MagicMock allowing to check with which arguments it was invoked. 314s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 314s 314s # Convenience print function 314s def _pprint(desc, value=None): 314s print( 314s "-----------------\n" 314s f"{desc}:\n" 314s "\n" 314s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 314s ) 314s 314s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 314s 314s _pprint = ._pprint at 0xf337ff78> 314s _type = 'p' 314s cmake_source_dir = '' 314s has_cmake_module = 1 314s has_cmake_package = 1 314s has_hybrid_package = 1 314s has_pure_module = 1 314s has_pure_package = 1 314s mock_setup = 314s mocker = 314s package_base = '' 314s package_base_dir = '' 314s path = 'pure/data/pure.dat' 314s path_types = ('c', 'cm', 'h', 'p', 'pm') 314s root = '' 314s select_paths = .select_paths at 0xf335bb68> 314s src_dir = local('/tmp/pytest-of-ubuntu/pytest-113/test_setup_inputs0') 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-113/test_setup_inputs0') 314s with_package_base = 0 314s 314s tests/test_setup.py:849: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-113/test_setup_inputs0') 314s setup_args = ['build'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-113/test_setup_inputs0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s ________________________ test_setup_inputs[1-0-0-0-0-0] ________________________ 314s 314s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 0 314s has_pure_package = 0, has_pure_module = 0, with_package_base = 1 314s mocker = 314s 314s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 314s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 314s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_module", [0, 1]) 314s @pytest.mark.parametrize("with_package_base", [0, 1]) 314s def test_setup_inputs( 314s has_cmake_package, 314s has_cmake_module, 314s has_hybrid_package, 314s has_pure_package, 314s has_pure_module, 314s with_package_base, 314s mocker, 314s ): 314s """This test that a project can have a package with some modules 314s installed using setup.py and some other modules installed using CMake. 314s """ 314s 314s tmp_dir = _tmpdir("test_setup_inputs") 314s 314s package_base = "to/the/base" if with_package_base else "" 314s package_base_dir = package_base + "/" if package_base else "" 314s cmake_source_dir = package_base 314s 314s if cmake_source_dir and (has_cmake_package or has_cmake_module): 314s pytest.skip( 314s "unsupported configuration: " 314s "python package fully generated by CMake does *NOT* work. " 314s "At least __init__.py should be in the project source tree" 314s ) 314s 314s # ------------------------------------------------------------------------- 314s # Here is the "SOURCE" tree layout: 314s # 314s # ROOT/ 314s # 314s # setup.py 314s # 314s # [/] 314s # 314s # pureModule.py 314s # 314s # pure/ 314s # __init__.py 314s # pure.py 314s # 314s # data/ 314s # pure.dat 314s # 314s # [/] 314s # 314s # hybrid/ 314s # CMakeLists.txt 314s # __init__.py 314s # hybrid_pure.dat 314s # hybrid_pure.py 314s # 314s # data/ 314s # hybrid_data_pure.dat 314s # 314s # hybrid_2/ 314s # __init__.py 314s # hybrid_2_pure.py 314s # 314s # hybrid_2_pure/ 314s # __init__.py 314s # hybrid_2_pure_1.py 314s # hybrid_2_pure_2.py 314s # 314s # 314s # ------------------------------------------------------------------------- 314s # and here is the "BINARY" distribution layout: 314s # 314s # The comment "CMake" or "Setuptools" indicates which tool is responsible 314s # for placing the file in the tree used to create the binary distribution. 314s # 314s # ROOT/ 314s # 314s # cmakeModule.py # CMake 314s # 314s # cmake/ 314s # __init__.py # CMake 314s # cmake.py # CMake 314s # 314s # hybrid/ 314s # hybrid_cmake.dat # CMake 314s # hybrid_cmake.py # CMake 314s # hybrid_pure.dat # Setuptools 314s # hybrid_pure.py # Setuptools 314s # 314s # data/ 314s # hybrid_data_pure.dat # CMake or Setuptools 314s # hybrid_data_cmake.dat # CMake *NO TEST* 314s # 314s # hybrid_2/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure.py # CMake or Setuptools 314s # hybrid_2_cmake.py # CMake 314s # 314s # hybrid_2_pure/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure_1.py # CMake or Setuptools 314s # hybrid_2_pure_2.py # CMake or Setuptools 314s # 314s # pureModule.py # Setuptools 314s # 314s # pure/ 314s # __init__.py # Setuptools 314s # pure.py # Setuptools 314s # 314s # data/ 314s # pure.dat # Setuptools 314s 314s tmp_dir.join("setup.py").write( 314s textwrap.dedent( 314s """ 314s from skbuild import setup 314s #from setuptools import setup 314s setup( 314s name="test_hybrid_project", 314s version="1.2.3", 314s description=("an hybrid package mixing files installed by both " 314s "CMake and setuptools"), 314s author='The scikit-build team', 314s license="MIT", 314s cmake_source_dir='{cmake_source_dir}', 314s cmake_install_dir='{cmake_install_dir}', 314s # Arbitrary order of packages 314s packages=[ 314s {p_off} 'pure', 314s {h_off} 'hybrid.hybrid_2', 314s {h_off} 'hybrid', 314s {c_off} 'cmake', 314s {p_off} 'hybrid.hybrid_2_pure', 314s ], 314s py_modules=[ 314s {pm_off} '{package_base}pureModule', 314s {cm_off} '{package_base}cmakeModule', 314s ], 314s package_data={{ 314s {p_off} 'pure': ['data/pure.dat'], 314s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 314s }}, 314s # Arbitrary order of package_dir 314s package_dir = {{ 314s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 314s {p_off} 'pure': '{package_base}pure', 314s {h_off} 'hybrid': '{package_base}hybrid', 314s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 314s {c_off} 'cmake': '{package_base}cmake', 314s }} 314s ) 314s """.format( 314s cmake_source_dir=cmake_source_dir, 314s cmake_install_dir=package_base, 314s package_base=package_base_dir, 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s p_off="" if has_pure_package else "#", 314s pm_off="" if has_pure_module else "#", 314s ) 314s ) 314s ) 314s 314s src_dir = tmp_dir.ensure(package_base, dir=1) 314s 314s src_dir.join("CMakeLists.txt").write( 314s textwrap.dedent( 314s """ 314s cmake_minimum_required(VERSION 3.5.0) 314s project(hybrid NONE) 314s set(build_dir ${{CMAKE_BINARY_DIR}}) 314s 314s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 314s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 314s {c_off} install( 314s {c_off} FILES 314s {c_off} ${{build_dir}}/__init__.py 314s {c_off} ${{build_dir}}/cmake.py 314s {c_off} DESTINATION cmake 314s {c_off} ) 314s 314s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 314s {cm_off} install( 314s {cm_off} FILES ${{build_dir}}/cmakeModule.py 314s {cm_off} DESTINATION .) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 314s {h_off} DESTINATION hybrid/data) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 314s {h_off} DESTINATION hybrid/hybrid_2) 314s 314s install(CODE "message(STATUS \\\"Installation complete\\\")") 314s """.format( 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s ) 314s ) 314s ) 314s 314s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 314s path_types: Sequence[str] 314s try: 314s path_types = next( 314s iter( 314s zip( 314s *filter( 314s lambda i: i[1], 314s [ 314s ("c", has_cmake_package), 314s ("cm", has_cmake_module), 314s ("h", has_hybrid_package), 314s ("p", has_pure_package), 314s ("pm", has_pure_module), 314s ], 314s ) 314s ) 314s ) 314s ) 314s except StopIteration: 314s path_types = [] 314s 314s def select_paths(annotated_paths): 314s """Return a filtered list paths considering ``path_types``. 314s 314s `annotated_paths`` is list of tuple ``(type, path)`` where type 314s is either `c`, 'cm', `h`, `p` or 'pm'. 314s 314s """ 314s return filter(lambda i: i[0] in path_types, annotated_paths) 314s 314s # Commented paths are the one expected to be installed by CMake. For 314s # this reason, corresponding files should NOT be created in the source 314s # tree. 314s for _type, path in select_paths( 314s [ 314s # ('c', 'cmake/__init__.py'), 314s # ('c', 'cmake/cmake.py'), 314s # ('cm', 'cmakeModule.py'), 314s ("h", "hybrid/__init__.py"), 314s # ('h', 'hybrid/hybrid_cmake.dat'), 314s # ('h', 'hybrid/hybrid_cmake.py'), 314s ("h", "hybrid/hybrid_pure.dat"), 314s ("h", "hybrid/hybrid_pure.py"), 314s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 314s ("h", "hybrid/data/hybrid_data_pure.dat"), 314s ("h", "hybrid/hybrid_2/__init__.py"), 314s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 314s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 314s ("p", "hybrid/hybrid_2_pure/__init__.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 314s ("pm", "pureModule.py"), 314s ("p", "pure/__init__.py"), 314s ("p", "pure/pure.py"), 314s ("p", "pure/data/pure.dat"), 314s ] 314s ): 314s assert _type in {"p", "pm", "h"} 314s root = package_base if _type in {"p", "pm"} else cmake_source_dir 314s tmp_dir.ensure(os.path.join(root, path)) 314s 314s # Do not call the real setup function. Instead, replace it with 314s # a MagicMock allowing to check with which arguments it was invoked. 314s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 314s 314s # Convenience print function 314s def _pprint(desc, value=None): 314s print( 314s "-----------------\n" 314s f"{desc}:\n" 314s "\n" 314s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 314s ) 314s 314s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 314s 314s _pprint = ._pprint at 0xf3321d98> 314s cmake_source_dir = 'to/the/base' 314s has_cmake_module = 0 314s has_cmake_package = 0 314s has_hybrid_package = 0 314s has_pure_module = 0 314s has_pure_package = 0 314s mock_setup = 314s mocker = 314s package_base = 'to/the/base' 314s package_base_dir = 'to/the/base/' 314s path_types = [] 314s select_paths = .select_paths at 0xf329ef78> 314s src_dir = local('/tmp/pytest-of-ubuntu/pytest-114/test_setup_inputs0/to/the/base') 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-114/test_setup_inputs0') 314s with_package_base = 1 314s 314s tests/test_setup.py:849: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-114/test_setup_inputs0') 314s setup_args = ['build'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-114/test_setup_inputs0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s ________________________ test_setup_inputs[1-0-0-1-0-0] ________________________ 314s 314s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 1 314s has_pure_package = 0, has_pure_module = 0, with_package_base = 1 314s mocker = 314s 314s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 314s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 314s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_module", [0, 1]) 314s @pytest.mark.parametrize("with_package_base", [0, 1]) 314s def test_setup_inputs( 314s has_cmake_package, 314s has_cmake_module, 314s has_hybrid_package, 314s has_pure_package, 314s has_pure_module, 314s with_package_base, 314s mocker, 314s ): 314s """This test that a project can have a package with some modules 314s installed using setup.py and some other modules installed using CMake. 314s """ 314s 314s tmp_dir = _tmpdir("test_setup_inputs") 314s 314s package_base = "to/the/base" if with_package_base else "" 314s package_base_dir = package_base + "/" if package_base else "" 314s cmake_source_dir = package_base 314s 314s if cmake_source_dir and (has_cmake_package or has_cmake_module): 314s pytest.skip( 314s "unsupported configuration: " 314s "python package fully generated by CMake does *NOT* work. " 314s "At least __init__.py should be in the project source tree" 314s ) 314s 314s # ------------------------------------------------------------------------- 314s # Here is the "SOURCE" tree layout: 314s # 314s # ROOT/ 314s # 314s # setup.py 314s # 314s # [/] 314s # 314s # pureModule.py 314s # 314s # pure/ 314s # __init__.py 314s # pure.py 314s # 314s # data/ 314s # pure.dat 314s # 314s # [/] 314s # 314s # hybrid/ 314s # CMakeLists.txt 314s # __init__.py 314s # hybrid_pure.dat 314s # hybrid_pure.py 314s # 314s # data/ 314s # hybrid_data_pure.dat 314s # 314s # hybrid_2/ 314s # __init__.py 314s # hybrid_2_pure.py 314s # 314s # hybrid_2_pure/ 314s # __init__.py 314s # hybrid_2_pure_1.py 314s # hybrid_2_pure_2.py 314s # 314s # 314s # ------------------------------------------------------------------------- 314s # and here is the "BINARY" distribution layout: 314s # 314s # The comment "CMake" or "Setuptools" indicates which tool is responsible 314s # for placing the file in the tree used to create the binary distribution. 314s # 314s # ROOT/ 314s # 314s # cmakeModule.py # CMake 314s # 314s # cmake/ 314s # __init__.py # CMake 314s # cmake.py # CMake 314s # 314s # hybrid/ 314s # hybrid_cmake.dat # CMake 314s # hybrid_cmake.py # CMake 314s # hybrid_pure.dat # Setuptools 314s # hybrid_pure.py # Setuptools 314s # 314s # data/ 314s # hybrid_data_pure.dat # CMake or Setuptools 314s # hybrid_data_cmake.dat # CMake *NO TEST* 314s # 314s # hybrid_2/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure.py # CMake or Setuptools 314s # hybrid_2_cmake.py # CMake 314s # 314s # hybrid_2_pure/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure_1.py # CMake or Setuptools 314s # hybrid_2_pure_2.py # CMake or Setuptools 314s # 314s # pureModule.py # Setuptools 314s # 314s # pure/ 314s # __init__.py # Setuptools 314s # pure.py # Setuptools 314s # 314s # data/ 314s # pure.dat # Setuptools 314s 314s tmp_dir.join("setup.py").write( 314s textwrap.dedent( 314s """ 314s from skbuild import setup 314s #from setuptools import setup 314s setup( 314s name="test_hybrid_project", 314s version="1.2.3", 314s description=("an hybrid package mixing files installed by both " 314s "CMake and setuptools"), 314s author='The scikit-build team', 314s license="MIT", 314s cmake_source_dir='{cmake_source_dir}', 314s cmake_install_dir='{cmake_install_dir}', 314s # Arbitrary order of packages 314s packages=[ 314s {p_off} 'pure', 314s {h_off} 'hybrid.hybrid_2', 314s {h_off} 'hybrid', 314s {c_off} 'cmake', 314s {p_off} 'hybrid.hybrid_2_pure', 314s ], 314s py_modules=[ 314s {pm_off} '{package_base}pureModule', 314s {cm_off} '{package_base}cmakeModule', 314s ], 314s package_data={{ 314s {p_off} 'pure': ['data/pure.dat'], 314s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 314s }}, 314s # Arbitrary order of package_dir 314s package_dir = {{ 314s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 314s {p_off} 'pure': '{package_base}pure', 314s {h_off} 'hybrid': '{package_base}hybrid', 314s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 314s {c_off} 'cmake': '{package_base}cmake', 314s }} 314s ) 314s """.format( 314s cmake_source_dir=cmake_source_dir, 314s cmake_install_dir=package_base, 314s package_base=package_base_dir, 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s p_off="" if has_pure_package else "#", 314s pm_off="" if has_pure_module else "#", 314s ) 314s ) 314s ) 314s 314s src_dir = tmp_dir.ensure(package_base, dir=1) 314s 314s src_dir.join("CMakeLists.txt").write( 314s textwrap.dedent( 314s """ 314s cmake_minimum_required(VERSION 3.5.0) 314s project(hybrid NONE) 314s set(build_dir ${{CMAKE_BINARY_DIR}}) 314s 314s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 314s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 314s {c_off} install( 314s {c_off} FILES 314s {c_off} ${{build_dir}}/__init__.py 314s {c_off} ${{build_dir}}/cmake.py 314s {c_off} DESTINATION cmake 314s {c_off} ) 314s 314s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 314s {cm_off} install( 314s {cm_off} FILES ${{build_dir}}/cmakeModule.py 314s {cm_off} DESTINATION .) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 314s {h_off} DESTINATION hybrid/data) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 314s {h_off} DESTINATION hybrid/hybrid_2) 314s 314s install(CODE "message(STATUS \\\"Installation complete\\\")") 314s """.format( 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s ) 314s ) 314s ) 314s 314s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 314s path_types: Sequence[str] 314s try: 314s path_types = next( 314s iter( 314s zip( 314s *filter( 314s lambda i: i[1], 314s [ 314s ("c", has_cmake_package), 314s ("cm", has_cmake_module), 314s ("h", has_hybrid_package), 314s ("p", has_pure_package), 314s ("pm", has_pure_module), 314s ], 314s ) 314s ) 314s ) 314s ) 314s except StopIteration: 314s path_types = [] 314s 314s def select_paths(annotated_paths): 314s """Return a filtered list paths considering ``path_types``. 314s 314s `annotated_paths`` is list of tuple ``(type, path)`` where type 314s is either `c`, 'cm', `h`, `p` or 'pm'. 314s 314s """ 314s return filter(lambda i: i[0] in path_types, annotated_paths) 314s 314s # Commented paths are the one expected to be installed by CMake. For 314s # this reason, corresponding files should NOT be created in the source 314s # tree. 314s for _type, path in select_paths( 314s [ 314s # ('c', 'cmake/__init__.py'), 314s # ('c', 'cmake/cmake.py'), 314s # ('cm', 'cmakeModule.py'), 314s ("h", "hybrid/__init__.py"), 314s # ('h', 'hybrid/hybrid_cmake.dat'), 314s # ('h', 'hybrid/hybrid_cmake.py'), 314s ("h", "hybrid/hybrid_pure.dat"), 314s ("h", "hybrid/hybrid_pure.py"), 314s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 314s ("h", "hybrid/data/hybrid_data_pure.dat"), 314s ("h", "hybrid/hybrid_2/__init__.py"), 314s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 314s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 314s ("p", "hybrid/hybrid_2_pure/__init__.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 314s ("pm", "pureModule.py"), 314s ("p", "pure/__init__.py"), 314s ("p", "pure/pure.py"), 314s ("p", "pure/data/pure.dat"), 314s ] 314s ): 314s assert _type in {"p", "pm", "h"} 314s root = package_base if _type in {"p", "pm"} else cmake_source_dir 314s tmp_dir.ensure(os.path.join(root, path)) 314s 314s # Do not call the real setup function. Instead, replace it with 314s # a MagicMock allowing to check with which arguments it was invoked. 314s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 314s 314s # Convenience print function 314s def _pprint(desc, value=None): 314s print( 314s "-----------------\n" 314s f"{desc}:\n" 314s "\n" 314s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 314s ) 314s 314s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 314s 314s _pprint = ._pprint at 0xf3321de8> 314s _type = 'h' 314s cmake_source_dir = 'to/the/base' 314s has_cmake_module = 0 314s has_cmake_package = 0 314s has_hybrid_package = 1 314s has_pure_module = 0 314s has_pure_package = 0 314s mock_setup = 314s mocker = 314s package_base = 'to/the/base' 314s package_base_dir = 'to/the/base/' 314s path = 'hybrid/hybrid_2/hybrid_2_pure.py' 314s path_types = ('h',) 314s root = 'to/the/base' 314s select_paths = .select_paths at 0xf3314de8> 314s src_dir = local('/tmp/pytest-of-ubuntu/pytest-118/test_setup_inputs0/to/the/base') 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-118/test_setup_inputs0') 314s with_package_base = 1 314s 314s tests/test_setup.py:849: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-118/test_setup_inputs0') 314s setup_args = ['build'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-118/test_setup_inputs0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s ________________________ test_setup_inputs[1-0-1-0-0-0] ________________________ 314s 314s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 0 314s has_pure_package = 1, has_pure_module = 0, with_package_base = 1 314s mocker = 314s 314s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 314s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 314s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_module", [0, 1]) 314s @pytest.mark.parametrize("with_package_base", [0, 1]) 314s def test_setup_inputs( 314s has_cmake_package, 314s has_cmake_module, 314s has_hybrid_package, 314s has_pure_package, 314s has_pure_module, 314s with_package_base, 314s mocker, 314s ): 314s """This test that a project can have a package with some modules 314s installed using setup.py and some other modules installed using CMake. 314s """ 314s 314s tmp_dir = _tmpdir("test_setup_inputs") 314s 314s package_base = "to/the/base" if with_package_base else "" 314s package_base_dir = package_base + "/" if package_base else "" 314s cmake_source_dir = package_base 314s 314s if cmake_source_dir and (has_cmake_package or has_cmake_module): 314s pytest.skip( 314s "unsupported configuration: " 314s "python package fully generated by CMake does *NOT* work. " 314s "At least __init__.py should be in the project source tree" 314s ) 314s 314s # ------------------------------------------------------------------------- 314s # Here is the "SOURCE" tree layout: 314s # 314s # ROOT/ 314s # 314s # setup.py 314s # 314s # [/] 314s # 314s # pureModule.py 314s # 314s # pure/ 314s # __init__.py 314s # pure.py 314s # 314s # data/ 314s # pure.dat 314s # 314s # [/] 314s # 314s # hybrid/ 314s # CMakeLists.txt 314s # __init__.py 314s # hybrid_pure.dat 314s # hybrid_pure.py 314s # 314s # data/ 314s # hybrid_data_pure.dat 314s # 314s # hybrid_2/ 314s # __init__.py 314s # hybrid_2_pure.py 314s # 314s # hybrid_2_pure/ 314s # __init__.py 314s # hybrid_2_pure_1.py 314s # hybrid_2_pure_2.py 314s # 314s # 314s # ------------------------------------------------------------------------- 314s # and here is the "BINARY" distribution layout: 314s # 314s # The comment "CMake" or "Setuptools" indicates which tool is responsible 314s # for placing the file in the tree used to create the binary distribution. 314s # 314s # ROOT/ 314s # 314s # cmakeModule.py # CMake 314s # 314s # cmake/ 314s # __init__.py # CMake 314s # cmake.py # CMake 314s # 314s # hybrid/ 314s # hybrid_cmake.dat # CMake 314s # hybrid_cmake.py # CMake 314s # hybrid_pure.dat # Setuptools 314s # hybrid_pure.py # Setuptools 314s # 314s # data/ 314s # hybrid_data_pure.dat # CMake or Setuptools 314s # hybrid_data_cmake.dat # CMake *NO TEST* 314s # 314s # hybrid_2/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure.py # CMake or Setuptools 314s # hybrid_2_cmake.py # CMake 314s # 314s # hybrid_2_pure/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure_1.py # CMake or Setuptools 314s # hybrid_2_pure_2.py # CMake or Setuptools 314s # 314s # pureModule.py # Setuptools 314s # 314s # pure/ 314s # __init__.py # Setuptools 314s # pure.py # Setuptools 314s # 314s # data/ 314s # pure.dat # Setuptools 314s 314s tmp_dir.join("setup.py").write( 314s textwrap.dedent( 314s """ 314s from skbuild import setup 314s #from setuptools import setup 314s setup( 314s name="test_hybrid_project", 314s version="1.2.3", 314s description=("an hybrid package mixing files installed by both " 314s "CMake and setuptools"), 314s author='The scikit-build team', 314s license="MIT", 314s cmake_source_dir='{cmake_source_dir}', 314s cmake_install_dir='{cmake_install_dir}', 314s # Arbitrary order of packages 314s packages=[ 314s {p_off} 'pure', 314s {h_off} 'hybrid.hybrid_2', 314s {h_off} 'hybrid', 314s {c_off} 'cmake', 314s {p_off} 'hybrid.hybrid_2_pure', 314s ], 314s py_modules=[ 314s {pm_off} '{package_base}pureModule', 314s {cm_off} '{package_base}cmakeModule', 314s ], 314s package_data={{ 314s {p_off} 'pure': ['data/pure.dat'], 314s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 314s }}, 314s # Arbitrary order of package_dir 314s package_dir = {{ 314s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 314s {p_off} 'pure': '{package_base}pure', 314s {h_off} 'hybrid': '{package_base}hybrid', 314s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 314s {c_off} 'cmake': '{package_base}cmake', 314s }} 314s ) 314s """.format( 314s cmake_source_dir=cmake_source_dir, 314s cmake_install_dir=package_base, 314s package_base=package_base_dir, 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s p_off="" if has_pure_package else "#", 314s pm_off="" if has_pure_module else "#", 314s ) 314s ) 314s ) 314s 314s src_dir = tmp_dir.ensure(package_base, dir=1) 314s 314s src_dir.join("CMakeLists.txt").write( 314s textwrap.dedent( 314s """ 314s cmake_minimum_required(VERSION 3.5.0) 314s project(hybrid NONE) 314s set(build_dir ${{CMAKE_BINARY_DIR}}) 314s 314s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 314s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 314s {c_off} install( 314s {c_off} FILES 314s {c_off} ${{build_dir}}/__init__.py 314s {c_off} ${{build_dir}}/cmake.py 314s {c_off} DESTINATION cmake 314s {c_off} ) 314s 314s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 314s {cm_off} install( 314s {cm_off} FILES ${{build_dir}}/cmakeModule.py 314s {cm_off} DESTINATION .) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 314s {h_off} DESTINATION hybrid/data) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 314s {h_off} DESTINATION hybrid/hybrid_2) 314s 314s install(CODE "message(STATUS \\\"Installation complete\\\")") 314s """.format( 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s ) 314s ) 314s ) 314s 314s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 314s path_types: Sequence[str] 314s try: 314s path_types = next( 314s iter( 314s zip( 314s *filter( 314s lambda i: i[1], 314s [ 314s ("c", has_cmake_package), 314s ("cm", has_cmake_module), 314s ("h", has_hybrid_package), 314s ("p", has_pure_package), 314s ("pm", has_pure_module), 314s ], 314s ) 314s ) 314s ) 314s ) 314s except StopIteration: 314s path_types = [] 314s 314s def select_paths(annotated_paths): 314s """Return a filtered list paths considering ``path_types``. 314s 314s `annotated_paths`` is list of tuple ``(type, path)`` where type 314s is either `c`, 'cm', `h`, `p` or 'pm'. 314s 314s """ 314s return filter(lambda i: i[0] in path_types, annotated_paths) 314s 314s # Commented paths are the one expected to be installed by CMake. For 314s # this reason, corresponding files should NOT be created in the source 314s # tree. 314s for _type, path in select_paths( 314s [ 314s # ('c', 'cmake/__init__.py'), 314s # ('c', 'cmake/cmake.py'), 314s # ('cm', 'cmakeModule.py'), 314s ("h", "hybrid/__init__.py"), 314s # ('h', 'hybrid/hybrid_cmake.dat'), 314s # ('h', 'hybrid/hybrid_cmake.py'), 314s ("h", "hybrid/hybrid_pure.dat"), 314s ("h", "hybrid/hybrid_pure.py"), 314s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 314s ("h", "hybrid/data/hybrid_data_pure.dat"), 314s ("h", "hybrid/hybrid_2/__init__.py"), 314s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 314s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 314s ("p", "hybrid/hybrid_2_pure/__init__.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 314s ("pm", "pureModule.py"), 314s ("p", "pure/__init__.py"), 314s ("p", "pure/pure.py"), 314s ("p", "pure/data/pure.dat"), 314s ] 314s ): 314s assert _type in {"p", "pm", "h"} 314s root = package_base if _type in {"p", "pm"} else cmake_source_dir 314s tmp_dir.ensure(os.path.join(root, path)) 314s 314s # Do not call the real setup function. Instead, replace it with 314s # a MagicMock allowing to check with which arguments it was invoked. 314s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 314s 314s # Convenience print function 314s def _pprint(desc, value=None): 314s print( 314s "-----------------\n" 314s f"{desc}:\n" 314s "\n" 314s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 314s ) 314s 314s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 314s 314s _pprint = ._pprint at 0xf32f7758> 314s _type = 'p' 314s cmake_source_dir = 'to/the/base' 314s has_cmake_module = 0 314s has_cmake_package = 0 314s has_hybrid_package = 0 314s has_pure_module = 0 314s has_pure_package = 1 314s mock_setup = 314s mocker = 314s package_base = 'to/the/base' 314s package_base_dir = 'to/the/base/' 314s path = 'pure/data/pure.dat' 314s path_types = ('p',) 314s root = 'to/the/base' 314s select_paths = .select_paths at 0xf32ee668> 314s src_dir = local('/tmp/pytest-of-ubuntu/pytest-122/test_setup_inputs0/to/the/base') 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-122/test_setup_inputs0') 314s with_package_base = 1 314s 314s tests/test_setup.py:849: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-122/test_setup_inputs0') 314s setup_args = ['build'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-122/test_setup_inputs0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s ________________________ test_setup_inputs[1-0-1-1-0-0] ________________________ 314s 314s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 1 314s has_pure_package = 1, has_pure_module = 0, with_package_base = 1 314s mocker = 314s 314s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 314s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 314s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_module", [0, 1]) 314s @pytest.mark.parametrize("with_package_base", [0, 1]) 314s def test_setup_inputs( 314s has_cmake_package, 314s has_cmake_module, 314s has_hybrid_package, 314s has_pure_package, 314s has_pure_module, 314s with_package_base, 314s mocker, 314s ): 314s """This test that a project can have a package with some modules 314s installed using setup.py and some other modules installed using CMake. 314s """ 314s 314s tmp_dir = _tmpdir("test_setup_inputs") 314s 314s package_base = "to/the/base" if with_package_base else "" 314s package_base_dir = package_base + "/" if package_base else "" 314s cmake_source_dir = package_base 314s 314s if cmake_source_dir and (has_cmake_package or has_cmake_module): 314s pytest.skip( 314s "unsupported configuration: " 314s "python package fully generated by CMake does *NOT* work. " 314s "At least __init__.py should be in the project source tree" 314s ) 314s 314s # ------------------------------------------------------------------------- 314s # Here is the "SOURCE" tree layout: 314s # 314s # ROOT/ 314s # 314s # setup.py 314s # 314s # [/] 314s # 314s # pureModule.py 314s # 314s # pure/ 314s # __init__.py 314s # pure.py 314s # 314s # data/ 314s # pure.dat 314s # 314s # [/] 314s # 314s # hybrid/ 314s # CMakeLists.txt 314s # __init__.py 314s # hybrid_pure.dat 314s # hybrid_pure.py 314s # 314s # data/ 314s # hybrid_data_pure.dat 314s # 314s # hybrid_2/ 314s # __init__.py 314s # hybrid_2_pure.py 314s # 314s # hybrid_2_pure/ 314s # __init__.py 314s # hybrid_2_pure_1.py 314s # hybrid_2_pure_2.py 314s # 314s # 314s # ------------------------------------------------------------------------- 314s # and here is the "BINARY" distribution layout: 314s # 314s # The comment "CMake" or "Setuptools" indicates which tool is responsible 314s # for placing the file in the tree used to create the binary distribution. 314s # 314s # ROOT/ 314s # 314s # cmakeModule.py # CMake 314s # 314s # cmake/ 314s # __init__.py # CMake 314s # cmake.py # CMake 314s # 314s # hybrid/ 314s # hybrid_cmake.dat # CMake 314s # hybrid_cmake.py # CMake 314s # hybrid_pure.dat # Setuptools 314s # hybrid_pure.py # Setuptools 314s # 314s # data/ 314s # hybrid_data_pure.dat # CMake or Setuptools 314s # hybrid_data_cmake.dat # CMake *NO TEST* 314s # 314s # hybrid_2/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure.py # CMake or Setuptools 314s # hybrid_2_cmake.py # CMake 314s # 314s # hybrid_2_pure/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure_1.py # CMake or Setuptools 314s # hybrid_2_pure_2.py # CMake or Setuptools 314s # 314s # pureModule.py # Setuptools 314s # 314s # pure/ 314s # __init__.py # Setuptools 314s # pure.py # Setuptools 314s # 314s # data/ 314s # pure.dat # Setuptools 314s 314s tmp_dir.join("setup.py").write( 314s textwrap.dedent( 314s """ 314s from skbuild import setup 314s #from setuptools import setup 314s setup( 314s name="test_hybrid_project", 314s version="1.2.3", 314s description=("an hybrid package mixing files installed by both " 314s "CMake and setuptools"), 314s author='The scikit-build team', 314s license="MIT", 314s cmake_source_dir='{cmake_source_dir}', 314s cmake_install_dir='{cmake_install_dir}', 314s # Arbitrary order of packages 314s packages=[ 314s {p_off} 'pure', 314s {h_off} 'hybrid.hybrid_2', 314s {h_off} 'hybrid', 314s {c_off} 'cmake', 314s {p_off} 'hybrid.hybrid_2_pure', 314s ], 314s py_modules=[ 314s {pm_off} '{package_base}pureModule', 314s {cm_off} '{package_base}cmakeModule', 314s ], 314s package_data={{ 314s {p_off} 'pure': ['data/pure.dat'], 314s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 314s }}, 314s # Arbitrary order of package_dir 314s package_dir = {{ 314s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 314s {p_off} 'pure': '{package_base}pure', 314s {h_off} 'hybrid': '{package_base}hybrid', 314s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 314s {c_off} 'cmake': '{package_base}cmake', 314s }} 314s ) 314s """.format( 314s cmake_source_dir=cmake_source_dir, 314s cmake_install_dir=package_base, 314s package_base=package_base_dir, 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s p_off="" if has_pure_package else "#", 314s pm_off="" if has_pure_module else "#", 314s ) 314s ) 314s ) 314s 314s src_dir = tmp_dir.ensure(package_base, dir=1) 314s 314s src_dir.join("CMakeLists.txt").write( 314s textwrap.dedent( 314s """ 314s cmake_minimum_required(VERSION 3.5.0) 314s project(hybrid NONE) 314s set(build_dir ${{CMAKE_BINARY_DIR}}) 314s 314s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 314s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 314s {c_off} install( 314s {c_off} FILES 314s {c_off} ${{build_dir}}/__init__.py 314s {c_off} ${{build_dir}}/cmake.py 314s {c_off} DESTINATION cmake 314s {c_off} ) 314s 314s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 314s {cm_off} install( 314s {cm_off} FILES ${{build_dir}}/cmakeModule.py 314s {cm_off} DESTINATION .) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 314s {h_off} DESTINATION hybrid/data) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 314s {h_off} DESTINATION hybrid/hybrid_2) 314s 314s install(CODE "message(STATUS \\\"Installation complete\\\")") 314s """.format( 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s ) 314s ) 314s ) 314s 314s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 314s path_types: Sequence[str] 314s try: 314s path_types = next( 314s iter( 314s zip( 314s *filter( 314s lambda i: i[1], 314s [ 314s ("c", has_cmake_package), 314s ("cm", has_cmake_module), 314s ("h", has_hybrid_package), 314s ("p", has_pure_package), 314s ("pm", has_pure_module), 314s ], 314s ) 314s ) 314s ) 314s ) 314s except StopIteration: 314s path_types = [] 314s 314s def select_paths(annotated_paths): 314s """Return a filtered list paths considering ``path_types``. 314s 314s `annotated_paths`` is list of tuple ``(type, path)`` where type 314s is either `c`, 'cm', `h`, `p` or 'pm'. 314s 314s """ 314s return filter(lambda i: i[0] in path_types, annotated_paths) 314s 314s # Commented paths are the one expected to be installed by CMake. For 314s # this reason, corresponding files should NOT be created in the source 314s # tree. 314s for _type, path in select_paths( 314s [ 314s # ('c', 'cmake/__init__.py'), 314s # ('c', 'cmake/cmake.py'), 314s # ('cm', 'cmakeModule.py'), 314s ("h", "hybrid/__init__.py"), 314s # ('h', 'hybrid/hybrid_cmake.dat'), 314s # ('h', 'hybrid/hybrid_cmake.py'), 314s ("h", "hybrid/hybrid_pure.dat"), 314s ("h", "hybrid/hybrid_pure.py"), 314s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 314s ("h", "hybrid/data/hybrid_data_pure.dat"), 314s ("h", "hybrid/hybrid_2/__init__.py"), 314s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 314s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 314s ("p", "hybrid/hybrid_2_pure/__init__.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 314s ("pm", "pureModule.py"), 314s ("p", "pure/__init__.py"), 314s ("p", "pure/pure.py"), 314s ("p", "pure/data/pure.dat"), 314s ] 314s ): 314s assert _type in {"p", "pm", "h"} 314s root = package_base if _type in {"p", "pm"} else cmake_source_dir 314s tmp_dir.ensure(os.path.join(root, path)) 314s 314s # Do not call the real setup function. Instead, replace it with 314s # a MagicMock allowing to check with which arguments it was invoked. 314s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 314s 314s # Convenience print function 314s def _pprint(desc, value=None): 314s print( 314s "-----------------\n" 314s f"{desc}:\n" 314s "\n" 314s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 314s ) 314s 314s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 314s 314s _pprint = ._pprint at 0xf331a5c8> 314s _type = 'p' 314s cmake_source_dir = 'to/the/base' 314s has_cmake_module = 0 314s has_cmake_package = 0 314s has_hybrid_package = 1 314s has_pure_module = 0 314s has_pure_package = 1 314s mock_setup = 314s mocker = 314s package_base = 'to/the/base' 314s package_base_dir = 'to/the/base/' 314s path = 'pure/data/pure.dat' 314s path_types = ('h', 'p') 314s root = 'to/the/base' 314s select_paths = .select_paths at 0xf32f7438> 314s src_dir = local('/tmp/pytest-of-ubuntu/pytest-126/test_setup_inputs0/to/the/base') 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-126/test_setup_inputs0') 314s with_package_base = 1 314s 314s tests/test_setup.py:849: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-126/test_setup_inputs0') 314s setup_args = ['build'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-126/test_setup_inputs0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s ________________________ test_setup_inputs[1-1-0-0-0-0] ________________________ 314s 314s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 0 314s has_pure_package = 0, has_pure_module = 1, with_package_base = 1 314s mocker = 314s 314s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 314s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 314s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_module", [0, 1]) 314s @pytest.mark.parametrize("with_package_base", [0, 1]) 314s def test_setup_inputs( 314s has_cmake_package, 314s has_cmake_module, 314s has_hybrid_package, 314s has_pure_package, 314s has_pure_module, 314s with_package_base, 314s mocker, 314s ): 314s """This test that a project can have a package with some modules 314s installed using setup.py and some other modules installed using CMake. 314s """ 314s 314s tmp_dir = _tmpdir("test_setup_inputs") 314s 314s package_base = "to/the/base" if with_package_base else "" 314s package_base_dir = package_base + "/" if package_base else "" 314s cmake_source_dir = package_base 314s 314s if cmake_source_dir and (has_cmake_package or has_cmake_module): 314s pytest.skip( 314s "unsupported configuration: " 314s "python package fully generated by CMake does *NOT* work. " 314s "At least __init__.py should be in the project source tree" 314s ) 314s 314s # ------------------------------------------------------------------------- 314s # Here is the "SOURCE" tree layout: 314s # 314s # ROOT/ 314s # 314s # setup.py 314s # 314s # [/] 314s # 314s # pureModule.py 314s # 314s # pure/ 314s # __init__.py 314s # pure.py 314s # 314s # data/ 314s # pure.dat 314s # 314s # [/] 314s # 314s # hybrid/ 314s # CMakeLists.txt 314s # __init__.py 314s # hybrid_pure.dat 314s # hybrid_pure.py 314s # 314s # data/ 314s # hybrid_data_pure.dat 314s # 314s # hybrid_2/ 314s # __init__.py 314s # hybrid_2_pure.py 314s # 314s # hybrid_2_pure/ 314s # __init__.py 314s # hybrid_2_pure_1.py 314s # hybrid_2_pure_2.py 314s # 314s # 314s # ------------------------------------------------------------------------- 314s # and here is the "BINARY" distribution layout: 314s # 314s # The comment "CMake" or "Setuptools" indicates which tool is responsible 314s # for placing the file in the tree used to create the binary distribution. 314s # 314s # ROOT/ 314s # 314s # cmakeModule.py # CMake 314s # 314s # cmake/ 314s # __init__.py # CMake 314s # cmake.py # CMake 314s # 314s # hybrid/ 314s # hybrid_cmake.dat # CMake 314s # hybrid_cmake.py # CMake 314s # hybrid_pure.dat # Setuptools 314s # hybrid_pure.py # Setuptools 314s # 314s # data/ 314s # hybrid_data_pure.dat # CMake or Setuptools 314s # hybrid_data_cmake.dat # CMake *NO TEST* 314s # 314s # hybrid_2/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure.py # CMake or Setuptools 314s # hybrid_2_cmake.py # CMake 314s # 314s # hybrid_2_pure/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure_1.py # CMake or Setuptools 314s # hybrid_2_pure_2.py # CMake or Setuptools 314s # 314s # pureModule.py # Setuptools 314s # 314s # pure/ 314s # __init__.py # Setuptools 314s # pure.py # Setuptools 314s # 314s # data/ 314s # pure.dat # Setuptools 314s 314s tmp_dir.join("setup.py").write( 314s textwrap.dedent( 314s """ 314s from skbuild import setup 314s #from setuptools import setup 314s setup( 314s name="test_hybrid_project", 314s version="1.2.3", 314s description=("an hybrid package mixing files installed by both " 314s "CMake and setuptools"), 314s author='The scikit-build team', 314s license="MIT", 314s cmake_source_dir='{cmake_source_dir}', 314s cmake_install_dir='{cmake_install_dir}', 314s # Arbitrary order of packages 314s packages=[ 314s {p_off} 'pure', 314s {h_off} 'hybrid.hybrid_2', 314s {h_off} 'hybrid', 314s {c_off} 'cmake', 314s {p_off} 'hybrid.hybrid_2_pure', 314s ], 314s py_modules=[ 314s {pm_off} '{package_base}pureModule', 314s {cm_off} '{package_base}cmakeModule', 314s ], 314s package_data={{ 314s {p_off} 'pure': ['data/pure.dat'], 314s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 314s }}, 314s # Arbitrary order of package_dir 314s package_dir = {{ 314s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 314s {p_off} 'pure': '{package_base}pure', 314s {h_off} 'hybrid': '{package_base}hybrid', 314s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 314s {c_off} 'cmake': '{package_base}cmake', 314s }} 314s ) 314s """.format( 314s cmake_source_dir=cmake_source_dir, 314s cmake_install_dir=package_base, 314s package_base=package_base_dir, 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s p_off="" if has_pure_package else "#", 314s pm_off="" if has_pure_module else "#", 314s ) 314s ) 314s ) 314s 314s src_dir = tmp_dir.ensure(package_base, dir=1) 314s 314s src_dir.join("CMakeLists.txt").write( 314s textwrap.dedent( 314s """ 314s cmake_minimum_required(VERSION 3.5.0) 314s project(hybrid NONE) 314s set(build_dir ${{CMAKE_BINARY_DIR}}) 314s 314s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 314s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 314s {c_off} install( 314s {c_off} FILES 314s {c_off} ${{build_dir}}/__init__.py 314s {c_off} ${{build_dir}}/cmake.py 314s {c_off} DESTINATION cmake 314s {c_off} ) 314s 314s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 314s {cm_off} install( 314s {cm_off} FILES ${{build_dir}}/cmakeModule.py 314s {cm_off} DESTINATION .) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 314s {h_off} DESTINATION hybrid/data) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 314s {h_off} DESTINATION hybrid/hybrid_2) 314s 314s install(CODE "message(STATUS \\\"Installation complete\\\")") 314s """.format( 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s ) 314s ) 314s ) 314s 314s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 314s path_types: Sequence[str] 314s try: 314s path_types = next( 314s iter( 314s zip( 314s *filter( 314s lambda i: i[1], 314s [ 314s ("c", has_cmake_package), 314s ("cm", has_cmake_module), 314s ("h", has_hybrid_package), 314s ("p", has_pure_package), 314s ("pm", has_pure_module), 314s ], 314s ) 314s ) 314s ) 314s ) 314s except StopIteration: 314s path_types = [] 314s 314s def select_paths(annotated_paths): 314s """Return a filtered list paths considering ``path_types``. 314s 314s `annotated_paths`` is list of tuple ``(type, path)`` where type 314s is either `c`, 'cm', `h`, `p` or 'pm'. 314s 314s """ 314s return filter(lambda i: i[0] in path_types, annotated_paths) 314s 314s # Commented paths are the one expected to be installed by CMake. For 314s # this reason, corresponding files should NOT be created in the source 314s # tree. 314s for _type, path in select_paths( 314s [ 314s # ('c', 'cmake/__init__.py'), 314s # ('c', 'cmake/cmake.py'), 314s # ('cm', 'cmakeModule.py'), 314s ("h", "hybrid/__init__.py"), 314s # ('h', 'hybrid/hybrid_cmake.dat'), 314s # ('h', 'hybrid/hybrid_cmake.py'), 314s ("h", "hybrid/hybrid_pure.dat"), 314s ("h", "hybrid/hybrid_pure.py"), 314s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 314s ("h", "hybrid/data/hybrid_data_pure.dat"), 314s ("h", "hybrid/hybrid_2/__init__.py"), 314s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 314s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 314s ("p", "hybrid/hybrid_2_pure/__init__.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 314s ("pm", "pureModule.py"), 314s ("p", "pure/__init__.py"), 314s ("p", "pure/pure.py"), 314s ("p", "pure/data/pure.dat"), 314s ] 314s ): 314s assert _type in {"p", "pm", "h"} 314s root = package_base if _type in {"p", "pm"} else cmake_source_dir 314s tmp_dir.ensure(os.path.join(root, path)) 314s 314s # Do not call the real setup function. Instead, replace it with 314s # a MagicMock allowing to check with which arguments it was invoked. 314s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 314s 314s # Convenience print function 314s def _pprint(desc, value=None): 314s print( 314s "-----------------\n" 314s f"{desc}:\n" 314s "\n" 314s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 314s ) 314s 314s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 314s 314s _pprint = ._pprint at 0xf3328e88> 314s _type = 'pm' 314s cmake_source_dir = 'to/the/base' 314s has_cmake_module = 0 314s has_cmake_package = 0 314s has_hybrid_package = 0 314s has_pure_module = 1 314s has_pure_package = 0 314s mock_setup = 314s mocker = 314s package_base = 'to/the/base' 314s package_base_dir = 'to/the/base/' 314s path = 'pureModule.py' 314s path_types = ('pm',) 314s root = 'to/the/base' 314s select_paths = .select_paths at 0xf3330d98> 314s src_dir = local('/tmp/pytest-of-ubuntu/pytest-130/test_setup_inputs0/to/the/base') 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-130/test_setup_inputs0') 314s with_package_base = 1 314s 314s tests/test_setup.py:849: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-130/test_setup_inputs0') 314s setup_args = ['build'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-130/test_setup_inputs0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s ________________________ test_setup_inputs[1-1-0-1-0-0] ________________________ 314s 314s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 1 314s has_pure_package = 0, has_pure_module = 1, with_package_base = 1 314s mocker = 314s 314s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 314s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 314s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_module", [0, 1]) 314s @pytest.mark.parametrize("with_package_base", [0, 1]) 314s def test_setup_inputs( 314s has_cmake_package, 314s has_cmake_module, 314s has_hybrid_package, 314s has_pure_package, 314s has_pure_module, 314s with_package_base, 314s mocker, 314s ): 314s """This test that a project can have a package with some modules 314s installed using setup.py and some other modules installed using CMake. 314s """ 314s 314s tmp_dir = _tmpdir("test_setup_inputs") 314s 314s package_base = "to/the/base" if with_package_base else "" 314s package_base_dir = package_base + "/" if package_base else "" 314s cmake_source_dir = package_base 314s 314s if cmake_source_dir and (has_cmake_package or has_cmake_module): 314s pytest.skip( 314s "unsupported configuration: " 314s "python package fully generated by CMake does *NOT* work. " 314s "At least __init__.py should be in the project source tree" 314s ) 314s 314s # ------------------------------------------------------------------------- 314s # Here is the "SOURCE" tree layout: 314s # 314s # ROOT/ 314s # 314s # setup.py 314s # 314s # [/] 314s # 314s # pureModule.py 314s # 314s # pure/ 314s # __init__.py 314s # pure.py 314s # 314s # data/ 314s # pure.dat 314s # 314s # [/] 314s # 314s # hybrid/ 314s # CMakeLists.txt 314s # __init__.py 314s # hybrid_pure.dat 314s # hybrid_pure.py 314s # 314s # data/ 314s # hybrid_data_pure.dat 314s # 314s # hybrid_2/ 314s # __init__.py 314s # hybrid_2_pure.py 314s # 314s # hybrid_2_pure/ 314s # __init__.py 314s # hybrid_2_pure_1.py 314s # hybrid_2_pure_2.py 314s # 314s # 314s # ------------------------------------------------------------------------- 314s # and here is the "BINARY" distribution layout: 314s # 314s # The comment "CMake" or "Setuptools" indicates which tool is responsible 314s # for placing the file in the tree used to create the binary distribution. 314s # 314s # ROOT/ 314s # 314s # cmakeModule.py # CMake 314s # 314s # cmake/ 314s # __init__.py # CMake 314s # cmake.py # CMake 314s # 314s # hybrid/ 314s # hybrid_cmake.dat # CMake 314s # hybrid_cmake.py # CMake 314s # hybrid_pure.dat # Setuptools 314s # hybrid_pure.py # Setuptools 314s # 314s # data/ 314s # hybrid_data_pure.dat # CMake or Setuptools 314s # hybrid_data_cmake.dat # CMake *NO TEST* 314s # 314s # hybrid_2/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure.py # CMake or Setuptools 314s # hybrid_2_cmake.py # CMake 314s # 314s # hybrid_2_pure/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure_1.py # CMake or Setuptools 314s # hybrid_2_pure_2.py # CMake or Setuptools 314s # 314s # pureModule.py # Setuptools 314s # 314s # pure/ 314s # __init__.py # Setuptools 314s # pure.py # Setuptools 314s # 314s # data/ 314s # pure.dat # Setuptools 314s 314s tmp_dir.join("setup.py").write( 314s textwrap.dedent( 314s """ 314s from skbuild import setup 314s #from setuptools import setup 314s setup( 314s name="test_hybrid_project", 314s version="1.2.3", 314s description=("an hybrid package mixing files installed by both " 314s "CMake and setuptools"), 314s author='The scikit-build team', 314s license="MIT", 314s cmake_source_dir='{cmake_source_dir}', 314s cmake_install_dir='{cmake_install_dir}', 314s # Arbitrary order of packages 314s packages=[ 314s {p_off} 'pure', 314s {h_off} 'hybrid.hybrid_2', 314s {h_off} 'hybrid', 314s {c_off} 'cmake', 314s {p_off} 'hybrid.hybrid_2_pure', 314s ], 314s py_modules=[ 314s {pm_off} '{package_base}pureModule', 314s {cm_off} '{package_base}cmakeModule', 314s ], 314s package_data={{ 314s {p_off} 'pure': ['data/pure.dat'], 314s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 314s }}, 314s # Arbitrary order of package_dir 314s package_dir = {{ 314s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 314s {p_off} 'pure': '{package_base}pure', 314s {h_off} 'hybrid': '{package_base}hybrid', 314s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 314s {c_off} 'cmake': '{package_base}cmake', 314s }} 314s ) 314s """.format( 314s cmake_source_dir=cmake_source_dir, 314s cmake_install_dir=package_base, 314s package_base=package_base_dir, 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s p_off="" if has_pure_package else "#", 314s pm_off="" if has_pure_module else "#", 314s ) 314s ) 314s ) 314s 314s src_dir = tmp_dir.ensure(package_base, dir=1) 314s 314s src_dir.join("CMakeLists.txt").write( 314s textwrap.dedent( 314s """ 314s cmake_minimum_required(VERSION 3.5.0) 314s project(hybrid NONE) 314s set(build_dir ${{CMAKE_BINARY_DIR}}) 314s 314s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 314s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 314s {c_off} install( 314s {c_off} FILES 314s {c_off} ${{build_dir}}/__init__.py 314s {c_off} ${{build_dir}}/cmake.py 314s {c_off} DESTINATION cmake 314s {c_off} ) 314s 314s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 314s {cm_off} install( 314s {cm_off} FILES ${{build_dir}}/cmakeModule.py 314s {cm_off} DESTINATION .) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 314s {h_off} DESTINATION hybrid/data) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 314s {h_off} DESTINATION hybrid/hybrid_2) 314s 314s install(CODE "message(STATUS \\\"Installation complete\\\")") 314s """.format( 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s ) 314s ) 314s ) 314s 314s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 314s path_types: Sequence[str] 314s try: 314s path_types = next( 314s iter( 314s zip( 314s *filter( 314s lambda i: i[1], 314s [ 314s ("c", has_cmake_package), 314s ("cm", has_cmake_module), 314s ("h", has_hybrid_package), 314s ("p", has_pure_package), 314s ("pm", has_pure_module), 314s ], 314s ) 314s ) 314s ) 314s ) 314s except StopIteration: 314s path_types = [] 314s 314s def select_paths(annotated_paths): 314s """Return a filtered list paths considering ``path_types``. 314s 314s `annotated_paths`` is list of tuple ``(type, path)`` where type 314s is either `c`, 'cm', `h`, `p` or 'pm'. 314s 314s """ 314s return filter(lambda i: i[0] in path_types, annotated_paths) 314s 314s # Commented paths are the one expected to be installed by CMake. For 314s # this reason, corresponding files should NOT be created in the source 314s # tree. 314s for _type, path in select_paths( 314s [ 314s # ('c', 'cmake/__init__.py'), 314s # ('c', 'cmake/cmake.py'), 314s # ('cm', 'cmakeModule.py'), 314s ("h", "hybrid/__init__.py"), 314s # ('h', 'hybrid/hybrid_cmake.dat'), 314s # ('h', 'hybrid/hybrid_cmake.py'), 314s ("h", "hybrid/hybrid_pure.dat"), 314s ("h", "hybrid/hybrid_pure.py"), 314s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 314s ("h", "hybrid/data/hybrid_data_pure.dat"), 314s ("h", "hybrid/hybrid_2/__init__.py"), 314s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 314s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 314s ("p", "hybrid/hybrid_2_pure/__init__.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 314s ("pm", "pureModule.py"), 314s ("p", "pure/__init__.py"), 314s ("p", "pure/pure.py"), 314s ("p", "pure/data/pure.dat"), 314s ] 314s ): 314s assert _type in {"p", "pm", "h"} 314s root = package_base if _type in {"p", "pm"} else cmake_source_dir 314s tmp_dir.ensure(os.path.join(root, path)) 314s 314s # Do not call the real setup function. Instead, replace it with 314s # a MagicMock allowing to check with which arguments it was invoked. 314s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 314s 314s # Convenience print function 314s def _pprint(desc, value=None): 314s print( 314s "-----------------\n" 314s f"{desc}:\n" 314s "\n" 314s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 314s ) 314s 314s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 314s 314s _pprint = ._pprint at 0xf3306a28> 314s _type = 'pm' 314s cmake_source_dir = 'to/the/base' 314s has_cmake_module = 0 314s has_cmake_package = 0 314s has_hybrid_package = 1 314s has_pure_module = 1 314s has_pure_package = 0 314s mock_setup = 314s mocker = 314s package_base = 'to/the/base' 314s package_base_dir = 'to/the/base/' 314s path = 'pureModule.py' 314s path_types = ('h', 'pm') 314s root = 'to/the/base' 314s select_paths = .select_paths at 0xf3306bb8> 314s src_dir = local('/tmp/pytest-of-ubuntu/pytest-134/test_setup_inputs0/to/the/base') 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-134/test_setup_inputs0') 314s with_package_base = 1 314s 314s tests/test_setup.py:849: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-134/test_setup_inputs0') 314s setup_args = ['build'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-134/test_setup_inputs0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s ________________________ test_setup_inputs[1-1-1-0-0-0] ________________________ 314s 314s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 0 314s has_pure_package = 1, has_pure_module = 1, with_package_base = 1 314s mocker = 314s 314s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 314s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 314s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_module", [0, 1]) 314s @pytest.mark.parametrize("with_package_base", [0, 1]) 314s def test_setup_inputs( 314s has_cmake_package, 314s has_cmake_module, 314s has_hybrid_package, 314s has_pure_package, 314s has_pure_module, 314s with_package_base, 314s mocker, 314s ): 314s """This test that a project can have a package with some modules 314s installed using setup.py and some other modules installed using CMake. 314s """ 314s 314s tmp_dir = _tmpdir("test_setup_inputs") 314s 314s package_base = "to/the/base" if with_package_base else "" 314s package_base_dir = package_base + "/" if package_base else "" 314s cmake_source_dir = package_base 314s 314s if cmake_source_dir and (has_cmake_package or has_cmake_module): 314s pytest.skip( 314s "unsupported configuration: " 314s "python package fully generated by CMake does *NOT* work. " 314s "At least __init__.py should be in the project source tree" 314s ) 314s 314s # ------------------------------------------------------------------------- 314s # Here is the "SOURCE" tree layout: 314s # 314s # ROOT/ 314s # 314s # setup.py 314s # 314s # [/] 314s # 314s # pureModule.py 314s # 314s # pure/ 314s # __init__.py 314s # pure.py 314s # 314s # data/ 314s # pure.dat 314s # 314s # [/] 314s # 314s # hybrid/ 314s # CMakeLists.txt 314s # __init__.py 314s # hybrid_pure.dat 314s # hybrid_pure.py 314s # 314s # data/ 314s # hybrid_data_pure.dat 314s # 314s # hybrid_2/ 314s # __init__.py 314s # hybrid_2_pure.py 314s # 314s # hybrid_2_pure/ 314s # __init__.py 314s # hybrid_2_pure_1.py 314s # hybrid_2_pure_2.py 314s # 314s # 314s # ------------------------------------------------------------------------- 314s # and here is the "BINARY" distribution layout: 314s # 314s # The comment "CMake" or "Setuptools" indicates which tool is responsible 314s # for placing the file in the tree used to create the binary distribution. 314s # 314s # ROOT/ 314s # 314s # cmakeModule.py # CMake 314s # 314s # cmake/ 314s # __init__.py # CMake 314s # cmake.py # CMake 314s # 314s # hybrid/ 314s # hybrid_cmake.dat # CMake 314s # hybrid_cmake.py # CMake 314s # hybrid_pure.dat # Setuptools 314s # hybrid_pure.py # Setuptools 314s # 314s # data/ 314s # hybrid_data_pure.dat # CMake or Setuptools 314s # hybrid_data_cmake.dat # CMake *NO TEST* 314s # 314s # hybrid_2/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure.py # CMake or Setuptools 314s # hybrid_2_cmake.py # CMake 314s # 314s # hybrid_2_pure/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure_1.py # CMake or Setuptools 314s # hybrid_2_pure_2.py # CMake or Setuptools 314s # 314s # pureModule.py # Setuptools 314s # 314s # pure/ 314s # __init__.py # Setuptools 314s # pure.py # Setuptools 314s # 314s # data/ 314s # pure.dat # Setuptools 314s 314s tmp_dir.join("setup.py").write( 314s textwrap.dedent( 314s """ 314s from skbuild import setup 314s #from setuptools import setup 314s setup( 314s name="test_hybrid_project", 314s version="1.2.3", 314s description=("an hybrid package mixing files installed by both " 314s "CMake and setuptools"), 314s author='The scikit-build team', 314s license="MIT", 314s cmake_source_dir='{cmake_source_dir}', 314s cmake_install_dir='{cmake_install_dir}', 314s # Arbitrary order of packages 314s packages=[ 314s {p_off} 'pure', 314s {h_off} 'hybrid.hybrid_2', 314s {h_off} 'hybrid', 314s {c_off} 'cmake', 314s {p_off} 'hybrid.hybrid_2_pure', 314s ], 314s py_modules=[ 314s {pm_off} '{package_base}pureModule', 314s {cm_off} '{package_base}cmakeModule', 314s ], 314s package_data={{ 314s {p_off} 'pure': ['data/pure.dat'], 314s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 314s }}, 314s # Arbitrary order of package_dir 314s package_dir = {{ 314s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 314s {p_off} 'pure': '{package_base}pure', 314s {h_off} 'hybrid': '{package_base}hybrid', 314s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 314s {c_off} 'cmake': '{package_base}cmake', 314s }} 314s ) 314s """.format( 314s cmake_source_dir=cmake_source_dir, 314s cmake_install_dir=package_base, 314s package_base=package_base_dir, 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s p_off="" if has_pure_package else "#", 314s pm_off="" if has_pure_module else "#", 314s ) 314s ) 314s ) 314s 314s src_dir = tmp_dir.ensure(package_base, dir=1) 314s 314s src_dir.join("CMakeLists.txt").write( 314s textwrap.dedent( 314s """ 314s cmake_minimum_required(VERSION 3.5.0) 314s project(hybrid NONE) 314s set(build_dir ${{CMAKE_BINARY_DIR}}) 314s 314s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 314s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 314s {c_off} install( 314s {c_off} FILES 314s {c_off} ${{build_dir}}/__init__.py 314s {c_off} ${{build_dir}}/cmake.py 314s {c_off} DESTINATION cmake 314s {c_off} ) 314s 314s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 314s {cm_off} install( 314s {cm_off} FILES ${{build_dir}}/cmakeModule.py 314s {cm_off} DESTINATION .) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 314s {h_off} DESTINATION hybrid/data) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 314s {h_off} DESTINATION hybrid/hybrid_2) 314s 314s install(CODE "message(STATUS \\\"Installation complete\\\")") 314s """.format( 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s ) 314s ) 314s ) 314s 314s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 314s path_types: Sequence[str] 314s try: 314s path_types = next( 314s iter( 314s zip( 314s *filter( 314s lambda i: i[1], 314s [ 314s ("c", has_cmake_package), 314s ("cm", has_cmake_module), 314s ("h", has_hybrid_package), 314s ("p", has_pure_package), 314s ("pm", has_pure_module), 314s ], 314s ) 314s ) 314s ) 314s ) 314s except StopIteration: 314s path_types = [] 314s 314s def select_paths(annotated_paths): 314s """Return a filtered list paths considering ``path_types``. 314s 314s `annotated_paths`` is list of tuple ``(type, path)`` where type 314s is either `c`, 'cm', `h`, `p` or 'pm'. 314s 314s """ 314s return filter(lambda i: i[0] in path_types, annotated_paths) 314s 314s # Commented paths are the one expected to be installed by CMake. For 314s # this reason, corresponding files should NOT be created in the source 314s # tree. 314s for _type, path in select_paths( 314s [ 314s # ('c', 'cmake/__init__.py'), 314s # ('c', 'cmake/cmake.py'), 314s # ('cm', 'cmakeModule.py'), 314s ("h", "hybrid/__init__.py"), 314s # ('h', 'hybrid/hybrid_cmake.dat'), 314s # ('h', 'hybrid/hybrid_cmake.py'), 314s ("h", "hybrid/hybrid_pure.dat"), 314s ("h", "hybrid/hybrid_pure.py"), 314s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 314s ("h", "hybrid/data/hybrid_data_pure.dat"), 314s ("h", "hybrid/hybrid_2/__init__.py"), 314s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 314s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 314s ("p", "hybrid/hybrid_2_pure/__init__.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 314s ("pm", "pureModule.py"), 314s ("p", "pure/__init__.py"), 314s ("p", "pure/pure.py"), 314s ("p", "pure/data/pure.dat"), 314s ] 314s ): 314s assert _type in {"p", "pm", "h"} 314s root = package_base if _type in {"p", "pm"} else cmake_source_dir 314s tmp_dir.ensure(os.path.join(root, path)) 314s 314s # Do not call the real setup function. Instead, replace it with 314s # a MagicMock allowing to check with which arguments it was invoked. 314s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 314s 314s # Convenience print function 314s def _pprint(desc, value=None): 314s print( 314s "-----------------\n" 314s f"{desc}:\n" 314s "\n" 314s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 314s ) 314s 314s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 314s 314s _pprint = ._pprint at 0xf3299e38> 314s _type = 'p' 314s cmake_source_dir = 'to/the/base' 314s has_cmake_module = 0 314s has_cmake_package = 0 314s has_hybrid_package = 0 314s has_pure_module = 1 314s has_pure_package = 1 314s mock_setup = 314s mocker = 314s package_base = 'to/the/base' 314s package_base_dir = 'to/the/base/' 314s path = 'pure/data/pure.dat' 314s path_types = ('p', 'pm') 314s root = 'to/the/base' 314s select_paths = .select_paths at 0xf3328e38> 314s src_dir = local('/tmp/pytest-of-ubuntu/pytest-138/test_setup_inputs0/to/the/base') 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-138/test_setup_inputs0') 314s with_package_base = 1 314s 314s tests/test_setup.py:849: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-138/test_setup_inputs0') 314s setup_args = ['build'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-138/test_setup_inputs0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s ________________________ test_setup_inputs[1-1-1-1-0-0] ________________________ 314s 314s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 1 314s has_pure_package = 1, has_pure_module = 1, with_package_base = 1 314s mocker = 314s 314s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 314s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 314s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_package", [0, 1]) 314s @pytest.mark.parametrize("has_pure_module", [0, 1]) 314s @pytest.mark.parametrize("with_package_base", [0, 1]) 314s def test_setup_inputs( 314s has_cmake_package, 314s has_cmake_module, 314s has_hybrid_package, 314s has_pure_package, 314s has_pure_module, 314s with_package_base, 314s mocker, 314s ): 314s """This test that a project can have a package with some modules 314s installed using setup.py and some other modules installed using CMake. 314s """ 314s 314s tmp_dir = _tmpdir("test_setup_inputs") 314s 314s package_base = "to/the/base" if with_package_base else "" 314s package_base_dir = package_base + "/" if package_base else "" 314s cmake_source_dir = package_base 314s 314s if cmake_source_dir and (has_cmake_package or has_cmake_module): 314s pytest.skip( 314s "unsupported configuration: " 314s "python package fully generated by CMake does *NOT* work. " 314s "At least __init__.py should be in the project source tree" 314s ) 314s 314s # ------------------------------------------------------------------------- 314s # Here is the "SOURCE" tree layout: 314s # 314s # ROOT/ 314s # 314s # setup.py 314s # 314s # [/] 314s # 314s # pureModule.py 314s # 314s # pure/ 314s # __init__.py 314s # pure.py 314s # 314s # data/ 314s # pure.dat 314s # 314s # [/] 314s # 314s # hybrid/ 314s # CMakeLists.txt 314s # __init__.py 314s # hybrid_pure.dat 314s # hybrid_pure.py 314s # 314s # data/ 314s # hybrid_data_pure.dat 314s # 314s # hybrid_2/ 314s # __init__.py 314s # hybrid_2_pure.py 314s # 314s # hybrid_2_pure/ 314s # __init__.py 314s # hybrid_2_pure_1.py 314s # hybrid_2_pure_2.py 314s # 314s # 314s # ------------------------------------------------------------------------- 314s # and here is the "BINARY" distribution layout: 314s # 314s # The comment "CMake" or "Setuptools" indicates which tool is responsible 314s # for placing the file in the tree used to create the binary distribution. 314s # 314s # ROOT/ 314s # 314s # cmakeModule.py # CMake 314s # 314s # cmake/ 314s # __init__.py # CMake 314s # cmake.py # CMake 314s # 314s # hybrid/ 314s # hybrid_cmake.dat # CMake 314s # hybrid_cmake.py # CMake 314s # hybrid_pure.dat # Setuptools 314s # hybrid_pure.py # Setuptools 314s # 314s # data/ 314s # hybrid_data_pure.dat # CMake or Setuptools 314s # hybrid_data_cmake.dat # CMake *NO TEST* 314s # 314s # hybrid_2/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure.py # CMake or Setuptools 314s # hybrid_2_cmake.py # CMake 314s # 314s # hybrid_2_pure/ 314s # __init__.py # CMake or Setuptools 314s # hybrid_2_pure_1.py # CMake or Setuptools 314s # hybrid_2_pure_2.py # CMake or Setuptools 314s # 314s # pureModule.py # Setuptools 314s # 314s # pure/ 314s # __init__.py # Setuptools 314s # pure.py # Setuptools 314s # 314s # data/ 314s # pure.dat # Setuptools 314s 314s tmp_dir.join("setup.py").write( 314s textwrap.dedent( 314s """ 314s from skbuild import setup 314s #from setuptools import setup 314s setup( 314s name="test_hybrid_project", 314s version="1.2.3", 314s description=("an hybrid package mixing files installed by both " 314s "CMake and setuptools"), 314s author='The scikit-build team', 314s license="MIT", 314s cmake_source_dir='{cmake_source_dir}', 314s cmake_install_dir='{cmake_install_dir}', 314s # Arbitrary order of packages 314s packages=[ 314s {p_off} 'pure', 314s {h_off} 'hybrid.hybrid_2', 314s {h_off} 'hybrid', 314s {c_off} 'cmake', 314s {p_off} 'hybrid.hybrid_2_pure', 314s ], 314s py_modules=[ 314s {pm_off} '{package_base}pureModule', 314s {cm_off} '{package_base}cmakeModule', 314s ], 314s package_data={{ 314s {p_off} 'pure': ['data/pure.dat'], 314s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 314s }}, 314s # Arbitrary order of package_dir 314s package_dir = {{ 314s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 314s {p_off} 'pure': '{package_base}pure', 314s {h_off} 'hybrid': '{package_base}hybrid', 314s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 314s {c_off} 'cmake': '{package_base}cmake', 314s }} 314s ) 314s """.format( 314s cmake_source_dir=cmake_source_dir, 314s cmake_install_dir=package_base, 314s package_base=package_base_dir, 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s p_off="" if has_pure_package else "#", 314s pm_off="" if has_pure_module else "#", 314s ) 314s ) 314s ) 314s 314s src_dir = tmp_dir.ensure(package_base, dir=1) 314s 314s src_dir.join("CMakeLists.txt").write( 314s textwrap.dedent( 314s """ 314s cmake_minimum_required(VERSION 3.5.0) 314s project(hybrid NONE) 314s set(build_dir ${{CMAKE_BINARY_DIR}}) 314s 314s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 314s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 314s {c_off} install( 314s {c_off} FILES 314s {c_off} ${{build_dir}}/__init__.py 314s {c_off} ${{build_dir}}/cmake.py 314s {c_off} DESTINATION cmake 314s {c_off} ) 314s 314s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 314s {cm_off} install( 314s {cm_off} FILES ${{build_dir}}/cmakeModule.py 314s {cm_off} DESTINATION .) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 314s {h_off} DESTINATION hybrid) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 314s {h_off} DESTINATION hybrid/data) 314s 314s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 314s {h_off} install( 314s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 314s {h_off} DESTINATION hybrid/hybrid_2) 314s 314s install(CODE "message(STATUS \\\"Installation complete\\\")") 314s """.format( 314s c_off="" if has_cmake_package else "#", 314s cm_off="" if has_cmake_module else "#", 314s h_off="" if has_hybrid_package else "#", 314s ) 314s ) 314s ) 314s 314s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 314s path_types: Sequence[str] 314s try: 314s path_types = next( 314s iter( 314s zip( 314s *filter( 314s lambda i: i[1], 314s [ 314s ("c", has_cmake_package), 314s ("cm", has_cmake_module), 314s ("h", has_hybrid_package), 314s ("p", has_pure_package), 314s ("pm", has_pure_module), 314s ], 314s ) 314s ) 314s ) 314s ) 314s except StopIteration: 314s path_types = [] 314s 314s def select_paths(annotated_paths): 314s """Return a filtered list paths considering ``path_types``. 314s 314s `annotated_paths`` is list of tuple ``(type, path)`` where type 314s is either `c`, 'cm', `h`, `p` or 'pm'. 314s 314s """ 314s return filter(lambda i: i[0] in path_types, annotated_paths) 314s 314s # Commented paths are the one expected to be installed by CMake. For 314s # this reason, corresponding files should NOT be created in the source 314s # tree. 314s for _type, path in select_paths( 314s [ 314s # ('c', 'cmake/__init__.py'), 314s # ('c', 'cmake/cmake.py'), 314s # ('cm', 'cmakeModule.py'), 314s ("h", "hybrid/__init__.py"), 314s # ('h', 'hybrid/hybrid_cmake.dat'), 314s # ('h', 'hybrid/hybrid_cmake.py'), 314s ("h", "hybrid/hybrid_pure.dat"), 314s ("h", "hybrid/hybrid_pure.py"), 314s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 314s ("h", "hybrid/data/hybrid_data_pure.dat"), 314s ("h", "hybrid/hybrid_2/__init__.py"), 314s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 314s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 314s ("p", "hybrid/hybrid_2_pure/__init__.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 314s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 314s ("pm", "pureModule.py"), 314s ("p", "pure/__init__.py"), 314s ("p", "pure/pure.py"), 314s ("p", "pure/data/pure.dat"), 314s ] 314s ): 314s assert _type in {"p", "pm", "h"} 314s root = package_base if _type in {"p", "pm"} else cmake_source_dir 314s tmp_dir.ensure(os.path.join(root, path)) 314s 314s # Do not call the real setup function. Instead, replace it with 314s # a MagicMock allowing to check with which arguments it was invoked. 314s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 314s 314s # Convenience print function 314s def _pprint(desc, value=None): 314s print( 314s "-----------------\n" 314s f"{desc}:\n" 314s "\n" 314s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 314s ) 314s 314s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 314s 314s _pprint = ._pprint at 0xf3321de8> 314s _type = 'p' 314s cmake_source_dir = 'to/the/base' 314s has_cmake_module = 0 314s has_cmake_package = 0 314s has_hybrid_package = 1 314s has_pure_module = 1 314s has_pure_package = 1 314s mock_setup = 314s mocker = 314s package_base = 'to/the/base' 314s package_base_dir = 'to/the/base/' 314s path = 'pure/data/pure.dat' 314s path_types = ('h', 'p', 'pm') 314s root = 'to/the/base' 314s select_paths = .select_paths at 0xf3308668> 314s src_dir = local('/tmp/pytest-of-ubuntu/pytest-142/test_setup_inputs0/to/the/base') 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-142/test_setup_inputs0') 314s with_package_base = 1 314s 314s tests/test_setup.py:849: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-142/test_setup_inputs0') 314s setup_args = ['build'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-142/test_setup_inputs0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s ___________________ test_cmake_install_into_pure_package[0] ____________________ 314s 314s with_cmake_source_dir = 0 314s capsys = <_pytest.capture.CaptureFixture object at 0xf34141e0> 314s caplog = <_pytest.logging.LogCaptureFixture object at 0xf3414510> 314s 314s @pytest.mark.parametrize("with_cmake_source_dir", [0, 1]) 314s def test_cmake_install_into_pure_package(with_cmake_source_dir, capsys, caplog): 314s # ------------------------------------------------------------------------- 314s # "SOURCE" tree layout: 314s # 314s # (1) with_cmake_source_dir == 0 314s # 314s # ROOT/ 314s # 314s # CMakeLists.txt 314s # setup.py 314s # 314s # fruits/ 314s # __init__.py 314s # 314s # 314s # (2) with_cmake_source_dir == 1 314s # 314s # ROOT/ 314s # 314s # setup.py 314s # 314s # fruits/ 314s # __init__.py 314s # 314s # src/ 314s # 314s # CMakeLists.txt 314s # 314s # ------------------------------------------------------------------------- 314s # "BINARY" distribution layout: 314s # 314s # ROOT/ 314s # 314s # fruits/ 314s # 314s # __init__.py 314s # apple.py 314s # banana.py 314s # 314s # data/ 314s # 314s # apple.dat 314s # banana.dat 314s # 314s 314s tmp_dir = _tmpdir("cmake_install_into_pure_package") 314s 314s cmake_source_dir = "src" if with_cmake_source_dir else "" 314s 314s tmp_dir.join("setup.py").write( 314s textwrap.dedent( 314s f""" 314s from skbuild import setup 314s setup( 314s name="test_py_modules_keyword", 314s version="1.2.3", 314s description="a package testing use of py_modules keyword", 314s author='The scikit-build team', 314s license="MIT", 314s packages=['fruits'], 314s cmake_install_dir='fruits', 314s cmake_source_dir='{cmake_source_dir}', 314s ) 314s """ 314s ) 314s ) 314s 314s cmake_src_dir = tmp_dir.ensure(cmake_source_dir, dir=1) 314s cmake_src_dir.join("CMakeLists.txt").write( 314s textwrap.dedent( 314s """ 314s cmake_minimum_required(VERSION 3.5.0) 314s project(test NONE) 314s file(WRITE "${CMAKE_BINARY_DIR}/apple.py" "# apple.py") 314s file(WRITE "${CMAKE_BINARY_DIR}/banana.py" "# banana.py") 314s install( 314s FILES 314s "${CMAKE_BINARY_DIR}/apple.py" 314s "${CMAKE_BINARY_DIR}/banana.py" 314s DESTINATION "." 314s ) 314s file(WRITE "${CMAKE_BINARY_DIR}/apple.dat" "# apple.dat") 314s file(WRITE "${CMAKE_BINARY_DIR}/banana.dat" "# banana.dat") 314s install( 314s FILES 314s "${CMAKE_BINARY_DIR}/apple.dat" 314s "${CMAKE_BINARY_DIR}/banana.dat" 314s DESTINATION "data" 314s ) 314s """ 314s ) 314s ) 314s 314s tmp_dir.ensure("fruits/__init__.py") 314s 314s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 314s 314s caplog = <_pytest.logging.LogCaptureFixture object at 0xf3414510> 314s capsys = <_pytest.capture.CaptureFixture object at 0xf34141e0> 314s cmake_source_dir = '' 314s cmake_src_dir = local('/tmp/pytest-of-ubuntu/pytest-146/cmake_install_into_pure_packag0') 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-146/cmake_install_into_pure_packag0') 314s with_cmake_source_dir = 0 314s 314s tests/test_setup.py:1031: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-146/cmake_install_into_pure_packag0') 314s setup_args = ['build'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-146/cmake_install_into_pure_packag0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s ___________________ test_cmake_install_into_pure_package[1] ____________________ 314s 314s with_cmake_source_dir = 1 314s capsys = <_pytest.capture.CaptureFixture object at 0xf32ccdb0> 314s caplog = <_pytest.logging.LogCaptureFixture object at 0xf32cca98> 314s 314s @pytest.mark.parametrize("with_cmake_source_dir", [0, 1]) 314s def test_cmake_install_into_pure_package(with_cmake_source_dir, capsys, caplog): 314s # ------------------------------------------------------------------------- 314s # "SOURCE" tree layout: 314s # 314s # (1) with_cmake_source_dir == 0 314s # 314s # ROOT/ 314s # 314s # CMakeLists.txt 314s # setup.py 314s # 314s # fruits/ 314s # __init__.py 314s # 314s # 314s # (2) with_cmake_source_dir == 1 314s # 314s # ROOT/ 314s # 314s # setup.py 314s # 314s # fruits/ 314s # __init__.py 314s # 314s # src/ 314s # 314s # CMakeLists.txt 314s # 314s # ------------------------------------------------------------------------- 314s # "BINARY" distribution layout: 314s # 314s # ROOT/ 314s # 314s # fruits/ 314s # 314s # __init__.py 314s # apple.py 314s # banana.py 314s # 314s # data/ 314s # 314s # apple.dat 314s # banana.dat 314s # 314s 314s tmp_dir = _tmpdir("cmake_install_into_pure_package") 314s 314s cmake_source_dir = "src" if with_cmake_source_dir else "" 314s 314s tmp_dir.join("setup.py").write( 314s textwrap.dedent( 314s f""" 314s from skbuild import setup 314s setup( 314s name="test_py_modules_keyword", 314s version="1.2.3", 314s description="a package testing use of py_modules keyword", 314s author='The scikit-build team', 314s license="MIT", 314s packages=['fruits'], 314s cmake_install_dir='fruits', 314s cmake_source_dir='{cmake_source_dir}', 314s ) 314s """ 314s ) 314s ) 314s 314s cmake_src_dir = tmp_dir.ensure(cmake_source_dir, dir=1) 314s cmake_src_dir.join("CMakeLists.txt").write( 314s textwrap.dedent( 314s """ 314s cmake_minimum_required(VERSION 3.5.0) 314s project(test NONE) 314s file(WRITE "${CMAKE_BINARY_DIR}/apple.py" "# apple.py") 314s file(WRITE "${CMAKE_BINARY_DIR}/banana.py" "# banana.py") 314s install( 314s FILES 314s "${CMAKE_BINARY_DIR}/apple.py" 314s "${CMAKE_BINARY_DIR}/banana.py" 314s DESTINATION "." 314s ) 314s file(WRITE "${CMAKE_BINARY_DIR}/apple.dat" "# apple.dat") 314s file(WRITE "${CMAKE_BINARY_DIR}/banana.dat" "# banana.dat") 314s install( 314s FILES 314s "${CMAKE_BINARY_DIR}/apple.dat" 314s "${CMAKE_BINARY_DIR}/banana.dat" 314s DESTINATION "data" 314s ) 314s """ 314s ) 314s ) 314s 314s tmp_dir.ensure("fruits/__init__.py") 314s 314s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 314s 314s caplog = <_pytest.logging.LogCaptureFixture object at 0xf32cca98> 314s capsys = <_pytest.capture.CaptureFixture object at 0xf32ccdb0> 314s cmake_source_dir = 'src' 314s cmake_src_dir = local('/tmp/pytest-of-ubuntu/pytest-147/cmake_install_into_pure_packag0/src') 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-147/cmake_install_into_pure_packag0') 314s with_cmake_source_dir = 1 314s 314s tests/test_setup.py:1031: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-147/cmake_install_into_pure_packag0') 314s setup_args = ['build'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-147/cmake_install_into_pure_packag0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s _________________________ test_zip_safe_default[None] __________________________ 314s 314s zip_safe = None 314s mocker = 314s 314s @pytest.mark.parametrize("zip_safe", [None, False, True]) 314s def test_zip_safe_default(zip_safe, mocker): 314s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 314s 314s tmp_dir = _tmpdir("zip_safe_default") 314s 314s setup_kwarg = "" 314s if zip_safe is not None: 314s setup_kwarg = f"zip_safe={zip_safe}" 314s 314s tmp_dir.join("setup.py").write( 314s textwrap.dedent( 314s f""" 314s from skbuild import setup 314s setup( 314s name="zip_safe_default", 314s version="1.2.3", 314s description="a minimal example package", 314s author='The scikit-build team', 314s license="MIT", 314s {setup_kwarg} 314s ) 314s """ 314s ) 314s ) 314s tmp_dir.join("CMakeLists.txt").write( 314s textwrap.dedent( 314s """ 314s cmake_minimum_required(VERSION 3.5.0) 314s project(test NONE) 314s install(CODE "execute_process( 314s COMMAND \\${CMAKE_COMMAND} -E sleep 0)") 314s """ 314s ) 314s ) 314s 314s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 314s 314s mock_setup = 314s mocker = 314s setup_kwarg = '' 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-148/zip_safe_default0') 314s zip_safe = None 314s 314s tests/test_setup.py:1087: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-148/zip_safe_default0') 314s setup_args = ['build'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-148/zip_safe_default0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s _________________________ test_zip_safe_default[False] _________________________ 314s 314s zip_safe = False 314s mocker = 314s 314s @pytest.mark.parametrize("zip_safe", [None, False, True]) 314s def test_zip_safe_default(zip_safe, mocker): 314s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 314s 314s tmp_dir = _tmpdir("zip_safe_default") 314s 314s setup_kwarg = "" 314s if zip_safe is not None: 314s setup_kwarg = f"zip_safe={zip_safe}" 314s 314s tmp_dir.join("setup.py").write( 314s textwrap.dedent( 314s f""" 314s from skbuild import setup 314s setup( 314s name="zip_safe_default", 314s version="1.2.3", 314s description="a minimal example package", 314s author='The scikit-build team', 314s license="MIT", 314s {setup_kwarg} 314s ) 314s """ 314s ) 314s ) 314s tmp_dir.join("CMakeLists.txt").write( 314s textwrap.dedent( 314s """ 314s cmake_minimum_required(VERSION 3.5.0) 314s project(test NONE) 314s install(CODE "execute_process( 314s COMMAND \\${CMAKE_COMMAND} -E sleep 0)") 314s """ 314s ) 314s ) 314s 314s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 314s 314s mock_setup = 314s mocker = 314s setup_kwarg = 'zip_safe=False' 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-149/zip_safe_default0') 314s zip_safe = False 314s 314s tests/test_setup.py:1087: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-149/zip_safe_default0') 314s setup_args = ['build'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-149/zip_safe_default0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s _________________________ test_zip_safe_default[True] __________________________ 314s 314s zip_safe = True 314s mocker = 314s 314s @pytest.mark.parametrize("zip_safe", [None, False, True]) 314s def test_zip_safe_default(zip_safe, mocker): 314s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 314s 314s tmp_dir = _tmpdir("zip_safe_default") 314s 314s setup_kwarg = "" 314s if zip_safe is not None: 314s setup_kwarg = f"zip_safe={zip_safe}" 314s 314s tmp_dir.join("setup.py").write( 314s textwrap.dedent( 314s f""" 314s from skbuild import setup 314s setup( 314s name="zip_safe_default", 314s version="1.2.3", 314s description="a minimal example package", 314s author='The scikit-build team', 314s license="MIT", 314s {setup_kwarg} 314s ) 314s """ 314s ) 314s ) 314s tmp_dir.join("CMakeLists.txt").write( 314s textwrap.dedent( 314s """ 314s cmake_minimum_required(VERSION 3.5.0) 314s project(test NONE) 314s install(CODE "execute_process( 314s COMMAND \\${CMAKE_COMMAND} -E sleep 0)") 314s """ 314s ) 314s ) 314s 314s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 314s 314s mock_setup = 314s mocker = 314s setup_kwarg = 'zip_safe=True' 314s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-150/zip_safe_default0') 314s zip_safe = True 314s 314s tests/test_setup.py:1087: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-150/zip_safe_default0') 314s setup_args = ['build'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-150/zip_safe_default0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s _____________________ test_generator[Unix Makefiles-make] ______________________ 314s 314s generator = 'Unix Makefiles', expected_make_program = 'make' 314s 314s @pytest.mark.parametrize( 314s ("generator", "expected_make_program"), [("NMake Makefiles", "nmake"), ("Unix Makefiles", "make")] 314s ) 314s def test_generator(generator, expected_make_program): 314s generator_platform = {"NMake Makefiles": ["windows"], "Unix Makefiles": ["darwin", "linux"]} 314s assert generator in generator_platform 314s 314s this_platform = platform.system().lower() 314s if this_platform not in generator_platform[generator]: 314s pytest.skip(f"{generator} generator is not available on {this_platform.title()}") 314s 314s if shutil.which(expected_make_program) is None: 314s pytest.skip(f"{expected_make_program} not available") 314s 314s @project_setup_py_test("hello-cpp", ["build"], ret=True) 314s def run_build(): 314s pass 314s 314s with push_env(CMAKE_GENERATOR=generator): 314s > tmp_dir = run_build()[0] 314s 314s expected_make_program = 'make' 314s generator = 'Unix Makefiles' 314s generator_platform = {'NMake Makefiles': ['windows'], 'Unix Makefiles': ['darwin', 'linux']} 314s run_build = .run_build at 0xf323a668> 314s this_platform = 'linux' 314s 314s tests/test_skbuild.py:94: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s tests/__init__.py:255: in wrapped 314s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 314s disable_languages_test = False 314s fun = .run_build at 0xf323ae88> 314s iargs = () 314s ikwargs = {} 314s ret = True 314s wrapped = .run_build at 0xf323a668> 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-151/run_build0') 314s setup_args = ['build'], disable_languages_test = False 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = False 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-151/run_build0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s ----------------------------- Captured stdout call ----------------------------- 314s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-151/run_build0/.git/ 314s [master (root-commit) e7f9dd6] Initial commit 314s 11 files changed, 115 insertions(+) 314s create mode 100644 CMakeLists.txt 314s create mode 100644 bonjour/__init__.py 314s create mode 100644 bonjour/data/ciel.txt 314s create mode 100644 bonjour/data/soleil.txt 314s create mode 100644 bonjour/data/terre.txt 314s create mode 100644 bonjourModule.py 314s create mode 100644 hello/CMakeLists.txt 314s create mode 100644 hello/__init__.py 314s create mode 100644 hello/__main__.py 314s create mode 100644 hello/_hello.cxx 314s create mode 100644 setup.py 314s ----------------------------- Captured stderr call ----------------------------- 314s hint: Using 'master' as the name for the initial branch. This default branch name 314s hint: is subject to change. To configure the initial branch name to use in all 314s hint: of your new repositories, which will suppress this warning, call: 314s hint: 314s hint: git config --global init.defaultBranch 314s hint: 314s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 314s hint: 'development'. The just-created branch can be renamed via this command: 314s hint: 314s hint: git branch -m 314s ___________________ test_invalid_generator[generator_args0] ____________________ 314s 314s generator_args = ['-G', 'invalid'] 314s 314s @pytest.mark.parametrize( 314s "generator_args", 314s [ 314s ["-G", "invalid"], 314s ["--", "-G", "invalid"], 314s ], 314s ) 314s def test_invalid_generator(generator_args): 314s with push_dir(): 314s build_args = ["build"] 314s build_args.extend(generator_args) 314s 314s @project_setup_py_test("hello-no-language", build_args, disable_languages_test=True) 314s def run(): 314s pass 314s 314s failed = False 314s message = "" 314s try: 314s > run() 314s 314s build_args = ['build', '-G', 'invalid'] 314s failed = False 314s generator_args = ['-G', 'invalid'] 314s message = '' 314s run = .run at 0xf3250618> 314s 314s tests/test_skbuild.py:121: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s tests/__init__.py:255: in wrapped 314s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 314s disable_languages_test = True 314s fun = .run at 0xf3250078> 314s iargs = () 314s ikwargs = {} 314s ret = False 314s wrapped = .run at 0xf3250618> 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-152/run0') 314s setup_args = ['build', '-G', 'invalid'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-152/run0') 314s setup_args = ['build', '-G', 'invalid'] 314s 314s tests/__init__.py:218: AttributeError 314s ----------------------------- Captured stdout call ----------------------------- 314s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-152/run0/.git/ 314s [master (root-commit) b6b19d4] Initial commit 314s 2 files changed, 16 insertions(+) 314s create mode 100644 CMakeLists.txt 314s create mode 100644 setup.py 314s ----------------------------- Captured stderr call ----------------------------- 314s hint: Using 'master' as the name for the initial branch. This default branch name 314s hint: is subject to change. To configure the initial branch name to use in all 314s hint: of your new repositories, which will suppress this warning, call: 314s hint: 314s hint: git config --global init.defaultBranch 314s hint: 314s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 314s hint: 'development'. The just-created branch can be renamed via this command: 314s hint: 314s hint: git branch -m 314s ___________________ test_invalid_generator[generator_args1] ____________________ 314s 314s generator_args = ['--', '-G', 'invalid'] 314s 314s @pytest.mark.parametrize( 314s "generator_args", 314s [ 314s ["-G", "invalid"], 314s ["--", "-G", "invalid"], 314s ], 314s ) 314s def test_invalid_generator(generator_args): 314s with push_dir(): 314s build_args = ["build"] 314s build_args.extend(generator_args) 314s 314s @project_setup_py_test("hello-no-language", build_args, disable_languages_test=True) 314s def run(): 314s pass 314s 314s failed = False 314s message = "" 314s try: 314s > run() 314s 314s build_args = ['build', '--', '-G', 'invalid'] 314s failed = False 314s generator_args = ['--', '-G', 'invalid'] 314s message = '' 314s run = .run at 0xf321c578> 314s 314s tests/test_skbuild.py:121: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s tests/__init__.py:255: in wrapped 314s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 314s disable_languages_test = True 314s fun = .run at 0xf321c668> 314s iargs = () 314s ikwargs = {} 314s ret = False 314s wrapped = .run at 0xf321c578> 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-153/run0') 314s setup_args = ['build', '--', '-G', 'invalid'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-153/run0') 314s setup_args = ['build', '--', '-G', 'invalid'] 314s 314s tests/__init__.py:218: AttributeError 314s ----------------------------- Captured stdout call ----------------------------- 314s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-153/run0/.git/ 314s [master (root-commit) b6b19d4] Initial commit 314s 2 files changed, 16 insertions(+) 314s create mode 100644 CMakeLists.txt 314s create mode 100644 setup.py 314s ----------------------------- Captured stderr call ----------------------------- 314s hint: Using 'master' as the name for the initial branch. This default branch name 314s hint: is subject to change. To configure the initial branch name to use in all 314s hint: of your new repositories, which will suppress this warning, call: 314s hint: 314s hint: git config --global init.defaultBranch 314s hint: 314s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 314s hint: 'development'. The just-created branch can be renamed via this command: 314s hint: 314s hint: git branch -m 314s _________________________ test_skbuild_variable_builds _________________________ 314s 314s iargs = (), ikwargs = {} 314s 314s @functools.wraps(fun) 314s def wrapped(*iargs, **ikwargs): 314s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 314s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 314s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 314s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 314s 314s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 314s 314s disable_languages_test = True 314s fun = 314s iargs = () 314s ikwargs = {} 314s ret = False 314s wrapped = 314s 314s tests/__init__.py:255: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-154/test_skbuild_variable_builds0') 314s setup_args = ['build'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-154/test_skbuild_variable_builds0') 314s setup_args = ['build'] 314s 314s tests/__init__.py:218: AttributeError 314s ----------------------------- Captured stdout call ----------------------------- 314s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-154/test_skbuild_variable_builds0/.git/ 314s [master (root-commit) 1773bfa] Initial commit 314s 2 files changed, 20 insertions(+) 314s create mode 100644 CMakeLists.txt 314s create mode 100644 setup.py 314s ----------------------------- Captured stderr call ----------------------------- 314s hint: Using 'master' as the name for the initial branch. This default branch name 314s hint: is subject to change. To configure the initial branch name to use in all 314s hint: of your new repositories, which will suppress this warning, call: 314s hint: 314s hint: git config --global init.defaultBranch 314s hint: 314s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 314s hint: 'development'. The just-created branch can be renamed via this command: 314s hint: 314s hint: git branch -m 314s _________________________ test_skbuild_variable_sdist __________________________ 314s 314s iargs = (), ikwargs = {} 314s 314s @functools.wraps(fun) 314s def wrapped(*iargs, **ikwargs): 314s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 314s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 314s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 314s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 314s 314s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 314s 314s disable_languages_test = True 314s fun = 314s iargs = () 314s ikwargs = {} 314s ret = False 314s wrapped = 314s 314s tests/__init__.py:255: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-155/test_skbuild_variable_sdist0') 314s setup_args = ['sdist'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-155/test_skbuild_variable_sdist0') 314s setup_args = ['sdist'] 314s 314s tests/__init__.py:218: AttributeError 314s ----------------------------- Captured stdout call ----------------------------- 314s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-155/test_skbuild_variable_sdist0/.git/ 314s [master (root-commit) 087f263] Initial commit 314s 2 files changed, 20 insertions(+) 314s create mode 100644 CMakeLists.txt 314s create mode 100644 setup.py 314s ----------------------------- Captured stderr call ----------------------------- 314s hint: Using 'master' as the name for the initial branch. This default branch name 314s hint: is subject to change. To configure the initial branch name to use in all 314s hint: of your new repositories, which will suppress this warning, call: 314s hint: 314s hint: git config --global init.defaultBranch 314s hint: 314s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 314s hint: 'development'. The just-created branch can be renamed via this command: 314s hint: 314s hint: git branch -m 314s _________________________ test_skbuild_variable_wheel __________________________ 314s 314s iargs = (), ikwargs = {} 314s 314s @functools.wraps(fun) 314s def wrapped(*iargs, **ikwargs): 314s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 314s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 314s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 314s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 314s 314s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 314s 314s disable_languages_test = True 314s fun = 314s iargs = () 314s ikwargs = {} 314s ret = False 314s wrapped = 314s 314s tests/__init__.py:255: 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s /usr/lib/python3.12/contextlib.py:137: in __enter__ 314s return next(self.gen) 314s self = 314s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 314s 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-156/test_skbuild_variable_wheel0') 314s setup_args = ['bdist_wheel'], disable_languages_test = True 314s 314s @contextmanager 314s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 314s """Context manager executing ``setup.py`` with the given arguments. 314s 314s It yields after changing the current working directory 314s to ``project_dir``. 314s """ 314s 314s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 314s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 314s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 314s 314s disable_languages_test = True 314s project_dir = local('/tmp/pytest-of-ubuntu/pytest-156/test_skbuild_variable_wheel0') 314s setup_args = ['bdist_wheel'] 314s 314s tests/__init__.py:218: AttributeError 314s ----------------------------- Captured stdout call ----------------------------- 314s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-156/test_skbuild_variable_wheel0/.git/ 314s [master (root-commit) 087f263] Initial commit 314s 2 files changed, 20 insertions(+) 314s create mode 100644 CMakeLists.txt 314s create mode 100644 setup.py 314s ----------------------------- Captured stderr call ----------------------------- 314s hint: Using 'master' as the name for the initial branch. This default branch name 314s hint: is subject to change. To configure the initial branch name to use in all 314s hint: of your new repositories, which will suppress this warning, call: 314s hint: 314s hint: git config --global init.defaultBranch 314s hint: 314s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 314s hint: 'development'. The just-created branch can be renamed via this command: 314s hint: 314s hint: git branch -m 314s =========================== short test summary info ============================ 314s SKIPPED [1] tests/test_hello_fortran.py:19: could not import 'numpy': No module named 'numpy' 314s SKIPPED [1] tests/test_platform.py:120: Requires Windows 314s 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 314s SKIPPED [1] tests/test_skbuild.py:84: NMake Makefiles generator is not available on Linux 314s SKIPPED [3] tests/test_skbuild.py:130: Requires Windows 314s SKIPPED [1] tests/test_skbuild.py:154: Requires Windows 314s FAILED tests/test_broken_project.py::test_cmakelists_with_fatalerror_fails - ... 314s FAILED tests/test_broken_project.py::test_cmakelists_with_syntaxerror_fails 314s FAILED tests/test_broken_project.py::test_hello_with_compileerror_fails - Att... 314s FAILED tests/test_broken_project.py::test_invalid_cmake[CalledProcessError] 314s FAILED tests/test_broken_project.py::test_invalid_cmake[OSError] - AttributeE... 314s FAILED tests/test_broken_project.py::test_first_invalid_generator - Attribute... 314s FAILED tests/test_broken_project.py::test_invalid_generator - AttributeError:... 314s FAILED tests/test_cmake_target.py::test_cmake_target_build - AttributeError: ... 314s FAILED tests/test_cmakelists_not_in_top_level_dir.py::test_build - AttributeE... 314s FAILED tests/test_cmakelists_not_in_top_level_dir.py::test_cmake_source_dir[invalid-True] 314s FAILED tests/test_cmakelists_not_in_top_level_dir.py::test_cmake_source_dir[-False] 314s FAILED tests/test_cmakelists_not_in_top_level_dir.py::test_cmake_source_dir[.-False] 314s FAILED tests/test_command_line.py::test_help - AttributeError: module 'distut... 314s FAILED tests/test_command_line.py::test_metadata_display - AttributeError: mo... 314s FAILED tests/test_command_line.py::test_no_command - AttributeError: module '... 314s FAILED tests/test_command_line.py::test_invalid_command - AttributeError: mod... 314s FAILED tests/test_command_line.py::test_too_many_separators - AttributeError:... 314s FAILED tests/test_command_line.py::test_cmake_initial_cache_as_global_option 314s FAILED tests/test_command_line.py::test_cmake_executable_arg - AttributeError... 314s FAILED tests/test_command_line.py::test_hide_listing[True-sdist] - AttributeE... 314s FAILED tests/test_command_line.py::test_hide_listing[True-bdist_wheel] - Attr... 314s FAILED tests/test_command_line.py::test_hide_listing[False-sdist] - Attribute... 314s FAILED tests/test_command_line.py::test_hide_listing[False-bdist_wheel] - Att... 314s FAILED tests/test_command_line.py::test_run_cmake_arg - AttributeError: modul... 314s FAILED tests/test_command_line.py::test_skip_cmake_arg - AttributeError: modu... 314s FAILED tests/test_cython_flags.py::test_hello_cython_builds - AttributeError:... 314s FAILED tests/test_filter_manifest.py::test_bdist_wheel_command - AttributeErr... 314s FAILED tests/test_hello_cpp.py::test_hello_builds - AttributeError: module 'd... 314s FAILED tests/test_hello_cpp.py::test_hello_wheel - AttributeError: module 'di... 314s FAILED tests/test_hello_cpp.py::test_hello_clean[with-dry-run] - AttributeErr... 314s FAILED tests/test_hello_cpp.py::test_hello_clean[without-dry-run] - Attribute... 314s FAILED tests/test_hello_cpp.py::test_hello_cleans - AttributeError: module 'd... 314s FAILED tests/test_hello_cython.py::test_hello_cython_builds - AttributeError:... 314s FAILED tests/test_hello_cython.py::test_hello_cython_sdist - AttributeError: ... 314s FAILED tests/test_hello_cython.py::test_hello_cython_wheel - AttributeError: ... 314s FAILED tests/test_hello_pure.py::test_hello_pure_builds - AttributeError: mod... 314s FAILED tests/test_hello_pure.py::test_hello_pure_sdist - AttributeError: modu... 314s FAILED tests/test_hello_pure.py::test_hello_pure_wheel - AttributeError: modu... 314s FAILED tests/test_hello_pure.py::test_hello_clean - AttributeError: module 'd... 314s FAILED tests/test_include_exclude_data.py::test_include_exclude_data - Attrib... 314s FAILED tests/test_include_exclude_data.py::test_include_exclude_data_with_base 314s FAILED tests/test_issue284_build_ext_inplace.py::test_build_ext_inplace_command 314s FAILED tests/test_issue335_support_cmake_source_dir.py::test_bdist_wheel_command 314s 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] 314s 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] 314s 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] 314s 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] 314s 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] 314s 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] 314s 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] 314s 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] 314s 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] 314s FAILED tests/test_issue352_isolated_environment_support.py::test_isolated_env_trigger_reconfigure 314s FAILED tests/test_issue668_symbol_visibility.py::test_symbol_visibility[ON] 314s FAILED tests/test_issue668_symbol_visibility.py::test_symbol_visibility[OFF] 314s FAILED tests/test_manifest_in.py::test_manifest_in_wheel - AttributeError: mo... 314s FAILED tests/test_outside_project_root.py::test_outside_project_root_fails[None] 314s FAILED tests/test_outside_project_root.py::test_outside_project_root_fails[-DINSTALL_FILE:BOOL=1] 314s FAILED tests/test_outside_project_root.py::test_outside_project_root_fails[-DINSTALL_PROJECT:BOOL=1] 314s FAILED tests/test_setup.py::test_cmake_args_keyword[cmake_args0] - AttributeE... 314s FAILED tests/test_setup.py::test_cmake_args_keyword[cmake_args1] - AttributeE... 314s FAILED tests/test_setup.py::test_cmake_install_dir_keyword[None-True-str] - A... 314s FAILED tests/test_setup.py::test_cmake_install_dir_keyword[-True-str] - Attri... 314s FAILED tests/test_setup.py::test_cmake_install_dir_keyword[/tmp/scikit-build-True-SKBuildError] 314s FAILED tests/test_setup.py::test_cmake_install_dir_keyword[banana-False-str] 314s FAILED tests/test_setup.py::test_cmake_with_sdist_keyword[True] - AttributeEr... 314s FAILED tests/test_setup.py::test_cmake_with_sdist_keyword[False] - AttributeE... 314s FAILED tests/test_setup.py::test_cmake_minimum_required_version_keyword - Att... 314s FAILED tests/test_setup.py::test_setup_requires_keyword_include_cmake - Attri... 314s FAILED tests/test_setup.py::test_script_keyword[pure] - AttributeError: modul... 314s FAILED tests/test_setup.py::test_script_keyword[skbuild] - AttributeError: mo... 314s FAILED tests/test_setup.py::test_py_modules_keyword[pure] - AttributeError: m... 314s FAILED tests/test_setup.py::test_py_modules_keyword[skbuild] - AttributeError... 314s FAILED tests/test_setup.py::test_setup_inputs[0-0-0-0-0-0] - AttributeError: ... 314s FAILED tests/test_setup.py::test_setup_inputs[0-0-0-0-0-1] - AttributeError: ... 314s FAILED tests/test_setup.py::test_setup_inputs[0-0-0-0-1-0] - AttributeError: ... 314s FAILED tests/test_setup.py::test_setup_inputs[0-0-0-0-1-1] - AttributeError: ... 314s FAILED tests/test_setup.py::test_setup_inputs[0-0-0-1-0-0] - AttributeError: ... 314s FAILED tests/test_setup.py::test_setup_inputs[0-0-0-1-0-1] - AttributeError: ... 314s FAILED tests/test_setup.py::test_setup_inputs[0-0-0-1-1-0] - AttributeError: ... 314s FAILED tests/test_setup.py::test_setup_inputs[0-0-0-1-1-1] - AttributeError: ... 314s FAILED tests/test_setup.py::test_setup_inputs[0-0-1-0-0-0] - AttributeError: ... 314s FAILED tests/test_setup.py::test_setup_inputs[0-0-1-0-0-1] - AttributeError: ... 314s FAILED tests/test_setup.py::test_setup_inputs[0-0-1-0-1-0] - AttributeError: ... 314s FAILED tests/test_setup.py::test_setup_inputs[0-0-1-0-1-1] - AttributeError: ... 314s FAILED tests/test_setup.py::test_setup_inputs[0-0-1-1-0-0] - AttributeError: ... 314s FAILED tests/test_setup.py::test_setup_inputs[0-0-1-1-0-1] - AttributeError: ... 314s FAILED tests/test_setup.py::test_setup_inputs[0-0-1-1-1-0] - AttributeError: ... 314s FAILED tests/test_setup.py::test_setup_inputs[0-0-1-1-1-1] - AttributeError: ... 314s FAILED tests/test_setup.py::test_setup_inputs[0-1-0-0-0-0] - AttributeError: ... 314s FAILED tests/test_setup.py::test_setup_inputs[0-1-0-0-0-1] - AttributeError: ... 314s FAILED tests/test_setup.py::test_setup_inputs[0-1-0-0-1-0] - AttributeError: ... 314s FAILED tests/test_setup.py::test_setup_inputs[0-1-0-0-1-1] - AttributeError: ... 314s FAILED tests/test_setup.py::test_setup_inputs[0-1-0-1-0-0] - AttributeError: ... 314s FAILED tests/test_setup.py::test_setup_inputs[0-1-0-1-0-1] - AttributeError: ... 314s FAILED tests/test_setup.py::test_setup_inputs[0-1-0-1-1-0] - AttributeError: ... 314s FAILED tests/test_setup.py::test_setup_inputs[0-1-0-1-1-1] - AttributeError: ... 314s FAILED tests/test_setup.py::test_setup_inputs[0-1-1-0-0-0] - AttributeError: ... 314s FAILED tests/test_setup.py::test_setup_inputs[0-1-1-0-0-1] - AttributeError: ... 314s FAILED tests/test_setup.py::test_setup_inputs[0-1-1-0-1-0] - AttributeError: ... 314s FAILED tests/test_setup.py::test_setup_inputs[0-1-1-0-1-1] - AttributeError: ... 314s FAILED tests/test_setup.py::test_setup_inputs[0-1-1-1-0-0] - AttributeError: ... 314s FAILED tests/test_setup.py::test_setup_inputs[0-1-1-1-0-1] - AttributeError: ... 314s FAILED tests/test_setup.py::test_setup_inputs[0-1-1-1-1-0] - AttributeError: ... 314s FAILED tests/test_setup.py::test_setup_inputs[0-1-1-1-1-1] - AttributeError: ... 314s FAILED tests/test_setup.py::test_setup_inputs[1-0-0-0-0-0] - AttributeError: ... 314s FAILED tests/test_setup.py::test_setup_inputs[1-0-0-1-0-0] - AttributeError: ... 314s FAILED tests/test_setup.py::test_setup_inputs[1-0-1-0-0-0] - AttributeError: ... 314s FAILED tests/test_setup.py::test_setup_inputs[1-0-1-1-0-0] - AttributeError: ... 314s FAILED tests/test_setup.py::test_setup_inputs[1-1-0-0-0-0] - AttributeError: ... 314s FAILED tests/test_setup.py::test_setup_inputs[1-1-0-1-0-0] - AttributeError: ... 314s FAILED tests/test_setup.py::test_setup_inputs[1-1-1-0-0-0] - AttributeError: ... 314s FAILED tests/test_setup.py::test_setup_inputs[1-1-1-1-0-0] - AttributeError: ... 314s FAILED tests/test_setup.py::test_cmake_install_into_pure_package[0] - Attribu... 314s FAILED tests/test_setup.py::test_cmake_install_into_pure_package[1] - Attribu... 314s FAILED tests/test_setup.py::test_zip_safe_default[None] - AttributeError: mod... 314s FAILED tests/test_setup.py::test_zip_safe_default[False] - AttributeError: mo... 314s FAILED tests/test_setup.py::test_zip_safe_default[True] - AttributeError: mod... 314s FAILED tests/test_skbuild.py::test_generator[Unix Makefiles-make] - Attribute... 314s FAILED tests/test_skbuild.py::test_invalid_generator[generator_args0] - Attri... 314s FAILED tests/test_skbuild.py::test_invalid_generator[generator_args1] - Attri... 314s FAILED tests/test_skbuild_variable.py::test_skbuild_variable_builds - Attribu... 314s FAILED tests/test_skbuild_variable.py::test_skbuild_variable_sdist - Attribut... 314s FAILED tests/test_skbuild_variable.py::test_skbuild_variable_wheel - Attribut... 314s ========== 124 failed, 67 passed, 31 skipped, 17 deselected in 11.94s ========== 315s autopkgtest [10:42:15]: test testsuite: -----------------------] 319s testsuite FAIL non-zero exit status 1 319s autopkgtest [10:42:19]: test testsuite: - - - - - - - - - - results - - - - - - - - - - 324s autopkgtest [10:42:24]: @@@@@@@@@@@@@@@@@@@@ summary 324s testsuite FAIL non-zero exit status 1