0s autopkgtest [15:58:58]: starting date and time: 2024-11-12 15:58:58+0000 0s autopkgtest [15:58:58]: git checkout: 0acbae0a WIP show VirtSubproc stderr in real-time 0s autopkgtest [15:58:58]: host juju-7f2275-prod-proposed-migration-environment-2; command line: /home/ubuntu/autopkgtest/runner/autopkgtest --output-dir /tmp/autopkgtest-work.q3bbht88/out --timeout-copy=6000 --setup-commands /home/ubuntu/autopkgtest-cloud/worker-config-production/setup-canonical.sh --apt-pocket=proposed=src:setuptools --apt-upgrade scikit-build --timeout-short=300 --timeout-copy=20000 --timeout-build=20000 --env=ADT_TEST_TRIGGERS=setuptools/75.2.0-1 -- ssh -s /home/ubuntu/autopkgtest/ssh-setup/nova -- --flavor builder-cpu2-ram4-disk20 --security-groups autopkgtest-juju-7f2275-prod-proposed-migration-environment-2@bos03-21.secgroup --name adt-plucky-amd64-scikit-build-20241112-155858-juju-7f2275-prod-proposed-migration-environment-2-11bb3aa1-d7d2-46ed-b341-4e1322a47b7a --image adt/ubuntu-plucky-amd64-server --keyname testbed-juju-7f2275-prod-proposed-migration-environment-2 --net-id=net_prod-proposed-migration-amd64 -e TERM=linux -e ''"'"'http_proxy=http://squid.internal:3128'"'"'' -e ''"'"'https_proxy=http://squid.internal:3128'"'"'' -e ''"'"'no_proxy=127.0.0.1,127.0.1.1,login.ubuntu.com,localhost,localdomain,novalocal,internal,archive.ubuntu.com,ports.ubuntu.com,security.ubuntu.com,ddebs.ubuntu.com,changelogs.ubuntu.com,keyserver.ubuntu.com,launchpadlibrarian.net,launchpadcontent.net,launchpad.net,10.24.0.0/24,keystone.ps5.canonical.com,objectstorage.prodstack5.canonical.com'"'"'' --mirror=http://ftpmaster.internal/ubuntu/ 349s autopkgtest [16:04:47]: testbed dpkg architecture: amd64 349s autopkgtest [16:04:47]: testbed apt version: 2.9.8 349s autopkgtest [16:04:47]: @@@@@@@@@@@@@@@@@@@@ test bed setup 350s Get:1 http://ftpmaster.internal/ubuntu plucky-proposed InRelease [73.9 kB] 350s Get:2 http://ftpmaster.internal/ubuntu plucky-proposed/restricted Sources [7016 B] 350s Get:3 http://ftpmaster.internal/ubuntu plucky-proposed/universe Sources [861 kB] 351s Get:4 http://ftpmaster.internal/ubuntu plucky-proposed/multiverse Sources [15.3 kB] 351s Get:5 http://ftpmaster.internal/ubuntu plucky-proposed/main Sources [86.7 kB] 351s Get:6 http://ftpmaster.internal/ubuntu plucky-proposed/main i386 Packages [73.8 kB] 351s Get:7 http://ftpmaster.internal/ubuntu plucky-proposed/main amd64 Packages [124 kB] 351s Get:8 http://ftpmaster.internal/ubuntu plucky-proposed/restricted amd64 Packages [32.6 kB] 351s Get:9 http://ftpmaster.internal/ubuntu plucky-proposed/universe amd64 Packages [655 kB] 351s Get:10 http://ftpmaster.internal/ubuntu plucky-proposed/universe i386 Packages [270 kB] 351s Get:11 http://ftpmaster.internal/ubuntu plucky-proposed/multiverse amd64 Packages [37.7 kB] 351s Get:12 http://ftpmaster.internal/ubuntu plucky-proposed/multiverse i386 Packages [13.0 kB] 351s Fetched 2251 kB in 1s (2722 kB/s) 351s Reading package lists... 353s Reading package lists... 353s Building dependency tree... 353s Reading state information... 354s Calculating upgrade... 354s The following NEW packages will be installed: 354s python3-jaraco.text 354s The following packages will be upgraded: 354s python3-pkg-resources python3-setuptools 354s 2 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. 354s Need to get 802 kB of archives. 354s After this operation, 12.3 kB of additional disk space will be used. 354s Get:1 http://ftpmaster.internal/ubuntu plucky/main amd64 python3-jaraco.text all 4.0.0-1 [11.5 kB] 354s Get:2 http://ftpmaster.internal/ubuntu plucky-proposed/main amd64 python3-pkg-resources all 75.2.0-1 [134 kB] 354s Get:3 http://ftpmaster.internal/ubuntu plucky-proposed/main amd64 python3-setuptools all 75.2.0-1 [657 kB] 355s Fetched 802 kB in 1s (1495 kB/s) 355s Selecting previously unselected package python3-jaraco.text. 355s (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 ... 75553 files and directories currently installed.) 355s Preparing to unpack .../python3-jaraco.text_4.0.0-1_all.deb ... 355s Unpacking python3-jaraco.text (4.0.0-1) ... 355s Preparing to unpack .../python3-pkg-resources_75.2.0-1_all.deb ... 355s Unpacking python3-pkg-resources (75.2.0-1) over (74.1.2-1) ... 355s Preparing to unpack .../python3-setuptools_75.2.0-1_all.deb ... 355s Unpacking python3-setuptools (75.2.0-1) over (74.1.2-1) ... 355s Setting up python3-pkg-resources (75.2.0-1) ... 355s Setting up python3-jaraco.text (4.0.0-1) ... 355s Setting up python3-setuptools (75.2.0-1) ... 356s Reading package lists... 356s Building dependency tree... 356s Reading state information... 357s 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 357s Hit:1 http://ftpmaster.internal/ubuntu plucky-proposed InRelease 357s Hit:2 http://ftpmaster.internal/ubuntu plucky InRelease 357s Hit:3 http://ftpmaster.internal/ubuntu plucky-updates InRelease 357s Hit:4 http://ftpmaster.internal/ubuntu plucky-security InRelease 358s Reading package lists... 358s Reading package lists... 358s Building dependency tree... 358s Reading state information... 358s Calculating upgrade... 358s 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 359s Reading package lists... 359s Building dependency tree... 359s Reading state information... 359s 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 362s autopkgtest [16:05:00]: testbed running kernel: Linux 6.11.0-8-generic #8-Ubuntu SMP PREEMPT_DYNAMIC Mon Sep 16 13:41:20 UTC 2024 362s autopkgtest [16:05:00]: @@@@@@@@@@@@@@@@@@@@ apt-source scikit-build 364s Get:1 http://ftpmaster.internal/ubuntu plucky/universe scikit-build 0.18.1-1 (dsc) [2733 B] 364s Get:2 http://ftpmaster.internal/ubuntu plucky/universe scikit-build 0.18.1-1 (tar) [273 kB] 364s Get:3 http://ftpmaster.internal/ubuntu plucky/universe scikit-build 0.18.1-1 (diff) [5768 B] 364s gpgv: Signature made Fri Aug 30 01:03:13 2024 UTC 364s gpgv: using RSA key 13796755BBC72BB8ABE2AEB5FA9DEC5DE11C63F1 364s gpgv: issuer "eamanu@debian.org" 364s gpgv: Can't check signature: No public key 364s dpkg-source: warning: cannot verify inline signature for ./scikit-build_0.18.1-1.dsc: no acceptable signature found 364s autopkgtest [16:05:02]: testing package scikit-build version 0.18.1-1 364s autopkgtest [16:05:02]: build not needed 365s autopkgtest [16:05:03]: test testsuite: preparing testbed 366s Reading package lists... 366s Building dependency tree... 366s Reading state information... 366s Starting pkgProblemResolver with broken count: 0 366s Starting 2 pkgProblemResolver with broken count: 0 366s Done 366s The following additional packages will be installed: 366s build-essential cmake cmake-data cpp cpp-14 cpp-14-x86-64-linux-gnu 366s cpp-x86-64-linux-gnu cython3 fonts-font-awesome fonts-lato g++ g++-14 366s g++-14-x86-64-linux-gnu g++-x86-64-linux-gnu gcc gcc-14 366s gcc-14-x86-64-linux-gnu gcc-x86-64-linux-gnu git git-man libasan8 libcc1-0 366s liberror-perl libexpat1-dev libgcc-14-dev libgomp1 libhwasan0 libisl23 366s libitm1 libjs-jquery libjs-sphinxdoc libjs-underscore libjsoncpp25 liblsan0 366s libmpc3 libpython3-all-dev libpython3-dev libpython3.12-dev libquadmath0 366s librhash0 libstdc++-14-dev libtsan2 libubsan1 python-skbuild-doc python3-all 366s python3-all-dev python3-build python3-dev python3-distlib python3-filelock 366s python3-iniconfig python3-packaging python3-pip python3-pip-whl 366s python3-platformdirs python3-pluggy python3-pyproject-hooks python3-pytest 366s python3-pytest-mock python3-setuptools-whl python3-skbuild python3-toml 366s python3-virtualenv python3-wheel python3-wheel-whl python3.12-dev 366s sphinx-rtd-theme-common zlib1g-dev 366s Suggested packages: 366s cmake-doc cmake-format elpa-cmake-mode ninja-build cpp-doc gcc-14-locales 366s cpp-14-doc cython-doc g++-multilib g++-14-multilib gcc-14-doc gcc-multilib 366s manpages-dev autoconf automake libtool flex bison gdb gcc-doc 366s gcc-14-multilib gdb-x86-64-linux-gnu git-daemon-run | git-daemon-sysvinit 366s git-doc git-email git-gui gitk gitweb git-cvs git-mediawiki git-svn 366s libstdc++-14-doc python3-venv python-build-doc python-pytest-mock-doc 366s Recommended packages: 366s javascript-common 366s The following NEW packages will be installed: 366s autopkgtest-satdep build-essential cmake cmake-data cpp cpp-14 366s cpp-14-x86-64-linux-gnu cpp-x86-64-linux-gnu cython3 fonts-font-awesome 366s fonts-lato g++ g++-14 g++-14-x86-64-linux-gnu g++-x86-64-linux-gnu gcc 366s gcc-14 gcc-14-x86-64-linux-gnu gcc-x86-64-linux-gnu git git-man libasan8 366s libcc1-0 liberror-perl libexpat1-dev libgcc-14-dev libgomp1 libhwasan0 366s libisl23 libitm1 libjs-jquery libjs-sphinxdoc libjs-underscore libjsoncpp25 366s liblsan0 libmpc3 libpython3-all-dev libpython3-dev libpython3.12-dev 366s libquadmath0 librhash0 libstdc++-14-dev libtsan2 libubsan1 366s python-skbuild-doc python3-all python3-all-dev python3-build python3-dev 366s python3-distlib python3-filelock python3-iniconfig python3-packaging 366s python3-pip python3-pip-whl python3-platformdirs python3-pluggy 366s python3-pyproject-hooks python3-pytest python3-pytest-mock 366s python3-setuptools-whl python3-skbuild python3-toml python3-virtualenv 366s python3-wheel python3-wheel-whl python3.12-dev sphinx-rtd-theme-common 366s zlib1g-dev 366s 0 upgraded, 69 newly installed, 0 to remove and 0 not upgraded. 366s Need to get 105 MB/105 MB of archives. 366s After this operation, 379 MB of additional disk space will be used. 366s Get:1 /tmp/autopkgtest.keEXGA/1-autopkgtest-satdep.deb autopkgtest-satdep amd64 0 [784 B] 366s Get:2 http://ftpmaster.internal/ubuntu plucky/main amd64 fonts-lato all 2.015-1 [2781 kB] 367s Get:3 http://ftpmaster.internal/ubuntu plucky/main amd64 libisl23 amd64 0.27-1 [685 kB] 367s Get:4 http://ftpmaster.internal/ubuntu plucky/main amd64 libmpc3 amd64 1.3.1-1build2 [55.3 kB] 367s Get:5 http://ftpmaster.internal/ubuntu plucky/main amd64 cpp-14-x86-64-linux-gnu amd64 14.2.0-7ubuntu1 [11.9 MB] 368s Get:6 http://ftpmaster.internal/ubuntu plucky/main amd64 cpp-14 amd64 14.2.0-7ubuntu1 [1026 B] 368s Get:7 http://ftpmaster.internal/ubuntu plucky/main amd64 cpp-x86-64-linux-gnu amd64 4:14.1.0-2ubuntu1 [5452 B] 368s Get:8 http://ftpmaster.internal/ubuntu plucky/main amd64 cpp amd64 4:14.1.0-2ubuntu1 [22.4 kB] 368s Get:9 http://ftpmaster.internal/ubuntu plucky/main amd64 libcc1-0 amd64 14.2.0-7ubuntu1 [47.6 kB] 368s Get:10 http://ftpmaster.internal/ubuntu plucky/main amd64 libgomp1 amd64 14.2.0-7ubuntu1 [148 kB] 368s Get:11 http://ftpmaster.internal/ubuntu plucky/main amd64 libitm1 amd64 14.2.0-7ubuntu1 [29.1 kB] 368s Get:12 http://ftpmaster.internal/ubuntu plucky/main amd64 libasan8 amd64 14.2.0-7ubuntu1 [2998 kB] 368s Get:13 http://ftpmaster.internal/ubuntu plucky/main amd64 liblsan0 amd64 14.2.0-7ubuntu1 [1316 kB] 368s Get:14 http://ftpmaster.internal/ubuntu plucky/main amd64 libtsan2 amd64 14.2.0-7ubuntu1 [2733 kB] 368s Get:15 http://ftpmaster.internal/ubuntu plucky/main amd64 libubsan1 amd64 14.2.0-7ubuntu1 [1177 kB] 368s Get:16 http://ftpmaster.internal/ubuntu plucky/main amd64 libhwasan0 amd64 14.2.0-7ubuntu1 [1634 kB] 368s Get:17 http://ftpmaster.internal/ubuntu plucky/main amd64 libquadmath0 amd64 14.2.0-7ubuntu1 [153 kB] 368s Get:18 http://ftpmaster.internal/ubuntu plucky/main amd64 libgcc-14-dev amd64 14.2.0-7ubuntu1 [2814 kB] 368s Get:19 http://ftpmaster.internal/ubuntu plucky/main amd64 gcc-14-x86-64-linux-gnu amd64 14.2.0-7ubuntu1 [23.4 MB] 369s Get:20 http://ftpmaster.internal/ubuntu plucky/main amd64 gcc-14 amd64 14.2.0-7ubuntu1 [526 kB] 369s Get:21 http://ftpmaster.internal/ubuntu plucky/main amd64 gcc-x86-64-linux-gnu amd64 4:14.1.0-2ubuntu1 [1214 B] 369s Get:22 http://ftpmaster.internal/ubuntu plucky/main amd64 gcc amd64 4:14.1.0-2ubuntu1 [5000 B] 369s Get:23 http://ftpmaster.internal/ubuntu plucky/main amd64 libstdc++-14-dev amd64 14.2.0-7ubuntu1 [2503 kB] 369s Get:24 http://ftpmaster.internal/ubuntu plucky/main amd64 g++-14-x86-64-linux-gnu amd64 14.2.0-7ubuntu1 [13.4 MB] 370s Get:25 http://ftpmaster.internal/ubuntu plucky/main amd64 g++-14 amd64 14.2.0-7ubuntu1 [19.8 kB] 370s Get:26 http://ftpmaster.internal/ubuntu plucky/main amd64 g++-x86-64-linux-gnu amd64 4:14.1.0-2ubuntu1 [966 B] 370s Get:27 http://ftpmaster.internal/ubuntu plucky/main amd64 g++ amd64 4:14.1.0-2ubuntu1 [1100 B] 370s Get:28 http://ftpmaster.internal/ubuntu plucky/main amd64 build-essential amd64 12.10ubuntu1 [4928 B] 370s Get:29 http://ftpmaster.internal/ubuntu plucky/main amd64 libjsoncpp25 amd64 1.9.5-6build1 [82.8 kB] 370s Get:30 http://ftpmaster.internal/ubuntu plucky/main amd64 librhash0 amd64 1.4.3-3build1 [129 kB] 370s Get:31 http://ftpmaster.internal/ubuntu plucky/main amd64 cmake-data all 3.30.3-1 [2246 kB] 370s Get:32 http://ftpmaster.internal/ubuntu plucky/main amd64 cmake amd64 3.30.3-1 [12.0 MB] 370s Get:33 http://ftpmaster.internal/ubuntu plucky/universe amd64 cython3 amd64 3.0.11+dfsg-1ubuntu1 [2491 kB] 370s Get:34 http://ftpmaster.internal/ubuntu plucky/main amd64 fonts-font-awesome all 5.0.10+really4.7.0~dfsg-4.1 [516 kB] 370s Get:35 http://ftpmaster.internal/ubuntu plucky/main amd64 liberror-perl all 0.17029-2 [25.6 kB] 370s Get:36 http://ftpmaster.internal/ubuntu plucky/main amd64 git-man all 1:2.45.2-1ubuntu1 [1122 kB] 370s Get:37 http://ftpmaster.internal/ubuntu plucky/main amd64 git amd64 1:2.45.2-1ubuntu1 [3928 kB] 371s Get:38 http://ftpmaster.internal/ubuntu plucky/main amd64 libexpat1-dev amd64 2.6.2-2 [140 kB] 371s Get:39 http://ftpmaster.internal/ubuntu plucky/main amd64 libjs-jquery all 3.6.1+dfsg+~3.5.14-1 [328 kB] 371s Get:40 http://ftpmaster.internal/ubuntu plucky/main amd64 libjs-underscore all 1.13.4~dfsg+~1.11.4-3 [118 kB] 371s Get:41 http://ftpmaster.internal/ubuntu plucky/main amd64 libjs-sphinxdoc all 7.4.7-4 [158 kB] 371s Get:42 http://ftpmaster.internal/ubuntu plucky/main amd64 zlib1g-dev amd64 1:1.3.dfsg+really1.3.1-1ubuntu1 [895 kB] 371s Get:43 http://ftpmaster.internal/ubuntu plucky/main amd64 libpython3.12-dev amd64 3.12.7-3 [5699 kB] 371s Get:44 http://ftpmaster.internal/ubuntu plucky/main amd64 libpython3-dev amd64 3.12.6-0ubuntu1 [10.2 kB] 371s Get:45 http://ftpmaster.internal/ubuntu plucky/main amd64 libpython3-all-dev amd64 3.12.6-0ubuntu1 [916 B] 371s Get:46 http://ftpmaster.internal/ubuntu plucky/main amd64 sphinx-rtd-theme-common all 3.0.1+dfsg-1 [1012 kB] 371s Get:47 http://ftpmaster.internal/ubuntu plucky/universe amd64 python-skbuild-doc all 0.18.1-1 [136 kB] 371s Get:48 http://ftpmaster.internal/ubuntu plucky/main amd64 python3-all amd64 3.12.6-0ubuntu1 [886 B] 371s Get:49 http://ftpmaster.internal/ubuntu plucky/main amd64 python3.12-dev amd64 3.12.7-3 [505 kB] 371s Get:50 http://ftpmaster.internal/ubuntu plucky/main amd64 python3-dev amd64 3.12.6-0ubuntu1 [26.7 kB] 371s Get:51 http://ftpmaster.internal/ubuntu plucky/main amd64 python3-all-dev amd64 3.12.6-0ubuntu1 [908 B] 371s Get:52 http://ftpmaster.internal/ubuntu plucky/main amd64 python3-packaging all 24.1-1 [41.4 kB] 371s Get:53 http://ftpmaster.internal/ubuntu plucky/universe amd64 python3-pyproject-hooks all 1.2.0-1 [10.2 kB] 371s Get:54 http://ftpmaster.internal/ubuntu plucky/universe amd64 python3-toml all 0.10.2-1 [16.5 kB] 371s Get:55 http://ftpmaster.internal/ubuntu plucky/universe amd64 python3-wheel all 0.44.0-1 [54.2 kB] 371s Get:56 http://ftpmaster.internal/ubuntu plucky/universe amd64 python3-build all 1.2.2-1 [31.0 kB] 371s Get:57 http://ftpmaster.internal/ubuntu plucky/universe amd64 python3-distlib all 0.3.9-1 [267 kB] 371s Get:58 http://ftpmaster.internal/ubuntu plucky/universe amd64 python3-filelock all 3.16.1-1 [12.8 kB] 371s Get:59 http://ftpmaster.internal/ubuntu plucky/universe amd64 python3-iniconfig all 1.1.1-2 [6024 B] 371s Get:60 http://ftpmaster.internal/ubuntu plucky/universe amd64 python3-pip all 24.2+dfsg-1 [1398 kB] 371s Get:61 http://ftpmaster.internal/ubuntu plucky/universe amd64 python3-pip-whl all 24.2+dfsg-1 [1420 kB] 371s Get:62 http://ftpmaster.internal/ubuntu plucky/main amd64 python3-platformdirs all 4.3.6-1 [16.8 kB] 371s Get:63 http://ftpmaster.internal/ubuntu plucky/universe amd64 python3-pluggy all 1.5.0-1 [21.0 kB] 371s Get:64 http://ftpmaster.internal/ubuntu plucky/universe amd64 python3-pytest all 8.3.3-1 [251 kB] 371s Get:65 http://ftpmaster.internal/ubuntu plucky/universe amd64 python3-pytest-mock all 3.14.0-1 [11.6 kB] 371s Get:66 http://ftpmaster.internal/ubuntu plucky-proposed/universe amd64 python3-setuptools-whl all 75.2.0-1 [1158 kB] 371s Get:67 http://ftpmaster.internal/ubuntu plucky/universe amd64 python3-skbuild all 0.18.1-1 [60.3 kB] 371s Get:68 http://ftpmaster.internal/ubuntu plucky/universe amd64 python3-wheel-whl all 0.44.0-1 [69.5 kB] 371s Get:69 http://ftpmaster.internal/ubuntu plucky/universe amd64 python3-virtualenv all 20.27.0+ds-1 [71.9 kB] 371s Fetched 105 MB in 5s (22.0 MB/s) 371s Selecting previously unselected package fonts-lato. 371s (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 ... 75562 files and directories currently installed.) 371s Preparing to unpack .../00-fonts-lato_2.015-1_all.deb ... 371s Unpacking fonts-lato (2.015-1) ... 372s Selecting previously unselected package libisl23:amd64. 372s Preparing to unpack .../01-libisl23_0.27-1_amd64.deb ... 372s Unpacking libisl23:amd64 (0.27-1) ... 372s Selecting previously unselected package libmpc3:amd64. 372s Preparing to unpack .../02-libmpc3_1.3.1-1build2_amd64.deb ... 372s Unpacking libmpc3:amd64 (1.3.1-1build2) ... 372s Selecting previously unselected package cpp-14-x86-64-linux-gnu. 372s Preparing to unpack .../03-cpp-14-x86-64-linux-gnu_14.2.0-7ubuntu1_amd64.deb ... 372s Unpacking cpp-14-x86-64-linux-gnu (14.2.0-7ubuntu1) ... 372s Selecting previously unselected package cpp-14. 372s Preparing to unpack .../04-cpp-14_14.2.0-7ubuntu1_amd64.deb ... 372s Unpacking cpp-14 (14.2.0-7ubuntu1) ... 372s Selecting previously unselected package cpp-x86-64-linux-gnu. 372s Preparing to unpack .../05-cpp-x86-64-linux-gnu_4%3a14.1.0-2ubuntu1_amd64.deb ... 372s Unpacking cpp-x86-64-linux-gnu (4:14.1.0-2ubuntu1) ... 372s Selecting previously unselected package cpp. 372s Preparing to unpack .../06-cpp_4%3a14.1.0-2ubuntu1_amd64.deb ... 372s Unpacking cpp (4:14.1.0-2ubuntu1) ... 372s Selecting previously unselected package libcc1-0:amd64. 372s Preparing to unpack .../07-libcc1-0_14.2.0-7ubuntu1_amd64.deb ... 372s Unpacking libcc1-0:amd64 (14.2.0-7ubuntu1) ... 372s Selecting previously unselected package libgomp1:amd64. 372s Preparing to unpack .../08-libgomp1_14.2.0-7ubuntu1_amd64.deb ... 372s Unpacking libgomp1:amd64 (14.2.0-7ubuntu1) ... 372s Selecting previously unselected package libitm1:amd64. 372s Preparing to unpack .../09-libitm1_14.2.0-7ubuntu1_amd64.deb ... 372s Unpacking libitm1:amd64 (14.2.0-7ubuntu1) ... 372s Selecting previously unselected package libasan8:amd64. 372s Preparing to unpack .../10-libasan8_14.2.0-7ubuntu1_amd64.deb ... 372s Unpacking libasan8:amd64 (14.2.0-7ubuntu1) ... 372s Selecting previously unselected package liblsan0:amd64. 372s Preparing to unpack .../11-liblsan0_14.2.0-7ubuntu1_amd64.deb ... 372s Unpacking liblsan0:amd64 (14.2.0-7ubuntu1) ... 372s Selecting previously unselected package libtsan2:amd64. 372s Preparing to unpack .../12-libtsan2_14.2.0-7ubuntu1_amd64.deb ... 372s Unpacking libtsan2:amd64 (14.2.0-7ubuntu1) ... 372s Selecting previously unselected package libubsan1:amd64. 372s Preparing to unpack .../13-libubsan1_14.2.0-7ubuntu1_amd64.deb ... 372s Unpacking libubsan1:amd64 (14.2.0-7ubuntu1) ... 372s Selecting previously unselected package libhwasan0:amd64. 372s Preparing to unpack .../14-libhwasan0_14.2.0-7ubuntu1_amd64.deb ... 372s Unpacking libhwasan0:amd64 (14.2.0-7ubuntu1) ... 372s Selecting previously unselected package libquadmath0:amd64. 372s Preparing to unpack .../15-libquadmath0_14.2.0-7ubuntu1_amd64.deb ... 372s Unpacking libquadmath0:amd64 (14.2.0-7ubuntu1) ... 372s Selecting previously unselected package libgcc-14-dev:amd64. 372s Preparing to unpack .../16-libgcc-14-dev_14.2.0-7ubuntu1_amd64.deb ... 372s Unpacking libgcc-14-dev:amd64 (14.2.0-7ubuntu1) ... 372s Selecting previously unselected package gcc-14-x86-64-linux-gnu. 372s Preparing to unpack .../17-gcc-14-x86-64-linux-gnu_14.2.0-7ubuntu1_amd64.deb ... 372s Unpacking gcc-14-x86-64-linux-gnu (14.2.0-7ubuntu1) ... 373s Selecting previously unselected package gcc-14. 373s Preparing to unpack .../18-gcc-14_14.2.0-7ubuntu1_amd64.deb ... 373s Unpacking gcc-14 (14.2.0-7ubuntu1) ... 373s Selecting previously unselected package gcc-x86-64-linux-gnu. 373s Preparing to unpack .../19-gcc-x86-64-linux-gnu_4%3a14.1.0-2ubuntu1_amd64.deb ... 373s Unpacking gcc-x86-64-linux-gnu (4:14.1.0-2ubuntu1) ... 373s Selecting previously unselected package gcc. 373s Preparing to unpack .../20-gcc_4%3a14.1.0-2ubuntu1_amd64.deb ... 373s Unpacking gcc (4:14.1.0-2ubuntu1) ... 373s Selecting previously unselected package libstdc++-14-dev:amd64. 373s Preparing to unpack .../21-libstdc++-14-dev_14.2.0-7ubuntu1_amd64.deb ... 373s Unpacking libstdc++-14-dev:amd64 (14.2.0-7ubuntu1) ... 373s Selecting previously unselected package g++-14-x86-64-linux-gnu. 373s Preparing to unpack .../22-g++-14-x86-64-linux-gnu_14.2.0-7ubuntu1_amd64.deb ... 373s Unpacking g++-14-x86-64-linux-gnu (14.2.0-7ubuntu1) ... 373s Selecting previously unselected package g++-14. 373s Preparing to unpack .../23-g++-14_14.2.0-7ubuntu1_amd64.deb ... 373s Unpacking g++-14 (14.2.0-7ubuntu1) ... 373s Selecting previously unselected package g++-x86-64-linux-gnu. 373s Preparing to unpack .../24-g++-x86-64-linux-gnu_4%3a14.1.0-2ubuntu1_amd64.deb ... 373s Unpacking g++-x86-64-linux-gnu (4:14.1.0-2ubuntu1) ... 373s Selecting previously unselected package g++. 373s Preparing to unpack .../25-g++_4%3a14.1.0-2ubuntu1_amd64.deb ... 373s Unpacking g++ (4:14.1.0-2ubuntu1) ... 373s Selecting previously unselected package build-essential. 373s Preparing to unpack .../26-build-essential_12.10ubuntu1_amd64.deb ... 373s Unpacking build-essential (12.10ubuntu1) ... 373s Selecting previously unselected package libjsoncpp25:amd64. 373s Preparing to unpack .../27-libjsoncpp25_1.9.5-6build1_amd64.deb ... 373s Unpacking libjsoncpp25:amd64 (1.9.5-6build1) ... 373s Selecting previously unselected package librhash0:amd64. 373s Preparing to unpack .../28-librhash0_1.4.3-3build1_amd64.deb ... 373s Unpacking librhash0:amd64 (1.4.3-3build1) ... 373s Selecting previously unselected package cmake-data. 373s Preparing to unpack .../29-cmake-data_3.30.3-1_all.deb ... 373s Unpacking cmake-data (3.30.3-1) ... 374s Selecting previously unselected package cmake. 374s Preparing to unpack .../30-cmake_3.30.3-1_amd64.deb ... 374s Unpacking cmake (3.30.3-1) ... 374s Selecting previously unselected package cython3. 374s Preparing to unpack .../31-cython3_3.0.11+dfsg-1ubuntu1_amd64.deb ... 374s Unpacking cython3 (3.0.11+dfsg-1ubuntu1) ... 374s Selecting previously unselected package fonts-font-awesome. 374s Preparing to unpack .../32-fonts-font-awesome_5.0.10+really4.7.0~dfsg-4.1_all.deb ... 374s Unpacking fonts-font-awesome (5.0.10+really4.7.0~dfsg-4.1) ... 374s Selecting previously unselected package liberror-perl. 374s Preparing to unpack .../33-liberror-perl_0.17029-2_all.deb ... 374s Unpacking liberror-perl (0.17029-2) ... 374s Selecting previously unselected package git-man. 374s Preparing to unpack .../34-git-man_1%3a2.45.2-1ubuntu1_all.deb ... 374s Unpacking git-man (1:2.45.2-1ubuntu1) ... 374s Selecting previously unselected package git. 374s Preparing to unpack .../35-git_1%3a2.45.2-1ubuntu1_amd64.deb ... 374s Unpacking git (1:2.45.2-1ubuntu1) ... 374s Selecting previously unselected package libexpat1-dev:amd64. 374s Preparing to unpack .../36-libexpat1-dev_2.6.2-2_amd64.deb ... 374s Unpacking libexpat1-dev:amd64 (2.6.2-2) ... 374s Selecting previously unselected package libjs-jquery. 374s Preparing to unpack .../37-libjs-jquery_3.6.1+dfsg+~3.5.14-1_all.deb ... 374s Unpacking libjs-jquery (3.6.1+dfsg+~3.5.14-1) ... 374s Selecting previously unselected package libjs-underscore. 374s Preparing to unpack .../38-libjs-underscore_1.13.4~dfsg+~1.11.4-3_all.deb ... 374s Unpacking libjs-underscore (1.13.4~dfsg+~1.11.4-3) ... 374s Selecting previously unselected package libjs-sphinxdoc. 374s Preparing to unpack .../39-libjs-sphinxdoc_7.4.7-4_all.deb ... 374s Unpacking libjs-sphinxdoc (7.4.7-4) ... 374s Selecting previously unselected package zlib1g-dev:amd64. 374s Preparing to unpack .../40-zlib1g-dev_1%3a1.3.dfsg+really1.3.1-1ubuntu1_amd64.deb ... 374s Unpacking zlib1g-dev:amd64 (1:1.3.dfsg+really1.3.1-1ubuntu1) ... 374s Selecting previously unselected package libpython3.12-dev:amd64. 374s Preparing to unpack .../41-libpython3.12-dev_3.12.7-3_amd64.deb ... 374s Unpacking libpython3.12-dev:amd64 (3.12.7-3) ... 375s Selecting previously unselected package libpython3-dev:amd64. 375s Preparing to unpack .../42-libpython3-dev_3.12.6-0ubuntu1_amd64.deb ... 375s Unpacking libpython3-dev:amd64 (3.12.6-0ubuntu1) ... 375s Selecting previously unselected package libpython3-all-dev:amd64. 375s Preparing to unpack .../43-libpython3-all-dev_3.12.6-0ubuntu1_amd64.deb ... 375s Unpacking libpython3-all-dev:amd64 (3.12.6-0ubuntu1) ... 375s Selecting previously unselected package sphinx-rtd-theme-common. 375s Preparing to unpack .../44-sphinx-rtd-theme-common_3.0.1+dfsg-1_all.deb ... 375s Unpacking sphinx-rtd-theme-common (3.0.1+dfsg-1) ... 375s Selecting previously unselected package python-skbuild-doc. 375s Preparing to unpack .../45-python-skbuild-doc_0.18.1-1_all.deb ... 375s Unpacking python-skbuild-doc (0.18.1-1) ... 375s Selecting previously unselected package python3-all. 375s Preparing to unpack .../46-python3-all_3.12.6-0ubuntu1_amd64.deb ... 375s Unpacking python3-all (3.12.6-0ubuntu1) ... 375s Selecting previously unselected package python3.12-dev. 375s Preparing to unpack .../47-python3.12-dev_3.12.7-3_amd64.deb ... 375s Unpacking python3.12-dev (3.12.7-3) ... 375s Selecting previously unselected package python3-dev. 375s Preparing to unpack .../48-python3-dev_3.12.6-0ubuntu1_amd64.deb ... 375s Unpacking python3-dev (3.12.6-0ubuntu1) ... 375s Selecting previously unselected package python3-all-dev. 375s Preparing to unpack .../49-python3-all-dev_3.12.6-0ubuntu1_amd64.deb ... 375s Unpacking python3-all-dev (3.12.6-0ubuntu1) ... 375s Selecting previously unselected package python3-packaging. 375s Preparing to unpack .../50-python3-packaging_24.1-1_all.deb ... 375s Unpacking python3-packaging (24.1-1) ... 375s Selecting previously unselected package python3-pyproject-hooks. 375s Preparing to unpack .../51-python3-pyproject-hooks_1.2.0-1_all.deb ... 375s Unpacking python3-pyproject-hooks (1.2.0-1) ... 375s Selecting previously unselected package python3-toml. 375s Preparing to unpack .../52-python3-toml_0.10.2-1_all.deb ... 375s Unpacking python3-toml (0.10.2-1) ... 375s Selecting previously unselected package python3-wheel. 375s Preparing to unpack .../53-python3-wheel_0.44.0-1_all.deb ... 375s Unpacking python3-wheel (0.44.0-1) ... 375s Selecting previously unselected package python3-build. 375s Preparing to unpack .../54-python3-build_1.2.2-1_all.deb ... 375s Unpacking python3-build (1.2.2-1) ... 375s Selecting previously unselected package python3-distlib. 375s Preparing to unpack .../55-python3-distlib_0.3.9-1_all.deb ... 375s Unpacking python3-distlib (0.3.9-1) ... 375s Selecting previously unselected package python3-filelock. 375s Preparing to unpack .../56-python3-filelock_3.16.1-1_all.deb ... 375s Unpacking python3-filelock (3.16.1-1) ... 375s Selecting previously unselected package python3-iniconfig. 375s Preparing to unpack .../57-python3-iniconfig_1.1.1-2_all.deb ... 375s Unpacking python3-iniconfig (1.1.1-2) ... 375s Selecting previously unselected package python3-pip. 375s Preparing to unpack .../58-python3-pip_24.2+dfsg-1_all.deb ... 375s Unpacking python3-pip (24.2+dfsg-1) ... 375s Selecting previously unselected package python3-pip-whl. 375s Preparing to unpack .../59-python3-pip-whl_24.2+dfsg-1_all.deb ... 375s Unpacking python3-pip-whl (24.2+dfsg-1) ... 375s Selecting previously unselected package python3-platformdirs. 375s Preparing to unpack .../60-python3-platformdirs_4.3.6-1_all.deb ... 375s Unpacking python3-platformdirs (4.3.6-1) ... 375s Selecting previously unselected package python3-pluggy. 375s Preparing to unpack .../61-python3-pluggy_1.5.0-1_all.deb ... 375s Unpacking python3-pluggy (1.5.0-1) ... 375s Selecting previously unselected package python3-pytest. 375s Preparing to unpack .../62-python3-pytest_8.3.3-1_all.deb ... 375s Unpacking python3-pytest (8.3.3-1) ... 375s Selecting previously unselected package python3-pytest-mock. 375s Preparing to unpack .../63-python3-pytest-mock_3.14.0-1_all.deb ... 375s Unpacking python3-pytest-mock (3.14.0-1) ... 375s Selecting previously unselected package python3-setuptools-whl. 375s Preparing to unpack .../64-python3-setuptools-whl_75.2.0-1_all.deb ... 375s Unpacking python3-setuptools-whl (75.2.0-1) ... 375s Selecting previously unselected package python3-skbuild. 375s Preparing to unpack .../65-python3-skbuild_0.18.1-1_all.deb ... 375s Unpacking python3-skbuild (0.18.1-1) ... 375s Selecting previously unselected package python3-wheel-whl. 375s Preparing to unpack .../66-python3-wheel-whl_0.44.0-1_all.deb ... 375s Unpacking python3-wheel-whl (0.44.0-1) ... 375s Selecting previously unselected package python3-virtualenv. 375s Preparing to unpack .../67-python3-virtualenv_20.27.0+ds-1_all.deb ... 375s Unpacking python3-virtualenv (20.27.0+ds-1) ... 375s Selecting previously unselected package autopkgtest-satdep. 375s Preparing to unpack .../68-1-autopkgtest-satdep.deb ... 375s Unpacking autopkgtest-satdep (0) ... 375s Setting up python3-iniconfig (1.1.1-2) ... 375s Setting up python3-setuptools-whl (75.2.0-1) ... 375s Setting up python3-filelock (3.16.1-1) ... 375s Setting up fonts-lato (2.015-1) ... 375s Setting up python3-pip-whl (24.2+dfsg-1) ... 375s Setting up python3-all (3.12.6-0ubuntu1) ... 375s Setting up python3-distlib (0.3.9-1) ... 376s Setting up libgomp1:amd64 (14.2.0-7ubuntu1) ... 376s Setting up python3-wheel (0.44.0-1) ... 376s Setting up python3-platformdirs (4.3.6-1) ... 376s Setting up liberror-perl (0.17029-2) ... 376s Setting up python3-packaging (24.1-1) ... 376s Setting up libexpat1-dev:amd64 (2.6.2-2) ... 376s Setting up python3-pyproject-hooks (1.2.0-1) ... 376s Setting up libquadmath0:amd64 (14.2.0-7ubuntu1) ... 376s Setting up libmpc3:amd64 (1.3.1-1build2) ... 376s Setting up cython3 (3.0.11+dfsg-1ubuntu1) ... 377s Setting up libjsoncpp25:amd64 (1.9.5-6build1) ... 377s Setting up python3-pip (24.2+dfsg-1) ... 377s Setting up python3-toml (0.10.2-1) ... 378s Setting up python3-pluggy (1.5.0-1) ... 378s Setting up libubsan1:amd64 (14.2.0-7ubuntu1) ... 378s Setting up zlib1g-dev:amd64 (1:1.3.dfsg+really1.3.1-1ubuntu1) ... 378s Setting up libhwasan0:amd64 (14.2.0-7ubuntu1) ... 378s Setting up librhash0:amd64 (1.4.3-3build1) ... 378s Setting up libasan8:amd64 (14.2.0-7ubuntu1) ... 378s Setting up git-man (1:2.45.2-1ubuntu1) ... 378s Setting up cmake-data (3.30.3-1) ... 378s Setting up libtsan2:amd64 (14.2.0-7ubuntu1) ... 378s Setting up libjs-jquery (3.6.1+dfsg+~3.5.14-1) ... 378s Setting up libisl23:amd64 (0.27-1) ... 378s Setting up python3-build (1.2.2-1) ... 378s Setting up python3-wheel-whl (0.44.0-1) ... 378s Setting up fonts-font-awesome (5.0.10+really4.7.0~dfsg-4.1) ... 378s Setting up sphinx-rtd-theme-common (3.0.1+dfsg-1) ... 378s Setting up libcc1-0:amd64 (14.2.0-7ubuntu1) ... 378s Setting up liblsan0:amd64 (14.2.0-7ubuntu1) ... 378s Setting up libitm1:amd64 (14.2.0-7ubuntu1) ... 378s Setting up libjs-underscore (1.13.4~dfsg+~1.11.4-3) ... 378s Setting up python3-pytest (8.3.3-1) ... 378s Setting up python3-virtualenv (20.27.0+ds-1) ... 378s Setting up libpython3.12-dev:amd64 (3.12.7-3) ... 378s Setting up python3.12-dev (3.12.7-3) ... 378s Setting up cpp-14-x86-64-linux-gnu (14.2.0-7ubuntu1) ... 378s Setting up git (1:2.45.2-1ubuntu1) ... 378s Setting up libjs-sphinxdoc (7.4.7-4) ... 378s Setting up cpp-14 (14.2.0-7ubuntu1) ... 378s Setting up python3-pytest-mock (3.14.0-1) ... 378s Setting up cmake (3.30.3-1) ... 378s Setting up libgcc-14-dev:amd64 (14.2.0-7ubuntu1) ... 378s Setting up libstdc++-14-dev:amd64 (14.2.0-7ubuntu1) ... 378s Setting up cpp-x86-64-linux-gnu (4:14.1.0-2ubuntu1) ... 378s Setting up libpython3-dev:amd64 (3.12.6-0ubuntu1) ... 378s Setting up python-skbuild-doc (0.18.1-1) ... 378s Setting up python3-skbuild (0.18.1-1) ... 378s Setting up libpython3-all-dev:amd64 (3.12.6-0ubuntu1) ... 378s Setting up python3-dev (3.12.6-0ubuntu1) ... 378s Setting up cpp (4:14.1.0-2ubuntu1) ... 378s Setting up gcc-14-x86-64-linux-gnu (14.2.0-7ubuntu1) ... 378s Setting up python3-all-dev (3.12.6-0ubuntu1) ... 378s Setting up gcc-x86-64-linux-gnu (4:14.1.0-2ubuntu1) ... 378s Setting up gcc-14 (14.2.0-7ubuntu1) ... 378s Setting up g++-14-x86-64-linux-gnu (14.2.0-7ubuntu1) ... 378s Setting up g++-x86-64-linux-gnu (4:14.1.0-2ubuntu1) ... 378s Setting up g++-14 (14.2.0-7ubuntu1) ... 378s Setting up gcc (4:14.1.0-2ubuntu1) ... 378s Setting up g++ (4:14.1.0-2ubuntu1) ... 378s update-alternatives: using /usr/bin/g++ to provide /usr/bin/c++ (c++) in auto mode 378s Setting up build-essential (12.10ubuntu1) ... 378s Setting up autopkgtest-satdep (0) ... 378s Processing triggers for man-db (2.12.1-3) ... 379s Processing triggers for libc-bin (2.40-1ubuntu3) ... 382s (Reading database ... 83690 files and directories currently installed.) 382s Removing autopkgtest-satdep (0) ... 383s autopkgtest [16:05:21]: test testsuite: [----------------------- 383s + cp -r tests /tmp/autopkgtest.keEXGA/autopkgtest_tmp 383s + cp pyproject.toml /tmp/autopkgtest.keEXGA/autopkgtest_tmp 383s + cd /tmp/autopkgtest.keEXGA/autopkgtest_tmp 383s + py3versions -s 383s + 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 384s ============================= test session starts ============================== 384s platform linux -- Python 3.12.7, pytest-8.3.3, pluggy-1.5.0 384s installed packages of interest: build==1.2.2 distro==1.9.0 packaging==24.1 pip==24.2 scikit-build==0.18.1 setuptools==75.2.0 virtualenv==20.27.0 wheel==0.44.0 384s No cmake3 executable found on PATH 384s /usr/bin/cmake: cmake version 3.30.3 384s No ninja executable found on PATH 384s rootdir: /tmp/autopkgtest.keEXGA/autopkgtest_tmp 384s configfile: pyproject.toml 384s testpaths: tests 384s plugins: mock-3.14.0, typeguard-4.4.1 384s collected 238 items / 17 deselected / 1 skipped / 221 selected 384s 384s tests/test_broken_project.py FFFFFFF [ 3%] 384s tests/test_cmake_target.py F [ 3%] 384s tests/test_cmakelists_not_in_top_level_dir.py FFFF [ 5%] 387s tests/test_cmaker.py ............... [ 12%] 388s tests/test_command_line.py FFFFFFFFFFFFF [ 18%] 388s tests/test_constants.py . [ 18%] 388s tests/test_cython_flags.py F [ 19%] 388s tests/test_filter_manifest.py F [ 19%] 388s tests/test_hello_cpp.py FFFFF [ 21%] 388s tests/test_hello_cython.py FFF [ 23%] 388s tests/test_hello_pure.py FFFF [ 24%] 388s tests/test_include_exclude_data.py FF [ 25%] 388s tests/test_issue284_build_ext_inplace.py F [ 26%] 388s tests/test_issue335_support_cmake_source_dir.py F [ 26%] 389s tests/test_issue342_cmake_osx_args_in_setup.py FFFFFFFFF [ 30%] 389s tests/test_issue352_isolated_environment_support.py F [ 31%] 389s tests/test_issue668_symbol_visibility.py FF [ 32%] 389s tests/test_logging.py .. [ 33%] 389s tests/test_manifest_in.py F [ 33%] 389s tests/test_outside_project_root.py FFF [ 34%] 389s tests/test_platform.py .............s [ 41%] 391s tests/test_setup.py ....FFFFFFFFFsFFFF..........FFFFFFFFFFFFFFFFFFFFFFFF [ 64%] 391s FFFFFFFFFsssFsssFsssFsssFsssFsssFsssFsssFFFFF [ 85%] 392s tests/test_skbuild.py .sFFFssss [ 89%] 392s tests/test_skbuild_variable.py FFF [ 90%] 392s tests/test_utils.py ..................... [100%] 392s 392s =================================== FAILURES =================================== 392s ____________________ test_cmakelists_with_fatalerror_fails _____________________ 392s 392s capfd = <_pytest.capture.CaptureFixture object at 0x7537dfeb68d0> 392s 392s def test_cmakelists_with_fatalerror_fails(capfd): 392s with push_dir(): 392s 392s @project_setup_py_test("fail-with-fatal-error-cmakelists", ["build"], disable_languages_test=True) 392s def should_fail(): 392s pass 392s 392s with pytest.raises(SystemExit) as excinfo: 392s > should_fail() 392s 392s capfd = <_pytest.capture.CaptureFixture object at 0x7537dfeb68d0> 392s excinfo = 392s should_fail = .should_fail at 0x7537dfb600e0> 392s 392s tests/test_broken_project.py:31: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s tests/__init__.py:255: in wrapped 392s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 392s disable_languages_test = True 392s fun = .should_fail at 0x7537dfb60040> 392s iargs = () 392s ikwargs = {} 392s ret = False 392s wrapped = .should_fail at 0x7537dfb600e0> 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-0/should_fail0') 392s setup_args = ['build'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-0/should_fail0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s ----------------------------- Captured stdout call ----------------------------- 392s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-0/should_fail0/.git/ 392s [master (root-commit) f2a3d85] Initial commit 392s 2 files changed, 20 insertions(+) 392s create mode 100644 CMakeLists.txt 392s create mode 100644 setup.py 392s ----------------------------- Captured stderr call ----------------------------- 392s hint: Using 'master' as the name for the initial branch. This default branch name 392s hint: is subject to change. To configure the initial branch name to use in all 392s hint: of your new repositories, which will suppress this warning, call: 392s hint: 392s hint: git config --global init.defaultBranch 392s hint: 392s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 392s hint: 'development'. The just-created branch can be renamed via this command: 392s hint: 392s hint: git branch -m 392s ____________________ test_cmakelists_with_syntaxerror_fails ____________________ 392s 392s capfd = <_pytest.capture.CaptureFixture object at 0x7537dfbe5790> 392s 392s def test_cmakelists_with_syntaxerror_fails(capfd): 392s with push_dir(): 392s 392s @project_setup_py_test("fail-with-syntax-error-cmakelists", ["build"], disable_languages_test=True) 392s def should_fail(): 392s pass 392s 392s with pytest.raises(SystemExit) as excinfo: 392s > should_fail() 392s 392s capfd = <_pytest.capture.CaptureFixture object at 0x7537dfbe5790> 392s excinfo = 392s should_fail = .should_fail at 0x7537dfb60c20> 392s 392s tests/test_broken_project.py:49: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s tests/__init__.py:255: in wrapped 392s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 392s disable_languages_test = True 392s fun = .should_fail at 0x7537dfb60cc0> 392s iargs = () 392s ikwargs = {} 392s ret = False 392s wrapped = .should_fail at 0x7537dfb60c20> 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-1/should_fail0') 392s setup_args = ['build'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-1/should_fail0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s ----------------------------- Captured stdout call ----------------------------- 392s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-1/should_fail0/.git/ 392s [master (root-commit) b51062e] Initial commit 392s 2 files changed, 20 insertions(+) 392s create mode 100644 CMakeLists.txt 392s create mode 100644 setup.py 392s ----------------------------- Captured stderr call ----------------------------- 392s hint: Using 'master' as the name for the initial branch. This default branch name 392s hint: is subject to change. To configure the initial branch name to use in all 392s hint: of your new repositories, which will suppress this warning, call: 392s hint: 392s hint: git config --global init.defaultBranch 392s hint: 392s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 392s hint: 'development'. The just-created branch can be renamed via this command: 392s hint: 392s hint: git branch -m 392s ______________________ test_hello_with_compileerror_fails ______________________ 392s 392s capfd = <_pytest.capture.CaptureFixture object at 0x7537dfbe6840> 392s 392s def test_hello_with_compileerror_fails(capfd): 392s with push_dir(): 392s 392s @project_setup_py_test("fail-hello-with-compile-error", ["build"]) 392s def should_fail(): 392s pass 392s 392s with pytest.raises(SystemExit) as excinfo: 392s > should_fail() 392s 392s capfd = <_pytest.capture.CaptureFixture object at 0x7537dfbe6840> 392s excinfo = 392s should_fail = .should_fail at 0x7537dfb61120> 392s 392s tests/test_broken_project.py:67: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s tests/__init__.py:255: in wrapped 392s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 392s disable_languages_test = False 392s fun = .should_fail at 0x7537dfb60d60> 392s iargs = () 392s ikwargs = {} 392s ret = False 392s wrapped = .should_fail at 0x7537dfb61120> 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-2/should_fail0') 392s setup_args = ['build'], disable_languages_test = False 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = False 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-2/should_fail0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s ----------------------------- Captured stdout call ----------------------------- 392s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-2/should_fail0/.git/ 392s [master (root-commit) 7da5b91] Initial commit 392s 6 files changed, 97 insertions(+) 392s create mode 100644 CMakeLists.txt 392s create mode 100644 hello/CMakeLists.txt 392s create mode 100644 hello/__init__.py 392s create mode 100644 hello/__main__.py 392s create mode 100644 hello/_hello.cxx 392s create mode 100644 setup.py 392s ----------------------------- Captured stderr call ----------------------------- 392s hint: Using 'master' as the name for the initial branch. This default branch name 392s hint: is subject to change. To configure the initial branch name to use in all 392s hint: of your new repositories, which will suppress this warning, call: 392s hint: 392s hint: git config --global init.defaultBranch 392s hint: 392s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 392s hint: 'development'. The just-created branch can be renamed via this command: 392s hint: 392s hint: git branch -m 392s ____________________ test_invalid_cmake[CalledProcessError] ____________________ 392s 392s exception = 392s mocker = 392s 392s @pytest.mark.parametrize("exception", [CalledProcessError, OSError]) 392s def test_invalid_cmake(exception, mocker): 392s exceptions = { 392s OSError: OSError("Unknown error"), 392s CalledProcessError: CalledProcessError(1, [CMAKE_DEFAULT_EXECUTABLE, "--version"]), 392s } 392s 392s run_original = run 392s 392s def run_mock(*args, **kwargs): 392s if args[0] == [CMAKE_DEFAULT_EXECUTABLE, "--version"]: 392s raise exceptions[exception] 392s return run_original(*args, **kwargs) 392s 392s mocker.patch("skbuild.cmaker.subprocess.run", new=run_mock) 392s 392s with push_dir(): 392s 392s @project_setup_py_test("hello-no-language", ["build"], disable_languages_test=True) 392s def should_fail(): 392s pass 392s 392s with pytest.raises(SystemExit) as excinfo: 392s > should_fail() 392s 392s exception = 392s exceptions = {: OSError('Unknown error'), : CalledProcessError(1, ['/usr/bin/cmake', '--version'])} 392s excinfo = 392s mocker = 392s run_mock = .run_mock at 0x7537dfb614e0> 392s run_original = 392s should_fail = .should_fail at 0x7537dfb600e0> 392s 392s tests/test_broken_project.py:100: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s tests/__init__.py:255: in wrapped 392s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 392s disable_languages_test = True 392s fun = .should_fail at 0x7537dfb60a40> 392s iargs = () 392s ikwargs = {} 392s ret = False 392s wrapped = .should_fail at 0x7537dfb600e0> 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-3/should_fail0') 392s setup_args = ['build'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-3/should_fail0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s ----------------------------- Captured stdout call ----------------------------- 392s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-3/should_fail0/.git/ 392s [master (root-commit) 46a81ec] Initial commit 392s 2 files changed, 16 insertions(+) 392s create mode 100644 CMakeLists.txt 392s create mode 100644 setup.py 392s ----------------------------- Captured stderr call ----------------------------- 392s hint: Using 'master' as the name for the initial branch. This default branch name 392s hint: is subject to change. To configure the initial branch name to use in all 392s hint: of your new repositories, which will suppress this warning, call: 392s hint: 392s hint: git config --global init.defaultBranch 392s hint: 392s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 392s hint: 'development'. The just-created branch can be renamed via this command: 392s hint: 392s hint: git branch -m 392s _________________________ test_invalid_cmake[OSError] __________________________ 392s 392s exception = 392s mocker = 392s 392s @pytest.mark.parametrize("exception", [CalledProcessError, OSError]) 392s def test_invalid_cmake(exception, mocker): 392s exceptions = { 392s OSError: OSError("Unknown error"), 392s CalledProcessError: CalledProcessError(1, [CMAKE_DEFAULT_EXECUTABLE, "--version"]), 392s } 392s 392s run_original = run 392s 392s def run_mock(*args, **kwargs): 392s if args[0] == [CMAKE_DEFAULT_EXECUTABLE, "--version"]: 392s raise exceptions[exception] 392s return run_original(*args, **kwargs) 392s 392s mocker.patch("skbuild.cmaker.subprocess.run", new=run_mock) 392s 392s with push_dir(): 392s 392s @project_setup_py_test("hello-no-language", ["build"], disable_languages_test=True) 392s def should_fail(): 392s pass 392s 392s with pytest.raises(SystemExit) as excinfo: 392s > should_fail() 392s 392s exception = 392s exceptions = {: OSError('Unknown error'), : CalledProcessError(1, ['/usr/bin/cmake', '--version'])} 392s excinfo = 392s mocker = 392s run_mock = .run_mock at 0x7537dfb618a0> 392s run_original = 392s should_fail = .should_fail at 0x7537dfb61bc0> 392s 392s tests/test_broken_project.py:100: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s tests/__init__.py:255: in wrapped 392s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 392s disable_languages_test = True 392s fun = .should_fail at 0x7537dfb60180> 392s iargs = () 392s ikwargs = {} 392s ret = False 392s wrapped = .should_fail at 0x7537dfb61bc0> 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-4/should_fail0') 392s setup_args = ['build'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-4/should_fail0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s ----------------------------- Captured stdout call ----------------------------- 392s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-4/should_fail0/.git/ 392s [master (root-commit) 46a81ec] Initial commit 392s 2 files changed, 16 insertions(+) 392s create mode 100644 CMakeLists.txt 392s create mode 100644 setup.py 392s ----------------------------- Captured stderr call ----------------------------- 392s hint: Using 'master' as the name for the initial branch. This default branch name 392s hint: is subject to change. To configure the initial branch name to use in all 392s hint: of your new repositories, which will suppress this warning, call: 392s hint: 392s hint: git config --global init.defaultBranch 392s hint: 392s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 392s hint: 'development'. The just-created branch can be renamed via this command: 392s hint: 392s hint: git branch -m 392s _________________________ test_first_invalid_generator _________________________ 392s 392s mocker = 392s capfd = <_pytest.capture.CaptureFixture object at 0x7537dfaeb140> 392s 392s def test_first_invalid_generator(mocker, capfd): 392s platform = get_platform() 392s default_generators = [CMakeGenerator("Invalid")] 392s default_generators.extend(platform.default_generators) 392s mocker.patch.object( 392s type(platform), "default_generators", new_callable=mocker.PropertyMock, return_value=default_generators 392s ) 392s 392s mocker.patch("skbuild.cmaker.get_platform", return_value=platform) 392s 392s with push_dir(), push_env(CMAKE_GENERATOR=None): 392s 392s @project_setup_py_test("hello-no-language", ["build"]) 392s def run_build(): 392s pass 392s 392s > run_build() 392s 392s capfd = <_pytest.capture.CaptureFixture object at 0x7537dfaeb140> 392s default_generators = [, , ] 392s mocker = 392s platform = 392s run_build = .run_build at 0x7537dfb62660> 392s 392s tests/test_broken_project.py:124: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s tests/__init__.py:255: in wrapped 392s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 392s disable_languages_test = False 392s fun = .run_build at 0x7537dfb625c0> 392s iargs = () 392s ikwargs = {} 392s ret = False 392s wrapped = .run_build at 0x7537dfb62660> 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-5/run_build0') 392s setup_args = ['build'], disable_languages_test = False 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = False 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-5/run_build0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s ----------------------------- Captured stdout call ----------------------------- 392s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-5/run_build0/.git/ 392s [master (root-commit) 46a81ec] Initial commit 392s 2 files changed, 16 insertions(+) 392s create mode 100644 CMakeLists.txt 392s create mode 100644 setup.py 392s ----------------------------- Captured stderr call ----------------------------- 392s hint: Using 'master' as the name for the initial branch. This default branch name 392s hint: is subject to change. To configure the initial branch name to use in all 392s hint: of your new repositories, which will suppress this warning, call: 392s hint: 392s hint: git config --global init.defaultBranch 392s hint: 392s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 392s hint: 'development'. The just-created branch can be renamed via this command: 392s hint: 392s hint: git branch -m 392s ____________________________ test_invalid_generator ____________________________ 392s 392s mocker = 392s capfd = <_pytest.capture.CaptureFixture object at 0x7537dfaebd70> 392s 392s def test_invalid_generator(mocker, capfd): 392s platform = get_platform() 392s mocker.patch.object( 392s type(platform), "default_generators", new_callable=mocker.PropertyMock, return_value=[CMakeGenerator("Invalid")] 392s ) 392s mocker.patch("skbuild.cmaker.get_platform", return_value=platform) 392s 392s with push_dir(), push_env(CMAKE_GENERATOR=None): 392s 392s @project_setup_py_test("hello-no-language", ["build"]) 392s def should_fail(): 392s pass 392s 392s with pytest.raises(SystemExit) as excinfo: 392s > should_fail() 392s 392s capfd = <_pytest.capture.CaptureFixture object at 0x7537dfaebd70> 392s excinfo = 392s mocker = 392s platform = 392s should_fail = .should_fail at 0x7537dfb62d40> 392s 392s tests/test_broken_project.py:144: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s tests/__init__.py:255: in wrapped 392s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 392s disable_languages_test = False 392s fun = .should_fail at 0x7537dfb62ca0> 392s iargs = () 392s ikwargs = {} 392s ret = False 392s wrapped = .should_fail at 0x7537dfb62d40> 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-6/should_fail0') 392s setup_args = ['build'], disable_languages_test = False 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = False 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-6/should_fail0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s ----------------------------- Captured stdout call ----------------------------- 392s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-6/should_fail0/.git/ 392s [master (root-commit) 46a81ec] Initial commit 392s 2 files changed, 16 insertions(+) 392s create mode 100644 CMakeLists.txt 392s create mode 100644 setup.py 392s ----------------------------- Captured stderr call ----------------------------- 392s hint: Using 'master' as the name for the initial branch. This default branch name 392s hint: is subject to change. To configure the initial branch name to use in all 392s hint: of your new repositories, which will suppress this warning, call: 392s hint: 392s hint: git config --global init.defaultBranch 392s hint: 392s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 392s hint: 'development'. The just-created branch can be renamed via this command: 392s hint: 392s hint: git branch -m 392s ___________________________ test_cmake_target_build ____________________________ 392s 392s iargs = () 392s ikwargs = {'capsys': <_pytest.capture.CaptureFixture object at 0x7537dfaea450>} 392s 392s @functools.wraps(fun) 392s def wrapped(*iargs, **ikwargs): 392s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 392s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 392s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 392s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 392s 392s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 392s 392s disable_languages_test = True 392s fun = 392s iargs = () 392s ikwargs = {'capsys': <_pytest.capture.CaptureFixture object at 0x7537dfaea450>} 392s ret = False 392s wrapped = 392s 392s tests/__init__.py:255: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-7/test_cmake_target_build0') 392s setup_args = ['build'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-7/test_cmake_target_build0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s ----------------------------- Captured stdout call ----------------------------- 392s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-7/test_cmake_target_build0/.git/ 392s [master (root-commit) c290a2b] Initial commit 392s 2 files changed, 26 insertions(+) 392s create mode 100644 CMakeLists.txt 392s create mode 100644 setup.py 392s ----------------------------- Captured stderr call ----------------------------- 392s hint: Using 'master' as the name for the initial branch. This default branch name 392s hint: is subject to change. To configure the initial branch name to use in all 392s hint: of your new repositories, which will suppress this warning, call: 392s hint: 392s hint: git config --global init.defaultBranch 392s hint: 392s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 392s hint: 'development'. The just-created branch can be renamed via this command: 392s hint: 392s hint: git branch -m 392s __________________________________ test_build __________________________________ 392s 392s iargs = () 392s ikwargs = {'capsys': <_pytest.capture.CaptureFixture object at 0x7537dfae9ac0>} 392s 392s @functools.wraps(fun) 392s def wrapped(*iargs, **ikwargs): 392s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 392s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 392s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 392s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 392s 392s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 392s 392s disable_languages_test = True 392s fun = 392s iargs = () 392s ikwargs = {'capsys': <_pytest.capture.CaptureFixture object at 0x7537dfae9ac0>} 392s ret = False 392s wrapped = 392s 392s tests/__init__.py:255: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-8/test_build0') 392s setup_args = ['build'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-8/test_build0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s ----------------------------- Captured stdout call ----------------------------- 392s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-8/test_build0/.git/ 392s [master (root-commit) 8775fa8] Initial commit 392s 5 files changed, 94 insertions(+) 392s create mode 100644 hello/CMakeLists.txt 392s create mode 100644 hello/__init__.py 392s create mode 100644 hello/__main__.py 392s create mode 100644 hello/_hello.cxx 392s create mode 100644 setup.py 392s ----------------------------- Captured stderr call ----------------------------- 392s hint: Using 'master' as the name for the initial branch. This default branch name 392s hint: is subject to change. To configure the initial branch name to use in all 392s hint: of your new repositories, which will suppress this warning, call: 392s hint: 392s hint: git config --global init.defaultBranch 392s hint: 392s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 392s hint: 'development'. The just-created branch can be renamed via this command: 392s hint: 392s hint: git branch -m 392s _____________________ test_cmake_source_dir[invalid-True] ______________________ 392s 392s cmake_source_dir = 'invalid', expected_failed = True 392s 392s @pytest.mark.parametrize( 392s ("cmake_source_dir", "expected_failed"), 392s [ 392s ("invalid", True), 392s ("", False), 392s (".", False), 392s ], 392s ) 392s def test_cmake_source_dir(cmake_source_dir, expected_failed): 392s tmp_dir = _tmpdir("test_cmake_source_dir") 392s 392s tmp_dir.join("setup.py").write( 392s textwrap.dedent( 392s f""" 392s from skbuild import setup 392s setup( 392s name="test_cmake_source_dir", 392s version="1.2.3", 392s description="a minimal example package", 392s author='The scikit-build team', 392s license="MIT", 392s cmake_source_dir="{cmake_source_dir}" 392s ) 392s """ 392s ) 392s ) 392s 392s failed = False 392s message = "" 392s try: 392s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 392s 392s cmake_source_dir = 'invalid' 392s expected_failed = True 392s failed = False 392s message = '' 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-9/test_cmake_source_dir0') 392s 392s tests/test_cmakelists_not_in_top_level_dir.py:60: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-9/test_cmake_source_dir0') 392s setup_args = ['build'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-9/test_cmake_source_dir0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s ________________________ test_cmake_source_dir[-False] _________________________ 392s 392s cmake_source_dir = '', expected_failed = False 392s 392s @pytest.mark.parametrize( 392s ("cmake_source_dir", "expected_failed"), 392s [ 392s ("invalid", True), 392s ("", False), 392s (".", False), 392s ], 392s ) 392s def test_cmake_source_dir(cmake_source_dir, expected_failed): 392s tmp_dir = _tmpdir("test_cmake_source_dir") 392s 392s tmp_dir.join("setup.py").write( 392s textwrap.dedent( 392s f""" 392s from skbuild import setup 392s setup( 392s name="test_cmake_source_dir", 392s version="1.2.3", 392s description="a minimal example package", 392s author='The scikit-build team', 392s license="MIT", 392s cmake_source_dir="{cmake_source_dir}" 392s ) 392s """ 392s ) 392s ) 392s 392s failed = False 392s message = "" 392s try: 392s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 392s 392s cmake_source_dir = '' 392s expected_failed = False 392s failed = False 392s message = '' 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-10/test_cmake_source_dir0') 392s 392s tests/test_cmakelists_not_in_top_level_dir.py:60: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-10/test_cmake_source_dir0') 392s setup_args = ['build'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-10/test_cmake_source_dir0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s ________________________ test_cmake_source_dir[.-False] ________________________ 392s 392s cmake_source_dir = '.', expected_failed = False 392s 392s @pytest.mark.parametrize( 392s ("cmake_source_dir", "expected_failed"), 392s [ 392s ("invalid", True), 392s ("", False), 392s (".", False), 392s ], 392s ) 392s def test_cmake_source_dir(cmake_source_dir, expected_failed): 392s tmp_dir = _tmpdir("test_cmake_source_dir") 392s 392s tmp_dir.join("setup.py").write( 392s textwrap.dedent( 392s f""" 392s from skbuild import setup 392s setup( 392s name="test_cmake_source_dir", 392s version="1.2.3", 392s description="a minimal example package", 392s author='The scikit-build team', 392s license="MIT", 392s cmake_source_dir="{cmake_source_dir}" 392s ) 392s """ 392s ) 392s ) 392s 392s failed = False 392s message = "" 392s try: 392s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 392s 392s cmake_source_dir = '.' 392s expected_failed = False 392s failed = False 392s message = '' 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-11/test_cmake_source_dir0') 392s 392s tests/test_cmakelists_not_in_top_level_dir.py:60: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-11/test_cmake_source_dir0') 392s setup_args = ['build'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-11/test_cmake_source_dir0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s __________________________________ test_help ___________________________________ 392s 392s iargs = () 392s ikwargs = {'capsys': <_pytest.capture.CaptureFixture object at 0x7537dfbc05f0>} 392s 392s @functools.wraps(fun) 392s def wrapped(*iargs, **ikwargs): 392s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 392s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 392s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 392s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 392s 392s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 392s 392s disable_languages_test = True 392s fun = 392s iargs = () 392s ikwargs = {'capsys': <_pytest.capture.CaptureFixture object at 0x7537dfbc05f0>} 392s ret = False 392s wrapped = 392s 392s tests/__init__.py:255: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-22/test_help0') 392s setup_args = ['--help'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-22/test_help0') 392s setup_args = ['--help'] 392s 392s tests/__init__.py:218: AttributeError 392s ----------------------------- Captured stdout call ----------------------------- 392s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-22/test_help0/.git/ 392s [master (root-commit) daa854f] Initial commit 392s 2 files changed, 16 insertions(+) 392s create mode 100644 CMakeLists.txt 392s create mode 100644 setup.py 392s ----------------------------- Captured stderr call ----------------------------- 392s hint: Using 'master' as the name for the initial branch. This default branch name 392s hint: is subject to change. To configure the initial branch name to use in all 392s hint: of your new repositories, which will suppress this warning, call: 392s hint: 392s hint: git config --global init.defaultBranch 392s hint: 392s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 392s hint: 'development'. The just-created branch can be renamed via this command: 392s hint: 392s hint: git branch -m 392s ____________________________ test_metadata_display _____________________________ 392s 392s iargs = () 392s ikwargs = {'capsys': <_pytest.capture.CaptureFixture object at 0x7537dfc6a330>} 392s 392s @functools.wraps(fun) 392s def wrapped(*iargs, **ikwargs): 392s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 392s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 392s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 392s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 392s 392s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 392s 392s disable_languages_test = True 392s fun = 392s iargs = () 392s ikwargs = {'capsys': <_pytest.capture.CaptureFixture object at 0x7537dfc6a330>} 392s ret = False 392s wrapped = 392s 392s tests/__init__.py:255: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-23/test_metadata_display0') 392s setup_args = ['--author', '--name'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-23/test_metadata_display0') 392s setup_args = ['--author', '--name'] 392s 392s tests/__init__.py:218: AttributeError 392s ----------------------------- Captured stdout call ----------------------------- 392s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-23/test_metadata_display0/.git/ 392s [master (root-commit) 1b1dc43] Initial commit 392s 2 files changed, 16 insertions(+) 392s create mode 100644 CMakeLists.txt 392s create mode 100644 setup.py 392s ----------------------------- Captured stderr call ----------------------------- 392s hint: Using 'master' as the name for the initial branch. This default branch name 392s hint: is subject to change. To configure the initial branch name to use in all 392s hint: of your new repositories, which will suppress this warning, call: 392s hint: 392s hint: git config --global init.defaultBranch 392s hint: 392s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 392s hint: 'development'. The just-created branch can be renamed via this command: 392s hint: 392s hint: git branch -m 392s _______________________________ test_no_command ________________________________ 392s 392s def test_no_command(): 392s with push_dir(): 392s 392s @project_setup_py_test("hello-no-language", [], disable_languages_test=True) 392s def run(): 392s pass 392s 392s failed = False 392s try: 392s > run() 392s 392s failed = False 392s run = .run at 0x7537dfb62e80> 392s 392s tests/test_command_line.py:62: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s tests/__init__.py:255: in wrapped 392s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 392s disable_languages_test = True 392s fun = .run at 0x7537dfb622a0> 392s iargs = () 392s ikwargs = {} 392s ret = False 392s wrapped = .run at 0x7537dfb62e80> 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-24/run0'), setup_args = [] 392s disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-24/run0') 392s setup_args = [] 392s 392s tests/__init__.py:218: AttributeError 392s ----------------------------- Captured stdout call ----------------------------- 392s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-24/run0/.git/ 392s [master (root-commit) 1b1dc43] Initial commit 392s 2 files changed, 16 insertions(+) 392s create mode 100644 CMakeLists.txt 392s create mode 100644 setup.py 392s ----------------------------- Captured stderr call ----------------------------- 392s hint: Using 'master' as the name for the initial branch. This default branch name 392s hint: is subject to change. To configure the initial branch name to use in all 392s hint: of your new repositories, which will suppress this warning, call: 392s hint: 392s hint: git config --global init.defaultBranch 392s hint: 392s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 392s hint: 'development'. The just-created branch can be renamed via this command: 392s hint: 392s hint: git branch -m 392s _____________________________ test_invalid_command _____________________________ 392s 392s def test_invalid_command(): 392s with push_dir(): 392s 392s @project_setup_py_test("hello-no-language", ["unknown"], disable_languages_test=True) 392s def run(): 392s pass 392s 392s failed = False 392s try: 392s > run() 392s 392s failed = False 392s run = .run at 0x7537dfb60d60> 392s 392s tests/test_command_line.py:79: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s tests/__init__.py:255: in wrapped 392s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 392s disable_languages_test = True 392s fun = .run at 0x7537dfb61120> 392s iargs = () 392s ikwargs = {} 392s ret = False 392s wrapped = .run at 0x7537dfb60d60> 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-25/run0') 392s setup_args = ['unknown'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-25/run0') 392s setup_args = ['unknown'] 392s 392s tests/__init__.py:218: AttributeError 392s ----------------------------- Captured stdout call ----------------------------- 392s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-25/run0/.git/ 392s [master (root-commit) 1b1dc43] Initial commit 392s 2 files changed, 16 insertions(+) 392s create mode 100644 CMakeLists.txt 392s create mode 100644 setup.py 392s ----------------------------- Captured stderr call ----------------------------- 392s hint: Using 'master' as the name for the initial branch. This default branch name 392s hint: is subject to change. To configure the initial branch name to use in all 392s hint: of your new repositories, which will suppress this warning, call: 392s hint: 392s hint: git config --global init.defaultBranch 392s hint: 392s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 392s hint: 'development'. The just-created branch can be renamed via this command: 392s hint: 392s hint: git branch -m 392s ___________________________ test_too_many_separators ___________________________ 392s 392s def test_too_many_separators(): 392s with push_dir(): 392s 392s @project_setup_py_test("hello-no-language", ["--"] * 3, disable_languages_test=True) 392s def run(): 392s pass 392s 392s failed = False 392s try: 392s > run() 392s 392s failed = False 392s run = .run at 0x7537dfb639c0> 392s 392s tests/test_command_line.py:96: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s tests/__init__.py:255: in wrapped 392s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 392s disable_languages_test = True 392s fun = .run at 0x7537dfb636a0> 392s iargs = () 392s ikwargs = {} 392s ret = False 392s wrapped = .run at 0x7537dfb639c0> 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-26/run0') 392s setup_args = ['--', '--', '--'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-26/run0') 392s setup_args = ['--', '--', '--'] 392s 392s tests/__init__.py:218: AttributeError 392s ----------------------------- Captured stdout call ----------------------------- 392s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-26/run0/.git/ 392s [master (root-commit) 1b1dc43] Initial commit 392s 2 files changed, 16 insertions(+) 392s create mode 100644 CMakeLists.txt 392s create mode 100644 setup.py 392s ----------------------------- Captured stderr call ----------------------------- 392s hint: Using 'master' as the name for the initial branch. This default branch name 392s hint: is subject to change. To configure the initial branch name to use in all 392s hint: of your new repositories, which will suppress this warning, call: 392s hint: 392s hint: git config --global init.defaultBranch 392s hint: 392s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 392s hint: 'development'. The just-created branch can be renamed via this command: 392s hint: 392s hint: git branch -m 392s __________________ test_cmake_initial_cache_as_global_option ___________________ 392s 392s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-21/test_cmake_initial_cache_as_gl0') 392s 392s def test_cmake_initial_cache_as_global_option(tmpdir): 392s project = "hello-no-language" 392s prepare_project(project, tmpdir) 392s initialize_git_repo_and_commit(tmpdir, verbose=True) 392s 392s initial_cache = tmpdir.join("initial-cache.txt") 392s initial_cache.write("""set(MY_CMAKE_VARIABLE "1" CACHE BOOL "My cache variable")""") 392s 392s try: 392s > with execute_setup_py(tmpdir, [f"-C{initial_cache}", "build"], disable_languages_test=True): 392s 392s initial_cache = local('/tmp/pytest-of-ubuntu/pytest-21/test_cmake_initial_cache_as_gl0/initial-cache.txt') 392s project = 'hello-no-language' 392s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-21/test_cmake_initial_cache_as_gl0') 392s 392s tests/test_command_line.py:112: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-21/test_cmake_initial_cache_as_gl0') 392s setup_args = ['-C/tmp/pytest-of-ubuntu/pytest-21/test_cmake_initial_cache_as_gl0/initial-cache.txt', 'build'] 392s disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-21/test_cmake_initial_cache_as_gl0') 392s setup_args = ['-C/tmp/pytest-of-ubuntu/pytest-21/test_cmake_initial_cache_as_gl0/initial-cache.txt', 'build'] 392s 392s tests/__init__.py:218: AttributeError 392s ----------------------------- Captured stdout call ----------------------------- 392s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-21/test_cmake_initial_cache_as_gl0/.git/ 392s [master (root-commit) 1b1dc43] Initial commit 392s 2 files changed, 16 insertions(+) 392s create mode 100644 CMakeLists.txt 392s create mode 100644 setup.py 392s ----------------------------- Captured stderr call ----------------------------- 392s hint: Using 'master' as the name for the initial branch. This default branch name 392s hint: is subject to change. To configure the initial branch name to use in all 392s hint: of your new repositories, which will suppress this warning, call: 392s hint: 392s hint: git config --global init.defaultBranch 392s hint: 392s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 392s hint: 'development'. The just-created branch can be renamed via this command: 392s hint: 392s hint: git branch -m 392s __________________________ test_cmake_executable_arg ___________________________ 392s 392s def test_cmake_executable_arg(): 392s cmake_executable = "/path/to/invalid/cmake" 392s 392s @project_setup_py_test( 392s "hello-no-language", ["--cmake-executable", cmake_executable, "build"], disable_languages_test=True 392s ) 392s def should_fail(): 392s pass 392s 392s failed = False 392s message = "" 392s try: 392s > should_fail() 392s 392s cmake_executable = '/path/to/invalid/cmake' 392s failed = False 392s message = '' 392s should_fail = .should_fail at 0x7537dfb639c0> 392s 392s tests/test_command_line.py:134: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s tests/__init__.py:255: in wrapped 392s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 392s disable_languages_test = True 392s fun = .should_fail at 0x7537dfb61940> 392s iargs = () 392s ikwargs = {} 392s ret = False 392s wrapped = .should_fail at 0x7537dfb639c0> 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-27/should_fail0') 392s setup_args = ['--cmake-executable', '/path/to/invalid/cmake', 'build'] 392s disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-27/should_fail0') 392s setup_args = ['--cmake-executable', '/path/to/invalid/cmake', 'build'] 392s 392s tests/__init__.py:218: AttributeError 392s ----------------------------- Captured stdout call ----------------------------- 392s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-27/should_fail0/.git/ 392s [master (root-commit) 1b1dc43] Initial commit 392s 2 files changed, 16 insertions(+) 392s create mode 100644 CMakeLists.txt 392s create mode 100644 setup.py 392s ----------------------------- Captured stderr call ----------------------------- 392s hint: Using 'master' as the name for the initial branch. This default branch name 392s hint: is subject to change. To configure the initial branch name to use in all 392s hint: of your new repositories, which will suppress this warning, call: 392s hint: 392s hint: git config --global init.defaultBranch 392s hint: 392s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 392s hint: 'development'. The just-created branch can be renamed via this command: 392s hint: 392s hint: git branch -m 392s ________________________ test_hide_listing[True-sdist] _________________________ 392s 392s action = 'sdist', hide_listing = True 392s capfd = <_pytest.capture.CaptureFixture object at 0x7537dfb25e50> 392s caplog = <_pytest.logging.LogCaptureFixture object at 0x7537dfb24a40> 392s 392s @pytest.mark.parametrize("action", ["sdist", "bdist_wheel"]) 392s @pytest.mark.parametrize("hide_listing", [True, False]) 392s def test_hide_listing(action, hide_listing, capfd, caplog): 392s cmd = [action] 392s if hide_listing: 392s cmd.insert(0, "--hide-listing") 392s 392s @project_setup_py_test("test-hide-listing", cmd, verbose_git=False, disable_languages_test=True) 392s def run(): 392s pass 392s 392s > run() 392s 392s action = 'sdist' 392s capfd = <_pytest.capture.CaptureFixture object at 0x7537dfb25e50> 392s caplog = <_pytest.logging.LogCaptureFixture object at 0x7537dfb24a40> 392s cmd = ['--hide-listing', 'sdist'] 392s hide_listing = True 392s run = .run at 0x7537dfb611c0> 392s 392s tests/test_command_line.py:154: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s tests/__init__.py:255: in wrapped 392s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 392s disable_languages_test = True 392s fun = .run at 0x7537dfb60f40> 392s iargs = () 392s ikwargs = {} 392s ret = False 392s wrapped = .run at 0x7537dfb611c0> 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-28/run0') 392s setup_args = ['--hide-listing', 'sdist'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-28/run0') 392s setup_args = ['--hide-listing', 'sdist'] 392s 392s tests/__init__.py:218: AttributeError 392s ----------------------------- Captured stderr call ----------------------------- 392s hint: Using 'master' as the name for the initial branch. This default branch name 392s hint: is subject to change. To configure the initial branch name to use in all 392s hint: of your new repositories, which will suppress this warning, call: 392s hint: 392s hint: git config --global init.defaultBranch 392s hint: 392s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 392s hint: 'development'. The just-created branch can be renamed via this command: 392s hint: 392s hint: git branch -m 392s _____________________ test_hide_listing[True-bdist_wheel] ______________________ 392s 392s action = 'bdist_wheel', hide_listing = True 392s capfd = <_pytest.capture.CaptureFixture object at 0x7537dfbe63c0> 392s caplog = <_pytest.logging.LogCaptureFixture object at 0x7537dfbe4950> 392s 392s @pytest.mark.parametrize("action", ["sdist", "bdist_wheel"]) 392s @pytest.mark.parametrize("hide_listing", [True, False]) 392s def test_hide_listing(action, hide_listing, capfd, caplog): 392s cmd = [action] 392s if hide_listing: 392s cmd.insert(0, "--hide-listing") 392s 392s @project_setup_py_test("test-hide-listing", cmd, verbose_git=False, disable_languages_test=True) 392s def run(): 392s pass 392s 392s > run() 392s 392s action = 'bdist_wheel' 392s capfd = <_pytest.capture.CaptureFixture object at 0x7537dfbe63c0> 392s caplog = <_pytest.logging.LogCaptureFixture object at 0x7537dfbe4950> 392s cmd = ['--hide-listing', 'bdist_wheel'] 392s hide_listing = True 392s run = .run at 0x7537dfb60180> 392s 392s tests/test_command_line.py:154: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s tests/__init__.py:255: in wrapped 392s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 392s disable_languages_test = True 392s fun = .run at 0x7537dfb62200> 392s iargs = () 392s ikwargs = {} 392s ret = False 392s wrapped = .run at 0x7537dfb60180> 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-29/run0') 392s setup_args = ['--hide-listing', 'bdist_wheel'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-29/run0') 392s setup_args = ['--hide-listing', 'bdist_wheel'] 392s 392s tests/__init__.py:218: AttributeError 392s ----------------------------- Captured stderr call ----------------------------- 392s hint: Using 'master' as the name for the initial branch. This default branch name 392s hint: is subject to change. To configure the initial branch name to use in all 392s hint: of your new repositories, which will suppress this warning, call: 392s hint: 392s hint: git config --global init.defaultBranch 392s hint: 392s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 392s hint: 'development'. The just-created branch can be renamed via this command: 392s hint: 392s hint: git branch -m 392s ________________________ test_hide_listing[False-sdist] ________________________ 392s 392s action = 'sdist', hide_listing = False 392s capfd = <_pytest.capture.CaptureFixture object at 0x7537dfda29c0> 392s caplog = <_pytest.logging.LogCaptureFixture object at 0x7537dfda3230> 392s 392s @pytest.mark.parametrize("action", ["sdist", "bdist_wheel"]) 392s @pytest.mark.parametrize("hide_listing", [True, False]) 392s def test_hide_listing(action, hide_listing, capfd, caplog): 392s cmd = [action] 392s if hide_listing: 392s cmd.insert(0, "--hide-listing") 392s 392s @project_setup_py_test("test-hide-listing", cmd, verbose_git=False, disable_languages_test=True) 392s def run(): 392s pass 392s 392s > run() 392s 392s action = 'sdist' 392s capfd = <_pytest.capture.CaptureFixture object at 0x7537dfda29c0> 392s caplog = <_pytest.logging.LogCaptureFixture object at 0x7537dfda3230> 392s cmd = ['sdist'] 392s hide_listing = False 392s run = .run at 0x7537dfb94360> 392s 392s tests/test_command_line.py:154: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s tests/__init__.py:255: in wrapped 392s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 392s disable_languages_test = True 392s fun = .run at 0x7537dfb94400> 392s iargs = () 392s ikwargs = {} 392s ret = False 392s wrapped = .run at 0x7537dfb94360> 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-30/run0') 392s setup_args = ['sdist'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-30/run0') 392s setup_args = ['sdist'] 392s 392s tests/__init__.py:218: AttributeError 392s ----------------------------- Captured stderr call ----------------------------- 392s hint: Using 'master' as the name for the initial branch. This default branch name 392s hint: is subject to change. To configure the initial branch name to use in all 392s hint: of your new repositories, which will suppress this warning, call: 392s hint: 392s hint: git config --global init.defaultBranch 392s hint: 392s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 392s hint: 'development'. The just-created branch can be renamed via this command: 392s hint: 392s hint: git branch -m 392s _____________________ test_hide_listing[False-bdist_wheel] _____________________ 392s 392s action = 'bdist_wheel', hide_listing = False 392s capfd = <_pytest.capture.CaptureFixture object at 0x7537dfbe7110> 392s caplog = <_pytest.logging.LogCaptureFixture object at 0x7537dfb26b10> 392s 392s @pytest.mark.parametrize("action", ["sdist", "bdist_wheel"]) 392s @pytest.mark.parametrize("hide_listing", [True, False]) 392s def test_hide_listing(action, hide_listing, capfd, caplog): 392s cmd = [action] 392s if hide_listing: 392s cmd.insert(0, "--hide-listing") 392s 392s @project_setup_py_test("test-hide-listing", cmd, verbose_git=False, disable_languages_test=True) 392s def run(): 392s pass 392s 392s > run() 392s 392s action = 'bdist_wheel' 392s capfd = <_pytest.capture.CaptureFixture object at 0x7537dfbe7110> 392s caplog = <_pytest.logging.LogCaptureFixture object at 0x7537dfb26b10> 392s cmd = ['bdist_wheel'] 392s hide_listing = False 392s run = .run at 0x7537dfb611c0> 392s 392s tests/test_command_line.py:154: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s tests/__init__.py:255: in wrapped 392s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 392s disable_languages_test = True 392s fun = .run at 0x7537dfb623e0> 392s iargs = () 392s ikwargs = {} 392s ret = False 392s wrapped = .run at 0x7537dfb611c0> 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-31/run0') 392s setup_args = ['bdist_wheel'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-31/run0') 392s setup_args = ['bdist_wheel'] 392s 392s tests/__init__.py:218: AttributeError 392s ----------------------------- Captured stderr call ----------------------------- 392s hint: Using 'master' as the name for the initial branch. This default branch name 392s hint: is subject to change. To configure the initial branch name to use in all 392s hint: of your new repositories, which will suppress this warning, call: 392s hint: 392s hint: git config --global init.defaultBranch 392s hint: 392s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 392s hint: 'development'. The just-created branch can be renamed via this command: 392s hint: 392s hint: git branch -m 392s ______________________________ test_run_cmake_arg ______________________________ 392s 392s iargs = () 392s ikwargs = {'capfd': <_pytest.capture.CaptureFixture object at 0x7537dfb25250>} 392s 392s @functools.wraps(fun) 392s def wrapped(*iargs, **ikwargs): 392s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 392s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 392s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 392s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 392s 392s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 392s 392s disable_languages_test = True 392s fun = 392s iargs = () 392s ikwargs = {'capfd': <_pytest.capture.CaptureFixture object at 0x7537dfb25250>} 392s ret = False 392s wrapped = 392s 392s tests/__init__.py:255: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-32/test_run_cmake_arg0') 392s setup_args = ['--force-cmake', '--help'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-32/test_run_cmake_arg0') 392s setup_args = ['--force-cmake', '--help'] 392s 392s tests/__init__.py:218: AttributeError 392s ----------------------------- Captured stdout call ----------------------------- 392s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-32/test_run_cmake_arg0/.git/ 392s [master (root-commit) 1b1dc43] Initial commit 392s 2 files changed, 16 insertions(+) 392s create mode 100644 CMakeLists.txt 392s create mode 100644 setup.py 392s ----------------------------- Captured stderr call ----------------------------- 392s hint: Using 'master' as the name for the initial branch. This default branch name 392s hint: is subject to change. To configure the initial branch name to use in all 392s hint: of your new repositories, which will suppress this warning, call: 392s hint: 392s hint: git config --global init.defaultBranch 392s hint: 392s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 392s hint: 'development'. The just-created branch can be renamed via this command: 392s hint: 392s hint: git branch -m 392s _____________________________ test_skip_cmake_arg ______________________________ 392s 392s iargs = () 392s ikwargs = {'capfd': <_pytest.capture.CaptureFixture object at 0x7537dfd77ec0>} 392s 392s @functools.wraps(fun) 392s def wrapped(*iargs, **ikwargs): 392s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 392s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 392s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 392s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 392s 392s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 392s 392s disable_languages_test = True 392s fun = 392s iargs = () 392s ikwargs = {'capfd': <_pytest.capture.CaptureFixture object at 0x7537dfd77ec0>} 392s ret = False 392s wrapped = 392s 392s tests/__init__.py:255: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-33/test_skip_cmake_arg0') 392s setup_args = ['--skip-cmake', 'build'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-33/test_skip_cmake_arg0') 392s setup_args = ['--skip-cmake', 'build'] 392s 392s tests/__init__.py:218: AttributeError 392s ----------------------------- Captured stdout call ----------------------------- 392s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-33/test_skip_cmake_arg0/.git/ 392s [master (root-commit) 1b1dc43] Initial commit 392s 2 files changed, 16 insertions(+) 392s create mode 100644 CMakeLists.txt 392s create mode 100644 setup.py 392s ----------------------------- Captured stderr call ----------------------------- 392s hint: Using 'master' as the name for the initial branch. This default branch name 392s hint: is subject to change. To configure the initial branch name to use in all 392s hint: of your new repositories, which will suppress this warning, call: 392s hint: 392s hint: git config --global init.defaultBranch 392s hint: 392s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 392s hint: 'development'. The just-created branch can be renamed via this command: 392s hint: 392s hint: git branch -m 392s ___________________________ test_hello_cython_builds ___________________________ 392s 392s iargs = (), ikwargs = {} 392s 392s @functools.wraps(fun) 392s def wrapped(*iargs, **ikwargs): 392s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 392s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 392s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 392s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 392s 392s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 392s 392s disable_languages_test = False 392s fun = 392s iargs = () 392s ikwargs = {} 392s ret = False 392s wrapped = 392s 392s tests/__init__.py:255: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-34/test_hello_cython_builds0') 392s setup_args = ['build'], disable_languages_test = False 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = False 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-34/test_hello_cython_builds0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s ----------------------------- Captured stdout call ----------------------------- 392s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-34/test_hello_cython_builds0/.git/ 392s [master (root-commit) e6d3515] Initial commit 392s 6 files changed, 40 insertions(+) 392s create mode 100644 CMakeLists.txt 392s create mode 100644 hello/CMakeLists.txt 392s create mode 100644 hello/__init__.py 392s create mode 100644 hello/__main__.py 392s create mode 100644 hello/_hello.pyx 392s create mode 100644 setup.py 392s ----------------------------- Captured stderr call ----------------------------- 392s hint: Using 'master' as the name for the initial branch. This default branch name 392s hint: is subject to change. To configure the initial branch name to use in all 392s hint: of your new repositories, which will suppress this warning, call: 392s hint: 392s hint: git config --global init.defaultBranch 392s hint: 392s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 392s hint: 'development'. The just-created branch can be renamed via this command: 392s hint: 392s hint: git branch -m 392s ___________________________ test_bdist_wheel_command ___________________________ 392s 392s def test_bdist_wheel_command(): 392s project = "test-filter-manifest" 392s 392s expected_content = [ 392s "hello/__init__.py", 392s "hello/swig_mwe.py", 392s "hello/_swig_mwe.pyd", 392s "hello-1.2.3.data/data/bin/hello", 392s ] 392s 392s expected_distribution_name = "hello-1.2.3" 392s 392s tmp_dir = _tmpdir("test_bdist_wheel_command") 392s prepare_project(project, tmp_dir) 392s initialize_git_repo_and_commit(tmp_dir, verbose=True) 392s 392s relative_setup_path = "wrapping/python/" 392s 392s > with execute_setup_py(tmp_dir.join(relative_setup_path), ["bdist_wheel"]): 392s 392s expected_content = ['hello/__init__.py', 'hello/swig_mwe.py', 'hello/_swig_mwe.pyd', 'hello-1.2.3.data/data/bin/hello'] 392s expected_distribution_name = 'hello-1.2.3' 392s project = 'test-filter-manifest' 392s relative_setup_path = 'wrapping/python/' 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-35/test_bdist_wheel_command0') 392s 392s tests/test_filter_manifest.py:27: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-35/test_bdist_wheel_command0/wrapping/python') 392s setup_args = ['bdist_wheel'], disable_languages_test = False 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = False 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-35/test_bdist_wheel_command0/wrapping/python') 392s setup_args = ['bdist_wheel'] 392s 392s tests/__init__.py:218: AttributeError 392s ----------------------------- Captured stdout call ----------------------------- 392s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-35/test_bdist_wheel_command0/.git/ 392s [master (root-commit) 6f2d4c0] Initial commit 392s 4 files changed, 59 insertions(+) 392s create mode 100644 CMakeLists.txt 392s create mode 100644 wrapping/python/CMakeLists.txt 392s create mode 100644 wrapping/python/hello/__init__.py 392s create mode 100644 wrapping/python/setup.py 392s ----------------------------- Captured stderr call ----------------------------- 392s hint: Using 'master' as the name for the initial branch. This default branch name 392s hint: is subject to change. To configure the initial branch name to use in all 392s hint: of your new repositories, which will suppress this warning, call: 392s hint: 392s hint: git config --global init.defaultBranch 392s hint: 392s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 392s hint: 'development'. The just-created branch can be renamed via this command: 392s hint: 392s hint: git branch -m 392s ______________________________ test_hello_builds _______________________________ 392s 392s def test_hello_builds(): 392s with push_dir(): 392s 392s @project_setup_py_test("hello-cpp", ["build"], ret=True) 392s def run(): 392s pass 392s 392s # Check that a project can be build twice in a row 392s # See issue scikit-build#120 392s > tmp_dir = run()[0] 392s 392s run = .run at 0x7537dfb61a80> 392s 392s tests/test_hello_cpp.py:30: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s tests/__init__.py:255: in wrapped 392s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 392s disable_languages_test = False 392s fun = .run at 0x7537dfb636a0> 392s iargs = () 392s ikwargs = {} 392s ret = True 392s wrapped = .run at 0x7537dfb61a80> 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-36/run0') 392s setup_args = ['build'], disable_languages_test = False 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = False 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-36/run0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s ----------------------------- Captured stdout call ----------------------------- 392s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-36/run0/.git/ 392s [master (root-commit) c250bdd] Initial commit 392s 11 files changed, 115 insertions(+) 392s create mode 100644 CMakeLists.txt 392s create mode 100644 bonjour/__init__.py 392s create mode 100644 bonjour/data/ciel.txt 392s create mode 100644 bonjour/data/soleil.txt 392s create mode 100644 bonjour/data/terre.txt 392s create mode 100644 bonjourModule.py 392s create mode 100644 hello/CMakeLists.txt 392s create mode 100644 hello/__init__.py 392s create mode 100644 hello/__main__.py 392s create mode 100644 hello/_hello.cxx 392s create mode 100644 setup.py 392s ----------------------------- Captured stderr call ----------------------------- 392s hint: Using 'master' as the name for the initial branch. This default branch name 392s hint: is subject to change. To configure the initial branch name to use in all 392s hint: of your new repositories, which will suppress this warning, call: 392s hint: 392s hint: git config --global init.defaultBranch 392s hint: 392s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 392s hint: 'development'. The just-created branch can be renamed via this command: 392s hint: 392s hint: git branch -m 392s _______________________________ test_hello_wheel _______________________________ 392s 392s def test_hello_wheel(): 392s expected_content = [ 392s f"hello/_hello{get_ext_suffix()}", 392s "hello/__init__.py", 392s "hello/__main__.py", 392s "hello/world.py", 392s "helloModule.py", 392s "bonjour/__init__.py", 392s "bonjour/data/ciel.txt", 392s "bonjour/data/soleil.txt", 392s "bonjour/data/terre.txt", 392s "bonjourModule.py", 392s ] 392s 392s expected_distribution_name = "hello-1.2.3" 392s 392s @project_setup_py_test("hello-cpp", ["bdist_wheel"], ret=True) 392s def build_wheel(): 392s whls = glob.glob("dist/*.whl") 392s assert len(whls) == 1 392s check_wheel_content(whls[0], expected_distribution_name, expected_content) 392s os.remove(whls[0]) 392s assert not os.path.exists(whls[0]) 392s 392s assert os.path.exists(os.path.join(CMAKE_BUILD_DIR(), "CMakeCache.txt")) 392s os.remove(os.path.join(CMAKE_BUILD_DIR(), "CMakeCache.txt")) 392s 392s > tmp_dir = build_wheel()[0] 392s 392s build_wheel = .build_wheel at 0x7537dfb95300> 392s expected_content = ['hello/_hello.cpython-312-x86_64-linux-gnu.so', 'hello/__init__.py', 'hello/__main__.py', 'hello/world.py', 'helloModule.py', 'bonjour/__init__.py', ...] 392s expected_distribution_name = 'hello-1.2.3' 392s 392s tests/test_hello_cpp.py:93: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s tests/__init__.py:255: in wrapped 392s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 392s disable_languages_test = False 392s fun = .build_wheel at 0x7537dfb95760> 392s iargs = () 392s ikwargs = {} 392s ret = True 392s wrapped = .build_wheel at 0x7537dfb95300> 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-37/build_wheel0') 392s setup_args = ['bdist_wheel'], disable_languages_test = False 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = False 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-37/build_wheel0') 392s setup_args = ['bdist_wheel'] 392s 392s tests/__init__.py:218: AttributeError 392s ----------------------------- Captured stdout call ----------------------------- 392s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-37/build_wheel0/.git/ 392s [master (root-commit) c250bdd] Initial commit 392s 11 files changed, 115 insertions(+) 392s create mode 100644 CMakeLists.txt 392s create mode 100644 bonjour/__init__.py 392s create mode 100644 bonjour/data/ciel.txt 392s create mode 100644 bonjour/data/soleil.txt 392s create mode 100644 bonjour/data/terre.txt 392s create mode 100644 bonjourModule.py 392s create mode 100644 hello/CMakeLists.txt 392s create mode 100644 hello/__init__.py 392s create mode 100644 hello/__main__.py 392s create mode 100644 hello/_hello.cxx 392s create mode 100644 setup.py 392s ----------------------------- Captured stderr call ----------------------------- 392s hint: Using 'master' as the name for the initial branch. This default branch name 392s hint: is subject to change. To configure the initial branch name to use in all 392s hint: of your new repositories, which will suppress this warning, call: 392s hint: 392s hint: git config --global init.defaultBranch 392s hint: 392s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 392s hint: 'development'. The just-created branch can be renamed via this command: 392s hint: 392s hint: git branch -m 392s ________________________ test_hello_clean[with-dry-run] ________________________ 392s 392s dry_run = True 392s capfd = <_pytest.capture.CaptureFixture object at 0x7537dfaead50> 392s 392s @pytest.mark.parametrize("dry_run", ["with-dry-run", "without-dry-run"]) 392s def test_hello_clean(dry_run, capfd): 392s with push_dir(): 392s dry_run = dry_run == "with-dry-run" 392s 392s @project_setup_py_test("hello-cpp", ["build"], ret=True) 392s def run_build(): 392s pass 392s 392s > tmp_dir = run_build()[0] 392s 392s capfd = <_pytest.capture.CaptureFixture object at 0x7537dfaead50> 392s dry_run = True 392s run_build = .run_build at 0x7537dfb95d00> 392s 392s tests/test_hello_cpp.py:114: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s tests/__init__.py:255: in wrapped 392s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 392s disable_languages_test = False 392s fun = .run_build at 0x7537dfb94040> 392s iargs = () 392s ikwargs = {} 392s ret = True 392s wrapped = .run_build at 0x7537dfb95d00> 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-38/run_build0') 392s setup_args = ['build'], disable_languages_test = False 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = False 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-38/run_build0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s ----------------------------- Captured stdout call ----------------------------- 392s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-38/run_build0/.git/ 392s [master (root-commit) c250bdd] Initial commit 392s 11 files changed, 115 insertions(+) 392s create mode 100644 CMakeLists.txt 392s create mode 100644 bonjour/__init__.py 392s create mode 100644 bonjour/data/ciel.txt 392s create mode 100644 bonjour/data/soleil.txt 392s create mode 100644 bonjour/data/terre.txt 392s create mode 100644 bonjourModule.py 392s create mode 100644 hello/CMakeLists.txt 392s create mode 100644 hello/__init__.py 392s create mode 100644 hello/__main__.py 392s create mode 100644 hello/_hello.cxx 392s create mode 100644 setup.py 392s ----------------------------- Captured stderr call ----------------------------- 392s hint: Using 'master' as the name for the initial branch. This default branch name 392s hint: is subject to change. To configure the initial branch name to use in all 392s hint: of your new repositories, which will suppress this warning, call: 392s hint: 392s hint: git config --global init.defaultBranch 392s hint: 392s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 392s hint: 'development'. The just-created branch can be renamed via this command: 392s hint: 392s hint: git branch -m 392s ______________________ test_hello_clean[without-dry-run] _______________________ 392s 392s dry_run = False 392s capfd = <_pytest.capture.CaptureFixture object at 0x7537dfbc3560> 392s 392s @pytest.mark.parametrize("dry_run", ["with-dry-run", "without-dry-run"]) 392s def test_hello_clean(dry_run, capfd): 392s with push_dir(): 392s dry_run = dry_run == "with-dry-run" 392s 392s @project_setup_py_test("hello-cpp", ["build"], ret=True) 392s def run_build(): 392s pass 392s 392s > tmp_dir = run_build()[0] 392s 392s capfd = <_pytest.capture.CaptureFixture object at 0x7537dfbc3560> 392s dry_run = False 392s run_build = .run_build at 0x7537dfb96160> 392s 392s tests/test_hello_cpp.py:114: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s tests/__init__.py:255: in wrapped 392s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 392s disable_languages_test = False 392s fun = .run_build at 0x7537dfb95f80> 392s iargs = () 392s ikwargs = {} 392s ret = True 392s wrapped = .run_build at 0x7537dfb96160> 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-39/run_build0') 392s setup_args = ['build'], disable_languages_test = False 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = False 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-39/run_build0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s ----------------------------- Captured stdout call ----------------------------- 392s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-39/run_build0/.git/ 392s [master (root-commit) c250bdd] Initial commit 392s 11 files changed, 115 insertions(+) 392s create mode 100644 CMakeLists.txt 392s create mode 100644 bonjour/__init__.py 392s create mode 100644 bonjour/data/ciel.txt 392s create mode 100644 bonjour/data/soleil.txt 392s create mode 100644 bonjour/data/terre.txt 392s create mode 100644 bonjourModule.py 392s create mode 100644 hello/CMakeLists.txt 392s create mode 100644 hello/__init__.py 392s create mode 100644 hello/__main__.py 392s create mode 100644 hello/_hello.cxx 392s create mode 100644 setup.py 392s ----------------------------- Captured stderr call ----------------------------- 392s hint: Using 'master' as the name for the initial branch. This default branch name 392s hint: is subject to change. To configure the initial branch name to use in all 392s hint: of your new repositories, which will suppress this warning, call: 392s hint: 392s hint: git config --global init.defaultBranch 392s hint: 392s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 392s hint: 'development'. The just-created branch can be renamed via this command: 392s hint: 392s hint: git branch -m 392s ______________________________ test_hello_cleans _______________________________ 392s 392s capfd = <_pytest.capture.CaptureFixture object at 0x7537dfae8aa0> 392s caplog = <_pytest.logging.LogCaptureFixture object at 0x7537dfaea3c0> 392s 392s def test_hello_cleans(capfd, caplog): 392s with push_dir(): 392s tmp_dir = _tmpdir("test_hello_cleans") 392s 392s _copy_dir(tmp_dir, os.path.join(SAMPLES_DIR, "hello-cpp")) 392s 392s @project_setup_py_test("hello-cpp", ["build"], tmp_dir=tmp_dir) 392s def run_build(): 392s pass 392s 392s @project_setup_py_test("hello-cpp", ["clean"], tmp_dir=tmp_dir) 392s def run_clean(): 392s pass 392s 392s # Check that a project can be cleaned twice in a row 392s > run_build() 392s 392s capfd = <_pytest.capture.CaptureFixture object at 0x7537dfae8aa0> 392s caplog = <_pytest.logging.LogCaptureFixture object at 0x7537dfaea3c0> 392s run_build = .run_build at 0x7537dfb61a80> 392s run_clean = .run_clean at 0x7537dfb96200> 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-40/test_hello_cleans0') 392s 392s tests/test_hello_cpp.py:158: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s tests/__init__.py:255: in wrapped 392s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 392s disable_languages_test = False 392s fun = .run_build at 0x7537dfb636a0> 392s iargs = () 392s ikwargs = {} 392s ret = False 392s wrapped = .run_build at 0x7537dfb61a80> 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-40/test_hello_cleans0') 392s setup_args = ['build'], disable_languages_test = False 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = False 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-40/test_hello_cleans0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s ___________________________ test_hello_cython_builds ___________________________ 392s 392s iargs = (), ikwargs = {} 392s 392s @functools.wraps(fun) 392s def wrapped(*iargs, **ikwargs): 392s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 392s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 392s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 392s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 392s 392s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 392s 392s disable_languages_test = False 392s fun = 392s iargs = () 392s ikwargs = {} 392s ret = False 392s wrapped = 392s 392s tests/__init__.py:255: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-41/test_hello_cython_builds0') 392s setup_args = ['build'], disable_languages_test = False 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = False 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-41/test_hello_cython_builds0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s ----------------------------- Captured stdout call ----------------------------- 392s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-41/test_hello_cython_builds0/.git/ 392s [master (root-commit) 7ab98ef] Initial commit 392s 6 files changed, 42 insertions(+) 392s create mode 100644 CMakeLists.txt 392s create mode 100644 hello/CMakeLists.txt 392s create mode 100644 hello/__init__.py 392s create mode 100644 hello/__main__.py 392s create mode 100644 hello/_hello.pyx 392s create mode 100644 setup.py 392s ----------------------------- Captured stderr call ----------------------------- 392s hint: Using 'master' as the name for the initial branch. This default branch name 392s hint: is subject to change. To configure the initial branch name to use in all 392s hint: of your new repositories, which will suppress this warning, call: 392s hint: 392s hint: git config --global init.defaultBranch 392s hint: 392s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 392s hint: 'development'. The just-created branch can be renamed via this command: 392s hint: 392s hint: git branch -m 392s ___________________________ test_hello_cython_sdist ____________________________ 392s 392s iargs = (), ikwargs = {} 392s 392s @functools.wraps(fun) 392s def wrapped(*iargs, **ikwargs): 392s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 392s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 392s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 392s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 392s 392s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 392s 392s disable_languages_test = False 392s fun = 392s iargs = () 392s ikwargs = {} 392s ret = False 392s wrapped = 392s 392s tests/__init__.py:255: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-42/test_hello_cython_sdist0') 392s setup_args = ['sdist'], disable_languages_test = False 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = False 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-42/test_hello_cython_sdist0') 392s setup_args = ['sdist'] 392s 392s tests/__init__.py:218: AttributeError 392s ----------------------------- Captured stdout call ----------------------------- 392s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-42/test_hello_cython_sdist0/.git/ 392s [master (root-commit) 7ab98ef] Initial commit 392s 6 files changed, 42 insertions(+) 392s create mode 100644 CMakeLists.txt 392s create mode 100644 hello/CMakeLists.txt 392s create mode 100644 hello/__init__.py 392s create mode 100644 hello/__main__.py 392s create mode 100644 hello/_hello.pyx 392s create mode 100644 setup.py 392s ----------------------------- Captured stderr call ----------------------------- 392s hint: Using 'master' as the name for the initial branch. This default branch name 392s hint: is subject to change. To configure the initial branch name to use in all 392s hint: of your new repositories, which will suppress this warning, call: 392s hint: 392s hint: git config --global init.defaultBranch 392s hint: 392s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 392s hint: 'development'. The just-created branch can be renamed via this command: 392s hint: 392s hint: git branch -m 392s ___________________________ test_hello_cython_wheel ____________________________ 392s 392s iargs = (), ikwargs = {} 392s 392s @functools.wraps(fun) 392s def wrapped(*iargs, **ikwargs): 392s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 392s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 392s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 392s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 392s 392s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 392s 392s disable_languages_test = False 392s fun = 392s iargs = () 392s ikwargs = {} 392s ret = False 392s wrapped = 392s 392s tests/__init__.py:255: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-43/test_hello_cython_wheel0') 392s setup_args = ['bdist_wheel'], disable_languages_test = False 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = False 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-43/test_hello_cython_wheel0') 392s setup_args = ['bdist_wheel'] 392s 392s tests/__init__.py:218: AttributeError 392s ----------------------------- Captured stdout call ----------------------------- 392s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-43/test_hello_cython_wheel0/.git/ 392s [master (root-commit) 7ab98ef] Initial commit 392s 6 files changed, 42 insertions(+) 392s create mode 100644 CMakeLists.txt 392s create mode 100644 hello/CMakeLists.txt 392s create mode 100644 hello/__init__.py 392s create mode 100644 hello/__main__.py 392s create mode 100644 hello/_hello.pyx 392s create mode 100644 setup.py 392s ----------------------------- Captured stderr call ----------------------------- 392s hint: Using 'master' as the name for the initial branch. This default branch name 392s hint: is subject to change. To configure the initial branch name to use in all 392s hint: of your new repositories, which will suppress this warning, call: 392s hint: 392s hint: git config --global init.defaultBranch 392s hint: 392s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 392s hint: 'development'. The just-created branch can be renamed via this command: 392s hint: 392s hint: git branch -m 392s ____________________________ test_hello_pure_builds ____________________________ 392s 392s iargs = () 392s ikwargs = {'capsys': <_pytest.capture.CaptureFixture object at 0x7537dfbc3a40>} 392s 392s @functools.wraps(fun) 392s def wrapped(*iargs, **ikwargs): 392s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 392s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 392s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 392s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 392s 392s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 392s 392s disable_languages_test = True 392s fun = 392s iargs = () 392s ikwargs = {'capsys': <_pytest.capture.CaptureFixture object at 0x7537dfbc3a40>} 392s ret = False 392s wrapped = 392s 392s tests/__init__.py:255: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-44/test_hello_pure_builds0') 392s setup_args = ['build'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-44/test_hello_pure_builds0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s ----------------------------- Captured stdout call ----------------------------- 392s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-44/test_hello_pure_builds0/.git/ 392s [master (root-commit) 74cac77] Initial commit 392s 2 files changed, 12 insertions(+) 392s create mode 100644 hello/__init__.py 392s create mode 100644 setup.py 392s ----------------------------- Captured stderr call ----------------------------- 392s hint: Using 'master' as the name for the initial branch. This default branch name 392s hint: is subject to change. To configure the initial branch name to use in all 392s hint: of your new repositories, which will suppress this warning, call: 392s hint: 392s hint: git config --global init.defaultBranch 392s hint: 392s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 392s hint: 'development'. The just-created branch can be renamed via this command: 392s hint: 392s hint: git branch -m 392s ____________________________ test_hello_pure_sdist _____________________________ 392s 392s iargs = (), ikwargs = {} 392s 392s @functools.wraps(fun) 392s def wrapped(*iargs, **ikwargs): 392s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 392s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 392s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 392s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 392s 392s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 392s 392s disable_languages_test = True 392s fun = 392s iargs = () 392s ikwargs = {} 392s ret = False 392s wrapped = 392s 392s tests/__init__.py:255: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-45/test_hello_pure_sdist0') 392s setup_args = ['sdist'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-45/test_hello_pure_sdist0') 392s setup_args = ['sdist'] 392s 392s tests/__init__.py:218: AttributeError 392s ----------------------------- Captured stdout call ----------------------------- 392s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-45/test_hello_pure_sdist0/.git/ 392s [master (root-commit) 74cac77] Initial commit 392s 2 files changed, 12 insertions(+) 392s create mode 100644 hello/__init__.py 392s create mode 100644 setup.py 392s ----------------------------- Captured stderr call ----------------------------- 392s hint: Using 'master' as the name for the initial branch. This default branch name 392s hint: is subject to change. To configure the initial branch name to use in all 392s hint: of your new repositories, which will suppress this warning, call: 392s hint: 392s hint: git config --global init.defaultBranch 392s hint: 392s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 392s hint: 'development'. The just-created branch can be renamed via this command: 392s hint: 392s hint: git branch -m 392s ____________________________ test_hello_pure_wheel _____________________________ 392s 392s iargs = (), ikwargs = {} 392s 392s @functools.wraps(fun) 392s def wrapped(*iargs, **ikwargs): 392s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 392s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 392s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 392s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 392s 392s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 392s 392s disable_languages_test = True 392s fun = 392s iargs = () 392s ikwargs = {} 392s ret = False 392s wrapped = 392s 392s tests/__init__.py:255: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-46/test_hello_pure_wheel0') 392s setup_args = ['bdist_wheel'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-46/test_hello_pure_wheel0') 392s setup_args = ['bdist_wheel'] 392s 392s tests/__init__.py:218: AttributeError 392s ----------------------------- Captured stdout call ----------------------------- 392s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-46/test_hello_pure_wheel0/.git/ 392s [master (root-commit) 74cac77] Initial commit 392s 2 files changed, 12 insertions(+) 392s create mode 100644 hello/__init__.py 392s create mode 100644 setup.py 392s ----------------------------- Captured stderr call ----------------------------- 392s hint: Using 'master' as the name for the initial branch. This default branch name 392s hint: is subject to change. To configure the initial branch name to use in all 392s hint: of your new repositories, which will suppress this warning, call: 392s hint: 392s hint: git config --global init.defaultBranch 392s hint: 392s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 392s hint: 'development'. The just-created branch can be renamed via this command: 392s hint: 392s hint: git branch -m 392s _______________________________ test_hello_clean _______________________________ 392s 392s capfd = <_pytest.capture.CaptureFixture object at 0x7537dfae8ad0> 392s 392s def test_hello_clean(capfd): 392s with push_dir(): 392s 392s @project_setup_py_test("hello-pure", ["build"], disable_languages_test=True, ret=True) 392s def run_build(): 392s pass 392s 392s > tmp_dir = run_build()[0] 392s 392s capfd = <_pytest.capture.CaptureFixture object at 0x7537dfae8ad0> 392s run_build = .run_build at 0x7537dfb96de0> 392s 392s tests/test_hello_pure.py:65: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s tests/__init__.py:255: in wrapped 392s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 392s disable_languages_test = True 392s fun = .run_build at 0x7537dfb96200> 392s iargs = () 392s ikwargs = {} 392s ret = True 392s wrapped = .run_build at 0x7537dfb96de0> 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-47/run_build0') 392s setup_args = ['build'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-47/run_build0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s ----------------------------- Captured stdout call ----------------------------- 392s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-47/run_build0/.git/ 392s [master (root-commit) 74cac77] Initial commit 392s 2 files changed, 12 insertions(+) 392s create mode 100644 hello/__init__.py 392s create mode 100644 setup.py 392s ----------------------------- Captured stderr call ----------------------------- 392s hint: Using 'master' as the name for the initial branch. This default branch name 392s hint: is subject to change. To configure the initial branch name to use in all 392s hint: of your new repositories, which will suppress this warning, call: 392s hint: 392s hint: git config --global init.defaultBranch 392s hint: 392s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 392s hint: 'development'. The just-created branch can be renamed via this command: 392s hint: 392s hint: git branch -m 392s __________________________ test_include_exclude_data ___________________________ 392s 392s iargs = (), ikwargs = {} 392s 392s @functools.wraps(fun) 392s def wrapped(*iargs, **ikwargs): 392s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 392s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 392s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 392s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 392s 392s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 392s 392s disable_languages_test = False 392s fun = 392s iargs = () 392s ikwargs = {} 392s ret = False 392s wrapped = 392s 392s tests/__init__.py:255: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-48/test_include_exclude_data0') 392s setup_args = ['bdist_wheel'], disable_languages_test = False 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = False 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-48/test_include_exclude_data0') 392s setup_args = ['bdist_wheel'] 392s 392s tests/__init__.py:218: AttributeError 392s ----------------------------- Captured stdout call ----------------------------- 392s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-48/test_include_exclude_data0/.git/ 392s [master (root-commit) c788101] Initial commit 392s 15 files changed, 79 insertions(+) 392s create mode 100644 CMakeLists.txt 392s create mode 100644 MANIFEST.in 392s create mode 100644 hello/__init__.py 392s create mode 100644 hello/data/subdata/hello_data1_include_from_manifest.txt 392s create mode 100644 hello/data/subdata/hello_data2_include_from_manifest.txt 392s create mode 100644 hello/data/subdata/hello_data3_include_from_manifest_and_exclude_from_manifest.txt 392s create mode 100644 hello/data/subdata/hello_data4_include_from_manifest_and_exclude_from_setup.txt 392s create mode 100644 hello/hello_include_from_manifest.txt 392s create mode 100644 hello2/__init__.py 392s create mode 100644 hello2/data2/subdata2/hello2_data1_include_from_manifest.txt 392s create mode 100644 hello2/data2/subdata2/hello2_data2_include_from_manifest.txt 392s create mode 100644 hello2/data2/subdata2/hello2_data3_include_from_manifest_and_exclude_from_manifest.txt 392s create mode 100644 hello2/data2/subdata2/hello2_data4_include_from_manifest_and_exclude_from_setup.txt 392s create mode 100644 hello2/hello2_include_from_manifest.txt 392s create mode 100644 setup.py 392s ----------------------------- Captured stderr call ----------------------------- 392s hint: Using 'master' as the name for the initial branch. This default branch name 392s hint: is subject to change. To configure the initial branch name to use in all 392s hint: of your new repositories, which will suppress this warning, call: 392s hint: 392s hint: git config --global init.defaultBranch 392s hint: 392s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 392s hint: 'development'. The just-created branch can be renamed via this command: 392s hint: 392s hint: git branch -m 392s _____________________ test_include_exclude_data_with_base ______________________ 392s 392s iargs = (), ikwargs = {} 392s 392s @functools.wraps(fun) 392s def wrapped(*iargs, **ikwargs): 392s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 392s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 392s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 392s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 392s 392s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 392s 392s disable_languages_test = False 392s fun = 392s iargs = () 392s ikwargs = {} 392s ret = False 392s wrapped = 392s 392s tests/__init__.py:255: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-49/test_include_exclude_data_with0') 392s setup_args = ['bdist_wheel'], disable_languages_test = False 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = False 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-49/test_include_exclude_data_with0') 392s setup_args = ['bdist_wheel'] 392s 392s tests/__init__.py:218: AttributeError 392s ----------------------------- Captured stdout call ----------------------------- 392s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-49/test_include_exclude_data_with0/.git/ 392s [master (root-commit) 448bd09] Initial commit 392s 15 files changed, 80 insertions(+) 392s create mode 100644 CMakeLists.txt 392s create mode 100644 MANIFEST.in 392s create mode 100644 setup.py 392s create mode 100644 src/hello/__init__.py 392s create mode 100644 src/hello/data/subdata/hello_data1_include_from_manifest.txt 392s create mode 100644 src/hello/data/subdata/hello_data2_include_from_manifest.txt 392s create mode 100644 src/hello/data/subdata/hello_data3_include_from_manifest_and_exclude_from_manifest.txt 392s create mode 100644 src/hello/data/subdata/hello_data4_include_from_manifest_and_exclude_from_setup.txt 392s create mode 100644 src/hello/hello_include_from_manifest.txt 392s create mode 100644 src/hello2/__init__.py 392s create mode 100644 src/hello2/data2/subdata2/hello2_data1_include_from_manifest.txt 392s create mode 100644 src/hello2/data2/subdata2/hello2_data2_include_from_manifest.txt 392s create mode 100644 src/hello2/data2/subdata2/hello2_data3_include_from_manifest_and_exclude_from_manifest.txt 392s create mode 100644 src/hello2/data2/subdata2/hello2_data4_include_from_manifest_and_exclude_from_setup.txt 392s create mode 100644 src/hello2/hello2_include_from_manifest.txt 392s ----------------------------- Captured stderr call ----------------------------- 392s hint: Using 'master' as the name for the initial branch. This default branch name 392s hint: is subject to change. To configure the initial branch name to use in all 392s hint: of your new repositories, which will suppress this warning, call: 392s hint: 392s hint: git config --global init.defaultBranch 392s hint: 392s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 392s hint: 'development'. The just-created branch can be renamed via this command: 392s hint: 392s hint: git branch -m 392s ________________________ test_build_ext_inplace_command ________________________ 392s 392s iargs = (), ikwargs = {} 392s 392s @functools.wraps(fun) 392s def wrapped(*iargs, **ikwargs): 392s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 392s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 392s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 392s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 392s 392s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 392s 392s disable_languages_test = True 392s fun = 392s iargs = () 392s ikwargs = {} 392s ret = False 392s wrapped = 392s 392s tests/__init__.py:255: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-50/test_build_ext_inplace_command0') 392s setup_args = ['build_ext', '--inplace'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-50/test_build_ext_inplace_command0') 392s setup_args = ['build_ext', '--inplace'] 392s 392s tests/__init__.py:218: AttributeError 392s ----------------------------- Captured stdout call ----------------------------- 392s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-50/test_build_ext_inplace_command0/.git/ 392s [master (root-commit) b575cfc] Initial commit 392s 5 files changed, 160 insertions(+) 392s create mode 100644 CMakeLists.txt 392s create mode 100644 hello/__init__.py 392s create mode 100644 hello/_hello_ext.cxx 392s create mode 100644 hello/_hello_sk.cxx 392s create mode 100644 setup.py 392s ----------------------------- Captured stderr call ----------------------------- 392s hint: Using 'master' as the name for the initial branch. This default branch name 392s hint: is subject to change. To configure the initial branch name to use in all 392s hint: of your new repositories, which will suppress this warning, call: 392s hint: 392s hint: git config --global init.defaultBranch 392s hint: 392s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 392s hint: 'development'. The just-created branch can be renamed via this command: 392s hint: 392s hint: git branch -m 392s ___________________________ test_bdist_wheel_command ___________________________ 392s 392s def test_bdist_wheel_command(): 392s project = "issue-335-support-cmake-source-dir" 392s 392s expected_content = [ 392s "hello/__init__.py", 392s "hello/swig_mwe.py", 392s "hello/_swig_mwe.pyd", 392s "hello-1.2.3.data/data/bin/hello", 392s "hello-1.2.3.data/data/lib/static/libbar.a", 392s "hello-1.2.3.data/data/lib/static/libfoo.a", 392s "hello-1.2.3.data/data/include/bar.h", 392s "hello-1.2.3.data/data/include/foo.h", 392s ] 392s 392s expected_distribution_name = "hello-1.2.3" 392s 392s tmp_dir = _tmpdir("test_bdist_wheel_command") 392s prepare_project(project, tmp_dir) 392s initialize_git_repo_and_commit(tmp_dir, verbose=True) 392s 392s relative_setup_path = "wrapping/python/" 392s 392s > with execute_setup_py(tmp_dir.join(relative_setup_path), ["bdist_wheel"]): 392s 392s 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', ...] 392s expected_distribution_name = 'hello-1.2.3' 392s project = 'issue-335-support-cmake-source-dir' 392s relative_setup_path = 'wrapping/python/' 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-51/test_bdist_wheel_command0') 392s 392s tests/test_issue335_support_cmake_source_dir.py:31: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-51/test_bdist_wheel_command0/wrapping/python') 392s setup_args = ['bdist_wheel'], disable_languages_test = False 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = False 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-51/test_bdist_wheel_command0/wrapping/python') 392s setup_args = ['bdist_wheel'] 392s 392s tests/__init__.py:218: AttributeError 392s ----------------------------- Captured stdout call ----------------------------- 392s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-51/test_bdist_wheel_command0/.git/ 392s [master (root-commit) 011cc44] Initial commit 392s 4 files changed, 52 insertions(+) 392s create mode 100644 CMakeLists.txt 392s create mode 100644 wrapping/python/CMakeLists.txt 392s create mode 100644 wrapping/python/hello/__init__.py 392s create mode 100644 wrapping/python/setup.py 392s ----------------------------- Captured stderr call ----------------------------- 392s hint: Using 'master' as the name for the initial branch. This default branch name 392s hint: is subject to change. To configure the initial branch name to use in all 392s hint: of your new repositories, which will suppress this warning, call: 392s hint: 392s hint: git config --global init.defaultBranch 392s hint: 392s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 392s hint: 'development'. The just-created branch can be renamed via this command: 392s hint: 392s hint: git branch -m 392s _ test_cmake_args_keyword_osx_default[None-cli_setup_args0-keyword_cmake_args0-cli_cmake_args0-10.9] _ 392s 392s osx_deployment_target_env_var = None, cli_setup_args = [] 392s keyword_cmake_args = [], cli_cmake_args = [] 392s expected_cmake_osx_deployment_target = '10.9' 392s mocker = 392s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7537dfbc1160> 392s 392s @pytest.mark.parametrize( 392s params, 392s [ 392s # default plat_name is 'macosx-10.9-x86_64' 392s ( 392s # osx_deployment_target_env_var 392s None, 392s # cli_setup_args 392s [], 392s # keyword_cmake_args 392s [], 392s # cli_cmake_args 392s [], 392s # expected_cmake_osx_deployment_target 392s "10.9", 392s ), 392s ( 392s # osx_deployment_target_env_var 392s "10.7", 392s # cli_setup_args 392s [], 392s # keyword_cmake_args 392s [], 392s # cli_cmake_args 392s [], 392s # expected_cmake_osx_deployment_target 392s "10.7", 392s ), 392s ( 392s # osx_deployment_target_env_var 392s "10.7", 392s # cli_setup_args 392s ["--plat-name", "macosx-10.9-x86_64"], 392s # keyword_cmake_args 392s [], 392s # cli_cmake_args 392s [], 392s # expected_cmake_osx_deployment_target 392s "10.9", 392s ), 392s ( 392s # osx_deployment_target_env_var 392s None, 392s # cli_setup_args 392s ["--plat-name", "macosx-10.6-x86_64"], 392s # keyword_cmake_args 392s [], 392s # cli_cmake_args 392s [], 392s # expected_cmake_osx_deployment_target 392s "10.6", 392s ), 392s ( 392s # osx_deployment_target_env_var 392s None, 392s # cli_setup_args 392s ["--plat-name", "macosx-10.7-x86_64"], 392s # keyword_cmake_args 392s [], 392s # cli_cmake_args 392s [], 392s # expected_cmake_osx_deployment_target 392s "10.7", 392s ), 392s ( 392s # osx_deployment_target_env_var 392s None, 392s # cli_setup_args 392s [], 392s # keyword_cmake_args 392s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 392s # cli_cmake_args 392s [], 392s # expected_cmake_osx_deployment_target 392s "10.7", 392s ), 392s ( 392s # osx_deployment_target_env_var 392s None, 392s # cli_setup_args 392s ["--plat-name", "macosx-10.12-x86_64"], 392s # keyword_cmake_args 392s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 392s # cli_cmake_args 392s [], 392s # expected_cmake_osx_deployment_target 392s "10.7", 392s ), 392s ( 392s # osx_deployment_target_env_var 392s None, 392s # cli_setup_args 392s [], 392s # keyword_cmake_args 392s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 392s # cli_cmake_args 392s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 392s # expected_cmake_osx_deployment_target 392s "10.8", 392s ), 392s ( 392s # osx_deployment_target_env_var 392s None, 392s # cli_setup_args 392s ["--plat-name", "macosx-10.12-x86_64"], 392s # keyword_cmake_args 392s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 392s # cli_cmake_args 392s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 392s # expected_cmake_osx_deployment_target 392s "10.8", 392s ), 392s ], 392s ) 392s def test_cmake_args_keyword_osx_default( 392s osx_deployment_target_env_var, 392s cli_setup_args, 392s keyword_cmake_args, 392s cli_cmake_args, 392s expected_cmake_osx_deployment_target, 392s mocker, 392s monkeypatch, 392s ): 392s tmp_dir = _tmpdir("cmake_args_keyword_osx_default") 392s 392s tmp_dir.join("setup.py").write( 392s textwrap.dedent( 392s """ 392s from skbuild import setup 392s setup( 392s name="test_cmake_args_keyword_osx_default", 392s version="1.2.3", 392s description="A minimal example package", 392s author="The scikit-build team", 392s license="MIT", 392s cmake_args=[{cmake_args}] 392s ) 392s """.format(cmake_args=",".join([f"'{arg}'" for arg in keyword_cmake_args])) 392s ) 392s ) 392s tmp_dir.join("CMakeLists.txt").write( 392s textwrap.dedent( 392s """ 392s message(FATAL_ERROR "This error message should not be displayed") 392s """ 392s ) 392s ) 392s 392s mock_configure = mocker.patch("skbuild.cmaker.CMaker.configure", side_effect=RuntimeError("exit skbuild")) 392s 392s monkeypatch.setattr(platform, "mac_ver", lambda: ("10.9", None, "x84_64")) 392s monkeypatch.setattr(platform, "machine", lambda: "x86_64") 392s monkeypatch.setattr(sys, "platform", "darwin") 392s 392s with push_env(MACOSX_DEPLOYMENT_TARGET=osx_deployment_target_env_var): 392s monkeypatch.setattr(skbuild.constants, "_SKBUILD_PLAT_NAME", skbuild.constants._default_skbuild_plat_name()) 392s with pytest.raises(RuntimeError, match="exit skbuild"): 392s > with execute_setup_py(tmp_dir, ["build", *cli_setup_args, "--", *cli_cmake_args]): 392s 392s cli_cmake_args = [] 392s cli_setup_args = [] 392s expected_cmake_osx_deployment_target = '10.9' 392s keyword_cmake_args = [] 392s mock_configure = 392s mocker = 392s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7537dfbc1160> 392s osx_deployment_target_env_var = None 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-52/cmake_args_keyword_osx_default0') 392s 392s tests/test_issue342_cmake_osx_args_in_setup.py:176: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-52/cmake_args_keyword_osx_default0') 392s setup_args = ['build', '--'], disable_languages_test = False 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = False 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-52/cmake_args_keyword_osx_default0') 392s setup_args = ['build', '--'] 392s 392s tests/__init__.py:218: AttributeError 392s _ test_cmake_args_keyword_osx_default[10.7-cli_setup_args1-keyword_cmake_args1-cli_cmake_args1-10.7] _ 392s 392s osx_deployment_target_env_var = '10.7', cli_setup_args = [] 392s keyword_cmake_args = [], cli_cmake_args = [] 392s expected_cmake_osx_deployment_target = '10.7' 392s mocker = 392s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7537dfbd1130> 392s 392s @pytest.mark.parametrize( 392s params, 392s [ 392s # default plat_name is 'macosx-10.9-x86_64' 392s ( 392s # osx_deployment_target_env_var 392s None, 392s # cli_setup_args 392s [], 392s # keyword_cmake_args 392s [], 392s # cli_cmake_args 392s [], 392s # expected_cmake_osx_deployment_target 392s "10.9", 392s ), 392s ( 392s # osx_deployment_target_env_var 392s "10.7", 392s # cli_setup_args 392s [], 392s # keyword_cmake_args 392s [], 392s # cli_cmake_args 392s [], 392s # expected_cmake_osx_deployment_target 392s "10.7", 392s ), 392s ( 392s # osx_deployment_target_env_var 392s "10.7", 392s # cli_setup_args 392s ["--plat-name", "macosx-10.9-x86_64"], 392s # keyword_cmake_args 392s [], 392s # cli_cmake_args 392s [], 392s # expected_cmake_osx_deployment_target 392s "10.9", 392s ), 392s ( 392s # osx_deployment_target_env_var 392s None, 392s # cli_setup_args 392s ["--plat-name", "macosx-10.6-x86_64"], 392s # keyword_cmake_args 392s [], 392s # cli_cmake_args 392s [], 392s # expected_cmake_osx_deployment_target 392s "10.6", 392s ), 392s ( 392s # osx_deployment_target_env_var 392s None, 392s # cli_setup_args 392s ["--plat-name", "macosx-10.7-x86_64"], 392s # keyword_cmake_args 392s [], 392s # cli_cmake_args 392s [], 392s # expected_cmake_osx_deployment_target 392s "10.7", 392s ), 392s ( 392s # osx_deployment_target_env_var 392s None, 392s # cli_setup_args 392s [], 392s # keyword_cmake_args 392s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 392s # cli_cmake_args 392s [], 392s # expected_cmake_osx_deployment_target 392s "10.7", 392s ), 392s ( 392s # osx_deployment_target_env_var 392s None, 392s # cli_setup_args 392s ["--plat-name", "macosx-10.12-x86_64"], 392s # keyword_cmake_args 392s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 392s # cli_cmake_args 392s [], 392s # expected_cmake_osx_deployment_target 392s "10.7", 392s ), 392s ( 392s # osx_deployment_target_env_var 392s None, 392s # cli_setup_args 392s [], 392s # keyword_cmake_args 392s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 392s # cli_cmake_args 392s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 392s # expected_cmake_osx_deployment_target 392s "10.8", 392s ), 392s ( 392s # osx_deployment_target_env_var 392s None, 392s # cli_setup_args 392s ["--plat-name", "macosx-10.12-x86_64"], 392s # keyword_cmake_args 392s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 392s # cli_cmake_args 392s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 392s # expected_cmake_osx_deployment_target 392s "10.8", 392s ), 392s ], 392s ) 392s def test_cmake_args_keyword_osx_default( 392s osx_deployment_target_env_var, 392s cli_setup_args, 392s keyword_cmake_args, 392s cli_cmake_args, 392s expected_cmake_osx_deployment_target, 392s mocker, 392s monkeypatch, 392s ): 392s tmp_dir = _tmpdir("cmake_args_keyword_osx_default") 392s 392s tmp_dir.join("setup.py").write( 392s textwrap.dedent( 392s """ 392s from skbuild import setup 392s setup( 392s name="test_cmake_args_keyword_osx_default", 392s version="1.2.3", 392s description="A minimal example package", 392s author="The scikit-build team", 392s license="MIT", 392s cmake_args=[{cmake_args}] 392s ) 392s """.format(cmake_args=",".join([f"'{arg}'" for arg in keyword_cmake_args])) 392s ) 392s ) 392s tmp_dir.join("CMakeLists.txt").write( 392s textwrap.dedent( 392s """ 392s message(FATAL_ERROR "This error message should not be displayed") 392s """ 392s ) 392s ) 392s 392s mock_configure = mocker.patch("skbuild.cmaker.CMaker.configure", side_effect=RuntimeError("exit skbuild")) 392s 392s monkeypatch.setattr(platform, "mac_ver", lambda: ("10.9", None, "x84_64")) 392s monkeypatch.setattr(platform, "machine", lambda: "x86_64") 392s monkeypatch.setattr(sys, "platform", "darwin") 392s 392s with push_env(MACOSX_DEPLOYMENT_TARGET=osx_deployment_target_env_var): 392s monkeypatch.setattr(skbuild.constants, "_SKBUILD_PLAT_NAME", skbuild.constants._default_skbuild_plat_name()) 392s with pytest.raises(RuntimeError, match="exit skbuild"): 392s > with execute_setup_py(tmp_dir, ["build", *cli_setup_args, "--", *cli_cmake_args]): 392s 392s cli_cmake_args = [] 392s cli_setup_args = [] 392s expected_cmake_osx_deployment_target = '10.7' 392s keyword_cmake_args = [] 392s mock_configure = 392s mocker = 392s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7537dfbd1130> 392s osx_deployment_target_env_var = '10.7' 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-53/cmake_args_keyword_osx_default0') 392s 392s tests/test_issue342_cmake_osx_args_in_setup.py:176: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-53/cmake_args_keyword_osx_default0') 392s setup_args = ['build', '--'], disable_languages_test = False 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = False 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-53/cmake_args_keyword_osx_default0') 392s setup_args = ['build', '--'] 392s 392s tests/__init__.py:218: AttributeError 392s _ test_cmake_args_keyword_osx_default[10.7-cli_setup_args2-keyword_cmake_args2-cli_cmake_args2-10.9] _ 392s 392s osx_deployment_target_env_var = '10.7' 392s cli_setup_args = ['--plat-name', 'macosx-10.9-x86_64'], keyword_cmake_args = [] 392s cli_cmake_args = [], expected_cmake_osx_deployment_target = '10.9' 392s mocker = 392s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7537dfbd36e0> 392s 392s @pytest.mark.parametrize( 392s params, 392s [ 392s # default plat_name is 'macosx-10.9-x86_64' 392s ( 392s # osx_deployment_target_env_var 392s None, 392s # cli_setup_args 392s [], 392s # keyword_cmake_args 392s [], 392s # cli_cmake_args 392s [], 392s # expected_cmake_osx_deployment_target 392s "10.9", 392s ), 392s ( 392s # osx_deployment_target_env_var 392s "10.7", 392s # cli_setup_args 392s [], 392s # keyword_cmake_args 392s [], 392s # cli_cmake_args 392s [], 392s # expected_cmake_osx_deployment_target 392s "10.7", 392s ), 392s ( 392s # osx_deployment_target_env_var 392s "10.7", 392s # cli_setup_args 392s ["--plat-name", "macosx-10.9-x86_64"], 392s # keyword_cmake_args 392s [], 392s # cli_cmake_args 392s [], 392s # expected_cmake_osx_deployment_target 392s "10.9", 392s ), 392s ( 392s # osx_deployment_target_env_var 392s None, 392s # cli_setup_args 392s ["--plat-name", "macosx-10.6-x86_64"], 392s # keyword_cmake_args 392s [], 392s # cli_cmake_args 392s [], 392s # expected_cmake_osx_deployment_target 392s "10.6", 392s ), 392s ( 392s # osx_deployment_target_env_var 392s None, 392s # cli_setup_args 392s ["--plat-name", "macosx-10.7-x86_64"], 392s # keyword_cmake_args 392s [], 392s # cli_cmake_args 392s [], 392s # expected_cmake_osx_deployment_target 392s "10.7", 392s ), 392s ( 392s # osx_deployment_target_env_var 392s None, 392s # cli_setup_args 392s [], 392s # keyword_cmake_args 392s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 392s # cli_cmake_args 392s [], 392s # expected_cmake_osx_deployment_target 392s "10.7", 392s ), 392s ( 392s # osx_deployment_target_env_var 392s None, 392s # cli_setup_args 392s ["--plat-name", "macosx-10.12-x86_64"], 392s # keyword_cmake_args 392s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 392s # cli_cmake_args 392s [], 392s # expected_cmake_osx_deployment_target 392s "10.7", 392s ), 392s ( 392s # osx_deployment_target_env_var 392s None, 392s # cli_setup_args 392s [], 392s # keyword_cmake_args 392s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 392s # cli_cmake_args 392s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 392s # expected_cmake_osx_deployment_target 392s "10.8", 392s ), 392s ( 392s # osx_deployment_target_env_var 392s None, 392s # cli_setup_args 392s ["--plat-name", "macosx-10.12-x86_64"], 392s # keyword_cmake_args 392s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 392s # cli_cmake_args 392s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 392s # expected_cmake_osx_deployment_target 392s "10.8", 392s ), 392s ], 392s ) 392s def test_cmake_args_keyword_osx_default( 392s osx_deployment_target_env_var, 392s cli_setup_args, 392s keyword_cmake_args, 392s cli_cmake_args, 392s expected_cmake_osx_deployment_target, 392s mocker, 392s monkeypatch, 392s ): 392s tmp_dir = _tmpdir("cmake_args_keyword_osx_default") 392s 392s tmp_dir.join("setup.py").write( 392s textwrap.dedent( 392s """ 392s from skbuild import setup 392s setup( 392s name="test_cmake_args_keyword_osx_default", 392s version="1.2.3", 392s description="A minimal example package", 392s author="The scikit-build team", 392s license="MIT", 392s cmake_args=[{cmake_args}] 392s ) 392s """.format(cmake_args=",".join([f"'{arg}'" for arg in keyword_cmake_args])) 392s ) 392s ) 392s tmp_dir.join("CMakeLists.txt").write( 392s textwrap.dedent( 392s """ 392s message(FATAL_ERROR "This error message should not be displayed") 392s """ 392s ) 392s ) 392s 392s mock_configure = mocker.patch("skbuild.cmaker.CMaker.configure", side_effect=RuntimeError("exit skbuild")) 392s 392s monkeypatch.setattr(platform, "mac_ver", lambda: ("10.9", None, "x84_64")) 392s monkeypatch.setattr(platform, "machine", lambda: "x86_64") 392s monkeypatch.setattr(sys, "platform", "darwin") 392s 392s with push_env(MACOSX_DEPLOYMENT_TARGET=osx_deployment_target_env_var): 392s monkeypatch.setattr(skbuild.constants, "_SKBUILD_PLAT_NAME", skbuild.constants._default_skbuild_plat_name()) 392s with pytest.raises(RuntimeError, match="exit skbuild"): 392s > with execute_setup_py(tmp_dir, ["build", *cli_setup_args, "--", *cli_cmake_args]): 392s 392s cli_cmake_args = [] 392s cli_setup_args = ['--plat-name', 'macosx-10.9-x86_64'] 392s expected_cmake_osx_deployment_target = '10.9' 392s keyword_cmake_args = [] 392s mock_configure = 392s mocker = 392s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7537dfbd36e0> 392s osx_deployment_target_env_var = '10.7' 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-54/cmake_args_keyword_osx_default0') 392s 392s tests/test_issue342_cmake_osx_args_in_setup.py:176: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-54/cmake_args_keyword_osx_default0') 392s setup_args = ['build', '--plat-name', 'macosx-10.9-x86_64', '--'] 392s disable_languages_test = False 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = False 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-54/cmake_args_keyword_osx_default0') 392s setup_args = ['build', '--plat-name', 'macosx-10.9-x86_64', '--'] 392s 392s tests/__init__.py:218: AttributeError 392s _ test_cmake_args_keyword_osx_default[None-cli_setup_args3-keyword_cmake_args3-cli_cmake_args3-10.6] _ 392s 392s osx_deployment_target_env_var = None 392s cli_setup_args = ['--plat-name', 'macosx-10.6-x86_64'], keyword_cmake_args = [] 392s cli_cmake_args = [], expected_cmake_osx_deployment_target = '10.6' 392s mocker = 392s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7537dfb3ed20> 392s 392s @pytest.mark.parametrize( 392s params, 392s [ 392s # default plat_name is 'macosx-10.9-x86_64' 392s ( 392s # osx_deployment_target_env_var 392s None, 392s # cli_setup_args 392s [], 392s # keyword_cmake_args 392s [], 392s # cli_cmake_args 392s [], 392s # expected_cmake_osx_deployment_target 392s "10.9", 392s ), 392s ( 392s # osx_deployment_target_env_var 392s "10.7", 392s # cli_setup_args 392s [], 392s # keyword_cmake_args 392s [], 392s # cli_cmake_args 392s [], 392s # expected_cmake_osx_deployment_target 392s "10.7", 392s ), 392s ( 392s # osx_deployment_target_env_var 392s "10.7", 392s # cli_setup_args 392s ["--plat-name", "macosx-10.9-x86_64"], 392s # keyword_cmake_args 392s [], 392s # cli_cmake_args 392s [], 392s # expected_cmake_osx_deployment_target 392s "10.9", 392s ), 392s ( 392s # osx_deployment_target_env_var 392s None, 392s # cli_setup_args 392s ["--plat-name", "macosx-10.6-x86_64"], 392s # keyword_cmake_args 392s [], 392s # cli_cmake_args 392s [], 392s # expected_cmake_osx_deployment_target 392s "10.6", 392s ), 392s ( 392s # osx_deployment_target_env_var 392s None, 392s # cli_setup_args 392s ["--plat-name", "macosx-10.7-x86_64"], 392s # keyword_cmake_args 392s [], 392s # cli_cmake_args 392s [], 392s # expected_cmake_osx_deployment_target 392s "10.7", 392s ), 392s ( 392s # osx_deployment_target_env_var 392s None, 392s # cli_setup_args 392s [], 392s # keyword_cmake_args 392s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 392s # cli_cmake_args 392s [], 392s # expected_cmake_osx_deployment_target 392s "10.7", 392s ), 392s ( 392s # osx_deployment_target_env_var 392s None, 392s # cli_setup_args 392s ["--plat-name", "macosx-10.12-x86_64"], 392s # keyword_cmake_args 392s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 392s # cli_cmake_args 392s [], 392s # expected_cmake_osx_deployment_target 392s "10.7", 392s ), 392s ( 392s # osx_deployment_target_env_var 392s None, 392s # cli_setup_args 392s [], 392s # keyword_cmake_args 392s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 392s # cli_cmake_args 392s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 392s # expected_cmake_osx_deployment_target 392s "10.8", 392s ), 392s ( 392s # osx_deployment_target_env_var 392s None, 392s # cli_setup_args 392s ["--plat-name", "macosx-10.12-x86_64"], 392s # keyword_cmake_args 392s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 392s # cli_cmake_args 392s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 392s # expected_cmake_osx_deployment_target 392s "10.8", 392s ), 392s ], 392s ) 392s def test_cmake_args_keyword_osx_default( 392s osx_deployment_target_env_var, 392s cli_setup_args, 392s keyword_cmake_args, 392s cli_cmake_args, 392s expected_cmake_osx_deployment_target, 392s mocker, 392s monkeypatch, 392s ): 392s tmp_dir = _tmpdir("cmake_args_keyword_osx_default") 392s 392s tmp_dir.join("setup.py").write( 392s textwrap.dedent( 392s """ 392s from skbuild import setup 392s setup( 392s name="test_cmake_args_keyword_osx_default", 392s version="1.2.3", 392s description="A minimal example package", 392s author="The scikit-build team", 392s license="MIT", 392s cmake_args=[{cmake_args}] 392s ) 392s """.format(cmake_args=",".join([f"'{arg}'" for arg in keyword_cmake_args])) 392s ) 392s ) 392s tmp_dir.join("CMakeLists.txt").write( 392s textwrap.dedent( 392s """ 392s message(FATAL_ERROR "This error message should not be displayed") 392s """ 392s ) 392s ) 392s 392s mock_configure = mocker.patch("skbuild.cmaker.CMaker.configure", side_effect=RuntimeError("exit skbuild")) 392s 392s monkeypatch.setattr(platform, "mac_ver", lambda: ("10.9", None, "x84_64")) 392s monkeypatch.setattr(platform, "machine", lambda: "x86_64") 392s monkeypatch.setattr(sys, "platform", "darwin") 392s 392s with push_env(MACOSX_DEPLOYMENT_TARGET=osx_deployment_target_env_var): 392s monkeypatch.setattr(skbuild.constants, "_SKBUILD_PLAT_NAME", skbuild.constants._default_skbuild_plat_name()) 392s with pytest.raises(RuntimeError, match="exit skbuild"): 392s > with execute_setup_py(tmp_dir, ["build", *cli_setup_args, "--", *cli_cmake_args]): 392s 392s cli_cmake_args = [] 392s cli_setup_args = ['--plat-name', 'macosx-10.6-x86_64'] 392s expected_cmake_osx_deployment_target = '10.6' 392s keyword_cmake_args = [] 392s mock_configure = 392s mocker = 392s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7537dfb3ed20> 392s osx_deployment_target_env_var = None 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-55/cmake_args_keyword_osx_default0') 392s 392s tests/test_issue342_cmake_osx_args_in_setup.py:176: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-55/cmake_args_keyword_osx_default0') 392s setup_args = ['build', '--plat-name', 'macosx-10.6-x86_64', '--'] 392s disable_languages_test = False 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = False 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-55/cmake_args_keyword_osx_default0') 392s setup_args = ['build', '--plat-name', 'macosx-10.6-x86_64', '--'] 392s 392s tests/__init__.py:218: AttributeError 392s _ test_cmake_args_keyword_osx_default[None-cli_setup_args4-keyword_cmake_args4-cli_cmake_args4-10.7] _ 392s 392s osx_deployment_target_env_var = None 392s cli_setup_args = ['--plat-name', 'macosx-10.7-x86_64'], keyword_cmake_args = [] 392s cli_cmake_args = [], expected_cmake_osx_deployment_target = '10.7' 392s mocker = 392s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7537dfb3ce60> 392s 392s @pytest.mark.parametrize( 392s params, 392s [ 392s # default plat_name is 'macosx-10.9-x86_64' 392s ( 392s # osx_deployment_target_env_var 392s None, 392s # cli_setup_args 392s [], 392s # keyword_cmake_args 392s [], 392s # cli_cmake_args 392s [], 392s # expected_cmake_osx_deployment_target 392s "10.9", 392s ), 392s ( 392s # osx_deployment_target_env_var 392s "10.7", 392s # cli_setup_args 392s [], 392s # keyword_cmake_args 392s [], 392s # cli_cmake_args 392s [], 392s # expected_cmake_osx_deployment_target 392s "10.7", 392s ), 392s ( 392s # osx_deployment_target_env_var 392s "10.7", 392s # cli_setup_args 392s ["--plat-name", "macosx-10.9-x86_64"], 392s # keyword_cmake_args 392s [], 392s # cli_cmake_args 392s [], 392s # expected_cmake_osx_deployment_target 392s "10.9", 392s ), 392s ( 392s # osx_deployment_target_env_var 392s None, 392s # cli_setup_args 392s ["--plat-name", "macosx-10.6-x86_64"], 392s # keyword_cmake_args 392s [], 392s # cli_cmake_args 392s [], 392s # expected_cmake_osx_deployment_target 392s "10.6", 392s ), 392s ( 392s # osx_deployment_target_env_var 392s None, 392s # cli_setup_args 392s ["--plat-name", "macosx-10.7-x86_64"], 392s # keyword_cmake_args 392s [], 392s # cli_cmake_args 392s [], 392s # expected_cmake_osx_deployment_target 392s "10.7", 392s ), 392s ( 392s # osx_deployment_target_env_var 392s None, 392s # cli_setup_args 392s [], 392s # keyword_cmake_args 392s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 392s # cli_cmake_args 392s [], 392s # expected_cmake_osx_deployment_target 392s "10.7", 392s ), 392s ( 392s # osx_deployment_target_env_var 392s None, 392s # cli_setup_args 392s ["--plat-name", "macosx-10.12-x86_64"], 392s # keyword_cmake_args 392s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 392s # cli_cmake_args 392s [], 392s # expected_cmake_osx_deployment_target 392s "10.7", 392s ), 392s ( 392s # osx_deployment_target_env_var 392s None, 392s # cli_setup_args 392s [], 392s # keyword_cmake_args 392s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 392s # cli_cmake_args 392s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 392s # expected_cmake_osx_deployment_target 392s "10.8", 392s ), 392s ( 392s # osx_deployment_target_env_var 392s None, 392s # cli_setup_args 392s ["--plat-name", "macosx-10.12-x86_64"], 392s # keyword_cmake_args 392s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 392s # cli_cmake_args 392s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 392s # expected_cmake_osx_deployment_target 392s "10.8", 392s ), 392s ], 392s ) 392s def test_cmake_args_keyword_osx_default( 392s osx_deployment_target_env_var, 392s cli_setup_args, 392s keyword_cmake_args, 392s cli_cmake_args, 392s expected_cmake_osx_deployment_target, 392s mocker, 392s monkeypatch, 392s ): 392s tmp_dir = _tmpdir("cmake_args_keyword_osx_default") 392s 392s tmp_dir.join("setup.py").write( 392s textwrap.dedent( 392s """ 392s from skbuild import setup 392s setup( 392s name="test_cmake_args_keyword_osx_default", 392s version="1.2.3", 392s description="A minimal example package", 392s author="The scikit-build team", 392s license="MIT", 392s cmake_args=[{cmake_args}] 392s ) 392s """.format(cmake_args=",".join([f"'{arg}'" for arg in keyword_cmake_args])) 392s ) 392s ) 392s tmp_dir.join("CMakeLists.txt").write( 392s textwrap.dedent( 392s """ 392s message(FATAL_ERROR "This error message should not be displayed") 392s """ 392s ) 392s ) 392s 392s mock_configure = mocker.patch("skbuild.cmaker.CMaker.configure", side_effect=RuntimeError("exit skbuild")) 392s 392s monkeypatch.setattr(platform, "mac_ver", lambda: ("10.9", None, "x84_64")) 392s monkeypatch.setattr(platform, "machine", lambda: "x86_64") 392s monkeypatch.setattr(sys, "platform", "darwin") 392s 392s with push_env(MACOSX_DEPLOYMENT_TARGET=osx_deployment_target_env_var): 392s monkeypatch.setattr(skbuild.constants, "_SKBUILD_PLAT_NAME", skbuild.constants._default_skbuild_plat_name()) 392s with pytest.raises(RuntimeError, match="exit skbuild"): 392s > with execute_setup_py(tmp_dir, ["build", *cli_setup_args, "--", *cli_cmake_args]): 392s 392s cli_cmake_args = [] 392s cli_setup_args = ['--plat-name', 'macosx-10.7-x86_64'] 392s expected_cmake_osx_deployment_target = '10.7' 392s keyword_cmake_args = [] 392s mock_configure = 392s mocker = 392s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7537dfb3ce60> 392s osx_deployment_target_env_var = None 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-56/cmake_args_keyword_osx_default0') 392s 392s tests/test_issue342_cmake_osx_args_in_setup.py:176: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-56/cmake_args_keyword_osx_default0') 392s setup_args = ['build', '--plat-name', 'macosx-10.7-x86_64', '--'] 392s disable_languages_test = False 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = False 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-56/cmake_args_keyword_osx_default0') 392s setup_args = ['build', '--plat-name', 'macosx-10.7-x86_64', '--'] 392s 392s tests/__init__.py:218: AttributeError 392s _ test_cmake_args_keyword_osx_default[None-cli_setup_args5-keyword_cmake_args5-cli_cmake_args5-10.7] _ 392s 392s osx_deployment_target_env_var = None, cli_setup_args = [] 392s keyword_cmake_args = ['-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7'] 392s cli_cmake_args = [], expected_cmake_osx_deployment_target = '10.7' 392s mocker = 392s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7537dfb23650> 392s 392s @pytest.mark.parametrize( 392s params, 392s [ 392s # default plat_name is 'macosx-10.9-x86_64' 392s ( 392s # osx_deployment_target_env_var 392s None, 392s # cli_setup_args 392s [], 392s # keyword_cmake_args 392s [], 392s # cli_cmake_args 392s [], 392s # expected_cmake_osx_deployment_target 392s "10.9", 392s ), 392s ( 392s # osx_deployment_target_env_var 392s "10.7", 392s # cli_setup_args 392s [], 392s # keyword_cmake_args 392s [], 392s # cli_cmake_args 392s [], 392s # expected_cmake_osx_deployment_target 392s "10.7", 392s ), 392s ( 392s # osx_deployment_target_env_var 392s "10.7", 392s # cli_setup_args 392s ["--plat-name", "macosx-10.9-x86_64"], 392s # keyword_cmake_args 392s [], 392s # cli_cmake_args 392s [], 392s # expected_cmake_osx_deployment_target 392s "10.9", 392s ), 392s ( 392s # osx_deployment_target_env_var 392s None, 392s # cli_setup_args 392s ["--plat-name", "macosx-10.6-x86_64"], 392s # keyword_cmake_args 392s [], 392s # cli_cmake_args 392s [], 392s # expected_cmake_osx_deployment_target 392s "10.6", 392s ), 392s ( 392s # osx_deployment_target_env_var 392s None, 392s # cli_setup_args 392s ["--plat-name", "macosx-10.7-x86_64"], 392s # keyword_cmake_args 392s [], 392s # cli_cmake_args 392s [], 392s # expected_cmake_osx_deployment_target 392s "10.7", 392s ), 392s ( 392s # osx_deployment_target_env_var 392s None, 392s # cli_setup_args 392s [], 392s # keyword_cmake_args 392s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 392s # cli_cmake_args 392s [], 392s # expected_cmake_osx_deployment_target 392s "10.7", 392s ), 392s ( 392s # osx_deployment_target_env_var 392s None, 392s # cli_setup_args 392s ["--plat-name", "macosx-10.12-x86_64"], 392s # keyword_cmake_args 392s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 392s # cli_cmake_args 392s [], 392s # expected_cmake_osx_deployment_target 392s "10.7", 392s ), 392s ( 392s # osx_deployment_target_env_var 392s None, 392s # cli_setup_args 392s [], 392s # keyword_cmake_args 392s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 392s # cli_cmake_args 392s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 392s # expected_cmake_osx_deployment_target 392s "10.8", 392s ), 392s ( 392s # osx_deployment_target_env_var 392s None, 392s # cli_setup_args 392s ["--plat-name", "macosx-10.12-x86_64"], 392s # keyword_cmake_args 392s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 392s # cli_cmake_args 392s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 392s # expected_cmake_osx_deployment_target 392s "10.8", 392s ), 392s ], 392s ) 392s def test_cmake_args_keyword_osx_default( 392s osx_deployment_target_env_var, 392s cli_setup_args, 392s keyword_cmake_args, 392s cli_cmake_args, 392s expected_cmake_osx_deployment_target, 392s mocker, 392s monkeypatch, 392s ): 392s tmp_dir = _tmpdir("cmake_args_keyword_osx_default") 392s 392s tmp_dir.join("setup.py").write( 392s textwrap.dedent( 392s """ 392s from skbuild import setup 392s setup( 392s name="test_cmake_args_keyword_osx_default", 392s version="1.2.3", 392s description="A minimal example package", 392s author="The scikit-build team", 392s license="MIT", 392s cmake_args=[{cmake_args}] 392s ) 392s """.format(cmake_args=",".join([f"'{arg}'" for arg in keyword_cmake_args])) 392s ) 392s ) 392s tmp_dir.join("CMakeLists.txt").write( 392s textwrap.dedent( 392s """ 392s message(FATAL_ERROR "This error message should not be displayed") 392s """ 392s ) 392s ) 392s 392s mock_configure = mocker.patch("skbuild.cmaker.CMaker.configure", side_effect=RuntimeError("exit skbuild")) 392s 392s monkeypatch.setattr(platform, "mac_ver", lambda: ("10.9", None, "x84_64")) 392s monkeypatch.setattr(platform, "machine", lambda: "x86_64") 392s monkeypatch.setattr(sys, "platform", "darwin") 392s 392s with push_env(MACOSX_DEPLOYMENT_TARGET=osx_deployment_target_env_var): 392s monkeypatch.setattr(skbuild.constants, "_SKBUILD_PLAT_NAME", skbuild.constants._default_skbuild_plat_name()) 392s with pytest.raises(RuntimeError, match="exit skbuild"): 392s > with execute_setup_py(tmp_dir, ["build", *cli_setup_args, "--", *cli_cmake_args]): 392s 392s cli_cmake_args = [] 392s cli_setup_args = [] 392s expected_cmake_osx_deployment_target = '10.7' 392s keyword_cmake_args = ['-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7'] 392s mock_configure = 392s mocker = 392s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7537dfb23650> 392s osx_deployment_target_env_var = None 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-57/cmake_args_keyword_osx_default0') 392s 392s tests/test_issue342_cmake_osx_args_in_setup.py:176: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-57/cmake_args_keyword_osx_default0') 392s setup_args = ['build', '--'], disable_languages_test = False 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = False 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-57/cmake_args_keyword_osx_default0') 392s setup_args = ['build', '--'] 392s 392s tests/__init__.py:218: AttributeError 392s _ test_cmake_args_keyword_osx_default[None-cli_setup_args6-keyword_cmake_args6-cli_cmake_args6-10.7] _ 392s 392s osx_deployment_target_env_var = None 392s cli_setup_args = ['--plat-name', 'macosx-10.12-x86_64'] 392s keyword_cmake_args = ['-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7'] 392s cli_cmake_args = [], expected_cmake_osx_deployment_target = '10.7' 392s mocker = 392s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7537dfbd01d0> 392s 392s @pytest.mark.parametrize( 392s params, 392s [ 392s # default plat_name is 'macosx-10.9-x86_64' 392s ( 392s # osx_deployment_target_env_var 392s None, 392s # cli_setup_args 392s [], 392s # keyword_cmake_args 392s [], 392s # cli_cmake_args 392s [], 392s # expected_cmake_osx_deployment_target 392s "10.9", 392s ), 392s ( 392s # osx_deployment_target_env_var 392s "10.7", 392s # cli_setup_args 392s [], 392s # keyword_cmake_args 392s [], 392s # cli_cmake_args 392s [], 392s # expected_cmake_osx_deployment_target 392s "10.7", 392s ), 392s ( 392s # osx_deployment_target_env_var 392s "10.7", 392s # cli_setup_args 392s ["--plat-name", "macosx-10.9-x86_64"], 392s # keyword_cmake_args 392s [], 392s # cli_cmake_args 392s [], 392s # expected_cmake_osx_deployment_target 392s "10.9", 392s ), 392s ( 392s # osx_deployment_target_env_var 392s None, 392s # cli_setup_args 392s ["--plat-name", "macosx-10.6-x86_64"], 392s # keyword_cmake_args 392s [], 392s # cli_cmake_args 392s [], 392s # expected_cmake_osx_deployment_target 392s "10.6", 392s ), 392s ( 392s # osx_deployment_target_env_var 392s None, 392s # cli_setup_args 392s ["--plat-name", "macosx-10.7-x86_64"], 392s # keyword_cmake_args 392s [], 392s # cli_cmake_args 392s [], 392s # expected_cmake_osx_deployment_target 392s "10.7", 392s ), 392s ( 392s # osx_deployment_target_env_var 392s None, 392s # cli_setup_args 392s [], 392s # keyword_cmake_args 392s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 392s # cli_cmake_args 392s [], 392s # expected_cmake_osx_deployment_target 392s "10.7", 392s ), 392s ( 392s # osx_deployment_target_env_var 392s None, 392s # cli_setup_args 392s ["--plat-name", "macosx-10.12-x86_64"], 392s # keyword_cmake_args 392s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 392s # cli_cmake_args 392s [], 392s # expected_cmake_osx_deployment_target 392s "10.7", 392s ), 392s ( 392s # osx_deployment_target_env_var 392s None, 392s # cli_setup_args 392s [], 392s # keyword_cmake_args 392s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 392s # cli_cmake_args 392s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 392s # expected_cmake_osx_deployment_target 392s "10.8", 392s ), 392s ( 392s # osx_deployment_target_env_var 392s None, 392s # cli_setup_args 392s ["--plat-name", "macosx-10.12-x86_64"], 392s # keyword_cmake_args 392s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 392s # cli_cmake_args 392s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 392s # expected_cmake_osx_deployment_target 392s "10.8", 392s ), 392s ], 392s ) 392s def test_cmake_args_keyword_osx_default( 392s osx_deployment_target_env_var, 392s cli_setup_args, 392s keyword_cmake_args, 392s cli_cmake_args, 392s expected_cmake_osx_deployment_target, 392s mocker, 392s monkeypatch, 392s ): 392s tmp_dir = _tmpdir("cmake_args_keyword_osx_default") 392s 392s tmp_dir.join("setup.py").write( 392s textwrap.dedent( 392s """ 392s from skbuild import setup 392s setup( 392s name="test_cmake_args_keyword_osx_default", 392s version="1.2.3", 392s description="A minimal example package", 392s author="The scikit-build team", 392s license="MIT", 392s cmake_args=[{cmake_args}] 392s ) 392s """.format(cmake_args=",".join([f"'{arg}'" for arg in keyword_cmake_args])) 392s ) 392s ) 392s tmp_dir.join("CMakeLists.txt").write( 392s textwrap.dedent( 392s """ 392s message(FATAL_ERROR "This error message should not be displayed") 392s """ 392s ) 392s ) 392s 392s mock_configure = mocker.patch("skbuild.cmaker.CMaker.configure", side_effect=RuntimeError("exit skbuild")) 392s 392s monkeypatch.setattr(platform, "mac_ver", lambda: ("10.9", None, "x84_64")) 392s monkeypatch.setattr(platform, "machine", lambda: "x86_64") 392s monkeypatch.setattr(sys, "platform", "darwin") 392s 392s with push_env(MACOSX_DEPLOYMENT_TARGET=osx_deployment_target_env_var): 392s monkeypatch.setattr(skbuild.constants, "_SKBUILD_PLAT_NAME", skbuild.constants._default_skbuild_plat_name()) 392s with pytest.raises(RuntimeError, match="exit skbuild"): 392s > with execute_setup_py(tmp_dir, ["build", *cli_setup_args, "--", *cli_cmake_args]): 392s 392s cli_cmake_args = [] 392s cli_setup_args = ['--plat-name', 'macosx-10.12-x86_64'] 392s expected_cmake_osx_deployment_target = '10.7' 392s keyword_cmake_args = ['-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7'] 392s mock_configure = 392s mocker = 392s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7537dfbd01d0> 392s osx_deployment_target_env_var = None 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-58/cmake_args_keyword_osx_default0') 392s 392s tests/test_issue342_cmake_osx_args_in_setup.py:176: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-58/cmake_args_keyword_osx_default0') 392s setup_args = ['build', '--plat-name', 'macosx-10.12-x86_64', '--'] 392s disable_languages_test = False 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = False 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-58/cmake_args_keyword_osx_default0') 392s setup_args = ['build', '--plat-name', 'macosx-10.12-x86_64', '--'] 392s 392s tests/__init__.py:218: AttributeError 392s _ test_cmake_args_keyword_osx_default[None-cli_setup_args7-keyword_cmake_args7-cli_cmake_args7-10.8] _ 392s 392s osx_deployment_target_env_var = None, cli_setup_args = [] 392s keyword_cmake_args = ['-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7'] 392s cli_cmake_args = ['-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8'] 392s expected_cmake_osx_deployment_target = '10.8' 392s mocker = 392s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7537dfb81040> 392s 392s @pytest.mark.parametrize( 392s params, 392s [ 392s # default plat_name is 'macosx-10.9-x86_64' 392s ( 392s # osx_deployment_target_env_var 392s None, 392s # cli_setup_args 392s [], 392s # keyword_cmake_args 392s [], 392s # cli_cmake_args 392s [], 392s # expected_cmake_osx_deployment_target 392s "10.9", 392s ), 392s ( 392s # osx_deployment_target_env_var 392s "10.7", 392s # cli_setup_args 392s [], 392s # keyword_cmake_args 392s [], 392s # cli_cmake_args 392s [], 392s # expected_cmake_osx_deployment_target 392s "10.7", 392s ), 392s ( 392s # osx_deployment_target_env_var 392s "10.7", 392s # cli_setup_args 392s ["--plat-name", "macosx-10.9-x86_64"], 392s # keyword_cmake_args 392s [], 392s # cli_cmake_args 392s [], 392s # expected_cmake_osx_deployment_target 392s "10.9", 392s ), 392s ( 392s # osx_deployment_target_env_var 392s None, 392s # cli_setup_args 392s ["--plat-name", "macosx-10.6-x86_64"], 392s # keyword_cmake_args 392s [], 392s # cli_cmake_args 392s [], 392s # expected_cmake_osx_deployment_target 392s "10.6", 392s ), 392s ( 392s # osx_deployment_target_env_var 392s None, 392s # cli_setup_args 392s ["--plat-name", "macosx-10.7-x86_64"], 392s # keyword_cmake_args 392s [], 392s # cli_cmake_args 392s [], 392s # expected_cmake_osx_deployment_target 392s "10.7", 392s ), 392s ( 392s # osx_deployment_target_env_var 392s None, 392s # cli_setup_args 392s [], 392s # keyword_cmake_args 392s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 392s # cli_cmake_args 392s [], 392s # expected_cmake_osx_deployment_target 392s "10.7", 392s ), 392s ( 392s # osx_deployment_target_env_var 392s None, 392s # cli_setup_args 392s ["--plat-name", "macosx-10.12-x86_64"], 392s # keyword_cmake_args 392s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 392s # cli_cmake_args 392s [], 392s # expected_cmake_osx_deployment_target 392s "10.7", 392s ), 392s ( 392s # osx_deployment_target_env_var 392s None, 392s # cli_setup_args 392s [], 392s # keyword_cmake_args 392s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 392s # cli_cmake_args 392s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 392s # expected_cmake_osx_deployment_target 392s "10.8", 392s ), 392s ( 392s # osx_deployment_target_env_var 392s None, 392s # cli_setup_args 392s ["--plat-name", "macosx-10.12-x86_64"], 392s # keyword_cmake_args 392s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 392s # cli_cmake_args 392s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 392s # expected_cmake_osx_deployment_target 392s "10.8", 392s ), 392s ], 392s ) 392s def test_cmake_args_keyword_osx_default( 392s osx_deployment_target_env_var, 392s cli_setup_args, 392s keyword_cmake_args, 392s cli_cmake_args, 392s expected_cmake_osx_deployment_target, 392s mocker, 392s monkeypatch, 392s ): 392s tmp_dir = _tmpdir("cmake_args_keyword_osx_default") 392s 392s tmp_dir.join("setup.py").write( 392s textwrap.dedent( 392s """ 392s from skbuild import setup 392s setup( 392s name="test_cmake_args_keyword_osx_default", 392s version="1.2.3", 392s description="A minimal example package", 392s author="The scikit-build team", 392s license="MIT", 392s cmake_args=[{cmake_args}] 392s ) 392s """.format(cmake_args=",".join([f"'{arg}'" for arg in keyword_cmake_args])) 392s ) 392s ) 392s tmp_dir.join("CMakeLists.txt").write( 392s textwrap.dedent( 392s """ 392s message(FATAL_ERROR "This error message should not be displayed") 392s """ 392s ) 392s ) 392s 392s mock_configure = mocker.patch("skbuild.cmaker.CMaker.configure", side_effect=RuntimeError("exit skbuild")) 392s 392s monkeypatch.setattr(platform, "mac_ver", lambda: ("10.9", None, "x84_64")) 392s monkeypatch.setattr(platform, "machine", lambda: "x86_64") 392s monkeypatch.setattr(sys, "platform", "darwin") 392s 392s with push_env(MACOSX_DEPLOYMENT_TARGET=osx_deployment_target_env_var): 392s monkeypatch.setattr(skbuild.constants, "_SKBUILD_PLAT_NAME", skbuild.constants._default_skbuild_plat_name()) 392s with pytest.raises(RuntimeError, match="exit skbuild"): 392s > with execute_setup_py(tmp_dir, ["build", *cli_setup_args, "--", *cli_cmake_args]): 392s 392s cli_cmake_args = ['-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8'] 392s cli_setup_args = [] 392s expected_cmake_osx_deployment_target = '10.8' 392s keyword_cmake_args = ['-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7'] 392s mock_configure = 392s mocker = 392s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7537dfb81040> 392s osx_deployment_target_env_var = None 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-59/cmake_args_keyword_osx_default0') 392s 392s tests/test_issue342_cmake_osx_args_in_setup.py:176: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-59/cmake_args_keyword_osx_default0') 392s setup_args = ['build', '--', '-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8'] 392s disable_languages_test = False 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = False 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-59/cmake_args_keyword_osx_default0') 392s setup_args = ['build', '--', '-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8'] 392s 392s tests/__init__.py:218: AttributeError 392s _ test_cmake_args_keyword_osx_default[None-cli_setup_args8-keyword_cmake_args8-cli_cmake_args8-10.8] _ 392s 392s osx_deployment_target_env_var = None 392s cli_setup_args = ['--plat-name', 'macosx-10.12-x86_64'] 392s keyword_cmake_args = ['-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7'] 392s cli_cmake_args = ['-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8'] 392s expected_cmake_osx_deployment_target = '10.8' 392s mocker = 392s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7537dfbc3650> 392s 392s @pytest.mark.parametrize( 392s params, 392s [ 392s # default plat_name is 'macosx-10.9-x86_64' 392s ( 392s # osx_deployment_target_env_var 392s None, 392s # cli_setup_args 392s [], 392s # keyword_cmake_args 392s [], 392s # cli_cmake_args 392s [], 392s # expected_cmake_osx_deployment_target 392s "10.9", 392s ), 392s ( 392s # osx_deployment_target_env_var 392s "10.7", 392s # cli_setup_args 392s [], 392s # keyword_cmake_args 392s [], 392s # cli_cmake_args 392s [], 392s # expected_cmake_osx_deployment_target 392s "10.7", 392s ), 392s ( 392s # osx_deployment_target_env_var 392s "10.7", 392s # cli_setup_args 392s ["--plat-name", "macosx-10.9-x86_64"], 392s # keyword_cmake_args 392s [], 392s # cli_cmake_args 392s [], 392s # expected_cmake_osx_deployment_target 392s "10.9", 392s ), 392s ( 392s # osx_deployment_target_env_var 392s None, 392s # cli_setup_args 392s ["--plat-name", "macosx-10.6-x86_64"], 392s # keyword_cmake_args 392s [], 392s # cli_cmake_args 392s [], 392s # expected_cmake_osx_deployment_target 392s "10.6", 392s ), 392s ( 392s # osx_deployment_target_env_var 392s None, 392s # cli_setup_args 392s ["--plat-name", "macosx-10.7-x86_64"], 392s # keyword_cmake_args 392s [], 392s # cli_cmake_args 392s [], 392s # expected_cmake_osx_deployment_target 392s "10.7", 392s ), 392s ( 392s # osx_deployment_target_env_var 392s None, 392s # cli_setup_args 392s [], 392s # keyword_cmake_args 392s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 392s # cli_cmake_args 392s [], 392s # expected_cmake_osx_deployment_target 392s "10.7", 392s ), 392s ( 392s # osx_deployment_target_env_var 392s None, 392s # cli_setup_args 392s ["--plat-name", "macosx-10.12-x86_64"], 392s # keyword_cmake_args 392s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 392s # cli_cmake_args 392s [], 392s # expected_cmake_osx_deployment_target 392s "10.7", 392s ), 392s ( 392s # osx_deployment_target_env_var 392s None, 392s # cli_setup_args 392s [], 392s # keyword_cmake_args 392s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 392s # cli_cmake_args 392s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 392s # expected_cmake_osx_deployment_target 392s "10.8", 392s ), 392s ( 392s # osx_deployment_target_env_var 392s None, 392s # cli_setup_args 392s ["--plat-name", "macosx-10.12-x86_64"], 392s # keyword_cmake_args 392s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 392s # cli_cmake_args 392s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 392s # expected_cmake_osx_deployment_target 392s "10.8", 392s ), 392s ], 392s ) 392s def test_cmake_args_keyword_osx_default( 392s osx_deployment_target_env_var, 392s cli_setup_args, 392s keyword_cmake_args, 392s cli_cmake_args, 392s expected_cmake_osx_deployment_target, 392s mocker, 392s monkeypatch, 392s ): 392s tmp_dir = _tmpdir("cmake_args_keyword_osx_default") 392s 392s tmp_dir.join("setup.py").write( 392s textwrap.dedent( 392s """ 392s from skbuild import setup 392s setup( 392s name="test_cmake_args_keyword_osx_default", 392s version="1.2.3", 392s description="A minimal example package", 392s author="The scikit-build team", 392s license="MIT", 392s cmake_args=[{cmake_args}] 392s ) 392s """.format(cmake_args=",".join([f"'{arg}'" for arg in keyword_cmake_args])) 392s ) 392s ) 392s tmp_dir.join("CMakeLists.txt").write( 392s textwrap.dedent( 392s """ 392s message(FATAL_ERROR "This error message should not be displayed") 392s """ 392s ) 392s ) 392s 392s mock_configure = mocker.patch("skbuild.cmaker.CMaker.configure", side_effect=RuntimeError("exit skbuild")) 392s 392s monkeypatch.setattr(platform, "mac_ver", lambda: ("10.9", None, "x84_64")) 392s monkeypatch.setattr(platform, "machine", lambda: "x86_64") 392s monkeypatch.setattr(sys, "platform", "darwin") 392s 392s with push_env(MACOSX_DEPLOYMENT_TARGET=osx_deployment_target_env_var): 392s monkeypatch.setattr(skbuild.constants, "_SKBUILD_PLAT_NAME", skbuild.constants._default_skbuild_plat_name()) 392s with pytest.raises(RuntimeError, match="exit skbuild"): 392s > with execute_setup_py(tmp_dir, ["build", *cli_setup_args, "--", *cli_cmake_args]): 392s 392s cli_cmake_args = ['-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8'] 392s cli_setup_args = ['--plat-name', 'macosx-10.12-x86_64'] 392s expected_cmake_osx_deployment_target = '10.8' 392s keyword_cmake_args = ['-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7'] 392s mock_configure = 392s mocker = 392s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7537dfbc3650> 392s osx_deployment_target_env_var = None 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-60/cmake_args_keyword_osx_default0') 392s 392s tests/test_issue342_cmake_osx_args_in_setup.py:176: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-60/cmake_args_keyword_osx_default0') 392s setup_args = ['build', '--plat-name', 'macosx-10.12-x86_64', '--', '-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8'] 392s disable_languages_test = False 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = False 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-60/cmake_args_keyword_osx_default0') 392s setup_args = ['build', '--plat-name', 'macosx-10.12-x86_64', '--', '-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8'] 392s 392s tests/__init__.py:218: AttributeError 392s ____________________ test_isolated_env_trigger_reconfigure _____________________ 392s 392s mocker = 392s 392s def test_isolated_env_trigger_reconfigure(mocker): 392s tmp_dir = _tmpdir("isolated_env_trigger_reconfigure") 392s 392s tmp_dir.join("setup.py").write( 392s textwrap.dedent( 392s """ 392s from skbuild import setup 392s setup( 392s name="test_isolated_env_trigger_reconfigure", 392s version="1.2.3", 392s description="A minimal example package", 392s author="The scikit-build team", 392s license="MIT", 392s ) 392s """ 392s ) 392s ) 392s tmp_dir.join("CMakeLists.txt").write( 392s textwrap.dedent( 392s """ 392s message(FATAL_ERROR "This error message should not be displayed") 392s """ 392s ) 392s ) 392s 392s # 392s # mock configure 392s # 392s def fake_configure(*args, **kwargs): 392s # Simulate a successful configuration creating a CMakeCache.txt 392s tmp_dir.ensure(CMAKE_BUILD_DIR(), dir=1).join("CMakeCache.txt").write( 392s textwrap.dedent( 392s """ 392s //Name of generator. 392s CMAKE_GENERATOR:INTERNAL=Ninja 392s """ 392s ) 392s ) 392s 392s # Skip real configuration creating the CMakeCache.txt expected by 392s # "skbuild.setuptools_wrap._load_cmake_spec()" function 392s mocker.patch("skbuild.cmaker.CMaker.configure", new=fake_configure) 392s 392s # 392s # mock _save_cmake_spec 392s # 392s _save_cmake_spec_original = skbuild.setuptools_wrap._save_cmake_spec 392s 392s exit_after_saving_cmake_spec = "exit skbuild saving cmake spec" 392s 392s def _save_cmake_spec_mock(args): 392s _save_cmake_spec_original(args) 392s raise RuntimeError(exit_after_saving_cmake_spec) 392s 392s mocker.patch("skbuild.setuptools_wrap._save_cmake_spec", new=_save_cmake_spec_mock) 392s 392s # 392s # mock make 392s # 392s exit_before_running_cmake = "exit skbuild running make" 392s mocker.patch("skbuild.cmaker.CMaker.make", side_effect=RuntimeError(exit_before_running_cmake)) 392s 392s # first build: "configure" and "_save_cmake_spec" are expected to be called 392s with pytest.raises(RuntimeError, match=exit_after_saving_cmake_spec): 392s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 392s 392s _save_cmake_spec_mock = ._save_cmake_spec_mock at 0x7537dfb11260> 392s _save_cmake_spec_original = 392s exit_after_saving_cmake_spec = 'exit skbuild saving cmake spec' 392s exit_before_running_cmake = 'exit skbuild running make' 392s fake_configure = .fake_configure at 0x7537dfb105e0> 392s mocker = 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-61/isolated_env_trigger_reconfigu0') 392s 392s tests/test_issue352_isolated_environment_support.py:78: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-61/isolated_env_trigger_reconfigu0') 392s setup_args = ['build'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-61/isolated_env_trigger_reconfigu0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s __________________________ test_symbol_visibility[ON] __________________________ 392s 392s skip_override = 'ON' 392s 392s @pytest.mark.skipif( 392s platform.system().lower() not in ["linux"], reason="Executable and Linkable Format (ELF) is specific to Linux" 392s ) 392s @pytest.mark.parametrize("skip_override", ["ON", "OFF"]) 392s def test_symbol_visibility(skip_override): 392s with push_dir(): 392s tmp_dir = _tmpdir("test_issue668_symbol_visibility") 392s project = "issue-668-symbol-visibility" 392s prepare_project(project, tmp_dir) 392s initialize_git_repo_and_commit(tmp_dir, verbose=True) 392s 392s > with execute_setup_py( 392s tmp_dir, ["build", f"-DSKBUILD_GNU_SKIP_LOCAL_SYMBOL_EXPORT_OVERRIDE:BOOL={skip_override}"] 392s ): 392s 392s project = 'issue-668-symbol-visibility' 392s skip_override = 'ON' 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-62/test_issue668_symbol_visibilit0') 392s 392s tests/test_issue668_symbol_visibility.py:32: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-62/test_issue668_symbol_visibilit0') 392s setup_args = ['build', '-DSKBUILD_GNU_SKIP_LOCAL_SYMBOL_EXPORT_OVERRIDE:BOOL=ON'] 392s disable_languages_test = False 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = False 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-62/test_issue668_symbol_visibilit0') 392s setup_args = ['build', '-DSKBUILD_GNU_SKIP_LOCAL_SYMBOL_EXPORT_OVERRIDE:BOOL=ON'] 392s 392s tests/__init__.py:218: AttributeError 392s ----------------------------- Captured stdout call ----------------------------- 392s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-62/test_issue668_symbol_visibilit0/.git/ 392s [master (root-commit) c793e09] Initial commit 392s 5 files changed, 121 insertions(+) 392s create mode 100644 CMakeLists.txt 392s create mode 100644 hello/__init__.py 392s create mode 100644 hello/_hello.cxx 392s create mode 100644 pyproject.toml 392s create mode 100644 setup.py 392s ----------------------------- Captured stderr call ----------------------------- 392s hint: Using 'master' as the name for the initial branch. This default branch name 392s hint: is subject to change. To configure the initial branch name to use in all 392s hint: of your new repositories, which will suppress this warning, call: 392s hint: 392s hint: git config --global init.defaultBranch 392s hint: 392s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 392s hint: 'development'. The just-created branch can be renamed via this command: 392s hint: 392s hint: git branch -m 392s _________________________ test_symbol_visibility[OFF] __________________________ 392s 392s skip_override = 'OFF' 392s 392s @pytest.mark.skipif( 392s platform.system().lower() not in ["linux"], reason="Executable and Linkable Format (ELF) is specific to Linux" 392s ) 392s @pytest.mark.parametrize("skip_override", ["ON", "OFF"]) 392s def test_symbol_visibility(skip_override): 392s with push_dir(): 392s tmp_dir = _tmpdir("test_issue668_symbol_visibility") 392s project = "issue-668-symbol-visibility" 392s prepare_project(project, tmp_dir) 392s initialize_git_repo_and_commit(tmp_dir, verbose=True) 392s 392s > with execute_setup_py( 392s tmp_dir, ["build", f"-DSKBUILD_GNU_SKIP_LOCAL_SYMBOL_EXPORT_OVERRIDE:BOOL={skip_override}"] 392s ): 392s 392s project = 'issue-668-symbol-visibility' 392s skip_override = 'OFF' 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-63/test_issue668_symbol_visibilit0') 392s 392s tests/test_issue668_symbol_visibility.py:32: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-63/test_issue668_symbol_visibilit0') 392s setup_args = ['build', '-DSKBUILD_GNU_SKIP_LOCAL_SYMBOL_EXPORT_OVERRIDE:BOOL=OFF'] 392s disable_languages_test = False 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = False 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-63/test_issue668_symbol_visibilit0') 392s setup_args = ['build', '-DSKBUILD_GNU_SKIP_LOCAL_SYMBOL_EXPORT_OVERRIDE:BOOL=OFF'] 392s 392s tests/__init__.py:218: AttributeError 392s ----------------------------- Captured stdout call ----------------------------- 392s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-63/test_issue668_symbol_visibilit0/.git/ 392s [master (root-commit) c793e09] Initial commit 392s 5 files changed, 121 insertions(+) 392s create mode 100644 CMakeLists.txt 392s create mode 100644 hello/__init__.py 392s create mode 100644 hello/_hello.cxx 392s create mode 100644 pyproject.toml 392s create mode 100644 setup.py 392s ----------------------------- Captured stderr call ----------------------------- 392s hint: Using 'master' as the name for the initial branch. This default branch name 392s hint: is subject to change. To configure the initial branch name to use in all 392s hint: of your new repositories, which will suppress this warning, call: 392s hint: 392s hint: git config --global init.defaultBranch 392s hint: 392s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 392s hint: 'development'. The just-created branch can be renamed via this command: 392s hint: 392s hint: git branch -m 392s ____________________________ test_manifest_in_wheel ____________________________ 392s 392s iargs = (), ikwargs = {} 392s 392s @functools.wraps(fun) 392s def wrapped(*iargs, **ikwargs): 392s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 392s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 392s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 392s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 392s 392s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 392s 392s disable_languages_test = True 392s fun = 392s iargs = () 392s ikwargs = {} 392s ret = False 392s wrapped = 392s 392s tests/__init__.py:255: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-64/test_manifest_in_wheel0') 392s setup_args = ['bdist_wheel'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-64/test_manifest_in_wheel0') 392s setup_args = ['bdist_wheel'] 392s 392s tests/__init__.py:218: AttributeError 392s ----------------------------- Captured stdout call ----------------------------- 392s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-64/test_manifest_in_wheel0/.git/ 392s [master (root-commit) 7da1009] Initial commit 392s 4 files changed, 14 insertions(+) 392s create mode 100644 MANIFEST.in 392s create mode 100644 hello/__init__.py 392s create mode 100644 not_included.txt 392s create mode 100644 setup.py 392s ----------------------------- Captured stderr call ----------------------------- 392s hint: Using 'master' as the name for the initial branch. This default branch name 392s hint: is subject to change. To configure the initial branch name to use in all 392s hint: of your new repositories, which will suppress this warning, call: 392s hint: 392s hint: git config --global init.defaultBranch 392s hint: 392s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 392s hint: 'development'. The just-created branch can be renamed via this command: 392s hint: 392s hint: git branch -m 392s ____________________ test_outside_project_root_fails[None] _____________________ 392s 392s option = None 392s 392s @pytest.mark.parametrize("option", [None, "-DINSTALL_FILE:BOOL=1", "-DINSTALL_PROJECT:BOOL=1"]) 392s def test_outside_project_root_fails(option): 392s with push_dir(): 392s expected_failure = False 392s 392s cmd = ["install"] 392s if option is not None: 392s expected_failure = True 392s cmd.extend(["--", option]) 392s 392s @project_setup_py_test("fail-outside-project-root", cmd, disable_languages_test=True) 392s def should_fail(): 392s pass 392s 392s failed = False 392s msg = "" 392s try: 392s > should_fail() 392s 392s cmd = ['install'] 392s expected_failure = False 392s failed = False 392s msg = '' 392s option = None 392s should_fail = .should_fail at 0x7537dfb11620> 392s 392s tests/test_outside_project_root.py:36: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s tests/__init__.py:255: in wrapped 392s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 392s disable_languages_test = True 392s fun = .should_fail at 0x7537dfb10b80> 392s iargs = () 392s ikwargs = {} 392s ret = False 392s wrapped = .should_fail at 0x7537dfb11620> 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-65/should_fail0') 392s setup_args = ['install'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-65/should_fail0') 392s setup_args = ['install'] 392s 392s tests/__init__.py:218: AttributeError 392s ----------------------------- Captured stdout call ----------------------------- 392s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-65/should_fail0/.git/ 392s [master (root-commit) 7a2b7a9] Initial commit 392s 4 files changed, 51 insertions(+) 392s create mode 100644 CMakeLists.txt 392s create mode 100644 dummy 392s create mode 100644 other_project/CMakeLists.txt 392s create mode 100644 setup.py 392s ----------------------------- Captured stderr call ----------------------------- 392s hint: Using 'master' as the name for the initial branch. This default branch name 392s hint: is subject to change. To configure the initial branch name to use in all 392s hint: of your new repositories, which will suppress this warning, call: 392s hint: 392s hint: git config --global init.defaultBranch 392s hint: 392s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 392s hint: 'development'. The just-created branch can be renamed via this command: 392s hint: 392s hint: git branch -m 392s ____________ test_outside_project_root_fails[-DINSTALL_FILE:BOOL=1] ____________ 392s 392s option = '-DINSTALL_FILE:BOOL=1' 392s 392s @pytest.mark.parametrize("option", [None, "-DINSTALL_FILE:BOOL=1", "-DINSTALL_PROJECT:BOOL=1"]) 392s def test_outside_project_root_fails(option): 392s with push_dir(): 392s expected_failure = False 392s 392s cmd = ["install"] 392s if option is not None: 392s expected_failure = True 392s cmd.extend(["--", option]) 392s 392s @project_setup_py_test("fail-outside-project-root", cmd, disable_languages_test=True) 392s def should_fail(): 392s pass 392s 392s failed = False 392s msg = "" 392s try: 392s > should_fail() 392s 392s cmd = ['install', '--', '-DINSTALL_FILE:BOOL=1'] 392s expected_failure = True 392s failed = False 392s msg = '' 392s option = '-DINSTALL_FILE:BOOL=1' 392s should_fail = .should_fail at 0x7537dfb11080> 392s 392s tests/test_outside_project_root.py:36: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s tests/__init__.py:255: in wrapped 392s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 392s disable_languages_test = True 392s fun = .should_fail at 0x7537dfb109a0> 392s iargs = () 392s ikwargs = {} 392s ret = False 392s wrapped = .should_fail at 0x7537dfb11080> 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-66/should_fail0') 392s setup_args = ['install', '--', '-DINSTALL_FILE:BOOL=1'] 392s disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-66/should_fail0') 392s setup_args = ['install', '--', '-DINSTALL_FILE:BOOL=1'] 392s 392s tests/__init__.py:218: AttributeError 392s ----------------------------- Captured stdout call ----------------------------- 392s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-66/should_fail0/.git/ 392s [master (root-commit) 7a2b7a9] Initial commit 392s 4 files changed, 51 insertions(+) 392s create mode 100644 CMakeLists.txt 392s create mode 100644 dummy 392s create mode 100644 other_project/CMakeLists.txt 392s create mode 100644 setup.py 392s ----------------------------- Captured stderr call ----------------------------- 392s hint: Using 'master' as the name for the initial branch. This default branch name 392s hint: is subject to change. To configure the initial branch name to use in all 392s hint: of your new repositories, which will suppress this warning, call: 392s hint: 392s hint: git config --global init.defaultBranch 392s hint: 392s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 392s hint: 'development'. The just-created branch can be renamed via this command: 392s hint: 392s hint: git branch -m 392s __________ test_outside_project_root_fails[-DINSTALL_PROJECT:BOOL=1] ___________ 392s 392s option = '-DINSTALL_PROJECT:BOOL=1' 392s 392s @pytest.mark.parametrize("option", [None, "-DINSTALL_FILE:BOOL=1", "-DINSTALL_PROJECT:BOOL=1"]) 392s def test_outside_project_root_fails(option): 392s with push_dir(): 392s expected_failure = False 392s 392s cmd = ["install"] 392s if option is not None: 392s expected_failure = True 392s cmd.extend(["--", option]) 392s 392s @project_setup_py_test("fail-outside-project-root", cmd, disable_languages_test=True) 392s def should_fail(): 392s pass 392s 392s failed = False 392s msg = "" 392s try: 392s > should_fail() 392s 392s cmd = ['install', '--', '-DINSTALL_PROJECT:BOOL=1'] 392s expected_failure = True 392s failed = False 392s msg = '' 392s option = '-DINSTALL_PROJECT:BOOL=1' 392s should_fail = .should_fail at 0x7537dfb125c0> 392s 392s tests/test_outside_project_root.py:36: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s tests/__init__.py:255: in wrapped 392s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 392s disable_languages_test = True 392s fun = .should_fail at 0x7537dfb123e0> 392s iargs = () 392s ikwargs = {} 392s ret = False 392s wrapped = .should_fail at 0x7537dfb125c0> 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-67/should_fail0') 392s setup_args = ['install', '--', '-DINSTALL_PROJECT:BOOL=1'] 392s disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-67/should_fail0') 392s setup_args = ['install', '--', '-DINSTALL_PROJECT:BOOL=1'] 392s 392s tests/__init__.py:218: AttributeError 392s ----------------------------- Captured stdout call ----------------------------- 392s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-67/should_fail0/.git/ 392s [master (root-commit) 7a2b7a9] Initial commit 392s 4 files changed, 51 insertions(+) 392s create mode 100644 CMakeLists.txt 392s create mode 100644 dummy 392s create mode 100644 other_project/CMakeLists.txt 392s create mode 100644 setup.py 392s ----------------------------- Captured stderr call ----------------------------- 392s hint: Using 'master' as the name for the initial branch. This default branch name 392s hint: is subject to change. To configure the initial branch name to use in all 392s hint: of your new repositories, which will suppress this warning, call: 392s hint: 392s hint: git config --global init.defaultBranch 392s hint: 392s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 392s hint: 'development'. The just-created branch can be renamed via this command: 392s hint: 392s hint: git branch -m 392s _____________________ test_cmake_args_keyword[cmake_args0] _____________________ 392s 392s cmake_args = [] 392s capfd = <_pytest.capture.CaptureFixture object at 0x7537dfaa36b0> 392s 392s @pytest.mark.parametrize("cmake_args", [[], ["--", "-DVAR:STRING=43", "-DVAR_WITH_SPACE:STRING=Ciao Mondo"]]) 392s def test_cmake_args_keyword(cmake_args, capfd): 392s tmp_dir = _tmpdir("cmake_args_keyword") 392s 392s tmp_dir.join("setup.py").write( 392s textwrap.dedent( 392s """ 392s from skbuild import setup 392s setup( 392s name="test_cmake_args_keyword", 392s version="1.2.3", 392s description="a minimal example package", 392s author='The scikit-build team', 392s license="MIT", 392s cmake_args=[ 392s "-DVAR:STRING=42", 392s "-DVAR_WITH_SPACE:STRING=Hello World" 392s ] 392s 392s ) 392s """ 392s ) 392s ) 392s tmp_dir.join("CMakeLists.txt").write( 392s textwrap.dedent( 392s """ 392s cmake_minimum_required(VERSION 3.5.0) 392s project(test NONE) 392s message(STATUS "VAR[${VAR}]") 392s message(STATUS "VAR_WITH_SPACE[${VAR_WITH_SPACE}]") 392s install(CODE "execute_process( 392s COMMAND \\${CMAKE_COMMAND} -E sleep 0)") 392s """ 392s ) 392s ) 392s 392s > with execute_setup_py(tmp_dir, ["build", *cmake_args], disable_languages_test=True): 392s 392s capfd = <_pytest.capture.CaptureFixture object at 0x7537dfaa36b0> 392s cmake_args = [] 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-68/cmake_args_keyword0') 392s 392s tests/test_setup.py:127: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-68/cmake_args_keyword0') 392s setup_args = ['build'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-68/cmake_args_keyword0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s _____________________ test_cmake_args_keyword[cmake_args1] _____________________ 392s 392s cmake_args = ['--', '-DVAR:STRING=43', '-DVAR_WITH_SPACE:STRING=Ciao Mondo'] 392s capfd = <_pytest.capture.CaptureFixture object at 0x7537dfaab830> 392s 392s @pytest.mark.parametrize("cmake_args", [[], ["--", "-DVAR:STRING=43", "-DVAR_WITH_SPACE:STRING=Ciao Mondo"]]) 392s def test_cmake_args_keyword(cmake_args, capfd): 392s tmp_dir = _tmpdir("cmake_args_keyword") 392s 392s tmp_dir.join("setup.py").write( 392s textwrap.dedent( 392s """ 392s from skbuild import setup 392s setup( 392s name="test_cmake_args_keyword", 392s version="1.2.3", 392s description="a minimal example package", 392s author='The scikit-build team', 392s license="MIT", 392s cmake_args=[ 392s "-DVAR:STRING=42", 392s "-DVAR_WITH_SPACE:STRING=Hello World" 392s ] 392s 392s ) 392s """ 392s ) 392s ) 392s tmp_dir.join("CMakeLists.txt").write( 392s textwrap.dedent( 392s """ 392s cmake_minimum_required(VERSION 3.5.0) 392s project(test NONE) 392s message(STATUS "VAR[${VAR}]") 392s message(STATUS "VAR_WITH_SPACE[${VAR_WITH_SPACE}]") 392s install(CODE "execute_process( 392s COMMAND \\${CMAKE_COMMAND} -E sleep 0)") 392s """ 392s ) 392s ) 392s 392s > with execute_setup_py(tmp_dir, ["build", *cmake_args], disable_languages_test=True): 392s 392s capfd = <_pytest.capture.CaptureFixture object at 0x7537dfaab830> 392s cmake_args = ['--', '-DVAR:STRING=43', '-DVAR_WITH_SPACE:STRING=Ciao Mondo'] 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-69/cmake_args_keyword0') 392s 392s tests/test_setup.py:127: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-69/cmake_args_keyword0') 392s setup_args = ['build', '--', '-DVAR:STRING=43', '-DVAR_WITH_SPACE:STRING=Ciao Mondo'] 392s disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-69/cmake_args_keyword0') 392s setup_args = ['build', '--', '-DVAR:STRING=43', '-DVAR_WITH_SPACE:STRING=Ciao Mondo'] 392s 392s tests/__init__.py:218: AttributeError 392s ________________ test_cmake_install_dir_keyword[None-True-str] _________________ 392s 392s cmake_install_dir = None, expected_failed = True 392s error_code_type = 392s capsys = <_pytest.capture.CaptureFixture object at 0x7537dfaa3470> 392s caplog = <_pytest.logging.LogCaptureFixture object at 0x7537dfbc26c0> 392s 392s @pytest.mark.parametrize( 392s ("cmake_install_dir", "expected_failed", "error_code_type"), 392s [ 392s (None, True, str), 392s ("", True, str), 392s (str(py.path.local.get_temproot().join("scikit-build")), True, SKBuildError), 392s ("banana", False, str), 392s ], 392s ) 392s def test_cmake_install_dir_keyword(cmake_install_dir, expected_failed, error_code_type, capsys, caplog): 392s # ------------------------------------------------------------------------- 392s # "SOURCE" tree layout: 392s # 392s # ROOT/ 392s # 392s # CMakeLists.txt 392s # setup.py 392s # 392s # apple/ 392s # __init__.py 392s # 392s # ------------------------------------------------------------------------- 392s # "BINARY" distribution layout 392s # 392s # ROOT/ 392s # 392s # apple/ 392s # __init__.py 392s # 392s 392s tmp_dir = _tmpdir("cmake_install_dir_keyword") 392s 392s setup_kwarg = "" 392s if cmake_install_dir is not None: 392s setup_kwarg = f"cmake_install_dir={str(cmake_install_dir)!r}" 392s 392s tmp_dir.join("setup.py").write( 392s textwrap.dedent( 392s f""" 392s from skbuild import setup 392s setup( 392s name="test_cmake_install_dir", 392s version="1.2.3", 392s description="a package testing use of cmake_install_dir", 392s author='The scikit-build team', 392s license="MIT", 392s packages=['apple', 'banana'], 392s {setup_kwarg} 392s ) 392s """ 392s ) 392s ) 392s 392s # Install location purposely set to "." so that we can test 392s # usage of "cmake_install_dir" skbuild.setup keyword. 392s tmp_dir.join("CMakeLists.txt").write( 392s textwrap.dedent( 392s """ 392s cmake_minimum_required(VERSION 3.5.0) 392s project(banana NONE) 392s file(WRITE "${CMAKE_BINARY_DIR}/__init__.py" "") 392s install(FILES "${CMAKE_BINARY_DIR}/__init__.py" DESTINATION ".") 392s """ 392s ) 392s ) 392s 392s tmp_dir.ensure("apple", "__init__.py") 392s 392s failed = False 392s message = "" 392s try: 392s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 392s 392s caplog = <_pytest.logging.LogCaptureFixture object at 0x7537dfbc26c0> 392s capsys = <_pytest.capture.CaptureFixture object at 0x7537dfaa3470> 392s cmake_install_dir = None 392s error_code_type = 392s expected_failed = True 392s failed = False 392s message = '' 392s setup_kwarg = '' 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-70/cmake_install_dir_keyword0') 392s 392s tests/test_setup.py:211: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-70/cmake_install_dir_keyword0') 392s setup_args = ['build'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-70/cmake_install_dir_keyword0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s __________________ test_cmake_install_dir_keyword[-True-str] ___________________ 392s 392s cmake_install_dir = '', expected_failed = True, error_code_type = 392s capsys = <_pytest.capture.CaptureFixture object at 0x7537dfaaa210> 392s caplog = <_pytest.logging.LogCaptureFixture object at 0x7537dfaabe30> 392s 392s @pytest.mark.parametrize( 392s ("cmake_install_dir", "expected_failed", "error_code_type"), 392s [ 392s (None, True, str), 392s ("", True, str), 392s (str(py.path.local.get_temproot().join("scikit-build")), True, SKBuildError), 392s ("banana", False, str), 392s ], 392s ) 392s def test_cmake_install_dir_keyword(cmake_install_dir, expected_failed, error_code_type, capsys, caplog): 392s # ------------------------------------------------------------------------- 392s # "SOURCE" tree layout: 392s # 392s # ROOT/ 392s # 392s # CMakeLists.txt 392s # setup.py 392s # 392s # apple/ 392s # __init__.py 392s # 392s # ------------------------------------------------------------------------- 392s # "BINARY" distribution layout 392s # 392s # ROOT/ 392s # 392s # apple/ 392s # __init__.py 392s # 392s 392s tmp_dir = _tmpdir("cmake_install_dir_keyword") 392s 392s setup_kwarg = "" 392s if cmake_install_dir is not None: 392s setup_kwarg = f"cmake_install_dir={str(cmake_install_dir)!r}" 392s 392s tmp_dir.join("setup.py").write( 392s textwrap.dedent( 392s f""" 392s from skbuild import setup 392s setup( 392s name="test_cmake_install_dir", 392s version="1.2.3", 392s description="a package testing use of cmake_install_dir", 392s author='The scikit-build team', 392s license="MIT", 392s packages=['apple', 'banana'], 392s {setup_kwarg} 392s ) 392s """ 392s ) 392s ) 392s 392s # Install location purposely set to "." so that we can test 392s # usage of "cmake_install_dir" skbuild.setup keyword. 392s tmp_dir.join("CMakeLists.txt").write( 392s textwrap.dedent( 392s """ 392s cmake_minimum_required(VERSION 3.5.0) 392s project(banana NONE) 392s file(WRITE "${CMAKE_BINARY_DIR}/__init__.py" "") 392s install(FILES "${CMAKE_BINARY_DIR}/__init__.py" DESTINATION ".") 392s """ 392s ) 392s ) 392s 392s tmp_dir.ensure("apple", "__init__.py") 392s 392s failed = False 392s message = "" 392s try: 392s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 392s 392s caplog = <_pytest.logging.LogCaptureFixture object at 0x7537dfaabe30> 392s capsys = <_pytest.capture.CaptureFixture object at 0x7537dfaaa210> 392s cmake_install_dir = '' 392s error_code_type = 392s expected_failed = True 392s failed = False 392s message = '' 392s setup_kwarg = "cmake_install_dir=''" 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-71/cmake_install_dir_keyword0') 392s 392s tests/test_setup.py:211: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-71/cmake_install_dir_keyword0') 392s setup_args = ['build'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-71/cmake_install_dir_keyword0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s _____ test_cmake_install_dir_keyword[/tmp/scikit-build-True-SKBuildError] ______ 392s 392s cmake_install_dir = '/tmp/scikit-build', expected_failed = True 392s error_code_type = 392s capsys = <_pytest.capture.CaptureFixture object at 0x7537dfaa97c0> 392s caplog = <_pytest.logging.LogCaptureFixture object at 0x7537dfaabd10> 392s 392s @pytest.mark.parametrize( 392s ("cmake_install_dir", "expected_failed", "error_code_type"), 392s [ 392s (None, True, str), 392s ("", True, str), 392s (str(py.path.local.get_temproot().join("scikit-build")), True, SKBuildError), 392s ("banana", False, str), 392s ], 392s ) 392s def test_cmake_install_dir_keyword(cmake_install_dir, expected_failed, error_code_type, capsys, caplog): 392s # ------------------------------------------------------------------------- 392s # "SOURCE" tree layout: 392s # 392s # ROOT/ 392s # 392s # CMakeLists.txt 392s # setup.py 392s # 392s # apple/ 392s # __init__.py 392s # 392s # ------------------------------------------------------------------------- 392s # "BINARY" distribution layout 392s # 392s # ROOT/ 392s # 392s # apple/ 392s # __init__.py 392s # 392s 392s tmp_dir = _tmpdir("cmake_install_dir_keyword") 392s 392s setup_kwarg = "" 392s if cmake_install_dir is not None: 392s setup_kwarg = f"cmake_install_dir={str(cmake_install_dir)!r}" 392s 392s tmp_dir.join("setup.py").write( 392s textwrap.dedent( 392s f""" 392s from skbuild import setup 392s setup( 392s name="test_cmake_install_dir", 392s version="1.2.3", 392s description="a package testing use of cmake_install_dir", 392s author='The scikit-build team', 392s license="MIT", 392s packages=['apple', 'banana'], 392s {setup_kwarg} 392s ) 392s """ 392s ) 392s ) 392s 392s # Install location purposely set to "." so that we can test 392s # usage of "cmake_install_dir" skbuild.setup keyword. 392s tmp_dir.join("CMakeLists.txt").write( 392s textwrap.dedent( 392s """ 392s cmake_minimum_required(VERSION 3.5.0) 392s project(banana NONE) 392s file(WRITE "${CMAKE_BINARY_DIR}/__init__.py" "") 392s install(FILES "${CMAKE_BINARY_DIR}/__init__.py" DESTINATION ".") 392s """ 392s ) 392s ) 392s 392s tmp_dir.ensure("apple", "__init__.py") 392s 392s failed = False 392s message = "" 392s try: 392s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 392s 392s caplog = <_pytest.logging.LogCaptureFixture object at 0x7537dfaabd10> 392s capsys = <_pytest.capture.CaptureFixture object at 0x7537dfaa97c0> 392s cmake_install_dir = '/tmp/scikit-build' 392s error_code_type = 392s expected_failed = True 392s failed = False 392s message = '' 392s setup_kwarg = "cmake_install_dir='/tmp/scikit-build'" 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-72/cmake_install_dir_keyword0') 392s 392s tests/test_setup.py:211: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-72/cmake_install_dir_keyword0') 392s setup_args = ['build'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-72/cmake_install_dir_keyword0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s _______________ test_cmake_install_dir_keyword[banana-False-str] _______________ 392s 392s cmake_install_dir = 'banana', expected_failed = False 392s error_code_type = 392s capsys = <_pytest.capture.CaptureFixture object at 0x7537dfaa8470> 392s caplog = <_pytest.logging.LogCaptureFixture object at 0x7537dfaa8950> 392s 392s @pytest.mark.parametrize( 392s ("cmake_install_dir", "expected_failed", "error_code_type"), 392s [ 392s (None, True, str), 392s ("", True, str), 392s (str(py.path.local.get_temproot().join("scikit-build")), True, SKBuildError), 392s ("banana", False, str), 392s ], 392s ) 392s def test_cmake_install_dir_keyword(cmake_install_dir, expected_failed, error_code_type, capsys, caplog): 392s # ------------------------------------------------------------------------- 392s # "SOURCE" tree layout: 392s # 392s # ROOT/ 392s # 392s # CMakeLists.txt 392s # setup.py 392s # 392s # apple/ 392s # __init__.py 392s # 392s # ------------------------------------------------------------------------- 392s # "BINARY" distribution layout 392s # 392s # ROOT/ 392s # 392s # apple/ 392s # __init__.py 392s # 392s 392s tmp_dir = _tmpdir("cmake_install_dir_keyword") 392s 392s setup_kwarg = "" 392s if cmake_install_dir is not None: 392s setup_kwarg = f"cmake_install_dir={str(cmake_install_dir)!r}" 392s 392s tmp_dir.join("setup.py").write( 392s textwrap.dedent( 392s f""" 392s from skbuild import setup 392s setup( 392s name="test_cmake_install_dir", 392s version="1.2.3", 392s description="a package testing use of cmake_install_dir", 392s author='The scikit-build team', 392s license="MIT", 392s packages=['apple', 'banana'], 392s {setup_kwarg} 392s ) 392s """ 392s ) 392s ) 392s 392s # Install location purposely set to "." so that we can test 392s # usage of "cmake_install_dir" skbuild.setup keyword. 392s tmp_dir.join("CMakeLists.txt").write( 392s textwrap.dedent( 392s """ 392s cmake_minimum_required(VERSION 3.5.0) 392s project(banana NONE) 392s file(WRITE "${CMAKE_BINARY_DIR}/__init__.py" "") 392s install(FILES "${CMAKE_BINARY_DIR}/__init__.py" DESTINATION ".") 392s """ 392s ) 392s ) 392s 392s tmp_dir.ensure("apple", "__init__.py") 392s 392s failed = False 392s message = "" 392s try: 392s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 392s 392s caplog = <_pytest.logging.LogCaptureFixture object at 0x7537dfaa8950> 392s capsys = <_pytest.capture.CaptureFixture object at 0x7537dfaa8470> 392s cmake_install_dir = 'banana' 392s error_code_type = 392s expected_failed = False 392s failed = False 392s message = '' 392s setup_kwarg = "cmake_install_dir='banana'" 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-73/cmake_install_dir_keyword0') 392s 392s tests/test_setup.py:211: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-73/cmake_install_dir_keyword0') 392s setup_args = ['build'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-73/cmake_install_dir_keyword0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s _____________________ test_cmake_with_sdist_keyword[True] ______________________ 392s 392s cmake_with_sdist = True 392s capfd = <_pytest.capture.CaptureFixture object at 0x7537dfaa87a0> 392s 392s @pytest.mark.parametrize("cmake_with_sdist", [True, False]) 392s def test_cmake_with_sdist_keyword(cmake_with_sdist, capfd): 392s tmp_dir = _tmpdir("cmake_with_sdist") 392s 392s tmp_dir.join("setup.py").write( 392s textwrap.dedent( 392s f""" 392s from skbuild import setup 392s setup( 392s name="cmake_with_sdist_keyword", 392s version="1.2.3", 392s description="a minimal example package", 392s author='The scikit-build team', 392s license="MIT", 392s cmake_with_sdist={cmake_with_sdist} 392s ) 392s """ 392s ) 392s ) 392s tmp_dir.join("CMakeLists.txt").write( 392s textwrap.dedent( 392s """ 392s cmake_minimum_required(VERSION 3.5.0) 392s project(test NONE) 392s install(CODE "execute_process( 392s COMMAND \\${CMAKE_COMMAND} -E sleep 0)") 392s """ 392s ) 392s ) 392s 392s initialize_git_repo_and_commit(tmp_dir) 392s 392s > with execute_setup_py(tmp_dir, ["sdist"], disable_languages_test=True): 392s 392s capfd = <_pytest.capture.CaptureFixture object at 0x7537dfaa87a0> 392s cmake_with_sdist = True 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-74/cmake_with_sdist0') 392s 392s tests/test_setup.py:267: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-74/cmake_with_sdist0') 392s setup_args = ['sdist'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-74/cmake_with_sdist0') 392s setup_args = ['sdist'] 392s 392s tests/__init__.py:218: AttributeError 392s ----------------------------- Captured stdout call ----------------------------- 392s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-74/cmake_with_sdist0/.git/ 392s [master (root-commit) 23b4ab3] Initial commit 392s 2 files changed, 15 insertions(+) 392s create mode 100644 CMakeLists.txt 392s create mode 100644 setup.py 392s ----------------------------- Captured stderr call ----------------------------- 392s hint: Using 'master' as the name for the initial branch. This default branch name 392s hint: is subject to change. To configure the initial branch name to use in all 392s hint: of your new repositories, which will suppress this warning, call: 392s hint: 392s hint: git config --global init.defaultBranch 392s hint: 392s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 392s hint: 'development'. The just-created branch can be renamed via this command: 392s hint: 392s hint: git branch -m 392s _____________________ test_cmake_with_sdist_keyword[False] _____________________ 392s 392s cmake_with_sdist = False 392s capfd = <_pytest.capture.CaptureFixture object at 0x7537dfaaa660> 392s 392s @pytest.mark.parametrize("cmake_with_sdist", [True, False]) 392s def test_cmake_with_sdist_keyword(cmake_with_sdist, capfd): 392s tmp_dir = _tmpdir("cmake_with_sdist") 392s 392s tmp_dir.join("setup.py").write( 392s textwrap.dedent( 392s f""" 392s from skbuild import setup 392s setup( 392s name="cmake_with_sdist_keyword", 392s version="1.2.3", 392s description="a minimal example package", 392s author='The scikit-build team', 392s license="MIT", 392s cmake_with_sdist={cmake_with_sdist} 392s ) 392s """ 392s ) 392s ) 392s tmp_dir.join("CMakeLists.txt").write( 392s textwrap.dedent( 392s """ 392s cmake_minimum_required(VERSION 3.5.0) 392s project(test NONE) 392s install(CODE "execute_process( 392s COMMAND \\${CMAKE_COMMAND} -E sleep 0)") 392s """ 392s ) 392s ) 392s 392s initialize_git_repo_and_commit(tmp_dir) 392s 392s > with execute_setup_py(tmp_dir, ["sdist"], disable_languages_test=True): 392s 392s capfd = <_pytest.capture.CaptureFixture object at 0x7537dfaaa660> 392s cmake_with_sdist = False 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-75/cmake_with_sdist0') 392s 392s tests/test_setup.py:267: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-75/cmake_with_sdist0') 392s setup_args = ['sdist'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-75/cmake_with_sdist0') 392s setup_args = ['sdist'] 392s 392s tests/__init__.py:218: AttributeError 392s ----------------------------- Captured stdout call ----------------------------- 392s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-75/cmake_with_sdist0/.git/ 392s [master (root-commit) 7c8d5f0] Initial commit 392s 2 files changed, 15 insertions(+) 392s create mode 100644 CMakeLists.txt 392s create mode 100644 setup.py 392s ----------------------------- Captured stderr call ----------------------------- 392s hint: Using 'master' as the name for the initial branch. This default branch name 392s hint: is subject to change. To configure the initial branch name to use in all 392s hint: of your new repositories, which will suppress this warning, call: 392s hint: 392s hint: git config --global init.defaultBranch 392s hint: 392s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 392s hint: 'development'. The just-created branch can be renamed via this command: 392s hint: 392s hint: git branch -m 392s _________________ test_cmake_minimum_required_version_keyword __________________ 392s 392s def test_cmake_minimum_required_version_keyword(): 392s tmp_dir = _tmpdir("cmake_minimum_required_version") 392s 392s tmp_dir.join("setup.py").write( 392s textwrap.dedent( 392s """ 392s from skbuild import setup 392s setup( 392s name="cmake_with_sdist_keyword", 392s version="1.2.3", 392s description="a minimal example package", 392s author='The scikit-build team', 392s license="MIT", 392s cmake_minimum_required_version='99.98.97' 392s ) 392s """ 392s ) 392s ) 392s tmp_dir.join("CMakeLists.txt").write( 392s textwrap.dedent( 392s """ 392s cmake_minimum_required(VERSION 3.5.0) 392s project(test NONE) 392s install(CODE "execute_process( 392s COMMAND \\${CMAKE_COMMAND} -E sleep 0)") 392s """ 392s ) 392s ) 392s 392s try: 392s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 392s 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-76/cmake_minimum_required_version0') 392s 392s tests/test_setup.py:308: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-76/cmake_minimum_required_version0') 392s setup_args = ['build'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-76/cmake_minimum_required_version0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s __________________________ test_script_keyword[pure] ___________________________ 392s 392s distribution_type = 'pure' 392s capsys = <_pytest.capture.CaptureFixture object at 0x7537dfaa0d40> 392s caplog = <_pytest.logging.LogCaptureFixture object at 0x7537dfaa3110> 392s 392s @pytest.mark.parametrize("distribution_type", ["pure", "skbuild"]) 392s def test_script_keyword(distribution_type, capsys, caplog): 392s # ------------------------------------------------------------------------- 392s # 392s # "SOURCE" tree layout for "pure" distribution: 392s # 392s # ROOT/ 392s # setup.py 392s # foo.py 392s # bar.py 392s # 392s # "SOURCE" tree layout for "pure" distribution: 392s # 392s # ROOT/ 392s # setup.py 392s # CMakeLists.txt 392s # 392s # ------------------------------------------------------------------------- 392s # "BINARY" distribution layout is identical for both 392s # 392s # ROOT/ 392s # foo.py 392s # bar.py 392s # 392s 392s tmp_dir = _tmpdir("script_keyword") 392s 392s tmp_dir.join("setup.py").write( 392s textwrap.dedent( 392s """ 392s from skbuild import setup 392s setup( 392s name="test_script_keyword", 392s version="1.2.3", 392s description="a package testing use of script keyword", 392s author='The scikit-build team', 392s license="MIT", 392s scripts=['foo.py', 'bar.py'], 392s packages=[], 392s ) 392s """ 392s ) 392s ) 392s 392s if distribution_type == "skbuild": 392s tmp_dir.join("CMakeLists.txt").write( 392s textwrap.dedent( 392s """ 392s cmake_minimum_required(VERSION 3.5.0) 392s project(foo NONE) 392s file(WRITE "${CMAKE_BINARY_DIR}/foo.py" "# foo.py") 392s file(WRITE "${CMAKE_BINARY_DIR}/bar.py" "# bar.py") 392s install( 392s FILES 392s "${CMAKE_BINARY_DIR}/foo.py" 392s "${CMAKE_BINARY_DIR}/bar.py" 392s DESTINATION "." 392s ) 392s """ 392s ) 392s ) 392s 392s messages = [ 392s f"copying {CMAKE_INSTALL_DIR()}/{module}.py -> {SKBUILD_DIR()}/setuptools/scripts-" 392s for module in ["foo", "bar"] 392s ] 392s 392s elif distribution_type == "pure": 392s tmp_dir.join("foo.py").write("# foo.py") 392s tmp_dir.join("bar.py").write("# bar.py") 392s 392s messages = [f"copying {module}.py -> {SKBUILD_DIR()}/setuptools/scripts-" for module in ["foo", "bar"]] 392s 392s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 392s 392s caplog = <_pytest.logging.LogCaptureFixture object at 0x7537dfaa3110> 392s capsys = <_pytest.capture.CaptureFixture object at 0x7537dfaa0d40> 392s distribution_type = 'pure' 392s messages = ['copying foo.py -> _skbuild/linux-x86_64-3.12/setuptools/scripts-', 'copying bar.py -> _skbuild/linux-x86_64-3.12/setuptools/scripts-'] 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-77/script_keyword0') 392s 392s tests/test_setup.py:448: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-77/script_keyword0') 392s setup_args = ['build'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-77/script_keyword0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s _________________________ test_script_keyword[skbuild] _________________________ 392s 392s distribution_type = 'skbuild' 392s capsys = <_pytest.capture.CaptureFixture object at 0x7537dfaa0110> 392s caplog = <_pytest.logging.LogCaptureFixture object at 0x7537dfaa31a0> 392s 392s @pytest.mark.parametrize("distribution_type", ["pure", "skbuild"]) 392s def test_script_keyword(distribution_type, capsys, caplog): 392s # ------------------------------------------------------------------------- 392s # 392s # "SOURCE" tree layout for "pure" distribution: 392s # 392s # ROOT/ 392s # setup.py 392s # foo.py 392s # bar.py 392s # 392s # "SOURCE" tree layout for "pure" distribution: 392s # 392s # ROOT/ 392s # setup.py 392s # CMakeLists.txt 392s # 392s # ------------------------------------------------------------------------- 392s # "BINARY" distribution layout is identical for both 392s # 392s # ROOT/ 392s # foo.py 392s # bar.py 392s # 392s 392s tmp_dir = _tmpdir("script_keyword") 392s 392s tmp_dir.join("setup.py").write( 392s textwrap.dedent( 392s """ 392s from skbuild import setup 392s setup( 392s name="test_script_keyword", 392s version="1.2.3", 392s description="a package testing use of script keyword", 392s author='The scikit-build team', 392s license="MIT", 392s scripts=['foo.py', 'bar.py'], 392s packages=[], 392s ) 392s """ 392s ) 392s ) 392s 392s if distribution_type == "skbuild": 392s tmp_dir.join("CMakeLists.txt").write( 392s textwrap.dedent( 392s """ 392s cmake_minimum_required(VERSION 3.5.0) 392s project(foo NONE) 392s file(WRITE "${CMAKE_BINARY_DIR}/foo.py" "# foo.py") 392s file(WRITE "${CMAKE_BINARY_DIR}/bar.py" "# bar.py") 392s install( 392s FILES 392s "${CMAKE_BINARY_DIR}/foo.py" 392s "${CMAKE_BINARY_DIR}/bar.py" 392s DESTINATION "." 392s ) 392s """ 392s ) 392s ) 392s 392s messages = [ 392s f"copying {CMAKE_INSTALL_DIR()}/{module}.py -> {SKBUILD_DIR()}/setuptools/scripts-" 392s for module in ["foo", "bar"] 392s ] 392s 392s elif distribution_type == "pure": 392s tmp_dir.join("foo.py").write("# foo.py") 392s tmp_dir.join("bar.py").write("# bar.py") 392s 392s messages = [f"copying {module}.py -> {SKBUILD_DIR()}/setuptools/scripts-" for module in ["foo", "bar"]] 392s 392s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 392s 392s caplog = <_pytest.logging.LogCaptureFixture object at 0x7537dfaa31a0> 392s capsys = <_pytest.capture.CaptureFixture object at 0x7537dfaa0110> 392s distribution_type = 'skbuild' 392s messages = ['copying _skbuild/linux-x86_64-3.12/cmake-install/foo.py -> _skbuild/linux-x86_64-3.12/setuptools/scripts-', 'copying _skbuild/linux-x86_64-3.12/cmake-install/bar.py -> _skbuild/linux-x86_64-3.12/setuptools/scripts-'] 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-78/script_keyword0') 392s 392s tests/test_setup.py:448: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-78/script_keyword0') 392s setup_args = ['build'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-78/script_keyword0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s ________________________ test_py_modules_keyword[pure] _________________________ 392s 392s distribution_type = 'pure' 392s capsys = <_pytest.capture.CaptureFixture object at 0x7537dfaa0ce0> 392s caplog = <_pytest.logging.LogCaptureFixture object at 0x7537dfaa19a0> 392s 392s @pytest.mark.parametrize("distribution_type", ["pure", "skbuild"]) 392s def test_py_modules_keyword(distribution_type, capsys, caplog): 392s # ------------------------------------------------------------------------- 392s # 392s # "SOURCE" tree layout for "pure" distribution: 392s # 392s # ROOT/ 392s # setup.py 392s # foo.py 392s # bar.py 392s # 392s # "SOURCE" tree layout for "skbuild" distribution: 392s # 392s # ROOT/ 392s # setup.py 392s # CMakeLists.txt 392s # 392s # ------------------------------------------------------------------------- 392s # "BINARY" distribution layout is identical for both 392s # 392s # ROOT/ 392s # foo.py 392s # bar.py 392s # 392s 392s tmp_dir = _tmpdir("py_modules_keyword") 392s 392s tmp_dir.join("setup.py").write( 392s textwrap.dedent( 392s """ 392s from skbuild import setup 392s setup( 392s name="test_py_modules_keyword", 392s version="1.2.3", 392s description="a package testing use of py_modules keyword", 392s author='The scikit-build team', 392s license="MIT", 392s py_modules=['foo', 'bar'] 392s ) 392s """ 392s ) 392s ) 392s 392s if distribution_type == "skbuild": 392s tmp_dir.join("CMakeLists.txt").write( 392s textwrap.dedent( 392s """ 392s cmake_minimum_required(VERSION 3.5.0) 392s project(foobar NONE) 392s file(WRITE "${CMAKE_BINARY_DIR}/foo.py" "# foo.py") 392s file(WRITE "${CMAKE_BINARY_DIR}/bar.py" "# bar.py") 392s install( 392s FILES 392s "${CMAKE_BINARY_DIR}/foo.py" 392s "${CMAKE_BINARY_DIR}/bar.py" 392s DESTINATION "." 392s ) 392s """ 392s ) 392s ) 392s 392s messages = [ 392s f"copying {CMAKE_INSTALL_DIR()}/{module}.py -> {SKBUILD_DIR()}/setuptools/lib" for module in ["foo", "bar"] 392s ] 392s 392s elif distribution_type == "pure": 392s tmp_dir.join("foo.py").write("# foo.py") 392s tmp_dir.join("bar.py").write("# bar.py") 392s 392s messages = [f"copying {module}.py -> {SKBUILD_DIR()}/setuptools/lib" for module in ["foo", "bar"]] 392s 392s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 392s 392s caplog = <_pytest.logging.LogCaptureFixture object at 0x7537dfaa19a0> 392s capsys = <_pytest.capture.CaptureFixture object at 0x7537dfaa0ce0> 392s distribution_type = 'pure' 392s messages = ['copying foo.py -> _skbuild/linux-x86_64-3.12/setuptools/lib', 'copying bar.py -> _skbuild/linux-x86_64-3.12/setuptools/lib'] 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-79/py_modules_keyword0') 392s 392s tests/test_setup.py:528: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-79/py_modules_keyword0') 392s setup_args = ['build'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-79/py_modules_keyword0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s _______________________ test_py_modules_keyword[skbuild] _______________________ 392s 392s distribution_type = 'skbuild' 392s capsys = <_pytest.capture.CaptureFixture object at 0x7537dfaaba70> 392s caplog = <_pytest.logging.LogCaptureFixture object at 0x7537dfaaa1b0> 392s 392s @pytest.mark.parametrize("distribution_type", ["pure", "skbuild"]) 392s def test_py_modules_keyword(distribution_type, capsys, caplog): 392s # ------------------------------------------------------------------------- 392s # 392s # "SOURCE" tree layout for "pure" distribution: 392s # 392s # ROOT/ 392s # setup.py 392s # foo.py 392s # bar.py 392s # 392s # "SOURCE" tree layout for "skbuild" distribution: 392s # 392s # ROOT/ 392s # setup.py 392s # CMakeLists.txt 392s # 392s # ------------------------------------------------------------------------- 392s # "BINARY" distribution layout is identical for both 392s # 392s # ROOT/ 392s # foo.py 392s # bar.py 392s # 392s 392s tmp_dir = _tmpdir("py_modules_keyword") 392s 392s tmp_dir.join("setup.py").write( 392s textwrap.dedent( 392s """ 392s from skbuild import setup 392s setup( 392s name="test_py_modules_keyword", 392s version="1.2.3", 392s description="a package testing use of py_modules keyword", 392s author='The scikit-build team', 392s license="MIT", 392s py_modules=['foo', 'bar'] 392s ) 392s """ 392s ) 392s ) 392s 392s if distribution_type == "skbuild": 392s tmp_dir.join("CMakeLists.txt").write( 392s textwrap.dedent( 392s """ 392s cmake_minimum_required(VERSION 3.5.0) 392s project(foobar NONE) 392s file(WRITE "${CMAKE_BINARY_DIR}/foo.py" "# foo.py") 392s file(WRITE "${CMAKE_BINARY_DIR}/bar.py" "# bar.py") 392s install( 392s FILES 392s "${CMAKE_BINARY_DIR}/foo.py" 392s "${CMAKE_BINARY_DIR}/bar.py" 392s DESTINATION "." 392s ) 392s """ 392s ) 392s ) 392s 392s messages = [ 392s f"copying {CMAKE_INSTALL_DIR()}/{module}.py -> {SKBUILD_DIR()}/setuptools/lib" for module in ["foo", "bar"] 392s ] 392s 392s elif distribution_type == "pure": 392s tmp_dir.join("foo.py").write("# foo.py") 392s tmp_dir.join("bar.py").write("# bar.py") 392s 392s messages = [f"copying {module}.py -> {SKBUILD_DIR()}/setuptools/lib" for module in ["foo", "bar"]] 392s 392s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 392s 392s caplog = <_pytest.logging.LogCaptureFixture object at 0x7537dfaaa1b0> 392s capsys = <_pytest.capture.CaptureFixture object at 0x7537dfaaba70> 392s distribution_type = 'skbuild' 392s messages = ['copying _skbuild/linux-x86_64-3.12/cmake-install/foo.py -> _skbuild/linux-x86_64-3.12/setuptools/lib', 'copying _skbuild/linux-x86_64-3.12/cmake-install/bar.py -> _skbuild/linux-x86_64-3.12/setuptools/lib'] 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-80/py_modules_keyword0') 392s 392s tests/test_setup.py:528: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-80/py_modules_keyword0') 392s setup_args = ['build'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-80/py_modules_keyword0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s ________________________ test_setup_inputs[0-0-0-0-0-0] ________________________ 392s 392s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 0 392s has_pure_package = 0, has_pure_module = 0, with_package_base = 0 392s mocker = 392s 392s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 392s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 392s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_module", [0, 1]) 392s @pytest.mark.parametrize("with_package_base", [0, 1]) 392s def test_setup_inputs( 392s has_cmake_package, 392s has_cmake_module, 392s has_hybrid_package, 392s has_pure_package, 392s has_pure_module, 392s with_package_base, 392s mocker, 392s ): 392s """This test that a project can have a package with some modules 392s installed using setup.py and some other modules installed using CMake. 392s """ 392s 392s tmp_dir = _tmpdir("test_setup_inputs") 392s 392s package_base = "to/the/base" if with_package_base else "" 392s package_base_dir = package_base + "/" if package_base else "" 392s cmake_source_dir = package_base 392s 392s if cmake_source_dir and (has_cmake_package or has_cmake_module): 392s pytest.skip( 392s "unsupported configuration: " 392s "python package fully generated by CMake does *NOT* work. " 392s "At least __init__.py should be in the project source tree" 392s ) 392s 392s # ------------------------------------------------------------------------- 392s # Here is the "SOURCE" tree layout: 392s # 392s # ROOT/ 392s # 392s # setup.py 392s # 392s # [/] 392s # 392s # pureModule.py 392s # 392s # pure/ 392s # __init__.py 392s # pure.py 392s # 392s # data/ 392s # pure.dat 392s # 392s # [/] 392s # 392s # hybrid/ 392s # CMakeLists.txt 392s # __init__.py 392s # hybrid_pure.dat 392s # hybrid_pure.py 392s # 392s # data/ 392s # hybrid_data_pure.dat 392s # 392s # hybrid_2/ 392s # __init__.py 392s # hybrid_2_pure.py 392s # 392s # hybrid_2_pure/ 392s # __init__.py 392s # hybrid_2_pure_1.py 392s # hybrid_2_pure_2.py 392s # 392s # 392s # ------------------------------------------------------------------------- 392s # and here is the "BINARY" distribution layout: 392s # 392s # The comment "CMake" or "Setuptools" indicates which tool is responsible 392s # for placing the file in the tree used to create the binary distribution. 392s # 392s # ROOT/ 392s # 392s # cmakeModule.py # CMake 392s # 392s # cmake/ 392s # __init__.py # CMake 392s # cmake.py # CMake 392s # 392s # hybrid/ 392s # hybrid_cmake.dat # CMake 392s # hybrid_cmake.py # CMake 392s # hybrid_pure.dat # Setuptools 392s # hybrid_pure.py # Setuptools 392s # 392s # data/ 392s # hybrid_data_pure.dat # CMake or Setuptools 392s # hybrid_data_cmake.dat # CMake *NO TEST* 392s # 392s # hybrid_2/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure.py # CMake or Setuptools 392s # hybrid_2_cmake.py # CMake 392s # 392s # hybrid_2_pure/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure_1.py # CMake or Setuptools 392s # hybrid_2_pure_2.py # CMake or Setuptools 392s # 392s # pureModule.py # Setuptools 392s # 392s # pure/ 392s # __init__.py # Setuptools 392s # pure.py # Setuptools 392s # 392s # data/ 392s # pure.dat # Setuptools 392s 392s tmp_dir.join("setup.py").write( 392s textwrap.dedent( 392s """ 392s from skbuild import setup 392s #from setuptools import setup 392s setup( 392s name="test_hybrid_project", 392s version="1.2.3", 392s description=("an hybrid package mixing files installed by both " 392s "CMake and setuptools"), 392s author='The scikit-build team', 392s license="MIT", 392s cmake_source_dir='{cmake_source_dir}', 392s cmake_install_dir='{cmake_install_dir}', 392s # Arbitrary order of packages 392s packages=[ 392s {p_off} 'pure', 392s {h_off} 'hybrid.hybrid_2', 392s {h_off} 'hybrid', 392s {c_off} 'cmake', 392s {p_off} 'hybrid.hybrid_2_pure', 392s ], 392s py_modules=[ 392s {pm_off} '{package_base}pureModule', 392s {cm_off} '{package_base}cmakeModule', 392s ], 392s package_data={{ 392s {p_off} 'pure': ['data/pure.dat'], 392s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 392s }}, 392s # Arbitrary order of package_dir 392s package_dir = {{ 392s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 392s {p_off} 'pure': '{package_base}pure', 392s {h_off} 'hybrid': '{package_base}hybrid', 392s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 392s {c_off} 'cmake': '{package_base}cmake', 392s }} 392s ) 392s """.format( 392s cmake_source_dir=cmake_source_dir, 392s cmake_install_dir=package_base, 392s package_base=package_base_dir, 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s p_off="" if has_pure_package else "#", 392s pm_off="" if has_pure_module else "#", 392s ) 392s ) 392s ) 392s 392s src_dir = tmp_dir.ensure(package_base, dir=1) 392s 392s src_dir.join("CMakeLists.txt").write( 392s textwrap.dedent( 392s """ 392s cmake_minimum_required(VERSION 3.5.0) 392s project(hybrid NONE) 392s set(build_dir ${{CMAKE_BINARY_DIR}}) 392s 392s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 392s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 392s {c_off} install( 392s {c_off} FILES 392s {c_off} ${{build_dir}}/__init__.py 392s {c_off} ${{build_dir}}/cmake.py 392s {c_off} DESTINATION cmake 392s {c_off} ) 392s 392s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 392s {cm_off} install( 392s {cm_off} FILES ${{build_dir}}/cmakeModule.py 392s {cm_off} DESTINATION .) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 392s {h_off} DESTINATION hybrid/data) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 392s {h_off} DESTINATION hybrid/hybrid_2) 392s 392s install(CODE "message(STATUS \\\"Installation complete\\\")") 392s """.format( 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s ) 392s ) 392s ) 392s 392s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 392s path_types: Sequence[str] 392s try: 392s path_types = next( 392s iter( 392s zip( 392s *filter( 392s lambda i: i[1], 392s [ 392s ("c", has_cmake_package), 392s ("cm", has_cmake_module), 392s ("h", has_hybrid_package), 392s ("p", has_pure_package), 392s ("pm", has_pure_module), 392s ], 392s ) 392s ) 392s ) 392s ) 392s except StopIteration: 392s path_types = [] 392s 392s def select_paths(annotated_paths): 392s """Return a filtered list paths considering ``path_types``. 392s 392s `annotated_paths`` is list of tuple ``(type, path)`` where type 392s is either `c`, 'cm', `h`, `p` or 'pm'. 392s 392s """ 392s return filter(lambda i: i[0] in path_types, annotated_paths) 392s 392s # Commented paths are the one expected to be installed by CMake. For 392s # this reason, corresponding files should NOT be created in the source 392s # tree. 392s for _type, path in select_paths( 392s [ 392s # ('c', 'cmake/__init__.py'), 392s # ('c', 'cmake/cmake.py'), 392s # ('cm', 'cmakeModule.py'), 392s ("h", "hybrid/__init__.py"), 392s # ('h', 'hybrid/hybrid_cmake.dat'), 392s # ('h', 'hybrid/hybrid_cmake.py'), 392s ("h", "hybrid/hybrid_pure.dat"), 392s ("h", "hybrid/hybrid_pure.py"), 392s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 392s ("h", "hybrid/data/hybrid_data_pure.dat"), 392s ("h", "hybrid/hybrid_2/__init__.py"), 392s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 392s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 392s ("p", "hybrid/hybrid_2_pure/__init__.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 392s ("pm", "pureModule.py"), 392s ("p", "pure/__init__.py"), 392s ("p", "pure/pure.py"), 392s ("p", "pure/data/pure.dat"), 392s ] 392s ): 392s assert _type in {"p", "pm", "h"} 392s root = package_base if _type in {"p", "pm"} else cmake_source_dir 392s tmp_dir.ensure(os.path.join(root, path)) 392s 392s # Do not call the real setup function. Instead, replace it with 392s # a MagicMock allowing to check with which arguments it was invoked. 392s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 392s 392s # Convenience print function 392s def _pprint(desc, value=None): 392s print( 392s "-----------------\n" 392s f"{desc}:\n" 392s "\n" 392s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 392s ) 392s 392s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 392s 392s _pprint = ._pprint at 0x7537df9f4680> 392s cmake_source_dir = '' 392s has_cmake_module = 0 392s has_cmake_package = 0 392s has_hybrid_package = 0 392s has_pure_module = 0 392s has_pure_package = 0 392s mock_setup = 392s mocker = 392s package_base = '' 392s package_base_dir = '' 392s path_types = [] 392s select_paths = .select_paths at 0x7537dfd3f600> 392s src_dir = local('/tmp/pytest-of-ubuntu/pytest-81/test_setup_inputs0') 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-81/test_setup_inputs0') 392s with_package_base = 0 392s 392s tests/test_setup.py:849: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-81/test_setup_inputs0') 392s setup_args = ['build'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-81/test_setup_inputs0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s ________________________ test_setup_inputs[0-0-0-0-0-1] ________________________ 392s 392s has_cmake_package = 1, has_cmake_module = 0, has_hybrid_package = 0 392s has_pure_package = 0, has_pure_module = 0, with_package_base = 0 392s mocker = 392s 392s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 392s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 392s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_module", [0, 1]) 392s @pytest.mark.parametrize("with_package_base", [0, 1]) 392s def test_setup_inputs( 392s has_cmake_package, 392s has_cmake_module, 392s has_hybrid_package, 392s has_pure_package, 392s has_pure_module, 392s with_package_base, 392s mocker, 392s ): 392s """This test that a project can have a package with some modules 392s installed using setup.py and some other modules installed using CMake. 392s """ 392s 392s tmp_dir = _tmpdir("test_setup_inputs") 392s 392s package_base = "to/the/base" if with_package_base else "" 392s package_base_dir = package_base + "/" if package_base else "" 392s cmake_source_dir = package_base 392s 392s if cmake_source_dir and (has_cmake_package or has_cmake_module): 392s pytest.skip( 392s "unsupported configuration: " 392s "python package fully generated by CMake does *NOT* work. " 392s "At least __init__.py should be in the project source tree" 392s ) 392s 392s # ------------------------------------------------------------------------- 392s # Here is the "SOURCE" tree layout: 392s # 392s # ROOT/ 392s # 392s # setup.py 392s # 392s # [/] 392s # 392s # pureModule.py 392s # 392s # pure/ 392s # __init__.py 392s # pure.py 392s # 392s # data/ 392s # pure.dat 392s # 392s # [/] 392s # 392s # hybrid/ 392s # CMakeLists.txt 392s # __init__.py 392s # hybrid_pure.dat 392s # hybrid_pure.py 392s # 392s # data/ 392s # hybrid_data_pure.dat 392s # 392s # hybrid_2/ 392s # __init__.py 392s # hybrid_2_pure.py 392s # 392s # hybrid_2_pure/ 392s # __init__.py 392s # hybrid_2_pure_1.py 392s # hybrid_2_pure_2.py 392s # 392s # 392s # ------------------------------------------------------------------------- 392s # and here is the "BINARY" distribution layout: 392s # 392s # The comment "CMake" or "Setuptools" indicates which tool is responsible 392s # for placing the file in the tree used to create the binary distribution. 392s # 392s # ROOT/ 392s # 392s # cmakeModule.py # CMake 392s # 392s # cmake/ 392s # __init__.py # CMake 392s # cmake.py # CMake 392s # 392s # hybrid/ 392s # hybrid_cmake.dat # CMake 392s # hybrid_cmake.py # CMake 392s # hybrid_pure.dat # Setuptools 392s # hybrid_pure.py # Setuptools 392s # 392s # data/ 392s # hybrid_data_pure.dat # CMake or Setuptools 392s # hybrid_data_cmake.dat # CMake *NO TEST* 392s # 392s # hybrid_2/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure.py # CMake or Setuptools 392s # hybrid_2_cmake.py # CMake 392s # 392s # hybrid_2_pure/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure_1.py # CMake or Setuptools 392s # hybrid_2_pure_2.py # CMake or Setuptools 392s # 392s # pureModule.py # Setuptools 392s # 392s # pure/ 392s # __init__.py # Setuptools 392s # pure.py # Setuptools 392s # 392s # data/ 392s # pure.dat # Setuptools 392s 392s tmp_dir.join("setup.py").write( 392s textwrap.dedent( 392s """ 392s from skbuild import setup 392s #from setuptools import setup 392s setup( 392s name="test_hybrid_project", 392s version="1.2.3", 392s description=("an hybrid package mixing files installed by both " 392s "CMake and setuptools"), 392s author='The scikit-build team', 392s license="MIT", 392s cmake_source_dir='{cmake_source_dir}', 392s cmake_install_dir='{cmake_install_dir}', 392s # Arbitrary order of packages 392s packages=[ 392s {p_off} 'pure', 392s {h_off} 'hybrid.hybrid_2', 392s {h_off} 'hybrid', 392s {c_off} 'cmake', 392s {p_off} 'hybrid.hybrid_2_pure', 392s ], 392s py_modules=[ 392s {pm_off} '{package_base}pureModule', 392s {cm_off} '{package_base}cmakeModule', 392s ], 392s package_data={{ 392s {p_off} 'pure': ['data/pure.dat'], 392s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 392s }}, 392s # Arbitrary order of package_dir 392s package_dir = {{ 392s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 392s {p_off} 'pure': '{package_base}pure', 392s {h_off} 'hybrid': '{package_base}hybrid', 392s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 392s {c_off} 'cmake': '{package_base}cmake', 392s }} 392s ) 392s """.format( 392s cmake_source_dir=cmake_source_dir, 392s cmake_install_dir=package_base, 392s package_base=package_base_dir, 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s p_off="" if has_pure_package else "#", 392s pm_off="" if has_pure_module else "#", 392s ) 392s ) 392s ) 392s 392s src_dir = tmp_dir.ensure(package_base, dir=1) 392s 392s src_dir.join("CMakeLists.txt").write( 392s textwrap.dedent( 392s """ 392s cmake_minimum_required(VERSION 3.5.0) 392s project(hybrid NONE) 392s set(build_dir ${{CMAKE_BINARY_DIR}}) 392s 392s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 392s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 392s {c_off} install( 392s {c_off} FILES 392s {c_off} ${{build_dir}}/__init__.py 392s {c_off} ${{build_dir}}/cmake.py 392s {c_off} DESTINATION cmake 392s {c_off} ) 392s 392s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 392s {cm_off} install( 392s {cm_off} FILES ${{build_dir}}/cmakeModule.py 392s {cm_off} DESTINATION .) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 392s {h_off} DESTINATION hybrid/data) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 392s {h_off} DESTINATION hybrid/hybrid_2) 392s 392s install(CODE "message(STATUS \\\"Installation complete\\\")") 392s """.format( 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s ) 392s ) 392s ) 392s 392s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 392s path_types: Sequence[str] 392s try: 392s path_types = next( 392s iter( 392s zip( 392s *filter( 392s lambda i: i[1], 392s [ 392s ("c", has_cmake_package), 392s ("cm", has_cmake_module), 392s ("h", has_hybrid_package), 392s ("p", has_pure_package), 392s ("pm", has_pure_module), 392s ], 392s ) 392s ) 392s ) 392s ) 392s except StopIteration: 392s path_types = [] 392s 392s def select_paths(annotated_paths): 392s """Return a filtered list paths considering ``path_types``. 392s 392s `annotated_paths`` is list of tuple ``(type, path)`` where type 392s is either `c`, 'cm', `h`, `p` or 'pm'. 392s 392s """ 392s return filter(lambda i: i[0] in path_types, annotated_paths) 392s 392s # Commented paths are the one expected to be installed by CMake. For 392s # this reason, corresponding files should NOT be created in the source 392s # tree. 392s for _type, path in select_paths( 392s [ 392s # ('c', 'cmake/__init__.py'), 392s # ('c', 'cmake/cmake.py'), 392s # ('cm', 'cmakeModule.py'), 392s ("h", "hybrid/__init__.py"), 392s # ('h', 'hybrid/hybrid_cmake.dat'), 392s # ('h', 'hybrid/hybrid_cmake.py'), 392s ("h", "hybrid/hybrid_pure.dat"), 392s ("h", "hybrid/hybrid_pure.py"), 392s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 392s ("h", "hybrid/data/hybrid_data_pure.dat"), 392s ("h", "hybrid/hybrid_2/__init__.py"), 392s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 392s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 392s ("p", "hybrid/hybrid_2_pure/__init__.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 392s ("pm", "pureModule.py"), 392s ("p", "pure/__init__.py"), 392s ("p", "pure/pure.py"), 392s ("p", "pure/data/pure.dat"), 392s ] 392s ): 392s assert _type in {"p", "pm", "h"} 392s root = package_base if _type in {"p", "pm"} else cmake_source_dir 392s tmp_dir.ensure(os.path.join(root, path)) 392s 392s # Do not call the real setup function. Instead, replace it with 392s # a MagicMock allowing to check with which arguments it was invoked. 392s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 392s 392s # Convenience print function 392s def _pprint(desc, value=None): 392s print( 392s "-----------------\n" 392s f"{desc}:\n" 392s "\n" 392s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 392s ) 392s 392s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 392s 392s _pprint = ._pprint at 0x7537df9f4720> 392s cmake_source_dir = '' 392s has_cmake_module = 0 392s has_cmake_package = 1 392s has_hybrid_package = 0 392s has_pure_module = 0 392s has_pure_package = 0 392s mock_setup = 392s mocker = 392s package_base = '' 392s package_base_dir = '' 392s path_types = ('c',) 392s select_paths = .select_paths at 0x7537df9f4360> 392s src_dir = local('/tmp/pytest-of-ubuntu/pytest-82/test_setup_inputs0') 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-82/test_setup_inputs0') 392s with_package_base = 0 392s 392s tests/test_setup.py:849: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-82/test_setup_inputs0') 392s setup_args = ['build'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-82/test_setup_inputs0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s ________________________ test_setup_inputs[0-0-0-0-1-0] ________________________ 392s 392s has_cmake_package = 0, has_cmake_module = 1, has_hybrid_package = 0 392s has_pure_package = 0, has_pure_module = 0, with_package_base = 0 392s mocker = 392s 392s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 392s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 392s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_module", [0, 1]) 392s @pytest.mark.parametrize("with_package_base", [0, 1]) 392s def test_setup_inputs( 392s has_cmake_package, 392s has_cmake_module, 392s has_hybrid_package, 392s has_pure_package, 392s has_pure_module, 392s with_package_base, 392s mocker, 392s ): 392s """This test that a project can have a package with some modules 392s installed using setup.py and some other modules installed using CMake. 392s """ 392s 392s tmp_dir = _tmpdir("test_setup_inputs") 392s 392s package_base = "to/the/base" if with_package_base else "" 392s package_base_dir = package_base + "/" if package_base else "" 392s cmake_source_dir = package_base 392s 392s if cmake_source_dir and (has_cmake_package or has_cmake_module): 392s pytest.skip( 392s "unsupported configuration: " 392s "python package fully generated by CMake does *NOT* work. " 392s "At least __init__.py should be in the project source tree" 392s ) 392s 392s # ------------------------------------------------------------------------- 392s # Here is the "SOURCE" tree layout: 392s # 392s # ROOT/ 392s # 392s # setup.py 392s # 392s # [/] 392s # 392s # pureModule.py 392s # 392s # pure/ 392s # __init__.py 392s # pure.py 392s # 392s # data/ 392s # pure.dat 392s # 392s # [/] 392s # 392s # hybrid/ 392s # CMakeLists.txt 392s # __init__.py 392s # hybrid_pure.dat 392s # hybrid_pure.py 392s # 392s # data/ 392s # hybrid_data_pure.dat 392s # 392s # hybrid_2/ 392s # __init__.py 392s # hybrid_2_pure.py 392s # 392s # hybrid_2_pure/ 392s # __init__.py 392s # hybrid_2_pure_1.py 392s # hybrid_2_pure_2.py 392s # 392s # 392s # ------------------------------------------------------------------------- 392s # and here is the "BINARY" distribution layout: 392s # 392s # The comment "CMake" or "Setuptools" indicates which tool is responsible 392s # for placing the file in the tree used to create the binary distribution. 392s # 392s # ROOT/ 392s # 392s # cmakeModule.py # CMake 392s # 392s # cmake/ 392s # __init__.py # CMake 392s # cmake.py # CMake 392s # 392s # hybrid/ 392s # hybrid_cmake.dat # CMake 392s # hybrid_cmake.py # CMake 392s # hybrid_pure.dat # Setuptools 392s # hybrid_pure.py # Setuptools 392s # 392s # data/ 392s # hybrid_data_pure.dat # CMake or Setuptools 392s # hybrid_data_cmake.dat # CMake *NO TEST* 392s # 392s # hybrid_2/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure.py # CMake or Setuptools 392s # hybrid_2_cmake.py # CMake 392s # 392s # hybrid_2_pure/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure_1.py # CMake or Setuptools 392s # hybrid_2_pure_2.py # CMake or Setuptools 392s # 392s # pureModule.py # Setuptools 392s # 392s # pure/ 392s # __init__.py # Setuptools 392s # pure.py # Setuptools 392s # 392s # data/ 392s # pure.dat # Setuptools 392s 392s tmp_dir.join("setup.py").write( 392s textwrap.dedent( 392s """ 392s from skbuild import setup 392s #from setuptools import setup 392s setup( 392s name="test_hybrid_project", 392s version="1.2.3", 392s description=("an hybrid package mixing files installed by both " 392s "CMake and setuptools"), 392s author='The scikit-build team', 392s license="MIT", 392s cmake_source_dir='{cmake_source_dir}', 392s cmake_install_dir='{cmake_install_dir}', 392s # Arbitrary order of packages 392s packages=[ 392s {p_off} 'pure', 392s {h_off} 'hybrid.hybrid_2', 392s {h_off} 'hybrid', 392s {c_off} 'cmake', 392s {p_off} 'hybrid.hybrid_2_pure', 392s ], 392s py_modules=[ 392s {pm_off} '{package_base}pureModule', 392s {cm_off} '{package_base}cmakeModule', 392s ], 392s package_data={{ 392s {p_off} 'pure': ['data/pure.dat'], 392s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 392s }}, 392s # Arbitrary order of package_dir 392s package_dir = {{ 392s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 392s {p_off} 'pure': '{package_base}pure', 392s {h_off} 'hybrid': '{package_base}hybrid', 392s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 392s {c_off} 'cmake': '{package_base}cmake', 392s }} 392s ) 392s """.format( 392s cmake_source_dir=cmake_source_dir, 392s cmake_install_dir=package_base, 392s package_base=package_base_dir, 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s p_off="" if has_pure_package else "#", 392s pm_off="" if has_pure_module else "#", 392s ) 392s ) 392s ) 392s 392s src_dir = tmp_dir.ensure(package_base, dir=1) 392s 392s src_dir.join("CMakeLists.txt").write( 392s textwrap.dedent( 392s """ 392s cmake_minimum_required(VERSION 3.5.0) 392s project(hybrid NONE) 392s set(build_dir ${{CMAKE_BINARY_DIR}}) 392s 392s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 392s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 392s {c_off} install( 392s {c_off} FILES 392s {c_off} ${{build_dir}}/__init__.py 392s {c_off} ${{build_dir}}/cmake.py 392s {c_off} DESTINATION cmake 392s {c_off} ) 392s 392s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 392s {cm_off} install( 392s {cm_off} FILES ${{build_dir}}/cmakeModule.py 392s {cm_off} DESTINATION .) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 392s {h_off} DESTINATION hybrid/data) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 392s {h_off} DESTINATION hybrid/hybrid_2) 392s 392s install(CODE "message(STATUS \\\"Installation complete\\\")") 392s """.format( 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s ) 392s ) 392s ) 392s 392s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 392s path_types: Sequence[str] 392s try: 392s path_types = next( 392s iter( 392s zip( 392s *filter( 392s lambda i: i[1], 392s [ 392s ("c", has_cmake_package), 392s ("cm", has_cmake_module), 392s ("h", has_hybrid_package), 392s ("p", has_pure_package), 392s ("pm", has_pure_module), 392s ], 392s ) 392s ) 392s ) 392s ) 392s except StopIteration: 392s path_types = [] 392s 392s def select_paths(annotated_paths): 392s """Return a filtered list paths considering ``path_types``. 392s 392s `annotated_paths`` is list of tuple ``(type, path)`` where type 392s is either `c`, 'cm', `h`, `p` or 'pm'. 392s 392s """ 392s return filter(lambda i: i[0] in path_types, annotated_paths) 392s 392s # Commented paths are the one expected to be installed by CMake. For 392s # this reason, corresponding files should NOT be created in the source 392s # tree. 392s for _type, path in select_paths( 392s [ 392s # ('c', 'cmake/__init__.py'), 392s # ('c', 'cmake/cmake.py'), 392s # ('cm', 'cmakeModule.py'), 392s ("h", "hybrid/__init__.py"), 392s # ('h', 'hybrid/hybrid_cmake.dat'), 392s # ('h', 'hybrid/hybrid_cmake.py'), 392s ("h", "hybrid/hybrid_pure.dat"), 392s ("h", "hybrid/hybrid_pure.py"), 392s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 392s ("h", "hybrid/data/hybrid_data_pure.dat"), 392s ("h", "hybrid/hybrid_2/__init__.py"), 392s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 392s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 392s ("p", "hybrid/hybrid_2_pure/__init__.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 392s ("pm", "pureModule.py"), 392s ("p", "pure/__init__.py"), 392s ("p", "pure/pure.py"), 392s ("p", "pure/data/pure.dat"), 392s ] 392s ): 392s assert _type in {"p", "pm", "h"} 392s root = package_base if _type in {"p", "pm"} else cmake_source_dir 392s tmp_dir.ensure(os.path.join(root, path)) 392s 392s # Do not call the real setup function. Instead, replace it with 392s # a MagicMock allowing to check with which arguments it was invoked. 392s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 392s 392s # Convenience print function 392s def _pprint(desc, value=None): 392s print( 392s "-----------------\n" 392s f"{desc}:\n" 392s "\n" 392s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 392s ) 392s 392s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 392s 392s _pprint = ._pprint at 0x7537dfb627a0> 392s cmake_source_dir = '' 392s has_cmake_module = 1 392s has_cmake_package = 0 392s has_hybrid_package = 0 392s has_pure_module = 0 392s has_pure_package = 0 392s mock_setup = 392s mocker = 392s package_base = '' 392s package_base_dir = '' 392s path_types = ('cm',) 392s select_paths = .select_paths at 0x7537dfb95a80> 392s src_dir = local('/tmp/pytest-of-ubuntu/pytest-83/test_setup_inputs0') 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-83/test_setup_inputs0') 392s with_package_base = 0 392s 392s tests/test_setup.py:849: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-83/test_setup_inputs0') 392s setup_args = ['build'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-83/test_setup_inputs0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s ________________________ test_setup_inputs[0-0-0-0-1-1] ________________________ 392s 392s has_cmake_package = 1, has_cmake_module = 1, has_hybrid_package = 0 392s has_pure_package = 0, has_pure_module = 0, with_package_base = 0 392s mocker = 392s 392s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 392s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 392s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_module", [0, 1]) 392s @pytest.mark.parametrize("with_package_base", [0, 1]) 392s def test_setup_inputs( 392s has_cmake_package, 392s has_cmake_module, 392s has_hybrid_package, 392s has_pure_package, 392s has_pure_module, 392s with_package_base, 392s mocker, 392s ): 392s """This test that a project can have a package with some modules 392s installed using setup.py and some other modules installed using CMake. 392s """ 392s 392s tmp_dir = _tmpdir("test_setup_inputs") 392s 392s package_base = "to/the/base" if with_package_base else "" 392s package_base_dir = package_base + "/" if package_base else "" 392s cmake_source_dir = package_base 392s 392s if cmake_source_dir and (has_cmake_package or has_cmake_module): 392s pytest.skip( 392s "unsupported configuration: " 392s "python package fully generated by CMake does *NOT* work. " 392s "At least __init__.py should be in the project source tree" 392s ) 392s 392s # ------------------------------------------------------------------------- 392s # Here is the "SOURCE" tree layout: 392s # 392s # ROOT/ 392s # 392s # setup.py 392s # 392s # [/] 392s # 392s # pureModule.py 392s # 392s # pure/ 392s # __init__.py 392s # pure.py 392s # 392s # data/ 392s # pure.dat 392s # 392s # [/] 392s # 392s # hybrid/ 392s # CMakeLists.txt 392s # __init__.py 392s # hybrid_pure.dat 392s # hybrid_pure.py 392s # 392s # data/ 392s # hybrid_data_pure.dat 392s # 392s # hybrid_2/ 392s # __init__.py 392s # hybrid_2_pure.py 392s # 392s # hybrid_2_pure/ 392s # __init__.py 392s # hybrid_2_pure_1.py 392s # hybrid_2_pure_2.py 392s # 392s # 392s # ------------------------------------------------------------------------- 392s # and here is the "BINARY" distribution layout: 392s # 392s # The comment "CMake" or "Setuptools" indicates which tool is responsible 392s # for placing the file in the tree used to create the binary distribution. 392s # 392s # ROOT/ 392s # 392s # cmakeModule.py # CMake 392s # 392s # cmake/ 392s # __init__.py # CMake 392s # cmake.py # CMake 392s # 392s # hybrid/ 392s # hybrid_cmake.dat # CMake 392s # hybrid_cmake.py # CMake 392s # hybrid_pure.dat # Setuptools 392s # hybrid_pure.py # Setuptools 392s # 392s # data/ 392s # hybrid_data_pure.dat # CMake or Setuptools 392s # hybrid_data_cmake.dat # CMake *NO TEST* 392s # 392s # hybrid_2/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure.py # CMake or Setuptools 392s # hybrid_2_cmake.py # CMake 392s # 392s # hybrid_2_pure/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure_1.py # CMake or Setuptools 392s # hybrid_2_pure_2.py # CMake or Setuptools 392s # 392s # pureModule.py # Setuptools 392s # 392s # pure/ 392s # __init__.py # Setuptools 392s # pure.py # Setuptools 392s # 392s # data/ 392s # pure.dat # Setuptools 392s 392s tmp_dir.join("setup.py").write( 392s textwrap.dedent( 392s """ 392s from skbuild import setup 392s #from setuptools import setup 392s setup( 392s name="test_hybrid_project", 392s version="1.2.3", 392s description=("an hybrid package mixing files installed by both " 392s "CMake and setuptools"), 392s author='The scikit-build team', 392s license="MIT", 392s cmake_source_dir='{cmake_source_dir}', 392s cmake_install_dir='{cmake_install_dir}', 392s # Arbitrary order of packages 392s packages=[ 392s {p_off} 'pure', 392s {h_off} 'hybrid.hybrid_2', 392s {h_off} 'hybrid', 392s {c_off} 'cmake', 392s {p_off} 'hybrid.hybrid_2_pure', 392s ], 392s py_modules=[ 392s {pm_off} '{package_base}pureModule', 392s {cm_off} '{package_base}cmakeModule', 392s ], 392s package_data={{ 392s {p_off} 'pure': ['data/pure.dat'], 392s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 392s }}, 392s # Arbitrary order of package_dir 392s package_dir = {{ 392s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 392s {p_off} 'pure': '{package_base}pure', 392s {h_off} 'hybrid': '{package_base}hybrid', 392s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 392s {c_off} 'cmake': '{package_base}cmake', 392s }} 392s ) 392s """.format( 392s cmake_source_dir=cmake_source_dir, 392s cmake_install_dir=package_base, 392s package_base=package_base_dir, 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s p_off="" if has_pure_package else "#", 392s pm_off="" if has_pure_module else "#", 392s ) 392s ) 392s ) 392s 392s src_dir = tmp_dir.ensure(package_base, dir=1) 392s 392s src_dir.join("CMakeLists.txt").write( 392s textwrap.dedent( 392s """ 392s cmake_minimum_required(VERSION 3.5.0) 392s project(hybrid NONE) 392s set(build_dir ${{CMAKE_BINARY_DIR}}) 392s 392s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 392s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 392s {c_off} install( 392s {c_off} FILES 392s {c_off} ${{build_dir}}/__init__.py 392s {c_off} ${{build_dir}}/cmake.py 392s {c_off} DESTINATION cmake 392s {c_off} ) 392s 392s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 392s {cm_off} install( 392s {cm_off} FILES ${{build_dir}}/cmakeModule.py 392s {cm_off} DESTINATION .) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 392s {h_off} DESTINATION hybrid/data) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 392s {h_off} DESTINATION hybrid/hybrid_2) 392s 392s install(CODE "message(STATUS \\\"Installation complete\\\")") 392s """.format( 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s ) 392s ) 392s ) 392s 392s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 392s path_types: Sequence[str] 392s try: 392s path_types = next( 392s iter( 392s zip( 392s *filter( 392s lambda i: i[1], 392s [ 392s ("c", has_cmake_package), 392s ("cm", has_cmake_module), 392s ("h", has_hybrid_package), 392s ("p", has_pure_package), 392s ("pm", has_pure_module), 392s ], 392s ) 392s ) 392s ) 392s ) 392s except StopIteration: 392s path_types = [] 392s 392s def select_paths(annotated_paths): 392s """Return a filtered list paths considering ``path_types``. 392s 392s `annotated_paths`` is list of tuple ``(type, path)`` where type 392s is either `c`, 'cm', `h`, `p` or 'pm'. 392s 392s """ 392s return filter(lambda i: i[0] in path_types, annotated_paths) 392s 392s # Commented paths are the one expected to be installed by CMake. For 392s # this reason, corresponding files should NOT be created in the source 392s # tree. 392s for _type, path in select_paths( 392s [ 392s # ('c', 'cmake/__init__.py'), 392s # ('c', 'cmake/cmake.py'), 392s # ('cm', 'cmakeModule.py'), 392s ("h", "hybrid/__init__.py"), 392s # ('h', 'hybrid/hybrid_cmake.dat'), 392s # ('h', 'hybrid/hybrid_cmake.py'), 392s ("h", "hybrid/hybrid_pure.dat"), 392s ("h", "hybrid/hybrid_pure.py"), 392s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 392s ("h", "hybrid/data/hybrid_data_pure.dat"), 392s ("h", "hybrid/hybrid_2/__init__.py"), 392s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 392s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 392s ("p", "hybrid/hybrid_2_pure/__init__.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 392s ("pm", "pureModule.py"), 392s ("p", "pure/__init__.py"), 392s ("p", "pure/pure.py"), 392s ("p", "pure/data/pure.dat"), 392s ] 392s ): 392s assert _type in {"p", "pm", "h"} 392s root = package_base if _type in {"p", "pm"} else cmake_source_dir 392s tmp_dir.ensure(os.path.join(root, path)) 392s 392s # Do not call the real setup function. Instead, replace it with 392s # a MagicMock allowing to check with which arguments it was invoked. 392s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 392s 392s # Convenience print function 392s def _pprint(desc, value=None): 392s print( 392s "-----------------\n" 392s f"{desc}:\n" 392s "\n" 392s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 392s ) 392s 392s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 392s 392s _pprint = ._pprint at 0x7537df9f4b80> 392s cmake_source_dir = '' 392s has_cmake_module = 1 392s has_cmake_package = 1 392s has_hybrid_package = 0 392s has_pure_module = 0 392s has_pure_package = 0 392s mock_setup = 392s mocker = 392s package_base = '' 392s package_base_dir = '' 392s path_types = ('c', 'cm') 392s select_paths = .select_paths at 0x7537df9f45e0> 392s src_dir = local('/tmp/pytest-of-ubuntu/pytest-84/test_setup_inputs0') 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-84/test_setup_inputs0') 392s with_package_base = 0 392s 392s tests/test_setup.py:849: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-84/test_setup_inputs0') 392s setup_args = ['build'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-84/test_setup_inputs0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s ________________________ test_setup_inputs[0-0-0-1-0-0] ________________________ 392s 392s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 1 392s has_pure_package = 0, has_pure_module = 0, with_package_base = 0 392s mocker = 392s 392s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 392s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 392s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_module", [0, 1]) 392s @pytest.mark.parametrize("with_package_base", [0, 1]) 392s def test_setup_inputs( 392s has_cmake_package, 392s has_cmake_module, 392s has_hybrid_package, 392s has_pure_package, 392s has_pure_module, 392s with_package_base, 392s mocker, 392s ): 392s """This test that a project can have a package with some modules 392s installed using setup.py and some other modules installed using CMake. 392s """ 392s 392s tmp_dir = _tmpdir("test_setup_inputs") 392s 392s package_base = "to/the/base" if with_package_base else "" 392s package_base_dir = package_base + "/" if package_base else "" 392s cmake_source_dir = package_base 392s 392s if cmake_source_dir and (has_cmake_package or has_cmake_module): 392s pytest.skip( 392s "unsupported configuration: " 392s "python package fully generated by CMake does *NOT* work. " 392s "At least __init__.py should be in the project source tree" 392s ) 392s 392s # ------------------------------------------------------------------------- 392s # Here is the "SOURCE" tree layout: 392s # 392s # ROOT/ 392s # 392s # setup.py 392s # 392s # [/] 392s # 392s # pureModule.py 392s # 392s # pure/ 392s # __init__.py 392s # pure.py 392s # 392s # data/ 392s # pure.dat 392s # 392s # [/] 392s # 392s # hybrid/ 392s # CMakeLists.txt 392s # __init__.py 392s # hybrid_pure.dat 392s # hybrid_pure.py 392s # 392s # data/ 392s # hybrid_data_pure.dat 392s # 392s # hybrid_2/ 392s # __init__.py 392s # hybrid_2_pure.py 392s # 392s # hybrid_2_pure/ 392s # __init__.py 392s # hybrid_2_pure_1.py 392s # hybrid_2_pure_2.py 392s # 392s # 392s # ------------------------------------------------------------------------- 392s # and here is the "BINARY" distribution layout: 392s # 392s # The comment "CMake" or "Setuptools" indicates which tool is responsible 392s # for placing the file in the tree used to create the binary distribution. 392s # 392s # ROOT/ 392s # 392s # cmakeModule.py # CMake 392s # 392s # cmake/ 392s # __init__.py # CMake 392s # cmake.py # CMake 392s # 392s # hybrid/ 392s # hybrid_cmake.dat # CMake 392s # hybrid_cmake.py # CMake 392s # hybrid_pure.dat # Setuptools 392s # hybrid_pure.py # Setuptools 392s # 392s # data/ 392s # hybrid_data_pure.dat # CMake or Setuptools 392s # hybrid_data_cmake.dat # CMake *NO TEST* 392s # 392s # hybrid_2/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure.py # CMake or Setuptools 392s # hybrid_2_cmake.py # CMake 392s # 392s # hybrid_2_pure/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure_1.py # CMake or Setuptools 392s # hybrid_2_pure_2.py # CMake or Setuptools 392s # 392s # pureModule.py # Setuptools 392s # 392s # pure/ 392s # __init__.py # Setuptools 392s # pure.py # Setuptools 392s # 392s # data/ 392s # pure.dat # Setuptools 392s 392s tmp_dir.join("setup.py").write( 392s textwrap.dedent( 392s """ 392s from skbuild import setup 392s #from setuptools import setup 392s setup( 392s name="test_hybrid_project", 392s version="1.2.3", 392s description=("an hybrid package mixing files installed by both " 392s "CMake and setuptools"), 392s author='The scikit-build team', 392s license="MIT", 392s cmake_source_dir='{cmake_source_dir}', 392s cmake_install_dir='{cmake_install_dir}', 392s # Arbitrary order of packages 392s packages=[ 392s {p_off} 'pure', 392s {h_off} 'hybrid.hybrid_2', 392s {h_off} 'hybrid', 392s {c_off} 'cmake', 392s {p_off} 'hybrid.hybrid_2_pure', 392s ], 392s py_modules=[ 392s {pm_off} '{package_base}pureModule', 392s {cm_off} '{package_base}cmakeModule', 392s ], 392s package_data={{ 392s {p_off} 'pure': ['data/pure.dat'], 392s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 392s }}, 392s # Arbitrary order of package_dir 392s package_dir = {{ 392s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 392s {p_off} 'pure': '{package_base}pure', 392s {h_off} 'hybrid': '{package_base}hybrid', 392s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 392s {c_off} 'cmake': '{package_base}cmake', 392s }} 392s ) 392s """.format( 392s cmake_source_dir=cmake_source_dir, 392s cmake_install_dir=package_base, 392s package_base=package_base_dir, 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s p_off="" if has_pure_package else "#", 392s pm_off="" if has_pure_module else "#", 392s ) 392s ) 392s ) 392s 392s src_dir = tmp_dir.ensure(package_base, dir=1) 392s 392s src_dir.join("CMakeLists.txt").write( 392s textwrap.dedent( 392s """ 392s cmake_minimum_required(VERSION 3.5.0) 392s project(hybrid NONE) 392s set(build_dir ${{CMAKE_BINARY_DIR}}) 392s 392s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 392s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 392s {c_off} install( 392s {c_off} FILES 392s {c_off} ${{build_dir}}/__init__.py 392s {c_off} ${{build_dir}}/cmake.py 392s {c_off} DESTINATION cmake 392s {c_off} ) 392s 392s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 392s {cm_off} install( 392s {cm_off} FILES ${{build_dir}}/cmakeModule.py 392s {cm_off} DESTINATION .) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 392s {h_off} DESTINATION hybrid/data) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 392s {h_off} DESTINATION hybrid/hybrid_2) 392s 392s install(CODE "message(STATUS \\\"Installation complete\\\")") 392s """.format( 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s ) 392s ) 392s ) 392s 392s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 392s path_types: Sequence[str] 392s try: 392s path_types = next( 392s iter( 392s zip( 392s *filter( 392s lambda i: i[1], 392s [ 392s ("c", has_cmake_package), 392s ("cm", has_cmake_module), 392s ("h", has_hybrid_package), 392s ("p", has_pure_package), 392s ("pm", has_pure_module), 392s ], 392s ) 392s ) 392s ) 392s ) 392s except StopIteration: 392s path_types = [] 392s 392s def select_paths(annotated_paths): 392s """Return a filtered list paths considering ``path_types``. 392s 392s `annotated_paths`` is list of tuple ``(type, path)`` where type 392s is either `c`, 'cm', `h`, `p` or 'pm'. 392s 392s """ 392s return filter(lambda i: i[0] in path_types, annotated_paths) 392s 392s # Commented paths are the one expected to be installed by CMake. For 392s # this reason, corresponding files should NOT be created in the source 392s # tree. 392s for _type, path in select_paths( 392s [ 392s # ('c', 'cmake/__init__.py'), 392s # ('c', 'cmake/cmake.py'), 392s # ('cm', 'cmakeModule.py'), 392s ("h", "hybrid/__init__.py"), 392s # ('h', 'hybrid/hybrid_cmake.dat'), 392s # ('h', 'hybrid/hybrid_cmake.py'), 392s ("h", "hybrid/hybrid_pure.dat"), 392s ("h", "hybrid/hybrid_pure.py"), 392s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 392s ("h", "hybrid/data/hybrid_data_pure.dat"), 392s ("h", "hybrid/hybrid_2/__init__.py"), 392s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 392s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 392s ("p", "hybrid/hybrid_2_pure/__init__.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 392s ("pm", "pureModule.py"), 392s ("p", "pure/__init__.py"), 392s ("p", "pure/pure.py"), 392s ("p", "pure/data/pure.dat"), 392s ] 392s ): 392s assert _type in {"p", "pm", "h"} 392s root = package_base if _type in {"p", "pm"} else cmake_source_dir 392s tmp_dir.ensure(os.path.join(root, path)) 392s 392s # Do not call the real setup function. Instead, replace it with 392s # a MagicMock allowing to check with which arguments it was invoked. 392s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 392s 392s # Convenience print function 392s def _pprint(desc, value=None): 392s print( 392s "-----------------\n" 392s f"{desc}:\n" 392s "\n" 392s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 392s ) 392s 392s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 392s 392s _pprint = ._pprint at 0x7537df9f4540> 392s _type = 'h' 392s cmake_source_dir = '' 392s has_cmake_module = 0 392s has_cmake_package = 0 392s has_hybrid_package = 1 392s has_pure_module = 0 392s has_pure_package = 0 392s mock_setup = 392s mocker = 392s package_base = '' 392s package_base_dir = '' 392s path = 'hybrid/hybrid_2/hybrid_2_pure.py' 392s path_types = ('h',) 392s root = '' 392s select_paths = .select_paths at 0x7537df9f5b20> 392s src_dir = local('/tmp/pytest-of-ubuntu/pytest-85/test_setup_inputs0') 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-85/test_setup_inputs0') 392s with_package_base = 0 392s 392s tests/test_setup.py:849: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-85/test_setup_inputs0') 392s setup_args = ['build'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-85/test_setup_inputs0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s ________________________ test_setup_inputs[0-0-0-1-0-1] ________________________ 392s 392s has_cmake_package = 1, has_cmake_module = 0, has_hybrid_package = 1 392s has_pure_package = 0, has_pure_module = 0, with_package_base = 0 392s mocker = 392s 392s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 392s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 392s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_module", [0, 1]) 392s @pytest.mark.parametrize("with_package_base", [0, 1]) 392s def test_setup_inputs( 392s has_cmake_package, 392s has_cmake_module, 392s has_hybrid_package, 392s has_pure_package, 392s has_pure_module, 392s with_package_base, 392s mocker, 392s ): 392s """This test that a project can have a package with some modules 392s installed using setup.py and some other modules installed using CMake. 392s """ 392s 392s tmp_dir = _tmpdir("test_setup_inputs") 392s 392s package_base = "to/the/base" if with_package_base else "" 392s package_base_dir = package_base + "/" if package_base else "" 392s cmake_source_dir = package_base 392s 392s if cmake_source_dir and (has_cmake_package or has_cmake_module): 392s pytest.skip( 392s "unsupported configuration: " 392s "python package fully generated by CMake does *NOT* work. " 392s "At least __init__.py should be in the project source tree" 392s ) 392s 392s # ------------------------------------------------------------------------- 392s # Here is the "SOURCE" tree layout: 392s # 392s # ROOT/ 392s # 392s # setup.py 392s # 392s # [/] 392s # 392s # pureModule.py 392s # 392s # pure/ 392s # __init__.py 392s # pure.py 392s # 392s # data/ 392s # pure.dat 392s # 392s # [/] 392s # 392s # hybrid/ 392s # CMakeLists.txt 392s # __init__.py 392s # hybrid_pure.dat 392s # hybrid_pure.py 392s # 392s # data/ 392s # hybrid_data_pure.dat 392s # 392s # hybrid_2/ 392s # __init__.py 392s # hybrid_2_pure.py 392s # 392s # hybrid_2_pure/ 392s # __init__.py 392s # hybrid_2_pure_1.py 392s # hybrid_2_pure_2.py 392s # 392s # 392s # ------------------------------------------------------------------------- 392s # and here is the "BINARY" distribution layout: 392s # 392s # The comment "CMake" or "Setuptools" indicates which tool is responsible 392s # for placing the file in the tree used to create the binary distribution. 392s # 392s # ROOT/ 392s # 392s # cmakeModule.py # CMake 392s # 392s # cmake/ 392s # __init__.py # CMake 392s # cmake.py # CMake 392s # 392s # hybrid/ 392s # hybrid_cmake.dat # CMake 392s # hybrid_cmake.py # CMake 392s # hybrid_pure.dat # Setuptools 392s # hybrid_pure.py # Setuptools 392s # 392s # data/ 392s # hybrid_data_pure.dat # CMake or Setuptools 392s # hybrid_data_cmake.dat # CMake *NO TEST* 392s # 392s # hybrid_2/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure.py # CMake or Setuptools 392s # hybrid_2_cmake.py # CMake 392s # 392s # hybrid_2_pure/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure_1.py # CMake or Setuptools 392s # hybrid_2_pure_2.py # CMake or Setuptools 392s # 392s # pureModule.py # Setuptools 392s # 392s # pure/ 392s # __init__.py # Setuptools 392s # pure.py # Setuptools 392s # 392s # data/ 392s # pure.dat # Setuptools 392s 392s tmp_dir.join("setup.py").write( 392s textwrap.dedent( 392s """ 392s from skbuild import setup 392s #from setuptools import setup 392s setup( 392s name="test_hybrid_project", 392s version="1.2.3", 392s description=("an hybrid package mixing files installed by both " 392s "CMake and setuptools"), 392s author='The scikit-build team', 392s license="MIT", 392s cmake_source_dir='{cmake_source_dir}', 392s cmake_install_dir='{cmake_install_dir}', 392s # Arbitrary order of packages 392s packages=[ 392s {p_off} 'pure', 392s {h_off} 'hybrid.hybrid_2', 392s {h_off} 'hybrid', 392s {c_off} 'cmake', 392s {p_off} 'hybrid.hybrid_2_pure', 392s ], 392s py_modules=[ 392s {pm_off} '{package_base}pureModule', 392s {cm_off} '{package_base}cmakeModule', 392s ], 392s package_data={{ 392s {p_off} 'pure': ['data/pure.dat'], 392s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 392s }}, 392s # Arbitrary order of package_dir 392s package_dir = {{ 392s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 392s {p_off} 'pure': '{package_base}pure', 392s {h_off} 'hybrid': '{package_base}hybrid', 392s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 392s {c_off} 'cmake': '{package_base}cmake', 392s }} 392s ) 392s """.format( 392s cmake_source_dir=cmake_source_dir, 392s cmake_install_dir=package_base, 392s package_base=package_base_dir, 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s p_off="" if has_pure_package else "#", 392s pm_off="" if has_pure_module else "#", 392s ) 392s ) 392s ) 392s 392s src_dir = tmp_dir.ensure(package_base, dir=1) 392s 392s src_dir.join("CMakeLists.txt").write( 392s textwrap.dedent( 392s """ 392s cmake_minimum_required(VERSION 3.5.0) 392s project(hybrid NONE) 392s set(build_dir ${{CMAKE_BINARY_DIR}}) 392s 392s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 392s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 392s {c_off} install( 392s {c_off} FILES 392s {c_off} ${{build_dir}}/__init__.py 392s {c_off} ${{build_dir}}/cmake.py 392s {c_off} DESTINATION cmake 392s {c_off} ) 392s 392s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 392s {cm_off} install( 392s {cm_off} FILES ${{build_dir}}/cmakeModule.py 392s {cm_off} DESTINATION .) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 392s {h_off} DESTINATION hybrid/data) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 392s {h_off} DESTINATION hybrid/hybrid_2) 392s 392s install(CODE "message(STATUS \\\"Installation complete\\\")") 392s """.format( 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s ) 392s ) 392s ) 392s 392s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 392s path_types: Sequence[str] 392s try: 392s path_types = next( 392s iter( 392s zip( 392s *filter( 392s lambda i: i[1], 392s [ 392s ("c", has_cmake_package), 392s ("cm", has_cmake_module), 392s ("h", has_hybrid_package), 392s ("p", has_pure_package), 392s ("pm", has_pure_module), 392s ], 392s ) 392s ) 392s ) 392s ) 392s except StopIteration: 392s path_types = [] 392s 392s def select_paths(annotated_paths): 392s """Return a filtered list paths considering ``path_types``. 392s 392s `annotated_paths`` is list of tuple ``(type, path)`` where type 392s is either `c`, 'cm', `h`, `p` or 'pm'. 392s 392s """ 392s return filter(lambda i: i[0] in path_types, annotated_paths) 392s 392s # Commented paths are the one expected to be installed by CMake. For 392s # this reason, corresponding files should NOT be created in the source 392s # tree. 392s for _type, path in select_paths( 392s [ 392s # ('c', 'cmake/__init__.py'), 392s # ('c', 'cmake/cmake.py'), 392s # ('cm', 'cmakeModule.py'), 392s ("h", "hybrid/__init__.py"), 392s # ('h', 'hybrid/hybrid_cmake.dat'), 392s # ('h', 'hybrid/hybrid_cmake.py'), 392s ("h", "hybrid/hybrid_pure.dat"), 392s ("h", "hybrid/hybrid_pure.py"), 392s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 392s ("h", "hybrid/data/hybrid_data_pure.dat"), 392s ("h", "hybrid/hybrid_2/__init__.py"), 392s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 392s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 392s ("p", "hybrid/hybrid_2_pure/__init__.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 392s ("pm", "pureModule.py"), 392s ("p", "pure/__init__.py"), 392s ("p", "pure/pure.py"), 392s ("p", "pure/data/pure.dat"), 392s ] 392s ): 392s assert _type in {"p", "pm", "h"} 392s root = package_base if _type in {"p", "pm"} else cmake_source_dir 392s tmp_dir.ensure(os.path.join(root, path)) 392s 392s # Do not call the real setup function. Instead, replace it with 392s # a MagicMock allowing to check with which arguments it was invoked. 392s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 392s 392s # Convenience print function 392s def _pprint(desc, value=None): 392s print( 392s "-----------------\n" 392s f"{desc}:\n" 392s "\n" 392s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 392s ) 392s 392s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 392s 392s _pprint = ._pprint at 0x7537df9f49a0> 392s _type = 'h' 392s cmake_source_dir = '' 392s has_cmake_module = 0 392s has_cmake_package = 1 392s has_hybrid_package = 1 392s has_pure_module = 0 392s has_pure_package = 0 392s mock_setup = 392s mocker = 392s package_base = '' 392s package_base_dir = '' 392s path = 'hybrid/hybrid_2/hybrid_2_pure.py' 392s path_types = ('c', 'h') 392s root = '' 392s select_paths = .select_paths at 0x7537df9f5120> 392s src_dir = local('/tmp/pytest-of-ubuntu/pytest-86/test_setup_inputs0') 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-86/test_setup_inputs0') 392s with_package_base = 0 392s 392s tests/test_setup.py:849: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-86/test_setup_inputs0') 392s setup_args = ['build'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-86/test_setup_inputs0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s ________________________ test_setup_inputs[0-0-0-1-1-0] ________________________ 392s 392s has_cmake_package = 0, has_cmake_module = 1, has_hybrid_package = 1 392s has_pure_package = 0, has_pure_module = 0, with_package_base = 0 392s mocker = 392s 392s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 392s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 392s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_module", [0, 1]) 392s @pytest.mark.parametrize("with_package_base", [0, 1]) 392s def test_setup_inputs( 392s has_cmake_package, 392s has_cmake_module, 392s has_hybrid_package, 392s has_pure_package, 392s has_pure_module, 392s with_package_base, 392s mocker, 392s ): 392s """This test that a project can have a package with some modules 392s installed using setup.py and some other modules installed using CMake. 392s """ 392s 392s tmp_dir = _tmpdir("test_setup_inputs") 392s 392s package_base = "to/the/base" if with_package_base else "" 392s package_base_dir = package_base + "/" if package_base else "" 392s cmake_source_dir = package_base 392s 392s if cmake_source_dir and (has_cmake_package or has_cmake_module): 392s pytest.skip( 392s "unsupported configuration: " 392s "python package fully generated by CMake does *NOT* work. " 392s "At least __init__.py should be in the project source tree" 392s ) 392s 392s # ------------------------------------------------------------------------- 392s # Here is the "SOURCE" tree layout: 392s # 392s # ROOT/ 392s # 392s # setup.py 392s # 392s # [/] 392s # 392s # pureModule.py 392s # 392s # pure/ 392s # __init__.py 392s # pure.py 392s # 392s # data/ 392s # pure.dat 392s # 392s # [/] 392s # 392s # hybrid/ 392s # CMakeLists.txt 392s # __init__.py 392s # hybrid_pure.dat 392s # hybrid_pure.py 392s # 392s # data/ 392s # hybrid_data_pure.dat 392s # 392s # hybrid_2/ 392s # __init__.py 392s # hybrid_2_pure.py 392s # 392s # hybrid_2_pure/ 392s # __init__.py 392s # hybrid_2_pure_1.py 392s # hybrid_2_pure_2.py 392s # 392s # 392s # ------------------------------------------------------------------------- 392s # and here is the "BINARY" distribution layout: 392s # 392s # The comment "CMake" or "Setuptools" indicates which tool is responsible 392s # for placing the file in the tree used to create the binary distribution. 392s # 392s # ROOT/ 392s # 392s # cmakeModule.py # CMake 392s # 392s # cmake/ 392s # __init__.py # CMake 392s # cmake.py # CMake 392s # 392s # hybrid/ 392s # hybrid_cmake.dat # CMake 392s # hybrid_cmake.py # CMake 392s # hybrid_pure.dat # Setuptools 392s # hybrid_pure.py # Setuptools 392s # 392s # data/ 392s # hybrid_data_pure.dat # CMake or Setuptools 392s # hybrid_data_cmake.dat # CMake *NO TEST* 392s # 392s # hybrid_2/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure.py # CMake or Setuptools 392s # hybrid_2_cmake.py # CMake 392s # 392s # hybrid_2_pure/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure_1.py # CMake or Setuptools 392s # hybrid_2_pure_2.py # CMake or Setuptools 392s # 392s # pureModule.py # Setuptools 392s # 392s # pure/ 392s # __init__.py # Setuptools 392s # pure.py # Setuptools 392s # 392s # data/ 392s # pure.dat # Setuptools 392s 392s tmp_dir.join("setup.py").write( 392s textwrap.dedent( 392s """ 392s from skbuild import setup 392s #from setuptools import setup 392s setup( 392s name="test_hybrid_project", 392s version="1.2.3", 392s description=("an hybrid package mixing files installed by both " 392s "CMake and setuptools"), 392s author='The scikit-build team', 392s license="MIT", 392s cmake_source_dir='{cmake_source_dir}', 392s cmake_install_dir='{cmake_install_dir}', 392s # Arbitrary order of packages 392s packages=[ 392s {p_off} 'pure', 392s {h_off} 'hybrid.hybrid_2', 392s {h_off} 'hybrid', 392s {c_off} 'cmake', 392s {p_off} 'hybrid.hybrid_2_pure', 392s ], 392s py_modules=[ 392s {pm_off} '{package_base}pureModule', 392s {cm_off} '{package_base}cmakeModule', 392s ], 392s package_data={{ 392s {p_off} 'pure': ['data/pure.dat'], 392s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 392s }}, 392s # Arbitrary order of package_dir 392s package_dir = {{ 392s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 392s {p_off} 'pure': '{package_base}pure', 392s {h_off} 'hybrid': '{package_base}hybrid', 392s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 392s {c_off} 'cmake': '{package_base}cmake', 392s }} 392s ) 392s """.format( 392s cmake_source_dir=cmake_source_dir, 392s cmake_install_dir=package_base, 392s package_base=package_base_dir, 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s p_off="" if has_pure_package else "#", 392s pm_off="" if has_pure_module else "#", 392s ) 392s ) 392s ) 392s 392s src_dir = tmp_dir.ensure(package_base, dir=1) 392s 392s src_dir.join("CMakeLists.txt").write( 392s textwrap.dedent( 392s """ 392s cmake_minimum_required(VERSION 3.5.0) 392s project(hybrid NONE) 392s set(build_dir ${{CMAKE_BINARY_DIR}}) 392s 392s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 392s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 392s {c_off} install( 392s {c_off} FILES 392s {c_off} ${{build_dir}}/__init__.py 392s {c_off} ${{build_dir}}/cmake.py 392s {c_off} DESTINATION cmake 392s {c_off} ) 392s 392s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 392s {cm_off} install( 392s {cm_off} FILES ${{build_dir}}/cmakeModule.py 392s {cm_off} DESTINATION .) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 392s {h_off} DESTINATION hybrid/data) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 392s {h_off} DESTINATION hybrid/hybrid_2) 392s 392s install(CODE "message(STATUS \\\"Installation complete\\\")") 392s """.format( 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s ) 392s ) 392s ) 392s 392s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 392s path_types: Sequence[str] 392s try: 392s path_types = next( 392s iter( 392s zip( 392s *filter( 392s lambda i: i[1], 392s [ 392s ("c", has_cmake_package), 392s ("cm", has_cmake_module), 392s ("h", has_hybrid_package), 392s ("p", has_pure_package), 392s ("pm", has_pure_module), 392s ], 392s ) 392s ) 392s ) 392s ) 392s except StopIteration: 392s path_types = [] 392s 392s def select_paths(annotated_paths): 392s """Return a filtered list paths considering ``path_types``. 392s 392s `annotated_paths`` is list of tuple ``(type, path)`` where type 392s is either `c`, 'cm', `h`, `p` or 'pm'. 392s 392s """ 392s return filter(lambda i: i[0] in path_types, annotated_paths) 392s 392s # Commented paths are the one expected to be installed by CMake. For 392s # this reason, corresponding files should NOT be created in the source 392s # tree. 392s for _type, path in select_paths( 392s [ 392s # ('c', 'cmake/__init__.py'), 392s # ('c', 'cmake/cmake.py'), 392s # ('cm', 'cmakeModule.py'), 392s ("h", "hybrid/__init__.py"), 392s # ('h', 'hybrid/hybrid_cmake.dat'), 392s # ('h', 'hybrid/hybrid_cmake.py'), 392s ("h", "hybrid/hybrid_pure.dat"), 392s ("h", "hybrid/hybrid_pure.py"), 392s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 392s ("h", "hybrid/data/hybrid_data_pure.dat"), 392s ("h", "hybrid/hybrid_2/__init__.py"), 392s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 392s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 392s ("p", "hybrid/hybrid_2_pure/__init__.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 392s ("pm", "pureModule.py"), 392s ("p", "pure/__init__.py"), 392s ("p", "pure/pure.py"), 392s ("p", "pure/data/pure.dat"), 392s ] 392s ): 392s assert _type in {"p", "pm", "h"} 392s root = package_base if _type in {"p", "pm"} else cmake_source_dir 392s tmp_dir.ensure(os.path.join(root, path)) 392s 392s # Do not call the real setup function. Instead, replace it with 392s # a MagicMock allowing to check with which arguments it was invoked. 392s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 392s 392s # Convenience print function 392s def _pprint(desc, value=None): 392s print( 392s "-----------------\n" 392s f"{desc}:\n" 392s "\n" 392s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 392s ) 392s 392s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 392s 392s _pprint = ._pprint at 0x7537dfb95a80> 392s _type = 'h' 392s cmake_source_dir = '' 392s has_cmake_module = 1 392s has_cmake_package = 0 392s has_hybrid_package = 1 392s has_pure_module = 0 392s has_pure_package = 0 392s mock_setup = 392s mocker = 392s package_base = '' 392s package_base_dir = '' 392s path = 'hybrid/hybrid_2/hybrid_2_pure.py' 392s path_types = ('cm', 'h') 392s root = '' 392s select_paths = .select_paths at 0x7537dfb627a0> 392s src_dir = local('/tmp/pytest-of-ubuntu/pytest-87/test_setup_inputs0') 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-87/test_setup_inputs0') 392s with_package_base = 0 392s 392s tests/test_setup.py:849: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-87/test_setup_inputs0') 392s setup_args = ['build'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-87/test_setup_inputs0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s ________________________ test_setup_inputs[0-0-0-1-1-1] ________________________ 392s 392s has_cmake_package = 1, has_cmake_module = 1, has_hybrid_package = 1 392s has_pure_package = 0, has_pure_module = 0, with_package_base = 0 392s mocker = 392s 392s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 392s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 392s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_module", [0, 1]) 392s @pytest.mark.parametrize("with_package_base", [0, 1]) 392s def test_setup_inputs( 392s has_cmake_package, 392s has_cmake_module, 392s has_hybrid_package, 392s has_pure_package, 392s has_pure_module, 392s with_package_base, 392s mocker, 392s ): 392s """This test that a project can have a package with some modules 392s installed using setup.py and some other modules installed using CMake. 392s """ 392s 392s tmp_dir = _tmpdir("test_setup_inputs") 392s 392s package_base = "to/the/base" if with_package_base else "" 392s package_base_dir = package_base + "/" if package_base else "" 392s cmake_source_dir = package_base 392s 392s if cmake_source_dir and (has_cmake_package or has_cmake_module): 392s pytest.skip( 392s "unsupported configuration: " 392s "python package fully generated by CMake does *NOT* work. " 392s "At least __init__.py should be in the project source tree" 392s ) 392s 392s # ------------------------------------------------------------------------- 392s # Here is the "SOURCE" tree layout: 392s # 392s # ROOT/ 392s # 392s # setup.py 392s # 392s # [/] 392s # 392s # pureModule.py 392s # 392s # pure/ 392s # __init__.py 392s # pure.py 392s # 392s # data/ 392s # pure.dat 392s # 392s # [/] 392s # 392s # hybrid/ 392s # CMakeLists.txt 392s # __init__.py 392s # hybrid_pure.dat 392s # hybrid_pure.py 392s # 392s # data/ 392s # hybrid_data_pure.dat 392s # 392s # hybrid_2/ 392s # __init__.py 392s # hybrid_2_pure.py 392s # 392s # hybrid_2_pure/ 392s # __init__.py 392s # hybrid_2_pure_1.py 392s # hybrid_2_pure_2.py 392s # 392s # 392s # ------------------------------------------------------------------------- 392s # and here is the "BINARY" distribution layout: 392s # 392s # The comment "CMake" or "Setuptools" indicates which tool is responsible 392s # for placing the file in the tree used to create the binary distribution. 392s # 392s # ROOT/ 392s # 392s # cmakeModule.py # CMake 392s # 392s # cmake/ 392s # __init__.py # CMake 392s # cmake.py # CMake 392s # 392s # hybrid/ 392s # hybrid_cmake.dat # CMake 392s # hybrid_cmake.py # CMake 392s # hybrid_pure.dat # Setuptools 392s # hybrid_pure.py # Setuptools 392s # 392s # data/ 392s # hybrid_data_pure.dat # CMake or Setuptools 392s # hybrid_data_cmake.dat # CMake *NO TEST* 392s # 392s # hybrid_2/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure.py # CMake or Setuptools 392s # hybrid_2_cmake.py # CMake 392s # 392s # hybrid_2_pure/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure_1.py # CMake or Setuptools 392s # hybrid_2_pure_2.py # CMake or Setuptools 392s # 392s # pureModule.py # Setuptools 392s # 392s # pure/ 392s # __init__.py # Setuptools 392s # pure.py # Setuptools 392s # 392s # data/ 392s # pure.dat # Setuptools 392s 392s tmp_dir.join("setup.py").write( 392s textwrap.dedent( 392s """ 392s from skbuild import setup 392s #from setuptools import setup 392s setup( 392s name="test_hybrid_project", 392s version="1.2.3", 392s description=("an hybrid package mixing files installed by both " 392s "CMake and setuptools"), 392s author='The scikit-build team', 392s license="MIT", 392s cmake_source_dir='{cmake_source_dir}', 392s cmake_install_dir='{cmake_install_dir}', 392s # Arbitrary order of packages 392s packages=[ 392s {p_off} 'pure', 392s {h_off} 'hybrid.hybrid_2', 392s {h_off} 'hybrid', 392s {c_off} 'cmake', 392s {p_off} 'hybrid.hybrid_2_pure', 392s ], 392s py_modules=[ 392s {pm_off} '{package_base}pureModule', 392s {cm_off} '{package_base}cmakeModule', 392s ], 392s package_data={{ 392s {p_off} 'pure': ['data/pure.dat'], 392s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 392s }}, 392s # Arbitrary order of package_dir 392s package_dir = {{ 392s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 392s {p_off} 'pure': '{package_base}pure', 392s {h_off} 'hybrid': '{package_base}hybrid', 392s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 392s {c_off} 'cmake': '{package_base}cmake', 392s }} 392s ) 392s """.format( 392s cmake_source_dir=cmake_source_dir, 392s cmake_install_dir=package_base, 392s package_base=package_base_dir, 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s p_off="" if has_pure_package else "#", 392s pm_off="" if has_pure_module else "#", 392s ) 392s ) 392s ) 392s 392s src_dir = tmp_dir.ensure(package_base, dir=1) 392s 392s src_dir.join("CMakeLists.txt").write( 392s textwrap.dedent( 392s """ 392s cmake_minimum_required(VERSION 3.5.0) 392s project(hybrid NONE) 392s set(build_dir ${{CMAKE_BINARY_DIR}}) 392s 392s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 392s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 392s {c_off} install( 392s {c_off} FILES 392s {c_off} ${{build_dir}}/__init__.py 392s {c_off} ${{build_dir}}/cmake.py 392s {c_off} DESTINATION cmake 392s {c_off} ) 392s 392s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 392s {cm_off} install( 392s {cm_off} FILES ${{build_dir}}/cmakeModule.py 392s {cm_off} DESTINATION .) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 392s {h_off} DESTINATION hybrid/data) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 392s {h_off} DESTINATION hybrid/hybrid_2) 392s 392s install(CODE "message(STATUS \\\"Installation complete\\\")") 392s """.format( 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s ) 392s ) 392s ) 392s 392s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 392s path_types: Sequence[str] 392s try: 392s path_types = next( 392s iter( 392s zip( 392s *filter( 392s lambda i: i[1], 392s [ 392s ("c", has_cmake_package), 392s ("cm", has_cmake_module), 392s ("h", has_hybrid_package), 392s ("p", has_pure_package), 392s ("pm", has_pure_module), 392s ], 392s ) 392s ) 392s ) 392s ) 392s except StopIteration: 392s path_types = [] 392s 392s def select_paths(annotated_paths): 392s """Return a filtered list paths considering ``path_types``. 392s 392s `annotated_paths`` is list of tuple ``(type, path)`` where type 392s is either `c`, 'cm', `h`, `p` or 'pm'. 392s 392s """ 392s return filter(lambda i: i[0] in path_types, annotated_paths) 392s 392s # Commented paths are the one expected to be installed by CMake. For 392s # this reason, corresponding files should NOT be created in the source 392s # tree. 392s for _type, path in select_paths( 392s [ 392s # ('c', 'cmake/__init__.py'), 392s # ('c', 'cmake/cmake.py'), 392s # ('cm', 'cmakeModule.py'), 392s ("h", "hybrid/__init__.py"), 392s # ('h', 'hybrid/hybrid_cmake.dat'), 392s # ('h', 'hybrid/hybrid_cmake.py'), 392s ("h", "hybrid/hybrid_pure.dat"), 392s ("h", "hybrid/hybrid_pure.py"), 392s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 392s ("h", "hybrid/data/hybrid_data_pure.dat"), 392s ("h", "hybrid/hybrid_2/__init__.py"), 392s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 392s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 392s ("p", "hybrid/hybrid_2_pure/__init__.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 392s ("pm", "pureModule.py"), 392s ("p", "pure/__init__.py"), 392s ("p", "pure/pure.py"), 392s ("p", "pure/data/pure.dat"), 392s ] 392s ): 392s assert _type in {"p", "pm", "h"} 392s root = package_base if _type in {"p", "pm"} else cmake_source_dir 392s tmp_dir.ensure(os.path.join(root, path)) 392s 392s # Do not call the real setup function. Instead, replace it with 392s # a MagicMock allowing to check with which arguments it was invoked. 392s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 392s 392s # Convenience print function 392s def _pprint(desc, value=None): 392s print( 392s "-----------------\n" 392s f"{desc}:\n" 392s "\n" 392s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 392s ) 392s 392s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 392s 392s _pprint = ._pprint at 0x7537df9f62a0> 392s _type = 'h' 392s cmake_source_dir = '' 392s has_cmake_module = 1 392s has_cmake_package = 1 392s has_hybrid_package = 1 392s has_pure_module = 0 392s has_pure_package = 0 392s mock_setup = 392s mocker = 392s package_base = '' 392s package_base_dir = '' 392s path = 'hybrid/hybrid_2/hybrid_2_pure.py' 392s path_types = ('c', 'cm', 'h') 392s root = '' 392s select_paths = .select_paths at 0x7537df9f6ac0> 392s src_dir = local('/tmp/pytest-of-ubuntu/pytest-88/test_setup_inputs0') 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-88/test_setup_inputs0') 392s with_package_base = 0 392s 392s tests/test_setup.py:849: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-88/test_setup_inputs0') 392s setup_args = ['build'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-88/test_setup_inputs0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s ________________________ test_setup_inputs[0-0-1-0-0-0] ________________________ 392s 392s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 0 392s has_pure_package = 1, has_pure_module = 0, with_package_base = 0 392s mocker = 392s 392s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 392s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 392s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_module", [0, 1]) 392s @pytest.mark.parametrize("with_package_base", [0, 1]) 392s def test_setup_inputs( 392s has_cmake_package, 392s has_cmake_module, 392s has_hybrid_package, 392s has_pure_package, 392s has_pure_module, 392s with_package_base, 392s mocker, 392s ): 392s """This test that a project can have a package with some modules 392s installed using setup.py and some other modules installed using CMake. 392s """ 392s 392s tmp_dir = _tmpdir("test_setup_inputs") 392s 392s package_base = "to/the/base" if with_package_base else "" 392s package_base_dir = package_base + "/" if package_base else "" 392s cmake_source_dir = package_base 392s 392s if cmake_source_dir and (has_cmake_package or has_cmake_module): 392s pytest.skip( 392s "unsupported configuration: " 392s "python package fully generated by CMake does *NOT* work. " 392s "At least __init__.py should be in the project source tree" 392s ) 392s 392s # ------------------------------------------------------------------------- 392s # Here is the "SOURCE" tree layout: 392s # 392s # ROOT/ 392s # 392s # setup.py 392s # 392s # [/] 392s # 392s # pureModule.py 392s # 392s # pure/ 392s # __init__.py 392s # pure.py 392s # 392s # data/ 392s # pure.dat 392s # 392s # [/] 392s # 392s # hybrid/ 392s # CMakeLists.txt 392s # __init__.py 392s # hybrid_pure.dat 392s # hybrid_pure.py 392s # 392s # data/ 392s # hybrid_data_pure.dat 392s # 392s # hybrid_2/ 392s # __init__.py 392s # hybrid_2_pure.py 392s # 392s # hybrid_2_pure/ 392s # __init__.py 392s # hybrid_2_pure_1.py 392s # hybrid_2_pure_2.py 392s # 392s # 392s # ------------------------------------------------------------------------- 392s # and here is the "BINARY" distribution layout: 392s # 392s # The comment "CMake" or "Setuptools" indicates which tool is responsible 392s # for placing the file in the tree used to create the binary distribution. 392s # 392s # ROOT/ 392s # 392s # cmakeModule.py # CMake 392s # 392s # cmake/ 392s # __init__.py # CMake 392s # cmake.py # CMake 392s # 392s # hybrid/ 392s # hybrid_cmake.dat # CMake 392s # hybrid_cmake.py # CMake 392s # hybrid_pure.dat # Setuptools 392s # hybrid_pure.py # Setuptools 392s # 392s # data/ 392s # hybrid_data_pure.dat # CMake or Setuptools 392s # hybrid_data_cmake.dat # CMake *NO TEST* 392s # 392s # hybrid_2/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure.py # CMake or Setuptools 392s # hybrid_2_cmake.py # CMake 392s # 392s # hybrid_2_pure/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure_1.py # CMake or Setuptools 392s # hybrid_2_pure_2.py # CMake or Setuptools 392s # 392s # pureModule.py # Setuptools 392s # 392s # pure/ 392s # __init__.py # Setuptools 392s # pure.py # Setuptools 392s # 392s # data/ 392s # pure.dat # Setuptools 392s 392s tmp_dir.join("setup.py").write( 392s textwrap.dedent( 392s """ 392s from skbuild import setup 392s #from setuptools import setup 392s setup( 392s name="test_hybrid_project", 392s version="1.2.3", 392s description=("an hybrid package mixing files installed by both " 392s "CMake and setuptools"), 392s author='The scikit-build team', 392s license="MIT", 392s cmake_source_dir='{cmake_source_dir}', 392s cmake_install_dir='{cmake_install_dir}', 392s # Arbitrary order of packages 392s packages=[ 392s {p_off} 'pure', 392s {h_off} 'hybrid.hybrid_2', 392s {h_off} 'hybrid', 392s {c_off} 'cmake', 392s {p_off} 'hybrid.hybrid_2_pure', 392s ], 392s py_modules=[ 392s {pm_off} '{package_base}pureModule', 392s {cm_off} '{package_base}cmakeModule', 392s ], 392s package_data={{ 392s {p_off} 'pure': ['data/pure.dat'], 392s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 392s }}, 392s # Arbitrary order of package_dir 392s package_dir = {{ 392s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 392s {p_off} 'pure': '{package_base}pure', 392s {h_off} 'hybrid': '{package_base}hybrid', 392s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 392s {c_off} 'cmake': '{package_base}cmake', 392s }} 392s ) 392s """.format( 392s cmake_source_dir=cmake_source_dir, 392s cmake_install_dir=package_base, 392s package_base=package_base_dir, 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s p_off="" if has_pure_package else "#", 392s pm_off="" if has_pure_module else "#", 392s ) 392s ) 392s ) 392s 392s src_dir = tmp_dir.ensure(package_base, dir=1) 392s 392s src_dir.join("CMakeLists.txt").write( 392s textwrap.dedent( 392s """ 392s cmake_minimum_required(VERSION 3.5.0) 392s project(hybrid NONE) 392s set(build_dir ${{CMAKE_BINARY_DIR}}) 392s 392s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 392s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 392s {c_off} install( 392s {c_off} FILES 392s {c_off} ${{build_dir}}/__init__.py 392s {c_off} ${{build_dir}}/cmake.py 392s {c_off} DESTINATION cmake 392s {c_off} ) 392s 392s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 392s {cm_off} install( 392s {cm_off} FILES ${{build_dir}}/cmakeModule.py 392s {cm_off} DESTINATION .) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 392s {h_off} DESTINATION hybrid/data) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 392s {h_off} DESTINATION hybrid/hybrid_2) 392s 392s install(CODE "message(STATUS \\\"Installation complete\\\")") 392s """.format( 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s ) 392s ) 392s ) 392s 392s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 392s path_types: Sequence[str] 392s try: 392s path_types = next( 392s iter( 392s zip( 392s *filter( 392s lambda i: i[1], 392s [ 392s ("c", has_cmake_package), 392s ("cm", has_cmake_module), 392s ("h", has_hybrid_package), 392s ("p", has_pure_package), 392s ("pm", has_pure_module), 392s ], 392s ) 392s ) 392s ) 392s ) 392s except StopIteration: 392s path_types = [] 392s 392s def select_paths(annotated_paths): 392s """Return a filtered list paths considering ``path_types``. 392s 392s `annotated_paths`` is list of tuple ``(type, path)`` where type 392s is either `c`, 'cm', `h`, `p` or 'pm'. 392s 392s """ 392s return filter(lambda i: i[0] in path_types, annotated_paths) 392s 392s # Commented paths are the one expected to be installed by CMake. For 392s # this reason, corresponding files should NOT be created in the source 392s # tree. 392s for _type, path in select_paths( 392s [ 392s # ('c', 'cmake/__init__.py'), 392s # ('c', 'cmake/cmake.py'), 392s # ('cm', 'cmakeModule.py'), 392s ("h", "hybrid/__init__.py"), 392s # ('h', 'hybrid/hybrid_cmake.dat'), 392s # ('h', 'hybrid/hybrid_cmake.py'), 392s ("h", "hybrid/hybrid_pure.dat"), 392s ("h", "hybrid/hybrid_pure.py"), 392s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 392s ("h", "hybrid/data/hybrid_data_pure.dat"), 392s ("h", "hybrid/hybrid_2/__init__.py"), 392s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 392s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 392s ("p", "hybrid/hybrid_2_pure/__init__.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 392s ("pm", "pureModule.py"), 392s ("p", "pure/__init__.py"), 392s ("p", "pure/pure.py"), 392s ("p", "pure/data/pure.dat"), 392s ] 392s ): 392s assert _type in {"p", "pm", "h"} 392s root = package_base if _type in {"p", "pm"} else cmake_source_dir 392s tmp_dir.ensure(os.path.join(root, path)) 392s 392s # Do not call the real setup function. Instead, replace it with 392s # a MagicMock allowing to check with which arguments it was invoked. 392s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 392s 392s # Convenience print function 392s def _pprint(desc, value=None): 392s print( 392s "-----------------\n" 392s f"{desc}:\n" 392s "\n" 392s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 392s ) 392s 392s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 392s 392s _pprint = ._pprint at 0x7537df9f4d60> 392s _type = 'p' 392s cmake_source_dir = '' 392s has_cmake_module = 0 392s has_cmake_package = 0 392s has_hybrid_package = 0 392s has_pure_module = 0 392s has_pure_package = 1 392s mock_setup = 392s mocker = 392s package_base = '' 392s package_base_dir = '' 392s path = 'pure/data/pure.dat' 392s path_types = ('p',) 392s root = '' 392s select_paths = .select_paths at 0x7537df9f6660> 392s src_dir = local('/tmp/pytest-of-ubuntu/pytest-89/test_setup_inputs0') 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-89/test_setup_inputs0') 392s with_package_base = 0 392s 392s tests/test_setup.py:849: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-89/test_setup_inputs0') 392s setup_args = ['build'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-89/test_setup_inputs0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s ________________________ test_setup_inputs[0-0-1-0-0-1] ________________________ 392s 392s has_cmake_package = 1, has_cmake_module = 0, has_hybrid_package = 0 392s has_pure_package = 1, has_pure_module = 0, with_package_base = 0 392s mocker = 392s 392s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 392s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 392s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_module", [0, 1]) 392s @pytest.mark.parametrize("with_package_base", [0, 1]) 392s def test_setup_inputs( 392s has_cmake_package, 392s has_cmake_module, 392s has_hybrid_package, 392s has_pure_package, 392s has_pure_module, 392s with_package_base, 392s mocker, 392s ): 392s """This test that a project can have a package with some modules 392s installed using setup.py and some other modules installed using CMake. 392s """ 392s 392s tmp_dir = _tmpdir("test_setup_inputs") 392s 392s package_base = "to/the/base" if with_package_base else "" 392s package_base_dir = package_base + "/" if package_base else "" 392s cmake_source_dir = package_base 392s 392s if cmake_source_dir and (has_cmake_package or has_cmake_module): 392s pytest.skip( 392s "unsupported configuration: " 392s "python package fully generated by CMake does *NOT* work. " 392s "At least __init__.py should be in the project source tree" 392s ) 392s 392s # ------------------------------------------------------------------------- 392s # Here is the "SOURCE" tree layout: 392s # 392s # ROOT/ 392s # 392s # setup.py 392s # 392s # [/] 392s # 392s # pureModule.py 392s # 392s # pure/ 392s # __init__.py 392s # pure.py 392s # 392s # data/ 392s # pure.dat 392s # 392s # [/] 392s # 392s # hybrid/ 392s # CMakeLists.txt 392s # __init__.py 392s # hybrid_pure.dat 392s # hybrid_pure.py 392s # 392s # data/ 392s # hybrid_data_pure.dat 392s # 392s # hybrid_2/ 392s # __init__.py 392s # hybrid_2_pure.py 392s # 392s # hybrid_2_pure/ 392s # __init__.py 392s # hybrid_2_pure_1.py 392s # hybrid_2_pure_2.py 392s # 392s # 392s # ------------------------------------------------------------------------- 392s # and here is the "BINARY" distribution layout: 392s # 392s # The comment "CMake" or "Setuptools" indicates which tool is responsible 392s # for placing the file in the tree used to create the binary distribution. 392s # 392s # ROOT/ 392s # 392s # cmakeModule.py # CMake 392s # 392s # cmake/ 392s # __init__.py # CMake 392s # cmake.py # CMake 392s # 392s # hybrid/ 392s # hybrid_cmake.dat # CMake 392s # hybrid_cmake.py # CMake 392s # hybrid_pure.dat # Setuptools 392s # hybrid_pure.py # Setuptools 392s # 392s # data/ 392s # hybrid_data_pure.dat # CMake or Setuptools 392s # hybrid_data_cmake.dat # CMake *NO TEST* 392s # 392s # hybrid_2/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure.py # CMake or Setuptools 392s # hybrid_2_cmake.py # CMake 392s # 392s # hybrid_2_pure/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure_1.py # CMake or Setuptools 392s # hybrid_2_pure_2.py # CMake or Setuptools 392s # 392s # pureModule.py # Setuptools 392s # 392s # pure/ 392s # __init__.py # Setuptools 392s # pure.py # Setuptools 392s # 392s # data/ 392s # pure.dat # Setuptools 392s 392s tmp_dir.join("setup.py").write( 392s textwrap.dedent( 392s """ 392s from skbuild import setup 392s #from setuptools import setup 392s setup( 392s name="test_hybrid_project", 392s version="1.2.3", 392s description=("an hybrid package mixing files installed by both " 392s "CMake and setuptools"), 392s author='The scikit-build team', 392s license="MIT", 392s cmake_source_dir='{cmake_source_dir}', 392s cmake_install_dir='{cmake_install_dir}', 392s # Arbitrary order of packages 392s packages=[ 392s {p_off} 'pure', 392s {h_off} 'hybrid.hybrid_2', 392s {h_off} 'hybrid', 392s {c_off} 'cmake', 392s {p_off} 'hybrid.hybrid_2_pure', 392s ], 392s py_modules=[ 392s {pm_off} '{package_base}pureModule', 392s {cm_off} '{package_base}cmakeModule', 392s ], 392s package_data={{ 392s {p_off} 'pure': ['data/pure.dat'], 392s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 392s }}, 392s # Arbitrary order of package_dir 392s package_dir = {{ 392s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 392s {p_off} 'pure': '{package_base}pure', 392s {h_off} 'hybrid': '{package_base}hybrid', 392s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 392s {c_off} 'cmake': '{package_base}cmake', 392s }} 392s ) 392s """.format( 392s cmake_source_dir=cmake_source_dir, 392s cmake_install_dir=package_base, 392s package_base=package_base_dir, 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s p_off="" if has_pure_package else "#", 392s pm_off="" if has_pure_module else "#", 392s ) 392s ) 392s ) 392s 392s src_dir = tmp_dir.ensure(package_base, dir=1) 392s 392s src_dir.join("CMakeLists.txt").write( 392s textwrap.dedent( 392s """ 392s cmake_minimum_required(VERSION 3.5.0) 392s project(hybrid NONE) 392s set(build_dir ${{CMAKE_BINARY_DIR}}) 392s 392s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 392s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 392s {c_off} install( 392s {c_off} FILES 392s {c_off} ${{build_dir}}/__init__.py 392s {c_off} ${{build_dir}}/cmake.py 392s {c_off} DESTINATION cmake 392s {c_off} ) 392s 392s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 392s {cm_off} install( 392s {cm_off} FILES ${{build_dir}}/cmakeModule.py 392s {cm_off} DESTINATION .) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 392s {h_off} DESTINATION hybrid/data) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 392s {h_off} DESTINATION hybrid/hybrid_2) 392s 392s install(CODE "message(STATUS \\\"Installation complete\\\")") 392s """.format( 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s ) 392s ) 392s ) 392s 392s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 392s path_types: Sequence[str] 392s try: 392s path_types = next( 392s iter( 392s zip( 392s *filter( 392s lambda i: i[1], 392s [ 392s ("c", has_cmake_package), 392s ("cm", has_cmake_module), 392s ("h", has_hybrid_package), 392s ("p", has_pure_package), 392s ("pm", has_pure_module), 392s ], 392s ) 392s ) 392s ) 392s ) 392s except StopIteration: 392s path_types = [] 392s 392s def select_paths(annotated_paths): 392s """Return a filtered list paths considering ``path_types``. 392s 392s `annotated_paths`` is list of tuple ``(type, path)`` where type 392s is either `c`, 'cm', `h`, `p` or 'pm'. 392s 392s """ 392s return filter(lambda i: i[0] in path_types, annotated_paths) 392s 392s # Commented paths are the one expected to be installed by CMake. For 392s # this reason, corresponding files should NOT be created in the source 392s # tree. 392s for _type, path in select_paths( 392s [ 392s # ('c', 'cmake/__init__.py'), 392s # ('c', 'cmake/cmake.py'), 392s # ('cm', 'cmakeModule.py'), 392s ("h", "hybrid/__init__.py"), 392s # ('h', 'hybrid/hybrid_cmake.dat'), 392s # ('h', 'hybrid/hybrid_cmake.py'), 392s ("h", "hybrid/hybrid_pure.dat"), 392s ("h", "hybrid/hybrid_pure.py"), 392s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 392s ("h", "hybrid/data/hybrid_data_pure.dat"), 392s ("h", "hybrid/hybrid_2/__init__.py"), 392s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 392s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 392s ("p", "hybrid/hybrid_2_pure/__init__.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 392s ("pm", "pureModule.py"), 392s ("p", "pure/__init__.py"), 392s ("p", "pure/pure.py"), 392s ("p", "pure/data/pure.dat"), 392s ] 392s ): 392s assert _type in {"p", "pm", "h"} 392s root = package_base if _type in {"p", "pm"} else cmake_source_dir 392s tmp_dir.ensure(os.path.join(root, path)) 392s 392s # Do not call the real setup function. Instead, replace it with 392s # a MagicMock allowing to check with which arguments it was invoked. 392s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 392s 392s # Convenience print function 392s def _pprint(desc, value=None): 392s print( 392s "-----------------\n" 392s f"{desc}:\n" 392s "\n" 392s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 392s ) 392s 392s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 392s 392s _pprint = ._pprint at 0x7537df9f4220> 392s _type = 'p' 392s cmake_source_dir = '' 392s has_cmake_module = 0 392s has_cmake_package = 1 392s has_hybrid_package = 0 392s has_pure_module = 0 392s has_pure_package = 1 392s mock_setup = 392s mocker = 392s package_base = '' 392s package_base_dir = '' 392s path = 'pure/data/pure.dat' 392s path_types = ('c', 'p') 392s root = '' 392s select_paths = .select_paths at 0x7537df9f5b20> 392s src_dir = local('/tmp/pytest-of-ubuntu/pytest-90/test_setup_inputs0') 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-90/test_setup_inputs0') 392s with_package_base = 0 392s 392s tests/test_setup.py:849: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-90/test_setup_inputs0') 392s setup_args = ['build'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-90/test_setup_inputs0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s ________________________ test_setup_inputs[0-0-1-0-1-0] ________________________ 392s 392s has_cmake_package = 0, has_cmake_module = 1, has_hybrid_package = 0 392s has_pure_package = 1, has_pure_module = 0, with_package_base = 0 392s mocker = 392s 392s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 392s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 392s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_module", [0, 1]) 392s @pytest.mark.parametrize("with_package_base", [0, 1]) 392s def test_setup_inputs( 392s has_cmake_package, 392s has_cmake_module, 392s has_hybrid_package, 392s has_pure_package, 392s has_pure_module, 392s with_package_base, 392s mocker, 392s ): 392s """This test that a project can have a package with some modules 392s installed using setup.py and some other modules installed using CMake. 392s """ 392s 392s tmp_dir = _tmpdir("test_setup_inputs") 392s 392s package_base = "to/the/base" if with_package_base else "" 392s package_base_dir = package_base + "/" if package_base else "" 392s cmake_source_dir = package_base 392s 392s if cmake_source_dir and (has_cmake_package or has_cmake_module): 392s pytest.skip( 392s "unsupported configuration: " 392s "python package fully generated by CMake does *NOT* work. " 392s "At least __init__.py should be in the project source tree" 392s ) 392s 392s # ------------------------------------------------------------------------- 392s # Here is the "SOURCE" tree layout: 392s # 392s # ROOT/ 392s # 392s # setup.py 392s # 392s # [/] 392s # 392s # pureModule.py 392s # 392s # pure/ 392s # __init__.py 392s # pure.py 392s # 392s # data/ 392s # pure.dat 392s # 392s # [/] 392s # 392s # hybrid/ 392s # CMakeLists.txt 392s # __init__.py 392s # hybrid_pure.dat 392s # hybrid_pure.py 392s # 392s # data/ 392s # hybrid_data_pure.dat 392s # 392s # hybrid_2/ 392s # __init__.py 392s # hybrid_2_pure.py 392s # 392s # hybrid_2_pure/ 392s # __init__.py 392s # hybrid_2_pure_1.py 392s # hybrid_2_pure_2.py 392s # 392s # 392s # ------------------------------------------------------------------------- 392s # and here is the "BINARY" distribution layout: 392s # 392s # The comment "CMake" or "Setuptools" indicates which tool is responsible 392s # for placing the file in the tree used to create the binary distribution. 392s # 392s # ROOT/ 392s # 392s # cmakeModule.py # CMake 392s # 392s # cmake/ 392s # __init__.py # CMake 392s # cmake.py # CMake 392s # 392s # hybrid/ 392s # hybrid_cmake.dat # CMake 392s # hybrid_cmake.py # CMake 392s # hybrid_pure.dat # Setuptools 392s # hybrid_pure.py # Setuptools 392s # 392s # data/ 392s # hybrid_data_pure.dat # CMake or Setuptools 392s # hybrid_data_cmake.dat # CMake *NO TEST* 392s # 392s # hybrid_2/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure.py # CMake or Setuptools 392s # hybrid_2_cmake.py # CMake 392s # 392s # hybrid_2_pure/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure_1.py # CMake or Setuptools 392s # hybrid_2_pure_2.py # CMake or Setuptools 392s # 392s # pureModule.py # Setuptools 392s # 392s # pure/ 392s # __init__.py # Setuptools 392s # pure.py # Setuptools 392s # 392s # data/ 392s # pure.dat # Setuptools 392s 392s tmp_dir.join("setup.py").write( 392s textwrap.dedent( 392s """ 392s from skbuild import setup 392s #from setuptools import setup 392s setup( 392s name="test_hybrid_project", 392s version="1.2.3", 392s description=("an hybrid package mixing files installed by both " 392s "CMake and setuptools"), 392s author='The scikit-build team', 392s license="MIT", 392s cmake_source_dir='{cmake_source_dir}', 392s cmake_install_dir='{cmake_install_dir}', 392s # Arbitrary order of packages 392s packages=[ 392s {p_off} 'pure', 392s {h_off} 'hybrid.hybrid_2', 392s {h_off} 'hybrid', 392s {c_off} 'cmake', 392s {p_off} 'hybrid.hybrid_2_pure', 392s ], 392s py_modules=[ 392s {pm_off} '{package_base}pureModule', 392s {cm_off} '{package_base}cmakeModule', 392s ], 392s package_data={{ 392s {p_off} 'pure': ['data/pure.dat'], 392s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 392s }}, 392s # Arbitrary order of package_dir 392s package_dir = {{ 392s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 392s {p_off} 'pure': '{package_base}pure', 392s {h_off} 'hybrid': '{package_base}hybrid', 392s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 392s {c_off} 'cmake': '{package_base}cmake', 392s }} 392s ) 392s """.format( 392s cmake_source_dir=cmake_source_dir, 392s cmake_install_dir=package_base, 392s package_base=package_base_dir, 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s p_off="" if has_pure_package else "#", 392s pm_off="" if has_pure_module else "#", 392s ) 392s ) 392s ) 392s 392s src_dir = tmp_dir.ensure(package_base, dir=1) 392s 392s src_dir.join("CMakeLists.txt").write( 392s textwrap.dedent( 392s """ 392s cmake_minimum_required(VERSION 3.5.0) 392s project(hybrid NONE) 392s set(build_dir ${{CMAKE_BINARY_DIR}}) 392s 392s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 392s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 392s {c_off} install( 392s {c_off} FILES 392s {c_off} ${{build_dir}}/__init__.py 392s {c_off} ${{build_dir}}/cmake.py 392s {c_off} DESTINATION cmake 392s {c_off} ) 392s 392s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 392s {cm_off} install( 392s {cm_off} FILES ${{build_dir}}/cmakeModule.py 392s {cm_off} DESTINATION .) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 392s {h_off} DESTINATION hybrid/data) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 392s {h_off} DESTINATION hybrid/hybrid_2) 392s 392s install(CODE "message(STATUS \\\"Installation complete\\\")") 392s """.format( 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s ) 392s ) 392s ) 392s 392s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 392s path_types: Sequence[str] 392s try: 392s path_types = next( 392s iter( 392s zip( 392s *filter( 392s lambda i: i[1], 392s [ 392s ("c", has_cmake_package), 392s ("cm", has_cmake_module), 392s ("h", has_hybrid_package), 392s ("p", has_pure_package), 392s ("pm", has_pure_module), 392s ], 392s ) 392s ) 392s ) 392s ) 392s except StopIteration: 392s path_types = [] 392s 392s def select_paths(annotated_paths): 392s """Return a filtered list paths considering ``path_types``. 392s 392s `annotated_paths`` is list of tuple ``(type, path)`` where type 392s is either `c`, 'cm', `h`, `p` or 'pm'. 392s 392s """ 392s return filter(lambda i: i[0] in path_types, annotated_paths) 392s 392s # Commented paths are the one expected to be installed by CMake. For 392s # this reason, corresponding files should NOT be created in the source 392s # tree. 392s for _type, path in select_paths( 392s [ 392s # ('c', 'cmake/__init__.py'), 392s # ('c', 'cmake/cmake.py'), 392s # ('cm', 'cmakeModule.py'), 392s ("h", "hybrid/__init__.py"), 392s # ('h', 'hybrid/hybrid_cmake.dat'), 392s # ('h', 'hybrid/hybrid_cmake.py'), 392s ("h", "hybrid/hybrid_pure.dat"), 392s ("h", "hybrid/hybrid_pure.py"), 392s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 392s ("h", "hybrid/data/hybrid_data_pure.dat"), 392s ("h", "hybrid/hybrid_2/__init__.py"), 392s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 392s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 392s ("p", "hybrid/hybrid_2_pure/__init__.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 392s ("pm", "pureModule.py"), 392s ("p", "pure/__init__.py"), 392s ("p", "pure/pure.py"), 392s ("p", "pure/data/pure.dat"), 392s ] 392s ): 392s assert _type in {"p", "pm", "h"} 392s root = package_base if _type in {"p", "pm"} else cmake_source_dir 392s tmp_dir.ensure(os.path.join(root, path)) 392s 392s # Do not call the real setup function. Instead, replace it with 392s # a MagicMock allowing to check with which arguments it was invoked. 392s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 392s 392s # Convenience print function 392s def _pprint(desc, value=None): 392s print( 392s "-----------------\n" 392s f"{desc}:\n" 392s "\n" 392s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 392s ) 392s 392s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 392s 392s _pprint = ._pprint at 0x7537df9f6840> 392s _type = 'p' 392s cmake_source_dir = '' 392s has_cmake_module = 1 392s has_cmake_package = 0 392s has_hybrid_package = 0 392s has_pure_module = 0 392s has_pure_package = 1 392s mock_setup = 392s mocker = 392s package_base = '' 392s package_base_dir = '' 392s path = 'pure/data/pure.dat' 392s path_types = ('cm', 'p') 392s root = '' 392s select_paths = .select_paths at 0x7537dfd3f560> 392s src_dir = local('/tmp/pytest-of-ubuntu/pytest-91/test_setup_inputs0') 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-91/test_setup_inputs0') 392s with_package_base = 0 392s 392s tests/test_setup.py:849: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-91/test_setup_inputs0') 392s setup_args = ['build'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-91/test_setup_inputs0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s ________________________ test_setup_inputs[0-0-1-0-1-1] ________________________ 392s 392s has_cmake_package = 1, has_cmake_module = 1, has_hybrid_package = 0 392s has_pure_package = 1, has_pure_module = 0, with_package_base = 0 392s mocker = 392s 392s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 392s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 392s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_module", [0, 1]) 392s @pytest.mark.parametrize("with_package_base", [0, 1]) 392s def test_setup_inputs( 392s has_cmake_package, 392s has_cmake_module, 392s has_hybrid_package, 392s has_pure_package, 392s has_pure_module, 392s with_package_base, 392s mocker, 392s ): 392s """This test that a project can have a package with some modules 392s installed using setup.py and some other modules installed using CMake. 392s """ 392s 392s tmp_dir = _tmpdir("test_setup_inputs") 392s 392s package_base = "to/the/base" if with_package_base else "" 392s package_base_dir = package_base + "/" if package_base else "" 392s cmake_source_dir = package_base 392s 392s if cmake_source_dir and (has_cmake_package or has_cmake_module): 392s pytest.skip( 392s "unsupported configuration: " 392s "python package fully generated by CMake does *NOT* work. " 392s "At least __init__.py should be in the project source tree" 392s ) 392s 392s # ------------------------------------------------------------------------- 392s # Here is the "SOURCE" tree layout: 392s # 392s # ROOT/ 392s # 392s # setup.py 392s # 392s # [/] 392s # 392s # pureModule.py 392s # 392s # pure/ 392s # __init__.py 392s # pure.py 392s # 392s # data/ 392s # pure.dat 392s # 392s # [/] 392s # 392s # hybrid/ 392s # CMakeLists.txt 392s # __init__.py 392s # hybrid_pure.dat 392s # hybrid_pure.py 392s # 392s # data/ 392s # hybrid_data_pure.dat 392s # 392s # hybrid_2/ 392s # __init__.py 392s # hybrid_2_pure.py 392s # 392s # hybrid_2_pure/ 392s # __init__.py 392s # hybrid_2_pure_1.py 392s # hybrid_2_pure_2.py 392s # 392s # 392s # ------------------------------------------------------------------------- 392s # and here is the "BINARY" distribution layout: 392s # 392s # The comment "CMake" or "Setuptools" indicates which tool is responsible 392s # for placing the file in the tree used to create the binary distribution. 392s # 392s # ROOT/ 392s # 392s # cmakeModule.py # CMake 392s # 392s # cmake/ 392s # __init__.py # CMake 392s # cmake.py # CMake 392s # 392s # hybrid/ 392s # hybrid_cmake.dat # CMake 392s # hybrid_cmake.py # CMake 392s # hybrid_pure.dat # Setuptools 392s # hybrid_pure.py # Setuptools 392s # 392s # data/ 392s # hybrid_data_pure.dat # CMake or Setuptools 392s # hybrid_data_cmake.dat # CMake *NO TEST* 392s # 392s # hybrid_2/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure.py # CMake or Setuptools 392s # hybrid_2_cmake.py # CMake 392s # 392s # hybrid_2_pure/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure_1.py # CMake or Setuptools 392s # hybrid_2_pure_2.py # CMake or Setuptools 392s # 392s # pureModule.py # Setuptools 392s # 392s # pure/ 392s # __init__.py # Setuptools 392s # pure.py # Setuptools 392s # 392s # data/ 392s # pure.dat # Setuptools 392s 392s tmp_dir.join("setup.py").write( 392s textwrap.dedent( 392s """ 392s from skbuild import setup 392s #from setuptools import setup 392s setup( 392s name="test_hybrid_project", 392s version="1.2.3", 392s description=("an hybrid package mixing files installed by both " 392s "CMake and setuptools"), 392s author='The scikit-build team', 392s license="MIT", 392s cmake_source_dir='{cmake_source_dir}', 392s cmake_install_dir='{cmake_install_dir}', 392s # Arbitrary order of packages 392s packages=[ 392s {p_off} 'pure', 392s {h_off} 'hybrid.hybrid_2', 392s {h_off} 'hybrid', 392s {c_off} 'cmake', 392s {p_off} 'hybrid.hybrid_2_pure', 392s ], 392s py_modules=[ 392s {pm_off} '{package_base}pureModule', 392s {cm_off} '{package_base}cmakeModule', 392s ], 392s package_data={{ 392s {p_off} 'pure': ['data/pure.dat'], 392s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 392s }}, 392s # Arbitrary order of package_dir 392s package_dir = {{ 392s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 392s {p_off} 'pure': '{package_base}pure', 392s {h_off} 'hybrid': '{package_base}hybrid', 392s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 392s {c_off} 'cmake': '{package_base}cmake', 392s }} 392s ) 392s """.format( 392s cmake_source_dir=cmake_source_dir, 392s cmake_install_dir=package_base, 392s package_base=package_base_dir, 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s p_off="" if has_pure_package else "#", 392s pm_off="" if has_pure_module else "#", 392s ) 392s ) 392s ) 392s 392s src_dir = tmp_dir.ensure(package_base, dir=1) 392s 392s src_dir.join("CMakeLists.txt").write( 392s textwrap.dedent( 392s """ 392s cmake_minimum_required(VERSION 3.5.0) 392s project(hybrid NONE) 392s set(build_dir ${{CMAKE_BINARY_DIR}}) 392s 392s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 392s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 392s {c_off} install( 392s {c_off} FILES 392s {c_off} ${{build_dir}}/__init__.py 392s {c_off} ${{build_dir}}/cmake.py 392s {c_off} DESTINATION cmake 392s {c_off} ) 392s 392s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 392s {cm_off} install( 392s {cm_off} FILES ${{build_dir}}/cmakeModule.py 392s {cm_off} DESTINATION .) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 392s {h_off} DESTINATION hybrid/data) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 392s {h_off} DESTINATION hybrid/hybrid_2) 392s 392s install(CODE "message(STATUS \\\"Installation complete\\\")") 392s """.format( 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s ) 392s ) 392s ) 392s 392s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 392s path_types: Sequence[str] 392s try: 392s path_types = next( 392s iter( 392s zip( 392s *filter( 392s lambda i: i[1], 392s [ 392s ("c", has_cmake_package), 392s ("cm", has_cmake_module), 392s ("h", has_hybrid_package), 392s ("p", has_pure_package), 392s ("pm", has_pure_module), 392s ], 392s ) 392s ) 392s ) 392s ) 392s except StopIteration: 392s path_types = [] 392s 392s def select_paths(annotated_paths): 392s """Return a filtered list paths considering ``path_types``. 392s 392s `annotated_paths`` is list of tuple ``(type, path)`` where type 392s is either `c`, 'cm', `h`, `p` or 'pm'. 392s 392s """ 392s return filter(lambda i: i[0] in path_types, annotated_paths) 392s 392s # Commented paths are the one expected to be installed by CMake. For 392s # this reason, corresponding files should NOT be created in the source 392s # tree. 392s for _type, path in select_paths( 392s [ 392s # ('c', 'cmake/__init__.py'), 392s # ('c', 'cmake/cmake.py'), 392s # ('cm', 'cmakeModule.py'), 392s ("h", "hybrid/__init__.py"), 392s # ('h', 'hybrid/hybrid_cmake.dat'), 392s # ('h', 'hybrid/hybrid_cmake.py'), 392s ("h", "hybrid/hybrid_pure.dat"), 392s ("h", "hybrid/hybrid_pure.py"), 392s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 392s ("h", "hybrid/data/hybrid_data_pure.dat"), 392s ("h", "hybrid/hybrid_2/__init__.py"), 392s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 392s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 392s ("p", "hybrid/hybrid_2_pure/__init__.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 392s ("pm", "pureModule.py"), 392s ("p", "pure/__init__.py"), 392s ("p", "pure/pure.py"), 392s ("p", "pure/data/pure.dat"), 392s ] 392s ): 392s assert _type in {"p", "pm", "h"} 392s root = package_base if _type in {"p", "pm"} else cmake_source_dir 392s tmp_dir.ensure(os.path.join(root, path)) 392s 392s # Do not call the real setup function. Instead, replace it with 392s # a MagicMock allowing to check with which arguments it was invoked. 392s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 392s 392s # Convenience print function 392s def _pprint(desc, value=None): 392s print( 392s "-----------------\n" 392s f"{desc}:\n" 392s "\n" 392s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 392s ) 392s 392s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 392s 392s _pprint = ._pprint at 0x7537df9f6de0> 392s _type = 'p' 392s cmake_source_dir = '' 392s has_cmake_module = 1 392s has_cmake_package = 1 392s has_hybrid_package = 0 392s has_pure_module = 0 392s has_pure_package = 1 392s mock_setup = 392s mocker = 392s package_base = '' 392s package_base_dir = '' 392s path = 'pure/data/pure.dat' 392s path_types = ('c', 'cm', 'p') 392s root = '' 392s select_paths = .select_paths at 0x7537df9f6b60> 392s src_dir = local('/tmp/pytest-of-ubuntu/pytest-92/test_setup_inputs0') 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-92/test_setup_inputs0') 392s with_package_base = 0 392s 392s tests/test_setup.py:849: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-92/test_setup_inputs0') 392s setup_args = ['build'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-92/test_setup_inputs0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s ________________________ test_setup_inputs[0-0-1-1-0-0] ________________________ 392s 392s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 1 392s has_pure_package = 1, has_pure_module = 0, with_package_base = 0 392s mocker = 392s 392s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 392s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 392s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_module", [0, 1]) 392s @pytest.mark.parametrize("with_package_base", [0, 1]) 392s def test_setup_inputs( 392s has_cmake_package, 392s has_cmake_module, 392s has_hybrid_package, 392s has_pure_package, 392s has_pure_module, 392s with_package_base, 392s mocker, 392s ): 392s """This test that a project can have a package with some modules 392s installed using setup.py and some other modules installed using CMake. 392s """ 392s 392s tmp_dir = _tmpdir("test_setup_inputs") 392s 392s package_base = "to/the/base" if with_package_base else "" 392s package_base_dir = package_base + "/" if package_base else "" 392s cmake_source_dir = package_base 392s 392s if cmake_source_dir and (has_cmake_package or has_cmake_module): 392s pytest.skip( 392s "unsupported configuration: " 392s "python package fully generated by CMake does *NOT* work. " 392s "At least __init__.py should be in the project source tree" 392s ) 392s 392s # ------------------------------------------------------------------------- 392s # Here is the "SOURCE" tree layout: 392s # 392s # ROOT/ 392s # 392s # setup.py 392s # 392s # [/] 392s # 392s # pureModule.py 392s # 392s # pure/ 392s # __init__.py 392s # pure.py 392s # 392s # data/ 392s # pure.dat 392s # 392s # [/] 392s # 392s # hybrid/ 392s # CMakeLists.txt 392s # __init__.py 392s # hybrid_pure.dat 392s # hybrid_pure.py 392s # 392s # data/ 392s # hybrid_data_pure.dat 392s # 392s # hybrid_2/ 392s # __init__.py 392s # hybrid_2_pure.py 392s # 392s # hybrid_2_pure/ 392s # __init__.py 392s # hybrid_2_pure_1.py 392s # hybrid_2_pure_2.py 392s # 392s # 392s # ------------------------------------------------------------------------- 392s # and here is the "BINARY" distribution layout: 392s # 392s # The comment "CMake" or "Setuptools" indicates which tool is responsible 392s # for placing the file in the tree used to create the binary distribution. 392s # 392s # ROOT/ 392s # 392s # cmakeModule.py # CMake 392s # 392s # cmake/ 392s # __init__.py # CMake 392s # cmake.py # CMake 392s # 392s # hybrid/ 392s # hybrid_cmake.dat # CMake 392s # hybrid_cmake.py # CMake 392s # hybrid_pure.dat # Setuptools 392s # hybrid_pure.py # Setuptools 392s # 392s # data/ 392s # hybrid_data_pure.dat # CMake or Setuptools 392s # hybrid_data_cmake.dat # CMake *NO TEST* 392s # 392s # hybrid_2/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure.py # CMake or Setuptools 392s # hybrid_2_cmake.py # CMake 392s # 392s # hybrid_2_pure/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure_1.py # CMake or Setuptools 392s # hybrid_2_pure_2.py # CMake or Setuptools 392s # 392s # pureModule.py # Setuptools 392s # 392s # pure/ 392s # __init__.py # Setuptools 392s # pure.py # Setuptools 392s # 392s # data/ 392s # pure.dat # Setuptools 392s 392s tmp_dir.join("setup.py").write( 392s textwrap.dedent( 392s """ 392s from skbuild import setup 392s #from setuptools import setup 392s setup( 392s name="test_hybrid_project", 392s version="1.2.3", 392s description=("an hybrid package mixing files installed by both " 392s "CMake and setuptools"), 392s author='The scikit-build team', 392s license="MIT", 392s cmake_source_dir='{cmake_source_dir}', 392s cmake_install_dir='{cmake_install_dir}', 392s # Arbitrary order of packages 392s packages=[ 392s {p_off} 'pure', 392s {h_off} 'hybrid.hybrid_2', 392s {h_off} 'hybrid', 392s {c_off} 'cmake', 392s {p_off} 'hybrid.hybrid_2_pure', 392s ], 392s py_modules=[ 392s {pm_off} '{package_base}pureModule', 392s {cm_off} '{package_base}cmakeModule', 392s ], 392s package_data={{ 392s {p_off} 'pure': ['data/pure.dat'], 392s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 392s }}, 392s # Arbitrary order of package_dir 392s package_dir = {{ 392s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 392s {p_off} 'pure': '{package_base}pure', 392s {h_off} 'hybrid': '{package_base}hybrid', 392s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 392s {c_off} 'cmake': '{package_base}cmake', 392s }} 392s ) 392s """.format( 392s cmake_source_dir=cmake_source_dir, 392s cmake_install_dir=package_base, 392s package_base=package_base_dir, 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s p_off="" if has_pure_package else "#", 392s pm_off="" if has_pure_module else "#", 392s ) 392s ) 392s ) 392s 392s src_dir = tmp_dir.ensure(package_base, dir=1) 392s 392s src_dir.join("CMakeLists.txt").write( 392s textwrap.dedent( 392s """ 392s cmake_minimum_required(VERSION 3.5.0) 392s project(hybrid NONE) 392s set(build_dir ${{CMAKE_BINARY_DIR}}) 392s 392s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 392s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 392s {c_off} install( 392s {c_off} FILES 392s {c_off} ${{build_dir}}/__init__.py 392s {c_off} ${{build_dir}}/cmake.py 392s {c_off} DESTINATION cmake 392s {c_off} ) 392s 392s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 392s {cm_off} install( 392s {cm_off} FILES ${{build_dir}}/cmakeModule.py 392s {cm_off} DESTINATION .) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 392s {h_off} DESTINATION hybrid/data) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 392s {h_off} DESTINATION hybrid/hybrid_2) 392s 392s install(CODE "message(STATUS \\\"Installation complete\\\")") 392s """.format( 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s ) 392s ) 392s ) 392s 392s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 392s path_types: Sequence[str] 392s try: 392s path_types = next( 392s iter( 392s zip( 392s *filter( 392s lambda i: i[1], 392s [ 392s ("c", has_cmake_package), 392s ("cm", has_cmake_module), 392s ("h", has_hybrid_package), 392s ("p", has_pure_package), 392s ("pm", has_pure_module), 392s ], 392s ) 392s ) 392s ) 392s ) 392s except StopIteration: 392s path_types = [] 392s 392s def select_paths(annotated_paths): 392s """Return a filtered list paths considering ``path_types``. 392s 392s `annotated_paths`` is list of tuple ``(type, path)`` where type 392s is either `c`, 'cm', `h`, `p` or 'pm'. 392s 392s """ 392s return filter(lambda i: i[0] in path_types, annotated_paths) 392s 392s # Commented paths are the one expected to be installed by CMake. For 392s # this reason, corresponding files should NOT be created in the source 392s # tree. 392s for _type, path in select_paths( 392s [ 392s # ('c', 'cmake/__init__.py'), 392s # ('c', 'cmake/cmake.py'), 392s # ('cm', 'cmakeModule.py'), 392s ("h", "hybrid/__init__.py"), 392s # ('h', 'hybrid/hybrid_cmake.dat'), 392s # ('h', 'hybrid/hybrid_cmake.py'), 392s ("h", "hybrid/hybrid_pure.dat"), 392s ("h", "hybrid/hybrid_pure.py"), 392s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 392s ("h", "hybrid/data/hybrid_data_pure.dat"), 392s ("h", "hybrid/hybrid_2/__init__.py"), 392s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 392s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 392s ("p", "hybrid/hybrid_2_pure/__init__.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 392s ("pm", "pureModule.py"), 392s ("p", "pure/__init__.py"), 392s ("p", "pure/pure.py"), 392s ("p", "pure/data/pure.dat"), 392s ] 392s ): 392s assert _type in {"p", "pm", "h"} 392s root = package_base if _type in {"p", "pm"} else cmake_source_dir 392s tmp_dir.ensure(os.path.join(root, path)) 392s 392s # Do not call the real setup function. Instead, replace it with 392s # a MagicMock allowing to check with which arguments it was invoked. 392s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 392s 392s # Convenience print function 392s def _pprint(desc, value=None): 392s print( 392s "-----------------\n" 392s f"{desc}:\n" 392s "\n" 392s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 392s ) 392s 392s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 392s 392s _pprint = ._pprint at 0x7537df9f51c0> 392s _type = 'p' 392s cmake_source_dir = '' 392s has_cmake_module = 0 392s has_cmake_package = 0 392s has_hybrid_package = 1 392s has_pure_module = 0 392s has_pure_package = 1 392s mock_setup = 392s mocker = 392s package_base = '' 392s package_base_dir = '' 392s path = 'pure/data/pure.dat' 392s path_types = ('h', 'p') 392s root = '' 392s select_paths = .select_paths at 0x7537df9f7100> 392s src_dir = local('/tmp/pytest-of-ubuntu/pytest-93/test_setup_inputs0') 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-93/test_setup_inputs0') 392s with_package_base = 0 392s 392s tests/test_setup.py:849: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-93/test_setup_inputs0') 392s setup_args = ['build'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-93/test_setup_inputs0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s ________________________ test_setup_inputs[0-0-1-1-0-1] ________________________ 392s 392s has_cmake_package = 1, has_cmake_module = 0, has_hybrid_package = 1 392s has_pure_package = 1, has_pure_module = 0, with_package_base = 0 392s mocker = 392s 392s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 392s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 392s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_module", [0, 1]) 392s @pytest.mark.parametrize("with_package_base", [0, 1]) 392s def test_setup_inputs( 392s has_cmake_package, 392s has_cmake_module, 392s has_hybrid_package, 392s has_pure_package, 392s has_pure_module, 392s with_package_base, 392s mocker, 392s ): 392s """This test that a project can have a package with some modules 392s installed using setup.py and some other modules installed using CMake. 392s """ 392s 392s tmp_dir = _tmpdir("test_setup_inputs") 392s 392s package_base = "to/the/base" if with_package_base else "" 392s package_base_dir = package_base + "/" if package_base else "" 392s cmake_source_dir = package_base 392s 392s if cmake_source_dir and (has_cmake_package or has_cmake_module): 392s pytest.skip( 392s "unsupported configuration: " 392s "python package fully generated by CMake does *NOT* work. " 392s "At least __init__.py should be in the project source tree" 392s ) 392s 392s # ------------------------------------------------------------------------- 392s # Here is the "SOURCE" tree layout: 392s # 392s # ROOT/ 392s # 392s # setup.py 392s # 392s # [/] 392s # 392s # pureModule.py 392s # 392s # pure/ 392s # __init__.py 392s # pure.py 392s # 392s # data/ 392s # pure.dat 392s # 392s # [/] 392s # 392s # hybrid/ 392s # CMakeLists.txt 392s # __init__.py 392s # hybrid_pure.dat 392s # hybrid_pure.py 392s # 392s # data/ 392s # hybrid_data_pure.dat 392s # 392s # hybrid_2/ 392s # __init__.py 392s # hybrid_2_pure.py 392s # 392s # hybrid_2_pure/ 392s # __init__.py 392s # hybrid_2_pure_1.py 392s # hybrid_2_pure_2.py 392s # 392s # 392s # ------------------------------------------------------------------------- 392s # and here is the "BINARY" distribution layout: 392s # 392s # The comment "CMake" or "Setuptools" indicates which tool is responsible 392s # for placing the file in the tree used to create the binary distribution. 392s # 392s # ROOT/ 392s # 392s # cmakeModule.py # CMake 392s # 392s # cmake/ 392s # __init__.py # CMake 392s # cmake.py # CMake 392s # 392s # hybrid/ 392s # hybrid_cmake.dat # CMake 392s # hybrid_cmake.py # CMake 392s # hybrid_pure.dat # Setuptools 392s # hybrid_pure.py # Setuptools 392s # 392s # data/ 392s # hybrid_data_pure.dat # CMake or Setuptools 392s # hybrid_data_cmake.dat # CMake *NO TEST* 392s # 392s # hybrid_2/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure.py # CMake or Setuptools 392s # hybrid_2_cmake.py # CMake 392s # 392s # hybrid_2_pure/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure_1.py # CMake or Setuptools 392s # hybrid_2_pure_2.py # CMake or Setuptools 392s # 392s # pureModule.py # Setuptools 392s # 392s # pure/ 392s # __init__.py # Setuptools 392s # pure.py # Setuptools 392s # 392s # data/ 392s # pure.dat # Setuptools 392s 392s tmp_dir.join("setup.py").write( 392s textwrap.dedent( 392s """ 392s from skbuild import setup 392s #from setuptools import setup 392s setup( 392s name="test_hybrid_project", 392s version="1.2.3", 392s description=("an hybrid package mixing files installed by both " 392s "CMake and setuptools"), 392s author='The scikit-build team', 392s license="MIT", 392s cmake_source_dir='{cmake_source_dir}', 392s cmake_install_dir='{cmake_install_dir}', 392s # Arbitrary order of packages 392s packages=[ 392s {p_off} 'pure', 392s {h_off} 'hybrid.hybrid_2', 392s {h_off} 'hybrid', 392s {c_off} 'cmake', 392s {p_off} 'hybrid.hybrid_2_pure', 392s ], 392s py_modules=[ 392s {pm_off} '{package_base}pureModule', 392s {cm_off} '{package_base}cmakeModule', 392s ], 392s package_data={{ 392s {p_off} 'pure': ['data/pure.dat'], 392s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 392s }}, 392s # Arbitrary order of package_dir 392s package_dir = {{ 392s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 392s {p_off} 'pure': '{package_base}pure', 392s {h_off} 'hybrid': '{package_base}hybrid', 392s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 392s {c_off} 'cmake': '{package_base}cmake', 392s }} 392s ) 392s """.format( 392s cmake_source_dir=cmake_source_dir, 392s cmake_install_dir=package_base, 392s package_base=package_base_dir, 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s p_off="" if has_pure_package else "#", 392s pm_off="" if has_pure_module else "#", 392s ) 392s ) 392s ) 392s 392s src_dir = tmp_dir.ensure(package_base, dir=1) 392s 392s src_dir.join("CMakeLists.txt").write( 392s textwrap.dedent( 392s """ 392s cmake_minimum_required(VERSION 3.5.0) 392s project(hybrid NONE) 392s set(build_dir ${{CMAKE_BINARY_DIR}}) 392s 392s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 392s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 392s {c_off} install( 392s {c_off} FILES 392s {c_off} ${{build_dir}}/__init__.py 392s {c_off} ${{build_dir}}/cmake.py 392s {c_off} DESTINATION cmake 392s {c_off} ) 392s 392s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 392s {cm_off} install( 392s {cm_off} FILES ${{build_dir}}/cmakeModule.py 392s {cm_off} DESTINATION .) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 392s {h_off} DESTINATION hybrid/data) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 392s {h_off} DESTINATION hybrid/hybrid_2) 392s 392s install(CODE "message(STATUS \\\"Installation complete\\\")") 392s """.format( 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s ) 392s ) 392s ) 392s 392s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 392s path_types: Sequence[str] 392s try: 392s path_types = next( 392s iter( 392s zip( 392s *filter( 392s lambda i: i[1], 392s [ 392s ("c", has_cmake_package), 392s ("cm", has_cmake_module), 392s ("h", has_hybrid_package), 392s ("p", has_pure_package), 392s ("pm", has_pure_module), 392s ], 392s ) 392s ) 392s ) 392s ) 392s except StopIteration: 392s path_types = [] 392s 392s def select_paths(annotated_paths): 392s """Return a filtered list paths considering ``path_types``. 392s 392s `annotated_paths`` is list of tuple ``(type, path)`` where type 392s is either `c`, 'cm', `h`, `p` or 'pm'. 392s 392s """ 392s return filter(lambda i: i[0] in path_types, annotated_paths) 392s 392s # Commented paths are the one expected to be installed by CMake. For 392s # this reason, corresponding files should NOT be created in the source 392s # tree. 392s for _type, path in select_paths( 392s [ 392s # ('c', 'cmake/__init__.py'), 392s # ('c', 'cmake/cmake.py'), 392s # ('cm', 'cmakeModule.py'), 392s ("h", "hybrid/__init__.py"), 392s # ('h', 'hybrid/hybrid_cmake.dat'), 392s # ('h', 'hybrid/hybrid_cmake.py'), 392s ("h", "hybrid/hybrid_pure.dat"), 392s ("h", "hybrid/hybrid_pure.py"), 392s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 392s ("h", "hybrid/data/hybrid_data_pure.dat"), 392s ("h", "hybrid/hybrid_2/__init__.py"), 392s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 392s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 392s ("p", "hybrid/hybrid_2_pure/__init__.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 392s ("pm", "pureModule.py"), 392s ("p", "pure/__init__.py"), 392s ("p", "pure/pure.py"), 392s ("p", "pure/data/pure.dat"), 392s ] 392s ): 392s assert _type in {"p", "pm", "h"} 392s root = package_base if _type in {"p", "pm"} else cmake_source_dir 392s tmp_dir.ensure(os.path.join(root, path)) 392s 392s # Do not call the real setup function. Instead, replace it with 392s # a MagicMock allowing to check with which arguments it was invoked. 392s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 392s 392s # Convenience print function 392s def _pprint(desc, value=None): 392s print( 392s "-----------------\n" 392s f"{desc}:\n" 392s "\n" 392s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 392s ) 392s 392s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 392s 392s _pprint = ._pprint at 0x7537df9f4040> 392s _type = 'p' 392s cmake_source_dir = '' 392s has_cmake_module = 0 392s has_cmake_package = 1 392s has_hybrid_package = 1 392s has_pure_module = 0 392s has_pure_package = 1 392s mock_setup = 392s mocker = 392s package_base = '' 392s package_base_dir = '' 392s path = 'pure/data/pure.dat' 392s path_types = ('c', 'h', 'p') 392s root = '' 392s select_paths = .select_paths at 0x7537df9f45e0> 392s src_dir = local('/tmp/pytest-of-ubuntu/pytest-94/test_setup_inputs0') 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-94/test_setup_inputs0') 392s with_package_base = 0 392s 392s tests/test_setup.py:849: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-94/test_setup_inputs0') 392s setup_args = ['build'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-94/test_setup_inputs0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s ________________________ test_setup_inputs[0-0-1-1-1-0] ________________________ 392s 392s has_cmake_package = 0, has_cmake_module = 1, has_hybrid_package = 1 392s has_pure_package = 1, has_pure_module = 0, with_package_base = 0 392s mocker = 392s 392s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 392s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 392s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_module", [0, 1]) 392s @pytest.mark.parametrize("with_package_base", [0, 1]) 392s def test_setup_inputs( 392s has_cmake_package, 392s has_cmake_module, 392s has_hybrid_package, 392s has_pure_package, 392s has_pure_module, 392s with_package_base, 392s mocker, 392s ): 392s """This test that a project can have a package with some modules 392s installed using setup.py and some other modules installed using CMake. 392s """ 392s 392s tmp_dir = _tmpdir("test_setup_inputs") 392s 392s package_base = "to/the/base" if with_package_base else "" 392s package_base_dir = package_base + "/" if package_base else "" 392s cmake_source_dir = package_base 392s 392s if cmake_source_dir and (has_cmake_package or has_cmake_module): 392s pytest.skip( 392s "unsupported configuration: " 392s "python package fully generated by CMake does *NOT* work. " 392s "At least __init__.py should be in the project source tree" 392s ) 392s 392s # ------------------------------------------------------------------------- 392s # Here is the "SOURCE" tree layout: 392s # 392s # ROOT/ 392s # 392s # setup.py 392s # 392s # [/] 392s # 392s # pureModule.py 392s # 392s # pure/ 392s # __init__.py 392s # pure.py 392s # 392s # data/ 392s # pure.dat 392s # 392s # [/] 392s # 392s # hybrid/ 392s # CMakeLists.txt 392s # __init__.py 392s # hybrid_pure.dat 392s # hybrid_pure.py 392s # 392s # data/ 392s # hybrid_data_pure.dat 392s # 392s # hybrid_2/ 392s # __init__.py 392s # hybrid_2_pure.py 392s # 392s # hybrid_2_pure/ 392s # __init__.py 392s # hybrid_2_pure_1.py 392s # hybrid_2_pure_2.py 392s # 392s # 392s # ------------------------------------------------------------------------- 392s # and here is the "BINARY" distribution layout: 392s # 392s # The comment "CMake" or "Setuptools" indicates which tool is responsible 392s # for placing the file in the tree used to create the binary distribution. 392s # 392s # ROOT/ 392s # 392s # cmakeModule.py # CMake 392s # 392s # cmake/ 392s # __init__.py # CMake 392s # cmake.py # CMake 392s # 392s # hybrid/ 392s # hybrid_cmake.dat # CMake 392s # hybrid_cmake.py # CMake 392s # hybrid_pure.dat # Setuptools 392s # hybrid_pure.py # Setuptools 392s # 392s # data/ 392s # hybrid_data_pure.dat # CMake or Setuptools 392s # hybrid_data_cmake.dat # CMake *NO TEST* 392s # 392s # hybrid_2/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure.py # CMake or Setuptools 392s # hybrid_2_cmake.py # CMake 392s # 392s # hybrid_2_pure/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure_1.py # CMake or Setuptools 392s # hybrid_2_pure_2.py # CMake or Setuptools 392s # 392s # pureModule.py # Setuptools 392s # 392s # pure/ 392s # __init__.py # Setuptools 392s # pure.py # Setuptools 392s # 392s # data/ 392s # pure.dat # Setuptools 392s 392s tmp_dir.join("setup.py").write( 392s textwrap.dedent( 392s """ 392s from skbuild import setup 392s #from setuptools import setup 392s setup( 392s name="test_hybrid_project", 392s version="1.2.3", 392s description=("an hybrid package mixing files installed by both " 392s "CMake and setuptools"), 392s author='The scikit-build team', 392s license="MIT", 392s cmake_source_dir='{cmake_source_dir}', 392s cmake_install_dir='{cmake_install_dir}', 392s # Arbitrary order of packages 392s packages=[ 392s {p_off} 'pure', 392s {h_off} 'hybrid.hybrid_2', 392s {h_off} 'hybrid', 392s {c_off} 'cmake', 392s {p_off} 'hybrid.hybrid_2_pure', 392s ], 392s py_modules=[ 392s {pm_off} '{package_base}pureModule', 392s {cm_off} '{package_base}cmakeModule', 392s ], 392s package_data={{ 392s {p_off} 'pure': ['data/pure.dat'], 392s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 392s }}, 392s # Arbitrary order of package_dir 392s package_dir = {{ 392s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 392s {p_off} 'pure': '{package_base}pure', 392s {h_off} 'hybrid': '{package_base}hybrid', 392s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 392s {c_off} 'cmake': '{package_base}cmake', 392s }} 392s ) 392s """.format( 392s cmake_source_dir=cmake_source_dir, 392s cmake_install_dir=package_base, 392s package_base=package_base_dir, 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s p_off="" if has_pure_package else "#", 392s pm_off="" if has_pure_module else "#", 392s ) 392s ) 392s ) 392s 392s src_dir = tmp_dir.ensure(package_base, dir=1) 392s 392s src_dir.join("CMakeLists.txt").write( 392s textwrap.dedent( 392s """ 392s cmake_minimum_required(VERSION 3.5.0) 392s project(hybrid NONE) 392s set(build_dir ${{CMAKE_BINARY_DIR}}) 392s 392s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 392s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 392s {c_off} install( 392s {c_off} FILES 392s {c_off} ${{build_dir}}/__init__.py 392s {c_off} ${{build_dir}}/cmake.py 392s {c_off} DESTINATION cmake 392s {c_off} ) 392s 392s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 392s {cm_off} install( 392s {cm_off} FILES ${{build_dir}}/cmakeModule.py 392s {cm_off} DESTINATION .) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 392s {h_off} DESTINATION hybrid/data) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 392s {h_off} DESTINATION hybrid/hybrid_2) 392s 392s install(CODE "message(STATUS \\\"Installation complete\\\")") 392s """.format( 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s ) 392s ) 392s ) 392s 392s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 392s path_types: Sequence[str] 392s try: 392s path_types = next( 392s iter( 392s zip( 392s *filter( 392s lambda i: i[1], 392s [ 392s ("c", has_cmake_package), 392s ("cm", has_cmake_module), 392s ("h", has_hybrid_package), 392s ("p", has_pure_package), 392s ("pm", has_pure_module), 392s ], 392s ) 392s ) 392s ) 392s ) 392s except StopIteration: 392s path_types = [] 392s 392s def select_paths(annotated_paths): 392s """Return a filtered list paths considering ``path_types``. 392s 392s `annotated_paths`` is list of tuple ``(type, path)`` where type 392s is either `c`, 'cm', `h`, `p` or 'pm'. 392s 392s """ 392s return filter(lambda i: i[0] in path_types, annotated_paths) 392s 392s # Commented paths are the one expected to be installed by CMake. For 392s # this reason, corresponding files should NOT be created in the source 392s # tree. 392s for _type, path in select_paths( 392s [ 392s # ('c', 'cmake/__init__.py'), 392s # ('c', 'cmake/cmake.py'), 392s # ('cm', 'cmakeModule.py'), 392s ("h", "hybrid/__init__.py"), 392s # ('h', 'hybrid/hybrid_cmake.dat'), 392s # ('h', 'hybrid/hybrid_cmake.py'), 392s ("h", "hybrid/hybrid_pure.dat"), 392s ("h", "hybrid/hybrid_pure.py"), 392s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 392s ("h", "hybrid/data/hybrid_data_pure.dat"), 392s ("h", "hybrid/hybrid_2/__init__.py"), 392s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 392s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 392s ("p", "hybrid/hybrid_2_pure/__init__.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 392s ("pm", "pureModule.py"), 392s ("p", "pure/__init__.py"), 392s ("p", "pure/pure.py"), 392s ("p", "pure/data/pure.dat"), 392s ] 392s ): 392s assert _type in {"p", "pm", "h"} 392s root = package_base if _type in {"p", "pm"} else cmake_source_dir 392s tmp_dir.ensure(os.path.join(root, path)) 392s 392s # Do not call the real setup function. Instead, replace it with 392s # a MagicMock allowing to check with which arguments it was invoked. 392s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 392s 392s # Convenience print function 392s def _pprint(desc, value=None): 392s print( 392s "-----------------\n" 392s f"{desc}:\n" 392s "\n" 392s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 392s ) 392s 392s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 392s 392s _pprint = ._pprint at 0x7537df9f7380> 392s _type = 'p' 392s cmake_source_dir = '' 392s has_cmake_module = 1 392s has_cmake_package = 0 392s has_hybrid_package = 1 392s has_pure_module = 0 392s has_pure_package = 1 392s mock_setup = 392s mocker = 392s package_base = '' 392s package_base_dir = '' 392s path = 'pure/data/pure.dat' 392s path_types = ('cm', 'h', 'p') 392s root = '' 392s select_paths = .select_paths at 0x7537dfb10d60> 392s src_dir = local('/tmp/pytest-of-ubuntu/pytest-95/test_setup_inputs0') 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-95/test_setup_inputs0') 392s with_package_base = 0 392s 392s tests/test_setup.py:849: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-95/test_setup_inputs0') 392s setup_args = ['build'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-95/test_setup_inputs0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s ________________________ test_setup_inputs[0-0-1-1-1-1] ________________________ 392s 392s has_cmake_package = 1, has_cmake_module = 1, has_hybrid_package = 1 392s has_pure_package = 1, has_pure_module = 0, with_package_base = 0 392s mocker = 392s 392s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 392s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 392s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_module", [0, 1]) 392s @pytest.mark.parametrize("with_package_base", [0, 1]) 392s def test_setup_inputs( 392s has_cmake_package, 392s has_cmake_module, 392s has_hybrid_package, 392s has_pure_package, 392s has_pure_module, 392s with_package_base, 392s mocker, 392s ): 392s """This test that a project can have a package with some modules 392s installed using setup.py and some other modules installed using CMake. 392s """ 392s 392s tmp_dir = _tmpdir("test_setup_inputs") 392s 392s package_base = "to/the/base" if with_package_base else "" 392s package_base_dir = package_base + "/" if package_base else "" 392s cmake_source_dir = package_base 392s 392s if cmake_source_dir and (has_cmake_package or has_cmake_module): 392s pytest.skip( 392s "unsupported configuration: " 392s "python package fully generated by CMake does *NOT* work. " 392s "At least __init__.py should be in the project source tree" 392s ) 392s 392s # ------------------------------------------------------------------------- 392s # Here is the "SOURCE" tree layout: 392s # 392s # ROOT/ 392s # 392s # setup.py 392s # 392s # [/] 392s # 392s # pureModule.py 392s # 392s # pure/ 392s # __init__.py 392s # pure.py 392s # 392s # data/ 392s # pure.dat 392s # 392s # [/] 392s # 392s # hybrid/ 392s # CMakeLists.txt 392s # __init__.py 392s # hybrid_pure.dat 392s # hybrid_pure.py 392s # 392s # data/ 392s # hybrid_data_pure.dat 392s # 392s # hybrid_2/ 392s # __init__.py 392s # hybrid_2_pure.py 392s # 392s # hybrid_2_pure/ 392s # __init__.py 392s # hybrid_2_pure_1.py 392s # hybrid_2_pure_2.py 392s # 392s # 392s # ------------------------------------------------------------------------- 392s # and here is the "BINARY" distribution layout: 392s # 392s # The comment "CMake" or "Setuptools" indicates which tool is responsible 392s # for placing the file in the tree used to create the binary distribution. 392s # 392s # ROOT/ 392s # 392s # cmakeModule.py # CMake 392s # 392s # cmake/ 392s # __init__.py # CMake 392s # cmake.py # CMake 392s # 392s # hybrid/ 392s # hybrid_cmake.dat # CMake 392s # hybrid_cmake.py # CMake 392s # hybrid_pure.dat # Setuptools 392s # hybrid_pure.py # Setuptools 392s # 392s # data/ 392s # hybrid_data_pure.dat # CMake or Setuptools 392s # hybrid_data_cmake.dat # CMake *NO TEST* 392s # 392s # hybrid_2/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure.py # CMake or Setuptools 392s # hybrid_2_cmake.py # CMake 392s # 392s # hybrid_2_pure/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure_1.py # CMake or Setuptools 392s # hybrid_2_pure_2.py # CMake or Setuptools 392s # 392s # pureModule.py # Setuptools 392s # 392s # pure/ 392s # __init__.py # Setuptools 392s # pure.py # Setuptools 392s # 392s # data/ 392s # pure.dat # Setuptools 392s 392s tmp_dir.join("setup.py").write( 392s textwrap.dedent( 392s """ 392s from skbuild import setup 392s #from setuptools import setup 392s setup( 392s name="test_hybrid_project", 392s version="1.2.3", 392s description=("an hybrid package mixing files installed by both " 392s "CMake and setuptools"), 392s author='The scikit-build team', 392s license="MIT", 392s cmake_source_dir='{cmake_source_dir}', 392s cmake_install_dir='{cmake_install_dir}', 392s # Arbitrary order of packages 392s packages=[ 392s {p_off} 'pure', 392s {h_off} 'hybrid.hybrid_2', 392s {h_off} 'hybrid', 392s {c_off} 'cmake', 392s {p_off} 'hybrid.hybrid_2_pure', 392s ], 392s py_modules=[ 392s {pm_off} '{package_base}pureModule', 392s {cm_off} '{package_base}cmakeModule', 392s ], 392s package_data={{ 392s {p_off} 'pure': ['data/pure.dat'], 392s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 392s }}, 392s # Arbitrary order of package_dir 392s package_dir = {{ 392s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 392s {p_off} 'pure': '{package_base}pure', 392s {h_off} 'hybrid': '{package_base}hybrid', 392s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 392s {c_off} 'cmake': '{package_base}cmake', 392s }} 392s ) 392s """.format( 392s cmake_source_dir=cmake_source_dir, 392s cmake_install_dir=package_base, 392s package_base=package_base_dir, 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s p_off="" if has_pure_package else "#", 392s pm_off="" if has_pure_module else "#", 392s ) 392s ) 392s ) 392s 392s src_dir = tmp_dir.ensure(package_base, dir=1) 392s 392s src_dir.join("CMakeLists.txt").write( 392s textwrap.dedent( 392s """ 392s cmake_minimum_required(VERSION 3.5.0) 392s project(hybrid NONE) 392s set(build_dir ${{CMAKE_BINARY_DIR}}) 392s 392s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 392s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 392s {c_off} install( 392s {c_off} FILES 392s {c_off} ${{build_dir}}/__init__.py 392s {c_off} ${{build_dir}}/cmake.py 392s {c_off} DESTINATION cmake 392s {c_off} ) 392s 392s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 392s {cm_off} install( 392s {cm_off} FILES ${{build_dir}}/cmakeModule.py 392s {cm_off} DESTINATION .) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 392s {h_off} DESTINATION hybrid/data) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 392s {h_off} DESTINATION hybrid/hybrid_2) 392s 392s install(CODE "message(STATUS \\\"Installation complete\\\")") 392s """.format( 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s ) 392s ) 392s ) 392s 392s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 392s path_types: Sequence[str] 392s try: 392s path_types = next( 392s iter( 392s zip( 392s *filter( 392s lambda i: i[1], 392s [ 392s ("c", has_cmake_package), 392s ("cm", has_cmake_module), 392s ("h", has_hybrid_package), 392s ("p", has_pure_package), 392s ("pm", has_pure_module), 392s ], 392s ) 392s ) 392s ) 392s ) 392s except StopIteration: 392s path_types = [] 392s 392s def select_paths(annotated_paths): 392s """Return a filtered list paths considering ``path_types``. 392s 392s `annotated_paths`` is list of tuple ``(type, path)`` where type 392s is either `c`, 'cm', `h`, `p` or 'pm'. 392s 392s """ 392s return filter(lambda i: i[0] in path_types, annotated_paths) 392s 392s # Commented paths are the one expected to be installed by CMake. For 392s # this reason, corresponding files should NOT be created in the source 392s # tree. 392s for _type, path in select_paths( 392s [ 392s # ('c', 'cmake/__init__.py'), 392s # ('c', 'cmake/cmake.py'), 392s # ('cm', 'cmakeModule.py'), 392s ("h", "hybrid/__init__.py"), 392s # ('h', 'hybrid/hybrid_cmake.dat'), 392s # ('h', 'hybrid/hybrid_cmake.py'), 392s ("h", "hybrid/hybrid_pure.dat"), 392s ("h", "hybrid/hybrid_pure.py"), 392s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 392s ("h", "hybrid/data/hybrid_data_pure.dat"), 392s ("h", "hybrid/hybrid_2/__init__.py"), 392s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 392s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 392s ("p", "hybrid/hybrid_2_pure/__init__.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 392s ("pm", "pureModule.py"), 392s ("p", "pure/__init__.py"), 392s ("p", "pure/pure.py"), 392s ("p", "pure/data/pure.dat"), 392s ] 392s ): 392s assert _type in {"p", "pm", "h"} 392s root = package_base if _type in {"p", "pm"} else cmake_source_dir 392s tmp_dir.ensure(os.path.join(root, path)) 392s 392s # Do not call the real setup function. Instead, replace it with 392s # a MagicMock allowing to check with which arguments it was invoked. 392s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 392s 392s # Convenience print function 392s def _pprint(desc, value=None): 392s print( 392s "-----------------\n" 392s f"{desc}:\n" 392s "\n" 392s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 392s ) 392s 392s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 392s 392s _pprint = ._pprint at 0x7537df9f62a0> 392s _type = 'p' 392s cmake_source_dir = '' 392s has_cmake_module = 1 392s has_cmake_package = 1 392s has_hybrid_package = 1 392s has_pure_module = 0 392s has_pure_package = 1 392s mock_setup = 392s mocker = 392s package_base = '' 392s package_base_dir = '' 392s path = 'pure/data/pure.dat' 392s path_types = ('c', 'cm', 'h', 'p') 392s root = '' 392s select_paths = .select_paths at 0x7537df9f7600> 392s src_dir = local('/tmp/pytest-of-ubuntu/pytest-96/test_setup_inputs0') 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-96/test_setup_inputs0') 392s with_package_base = 0 392s 392s tests/test_setup.py:849: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-96/test_setup_inputs0') 392s setup_args = ['build'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-96/test_setup_inputs0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s ________________________ test_setup_inputs[0-1-0-0-0-0] ________________________ 392s 392s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 0 392s has_pure_package = 0, has_pure_module = 1, with_package_base = 0 392s mocker = 392s 392s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 392s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 392s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_module", [0, 1]) 392s @pytest.mark.parametrize("with_package_base", [0, 1]) 392s def test_setup_inputs( 392s has_cmake_package, 392s has_cmake_module, 392s has_hybrid_package, 392s has_pure_package, 392s has_pure_module, 392s with_package_base, 392s mocker, 392s ): 392s """This test that a project can have a package with some modules 392s installed using setup.py and some other modules installed using CMake. 392s """ 392s 392s tmp_dir = _tmpdir("test_setup_inputs") 392s 392s package_base = "to/the/base" if with_package_base else "" 392s package_base_dir = package_base + "/" if package_base else "" 392s cmake_source_dir = package_base 392s 392s if cmake_source_dir and (has_cmake_package or has_cmake_module): 392s pytest.skip( 392s "unsupported configuration: " 392s "python package fully generated by CMake does *NOT* work. " 392s "At least __init__.py should be in the project source tree" 392s ) 392s 392s # ------------------------------------------------------------------------- 392s # Here is the "SOURCE" tree layout: 392s # 392s # ROOT/ 392s # 392s # setup.py 392s # 392s # [/] 392s # 392s # pureModule.py 392s # 392s # pure/ 392s # __init__.py 392s # pure.py 392s # 392s # data/ 392s # pure.dat 392s # 392s # [/] 392s # 392s # hybrid/ 392s # CMakeLists.txt 392s # __init__.py 392s # hybrid_pure.dat 392s # hybrid_pure.py 392s # 392s # data/ 392s # hybrid_data_pure.dat 392s # 392s # hybrid_2/ 392s # __init__.py 392s # hybrid_2_pure.py 392s # 392s # hybrid_2_pure/ 392s # __init__.py 392s # hybrid_2_pure_1.py 392s # hybrid_2_pure_2.py 392s # 392s # 392s # ------------------------------------------------------------------------- 392s # and here is the "BINARY" distribution layout: 392s # 392s # The comment "CMake" or "Setuptools" indicates which tool is responsible 392s # for placing the file in the tree used to create the binary distribution. 392s # 392s # ROOT/ 392s # 392s # cmakeModule.py # CMake 392s # 392s # cmake/ 392s # __init__.py # CMake 392s # cmake.py # CMake 392s # 392s # hybrid/ 392s # hybrid_cmake.dat # CMake 392s # hybrid_cmake.py # CMake 392s # hybrid_pure.dat # Setuptools 392s # hybrid_pure.py # Setuptools 392s # 392s # data/ 392s # hybrid_data_pure.dat # CMake or Setuptools 392s # hybrid_data_cmake.dat # CMake *NO TEST* 392s # 392s # hybrid_2/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure.py # CMake or Setuptools 392s # hybrid_2_cmake.py # CMake 392s # 392s # hybrid_2_pure/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure_1.py # CMake or Setuptools 392s # hybrid_2_pure_2.py # CMake or Setuptools 392s # 392s # pureModule.py # Setuptools 392s # 392s # pure/ 392s # __init__.py # Setuptools 392s # pure.py # Setuptools 392s # 392s # data/ 392s # pure.dat # Setuptools 392s 392s tmp_dir.join("setup.py").write( 392s textwrap.dedent( 392s """ 392s from skbuild import setup 392s #from setuptools import setup 392s setup( 392s name="test_hybrid_project", 392s version="1.2.3", 392s description=("an hybrid package mixing files installed by both " 392s "CMake and setuptools"), 392s author='The scikit-build team', 392s license="MIT", 392s cmake_source_dir='{cmake_source_dir}', 392s cmake_install_dir='{cmake_install_dir}', 392s # Arbitrary order of packages 392s packages=[ 392s {p_off} 'pure', 392s {h_off} 'hybrid.hybrid_2', 392s {h_off} 'hybrid', 392s {c_off} 'cmake', 392s {p_off} 'hybrid.hybrid_2_pure', 392s ], 392s py_modules=[ 392s {pm_off} '{package_base}pureModule', 392s {cm_off} '{package_base}cmakeModule', 392s ], 392s package_data={{ 392s {p_off} 'pure': ['data/pure.dat'], 392s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 392s }}, 392s # Arbitrary order of package_dir 392s package_dir = {{ 392s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 392s {p_off} 'pure': '{package_base}pure', 392s {h_off} 'hybrid': '{package_base}hybrid', 392s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 392s {c_off} 'cmake': '{package_base}cmake', 392s }} 392s ) 392s """.format( 392s cmake_source_dir=cmake_source_dir, 392s cmake_install_dir=package_base, 392s package_base=package_base_dir, 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s p_off="" if has_pure_package else "#", 392s pm_off="" if has_pure_module else "#", 392s ) 392s ) 392s ) 392s 392s src_dir = tmp_dir.ensure(package_base, dir=1) 392s 392s src_dir.join("CMakeLists.txt").write( 392s textwrap.dedent( 392s """ 392s cmake_minimum_required(VERSION 3.5.0) 392s project(hybrid NONE) 392s set(build_dir ${{CMAKE_BINARY_DIR}}) 392s 392s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 392s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 392s {c_off} install( 392s {c_off} FILES 392s {c_off} ${{build_dir}}/__init__.py 392s {c_off} ${{build_dir}}/cmake.py 392s {c_off} DESTINATION cmake 392s {c_off} ) 392s 392s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 392s {cm_off} install( 392s {cm_off} FILES ${{build_dir}}/cmakeModule.py 392s {cm_off} DESTINATION .) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 392s {h_off} DESTINATION hybrid/data) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 392s {h_off} DESTINATION hybrid/hybrid_2) 392s 392s install(CODE "message(STATUS \\\"Installation complete\\\")") 392s """.format( 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s ) 392s ) 392s ) 392s 392s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 392s path_types: Sequence[str] 392s try: 392s path_types = next( 392s iter( 392s zip( 392s *filter( 392s lambda i: i[1], 392s [ 392s ("c", has_cmake_package), 392s ("cm", has_cmake_module), 392s ("h", has_hybrid_package), 392s ("p", has_pure_package), 392s ("pm", has_pure_module), 392s ], 392s ) 392s ) 392s ) 392s ) 392s except StopIteration: 392s path_types = [] 392s 392s def select_paths(annotated_paths): 392s """Return a filtered list paths considering ``path_types``. 392s 392s `annotated_paths`` is list of tuple ``(type, path)`` where type 392s is either `c`, 'cm', `h`, `p` or 'pm'. 392s 392s """ 392s return filter(lambda i: i[0] in path_types, annotated_paths) 392s 392s # Commented paths are the one expected to be installed by CMake. For 392s # this reason, corresponding files should NOT be created in the source 392s # tree. 392s for _type, path in select_paths( 392s [ 392s # ('c', 'cmake/__init__.py'), 392s # ('c', 'cmake/cmake.py'), 392s # ('cm', 'cmakeModule.py'), 392s ("h", "hybrid/__init__.py"), 392s # ('h', 'hybrid/hybrid_cmake.dat'), 392s # ('h', 'hybrid/hybrid_cmake.py'), 392s ("h", "hybrid/hybrid_pure.dat"), 392s ("h", "hybrid/hybrid_pure.py"), 392s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 392s ("h", "hybrid/data/hybrid_data_pure.dat"), 392s ("h", "hybrid/hybrid_2/__init__.py"), 392s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 392s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 392s ("p", "hybrid/hybrid_2_pure/__init__.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 392s ("pm", "pureModule.py"), 392s ("p", "pure/__init__.py"), 392s ("p", "pure/pure.py"), 392s ("p", "pure/data/pure.dat"), 392s ] 392s ): 392s assert _type in {"p", "pm", "h"} 392s root = package_base if _type in {"p", "pm"} else cmake_source_dir 392s tmp_dir.ensure(os.path.join(root, path)) 392s 392s # Do not call the real setup function. Instead, replace it with 392s # a MagicMock allowing to check with which arguments it was invoked. 392s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 392s 392s # Convenience print function 392s def _pprint(desc, value=None): 392s print( 392s "-----------------\n" 392s f"{desc}:\n" 392s "\n" 392s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 392s ) 392s 392s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 392s 392s _pprint = ._pprint at 0x7537df9f6660> 392s _type = 'pm' 392s cmake_source_dir = '' 392s has_cmake_module = 0 392s has_cmake_package = 0 392s has_hybrid_package = 0 392s has_pure_module = 1 392s has_pure_package = 0 392s mock_setup = 392s mocker = 392s package_base = '' 392s package_base_dir = '' 392s path = 'pureModule.py' 392s path_types = ('pm',) 392s root = '' 392s select_paths = .select_paths at 0x7537df9f7ba0> 392s src_dir = local('/tmp/pytest-of-ubuntu/pytest-97/test_setup_inputs0') 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-97/test_setup_inputs0') 392s with_package_base = 0 392s 392s tests/test_setup.py:849: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-97/test_setup_inputs0') 392s setup_args = ['build'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-97/test_setup_inputs0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s ________________________ test_setup_inputs[0-1-0-0-0-1] ________________________ 392s 392s has_cmake_package = 1, has_cmake_module = 0, has_hybrid_package = 0 392s has_pure_package = 0, has_pure_module = 1, with_package_base = 0 392s mocker = 392s 392s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 392s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 392s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_module", [0, 1]) 392s @pytest.mark.parametrize("with_package_base", [0, 1]) 392s def test_setup_inputs( 392s has_cmake_package, 392s has_cmake_module, 392s has_hybrid_package, 392s has_pure_package, 392s has_pure_module, 392s with_package_base, 392s mocker, 392s ): 392s """This test that a project can have a package with some modules 392s installed using setup.py and some other modules installed using CMake. 392s """ 392s 392s tmp_dir = _tmpdir("test_setup_inputs") 392s 392s package_base = "to/the/base" if with_package_base else "" 392s package_base_dir = package_base + "/" if package_base else "" 392s cmake_source_dir = package_base 392s 392s if cmake_source_dir and (has_cmake_package or has_cmake_module): 392s pytest.skip( 392s "unsupported configuration: " 392s "python package fully generated by CMake does *NOT* work. " 392s "At least __init__.py should be in the project source tree" 392s ) 392s 392s # ------------------------------------------------------------------------- 392s # Here is the "SOURCE" tree layout: 392s # 392s # ROOT/ 392s # 392s # setup.py 392s # 392s # [/] 392s # 392s # pureModule.py 392s # 392s # pure/ 392s # __init__.py 392s # pure.py 392s # 392s # data/ 392s # pure.dat 392s # 392s # [/] 392s # 392s # hybrid/ 392s # CMakeLists.txt 392s # __init__.py 392s # hybrid_pure.dat 392s # hybrid_pure.py 392s # 392s # data/ 392s # hybrid_data_pure.dat 392s # 392s # hybrid_2/ 392s # __init__.py 392s # hybrid_2_pure.py 392s # 392s # hybrid_2_pure/ 392s # __init__.py 392s # hybrid_2_pure_1.py 392s # hybrid_2_pure_2.py 392s # 392s # 392s # ------------------------------------------------------------------------- 392s # and here is the "BINARY" distribution layout: 392s # 392s # The comment "CMake" or "Setuptools" indicates which tool is responsible 392s # for placing the file in the tree used to create the binary distribution. 392s # 392s # ROOT/ 392s # 392s # cmakeModule.py # CMake 392s # 392s # cmake/ 392s # __init__.py # CMake 392s # cmake.py # CMake 392s # 392s # hybrid/ 392s # hybrid_cmake.dat # CMake 392s # hybrid_cmake.py # CMake 392s # hybrid_pure.dat # Setuptools 392s # hybrid_pure.py # Setuptools 392s # 392s # data/ 392s # hybrid_data_pure.dat # CMake or Setuptools 392s # hybrid_data_cmake.dat # CMake *NO TEST* 392s # 392s # hybrid_2/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure.py # CMake or Setuptools 392s # hybrid_2_cmake.py # CMake 392s # 392s # hybrid_2_pure/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure_1.py # CMake or Setuptools 392s # hybrid_2_pure_2.py # CMake or Setuptools 392s # 392s # pureModule.py # Setuptools 392s # 392s # pure/ 392s # __init__.py # Setuptools 392s # pure.py # Setuptools 392s # 392s # data/ 392s # pure.dat # Setuptools 392s 392s tmp_dir.join("setup.py").write( 392s textwrap.dedent( 392s """ 392s from skbuild import setup 392s #from setuptools import setup 392s setup( 392s name="test_hybrid_project", 392s version="1.2.3", 392s description=("an hybrid package mixing files installed by both " 392s "CMake and setuptools"), 392s author='The scikit-build team', 392s license="MIT", 392s cmake_source_dir='{cmake_source_dir}', 392s cmake_install_dir='{cmake_install_dir}', 392s # Arbitrary order of packages 392s packages=[ 392s {p_off} 'pure', 392s {h_off} 'hybrid.hybrid_2', 392s {h_off} 'hybrid', 392s {c_off} 'cmake', 392s {p_off} 'hybrid.hybrid_2_pure', 392s ], 392s py_modules=[ 392s {pm_off} '{package_base}pureModule', 392s {cm_off} '{package_base}cmakeModule', 392s ], 392s package_data={{ 392s {p_off} 'pure': ['data/pure.dat'], 392s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 392s }}, 392s # Arbitrary order of package_dir 392s package_dir = {{ 392s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 392s {p_off} 'pure': '{package_base}pure', 392s {h_off} 'hybrid': '{package_base}hybrid', 392s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 392s {c_off} 'cmake': '{package_base}cmake', 392s }} 392s ) 392s """.format( 392s cmake_source_dir=cmake_source_dir, 392s cmake_install_dir=package_base, 392s package_base=package_base_dir, 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s p_off="" if has_pure_package else "#", 392s pm_off="" if has_pure_module else "#", 392s ) 392s ) 392s ) 392s 392s src_dir = tmp_dir.ensure(package_base, dir=1) 392s 392s src_dir.join("CMakeLists.txt").write( 392s textwrap.dedent( 392s """ 392s cmake_minimum_required(VERSION 3.5.0) 392s project(hybrid NONE) 392s set(build_dir ${{CMAKE_BINARY_DIR}}) 392s 392s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 392s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 392s {c_off} install( 392s {c_off} FILES 392s {c_off} ${{build_dir}}/__init__.py 392s {c_off} ${{build_dir}}/cmake.py 392s {c_off} DESTINATION cmake 392s {c_off} ) 392s 392s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 392s {cm_off} install( 392s {cm_off} FILES ${{build_dir}}/cmakeModule.py 392s {cm_off} DESTINATION .) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 392s {h_off} DESTINATION hybrid/data) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 392s {h_off} DESTINATION hybrid/hybrid_2) 392s 392s install(CODE "message(STATUS \\\"Installation complete\\\")") 392s """.format( 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s ) 392s ) 392s ) 392s 392s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 392s path_types: Sequence[str] 392s try: 392s path_types = next( 392s iter( 392s zip( 392s *filter( 392s lambda i: i[1], 392s [ 392s ("c", has_cmake_package), 392s ("cm", has_cmake_module), 392s ("h", has_hybrid_package), 392s ("p", has_pure_package), 392s ("pm", has_pure_module), 392s ], 392s ) 392s ) 392s ) 392s ) 392s except StopIteration: 392s path_types = [] 392s 392s def select_paths(annotated_paths): 392s """Return a filtered list paths considering ``path_types``. 392s 392s `annotated_paths`` is list of tuple ``(type, path)`` where type 392s is either `c`, 'cm', `h`, `p` or 'pm'. 392s 392s """ 392s return filter(lambda i: i[0] in path_types, annotated_paths) 392s 392s # Commented paths are the one expected to be installed by CMake. For 392s # this reason, corresponding files should NOT be created in the source 392s # tree. 392s for _type, path in select_paths( 392s [ 392s # ('c', 'cmake/__init__.py'), 392s # ('c', 'cmake/cmake.py'), 392s # ('cm', 'cmakeModule.py'), 392s ("h", "hybrid/__init__.py"), 392s # ('h', 'hybrid/hybrid_cmake.dat'), 392s # ('h', 'hybrid/hybrid_cmake.py'), 392s ("h", "hybrid/hybrid_pure.dat"), 392s ("h", "hybrid/hybrid_pure.py"), 392s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 392s ("h", "hybrid/data/hybrid_data_pure.dat"), 392s ("h", "hybrid/hybrid_2/__init__.py"), 392s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 392s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 392s ("p", "hybrid/hybrid_2_pure/__init__.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 392s ("pm", "pureModule.py"), 392s ("p", "pure/__init__.py"), 392s ("p", "pure/pure.py"), 392s ("p", "pure/data/pure.dat"), 392s ] 392s ): 392s assert _type in {"p", "pm", "h"} 392s root = package_base if _type in {"p", "pm"} else cmake_source_dir 392s tmp_dir.ensure(os.path.join(root, path)) 392s 392s # Do not call the real setup function. Instead, replace it with 392s # a MagicMock allowing to check with which arguments it was invoked. 392s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 392s 392s # Convenience print function 392s def _pprint(desc, value=None): 392s print( 392s "-----------------\n" 392s f"{desc}:\n" 392s "\n" 392s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 392s ) 392s 392s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 392s 392s _pprint = ._pprint at 0x7537df9f7c40> 392s _type = 'pm' 392s cmake_source_dir = '' 392s has_cmake_module = 0 392s has_cmake_package = 1 392s has_hybrid_package = 0 392s has_pure_module = 1 392s has_pure_package = 0 392s mock_setup = 392s mocker = 392s package_base = '' 392s package_base_dir = '' 392s path = 'pureModule.py' 392s path_types = ('c', 'pm') 392s root = '' 392s select_paths = .select_paths at 0x7537df9f6b60> 392s src_dir = local('/tmp/pytest-of-ubuntu/pytest-98/test_setup_inputs0') 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-98/test_setup_inputs0') 392s with_package_base = 0 392s 392s tests/test_setup.py:849: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-98/test_setup_inputs0') 392s setup_args = ['build'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-98/test_setup_inputs0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s ________________________ test_setup_inputs[0-1-0-0-1-0] ________________________ 392s 392s has_cmake_package = 0, has_cmake_module = 1, has_hybrid_package = 0 392s has_pure_package = 0, has_pure_module = 1, with_package_base = 0 392s mocker = 392s 392s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 392s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 392s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_module", [0, 1]) 392s @pytest.mark.parametrize("with_package_base", [0, 1]) 392s def test_setup_inputs( 392s has_cmake_package, 392s has_cmake_module, 392s has_hybrid_package, 392s has_pure_package, 392s has_pure_module, 392s with_package_base, 392s mocker, 392s ): 392s """This test that a project can have a package with some modules 392s installed using setup.py and some other modules installed using CMake. 392s """ 392s 392s tmp_dir = _tmpdir("test_setup_inputs") 392s 392s package_base = "to/the/base" if with_package_base else "" 392s package_base_dir = package_base + "/" if package_base else "" 392s cmake_source_dir = package_base 392s 392s if cmake_source_dir and (has_cmake_package or has_cmake_module): 392s pytest.skip( 392s "unsupported configuration: " 392s "python package fully generated by CMake does *NOT* work. " 392s "At least __init__.py should be in the project source tree" 392s ) 392s 392s # ------------------------------------------------------------------------- 392s # Here is the "SOURCE" tree layout: 392s # 392s # ROOT/ 392s # 392s # setup.py 392s # 392s # [/] 392s # 392s # pureModule.py 392s # 392s # pure/ 392s # __init__.py 392s # pure.py 392s # 392s # data/ 392s # pure.dat 392s # 392s # [/] 392s # 392s # hybrid/ 392s # CMakeLists.txt 392s # __init__.py 392s # hybrid_pure.dat 392s # hybrid_pure.py 392s # 392s # data/ 392s # hybrid_data_pure.dat 392s # 392s # hybrid_2/ 392s # __init__.py 392s # hybrid_2_pure.py 392s # 392s # hybrid_2_pure/ 392s # __init__.py 392s # hybrid_2_pure_1.py 392s # hybrid_2_pure_2.py 392s # 392s # 392s # ------------------------------------------------------------------------- 392s # and here is the "BINARY" distribution layout: 392s # 392s # The comment "CMake" or "Setuptools" indicates which tool is responsible 392s # for placing the file in the tree used to create the binary distribution. 392s # 392s # ROOT/ 392s # 392s # cmakeModule.py # CMake 392s # 392s # cmake/ 392s # __init__.py # CMake 392s # cmake.py # CMake 392s # 392s # hybrid/ 392s # hybrid_cmake.dat # CMake 392s # hybrid_cmake.py # CMake 392s # hybrid_pure.dat # Setuptools 392s # hybrid_pure.py # Setuptools 392s # 392s # data/ 392s # hybrid_data_pure.dat # CMake or Setuptools 392s # hybrid_data_cmake.dat # CMake *NO TEST* 392s # 392s # hybrid_2/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure.py # CMake or Setuptools 392s # hybrid_2_cmake.py # CMake 392s # 392s # hybrid_2_pure/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure_1.py # CMake or Setuptools 392s # hybrid_2_pure_2.py # CMake or Setuptools 392s # 392s # pureModule.py # Setuptools 392s # 392s # pure/ 392s # __init__.py # Setuptools 392s # pure.py # Setuptools 392s # 392s # data/ 392s # pure.dat # Setuptools 392s 392s tmp_dir.join("setup.py").write( 392s textwrap.dedent( 392s """ 392s from skbuild import setup 392s #from setuptools import setup 392s setup( 392s name="test_hybrid_project", 392s version="1.2.3", 392s description=("an hybrid package mixing files installed by both " 392s "CMake and setuptools"), 392s author='The scikit-build team', 392s license="MIT", 392s cmake_source_dir='{cmake_source_dir}', 392s cmake_install_dir='{cmake_install_dir}', 392s # Arbitrary order of packages 392s packages=[ 392s {p_off} 'pure', 392s {h_off} 'hybrid.hybrid_2', 392s {h_off} 'hybrid', 392s {c_off} 'cmake', 392s {p_off} 'hybrid.hybrid_2_pure', 392s ], 392s py_modules=[ 392s {pm_off} '{package_base}pureModule', 392s {cm_off} '{package_base}cmakeModule', 392s ], 392s package_data={{ 392s {p_off} 'pure': ['data/pure.dat'], 392s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 392s }}, 392s # Arbitrary order of package_dir 392s package_dir = {{ 392s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 392s {p_off} 'pure': '{package_base}pure', 392s {h_off} 'hybrid': '{package_base}hybrid', 392s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 392s {c_off} 'cmake': '{package_base}cmake', 392s }} 392s ) 392s """.format( 392s cmake_source_dir=cmake_source_dir, 392s cmake_install_dir=package_base, 392s package_base=package_base_dir, 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s p_off="" if has_pure_package else "#", 392s pm_off="" if has_pure_module else "#", 392s ) 392s ) 392s ) 392s 392s src_dir = tmp_dir.ensure(package_base, dir=1) 392s 392s src_dir.join("CMakeLists.txt").write( 392s textwrap.dedent( 392s """ 392s cmake_minimum_required(VERSION 3.5.0) 392s project(hybrid NONE) 392s set(build_dir ${{CMAKE_BINARY_DIR}}) 392s 392s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 392s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 392s {c_off} install( 392s {c_off} FILES 392s {c_off} ${{build_dir}}/__init__.py 392s {c_off} ${{build_dir}}/cmake.py 392s {c_off} DESTINATION cmake 392s {c_off} ) 392s 392s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 392s {cm_off} install( 392s {cm_off} FILES ${{build_dir}}/cmakeModule.py 392s {cm_off} DESTINATION .) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 392s {h_off} DESTINATION hybrid/data) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 392s {h_off} DESTINATION hybrid/hybrid_2) 392s 392s install(CODE "message(STATUS \\\"Installation complete\\\")") 392s """.format( 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s ) 392s ) 392s ) 392s 392s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 392s path_types: Sequence[str] 392s try: 392s path_types = next( 392s iter( 392s zip( 392s *filter( 392s lambda i: i[1], 392s [ 392s ("c", has_cmake_package), 392s ("cm", has_cmake_module), 392s ("h", has_hybrid_package), 392s ("p", has_pure_package), 392s ("pm", has_pure_module), 392s ], 392s ) 392s ) 392s ) 392s ) 392s except StopIteration: 392s path_types = [] 392s 392s def select_paths(annotated_paths): 392s """Return a filtered list paths considering ``path_types``. 392s 392s `annotated_paths`` is list of tuple ``(type, path)`` where type 392s is either `c`, 'cm', `h`, `p` or 'pm'. 392s 392s """ 392s return filter(lambda i: i[0] in path_types, annotated_paths) 392s 392s # Commented paths are the one expected to be installed by CMake. For 392s # this reason, corresponding files should NOT be created in the source 392s # tree. 392s for _type, path in select_paths( 392s [ 392s # ('c', 'cmake/__init__.py'), 392s # ('c', 'cmake/cmake.py'), 392s # ('cm', 'cmakeModule.py'), 392s ("h", "hybrid/__init__.py"), 392s # ('h', 'hybrid/hybrid_cmake.dat'), 392s # ('h', 'hybrid/hybrid_cmake.py'), 392s ("h", "hybrid/hybrid_pure.dat"), 392s ("h", "hybrid/hybrid_pure.py"), 392s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 392s ("h", "hybrid/data/hybrid_data_pure.dat"), 392s ("h", "hybrid/hybrid_2/__init__.py"), 392s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 392s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 392s ("p", "hybrid/hybrid_2_pure/__init__.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 392s ("pm", "pureModule.py"), 392s ("p", "pure/__init__.py"), 392s ("p", "pure/pure.py"), 392s ("p", "pure/data/pure.dat"), 392s ] 392s ): 392s assert _type in {"p", "pm", "h"} 392s root = package_base if _type in {"p", "pm"} else cmake_source_dir 392s tmp_dir.ensure(os.path.join(root, path)) 392s 392s # Do not call the real setup function. Instead, replace it with 392s # a MagicMock allowing to check with which arguments it was invoked. 392s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 392s 392s # Convenience print function 392s def _pprint(desc, value=None): 392s print( 392s "-----------------\n" 392s f"{desc}:\n" 392s "\n" 392s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 392s ) 392s 392s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 392s 392s _pprint = ._pprint at 0x7537df9f7920> 392s _type = 'pm' 392s cmake_source_dir = '' 392s has_cmake_module = 1 392s has_cmake_package = 0 392s has_hybrid_package = 0 392s has_pure_module = 1 392s has_pure_package = 0 392s mock_setup = 392s mocker = 392s package_base = '' 392s package_base_dir = '' 392s path = 'pureModule.py' 392s path_types = ('cm', 'pm') 392s root = '' 392s select_paths = .select_paths at 0x7537df9f6a20> 392s src_dir = local('/tmp/pytest-of-ubuntu/pytest-99/test_setup_inputs0') 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-99/test_setup_inputs0') 392s with_package_base = 0 392s 392s tests/test_setup.py:849: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-99/test_setup_inputs0') 392s setup_args = ['build'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-99/test_setup_inputs0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s ________________________ test_setup_inputs[0-1-0-0-1-1] ________________________ 392s 392s has_cmake_package = 1, has_cmake_module = 1, has_hybrid_package = 0 392s has_pure_package = 0, has_pure_module = 1, with_package_base = 0 392s mocker = 392s 392s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 392s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 392s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_module", [0, 1]) 392s @pytest.mark.parametrize("with_package_base", [0, 1]) 392s def test_setup_inputs( 392s has_cmake_package, 392s has_cmake_module, 392s has_hybrid_package, 392s has_pure_package, 392s has_pure_module, 392s with_package_base, 392s mocker, 392s ): 392s """This test that a project can have a package with some modules 392s installed using setup.py and some other modules installed using CMake. 392s """ 392s 392s tmp_dir = _tmpdir("test_setup_inputs") 392s 392s package_base = "to/the/base" if with_package_base else "" 392s package_base_dir = package_base + "/" if package_base else "" 392s cmake_source_dir = package_base 392s 392s if cmake_source_dir and (has_cmake_package or has_cmake_module): 392s pytest.skip( 392s "unsupported configuration: " 392s "python package fully generated by CMake does *NOT* work. " 392s "At least __init__.py should be in the project source tree" 392s ) 392s 392s # ------------------------------------------------------------------------- 392s # Here is the "SOURCE" tree layout: 392s # 392s # ROOT/ 392s # 392s # setup.py 392s # 392s # [/] 392s # 392s # pureModule.py 392s # 392s # pure/ 392s # __init__.py 392s # pure.py 392s # 392s # data/ 392s # pure.dat 392s # 392s # [/] 392s # 392s # hybrid/ 392s # CMakeLists.txt 392s # __init__.py 392s # hybrid_pure.dat 392s # hybrid_pure.py 392s # 392s # data/ 392s # hybrid_data_pure.dat 392s # 392s # hybrid_2/ 392s # __init__.py 392s # hybrid_2_pure.py 392s # 392s # hybrid_2_pure/ 392s # __init__.py 392s # hybrid_2_pure_1.py 392s # hybrid_2_pure_2.py 392s # 392s # 392s # ------------------------------------------------------------------------- 392s # and here is the "BINARY" distribution layout: 392s # 392s # The comment "CMake" or "Setuptools" indicates which tool is responsible 392s # for placing the file in the tree used to create the binary distribution. 392s # 392s # ROOT/ 392s # 392s # cmakeModule.py # CMake 392s # 392s # cmake/ 392s # __init__.py # CMake 392s # cmake.py # CMake 392s # 392s # hybrid/ 392s # hybrid_cmake.dat # CMake 392s # hybrid_cmake.py # CMake 392s # hybrid_pure.dat # Setuptools 392s # hybrid_pure.py # Setuptools 392s # 392s # data/ 392s # hybrid_data_pure.dat # CMake or Setuptools 392s # hybrid_data_cmake.dat # CMake *NO TEST* 392s # 392s # hybrid_2/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure.py # CMake or Setuptools 392s # hybrid_2_cmake.py # CMake 392s # 392s # hybrid_2_pure/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure_1.py # CMake or Setuptools 392s # hybrid_2_pure_2.py # CMake or Setuptools 392s # 392s # pureModule.py # Setuptools 392s # 392s # pure/ 392s # __init__.py # Setuptools 392s # pure.py # Setuptools 392s # 392s # data/ 392s # pure.dat # Setuptools 392s 392s tmp_dir.join("setup.py").write( 392s textwrap.dedent( 392s """ 392s from skbuild import setup 392s #from setuptools import setup 392s setup( 392s name="test_hybrid_project", 392s version="1.2.3", 392s description=("an hybrid package mixing files installed by both " 392s "CMake and setuptools"), 392s author='The scikit-build team', 392s license="MIT", 392s cmake_source_dir='{cmake_source_dir}', 392s cmake_install_dir='{cmake_install_dir}', 392s # Arbitrary order of packages 392s packages=[ 392s {p_off} 'pure', 392s {h_off} 'hybrid.hybrid_2', 392s {h_off} 'hybrid', 392s {c_off} 'cmake', 392s {p_off} 'hybrid.hybrid_2_pure', 392s ], 392s py_modules=[ 392s {pm_off} '{package_base}pureModule', 392s {cm_off} '{package_base}cmakeModule', 392s ], 392s package_data={{ 392s {p_off} 'pure': ['data/pure.dat'], 392s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 392s }}, 392s # Arbitrary order of package_dir 392s package_dir = {{ 392s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 392s {p_off} 'pure': '{package_base}pure', 392s {h_off} 'hybrid': '{package_base}hybrid', 392s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 392s {c_off} 'cmake': '{package_base}cmake', 392s }} 392s ) 392s """.format( 392s cmake_source_dir=cmake_source_dir, 392s cmake_install_dir=package_base, 392s package_base=package_base_dir, 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s p_off="" if has_pure_package else "#", 392s pm_off="" if has_pure_module else "#", 392s ) 392s ) 392s ) 392s 392s src_dir = tmp_dir.ensure(package_base, dir=1) 392s 392s src_dir.join("CMakeLists.txt").write( 392s textwrap.dedent( 392s """ 392s cmake_minimum_required(VERSION 3.5.0) 392s project(hybrid NONE) 392s set(build_dir ${{CMAKE_BINARY_DIR}}) 392s 392s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 392s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 392s {c_off} install( 392s {c_off} FILES 392s {c_off} ${{build_dir}}/__init__.py 392s {c_off} ${{build_dir}}/cmake.py 392s {c_off} DESTINATION cmake 392s {c_off} ) 392s 392s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 392s {cm_off} install( 392s {cm_off} FILES ${{build_dir}}/cmakeModule.py 392s {cm_off} DESTINATION .) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 392s {h_off} DESTINATION hybrid/data) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 392s {h_off} DESTINATION hybrid/hybrid_2) 392s 392s install(CODE "message(STATUS \\\"Installation complete\\\")") 392s """.format( 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s ) 392s ) 392s ) 392s 392s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 392s path_types: Sequence[str] 392s try: 392s path_types = next( 392s iter( 392s zip( 392s *filter( 392s lambda i: i[1], 392s [ 392s ("c", has_cmake_package), 392s ("cm", has_cmake_module), 392s ("h", has_hybrid_package), 392s ("p", has_pure_package), 392s ("pm", has_pure_module), 392s ], 392s ) 392s ) 392s ) 392s ) 392s except StopIteration: 392s path_types = [] 392s 392s def select_paths(annotated_paths): 392s """Return a filtered list paths considering ``path_types``. 392s 392s `annotated_paths`` is list of tuple ``(type, path)`` where type 392s is either `c`, 'cm', `h`, `p` or 'pm'. 392s 392s """ 392s return filter(lambda i: i[0] in path_types, annotated_paths) 392s 392s # Commented paths are the one expected to be installed by CMake. For 392s # this reason, corresponding files should NOT be created in the source 392s # tree. 392s for _type, path in select_paths( 392s [ 392s # ('c', 'cmake/__init__.py'), 392s # ('c', 'cmake/cmake.py'), 392s # ('cm', 'cmakeModule.py'), 392s ("h", "hybrid/__init__.py"), 392s # ('h', 'hybrid/hybrid_cmake.dat'), 392s # ('h', 'hybrid/hybrid_cmake.py'), 392s ("h", "hybrid/hybrid_pure.dat"), 392s ("h", "hybrid/hybrid_pure.py"), 392s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 392s ("h", "hybrid/data/hybrid_data_pure.dat"), 392s ("h", "hybrid/hybrid_2/__init__.py"), 392s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 392s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 392s ("p", "hybrid/hybrid_2_pure/__init__.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 392s ("pm", "pureModule.py"), 392s ("p", "pure/__init__.py"), 392s ("p", "pure/pure.py"), 392s ("p", "pure/data/pure.dat"), 392s ] 392s ): 392s assert _type in {"p", "pm", "h"} 392s root = package_base if _type in {"p", "pm"} else cmake_source_dir 392s tmp_dir.ensure(os.path.join(root, path)) 392s 392s # Do not call the real setup function. Instead, replace it with 392s # a MagicMock allowing to check with which arguments it was invoked. 392s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 392s 392s # Convenience print function 392s def _pprint(desc, value=None): 392s print( 392s "-----------------\n" 392s f"{desc}:\n" 392s "\n" 392s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 392s ) 392s 392s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 392s 392s _pprint = ._pprint at 0x7537df9f7b00> 392s _type = 'pm' 392s cmake_source_dir = '' 392s has_cmake_module = 1 392s has_cmake_package = 1 392s has_hybrid_package = 0 392s has_pure_module = 1 392s has_pure_package = 0 392s mock_setup = 392s mocker = 392s package_base = '' 392s package_base_dir = '' 392s path = 'pureModule.py' 392s path_types = ('c', 'cm', 'pm') 392s root = '' 392s select_paths = .select_paths at 0x7537df9f7ba0> 392s src_dir = local('/tmp/pytest-of-ubuntu/pytest-100/test_setup_inputs0') 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-100/test_setup_inputs0') 392s with_package_base = 0 392s 392s tests/test_setup.py:849: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-100/test_setup_inputs0') 392s setup_args = ['build'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-100/test_setup_inputs0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s ________________________ test_setup_inputs[0-1-0-1-0-0] ________________________ 392s 392s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 1 392s has_pure_package = 0, has_pure_module = 1, with_package_base = 0 392s mocker = 392s 392s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 392s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 392s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_module", [0, 1]) 392s @pytest.mark.parametrize("with_package_base", [0, 1]) 392s def test_setup_inputs( 392s has_cmake_package, 392s has_cmake_module, 392s has_hybrid_package, 392s has_pure_package, 392s has_pure_module, 392s with_package_base, 392s mocker, 392s ): 392s """This test that a project can have a package with some modules 392s installed using setup.py and some other modules installed using CMake. 392s """ 392s 392s tmp_dir = _tmpdir("test_setup_inputs") 392s 392s package_base = "to/the/base" if with_package_base else "" 392s package_base_dir = package_base + "/" if package_base else "" 392s cmake_source_dir = package_base 392s 392s if cmake_source_dir and (has_cmake_package or has_cmake_module): 392s pytest.skip( 392s "unsupported configuration: " 392s "python package fully generated by CMake does *NOT* work. " 392s "At least __init__.py should be in the project source tree" 392s ) 392s 392s # ------------------------------------------------------------------------- 392s # Here is the "SOURCE" tree layout: 392s # 392s # ROOT/ 392s # 392s # setup.py 392s # 392s # [/] 392s # 392s # pureModule.py 392s # 392s # pure/ 392s # __init__.py 392s # pure.py 392s # 392s # data/ 392s # pure.dat 392s # 392s # [/] 392s # 392s # hybrid/ 392s # CMakeLists.txt 392s # __init__.py 392s # hybrid_pure.dat 392s # hybrid_pure.py 392s # 392s # data/ 392s # hybrid_data_pure.dat 392s # 392s # hybrid_2/ 392s # __init__.py 392s # hybrid_2_pure.py 392s # 392s # hybrid_2_pure/ 392s # __init__.py 392s # hybrid_2_pure_1.py 392s # hybrid_2_pure_2.py 392s # 392s # 392s # ------------------------------------------------------------------------- 392s # and here is the "BINARY" distribution layout: 392s # 392s # The comment "CMake" or "Setuptools" indicates which tool is responsible 392s # for placing the file in the tree used to create the binary distribution. 392s # 392s # ROOT/ 392s # 392s # cmakeModule.py # CMake 392s # 392s # cmake/ 392s # __init__.py # CMake 392s # cmake.py # CMake 392s # 392s # hybrid/ 392s # hybrid_cmake.dat # CMake 392s # hybrid_cmake.py # CMake 392s # hybrid_pure.dat # Setuptools 392s # hybrid_pure.py # Setuptools 392s # 392s # data/ 392s # hybrid_data_pure.dat # CMake or Setuptools 392s # hybrid_data_cmake.dat # CMake *NO TEST* 392s # 392s # hybrid_2/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure.py # CMake or Setuptools 392s # hybrid_2_cmake.py # CMake 392s # 392s # hybrid_2_pure/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure_1.py # CMake or Setuptools 392s # hybrid_2_pure_2.py # CMake or Setuptools 392s # 392s # pureModule.py # Setuptools 392s # 392s # pure/ 392s # __init__.py # Setuptools 392s # pure.py # Setuptools 392s # 392s # data/ 392s # pure.dat # Setuptools 392s 392s tmp_dir.join("setup.py").write( 392s textwrap.dedent( 392s """ 392s from skbuild import setup 392s #from setuptools import setup 392s setup( 392s name="test_hybrid_project", 392s version="1.2.3", 392s description=("an hybrid package mixing files installed by both " 392s "CMake and setuptools"), 392s author='The scikit-build team', 392s license="MIT", 392s cmake_source_dir='{cmake_source_dir}', 392s cmake_install_dir='{cmake_install_dir}', 392s # Arbitrary order of packages 392s packages=[ 392s {p_off} 'pure', 392s {h_off} 'hybrid.hybrid_2', 392s {h_off} 'hybrid', 392s {c_off} 'cmake', 392s {p_off} 'hybrid.hybrid_2_pure', 392s ], 392s py_modules=[ 392s {pm_off} '{package_base}pureModule', 392s {cm_off} '{package_base}cmakeModule', 392s ], 392s package_data={{ 392s {p_off} 'pure': ['data/pure.dat'], 392s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 392s }}, 392s # Arbitrary order of package_dir 392s package_dir = {{ 392s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 392s {p_off} 'pure': '{package_base}pure', 392s {h_off} 'hybrid': '{package_base}hybrid', 392s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 392s {c_off} 'cmake': '{package_base}cmake', 392s }} 392s ) 392s """.format( 392s cmake_source_dir=cmake_source_dir, 392s cmake_install_dir=package_base, 392s package_base=package_base_dir, 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s p_off="" if has_pure_package else "#", 392s pm_off="" if has_pure_module else "#", 392s ) 392s ) 392s ) 392s 392s src_dir = tmp_dir.ensure(package_base, dir=1) 392s 392s src_dir.join("CMakeLists.txt").write( 392s textwrap.dedent( 392s """ 392s cmake_minimum_required(VERSION 3.5.0) 392s project(hybrid NONE) 392s set(build_dir ${{CMAKE_BINARY_DIR}}) 392s 392s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 392s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 392s {c_off} install( 392s {c_off} FILES 392s {c_off} ${{build_dir}}/__init__.py 392s {c_off} ${{build_dir}}/cmake.py 392s {c_off} DESTINATION cmake 392s {c_off} ) 392s 392s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 392s {cm_off} install( 392s {cm_off} FILES ${{build_dir}}/cmakeModule.py 392s {cm_off} DESTINATION .) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 392s {h_off} DESTINATION hybrid/data) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 392s {h_off} DESTINATION hybrid/hybrid_2) 392s 392s install(CODE "message(STATUS \\\"Installation complete\\\")") 392s """.format( 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s ) 392s ) 392s ) 392s 392s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 392s path_types: Sequence[str] 392s try: 392s path_types = next( 392s iter( 392s zip( 392s *filter( 392s lambda i: i[1], 392s [ 392s ("c", has_cmake_package), 392s ("cm", has_cmake_module), 392s ("h", has_hybrid_package), 392s ("p", has_pure_package), 392s ("pm", has_pure_module), 392s ], 392s ) 392s ) 392s ) 392s ) 392s except StopIteration: 392s path_types = [] 392s 392s def select_paths(annotated_paths): 392s """Return a filtered list paths considering ``path_types``. 392s 392s `annotated_paths`` is list of tuple ``(type, path)`` where type 392s is either `c`, 'cm', `h`, `p` or 'pm'. 392s 392s """ 392s return filter(lambda i: i[0] in path_types, annotated_paths) 392s 392s # Commented paths are the one expected to be installed by CMake. For 392s # this reason, corresponding files should NOT be created in the source 392s # tree. 392s for _type, path in select_paths( 392s [ 392s # ('c', 'cmake/__init__.py'), 392s # ('c', 'cmake/cmake.py'), 392s # ('cm', 'cmakeModule.py'), 392s ("h", "hybrid/__init__.py"), 392s # ('h', 'hybrid/hybrid_cmake.dat'), 392s # ('h', 'hybrid/hybrid_cmake.py'), 392s ("h", "hybrid/hybrid_pure.dat"), 392s ("h", "hybrid/hybrid_pure.py"), 392s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 392s ("h", "hybrid/data/hybrid_data_pure.dat"), 392s ("h", "hybrid/hybrid_2/__init__.py"), 392s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 392s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 392s ("p", "hybrid/hybrid_2_pure/__init__.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 392s ("pm", "pureModule.py"), 392s ("p", "pure/__init__.py"), 392s ("p", "pure/pure.py"), 392s ("p", "pure/data/pure.dat"), 392s ] 392s ): 392s assert _type in {"p", "pm", "h"} 392s root = package_base if _type in {"p", "pm"} else cmake_source_dir 392s tmp_dir.ensure(os.path.join(root, path)) 392s 392s # Do not call the real setup function. Instead, replace it with 392s # a MagicMock allowing to check with which arguments it was invoked. 392s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 392s 392s # Convenience print function 392s def _pprint(desc, value=None): 392s print( 392s "-----------------\n" 392s f"{desc}:\n" 392s "\n" 392s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 392s ) 392s 392s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 392s 392s _pprint = ._pprint at 0x7537df9f7060> 392s _type = 'pm' 392s cmake_source_dir = '' 392s has_cmake_module = 0 392s has_cmake_package = 0 392s has_hybrid_package = 1 392s has_pure_module = 1 392s has_pure_package = 0 392s mock_setup = 392s mocker = 392s package_base = '' 392s package_base_dir = '' 392s path = 'pureModule.py' 392s path_types = ('h', 'pm') 392s root = '' 392s select_paths = .select_paths at 0x7537df9f7560> 392s src_dir = local('/tmp/pytest-of-ubuntu/pytest-101/test_setup_inputs0') 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-101/test_setup_inputs0') 392s with_package_base = 0 392s 392s tests/test_setup.py:849: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-101/test_setup_inputs0') 392s setup_args = ['build'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-101/test_setup_inputs0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s ________________________ test_setup_inputs[0-1-0-1-0-1] ________________________ 392s 392s has_cmake_package = 1, has_cmake_module = 0, has_hybrid_package = 1 392s has_pure_package = 0, has_pure_module = 1, with_package_base = 0 392s mocker = 392s 392s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 392s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 392s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_module", [0, 1]) 392s @pytest.mark.parametrize("with_package_base", [0, 1]) 392s def test_setup_inputs( 392s has_cmake_package, 392s has_cmake_module, 392s has_hybrid_package, 392s has_pure_package, 392s has_pure_module, 392s with_package_base, 392s mocker, 392s ): 392s """This test that a project can have a package with some modules 392s installed using setup.py and some other modules installed using CMake. 392s """ 392s 392s tmp_dir = _tmpdir("test_setup_inputs") 392s 392s package_base = "to/the/base" if with_package_base else "" 392s package_base_dir = package_base + "/" if package_base else "" 392s cmake_source_dir = package_base 392s 392s if cmake_source_dir and (has_cmake_package or has_cmake_module): 392s pytest.skip( 392s "unsupported configuration: " 392s "python package fully generated by CMake does *NOT* work. " 392s "At least __init__.py should be in the project source tree" 392s ) 392s 392s # ------------------------------------------------------------------------- 392s # Here is the "SOURCE" tree layout: 392s # 392s # ROOT/ 392s # 392s # setup.py 392s # 392s # [/] 392s # 392s # pureModule.py 392s # 392s # pure/ 392s # __init__.py 392s # pure.py 392s # 392s # data/ 392s # pure.dat 392s # 392s # [/] 392s # 392s # hybrid/ 392s # CMakeLists.txt 392s # __init__.py 392s # hybrid_pure.dat 392s # hybrid_pure.py 392s # 392s # data/ 392s # hybrid_data_pure.dat 392s # 392s # hybrid_2/ 392s # __init__.py 392s # hybrid_2_pure.py 392s # 392s # hybrid_2_pure/ 392s # __init__.py 392s # hybrid_2_pure_1.py 392s # hybrid_2_pure_2.py 392s # 392s # 392s # ------------------------------------------------------------------------- 392s # and here is the "BINARY" distribution layout: 392s # 392s # The comment "CMake" or "Setuptools" indicates which tool is responsible 392s # for placing the file in the tree used to create the binary distribution. 392s # 392s # ROOT/ 392s # 392s # cmakeModule.py # CMake 392s # 392s # cmake/ 392s # __init__.py # CMake 392s # cmake.py # CMake 392s # 392s # hybrid/ 392s # hybrid_cmake.dat # CMake 392s # hybrid_cmake.py # CMake 392s # hybrid_pure.dat # Setuptools 392s # hybrid_pure.py # Setuptools 392s # 392s # data/ 392s # hybrid_data_pure.dat # CMake or Setuptools 392s # hybrid_data_cmake.dat # CMake *NO TEST* 392s # 392s # hybrid_2/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure.py # CMake or Setuptools 392s # hybrid_2_cmake.py # CMake 392s # 392s # hybrid_2_pure/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure_1.py # CMake or Setuptools 392s # hybrid_2_pure_2.py # CMake or Setuptools 392s # 392s # pureModule.py # Setuptools 392s # 392s # pure/ 392s # __init__.py # Setuptools 392s # pure.py # Setuptools 392s # 392s # data/ 392s # pure.dat # Setuptools 392s 392s tmp_dir.join("setup.py").write( 392s textwrap.dedent( 392s """ 392s from skbuild import setup 392s #from setuptools import setup 392s setup( 392s name="test_hybrid_project", 392s version="1.2.3", 392s description=("an hybrid package mixing files installed by both " 392s "CMake and setuptools"), 392s author='The scikit-build team', 392s license="MIT", 392s cmake_source_dir='{cmake_source_dir}', 392s cmake_install_dir='{cmake_install_dir}', 392s # Arbitrary order of packages 392s packages=[ 392s {p_off} 'pure', 392s {h_off} 'hybrid.hybrid_2', 392s {h_off} 'hybrid', 392s {c_off} 'cmake', 392s {p_off} 'hybrid.hybrid_2_pure', 392s ], 392s py_modules=[ 392s {pm_off} '{package_base}pureModule', 392s {cm_off} '{package_base}cmakeModule', 392s ], 392s package_data={{ 392s {p_off} 'pure': ['data/pure.dat'], 392s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 392s }}, 392s # Arbitrary order of package_dir 392s package_dir = {{ 392s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 392s {p_off} 'pure': '{package_base}pure', 392s {h_off} 'hybrid': '{package_base}hybrid', 392s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 392s {c_off} 'cmake': '{package_base}cmake', 392s }} 392s ) 392s """.format( 392s cmake_source_dir=cmake_source_dir, 392s cmake_install_dir=package_base, 392s package_base=package_base_dir, 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s p_off="" if has_pure_package else "#", 392s pm_off="" if has_pure_module else "#", 392s ) 392s ) 392s ) 392s 392s src_dir = tmp_dir.ensure(package_base, dir=1) 392s 392s src_dir.join("CMakeLists.txt").write( 392s textwrap.dedent( 392s """ 392s cmake_minimum_required(VERSION 3.5.0) 392s project(hybrid NONE) 392s set(build_dir ${{CMAKE_BINARY_DIR}}) 392s 392s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 392s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 392s {c_off} install( 392s {c_off} FILES 392s {c_off} ${{build_dir}}/__init__.py 392s {c_off} ${{build_dir}}/cmake.py 392s {c_off} DESTINATION cmake 392s {c_off} ) 392s 392s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 392s {cm_off} install( 392s {cm_off} FILES ${{build_dir}}/cmakeModule.py 392s {cm_off} DESTINATION .) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 392s {h_off} DESTINATION hybrid/data) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 392s {h_off} DESTINATION hybrid/hybrid_2) 392s 392s install(CODE "message(STATUS \\\"Installation complete\\\")") 392s """.format( 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s ) 392s ) 392s ) 392s 392s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 392s path_types: Sequence[str] 392s try: 392s path_types = next( 392s iter( 392s zip( 392s *filter( 392s lambda i: i[1], 392s [ 392s ("c", has_cmake_package), 392s ("cm", has_cmake_module), 392s ("h", has_hybrid_package), 392s ("p", has_pure_package), 392s ("pm", has_pure_module), 392s ], 392s ) 392s ) 392s ) 392s ) 392s except StopIteration: 392s path_types = [] 392s 392s def select_paths(annotated_paths): 392s """Return a filtered list paths considering ``path_types``. 392s 392s `annotated_paths`` is list of tuple ``(type, path)`` where type 392s is either `c`, 'cm', `h`, `p` or 'pm'. 392s 392s """ 392s return filter(lambda i: i[0] in path_types, annotated_paths) 392s 392s # Commented paths are the one expected to be installed by CMake. For 392s # this reason, corresponding files should NOT be created in the source 392s # tree. 392s for _type, path in select_paths( 392s [ 392s # ('c', 'cmake/__init__.py'), 392s # ('c', 'cmake/cmake.py'), 392s # ('cm', 'cmakeModule.py'), 392s ("h", "hybrid/__init__.py"), 392s # ('h', 'hybrid/hybrid_cmake.dat'), 392s # ('h', 'hybrid/hybrid_cmake.py'), 392s ("h", "hybrid/hybrid_pure.dat"), 392s ("h", "hybrid/hybrid_pure.py"), 392s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 392s ("h", "hybrid/data/hybrid_data_pure.dat"), 392s ("h", "hybrid/hybrid_2/__init__.py"), 392s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 392s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 392s ("p", "hybrid/hybrid_2_pure/__init__.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 392s ("pm", "pureModule.py"), 392s ("p", "pure/__init__.py"), 392s ("p", "pure/pure.py"), 392s ("p", "pure/data/pure.dat"), 392s ] 392s ): 392s assert _type in {"p", "pm", "h"} 392s root = package_base if _type in {"p", "pm"} else cmake_source_dir 392s tmp_dir.ensure(os.path.join(root, path)) 392s 392s # Do not call the real setup function. Instead, replace it with 392s # a MagicMock allowing to check with which arguments it was invoked. 392s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 392s 392s # Convenience print function 392s def _pprint(desc, value=None): 392s print( 392s "-----------------\n" 392s f"{desc}:\n" 392s "\n" 392s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 392s ) 392s 392s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 392s 392s _pprint = ._pprint at 0x7537df9b4360> 392s _type = 'pm' 392s cmake_source_dir = '' 392s has_cmake_module = 0 392s has_cmake_package = 1 392s has_hybrid_package = 1 392s has_pure_module = 1 392s has_pure_package = 0 392s mock_setup = 392s mocker = 392s package_base = '' 392s package_base_dir = '' 392s path = 'pureModule.py' 392s path_types = ('c', 'h', 'pm') 392s root = '' 392s select_paths = .select_paths at 0x7537df9b4180> 392s src_dir = local('/tmp/pytest-of-ubuntu/pytest-102/test_setup_inputs0') 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-102/test_setup_inputs0') 392s with_package_base = 0 392s 392s tests/test_setup.py:849: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-102/test_setup_inputs0') 392s setup_args = ['build'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-102/test_setup_inputs0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s ________________________ test_setup_inputs[0-1-0-1-1-0] ________________________ 392s 392s has_cmake_package = 0, has_cmake_module = 1, has_hybrid_package = 1 392s has_pure_package = 0, has_pure_module = 1, with_package_base = 0 392s mocker = 392s 392s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 392s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 392s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_module", [0, 1]) 392s @pytest.mark.parametrize("with_package_base", [0, 1]) 392s def test_setup_inputs( 392s has_cmake_package, 392s has_cmake_module, 392s has_hybrid_package, 392s has_pure_package, 392s has_pure_module, 392s with_package_base, 392s mocker, 392s ): 392s """This test that a project can have a package with some modules 392s installed using setup.py and some other modules installed using CMake. 392s """ 392s 392s tmp_dir = _tmpdir("test_setup_inputs") 392s 392s package_base = "to/the/base" if with_package_base else "" 392s package_base_dir = package_base + "/" if package_base else "" 392s cmake_source_dir = package_base 392s 392s if cmake_source_dir and (has_cmake_package or has_cmake_module): 392s pytest.skip( 392s "unsupported configuration: " 392s "python package fully generated by CMake does *NOT* work. " 392s "At least __init__.py should be in the project source tree" 392s ) 392s 392s # ------------------------------------------------------------------------- 392s # Here is the "SOURCE" tree layout: 392s # 392s # ROOT/ 392s # 392s # setup.py 392s # 392s # [/] 392s # 392s # pureModule.py 392s # 392s # pure/ 392s # __init__.py 392s # pure.py 392s # 392s # data/ 392s # pure.dat 392s # 392s # [/] 392s # 392s # hybrid/ 392s # CMakeLists.txt 392s # __init__.py 392s # hybrid_pure.dat 392s # hybrid_pure.py 392s # 392s # data/ 392s # hybrid_data_pure.dat 392s # 392s # hybrid_2/ 392s # __init__.py 392s # hybrid_2_pure.py 392s # 392s # hybrid_2_pure/ 392s # __init__.py 392s # hybrid_2_pure_1.py 392s # hybrid_2_pure_2.py 392s # 392s # 392s # ------------------------------------------------------------------------- 392s # and here is the "BINARY" distribution layout: 392s # 392s # The comment "CMake" or "Setuptools" indicates which tool is responsible 392s # for placing the file in the tree used to create the binary distribution. 392s # 392s # ROOT/ 392s # 392s # cmakeModule.py # CMake 392s # 392s # cmake/ 392s # __init__.py # CMake 392s # cmake.py # CMake 392s # 392s # hybrid/ 392s # hybrid_cmake.dat # CMake 392s # hybrid_cmake.py # CMake 392s # hybrid_pure.dat # Setuptools 392s # hybrid_pure.py # Setuptools 392s # 392s # data/ 392s # hybrid_data_pure.dat # CMake or Setuptools 392s # hybrid_data_cmake.dat # CMake *NO TEST* 392s # 392s # hybrid_2/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure.py # CMake or Setuptools 392s # hybrid_2_cmake.py # CMake 392s # 392s # hybrid_2_pure/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure_1.py # CMake or Setuptools 392s # hybrid_2_pure_2.py # CMake or Setuptools 392s # 392s # pureModule.py # Setuptools 392s # 392s # pure/ 392s # __init__.py # Setuptools 392s # pure.py # Setuptools 392s # 392s # data/ 392s # pure.dat # Setuptools 392s 392s tmp_dir.join("setup.py").write( 392s textwrap.dedent( 392s """ 392s from skbuild import setup 392s #from setuptools import setup 392s setup( 392s name="test_hybrid_project", 392s version="1.2.3", 392s description=("an hybrid package mixing files installed by both " 392s "CMake and setuptools"), 392s author='The scikit-build team', 392s license="MIT", 392s cmake_source_dir='{cmake_source_dir}', 392s cmake_install_dir='{cmake_install_dir}', 392s # Arbitrary order of packages 392s packages=[ 392s {p_off} 'pure', 392s {h_off} 'hybrid.hybrid_2', 392s {h_off} 'hybrid', 392s {c_off} 'cmake', 392s {p_off} 'hybrid.hybrid_2_pure', 392s ], 392s py_modules=[ 392s {pm_off} '{package_base}pureModule', 392s {cm_off} '{package_base}cmakeModule', 392s ], 392s package_data={{ 392s {p_off} 'pure': ['data/pure.dat'], 392s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 392s }}, 392s # Arbitrary order of package_dir 392s package_dir = {{ 392s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 392s {p_off} 'pure': '{package_base}pure', 392s {h_off} 'hybrid': '{package_base}hybrid', 392s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 392s {c_off} 'cmake': '{package_base}cmake', 392s }} 392s ) 392s """.format( 392s cmake_source_dir=cmake_source_dir, 392s cmake_install_dir=package_base, 392s package_base=package_base_dir, 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s p_off="" if has_pure_package else "#", 392s pm_off="" if has_pure_module else "#", 392s ) 392s ) 392s ) 392s 392s src_dir = tmp_dir.ensure(package_base, dir=1) 392s 392s src_dir.join("CMakeLists.txt").write( 392s textwrap.dedent( 392s """ 392s cmake_minimum_required(VERSION 3.5.0) 392s project(hybrid NONE) 392s set(build_dir ${{CMAKE_BINARY_DIR}}) 392s 392s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 392s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 392s {c_off} install( 392s {c_off} FILES 392s {c_off} ${{build_dir}}/__init__.py 392s {c_off} ${{build_dir}}/cmake.py 392s {c_off} DESTINATION cmake 392s {c_off} ) 392s 392s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 392s {cm_off} install( 392s {cm_off} FILES ${{build_dir}}/cmakeModule.py 392s {cm_off} DESTINATION .) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 392s {h_off} DESTINATION hybrid/data) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 392s {h_off} DESTINATION hybrid/hybrid_2) 392s 392s install(CODE "message(STATUS \\\"Installation complete\\\")") 392s """.format( 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s ) 392s ) 392s ) 392s 392s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 392s path_types: Sequence[str] 392s try: 392s path_types = next( 392s iter( 392s zip( 392s *filter( 392s lambda i: i[1], 392s [ 392s ("c", has_cmake_package), 392s ("cm", has_cmake_module), 392s ("h", has_hybrid_package), 392s ("p", has_pure_package), 392s ("pm", has_pure_module), 392s ], 392s ) 392s ) 392s ) 392s ) 392s except StopIteration: 392s path_types = [] 392s 392s def select_paths(annotated_paths): 392s """Return a filtered list paths considering ``path_types``. 392s 392s `annotated_paths`` is list of tuple ``(type, path)`` where type 392s is either `c`, 'cm', `h`, `p` or 'pm'. 392s 392s """ 392s return filter(lambda i: i[0] in path_types, annotated_paths) 392s 392s # Commented paths are the one expected to be installed by CMake. For 392s # this reason, corresponding files should NOT be created in the source 392s # tree. 392s for _type, path in select_paths( 392s [ 392s # ('c', 'cmake/__init__.py'), 392s # ('c', 'cmake/cmake.py'), 392s # ('cm', 'cmakeModule.py'), 392s ("h", "hybrid/__init__.py"), 392s # ('h', 'hybrid/hybrid_cmake.dat'), 392s # ('h', 'hybrid/hybrid_cmake.py'), 392s ("h", "hybrid/hybrid_pure.dat"), 392s ("h", "hybrid/hybrid_pure.py"), 392s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 392s ("h", "hybrid/data/hybrid_data_pure.dat"), 392s ("h", "hybrid/hybrid_2/__init__.py"), 392s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 392s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 392s ("p", "hybrid/hybrid_2_pure/__init__.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 392s ("pm", "pureModule.py"), 392s ("p", "pure/__init__.py"), 392s ("p", "pure/pure.py"), 392s ("p", "pure/data/pure.dat"), 392s ] 392s ): 392s assert _type in {"p", "pm", "h"} 392s root = package_base if _type in {"p", "pm"} else cmake_source_dir 392s tmp_dir.ensure(os.path.join(root, path)) 392s 392s # Do not call the real setup function. Instead, replace it with 392s # a MagicMock allowing to check with which arguments it was invoked. 392s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 392s 392s # Convenience print function 392s def _pprint(desc, value=None): 392s print( 392s "-----------------\n" 392s f"{desc}:\n" 392s "\n" 392s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 392s ) 392s 392s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 392s 392s _pprint = ._pprint at 0x7537df9f7600> 392s _type = 'pm' 392s cmake_source_dir = '' 392s has_cmake_module = 1 392s has_cmake_package = 0 392s has_hybrid_package = 1 392s has_pure_module = 1 392s has_pure_package = 0 392s mock_setup = 392s mocker = 392s package_base = '' 392s package_base_dir = '' 392s path = 'pureModule.py' 392s path_types = ('cm', 'h', 'pm') 392s root = '' 392s select_paths = .select_paths at 0x7537df9f7060> 392s src_dir = local('/tmp/pytest-of-ubuntu/pytest-103/test_setup_inputs0') 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-103/test_setup_inputs0') 392s with_package_base = 0 392s 392s tests/test_setup.py:849: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-103/test_setup_inputs0') 392s setup_args = ['build'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-103/test_setup_inputs0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s ________________________ test_setup_inputs[0-1-0-1-1-1] ________________________ 392s 392s has_cmake_package = 1, has_cmake_module = 1, has_hybrid_package = 1 392s has_pure_package = 0, has_pure_module = 1, with_package_base = 0 392s mocker = 392s 392s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 392s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 392s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_module", [0, 1]) 392s @pytest.mark.parametrize("with_package_base", [0, 1]) 392s def test_setup_inputs( 392s has_cmake_package, 392s has_cmake_module, 392s has_hybrid_package, 392s has_pure_package, 392s has_pure_module, 392s with_package_base, 392s mocker, 392s ): 392s """This test that a project can have a package with some modules 392s installed using setup.py and some other modules installed using CMake. 392s """ 392s 392s tmp_dir = _tmpdir("test_setup_inputs") 392s 392s package_base = "to/the/base" if with_package_base else "" 392s package_base_dir = package_base + "/" if package_base else "" 392s cmake_source_dir = package_base 392s 392s if cmake_source_dir and (has_cmake_package or has_cmake_module): 392s pytest.skip( 392s "unsupported configuration: " 392s "python package fully generated by CMake does *NOT* work. " 392s "At least __init__.py should be in the project source tree" 392s ) 392s 392s # ------------------------------------------------------------------------- 392s # Here is the "SOURCE" tree layout: 392s # 392s # ROOT/ 392s # 392s # setup.py 392s # 392s # [/] 392s # 392s # pureModule.py 392s # 392s # pure/ 392s # __init__.py 392s # pure.py 392s # 392s # data/ 392s # pure.dat 392s # 392s # [/] 392s # 392s # hybrid/ 392s # CMakeLists.txt 392s # __init__.py 392s # hybrid_pure.dat 392s # hybrid_pure.py 392s # 392s # data/ 392s # hybrid_data_pure.dat 392s # 392s # hybrid_2/ 392s # __init__.py 392s # hybrid_2_pure.py 392s # 392s # hybrid_2_pure/ 392s # __init__.py 392s # hybrid_2_pure_1.py 392s # hybrid_2_pure_2.py 392s # 392s # 392s # ------------------------------------------------------------------------- 392s # and here is the "BINARY" distribution layout: 392s # 392s # The comment "CMake" or "Setuptools" indicates which tool is responsible 392s # for placing the file in the tree used to create the binary distribution. 392s # 392s # ROOT/ 392s # 392s # cmakeModule.py # CMake 392s # 392s # cmake/ 392s # __init__.py # CMake 392s # cmake.py # CMake 392s # 392s # hybrid/ 392s # hybrid_cmake.dat # CMake 392s # hybrid_cmake.py # CMake 392s # hybrid_pure.dat # Setuptools 392s # hybrid_pure.py # Setuptools 392s # 392s # data/ 392s # hybrid_data_pure.dat # CMake or Setuptools 392s # hybrid_data_cmake.dat # CMake *NO TEST* 392s # 392s # hybrid_2/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure.py # CMake or Setuptools 392s # hybrid_2_cmake.py # CMake 392s # 392s # hybrid_2_pure/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure_1.py # CMake or Setuptools 392s # hybrid_2_pure_2.py # CMake or Setuptools 392s # 392s # pureModule.py # Setuptools 392s # 392s # pure/ 392s # __init__.py # Setuptools 392s # pure.py # Setuptools 392s # 392s # data/ 392s # pure.dat # Setuptools 392s 392s tmp_dir.join("setup.py").write( 392s textwrap.dedent( 392s """ 392s from skbuild import setup 392s #from setuptools import setup 392s setup( 392s name="test_hybrid_project", 392s version="1.2.3", 392s description=("an hybrid package mixing files installed by both " 392s "CMake and setuptools"), 392s author='The scikit-build team', 392s license="MIT", 392s cmake_source_dir='{cmake_source_dir}', 392s cmake_install_dir='{cmake_install_dir}', 392s # Arbitrary order of packages 392s packages=[ 392s {p_off} 'pure', 392s {h_off} 'hybrid.hybrid_2', 392s {h_off} 'hybrid', 392s {c_off} 'cmake', 392s {p_off} 'hybrid.hybrid_2_pure', 392s ], 392s py_modules=[ 392s {pm_off} '{package_base}pureModule', 392s {cm_off} '{package_base}cmakeModule', 392s ], 392s package_data={{ 392s {p_off} 'pure': ['data/pure.dat'], 392s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 392s }}, 392s # Arbitrary order of package_dir 392s package_dir = {{ 392s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 392s {p_off} 'pure': '{package_base}pure', 392s {h_off} 'hybrid': '{package_base}hybrid', 392s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 392s {c_off} 'cmake': '{package_base}cmake', 392s }} 392s ) 392s """.format( 392s cmake_source_dir=cmake_source_dir, 392s cmake_install_dir=package_base, 392s package_base=package_base_dir, 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s p_off="" if has_pure_package else "#", 392s pm_off="" if has_pure_module else "#", 392s ) 392s ) 392s ) 392s 392s src_dir = tmp_dir.ensure(package_base, dir=1) 392s 392s src_dir.join("CMakeLists.txt").write( 392s textwrap.dedent( 392s """ 392s cmake_minimum_required(VERSION 3.5.0) 392s project(hybrid NONE) 392s set(build_dir ${{CMAKE_BINARY_DIR}}) 392s 392s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 392s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 392s {c_off} install( 392s {c_off} FILES 392s {c_off} ${{build_dir}}/__init__.py 392s {c_off} ${{build_dir}}/cmake.py 392s {c_off} DESTINATION cmake 392s {c_off} ) 392s 392s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 392s {cm_off} install( 392s {cm_off} FILES ${{build_dir}}/cmakeModule.py 392s {cm_off} DESTINATION .) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 392s {h_off} DESTINATION hybrid/data) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 392s {h_off} DESTINATION hybrid/hybrid_2) 392s 392s install(CODE "message(STATUS \\\"Installation complete\\\")") 392s """.format( 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s ) 392s ) 392s ) 392s 392s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 392s path_types: Sequence[str] 392s try: 392s path_types = next( 392s iter( 392s zip( 392s *filter( 392s lambda i: i[1], 392s [ 392s ("c", has_cmake_package), 392s ("cm", has_cmake_module), 392s ("h", has_hybrid_package), 392s ("p", has_pure_package), 392s ("pm", has_pure_module), 392s ], 392s ) 392s ) 392s ) 392s ) 392s except StopIteration: 392s path_types = [] 392s 392s def select_paths(annotated_paths): 392s """Return a filtered list paths considering ``path_types``. 392s 392s `annotated_paths`` is list of tuple ``(type, path)`` where type 392s is either `c`, 'cm', `h`, `p` or 'pm'. 392s 392s """ 392s return filter(lambda i: i[0] in path_types, annotated_paths) 392s 392s # Commented paths are the one expected to be installed by CMake. For 392s # this reason, corresponding files should NOT be created in the source 392s # tree. 392s for _type, path in select_paths( 392s [ 392s # ('c', 'cmake/__init__.py'), 392s # ('c', 'cmake/cmake.py'), 392s # ('cm', 'cmakeModule.py'), 392s ("h", "hybrid/__init__.py"), 392s # ('h', 'hybrid/hybrid_cmake.dat'), 392s # ('h', 'hybrid/hybrid_cmake.py'), 392s ("h", "hybrid/hybrid_pure.dat"), 392s ("h", "hybrid/hybrid_pure.py"), 392s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 392s ("h", "hybrid/data/hybrid_data_pure.dat"), 392s ("h", "hybrid/hybrid_2/__init__.py"), 392s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 392s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 392s ("p", "hybrid/hybrid_2_pure/__init__.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 392s ("pm", "pureModule.py"), 392s ("p", "pure/__init__.py"), 392s ("p", "pure/pure.py"), 392s ("p", "pure/data/pure.dat"), 392s ] 392s ): 392s assert _type in {"p", "pm", "h"} 392s root = package_base if _type in {"p", "pm"} else cmake_source_dir 392s tmp_dir.ensure(os.path.join(root, path)) 392s 392s # Do not call the real setup function. Instead, replace it with 392s # a MagicMock allowing to check with which arguments it was invoked. 392s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 392s 392s # Convenience print function 392s def _pprint(desc, value=None): 392s print( 392s "-----------------\n" 392s f"{desc}:\n" 392s "\n" 392s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 392s ) 392s 392s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 392s 392s _pprint = ._pprint at 0x7537df9f4d60> 392s _type = 'pm' 392s cmake_source_dir = '' 392s has_cmake_module = 1 392s has_cmake_package = 1 392s has_hybrid_package = 1 392s has_pure_module = 1 392s has_pure_package = 0 392s mock_setup = 392s mocker = 392s package_base = '' 392s package_base_dir = '' 392s path = 'pureModule.py' 392s path_types = ('c', 'cm', 'h', 'pm') 392s root = '' 392s select_paths = .select_paths at 0x7537df9f7380> 392s src_dir = local('/tmp/pytest-of-ubuntu/pytest-104/test_setup_inputs0') 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-104/test_setup_inputs0') 392s with_package_base = 0 392s 392s tests/test_setup.py:849: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-104/test_setup_inputs0') 392s setup_args = ['build'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-104/test_setup_inputs0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s ________________________ test_setup_inputs[0-1-1-0-0-0] ________________________ 392s 392s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 0 392s has_pure_package = 1, has_pure_module = 1, with_package_base = 0 392s mocker = 392s 392s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 392s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 392s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_module", [0, 1]) 392s @pytest.mark.parametrize("with_package_base", [0, 1]) 392s def test_setup_inputs( 392s has_cmake_package, 392s has_cmake_module, 392s has_hybrid_package, 392s has_pure_package, 392s has_pure_module, 392s with_package_base, 392s mocker, 392s ): 392s """This test that a project can have a package with some modules 392s installed using setup.py and some other modules installed using CMake. 392s """ 392s 392s tmp_dir = _tmpdir("test_setup_inputs") 392s 392s package_base = "to/the/base" if with_package_base else "" 392s package_base_dir = package_base + "/" if package_base else "" 392s cmake_source_dir = package_base 392s 392s if cmake_source_dir and (has_cmake_package or has_cmake_module): 392s pytest.skip( 392s "unsupported configuration: " 392s "python package fully generated by CMake does *NOT* work. " 392s "At least __init__.py should be in the project source tree" 392s ) 392s 392s # ------------------------------------------------------------------------- 392s # Here is the "SOURCE" tree layout: 392s # 392s # ROOT/ 392s # 392s # setup.py 392s # 392s # [/] 392s # 392s # pureModule.py 392s # 392s # pure/ 392s # __init__.py 392s # pure.py 392s # 392s # data/ 392s # pure.dat 392s # 392s # [/] 392s # 392s # hybrid/ 392s # CMakeLists.txt 392s # __init__.py 392s # hybrid_pure.dat 392s # hybrid_pure.py 392s # 392s # data/ 392s # hybrid_data_pure.dat 392s # 392s # hybrid_2/ 392s # __init__.py 392s # hybrid_2_pure.py 392s # 392s # hybrid_2_pure/ 392s # __init__.py 392s # hybrid_2_pure_1.py 392s # hybrid_2_pure_2.py 392s # 392s # 392s # ------------------------------------------------------------------------- 392s # and here is the "BINARY" distribution layout: 392s # 392s # The comment "CMake" or "Setuptools" indicates which tool is responsible 392s # for placing the file in the tree used to create the binary distribution. 392s # 392s # ROOT/ 392s # 392s # cmakeModule.py # CMake 392s # 392s # cmake/ 392s # __init__.py # CMake 392s # cmake.py # CMake 392s # 392s # hybrid/ 392s # hybrid_cmake.dat # CMake 392s # hybrid_cmake.py # CMake 392s # hybrid_pure.dat # Setuptools 392s # hybrid_pure.py # Setuptools 392s # 392s # data/ 392s # hybrid_data_pure.dat # CMake or Setuptools 392s # hybrid_data_cmake.dat # CMake *NO TEST* 392s # 392s # hybrid_2/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure.py # CMake or Setuptools 392s # hybrid_2_cmake.py # CMake 392s # 392s # hybrid_2_pure/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure_1.py # CMake or Setuptools 392s # hybrid_2_pure_2.py # CMake or Setuptools 392s # 392s # pureModule.py # Setuptools 392s # 392s # pure/ 392s # __init__.py # Setuptools 392s # pure.py # Setuptools 392s # 392s # data/ 392s # pure.dat # Setuptools 392s 392s tmp_dir.join("setup.py").write( 392s textwrap.dedent( 392s """ 392s from skbuild import setup 392s #from setuptools import setup 392s setup( 392s name="test_hybrid_project", 392s version="1.2.3", 392s description=("an hybrid package mixing files installed by both " 392s "CMake and setuptools"), 392s author='The scikit-build team', 392s license="MIT", 392s cmake_source_dir='{cmake_source_dir}', 392s cmake_install_dir='{cmake_install_dir}', 392s # Arbitrary order of packages 392s packages=[ 392s {p_off} 'pure', 392s {h_off} 'hybrid.hybrid_2', 392s {h_off} 'hybrid', 392s {c_off} 'cmake', 392s {p_off} 'hybrid.hybrid_2_pure', 392s ], 392s py_modules=[ 392s {pm_off} '{package_base}pureModule', 392s {cm_off} '{package_base}cmakeModule', 392s ], 392s package_data={{ 392s {p_off} 'pure': ['data/pure.dat'], 392s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 392s }}, 392s # Arbitrary order of package_dir 392s package_dir = {{ 392s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 392s {p_off} 'pure': '{package_base}pure', 392s {h_off} 'hybrid': '{package_base}hybrid', 392s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 392s {c_off} 'cmake': '{package_base}cmake', 392s }} 392s ) 392s """.format( 392s cmake_source_dir=cmake_source_dir, 392s cmake_install_dir=package_base, 392s package_base=package_base_dir, 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s p_off="" if has_pure_package else "#", 392s pm_off="" if has_pure_module else "#", 392s ) 392s ) 392s ) 392s 392s src_dir = tmp_dir.ensure(package_base, dir=1) 392s 392s src_dir.join("CMakeLists.txt").write( 392s textwrap.dedent( 392s """ 392s cmake_minimum_required(VERSION 3.5.0) 392s project(hybrid NONE) 392s set(build_dir ${{CMAKE_BINARY_DIR}}) 392s 392s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 392s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 392s {c_off} install( 392s {c_off} FILES 392s {c_off} ${{build_dir}}/__init__.py 392s {c_off} ${{build_dir}}/cmake.py 392s {c_off} DESTINATION cmake 392s {c_off} ) 392s 392s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 392s {cm_off} install( 392s {cm_off} FILES ${{build_dir}}/cmakeModule.py 392s {cm_off} DESTINATION .) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 392s {h_off} DESTINATION hybrid/data) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 392s {h_off} DESTINATION hybrid/hybrid_2) 392s 392s install(CODE "message(STATUS \\\"Installation complete\\\")") 392s """.format( 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s ) 392s ) 392s ) 392s 392s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 392s path_types: Sequence[str] 392s try: 392s path_types = next( 392s iter( 392s zip( 392s *filter( 392s lambda i: i[1], 392s [ 392s ("c", has_cmake_package), 392s ("cm", has_cmake_module), 392s ("h", has_hybrid_package), 392s ("p", has_pure_package), 392s ("pm", has_pure_module), 392s ], 392s ) 392s ) 392s ) 392s ) 392s except StopIteration: 392s path_types = [] 392s 392s def select_paths(annotated_paths): 392s """Return a filtered list paths considering ``path_types``. 392s 392s `annotated_paths`` is list of tuple ``(type, path)`` where type 392s is either `c`, 'cm', `h`, `p` or 'pm'. 392s 392s """ 392s return filter(lambda i: i[0] in path_types, annotated_paths) 392s 392s # Commented paths are the one expected to be installed by CMake. For 392s # this reason, corresponding files should NOT be created in the source 392s # tree. 392s for _type, path in select_paths( 392s [ 392s # ('c', 'cmake/__init__.py'), 392s # ('c', 'cmake/cmake.py'), 392s # ('cm', 'cmakeModule.py'), 392s ("h", "hybrid/__init__.py"), 392s # ('h', 'hybrid/hybrid_cmake.dat'), 392s # ('h', 'hybrid/hybrid_cmake.py'), 392s ("h", "hybrid/hybrid_pure.dat"), 392s ("h", "hybrid/hybrid_pure.py"), 392s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 392s ("h", "hybrid/data/hybrid_data_pure.dat"), 392s ("h", "hybrid/hybrid_2/__init__.py"), 392s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 392s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 392s ("p", "hybrid/hybrid_2_pure/__init__.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 392s ("pm", "pureModule.py"), 392s ("p", "pure/__init__.py"), 392s ("p", "pure/pure.py"), 392s ("p", "pure/data/pure.dat"), 392s ] 392s ): 392s assert _type in {"p", "pm", "h"} 392s root = package_base if _type in {"p", "pm"} else cmake_source_dir 392s tmp_dir.ensure(os.path.join(root, path)) 392s 392s # Do not call the real setup function. Instead, replace it with 392s # a MagicMock allowing to check with which arguments it was invoked. 392s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 392s 392s # Convenience print function 392s def _pprint(desc, value=None): 392s print( 392s "-----------------\n" 392s f"{desc}:\n" 392s "\n" 392s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 392s ) 392s 392s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 392s 392s _pprint = ._pprint at 0x7537df9b5080> 392s _type = 'p' 392s cmake_source_dir = '' 392s has_cmake_module = 0 392s has_cmake_package = 0 392s has_hybrid_package = 0 392s has_pure_module = 1 392s has_pure_package = 1 392s mock_setup = 392s mocker = 392s package_base = '' 392s package_base_dir = '' 392s path = 'pure/data/pure.dat' 392s path_types = ('p', 'pm') 392s root = '' 392s select_paths = .select_paths at 0x7537df9b4720> 392s src_dir = local('/tmp/pytest-of-ubuntu/pytest-105/test_setup_inputs0') 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-105/test_setup_inputs0') 392s with_package_base = 0 392s 392s tests/test_setup.py:849: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-105/test_setup_inputs0') 392s setup_args = ['build'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-105/test_setup_inputs0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s ________________________ test_setup_inputs[0-1-1-0-0-1] ________________________ 392s 392s has_cmake_package = 1, has_cmake_module = 0, has_hybrid_package = 0 392s has_pure_package = 1, has_pure_module = 1, with_package_base = 0 392s mocker = 392s 392s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 392s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 392s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_module", [0, 1]) 392s @pytest.mark.parametrize("with_package_base", [0, 1]) 392s def test_setup_inputs( 392s has_cmake_package, 392s has_cmake_module, 392s has_hybrid_package, 392s has_pure_package, 392s has_pure_module, 392s with_package_base, 392s mocker, 392s ): 392s """This test that a project can have a package with some modules 392s installed using setup.py and some other modules installed using CMake. 392s """ 392s 392s tmp_dir = _tmpdir("test_setup_inputs") 392s 392s package_base = "to/the/base" if with_package_base else "" 392s package_base_dir = package_base + "/" if package_base else "" 392s cmake_source_dir = package_base 392s 392s if cmake_source_dir and (has_cmake_package or has_cmake_module): 392s pytest.skip( 392s "unsupported configuration: " 392s "python package fully generated by CMake does *NOT* work. " 392s "At least __init__.py should be in the project source tree" 392s ) 392s 392s # ------------------------------------------------------------------------- 392s # Here is the "SOURCE" tree layout: 392s # 392s # ROOT/ 392s # 392s # setup.py 392s # 392s # [/] 392s # 392s # pureModule.py 392s # 392s # pure/ 392s # __init__.py 392s # pure.py 392s # 392s # data/ 392s # pure.dat 392s # 392s # [/] 392s # 392s # hybrid/ 392s # CMakeLists.txt 392s # __init__.py 392s # hybrid_pure.dat 392s # hybrid_pure.py 392s # 392s # data/ 392s # hybrid_data_pure.dat 392s # 392s # hybrid_2/ 392s # __init__.py 392s # hybrid_2_pure.py 392s # 392s # hybrid_2_pure/ 392s # __init__.py 392s # hybrid_2_pure_1.py 392s # hybrid_2_pure_2.py 392s # 392s # 392s # ------------------------------------------------------------------------- 392s # and here is the "BINARY" distribution layout: 392s # 392s # The comment "CMake" or "Setuptools" indicates which tool is responsible 392s # for placing the file in the tree used to create the binary distribution. 392s # 392s # ROOT/ 392s # 392s # cmakeModule.py # CMake 392s # 392s # cmake/ 392s # __init__.py # CMake 392s # cmake.py # CMake 392s # 392s # hybrid/ 392s # hybrid_cmake.dat # CMake 392s # hybrid_cmake.py # CMake 392s # hybrid_pure.dat # Setuptools 392s # hybrid_pure.py # Setuptools 392s # 392s # data/ 392s # hybrid_data_pure.dat # CMake or Setuptools 392s # hybrid_data_cmake.dat # CMake *NO TEST* 392s # 392s # hybrid_2/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure.py # CMake or Setuptools 392s # hybrid_2_cmake.py # CMake 392s # 392s # hybrid_2_pure/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure_1.py # CMake or Setuptools 392s # hybrid_2_pure_2.py # CMake or Setuptools 392s # 392s # pureModule.py # Setuptools 392s # 392s # pure/ 392s # __init__.py # Setuptools 392s # pure.py # Setuptools 392s # 392s # data/ 392s # pure.dat # Setuptools 392s 392s tmp_dir.join("setup.py").write( 392s textwrap.dedent( 392s """ 392s from skbuild import setup 392s #from setuptools import setup 392s setup( 392s name="test_hybrid_project", 392s version="1.2.3", 392s description=("an hybrid package mixing files installed by both " 392s "CMake and setuptools"), 392s author='The scikit-build team', 392s license="MIT", 392s cmake_source_dir='{cmake_source_dir}', 392s cmake_install_dir='{cmake_install_dir}', 392s # Arbitrary order of packages 392s packages=[ 392s {p_off} 'pure', 392s {h_off} 'hybrid.hybrid_2', 392s {h_off} 'hybrid', 392s {c_off} 'cmake', 392s {p_off} 'hybrid.hybrid_2_pure', 392s ], 392s py_modules=[ 392s {pm_off} '{package_base}pureModule', 392s {cm_off} '{package_base}cmakeModule', 392s ], 392s package_data={{ 392s {p_off} 'pure': ['data/pure.dat'], 392s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 392s }}, 392s # Arbitrary order of package_dir 392s package_dir = {{ 392s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 392s {p_off} 'pure': '{package_base}pure', 392s {h_off} 'hybrid': '{package_base}hybrid', 392s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 392s {c_off} 'cmake': '{package_base}cmake', 392s }} 392s ) 392s """.format( 392s cmake_source_dir=cmake_source_dir, 392s cmake_install_dir=package_base, 392s package_base=package_base_dir, 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s p_off="" if has_pure_package else "#", 392s pm_off="" if has_pure_module else "#", 392s ) 392s ) 392s ) 392s 392s src_dir = tmp_dir.ensure(package_base, dir=1) 392s 392s src_dir.join("CMakeLists.txt").write( 392s textwrap.dedent( 392s """ 392s cmake_minimum_required(VERSION 3.5.0) 392s project(hybrid NONE) 392s set(build_dir ${{CMAKE_BINARY_DIR}}) 392s 392s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 392s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 392s {c_off} install( 392s {c_off} FILES 392s {c_off} ${{build_dir}}/__init__.py 392s {c_off} ${{build_dir}}/cmake.py 392s {c_off} DESTINATION cmake 392s {c_off} ) 392s 392s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 392s {cm_off} install( 392s {cm_off} FILES ${{build_dir}}/cmakeModule.py 392s {cm_off} DESTINATION .) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 392s {h_off} DESTINATION hybrid/data) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 392s {h_off} DESTINATION hybrid/hybrid_2) 392s 392s install(CODE "message(STATUS \\\"Installation complete\\\")") 392s """.format( 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s ) 392s ) 392s ) 392s 392s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 392s path_types: Sequence[str] 392s try: 392s path_types = next( 392s iter( 392s zip( 392s *filter( 392s lambda i: i[1], 392s [ 392s ("c", has_cmake_package), 392s ("cm", has_cmake_module), 392s ("h", has_hybrid_package), 392s ("p", has_pure_package), 392s ("pm", has_pure_module), 392s ], 392s ) 392s ) 392s ) 392s ) 392s except StopIteration: 392s path_types = [] 392s 392s def select_paths(annotated_paths): 392s """Return a filtered list paths considering ``path_types``. 392s 392s `annotated_paths`` is list of tuple ``(type, path)`` where type 392s is either `c`, 'cm', `h`, `p` or 'pm'. 392s 392s """ 392s return filter(lambda i: i[0] in path_types, annotated_paths) 392s 392s # Commented paths are the one expected to be installed by CMake. For 392s # this reason, corresponding files should NOT be created in the source 392s # tree. 392s for _type, path in select_paths( 392s [ 392s # ('c', 'cmake/__init__.py'), 392s # ('c', 'cmake/cmake.py'), 392s # ('cm', 'cmakeModule.py'), 392s ("h", "hybrid/__init__.py"), 392s # ('h', 'hybrid/hybrid_cmake.dat'), 392s # ('h', 'hybrid/hybrid_cmake.py'), 392s ("h", "hybrid/hybrid_pure.dat"), 392s ("h", "hybrid/hybrid_pure.py"), 392s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 392s ("h", "hybrid/data/hybrid_data_pure.dat"), 392s ("h", "hybrid/hybrid_2/__init__.py"), 392s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 392s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 392s ("p", "hybrid/hybrid_2_pure/__init__.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 392s ("pm", "pureModule.py"), 392s ("p", "pure/__init__.py"), 392s ("p", "pure/pure.py"), 392s ("p", "pure/data/pure.dat"), 392s ] 392s ): 392s assert _type in {"p", "pm", "h"} 392s root = package_base if _type in {"p", "pm"} else cmake_source_dir 392s tmp_dir.ensure(os.path.join(root, path)) 392s 392s # Do not call the real setup function. Instead, replace it with 392s # a MagicMock allowing to check with which arguments it was invoked. 392s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 392s 392s # Convenience print function 392s def _pprint(desc, value=None): 392s print( 392s "-----------------\n" 392s f"{desc}:\n" 392s "\n" 392s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 392s ) 392s 392s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 392s 392s _pprint = ._pprint at 0x7537df9b4cc0> 392s _type = 'p' 392s cmake_source_dir = '' 392s has_cmake_module = 0 392s has_cmake_package = 1 392s has_hybrid_package = 0 392s has_pure_module = 1 392s has_pure_package = 1 392s mock_setup = 392s mocker = 392s package_base = '' 392s package_base_dir = '' 392s path = 'pure/data/pure.dat' 392s path_types = ('c', 'p', 'pm') 392s root = '' 392s select_paths = .select_paths at 0x7537df9b4b80> 392s src_dir = local('/tmp/pytest-of-ubuntu/pytest-106/test_setup_inputs0') 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-106/test_setup_inputs0') 392s with_package_base = 0 392s 392s tests/test_setup.py:849: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-106/test_setup_inputs0') 392s setup_args = ['build'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-106/test_setup_inputs0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s ________________________ test_setup_inputs[0-1-1-0-1-0] ________________________ 392s 392s has_cmake_package = 0, has_cmake_module = 1, has_hybrid_package = 0 392s has_pure_package = 1, has_pure_module = 1, with_package_base = 0 392s mocker = 392s 392s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 392s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 392s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_module", [0, 1]) 392s @pytest.mark.parametrize("with_package_base", [0, 1]) 392s def test_setup_inputs( 392s has_cmake_package, 392s has_cmake_module, 392s has_hybrid_package, 392s has_pure_package, 392s has_pure_module, 392s with_package_base, 392s mocker, 392s ): 392s """This test that a project can have a package with some modules 392s installed using setup.py and some other modules installed using CMake. 392s """ 392s 392s tmp_dir = _tmpdir("test_setup_inputs") 392s 392s package_base = "to/the/base" if with_package_base else "" 392s package_base_dir = package_base + "/" if package_base else "" 392s cmake_source_dir = package_base 392s 392s if cmake_source_dir and (has_cmake_package or has_cmake_module): 392s pytest.skip( 392s "unsupported configuration: " 392s "python package fully generated by CMake does *NOT* work. " 392s "At least __init__.py should be in the project source tree" 392s ) 392s 392s # ------------------------------------------------------------------------- 392s # Here is the "SOURCE" tree layout: 392s # 392s # ROOT/ 392s # 392s # setup.py 392s # 392s # [/] 392s # 392s # pureModule.py 392s # 392s # pure/ 392s # __init__.py 392s # pure.py 392s # 392s # data/ 392s # pure.dat 392s # 392s # [/] 392s # 392s # hybrid/ 392s # CMakeLists.txt 392s # __init__.py 392s # hybrid_pure.dat 392s # hybrid_pure.py 392s # 392s # data/ 392s # hybrid_data_pure.dat 392s # 392s # hybrid_2/ 392s # __init__.py 392s # hybrid_2_pure.py 392s # 392s # hybrid_2_pure/ 392s # __init__.py 392s # hybrid_2_pure_1.py 392s # hybrid_2_pure_2.py 392s # 392s # 392s # ------------------------------------------------------------------------- 392s # and here is the "BINARY" distribution layout: 392s # 392s # The comment "CMake" or "Setuptools" indicates which tool is responsible 392s # for placing the file in the tree used to create the binary distribution. 392s # 392s # ROOT/ 392s # 392s # cmakeModule.py # CMake 392s # 392s # cmake/ 392s # __init__.py # CMake 392s # cmake.py # CMake 392s # 392s # hybrid/ 392s # hybrid_cmake.dat # CMake 392s # hybrid_cmake.py # CMake 392s # hybrid_pure.dat # Setuptools 392s # hybrid_pure.py # Setuptools 392s # 392s # data/ 392s # hybrid_data_pure.dat # CMake or Setuptools 392s # hybrid_data_cmake.dat # CMake *NO TEST* 392s # 392s # hybrid_2/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure.py # CMake or Setuptools 392s # hybrid_2_cmake.py # CMake 392s # 392s # hybrid_2_pure/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure_1.py # CMake or Setuptools 392s # hybrid_2_pure_2.py # CMake or Setuptools 392s # 392s # pureModule.py # Setuptools 392s # 392s # pure/ 392s # __init__.py # Setuptools 392s # pure.py # Setuptools 392s # 392s # data/ 392s # pure.dat # Setuptools 392s 392s tmp_dir.join("setup.py").write( 392s textwrap.dedent( 392s """ 392s from skbuild import setup 392s #from setuptools import setup 392s setup( 392s name="test_hybrid_project", 392s version="1.2.3", 392s description=("an hybrid package mixing files installed by both " 392s "CMake and setuptools"), 392s author='The scikit-build team', 392s license="MIT", 392s cmake_source_dir='{cmake_source_dir}', 392s cmake_install_dir='{cmake_install_dir}', 392s # Arbitrary order of packages 392s packages=[ 392s {p_off} 'pure', 392s {h_off} 'hybrid.hybrid_2', 392s {h_off} 'hybrid', 392s {c_off} 'cmake', 392s {p_off} 'hybrid.hybrid_2_pure', 392s ], 392s py_modules=[ 392s {pm_off} '{package_base}pureModule', 392s {cm_off} '{package_base}cmakeModule', 392s ], 392s package_data={{ 392s {p_off} 'pure': ['data/pure.dat'], 392s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 392s }}, 392s # Arbitrary order of package_dir 392s package_dir = {{ 392s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 392s {p_off} 'pure': '{package_base}pure', 392s {h_off} 'hybrid': '{package_base}hybrid', 392s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 392s {c_off} 'cmake': '{package_base}cmake', 392s }} 392s ) 392s """.format( 392s cmake_source_dir=cmake_source_dir, 392s cmake_install_dir=package_base, 392s package_base=package_base_dir, 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s p_off="" if has_pure_package else "#", 392s pm_off="" if has_pure_module else "#", 392s ) 392s ) 392s ) 392s 392s src_dir = tmp_dir.ensure(package_base, dir=1) 392s 392s src_dir.join("CMakeLists.txt").write( 392s textwrap.dedent( 392s """ 392s cmake_minimum_required(VERSION 3.5.0) 392s project(hybrid NONE) 392s set(build_dir ${{CMAKE_BINARY_DIR}}) 392s 392s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 392s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 392s {c_off} install( 392s {c_off} FILES 392s {c_off} ${{build_dir}}/__init__.py 392s {c_off} ${{build_dir}}/cmake.py 392s {c_off} DESTINATION cmake 392s {c_off} ) 392s 392s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 392s {cm_off} install( 392s {cm_off} FILES ${{build_dir}}/cmakeModule.py 392s {cm_off} DESTINATION .) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 392s {h_off} DESTINATION hybrid/data) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 392s {h_off} DESTINATION hybrid/hybrid_2) 392s 392s install(CODE "message(STATUS \\\"Installation complete\\\")") 392s """.format( 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s ) 392s ) 392s ) 392s 392s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 392s path_types: Sequence[str] 392s try: 392s path_types = next( 392s iter( 392s zip( 392s *filter( 392s lambda i: i[1], 392s [ 392s ("c", has_cmake_package), 392s ("cm", has_cmake_module), 392s ("h", has_hybrid_package), 392s ("p", has_pure_package), 392s ("pm", has_pure_module), 392s ], 392s ) 392s ) 392s ) 392s ) 392s except StopIteration: 392s path_types = [] 392s 392s def select_paths(annotated_paths): 392s """Return a filtered list paths considering ``path_types``. 392s 392s `annotated_paths`` is list of tuple ``(type, path)`` where type 392s is either `c`, 'cm', `h`, `p` or 'pm'. 392s 392s """ 392s return filter(lambda i: i[0] in path_types, annotated_paths) 392s 392s # Commented paths are the one expected to be installed by CMake. For 392s # this reason, corresponding files should NOT be created in the source 392s # tree. 392s for _type, path in select_paths( 392s [ 392s # ('c', 'cmake/__init__.py'), 392s # ('c', 'cmake/cmake.py'), 392s # ('cm', 'cmakeModule.py'), 392s ("h", "hybrid/__init__.py"), 392s # ('h', 'hybrid/hybrid_cmake.dat'), 392s # ('h', 'hybrid/hybrid_cmake.py'), 392s ("h", "hybrid/hybrid_pure.dat"), 392s ("h", "hybrid/hybrid_pure.py"), 392s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 392s ("h", "hybrid/data/hybrid_data_pure.dat"), 392s ("h", "hybrid/hybrid_2/__init__.py"), 392s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 392s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 392s ("p", "hybrid/hybrid_2_pure/__init__.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 392s ("pm", "pureModule.py"), 392s ("p", "pure/__init__.py"), 392s ("p", "pure/pure.py"), 392s ("p", "pure/data/pure.dat"), 392s ] 392s ): 392s assert _type in {"p", "pm", "h"} 392s root = package_base if _type in {"p", "pm"} else cmake_source_dir 392s tmp_dir.ensure(os.path.join(root, path)) 392s 392s # Do not call the real setup function. Instead, replace it with 392s # a MagicMock allowing to check with which arguments it was invoked. 392s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 392s 392s # Convenience print function 392s def _pprint(desc, value=None): 392s print( 392s "-----------------\n" 392s f"{desc}:\n" 392s "\n" 392s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 392s ) 392s 392s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 392s 392s _pprint = ._pprint at 0x7537df9f7420> 392s _type = 'p' 392s cmake_source_dir = '' 392s has_cmake_module = 1 392s has_cmake_package = 0 392s has_hybrid_package = 0 392s has_pure_module = 1 392s has_pure_package = 1 392s mock_setup = 392s mocker = 392s package_base = '' 392s package_base_dir = '' 392s path = 'pure/data/pure.dat' 392s path_types = ('cm', 'p', 'pm') 392s root = '' 392s select_paths = .select_paths at 0x7537df9f7ba0> 392s src_dir = local('/tmp/pytest-of-ubuntu/pytest-107/test_setup_inputs0') 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-107/test_setup_inputs0') 392s with_package_base = 0 392s 392s tests/test_setup.py:849: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-107/test_setup_inputs0') 392s setup_args = ['build'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-107/test_setup_inputs0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s ________________________ test_setup_inputs[0-1-1-0-1-1] ________________________ 392s 392s has_cmake_package = 1, has_cmake_module = 1, has_hybrid_package = 0 392s has_pure_package = 1, has_pure_module = 1, with_package_base = 0 392s mocker = 392s 392s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 392s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 392s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_module", [0, 1]) 392s @pytest.mark.parametrize("with_package_base", [0, 1]) 392s def test_setup_inputs( 392s has_cmake_package, 392s has_cmake_module, 392s has_hybrid_package, 392s has_pure_package, 392s has_pure_module, 392s with_package_base, 392s mocker, 392s ): 392s """This test that a project can have a package with some modules 392s installed using setup.py and some other modules installed using CMake. 392s """ 392s 392s tmp_dir = _tmpdir("test_setup_inputs") 392s 392s package_base = "to/the/base" if with_package_base else "" 392s package_base_dir = package_base + "/" if package_base else "" 392s cmake_source_dir = package_base 392s 392s if cmake_source_dir and (has_cmake_package or has_cmake_module): 392s pytest.skip( 392s "unsupported configuration: " 392s "python package fully generated by CMake does *NOT* work. " 392s "At least __init__.py should be in the project source tree" 392s ) 392s 392s # ------------------------------------------------------------------------- 392s # Here is the "SOURCE" tree layout: 392s # 392s # ROOT/ 392s # 392s # setup.py 392s # 392s # [/] 392s # 392s # pureModule.py 392s # 392s # pure/ 392s # __init__.py 392s # pure.py 392s # 392s # data/ 392s # pure.dat 392s # 392s # [/] 392s # 392s # hybrid/ 392s # CMakeLists.txt 392s # __init__.py 392s # hybrid_pure.dat 392s # hybrid_pure.py 392s # 392s # data/ 392s # hybrid_data_pure.dat 392s # 392s # hybrid_2/ 392s # __init__.py 392s # hybrid_2_pure.py 392s # 392s # hybrid_2_pure/ 392s # __init__.py 392s # hybrid_2_pure_1.py 392s # hybrid_2_pure_2.py 392s # 392s # 392s # ------------------------------------------------------------------------- 392s # and here is the "BINARY" distribution layout: 392s # 392s # The comment "CMake" or "Setuptools" indicates which tool is responsible 392s # for placing the file in the tree used to create the binary distribution. 392s # 392s # ROOT/ 392s # 392s # cmakeModule.py # CMake 392s # 392s # cmake/ 392s # __init__.py # CMake 392s # cmake.py # CMake 392s # 392s # hybrid/ 392s # hybrid_cmake.dat # CMake 392s # hybrid_cmake.py # CMake 392s # hybrid_pure.dat # Setuptools 392s # hybrid_pure.py # Setuptools 392s # 392s # data/ 392s # hybrid_data_pure.dat # CMake or Setuptools 392s # hybrid_data_cmake.dat # CMake *NO TEST* 392s # 392s # hybrid_2/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure.py # CMake or Setuptools 392s # hybrid_2_cmake.py # CMake 392s # 392s # hybrid_2_pure/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure_1.py # CMake or Setuptools 392s # hybrid_2_pure_2.py # CMake or Setuptools 392s # 392s # pureModule.py # Setuptools 392s # 392s # pure/ 392s # __init__.py # Setuptools 392s # pure.py # Setuptools 392s # 392s # data/ 392s # pure.dat # Setuptools 392s 392s tmp_dir.join("setup.py").write( 392s textwrap.dedent( 392s """ 392s from skbuild import setup 392s #from setuptools import setup 392s setup( 392s name="test_hybrid_project", 392s version="1.2.3", 392s description=("an hybrid package mixing files installed by both " 392s "CMake and setuptools"), 392s author='The scikit-build team', 392s license="MIT", 392s cmake_source_dir='{cmake_source_dir}', 392s cmake_install_dir='{cmake_install_dir}', 392s # Arbitrary order of packages 392s packages=[ 392s {p_off} 'pure', 392s {h_off} 'hybrid.hybrid_2', 392s {h_off} 'hybrid', 392s {c_off} 'cmake', 392s {p_off} 'hybrid.hybrid_2_pure', 392s ], 392s py_modules=[ 392s {pm_off} '{package_base}pureModule', 392s {cm_off} '{package_base}cmakeModule', 392s ], 392s package_data={{ 392s {p_off} 'pure': ['data/pure.dat'], 392s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 392s }}, 392s # Arbitrary order of package_dir 392s package_dir = {{ 392s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 392s {p_off} 'pure': '{package_base}pure', 392s {h_off} 'hybrid': '{package_base}hybrid', 392s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 392s {c_off} 'cmake': '{package_base}cmake', 392s }} 392s ) 392s """.format( 392s cmake_source_dir=cmake_source_dir, 392s cmake_install_dir=package_base, 392s package_base=package_base_dir, 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s p_off="" if has_pure_package else "#", 392s pm_off="" if has_pure_module else "#", 392s ) 392s ) 392s ) 392s 392s src_dir = tmp_dir.ensure(package_base, dir=1) 392s 392s src_dir.join("CMakeLists.txt").write( 392s textwrap.dedent( 392s """ 392s cmake_minimum_required(VERSION 3.5.0) 392s project(hybrid NONE) 392s set(build_dir ${{CMAKE_BINARY_DIR}}) 392s 392s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 392s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 392s {c_off} install( 392s {c_off} FILES 392s {c_off} ${{build_dir}}/__init__.py 392s {c_off} ${{build_dir}}/cmake.py 392s {c_off} DESTINATION cmake 392s {c_off} ) 392s 392s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 392s {cm_off} install( 392s {cm_off} FILES ${{build_dir}}/cmakeModule.py 392s {cm_off} DESTINATION .) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 392s {h_off} DESTINATION hybrid/data) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 392s {h_off} DESTINATION hybrid/hybrid_2) 392s 392s install(CODE "message(STATUS \\\"Installation complete\\\")") 392s """.format( 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s ) 392s ) 392s ) 392s 392s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 392s path_types: Sequence[str] 392s try: 392s path_types = next( 392s iter( 392s zip( 392s *filter( 392s lambda i: i[1], 392s [ 392s ("c", has_cmake_package), 392s ("cm", has_cmake_module), 392s ("h", has_hybrid_package), 392s ("p", has_pure_package), 392s ("pm", has_pure_module), 392s ], 392s ) 392s ) 392s ) 392s ) 392s except StopIteration: 392s path_types = [] 392s 392s def select_paths(annotated_paths): 392s """Return a filtered list paths considering ``path_types``. 392s 392s `annotated_paths`` is list of tuple ``(type, path)`` where type 392s is either `c`, 'cm', `h`, `p` or 'pm'. 392s 392s """ 392s return filter(lambda i: i[0] in path_types, annotated_paths) 392s 392s # Commented paths are the one expected to be installed by CMake. For 392s # this reason, corresponding files should NOT be created in the source 392s # tree. 392s for _type, path in select_paths( 392s [ 392s # ('c', 'cmake/__init__.py'), 392s # ('c', 'cmake/cmake.py'), 392s # ('cm', 'cmakeModule.py'), 392s ("h", "hybrid/__init__.py"), 392s # ('h', 'hybrid/hybrid_cmake.dat'), 392s # ('h', 'hybrid/hybrid_cmake.py'), 392s ("h", "hybrid/hybrid_pure.dat"), 392s ("h", "hybrid/hybrid_pure.py"), 392s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 392s ("h", "hybrid/data/hybrid_data_pure.dat"), 392s ("h", "hybrid/hybrid_2/__init__.py"), 392s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 392s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 392s ("p", "hybrid/hybrid_2_pure/__init__.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 392s ("pm", "pureModule.py"), 392s ("p", "pure/__init__.py"), 392s ("p", "pure/pure.py"), 392s ("p", "pure/data/pure.dat"), 392s ] 392s ): 392s assert _type in {"p", "pm", "h"} 392s root = package_base if _type in {"p", "pm"} else cmake_source_dir 392s tmp_dir.ensure(os.path.join(root, path)) 392s 392s # Do not call the real setup function. Instead, replace it with 392s # a MagicMock allowing to check with which arguments it was invoked. 392s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 392s 392s # Convenience print function 392s def _pprint(desc, value=None): 392s print( 392s "-----------------\n" 392s f"{desc}:\n" 392s "\n" 392s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 392s ) 392s 392s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 392s 392s _pprint = ._pprint at 0x7537df9b4c20> 392s _type = 'p' 392s cmake_source_dir = '' 392s has_cmake_module = 1 392s has_cmake_package = 1 392s has_hybrid_package = 0 392s has_pure_module = 1 392s has_pure_package = 1 392s mock_setup = 392s mocker = 392s package_base = '' 392s package_base_dir = '' 392s path = 'pure/data/pure.dat' 392s path_types = ('c', 'cm', 'p', 'pm') 392s root = '' 392s select_paths = .select_paths at 0x7537df9f7560> 392s src_dir = local('/tmp/pytest-of-ubuntu/pytest-108/test_setup_inputs0') 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-108/test_setup_inputs0') 392s with_package_base = 0 392s 392s tests/test_setup.py:849: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-108/test_setup_inputs0') 392s setup_args = ['build'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-108/test_setup_inputs0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s ________________________ test_setup_inputs[0-1-1-1-0-0] ________________________ 392s 392s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 1 392s has_pure_package = 1, has_pure_module = 1, with_package_base = 0 392s mocker = 392s 392s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 392s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 392s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_module", [0, 1]) 392s @pytest.mark.parametrize("with_package_base", [0, 1]) 392s def test_setup_inputs( 392s has_cmake_package, 392s has_cmake_module, 392s has_hybrid_package, 392s has_pure_package, 392s has_pure_module, 392s with_package_base, 392s mocker, 392s ): 392s """This test that a project can have a package with some modules 392s installed using setup.py and some other modules installed using CMake. 392s """ 392s 392s tmp_dir = _tmpdir("test_setup_inputs") 392s 392s package_base = "to/the/base" if with_package_base else "" 392s package_base_dir = package_base + "/" if package_base else "" 392s cmake_source_dir = package_base 392s 392s if cmake_source_dir and (has_cmake_package or has_cmake_module): 392s pytest.skip( 392s "unsupported configuration: " 392s "python package fully generated by CMake does *NOT* work. " 392s "At least __init__.py should be in the project source tree" 392s ) 392s 392s # ------------------------------------------------------------------------- 392s # Here is the "SOURCE" tree layout: 392s # 392s # ROOT/ 392s # 392s # setup.py 392s # 392s # [/] 392s # 392s # pureModule.py 392s # 392s # pure/ 392s # __init__.py 392s # pure.py 392s # 392s # data/ 392s # pure.dat 392s # 392s # [/] 392s # 392s # hybrid/ 392s # CMakeLists.txt 392s # __init__.py 392s # hybrid_pure.dat 392s # hybrid_pure.py 392s # 392s # data/ 392s # hybrid_data_pure.dat 392s # 392s # hybrid_2/ 392s # __init__.py 392s # hybrid_2_pure.py 392s # 392s # hybrid_2_pure/ 392s # __init__.py 392s # hybrid_2_pure_1.py 392s # hybrid_2_pure_2.py 392s # 392s # 392s # ------------------------------------------------------------------------- 392s # and here is the "BINARY" distribution layout: 392s # 392s # The comment "CMake" or "Setuptools" indicates which tool is responsible 392s # for placing the file in the tree used to create the binary distribution. 392s # 392s # ROOT/ 392s # 392s # cmakeModule.py # CMake 392s # 392s # cmake/ 392s # __init__.py # CMake 392s # cmake.py # CMake 392s # 392s # hybrid/ 392s # hybrid_cmake.dat # CMake 392s # hybrid_cmake.py # CMake 392s # hybrid_pure.dat # Setuptools 392s # hybrid_pure.py # Setuptools 392s # 392s # data/ 392s # hybrid_data_pure.dat # CMake or Setuptools 392s # hybrid_data_cmake.dat # CMake *NO TEST* 392s # 392s # hybrid_2/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure.py # CMake or Setuptools 392s # hybrid_2_cmake.py # CMake 392s # 392s # hybrid_2_pure/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure_1.py # CMake or Setuptools 392s # hybrid_2_pure_2.py # CMake or Setuptools 392s # 392s # pureModule.py # Setuptools 392s # 392s # pure/ 392s # __init__.py # Setuptools 392s # pure.py # Setuptools 392s # 392s # data/ 392s # pure.dat # Setuptools 392s 392s tmp_dir.join("setup.py").write( 392s textwrap.dedent( 392s """ 392s from skbuild import setup 392s #from setuptools import setup 392s setup( 392s name="test_hybrid_project", 392s version="1.2.3", 392s description=("an hybrid package mixing files installed by both " 392s "CMake and setuptools"), 392s author='The scikit-build team', 392s license="MIT", 392s cmake_source_dir='{cmake_source_dir}', 392s cmake_install_dir='{cmake_install_dir}', 392s # Arbitrary order of packages 392s packages=[ 392s {p_off} 'pure', 392s {h_off} 'hybrid.hybrid_2', 392s {h_off} 'hybrid', 392s {c_off} 'cmake', 392s {p_off} 'hybrid.hybrid_2_pure', 392s ], 392s py_modules=[ 392s {pm_off} '{package_base}pureModule', 392s {cm_off} '{package_base}cmakeModule', 392s ], 392s package_data={{ 392s {p_off} 'pure': ['data/pure.dat'], 392s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 392s }}, 392s # Arbitrary order of package_dir 392s package_dir = {{ 392s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 392s {p_off} 'pure': '{package_base}pure', 392s {h_off} 'hybrid': '{package_base}hybrid', 392s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 392s {c_off} 'cmake': '{package_base}cmake', 392s }} 392s ) 392s """.format( 392s cmake_source_dir=cmake_source_dir, 392s cmake_install_dir=package_base, 392s package_base=package_base_dir, 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s p_off="" if has_pure_package else "#", 392s pm_off="" if has_pure_module else "#", 392s ) 392s ) 392s ) 392s 392s src_dir = tmp_dir.ensure(package_base, dir=1) 392s 392s src_dir.join("CMakeLists.txt").write( 392s textwrap.dedent( 392s """ 392s cmake_minimum_required(VERSION 3.5.0) 392s project(hybrid NONE) 392s set(build_dir ${{CMAKE_BINARY_DIR}}) 392s 392s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 392s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 392s {c_off} install( 392s {c_off} FILES 392s {c_off} ${{build_dir}}/__init__.py 392s {c_off} ${{build_dir}}/cmake.py 392s {c_off} DESTINATION cmake 392s {c_off} ) 392s 392s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 392s {cm_off} install( 392s {cm_off} FILES ${{build_dir}}/cmakeModule.py 392s {cm_off} DESTINATION .) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 392s {h_off} DESTINATION hybrid/data) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 392s {h_off} DESTINATION hybrid/hybrid_2) 392s 392s install(CODE "message(STATUS \\\"Installation complete\\\")") 392s """.format( 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s ) 392s ) 392s ) 392s 392s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 392s path_types: Sequence[str] 392s try: 392s path_types = next( 392s iter( 392s zip( 392s *filter( 392s lambda i: i[1], 392s [ 392s ("c", has_cmake_package), 392s ("cm", has_cmake_module), 392s ("h", has_hybrid_package), 392s ("p", has_pure_package), 392s ("pm", has_pure_module), 392s ], 392s ) 392s ) 392s ) 392s ) 392s except StopIteration: 392s path_types = [] 392s 392s def select_paths(annotated_paths): 392s """Return a filtered list paths considering ``path_types``. 392s 392s `annotated_paths`` is list of tuple ``(type, path)`` where type 392s is either `c`, 'cm', `h`, `p` or 'pm'. 392s 392s """ 392s return filter(lambda i: i[0] in path_types, annotated_paths) 392s 392s # Commented paths are the one expected to be installed by CMake. For 392s # this reason, corresponding files should NOT be created in the source 392s # tree. 392s for _type, path in select_paths( 392s [ 392s # ('c', 'cmake/__init__.py'), 392s # ('c', 'cmake/cmake.py'), 392s # ('cm', 'cmakeModule.py'), 392s ("h", "hybrid/__init__.py"), 392s # ('h', 'hybrid/hybrid_cmake.dat'), 392s # ('h', 'hybrid/hybrid_cmake.py'), 392s ("h", "hybrid/hybrid_pure.dat"), 392s ("h", "hybrid/hybrid_pure.py"), 392s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 392s ("h", "hybrid/data/hybrid_data_pure.dat"), 392s ("h", "hybrid/hybrid_2/__init__.py"), 392s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 392s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 392s ("p", "hybrid/hybrid_2_pure/__init__.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 392s ("pm", "pureModule.py"), 392s ("p", "pure/__init__.py"), 392s ("p", "pure/pure.py"), 392s ("p", "pure/data/pure.dat"), 392s ] 392s ): 392s assert _type in {"p", "pm", "h"} 392s root = package_base if _type in {"p", "pm"} else cmake_source_dir 392s tmp_dir.ensure(os.path.join(root, path)) 392s 392s # Do not call the real setup function. Instead, replace it with 392s # a MagicMock allowing to check with which arguments it was invoked. 392s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 392s 392s # Convenience print function 392s def _pprint(desc, value=None): 392s print( 392s "-----------------\n" 392s f"{desc}:\n" 392s "\n" 392s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 392s ) 392s 392s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 392s 392s _pprint = ._pprint at 0x7537df9b4d60> 392s _type = 'p' 392s cmake_source_dir = '' 392s has_cmake_module = 0 392s has_cmake_package = 0 392s has_hybrid_package = 1 392s has_pure_module = 1 392s has_pure_package = 1 392s mock_setup = 392s mocker = 392s package_base = '' 392s package_base_dir = '' 392s path = 'pure/data/pure.dat' 392s path_types = ('h', 'p', 'pm') 392s root = '' 392s select_paths = .select_paths at 0x7537df9b5120> 392s src_dir = local('/tmp/pytest-of-ubuntu/pytest-109/test_setup_inputs0') 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-109/test_setup_inputs0') 392s with_package_base = 0 392s 392s tests/test_setup.py:849: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-109/test_setup_inputs0') 392s setup_args = ['build'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-109/test_setup_inputs0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s ________________________ test_setup_inputs[0-1-1-1-0-1] ________________________ 392s 392s has_cmake_package = 1, has_cmake_module = 0, has_hybrid_package = 1 392s has_pure_package = 1, has_pure_module = 1, with_package_base = 0 392s mocker = 392s 392s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 392s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 392s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_module", [0, 1]) 392s @pytest.mark.parametrize("with_package_base", [0, 1]) 392s def test_setup_inputs( 392s has_cmake_package, 392s has_cmake_module, 392s has_hybrid_package, 392s has_pure_package, 392s has_pure_module, 392s with_package_base, 392s mocker, 392s ): 392s """This test that a project can have a package with some modules 392s installed using setup.py and some other modules installed using CMake. 392s """ 392s 392s tmp_dir = _tmpdir("test_setup_inputs") 392s 392s package_base = "to/the/base" if with_package_base else "" 392s package_base_dir = package_base + "/" if package_base else "" 392s cmake_source_dir = package_base 392s 392s if cmake_source_dir and (has_cmake_package or has_cmake_module): 392s pytest.skip( 392s "unsupported configuration: " 392s "python package fully generated by CMake does *NOT* work. " 392s "At least __init__.py should be in the project source tree" 392s ) 392s 392s # ------------------------------------------------------------------------- 392s # Here is the "SOURCE" tree layout: 392s # 392s # ROOT/ 392s # 392s # setup.py 392s # 392s # [/] 392s # 392s # pureModule.py 392s # 392s # pure/ 392s # __init__.py 392s # pure.py 392s # 392s # data/ 392s # pure.dat 392s # 392s # [/] 392s # 392s # hybrid/ 392s # CMakeLists.txt 392s # __init__.py 392s # hybrid_pure.dat 392s # hybrid_pure.py 392s # 392s # data/ 392s # hybrid_data_pure.dat 392s # 392s # hybrid_2/ 392s # __init__.py 392s # hybrid_2_pure.py 392s # 392s # hybrid_2_pure/ 392s # __init__.py 392s # hybrid_2_pure_1.py 392s # hybrid_2_pure_2.py 392s # 392s # 392s # ------------------------------------------------------------------------- 392s # and here is the "BINARY" distribution layout: 392s # 392s # The comment "CMake" or "Setuptools" indicates which tool is responsible 392s # for placing the file in the tree used to create the binary distribution. 392s # 392s # ROOT/ 392s # 392s # cmakeModule.py # CMake 392s # 392s # cmake/ 392s # __init__.py # CMake 392s # cmake.py # CMake 392s # 392s # hybrid/ 392s # hybrid_cmake.dat # CMake 392s # hybrid_cmake.py # CMake 392s # hybrid_pure.dat # Setuptools 392s # hybrid_pure.py # Setuptools 392s # 392s # data/ 392s # hybrid_data_pure.dat # CMake or Setuptools 392s # hybrid_data_cmake.dat # CMake *NO TEST* 392s # 392s # hybrid_2/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure.py # CMake or Setuptools 392s # hybrid_2_cmake.py # CMake 392s # 392s # hybrid_2_pure/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure_1.py # CMake or Setuptools 392s # hybrid_2_pure_2.py # CMake or Setuptools 392s # 392s # pureModule.py # Setuptools 392s # 392s # pure/ 392s # __init__.py # Setuptools 392s # pure.py # Setuptools 392s # 392s # data/ 392s # pure.dat # Setuptools 392s 392s tmp_dir.join("setup.py").write( 392s textwrap.dedent( 392s """ 392s from skbuild import setup 392s #from setuptools import setup 392s setup( 392s name="test_hybrid_project", 392s version="1.2.3", 392s description=("an hybrid package mixing files installed by both " 392s "CMake and setuptools"), 392s author='The scikit-build team', 392s license="MIT", 392s cmake_source_dir='{cmake_source_dir}', 392s cmake_install_dir='{cmake_install_dir}', 392s # Arbitrary order of packages 392s packages=[ 392s {p_off} 'pure', 392s {h_off} 'hybrid.hybrid_2', 392s {h_off} 'hybrid', 392s {c_off} 'cmake', 392s {p_off} 'hybrid.hybrid_2_pure', 392s ], 392s py_modules=[ 392s {pm_off} '{package_base}pureModule', 392s {cm_off} '{package_base}cmakeModule', 392s ], 392s package_data={{ 392s {p_off} 'pure': ['data/pure.dat'], 392s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 392s }}, 392s # Arbitrary order of package_dir 392s package_dir = {{ 392s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 392s {p_off} 'pure': '{package_base}pure', 392s {h_off} 'hybrid': '{package_base}hybrid', 392s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 392s {c_off} 'cmake': '{package_base}cmake', 392s }} 392s ) 392s """.format( 392s cmake_source_dir=cmake_source_dir, 392s cmake_install_dir=package_base, 392s package_base=package_base_dir, 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s p_off="" if has_pure_package else "#", 392s pm_off="" if has_pure_module else "#", 392s ) 392s ) 392s ) 392s 392s src_dir = tmp_dir.ensure(package_base, dir=1) 392s 392s src_dir.join("CMakeLists.txt").write( 392s textwrap.dedent( 392s """ 392s cmake_minimum_required(VERSION 3.5.0) 392s project(hybrid NONE) 392s set(build_dir ${{CMAKE_BINARY_DIR}}) 392s 392s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 392s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 392s {c_off} install( 392s {c_off} FILES 392s {c_off} ${{build_dir}}/__init__.py 392s {c_off} ${{build_dir}}/cmake.py 392s {c_off} DESTINATION cmake 392s {c_off} ) 392s 392s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 392s {cm_off} install( 392s {cm_off} FILES ${{build_dir}}/cmakeModule.py 392s {cm_off} DESTINATION .) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 392s {h_off} DESTINATION hybrid/data) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 392s {h_off} DESTINATION hybrid/hybrid_2) 392s 392s install(CODE "message(STATUS \\\"Installation complete\\\")") 392s """.format( 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s ) 392s ) 392s ) 392s 392s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 392s path_types: Sequence[str] 392s try: 392s path_types = next( 392s iter( 392s zip( 392s *filter( 392s lambda i: i[1], 392s [ 392s ("c", has_cmake_package), 392s ("cm", has_cmake_module), 392s ("h", has_hybrid_package), 392s ("p", has_pure_package), 392s ("pm", has_pure_module), 392s ], 392s ) 392s ) 392s ) 392s ) 392s except StopIteration: 392s path_types = [] 392s 392s def select_paths(annotated_paths): 392s """Return a filtered list paths considering ``path_types``. 392s 392s `annotated_paths`` is list of tuple ``(type, path)`` where type 392s is either `c`, 'cm', `h`, `p` or 'pm'. 392s 392s """ 392s return filter(lambda i: i[0] in path_types, annotated_paths) 392s 392s # Commented paths are the one expected to be installed by CMake. For 392s # this reason, corresponding files should NOT be created in the source 392s # tree. 392s for _type, path in select_paths( 392s [ 392s # ('c', 'cmake/__init__.py'), 392s # ('c', 'cmake/cmake.py'), 392s # ('cm', 'cmakeModule.py'), 392s ("h", "hybrid/__init__.py"), 392s # ('h', 'hybrid/hybrid_cmake.dat'), 392s # ('h', 'hybrid/hybrid_cmake.py'), 392s ("h", "hybrid/hybrid_pure.dat"), 392s ("h", "hybrid/hybrid_pure.py"), 392s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 392s ("h", "hybrid/data/hybrid_data_pure.dat"), 392s ("h", "hybrid/hybrid_2/__init__.py"), 392s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 392s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 392s ("p", "hybrid/hybrid_2_pure/__init__.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 392s ("pm", "pureModule.py"), 392s ("p", "pure/__init__.py"), 392s ("p", "pure/pure.py"), 392s ("p", "pure/data/pure.dat"), 392s ] 392s ): 392s assert _type in {"p", "pm", "h"} 392s root = package_base if _type in {"p", "pm"} else cmake_source_dir 392s tmp_dir.ensure(os.path.join(root, path)) 392s 392s # Do not call the real setup function. Instead, replace it with 392s # a MagicMock allowing to check with which arguments it was invoked. 392s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 392s 392s # Convenience print function 392s def _pprint(desc, value=None): 392s print( 392s "-----------------\n" 392s f"{desc}:\n" 392s "\n" 392s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 392s ) 392s 392s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 392s 392s _pprint = ._pprint at 0x7537df9b5080> 392s _type = 'p' 392s cmake_source_dir = '' 392s has_cmake_module = 0 392s has_cmake_package = 1 392s has_hybrid_package = 1 392s has_pure_module = 1 392s has_pure_package = 1 392s mock_setup = 392s mocker = 392s package_base = '' 392s package_base_dir = '' 392s path = 'pure/data/pure.dat' 392s path_types = ('c', 'h', 'p', 'pm') 392s root = '' 392s select_paths = .select_paths at 0x7537df9b5800> 392s src_dir = local('/tmp/pytest-of-ubuntu/pytest-110/test_setup_inputs0') 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-110/test_setup_inputs0') 392s with_package_base = 0 392s 392s tests/test_setup.py:849: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-110/test_setup_inputs0') 392s setup_args = ['build'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-110/test_setup_inputs0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s ________________________ test_setup_inputs[0-1-1-1-1-0] ________________________ 392s 392s has_cmake_package = 0, has_cmake_module = 1, has_hybrid_package = 1 392s has_pure_package = 1, has_pure_module = 1, with_package_base = 0 392s mocker = 392s 392s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 392s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 392s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_module", [0, 1]) 392s @pytest.mark.parametrize("with_package_base", [0, 1]) 392s def test_setup_inputs( 392s has_cmake_package, 392s has_cmake_module, 392s has_hybrid_package, 392s has_pure_package, 392s has_pure_module, 392s with_package_base, 392s mocker, 392s ): 392s """This test that a project can have a package with some modules 392s installed using setup.py and some other modules installed using CMake. 392s """ 392s 392s tmp_dir = _tmpdir("test_setup_inputs") 392s 392s package_base = "to/the/base" if with_package_base else "" 392s package_base_dir = package_base + "/" if package_base else "" 392s cmake_source_dir = package_base 392s 392s if cmake_source_dir and (has_cmake_package or has_cmake_module): 392s pytest.skip( 392s "unsupported configuration: " 392s "python package fully generated by CMake does *NOT* work. " 392s "At least __init__.py should be in the project source tree" 392s ) 392s 392s # ------------------------------------------------------------------------- 392s # Here is the "SOURCE" tree layout: 392s # 392s # ROOT/ 392s # 392s # setup.py 392s # 392s # [/] 392s # 392s # pureModule.py 392s # 392s # pure/ 392s # __init__.py 392s # pure.py 392s # 392s # data/ 392s # pure.dat 392s # 392s # [/] 392s # 392s # hybrid/ 392s # CMakeLists.txt 392s # __init__.py 392s # hybrid_pure.dat 392s # hybrid_pure.py 392s # 392s # data/ 392s # hybrid_data_pure.dat 392s # 392s # hybrid_2/ 392s # __init__.py 392s # hybrid_2_pure.py 392s # 392s # hybrid_2_pure/ 392s # __init__.py 392s # hybrid_2_pure_1.py 392s # hybrid_2_pure_2.py 392s # 392s # 392s # ------------------------------------------------------------------------- 392s # and here is the "BINARY" distribution layout: 392s # 392s # The comment "CMake" or "Setuptools" indicates which tool is responsible 392s # for placing the file in the tree used to create the binary distribution. 392s # 392s # ROOT/ 392s # 392s # cmakeModule.py # CMake 392s # 392s # cmake/ 392s # __init__.py # CMake 392s # cmake.py # CMake 392s # 392s # hybrid/ 392s # hybrid_cmake.dat # CMake 392s # hybrid_cmake.py # CMake 392s # hybrid_pure.dat # Setuptools 392s # hybrid_pure.py # Setuptools 392s # 392s # data/ 392s # hybrid_data_pure.dat # CMake or Setuptools 392s # hybrid_data_cmake.dat # CMake *NO TEST* 392s # 392s # hybrid_2/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure.py # CMake or Setuptools 392s # hybrid_2_cmake.py # CMake 392s # 392s # hybrid_2_pure/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure_1.py # CMake or Setuptools 392s # hybrid_2_pure_2.py # CMake or Setuptools 392s # 392s # pureModule.py # Setuptools 392s # 392s # pure/ 392s # __init__.py # Setuptools 392s # pure.py # Setuptools 392s # 392s # data/ 392s # pure.dat # Setuptools 392s 392s tmp_dir.join("setup.py").write( 392s textwrap.dedent( 392s """ 392s from skbuild import setup 392s #from setuptools import setup 392s setup( 392s name="test_hybrid_project", 392s version="1.2.3", 392s description=("an hybrid package mixing files installed by both " 392s "CMake and setuptools"), 392s author='The scikit-build team', 392s license="MIT", 392s cmake_source_dir='{cmake_source_dir}', 392s cmake_install_dir='{cmake_install_dir}', 392s # Arbitrary order of packages 392s packages=[ 392s {p_off} 'pure', 392s {h_off} 'hybrid.hybrid_2', 392s {h_off} 'hybrid', 392s {c_off} 'cmake', 392s {p_off} 'hybrid.hybrid_2_pure', 392s ], 392s py_modules=[ 392s {pm_off} '{package_base}pureModule', 392s {cm_off} '{package_base}cmakeModule', 392s ], 392s package_data={{ 392s {p_off} 'pure': ['data/pure.dat'], 392s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 392s }}, 392s # Arbitrary order of package_dir 392s package_dir = {{ 392s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 392s {p_off} 'pure': '{package_base}pure', 392s {h_off} 'hybrid': '{package_base}hybrid', 392s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 392s {c_off} 'cmake': '{package_base}cmake', 392s }} 392s ) 392s """.format( 392s cmake_source_dir=cmake_source_dir, 392s cmake_install_dir=package_base, 392s package_base=package_base_dir, 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s p_off="" if has_pure_package else "#", 392s pm_off="" if has_pure_module else "#", 392s ) 392s ) 392s ) 392s 392s src_dir = tmp_dir.ensure(package_base, dir=1) 392s 392s src_dir.join("CMakeLists.txt").write( 392s textwrap.dedent( 392s """ 392s cmake_minimum_required(VERSION 3.5.0) 392s project(hybrid NONE) 392s set(build_dir ${{CMAKE_BINARY_DIR}}) 392s 392s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 392s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 392s {c_off} install( 392s {c_off} FILES 392s {c_off} ${{build_dir}}/__init__.py 392s {c_off} ${{build_dir}}/cmake.py 392s {c_off} DESTINATION cmake 392s {c_off} ) 392s 392s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 392s {cm_off} install( 392s {cm_off} FILES ${{build_dir}}/cmakeModule.py 392s {cm_off} DESTINATION .) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 392s {h_off} DESTINATION hybrid/data) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 392s {h_off} DESTINATION hybrid/hybrid_2) 392s 392s install(CODE "message(STATUS \\\"Installation complete\\\")") 392s """.format( 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s ) 392s ) 392s ) 392s 392s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 392s path_types: Sequence[str] 392s try: 392s path_types = next( 392s iter( 392s zip( 392s *filter( 392s lambda i: i[1], 392s [ 392s ("c", has_cmake_package), 392s ("cm", has_cmake_module), 392s ("h", has_hybrid_package), 392s ("p", has_pure_package), 392s ("pm", has_pure_module), 392s ], 392s ) 392s ) 392s ) 392s ) 392s except StopIteration: 392s path_types = [] 392s 392s def select_paths(annotated_paths): 392s """Return a filtered list paths considering ``path_types``. 392s 392s `annotated_paths`` is list of tuple ``(type, path)`` where type 392s is either `c`, 'cm', `h`, `p` or 'pm'. 392s 392s """ 392s return filter(lambda i: i[0] in path_types, annotated_paths) 392s 392s # Commented paths are the one expected to be installed by CMake. For 392s # this reason, corresponding files should NOT be created in the source 392s # tree. 392s for _type, path in select_paths( 392s [ 392s # ('c', 'cmake/__init__.py'), 392s # ('c', 'cmake/cmake.py'), 392s # ('cm', 'cmakeModule.py'), 392s ("h", "hybrid/__init__.py"), 392s # ('h', 'hybrid/hybrid_cmake.dat'), 392s # ('h', 'hybrid/hybrid_cmake.py'), 392s ("h", "hybrid/hybrid_pure.dat"), 392s ("h", "hybrid/hybrid_pure.py"), 392s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 392s ("h", "hybrid/data/hybrid_data_pure.dat"), 392s ("h", "hybrid/hybrid_2/__init__.py"), 392s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 392s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 392s ("p", "hybrid/hybrid_2_pure/__init__.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 392s ("pm", "pureModule.py"), 392s ("p", "pure/__init__.py"), 392s ("p", "pure/pure.py"), 392s ("p", "pure/data/pure.dat"), 392s ] 392s ): 392s assert _type in {"p", "pm", "h"} 392s root = package_base if _type in {"p", "pm"} else cmake_source_dir 392s tmp_dir.ensure(os.path.join(root, path)) 392s 392s # Do not call the real setup function. Instead, replace it with 392s # a MagicMock allowing to check with which arguments it was invoked. 392s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 392s 392s # Convenience print function 392s def _pprint(desc, value=None): 392s print( 392s "-----------------\n" 392s f"{desc}:\n" 392s "\n" 392s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 392s ) 392s 392s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 392s 392s _pprint = ._pprint at 0x7537df9f7ba0> 392s _type = 'p' 392s cmake_source_dir = '' 392s has_cmake_module = 1 392s has_cmake_package = 0 392s has_hybrid_package = 1 392s has_pure_module = 1 392s has_pure_package = 1 392s mock_setup = 392s mocker = 392s package_base = '' 392s package_base_dir = '' 392s path = 'pure/data/pure.dat' 392s path_types = ('cm', 'h', 'p', 'pm') 392s root = '' 392s select_paths = .select_paths at 0x7537df9f7560> 392s src_dir = local('/tmp/pytest-of-ubuntu/pytest-111/test_setup_inputs0') 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-111/test_setup_inputs0') 392s with_package_base = 0 392s 392s tests/test_setup.py:849: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-111/test_setup_inputs0') 392s setup_args = ['build'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-111/test_setup_inputs0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s ________________________ test_setup_inputs[0-1-1-1-1-1] ________________________ 392s 392s has_cmake_package = 1, has_cmake_module = 1, has_hybrid_package = 1 392s has_pure_package = 1, has_pure_module = 1, with_package_base = 0 392s mocker = 392s 392s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 392s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 392s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_module", [0, 1]) 392s @pytest.mark.parametrize("with_package_base", [0, 1]) 392s def test_setup_inputs( 392s has_cmake_package, 392s has_cmake_module, 392s has_hybrid_package, 392s has_pure_package, 392s has_pure_module, 392s with_package_base, 392s mocker, 392s ): 392s """This test that a project can have a package with some modules 392s installed using setup.py and some other modules installed using CMake. 392s """ 392s 392s tmp_dir = _tmpdir("test_setup_inputs") 392s 392s package_base = "to/the/base" if with_package_base else "" 392s package_base_dir = package_base + "/" if package_base else "" 392s cmake_source_dir = package_base 392s 392s if cmake_source_dir and (has_cmake_package or has_cmake_module): 392s pytest.skip( 392s "unsupported configuration: " 392s "python package fully generated by CMake does *NOT* work. " 392s "At least __init__.py should be in the project source tree" 392s ) 392s 392s # ------------------------------------------------------------------------- 392s # Here is the "SOURCE" tree layout: 392s # 392s # ROOT/ 392s # 392s # setup.py 392s # 392s # [/] 392s # 392s # pureModule.py 392s # 392s # pure/ 392s # __init__.py 392s # pure.py 392s # 392s # data/ 392s # pure.dat 392s # 392s # [/] 392s # 392s # hybrid/ 392s # CMakeLists.txt 392s # __init__.py 392s # hybrid_pure.dat 392s # hybrid_pure.py 392s # 392s # data/ 392s # hybrid_data_pure.dat 392s # 392s # hybrid_2/ 392s # __init__.py 392s # hybrid_2_pure.py 392s # 392s # hybrid_2_pure/ 392s # __init__.py 392s # hybrid_2_pure_1.py 392s # hybrid_2_pure_2.py 392s # 392s # 392s # ------------------------------------------------------------------------- 392s # and here is the "BINARY" distribution layout: 392s # 392s # The comment "CMake" or "Setuptools" indicates which tool is responsible 392s # for placing the file in the tree used to create the binary distribution. 392s # 392s # ROOT/ 392s # 392s # cmakeModule.py # CMake 392s # 392s # cmake/ 392s # __init__.py # CMake 392s # cmake.py # CMake 392s # 392s # hybrid/ 392s # hybrid_cmake.dat # CMake 392s # hybrid_cmake.py # CMake 392s # hybrid_pure.dat # Setuptools 392s # hybrid_pure.py # Setuptools 392s # 392s # data/ 392s # hybrid_data_pure.dat # CMake or Setuptools 392s # hybrid_data_cmake.dat # CMake *NO TEST* 392s # 392s # hybrid_2/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure.py # CMake or Setuptools 392s # hybrid_2_cmake.py # CMake 392s # 392s # hybrid_2_pure/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure_1.py # CMake or Setuptools 392s # hybrid_2_pure_2.py # CMake or Setuptools 392s # 392s # pureModule.py # Setuptools 392s # 392s # pure/ 392s # __init__.py # Setuptools 392s # pure.py # Setuptools 392s # 392s # data/ 392s # pure.dat # Setuptools 392s 392s tmp_dir.join("setup.py").write( 392s textwrap.dedent( 392s """ 392s from skbuild import setup 392s #from setuptools import setup 392s setup( 392s name="test_hybrid_project", 392s version="1.2.3", 392s description=("an hybrid package mixing files installed by both " 392s "CMake and setuptools"), 392s author='The scikit-build team', 392s license="MIT", 392s cmake_source_dir='{cmake_source_dir}', 392s cmake_install_dir='{cmake_install_dir}', 392s # Arbitrary order of packages 392s packages=[ 392s {p_off} 'pure', 392s {h_off} 'hybrid.hybrid_2', 392s {h_off} 'hybrid', 392s {c_off} 'cmake', 392s {p_off} 'hybrid.hybrid_2_pure', 392s ], 392s py_modules=[ 392s {pm_off} '{package_base}pureModule', 392s {cm_off} '{package_base}cmakeModule', 392s ], 392s package_data={{ 392s {p_off} 'pure': ['data/pure.dat'], 392s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 392s }}, 392s # Arbitrary order of package_dir 392s package_dir = {{ 392s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 392s {p_off} 'pure': '{package_base}pure', 392s {h_off} 'hybrid': '{package_base}hybrid', 392s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 392s {c_off} 'cmake': '{package_base}cmake', 392s }} 392s ) 392s """.format( 392s cmake_source_dir=cmake_source_dir, 392s cmake_install_dir=package_base, 392s package_base=package_base_dir, 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s p_off="" if has_pure_package else "#", 392s pm_off="" if has_pure_module else "#", 392s ) 392s ) 392s ) 392s 392s src_dir = tmp_dir.ensure(package_base, dir=1) 392s 392s src_dir.join("CMakeLists.txt").write( 392s textwrap.dedent( 392s """ 392s cmake_minimum_required(VERSION 3.5.0) 392s project(hybrid NONE) 392s set(build_dir ${{CMAKE_BINARY_DIR}}) 392s 392s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 392s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 392s {c_off} install( 392s {c_off} FILES 392s {c_off} ${{build_dir}}/__init__.py 392s {c_off} ${{build_dir}}/cmake.py 392s {c_off} DESTINATION cmake 392s {c_off} ) 392s 392s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 392s {cm_off} install( 392s {cm_off} FILES ${{build_dir}}/cmakeModule.py 392s {cm_off} DESTINATION .) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 392s {h_off} DESTINATION hybrid/data) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 392s {h_off} DESTINATION hybrid/hybrid_2) 392s 392s install(CODE "message(STATUS \\\"Installation complete\\\")") 392s """.format( 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s ) 392s ) 392s ) 392s 392s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 392s path_types: Sequence[str] 392s try: 392s path_types = next( 392s iter( 392s zip( 392s *filter( 392s lambda i: i[1], 392s [ 392s ("c", has_cmake_package), 392s ("cm", has_cmake_module), 392s ("h", has_hybrid_package), 392s ("p", has_pure_package), 392s ("pm", has_pure_module), 392s ], 392s ) 392s ) 392s ) 392s ) 392s except StopIteration: 392s path_types = [] 392s 392s def select_paths(annotated_paths): 392s """Return a filtered list paths considering ``path_types``. 392s 392s `annotated_paths`` is list of tuple ``(type, path)`` where type 392s is either `c`, 'cm', `h`, `p` or 'pm'. 392s 392s """ 392s return filter(lambda i: i[0] in path_types, annotated_paths) 392s 392s # Commented paths are the one expected to be installed by CMake. For 392s # this reason, corresponding files should NOT be created in the source 392s # tree. 392s for _type, path in select_paths( 392s [ 392s # ('c', 'cmake/__init__.py'), 392s # ('c', 'cmake/cmake.py'), 392s # ('cm', 'cmakeModule.py'), 392s ("h", "hybrid/__init__.py"), 392s # ('h', 'hybrid/hybrid_cmake.dat'), 392s # ('h', 'hybrid/hybrid_cmake.py'), 392s ("h", "hybrid/hybrid_pure.dat"), 392s ("h", "hybrid/hybrid_pure.py"), 392s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 392s ("h", "hybrid/data/hybrid_data_pure.dat"), 392s ("h", "hybrid/hybrid_2/__init__.py"), 392s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 392s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 392s ("p", "hybrid/hybrid_2_pure/__init__.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 392s ("pm", "pureModule.py"), 392s ("p", "pure/__init__.py"), 392s ("p", "pure/pure.py"), 392s ("p", "pure/data/pure.dat"), 392s ] 392s ): 392s assert _type in {"p", "pm", "h"} 392s root = package_base if _type in {"p", "pm"} else cmake_source_dir 392s tmp_dir.ensure(os.path.join(root, path)) 392s 392s # Do not call the real setup function. Instead, replace it with 392s # a MagicMock allowing to check with which arguments it was invoked. 392s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 392s 392s # Convenience print function 392s def _pprint(desc, value=None): 392s print( 392s "-----------------\n" 392s f"{desc}:\n" 392s "\n" 392s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 392s ) 392s 392s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 392s 392s _pprint = ._pprint at 0x7537df9b5940> 392s _type = 'p' 392s cmake_source_dir = '' 392s has_cmake_module = 1 392s has_cmake_package = 1 392s has_hybrid_package = 1 392s has_pure_module = 1 392s has_pure_package = 1 392s mock_setup = 392s mocker = 392s package_base = '' 392s package_base_dir = '' 392s path = 'pure/data/pure.dat' 392s path_types = ('c', 'cm', 'h', 'p', 'pm') 392s root = '' 392s select_paths = .select_paths at 0x7537df9b53a0> 392s src_dir = local('/tmp/pytest-of-ubuntu/pytest-112/test_setup_inputs0') 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-112/test_setup_inputs0') 392s with_package_base = 0 392s 392s tests/test_setup.py:849: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-112/test_setup_inputs0') 392s setup_args = ['build'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-112/test_setup_inputs0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s ________________________ test_setup_inputs[1-0-0-0-0-0] ________________________ 392s 392s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 0 392s has_pure_package = 0, has_pure_module = 0, with_package_base = 1 392s mocker = 392s 392s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 392s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 392s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_module", [0, 1]) 392s @pytest.mark.parametrize("with_package_base", [0, 1]) 392s def test_setup_inputs( 392s has_cmake_package, 392s has_cmake_module, 392s has_hybrid_package, 392s has_pure_package, 392s has_pure_module, 392s with_package_base, 392s mocker, 392s ): 392s """This test that a project can have a package with some modules 392s installed using setup.py and some other modules installed using CMake. 392s """ 392s 392s tmp_dir = _tmpdir("test_setup_inputs") 392s 392s package_base = "to/the/base" if with_package_base else "" 392s package_base_dir = package_base + "/" if package_base else "" 392s cmake_source_dir = package_base 392s 392s if cmake_source_dir and (has_cmake_package or has_cmake_module): 392s pytest.skip( 392s "unsupported configuration: " 392s "python package fully generated by CMake does *NOT* work. " 392s "At least __init__.py should be in the project source tree" 392s ) 392s 392s # ------------------------------------------------------------------------- 392s # Here is the "SOURCE" tree layout: 392s # 392s # ROOT/ 392s # 392s # setup.py 392s # 392s # [/] 392s # 392s # pureModule.py 392s # 392s # pure/ 392s # __init__.py 392s # pure.py 392s # 392s # data/ 392s # pure.dat 392s # 392s # [/] 392s # 392s # hybrid/ 392s # CMakeLists.txt 392s # __init__.py 392s # hybrid_pure.dat 392s # hybrid_pure.py 392s # 392s # data/ 392s # hybrid_data_pure.dat 392s # 392s # hybrid_2/ 392s # __init__.py 392s # hybrid_2_pure.py 392s # 392s # hybrid_2_pure/ 392s # __init__.py 392s # hybrid_2_pure_1.py 392s # hybrid_2_pure_2.py 392s # 392s # 392s # ------------------------------------------------------------------------- 392s # and here is the "BINARY" distribution layout: 392s # 392s # The comment "CMake" or "Setuptools" indicates which tool is responsible 392s # for placing the file in the tree used to create the binary distribution. 392s # 392s # ROOT/ 392s # 392s # cmakeModule.py # CMake 392s # 392s # cmake/ 392s # __init__.py # CMake 392s # cmake.py # CMake 392s # 392s # hybrid/ 392s # hybrid_cmake.dat # CMake 392s # hybrid_cmake.py # CMake 392s # hybrid_pure.dat # Setuptools 392s # hybrid_pure.py # Setuptools 392s # 392s # data/ 392s # hybrid_data_pure.dat # CMake or Setuptools 392s # hybrid_data_cmake.dat # CMake *NO TEST* 392s # 392s # hybrid_2/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure.py # CMake or Setuptools 392s # hybrid_2_cmake.py # CMake 392s # 392s # hybrid_2_pure/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure_1.py # CMake or Setuptools 392s # hybrid_2_pure_2.py # CMake or Setuptools 392s # 392s # pureModule.py # Setuptools 392s # 392s # pure/ 392s # __init__.py # Setuptools 392s # pure.py # Setuptools 392s # 392s # data/ 392s # pure.dat # Setuptools 392s 392s tmp_dir.join("setup.py").write( 392s textwrap.dedent( 392s """ 392s from skbuild import setup 392s #from setuptools import setup 392s setup( 392s name="test_hybrid_project", 392s version="1.2.3", 392s description=("an hybrid package mixing files installed by both " 392s "CMake and setuptools"), 392s author='The scikit-build team', 392s license="MIT", 392s cmake_source_dir='{cmake_source_dir}', 392s cmake_install_dir='{cmake_install_dir}', 392s # Arbitrary order of packages 392s packages=[ 392s {p_off} 'pure', 392s {h_off} 'hybrid.hybrid_2', 392s {h_off} 'hybrid', 392s {c_off} 'cmake', 392s {p_off} 'hybrid.hybrid_2_pure', 392s ], 392s py_modules=[ 392s {pm_off} '{package_base}pureModule', 392s {cm_off} '{package_base}cmakeModule', 392s ], 392s package_data={{ 392s {p_off} 'pure': ['data/pure.dat'], 392s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 392s }}, 392s # Arbitrary order of package_dir 392s package_dir = {{ 392s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 392s {p_off} 'pure': '{package_base}pure', 392s {h_off} 'hybrid': '{package_base}hybrid', 392s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 392s {c_off} 'cmake': '{package_base}cmake', 392s }} 392s ) 392s """.format( 392s cmake_source_dir=cmake_source_dir, 392s cmake_install_dir=package_base, 392s package_base=package_base_dir, 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s p_off="" if has_pure_package else "#", 392s pm_off="" if has_pure_module else "#", 392s ) 392s ) 392s ) 392s 392s src_dir = tmp_dir.ensure(package_base, dir=1) 392s 392s src_dir.join("CMakeLists.txt").write( 392s textwrap.dedent( 392s """ 392s cmake_minimum_required(VERSION 3.5.0) 392s project(hybrid NONE) 392s set(build_dir ${{CMAKE_BINARY_DIR}}) 392s 392s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 392s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 392s {c_off} install( 392s {c_off} FILES 392s {c_off} ${{build_dir}}/__init__.py 392s {c_off} ${{build_dir}}/cmake.py 392s {c_off} DESTINATION cmake 392s {c_off} ) 392s 392s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 392s {cm_off} install( 392s {cm_off} FILES ${{build_dir}}/cmakeModule.py 392s {cm_off} DESTINATION .) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 392s {h_off} DESTINATION hybrid/data) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 392s {h_off} DESTINATION hybrid/hybrid_2) 392s 392s install(CODE "message(STATUS \\\"Installation complete\\\")") 392s """.format( 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s ) 392s ) 392s ) 392s 392s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 392s path_types: Sequence[str] 392s try: 392s path_types = next( 392s iter( 392s zip( 392s *filter( 392s lambda i: i[1], 392s [ 392s ("c", has_cmake_package), 392s ("cm", has_cmake_module), 392s ("h", has_hybrid_package), 392s ("p", has_pure_package), 392s ("pm", has_pure_module), 392s ], 392s ) 392s ) 392s ) 392s ) 392s except StopIteration: 392s path_types = [] 392s 392s def select_paths(annotated_paths): 392s """Return a filtered list paths considering ``path_types``. 392s 392s `annotated_paths`` is list of tuple ``(type, path)`` where type 392s is either `c`, 'cm', `h`, `p` or 'pm'. 392s 392s """ 392s return filter(lambda i: i[0] in path_types, annotated_paths) 392s 392s # Commented paths are the one expected to be installed by CMake. For 392s # this reason, corresponding files should NOT be created in the source 392s # tree. 392s for _type, path in select_paths( 392s [ 392s # ('c', 'cmake/__init__.py'), 392s # ('c', 'cmake/cmake.py'), 392s # ('cm', 'cmakeModule.py'), 392s ("h", "hybrid/__init__.py"), 392s # ('h', 'hybrid/hybrid_cmake.dat'), 392s # ('h', 'hybrid/hybrid_cmake.py'), 392s ("h", "hybrid/hybrid_pure.dat"), 392s ("h", "hybrid/hybrid_pure.py"), 392s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 392s ("h", "hybrid/data/hybrid_data_pure.dat"), 392s ("h", "hybrid/hybrid_2/__init__.py"), 392s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 392s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 392s ("p", "hybrid/hybrid_2_pure/__init__.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 392s ("pm", "pureModule.py"), 392s ("p", "pure/__init__.py"), 392s ("p", "pure/pure.py"), 392s ("p", "pure/data/pure.dat"), 392s ] 392s ): 392s assert _type in {"p", "pm", "h"} 392s root = package_base if _type in {"p", "pm"} else cmake_source_dir 392s tmp_dir.ensure(os.path.join(root, path)) 392s 392s # Do not call the real setup function. Instead, replace it with 392s # a MagicMock allowing to check with which arguments it was invoked. 392s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 392s 392s # Convenience print function 392s def _pprint(desc, value=None): 392s print( 392s "-----------------\n" 392s f"{desc}:\n" 392s "\n" 392s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 392s ) 392s 392s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 392s 392s _pprint = ._pprint at 0x7537df9b5f80> 392s cmake_source_dir = 'to/the/base' 392s has_cmake_module = 0 392s has_cmake_package = 0 392s has_hybrid_package = 0 392s has_pure_module = 0 392s has_pure_package = 0 392s mock_setup = 392s mocker = 392s package_base = 'to/the/base' 392s package_base_dir = 'to/the/base/' 392s path_types = [] 392s select_paths = .select_paths at 0x7537df9b5d00> 392s src_dir = local('/tmp/pytest-of-ubuntu/pytest-113/test_setup_inputs0/to/the/base') 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-113/test_setup_inputs0') 392s with_package_base = 1 392s 392s tests/test_setup.py:849: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-113/test_setup_inputs0') 392s setup_args = ['build'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-113/test_setup_inputs0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s ________________________ test_setup_inputs[1-0-0-1-0-0] ________________________ 392s 392s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 1 392s has_pure_package = 0, has_pure_module = 0, with_package_base = 1 392s mocker = 392s 392s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 392s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 392s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_module", [0, 1]) 392s @pytest.mark.parametrize("with_package_base", [0, 1]) 392s def test_setup_inputs( 392s has_cmake_package, 392s has_cmake_module, 392s has_hybrid_package, 392s has_pure_package, 392s has_pure_module, 392s with_package_base, 392s mocker, 392s ): 392s """This test that a project can have a package with some modules 392s installed using setup.py and some other modules installed using CMake. 392s """ 392s 392s tmp_dir = _tmpdir("test_setup_inputs") 392s 392s package_base = "to/the/base" if with_package_base else "" 392s package_base_dir = package_base + "/" if package_base else "" 392s cmake_source_dir = package_base 392s 392s if cmake_source_dir and (has_cmake_package or has_cmake_module): 392s pytest.skip( 392s "unsupported configuration: " 392s "python package fully generated by CMake does *NOT* work. " 392s "At least __init__.py should be in the project source tree" 392s ) 392s 392s # ------------------------------------------------------------------------- 392s # Here is the "SOURCE" tree layout: 392s # 392s # ROOT/ 392s # 392s # setup.py 392s # 392s # [/] 392s # 392s # pureModule.py 392s # 392s # pure/ 392s # __init__.py 392s # pure.py 392s # 392s # data/ 392s # pure.dat 392s # 392s # [/] 392s # 392s # hybrid/ 392s # CMakeLists.txt 392s # __init__.py 392s # hybrid_pure.dat 392s # hybrid_pure.py 392s # 392s # data/ 392s # hybrid_data_pure.dat 392s # 392s # hybrid_2/ 392s # __init__.py 392s # hybrid_2_pure.py 392s # 392s # hybrid_2_pure/ 392s # __init__.py 392s # hybrid_2_pure_1.py 392s # hybrid_2_pure_2.py 392s # 392s # 392s # ------------------------------------------------------------------------- 392s # and here is the "BINARY" distribution layout: 392s # 392s # The comment "CMake" or "Setuptools" indicates which tool is responsible 392s # for placing the file in the tree used to create the binary distribution. 392s # 392s # ROOT/ 392s # 392s # cmakeModule.py # CMake 392s # 392s # cmake/ 392s # __init__.py # CMake 392s # cmake.py # CMake 392s # 392s # hybrid/ 392s # hybrid_cmake.dat # CMake 392s # hybrid_cmake.py # CMake 392s # hybrid_pure.dat # Setuptools 392s # hybrid_pure.py # Setuptools 392s # 392s # data/ 392s # hybrid_data_pure.dat # CMake or Setuptools 392s # hybrid_data_cmake.dat # CMake *NO TEST* 392s # 392s # hybrid_2/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure.py # CMake or Setuptools 392s # hybrid_2_cmake.py # CMake 392s # 392s # hybrid_2_pure/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure_1.py # CMake or Setuptools 392s # hybrid_2_pure_2.py # CMake or Setuptools 392s # 392s # pureModule.py # Setuptools 392s # 392s # pure/ 392s # __init__.py # Setuptools 392s # pure.py # Setuptools 392s # 392s # data/ 392s # pure.dat # Setuptools 392s 392s tmp_dir.join("setup.py").write( 392s textwrap.dedent( 392s """ 392s from skbuild import setup 392s #from setuptools import setup 392s setup( 392s name="test_hybrid_project", 392s version="1.2.3", 392s description=("an hybrid package mixing files installed by both " 392s "CMake and setuptools"), 392s author='The scikit-build team', 392s license="MIT", 392s cmake_source_dir='{cmake_source_dir}', 392s cmake_install_dir='{cmake_install_dir}', 392s # Arbitrary order of packages 392s packages=[ 392s {p_off} 'pure', 392s {h_off} 'hybrid.hybrid_2', 392s {h_off} 'hybrid', 392s {c_off} 'cmake', 392s {p_off} 'hybrid.hybrid_2_pure', 392s ], 392s py_modules=[ 392s {pm_off} '{package_base}pureModule', 392s {cm_off} '{package_base}cmakeModule', 392s ], 392s package_data={{ 392s {p_off} 'pure': ['data/pure.dat'], 392s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 392s }}, 392s # Arbitrary order of package_dir 392s package_dir = {{ 392s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 392s {p_off} 'pure': '{package_base}pure', 392s {h_off} 'hybrid': '{package_base}hybrid', 392s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 392s {c_off} 'cmake': '{package_base}cmake', 392s }} 392s ) 392s """.format( 392s cmake_source_dir=cmake_source_dir, 392s cmake_install_dir=package_base, 392s package_base=package_base_dir, 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s p_off="" if has_pure_package else "#", 392s pm_off="" if has_pure_module else "#", 392s ) 392s ) 392s ) 392s 392s src_dir = tmp_dir.ensure(package_base, dir=1) 392s 392s src_dir.join("CMakeLists.txt").write( 392s textwrap.dedent( 392s """ 392s cmake_minimum_required(VERSION 3.5.0) 392s project(hybrid NONE) 392s set(build_dir ${{CMAKE_BINARY_DIR}}) 392s 392s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 392s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 392s {c_off} install( 392s {c_off} FILES 392s {c_off} ${{build_dir}}/__init__.py 392s {c_off} ${{build_dir}}/cmake.py 392s {c_off} DESTINATION cmake 392s {c_off} ) 392s 392s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 392s {cm_off} install( 392s {cm_off} FILES ${{build_dir}}/cmakeModule.py 392s {cm_off} DESTINATION .) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 392s {h_off} DESTINATION hybrid/data) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 392s {h_off} DESTINATION hybrid/hybrid_2) 392s 392s install(CODE "message(STATUS \\\"Installation complete\\\")") 392s """.format( 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s ) 392s ) 392s ) 392s 392s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 392s path_types: Sequence[str] 392s try: 392s path_types = next( 392s iter( 392s zip( 392s *filter( 392s lambda i: i[1], 392s [ 392s ("c", has_cmake_package), 392s ("cm", has_cmake_module), 392s ("h", has_hybrid_package), 392s ("p", has_pure_package), 392s ("pm", has_pure_module), 392s ], 392s ) 392s ) 392s ) 392s ) 392s except StopIteration: 392s path_types = [] 392s 392s def select_paths(annotated_paths): 392s """Return a filtered list paths considering ``path_types``. 392s 392s `annotated_paths`` is list of tuple ``(type, path)`` where type 392s is either `c`, 'cm', `h`, `p` or 'pm'. 392s 392s """ 392s return filter(lambda i: i[0] in path_types, annotated_paths) 392s 392s # Commented paths are the one expected to be installed by CMake. For 392s # this reason, corresponding files should NOT be created in the source 392s # tree. 392s for _type, path in select_paths( 392s [ 392s # ('c', 'cmake/__init__.py'), 392s # ('c', 'cmake/cmake.py'), 392s # ('cm', 'cmakeModule.py'), 392s ("h", "hybrid/__init__.py"), 392s # ('h', 'hybrid/hybrid_cmake.dat'), 392s # ('h', 'hybrid/hybrid_cmake.py'), 392s ("h", "hybrid/hybrid_pure.dat"), 392s ("h", "hybrid/hybrid_pure.py"), 392s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 392s ("h", "hybrid/data/hybrid_data_pure.dat"), 392s ("h", "hybrid/hybrid_2/__init__.py"), 392s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 392s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 392s ("p", "hybrid/hybrid_2_pure/__init__.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 392s ("pm", "pureModule.py"), 392s ("p", "pure/__init__.py"), 392s ("p", "pure/pure.py"), 392s ("p", "pure/data/pure.dat"), 392s ] 392s ): 392s assert _type in {"p", "pm", "h"} 392s root = package_base if _type in {"p", "pm"} else cmake_source_dir 392s tmp_dir.ensure(os.path.join(root, path)) 392s 392s # Do not call the real setup function. Instead, replace it with 392s # a MagicMock allowing to check with which arguments it was invoked. 392s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 392s 392s # Convenience print function 392s def _pprint(desc, value=None): 392s print( 392s "-----------------\n" 392s f"{desc}:\n" 392s "\n" 392s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 392s ) 392s 392s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 392s 392s _pprint = ._pprint at 0x7537df9b6ca0> 392s _type = 'h' 392s cmake_source_dir = 'to/the/base' 392s has_cmake_module = 0 392s has_cmake_package = 0 392s has_hybrid_package = 1 392s has_pure_module = 0 392s has_pure_package = 0 392s mock_setup = 392s mocker = 392s package_base = 'to/the/base' 392s package_base_dir = 'to/the/base/' 392s path = 'hybrid/hybrid_2/hybrid_2_pure.py' 392s path_types = ('h',) 392s root = 'to/the/base' 392s select_paths = .select_paths at 0x7537df9b6b60> 392s src_dir = local('/tmp/pytest-of-ubuntu/pytest-117/test_setup_inputs0/to/the/base') 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-117/test_setup_inputs0') 392s with_package_base = 1 392s 392s tests/test_setup.py:849: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-117/test_setup_inputs0') 392s setup_args = ['build'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-117/test_setup_inputs0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s ________________________ test_setup_inputs[1-0-1-0-0-0] ________________________ 392s 392s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 0 392s has_pure_package = 1, has_pure_module = 0, with_package_base = 1 392s mocker = 392s 392s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 392s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 392s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_module", [0, 1]) 392s @pytest.mark.parametrize("with_package_base", [0, 1]) 392s def test_setup_inputs( 392s has_cmake_package, 392s has_cmake_module, 392s has_hybrid_package, 392s has_pure_package, 392s has_pure_module, 392s with_package_base, 392s mocker, 392s ): 392s """This test that a project can have a package with some modules 392s installed using setup.py and some other modules installed using CMake. 392s """ 392s 392s tmp_dir = _tmpdir("test_setup_inputs") 392s 392s package_base = "to/the/base" if with_package_base else "" 392s package_base_dir = package_base + "/" if package_base else "" 392s cmake_source_dir = package_base 392s 392s if cmake_source_dir and (has_cmake_package or has_cmake_module): 392s pytest.skip( 392s "unsupported configuration: " 392s "python package fully generated by CMake does *NOT* work. " 392s "At least __init__.py should be in the project source tree" 392s ) 392s 392s # ------------------------------------------------------------------------- 392s # Here is the "SOURCE" tree layout: 392s # 392s # ROOT/ 392s # 392s # setup.py 392s # 392s # [/] 392s # 392s # pureModule.py 392s # 392s # pure/ 392s # __init__.py 392s # pure.py 392s # 392s # data/ 392s # pure.dat 392s # 392s # [/] 392s # 392s # hybrid/ 392s # CMakeLists.txt 392s # __init__.py 392s # hybrid_pure.dat 392s # hybrid_pure.py 392s # 392s # data/ 392s # hybrid_data_pure.dat 392s # 392s # hybrid_2/ 392s # __init__.py 392s # hybrid_2_pure.py 392s # 392s # hybrid_2_pure/ 392s # __init__.py 392s # hybrid_2_pure_1.py 392s # hybrid_2_pure_2.py 392s # 392s # 392s # ------------------------------------------------------------------------- 392s # and here is the "BINARY" distribution layout: 392s # 392s # The comment "CMake" or "Setuptools" indicates which tool is responsible 392s # for placing the file in the tree used to create the binary distribution. 392s # 392s # ROOT/ 392s # 392s # cmakeModule.py # CMake 392s # 392s # cmake/ 392s # __init__.py # CMake 392s # cmake.py # CMake 392s # 392s # hybrid/ 392s # hybrid_cmake.dat # CMake 392s # hybrid_cmake.py # CMake 392s # hybrid_pure.dat # Setuptools 392s # hybrid_pure.py # Setuptools 392s # 392s # data/ 392s # hybrid_data_pure.dat # CMake or Setuptools 392s # hybrid_data_cmake.dat # CMake *NO TEST* 392s # 392s # hybrid_2/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure.py # CMake or Setuptools 392s # hybrid_2_cmake.py # CMake 392s # 392s # hybrid_2_pure/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure_1.py # CMake or Setuptools 392s # hybrid_2_pure_2.py # CMake or Setuptools 392s # 392s # pureModule.py # Setuptools 392s # 392s # pure/ 392s # __init__.py # Setuptools 392s # pure.py # Setuptools 392s # 392s # data/ 392s # pure.dat # Setuptools 392s 392s tmp_dir.join("setup.py").write( 392s textwrap.dedent( 392s """ 392s from skbuild import setup 392s #from setuptools import setup 392s setup( 392s name="test_hybrid_project", 392s version="1.2.3", 392s description=("an hybrid package mixing files installed by both " 392s "CMake and setuptools"), 392s author='The scikit-build team', 392s license="MIT", 392s cmake_source_dir='{cmake_source_dir}', 392s cmake_install_dir='{cmake_install_dir}', 392s # Arbitrary order of packages 392s packages=[ 392s {p_off} 'pure', 392s {h_off} 'hybrid.hybrid_2', 392s {h_off} 'hybrid', 392s {c_off} 'cmake', 392s {p_off} 'hybrid.hybrid_2_pure', 392s ], 392s py_modules=[ 392s {pm_off} '{package_base}pureModule', 392s {cm_off} '{package_base}cmakeModule', 392s ], 392s package_data={{ 392s {p_off} 'pure': ['data/pure.dat'], 392s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 392s }}, 392s # Arbitrary order of package_dir 392s package_dir = {{ 392s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 392s {p_off} 'pure': '{package_base}pure', 392s {h_off} 'hybrid': '{package_base}hybrid', 392s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 392s {c_off} 'cmake': '{package_base}cmake', 392s }} 392s ) 392s """.format( 392s cmake_source_dir=cmake_source_dir, 392s cmake_install_dir=package_base, 392s package_base=package_base_dir, 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s p_off="" if has_pure_package else "#", 392s pm_off="" if has_pure_module else "#", 392s ) 392s ) 392s ) 392s 392s src_dir = tmp_dir.ensure(package_base, dir=1) 392s 392s src_dir.join("CMakeLists.txt").write( 392s textwrap.dedent( 392s """ 392s cmake_minimum_required(VERSION 3.5.0) 392s project(hybrid NONE) 392s set(build_dir ${{CMAKE_BINARY_DIR}}) 392s 392s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 392s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 392s {c_off} install( 392s {c_off} FILES 392s {c_off} ${{build_dir}}/__init__.py 392s {c_off} ${{build_dir}}/cmake.py 392s {c_off} DESTINATION cmake 392s {c_off} ) 392s 392s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 392s {cm_off} install( 392s {cm_off} FILES ${{build_dir}}/cmakeModule.py 392s {cm_off} DESTINATION .) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 392s {h_off} DESTINATION hybrid/data) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 392s {h_off} DESTINATION hybrid/hybrid_2) 392s 392s install(CODE "message(STATUS \\\"Installation complete\\\")") 392s """.format( 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s ) 392s ) 392s ) 392s 392s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 392s path_types: Sequence[str] 392s try: 392s path_types = next( 392s iter( 392s zip( 392s *filter( 392s lambda i: i[1], 392s [ 392s ("c", has_cmake_package), 392s ("cm", has_cmake_module), 392s ("h", has_hybrid_package), 392s ("p", has_pure_package), 392s ("pm", has_pure_module), 392s ], 392s ) 392s ) 392s ) 392s ) 392s except StopIteration: 392s path_types = [] 392s 392s def select_paths(annotated_paths): 392s """Return a filtered list paths considering ``path_types``. 392s 392s `annotated_paths`` is list of tuple ``(type, path)`` where type 392s is either `c`, 'cm', `h`, `p` or 'pm'. 392s 392s """ 392s return filter(lambda i: i[0] in path_types, annotated_paths) 392s 392s # Commented paths are the one expected to be installed by CMake. For 392s # this reason, corresponding files should NOT be created in the source 392s # tree. 392s for _type, path in select_paths( 392s [ 392s # ('c', 'cmake/__init__.py'), 392s # ('c', 'cmake/cmake.py'), 392s # ('cm', 'cmakeModule.py'), 392s ("h", "hybrid/__init__.py"), 392s # ('h', 'hybrid/hybrid_cmake.dat'), 392s # ('h', 'hybrid/hybrid_cmake.py'), 392s ("h", "hybrid/hybrid_pure.dat"), 392s ("h", "hybrid/hybrid_pure.py"), 392s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 392s ("h", "hybrid/data/hybrid_data_pure.dat"), 392s ("h", "hybrid/hybrid_2/__init__.py"), 392s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 392s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 392s ("p", "hybrid/hybrid_2_pure/__init__.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 392s ("pm", "pureModule.py"), 392s ("p", "pure/__init__.py"), 392s ("p", "pure/pure.py"), 392s ("p", "pure/data/pure.dat"), 392s ] 392s ): 392s assert _type in {"p", "pm", "h"} 392s root = package_base if _type in {"p", "pm"} else cmake_source_dir 392s tmp_dir.ensure(os.path.join(root, path)) 392s 392s # Do not call the real setup function. Instead, replace it with 392s # a MagicMock allowing to check with which arguments it was invoked. 392s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 392s 392s # Convenience print function 392s def _pprint(desc, value=None): 392s print( 392s "-----------------\n" 392s f"{desc}:\n" 392s "\n" 392s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 392s ) 392s 392s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 392s 392s _pprint = ._pprint at 0x7537df9f44a0> 392s _type = 'p' 392s cmake_source_dir = 'to/the/base' 392s has_cmake_module = 0 392s has_cmake_package = 0 392s has_hybrid_package = 0 392s has_pure_module = 0 392s has_pure_package = 1 392s mock_setup = 392s mocker = 392s package_base = 'to/the/base' 392s package_base_dir = 'to/the/base/' 392s path = 'pure/data/pure.dat' 392s path_types = ('p',) 392s root = 'to/the/base' 392s select_paths = .select_paths at 0x7537df9f6480> 392s src_dir = local('/tmp/pytest-of-ubuntu/pytest-121/test_setup_inputs0/to/the/base') 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-121/test_setup_inputs0') 392s with_package_base = 1 392s 392s tests/test_setup.py:849: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-121/test_setup_inputs0') 392s setup_args = ['build'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-121/test_setup_inputs0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s ________________________ test_setup_inputs[1-0-1-1-0-0] ________________________ 392s 392s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 1 392s has_pure_package = 1, has_pure_module = 0, with_package_base = 1 392s mocker = 392s 392s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 392s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 392s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_module", [0, 1]) 392s @pytest.mark.parametrize("with_package_base", [0, 1]) 392s def test_setup_inputs( 392s has_cmake_package, 392s has_cmake_module, 392s has_hybrid_package, 392s has_pure_package, 392s has_pure_module, 392s with_package_base, 392s mocker, 392s ): 392s """This test that a project can have a package with some modules 392s installed using setup.py and some other modules installed using CMake. 392s """ 392s 392s tmp_dir = _tmpdir("test_setup_inputs") 392s 392s package_base = "to/the/base" if with_package_base else "" 392s package_base_dir = package_base + "/" if package_base else "" 392s cmake_source_dir = package_base 392s 392s if cmake_source_dir and (has_cmake_package or has_cmake_module): 392s pytest.skip( 392s "unsupported configuration: " 392s "python package fully generated by CMake does *NOT* work. " 392s "At least __init__.py should be in the project source tree" 392s ) 392s 392s # ------------------------------------------------------------------------- 392s # Here is the "SOURCE" tree layout: 392s # 392s # ROOT/ 392s # 392s # setup.py 392s # 392s # [/] 392s # 392s # pureModule.py 392s # 392s # pure/ 392s # __init__.py 392s # pure.py 392s # 392s # data/ 392s # pure.dat 392s # 392s # [/] 392s # 392s # hybrid/ 392s # CMakeLists.txt 392s # __init__.py 392s # hybrid_pure.dat 392s # hybrid_pure.py 392s # 392s # data/ 392s # hybrid_data_pure.dat 392s # 392s # hybrid_2/ 392s # __init__.py 392s # hybrid_2_pure.py 392s # 392s # hybrid_2_pure/ 392s # __init__.py 392s # hybrid_2_pure_1.py 392s # hybrid_2_pure_2.py 392s # 392s # 392s # ------------------------------------------------------------------------- 392s # and here is the "BINARY" distribution layout: 392s # 392s # The comment "CMake" or "Setuptools" indicates which tool is responsible 392s # for placing the file in the tree used to create the binary distribution. 392s # 392s # ROOT/ 392s # 392s # cmakeModule.py # CMake 392s # 392s # cmake/ 392s # __init__.py # CMake 392s # cmake.py # CMake 392s # 392s # hybrid/ 392s # hybrid_cmake.dat # CMake 392s # hybrid_cmake.py # CMake 392s # hybrid_pure.dat # Setuptools 392s # hybrid_pure.py # Setuptools 392s # 392s # data/ 392s # hybrid_data_pure.dat # CMake or Setuptools 392s # hybrid_data_cmake.dat # CMake *NO TEST* 392s # 392s # hybrid_2/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure.py # CMake or Setuptools 392s # hybrid_2_cmake.py # CMake 392s # 392s # hybrid_2_pure/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure_1.py # CMake or Setuptools 392s # hybrid_2_pure_2.py # CMake or Setuptools 392s # 392s # pureModule.py # Setuptools 392s # 392s # pure/ 392s # __init__.py # Setuptools 392s # pure.py # Setuptools 392s # 392s # data/ 392s # pure.dat # Setuptools 392s 392s tmp_dir.join("setup.py").write( 392s textwrap.dedent( 392s """ 392s from skbuild import setup 392s #from setuptools import setup 392s setup( 392s name="test_hybrid_project", 392s version="1.2.3", 392s description=("an hybrid package mixing files installed by both " 392s "CMake and setuptools"), 392s author='The scikit-build team', 392s license="MIT", 392s cmake_source_dir='{cmake_source_dir}', 392s cmake_install_dir='{cmake_install_dir}', 392s # Arbitrary order of packages 392s packages=[ 392s {p_off} 'pure', 392s {h_off} 'hybrid.hybrid_2', 392s {h_off} 'hybrid', 392s {c_off} 'cmake', 392s {p_off} 'hybrid.hybrid_2_pure', 392s ], 392s py_modules=[ 392s {pm_off} '{package_base}pureModule', 392s {cm_off} '{package_base}cmakeModule', 392s ], 392s package_data={{ 392s {p_off} 'pure': ['data/pure.dat'], 392s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 392s }}, 392s # Arbitrary order of package_dir 392s package_dir = {{ 392s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 392s {p_off} 'pure': '{package_base}pure', 392s {h_off} 'hybrid': '{package_base}hybrid', 392s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 392s {c_off} 'cmake': '{package_base}cmake', 392s }} 392s ) 392s """.format( 392s cmake_source_dir=cmake_source_dir, 392s cmake_install_dir=package_base, 392s package_base=package_base_dir, 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s p_off="" if has_pure_package else "#", 392s pm_off="" if has_pure_module else "#", 392s ) 392s ) 392s ) 392s 392s src_dir = tmp_dir.ensure(package_base, dir=1) 392s 392s src_dir.join("CMakeLists.txt").write( 392s textwrap.dedent( 392s """ 392s cmake_minimum_required(VERSION 3.5.0) 392s project(hybrid NONE) 392s set(build_dir ${{CMAKE_BINARY_DIR}}) 392s 392s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 392s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 392s {c_off} install( 392s {c_off} FILES 392s {c_off} ${{build_dir}}/__init__.py 392s {c_off} ${{build_dir}}/cmake.py 392s {c_off} DESTINATION cmake 392s {c_off} ) 392s 392s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 392s {cm_off} install( 392s {cm_off} FILES ${{build_dir}}/cmakeModule.py 392s {cm_off} DESTINATION .) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 392s {h_off} DESTINATION hybrid/data) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 392s {h_off} DESTINATION hybrid/hybrid_2) 392s 392s install(CODE "message(STATUS \\\"Installation complete\\\")") 392s """.format( 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s ) 392s ) 392s ) 392s 392s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 392s path_types: Sequence[str] 392s try: 392s path_types = next( 392s iter( 392s zip( 392s *filter( 392s lambda i: i[1], 392s [ 392s ("c", has_cmake_package), 392s ("cm", has_cmake_module), 392s ("h", has_hybrid_package), 392s ("p", has_pure_package), 392s ("pm", has_pure_module), 392s ], 392s ) 392s ) 392s ) 392s ) 392s except StopIteration: 392s path_types = [] 392s 392s def select_paths(annotated_paths): 392s """Return a filtered list paths considering ``path_types``. 392s 392s `annotated_paths`` is list of tuple ``(type, path)`` where type 392s is either `c`, 'cm', `h`, `p` or 'pm'. 392s 392s """ 392s return filter(lambda i: i[0] in path_types, annotated_paths) 392s 392s # Commented paths are the one expected to be installed by CMake. For 392s # this reason, corresponding files should NOT be created in the source 392s # tree. 392s for _type, path in select_paths( 392s [ 392s # ('c', 'cmake/__init__.py'), 392s # ('c', 'cmake/cmake.py'), 392s # ('cm', 'cmakeModule.py'), 392s ("h", "hybrid/__init__.py"), 392s # ('h', 'hybrid/hybrid_cmake.dat'), 392s # ('h', 'hybrid/hybrid_cmake.py'), 392s ("h", "hybrid/hybrid_pure.dat"), 392s ("h", "hybrid/hybrid_pure.py"), 392s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 392s ("h", "hybrid/data/hybrid_data_pure.dat"), 392s ("h", "hybrid/hybrid_2/__init__.py"), 392s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 392s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 392s ("p", "hybrid/hybrid_2_pure/__init__.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 392s ("pm", "pureModule.py"), 392s ("p", "pure/__init__.py"), 392s ("p", "pure/pure.py"), 392s ("p", "pure/data/pure.dat"), 392s ] 392s ): 392s assert _type in {"p", "pm", "h"} 392s root = package_base if _type in {"p", "pm"} else cmake_source_dir 392s tmp_dir.ensure(os.path.join(root, path)) 392s 392s # Do not call the real setup function. Instead, replace it with 392s # a MagicMock allowing to check with which arguments it was invoked. 392s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 392s 392s # Convenience print function 392s def _pprint(desc, value=None): 392s print( 392s "-----------------\n" 392s f"{desc}:\n" 392s "\n" 392s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 392s ) 392s 392s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 392s 392s _pprint = ._pprint at 0x7537df9f4ea0> 392s _type = 'p' 392s cmake_source_dir = 'to/the/base' 392s has_cmake_module = 0 392s has_cmake_package = 0 392s has_hybrid_package = 1 392s has_pure_module = 0 392s has_pure_package = 1 392s mock_setup = 392s mocker = 392s package_base = 'to/the/base' 392s package_base_dir = 'to/the/base/' 392s path = 'pure/data/pure.dat' 392s path_types = ('h', 'p') 392s root = 'to/the/base' 392s select_paths = .select_paths at 0x7537df9f6520> 392s src_dir = local('/tmp/pytest-of-ubuntu/pytest-125/test_setup_inputs0/to/the/base') 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-125/test_setup_inputs0') 392s with_package_base = 1 392s 392s tests/test_setup.py:849: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-125/test_setup_inputs0') 392s setup_args = ['build'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-125/test_setup_inputs0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s ________________________ test_setup_inputs[1-1-0-0-0-0] ________________________ 392s 392s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 0 392s has_pure_package = 0, has_pure_module = 1, with_package_base = 1 392s mocker = 392s 392s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 392s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 392s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_module", [0, 1]) 392s @pytest.mark.parametrize("with_package_base", [0, 1]) 392s def test_setup_inputs( 392s has_cmake_package, 392s has_cmake_module, 392s has_hybrid_package, 392s has_pure_package, 392s has_pure_module, 392s with_package_base, 392s mocker, 392s ): 392s """This test that a project can have a package with some modules 392s installed using setup.py and some other modules installed using CMake. 392s """ 392s 392s tmp_dir = _tmpdir("test_setup_inputs") 392s 392s package_base = "to/the/base" if with_package_base else "" 392s package_base_dir = package_base + "/" if package_base else "" 392s cmake_source_dir = package_base 392s 392s if cmake_source_dir and (has_cmake_package or has_cmake_module): 392s pytest.skip( 392s "unsupported configuration: " 392s "python package fully generated by CMake does *NOT* work. " 392s "At least __init__.py should be in the project source tree" 392s ) 392s 392s # ------------------------------------------------------------------------- 392s # Here is the "SOURCE" tree layout: 392s # 392s # ROOT/ 392s # 392s # setup.py 392s # 392s # [/] 392s # 392s # pureModule.py 392s # 392s # pure/ 392s # __init__.py 392s # pure.py 392s # 392s # data/ 392s # pure.dat 392s # 392s # [/] 392s # 392s # hybrid/ 392s # CMakeLists.txt 392s # __init__.py 392s # hybrid_pure.dat 392s # hybrid_pure.py 392s # 392s # data/ 392s # hybrid_data_pure.dat 392s # 392s # hybrid_2/ 392s # __init__.py 392s # hybrid_2_pure.py 392s # 392s # hybrid_2_pure/ 392s # __init__.py 392s # hybrid_2_pure_1.py 392s # hybrid_2_pure_2.py 392s # 392s # 392s # ------------------------------------------------------------------------- 392s # and here is the "BINARY" distribution layout: 392s # 392s # The comment "CMake" or "Setuptools" indicates which tool is responsible 392s # for placing the file in the tree used to create the binary distribution. 392s # 392s # ROOT/ 392s # 392s # cmakeModule.py # CMake 392s # 392s # cmake/ 392s # __init__.py # CMake 392s # cmake.py # CMake 392s # 392s # hybrid/ 392s # hybrid_cmake.dat # CMake 392s # hybrid_cmake.py # CMake 392s # hybrid_pure.dat # Setuptools 392s # hybrid_pure.py # Setuptools 392s # 392s # data/ 392s # hybrid_data_pure.dat # CMake or Setuptools 392s # hybrid_data_cmake.dat # CMake *NO TEST* 392s # 392s # hybrid_2/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure.py # CMake or Setuptools 392s # hybrid_2_cmake.py # CMake 392s # 392s # hybrid_2_pure/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure_1.py # CMake or Setuptools 392s # hybrid_2_pure_2.py # CMake or Setuptools 392s # 392s # pureModule.py # Setuptools 392s # 392s # pure/ 392s # __init__.py # Setuptools 392s # pure.py # Setuptools 392s # 392s # data/ 392s # pure.dat # Setuptools 392s 392s tmp_dir.join("setup.py").write( 392s textwrap.dedent( 392s """ 392s from skbuild import setup 392s #from setuptools import setup 392s setup( 392s name="test_hybrid_project", 392s version="1.2.3", 392s description=("an hybrid package mixing files installed by both " 392s "CMake and setuptools"), 392s author='The scikit-build team', 392s license="MIT", 392s cmake_source_dir='{cmake_source_dir}', 392s cmake_install_dir='{cmake_install_dir}', 392s # Arbitrary order of packages 392s packages=[ 392s {p_off} 'pure', 392s {h_off} 'hybrid.hybrid_2', 392s {h_off} 'hybrid', 392s {c_off} 'cmake', 392s {p_off} 'hybrid.hybrid_2_pure', 392s ], 392s py_modules=[ 392s {pm_off} '{package_base}pureModule', 392s {cm_off} '{package_base}cmakeModule', 392s ], 392s package_data={{ 392s {p_off} 'pure': ['data/pure.dat'], 392s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 392s }}, 392s # Arbitrary order of package_dir 392s package_dir = {{ 392s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 392s {p_off} 'pure': '{package_base}pure', 392s {h_off} 'hybrid': '{package_base}hybrid', 392s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 392s {c_off} 'cmake': '{package_base}cmake', 392s }} 392s ) 392s """.format( 392s cmake_source_dir=cmake_source_dir, 392s cmake_install_dir=package_base, 392s package_base=package_base_dir, 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s p_off="" if has_pure_package else "#", 392s pm_off="" if has_pure_module else "#", 392s ) 392s ) 392s ) 392s 392s src_dir = tmp_dir.ensure(package_base, dir=1) 392s 392s src_dir.join("CMakeLists.txt").write( 392s textwrap.dedent( 392s """ 392s cmake_minimum_required(VERSION 3.5.0) 392s project(hybrid NONE) 392s set(build_dir ${{CMAKE_BINARY_DIR}}) 392s 392s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 392s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 392s {c_off} install( 392s {c_off} FILES 392s {c_off} ${{build_dir}}/__init__.py 392s {c_off} ${{build_dir}}/cmake.py 392s {c_off} DESTINATION cmake 392s {c_off} ) 392s 392s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 392s {cm_off} install( 392s {cm_off} FILES ${{build_dir}}/cmakeModule.py 392s {cm_off} DESTINATION .) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 392s {h_off} DESTINATION hybrid/data) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 392s {h_off} DESTINATION hybrid/hybrid_2) 392s 392s install(CODE "message(STATUS \\\"Installation complete\\\")") 392s """.format( 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s ) 392s ) 392s ) 392s 392s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 392s path_types: Sequence[str] 392s try: 392s path_types = next( 392s iter( 392s zip( 392s *filter( 392s lambda i: i[1], 392s [ 392s ("c", has_cmake_package), 392s ("cm", has_cmake_module), 392s ("h", has_hybrid_package), 392s ("p", has_pure_package), 392s ("pm", has_pure_module), 392s ], 392s ) 392s ) 392s ) 392s ) 392s except StopIteration: 392s path_types = [] 392s 392s def select_paths(annotated_paths): 392s """Return a filtered list paths considering ``path_types``. 392s 392s `annotated_paths`` is list of tuple ``(type, path)`` where type 392s is either `c`, 'cm', `h`, `p` or 'pm'. 392s 392s """ 392s return filter(lambda i: i[0] in path_types, annotated_paths) 392s 392s # Commented paths are the one expected to be installed by CMake. For 392s # this reason, corresponding files should NOT be created in the source 392s # tree. 392s for _type, path in select_paths( 392s [ 392s # ('c', 'cmake/__init__.py'), 392s # ('c', 'cmake/cmake.py'), 392s # ('cm', 'cmakeModule.py'), 392s ("h", "hybrid/__init__.py"), 392s # ('h', 'hybrid/hybrid_cmake.dat'), 392s # ('h', 'hybrid/hybrid_cmake.py'), 392s ("h", "hybrid/hybrid_pure.dat"), 392s ("h", "hybrid/hybrid_pure.py"), 392s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 392s ("h", "hybrid/data/hybrid_data_pure.dat"), 392s ("h", "hybrid/hybrid_2/__init__.py"), 392s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 392s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 392s ("p", "hybrid/hybrid_2_pure/__init__.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 392s ("pm", "pureModule.py"), 392s ("p", "pure/__init__.py"), 392s ("p", "pure/pure.py"), 392s ("p", "pure/data/pure.dat"), 392s ] 392s ): 392s assert _type in {"p", "pm", "h"} 392s root = package_base if _type in {"p", "pm"} else cmake_source_dir 392s tmp_dir.ensure(os.path.join(root, path)) 392s 392s # Do not call the real setup function. Instead, replace it with 392s # a MagicMock allowing to check with which arguments it was invoked. 392s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 392s 392s # Convenience print function 392s def _pprint(desc, value=None): 392s print( 392s "-----------------\n" 392s f"{desc}:\n" 392s "\n" 392s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 392s ) 392s 392s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 392s 392s _pprint = ._pprint at 0x7537df9b6c00> 392s _type = 'pm' 392s cmake_source_dir = 'to/the/base' 392s has_cmake_module = 0 392s has_cmake_package = 0 392s has_hybrid_package = 0 392s has_pure_module = 1 392s has_pure_package = 0 392s mock_setup = 392s mocker = 392s package_base = 'to/the/base' 392s package_base_dir = 'to/the/base/' 392s path = 'pureModule.py' 392s path_types = ('pm',) 392s root = 'to/the/base' 392s select_paths = .select_paths at 0x7537dfb136a0> 392s src_dir = local('/tmp/pytest-of-ubuntu/pytest-129/test_setup_inputs0/to/the/base') 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-129/test_setup_inputs0') 392s with_package_base = 1 392s 392s tests/test_setup.py:849: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-129/test_setup_inputs0') 392s setup_args = ['build'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-129/test_setup_inputs0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s ________________________ test_setup_inputs[1-1-0-1-0-0] ________________________ 392s 392s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 1 392s has_pure_package = 0, has_pure_module = 1, with_package_base = 1 392s mocker = 392s 392s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 392s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 392s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_module", [0, 1]) 392s @pytest.mark.parametrize("with_package_base", [0, 1]) 392s def test_setup_inputs( 392s has_cmake_package, 392s has_cmake_module, 392s has_hybrid_package, 392s has_pure_package, 392s has_pure_module, 392s with_package_base, 392s mocker, 392s ): 392s """This test that a project can have a package with some modules 392s installed using setup.py and some other modules installed using CMake. 392s """ 392s 392s tmp_dir = _tmpdir("test_setup_inputs") 392s 392s package_base = "to/the/base" if with_package_base else "" 392s package_base_dir = package_base + "/" if package_base else "" 392s cmake_source_dir = package_base 392s 392s if cmake_source_dir and (has_cmake_package or has_cmake_module): 392s pytest.skip( 392s "unsupported configuration: " 392s "python package fully generated by CMake does *NOT* work. " 392s "At least __init__.py should be in the project source tree" 392s ) 392s 392s # ------------------------------------------------------------------------- 392s # Here is the "SOURCE" tree layout: 392s # 392s # ROOT/ 392s # 392s # setup.py 392s # 392s # [/] 392s # 392s # pureModule.py 392s # 392s # pure/ 392s # __init__.py 392s # pure.py 392s # 392s # data/ 392s # pure.dat 392s # 392s # [/] 392s # 392s # hybrid/ 392s # CMakeLists.txt 392s # __init__.py 392s # hybrid_pure.dat 392s # hybrid_pure.py 392s # 392s # data/ 392s # hybrid_data_pure.dat 392s # 392s # hybrid_2/ 392s # __init__.py 392s # hybrid_2_pure.py 392s # 392s # hybrid_2_pure/ 392s # __init__.py 392s # hybrid_2_pure_1.py 392s # hybrid_2_pure_2.py 392s # 392s # 392s # ------------------------------------------------------------------------- 392s # and here is the "BINARY" distribution layout: 392s # 392s # The comment "CMake" or "Setuptools" indicates which tool is responsible 392s # for placing the file in the tree used to create the binary distribution. 392s # 392s # ROOT/ 392s # 392s # cmakeModule.py # CMake 392s # 392s # cmake/ 392s # __init__.py # CMake 392s # cmake.py # CMake 392s # 392s # hybrid/ 392s # hybrid_cmake.dat # CMake 392s # hybrid_cmake.py # CMake 392s # hybrid_pure.dat # Setuptools 392s # hybrid_pure.py # Setuptools 392s # 392s # data/ 392s # hybrid_data_pure.dat # CMake or Setuptools 392s # hybrid_data_cmake.dat # CMake *NO TEST* 392s # 392s # hybrid_2/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure.py # CMake or Setuptools 392s # hybrid_2_cmake.py # CMake 392s # 392s # hybrid_2_pure/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure_1.py # CMake or Setuptools 392s # hybrid_2_pure_2.py # CMake or Setuptools 392s # 392s # pureModule.py # Setuptools 392s # 392s # pure/ 392s # __init__.py # Setuptools 392s # pure.py # Setuptools 392s # 392s # data/ 392s # pure.dat # Setuptools 392s 392s tmp_dir.join("setup.py").write( 392s textwrap.dedent( 392s """ 392s from skbuild import setup 392s #from setuptools import setup 392s setup( 392s name="test_hybrid_project", 392s version="1.2.3", 392s description=("an hybrid package mixing files installed by both " 392s "CMake and setuptools"), 392s author='The scikit-build team', 392s license="MIT", 392s cmake_source_dir='{cmake_source_dir}', 392s cmake_install_dir='{cmake_install_dir}', 392s # Arbitrary order of packages 392s packages=[ 392s {p_off} 'pure', 392s {h_off} 'hybrid.hybrid_2', 392s {h_off} 'hybrid', 392s {c_off} 'cmake', 392s {p_off} 'hybrid.hybrid_2_pure', 392s ], 392s py_modules=[ 392s {pm_off} '{package_base}pureModule', 392s {cm_off} '{package_base}cmakeModule', 392s ], 392s package_data={{ 392s {p_off} 'pure': ['data/pure.dat'], 392s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 392s }}, 392s # Arbitrary order of package_dir 392s package_dir = {{ 392s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 392s {p_off} 'pure': '{package_base}pure', 392s {h_off} 'hybrid': '{package_base}hybrid', 392s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 392s {c_off} 'cmake': '{package_base}cmake', 392s }} 392s ) 392s """.format( 392s cmake_source_dir=cmake_source_dir, 392s cmake_install_dir=package_base, 392s package_base=package_base_dir, 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s p_off="" if has_pure_package else "#", 392s pm_off="" if has_pure_module else "#", 392s ) 392s ) 392s ) 392s 392s src_dir = tmp_dir.ensure(package_base, dir=1) 392s 392s src_dir.join("CMakeLists.txt").write( 392s textwrap.dedent( 392s """ 392s cmake_minimum_required(VERSION 3.5.0) 392s project(hybrid NONE) 392s set(build_dir ${{CMAKE_BINARY_DIR}}) 392s 392s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 392s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 392s {c_off} install( 392s {c_off} FILES 392s {c_off} ${{build_dir}}/__init__.py 392s {c_off} ${{build_dir}}/cmake.py 392s {c_off} DESTINATION cmake 392s {c_off} ) 392s 392s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 392s {cm_off} install( 392s {cm_off} FILES ${{build_dir}}/cmakeModule.py 392s {cm_off} DESTINATION .) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 392s {h_off} DESTINATION hybrid/data) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 392s {h_off} DESTINATION hybrid/hybrid_2) 392s 392s install(CODE "message(STATUS \\\"Installation complete\\\")") 392s """.format( 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s ) 392s ) 392s ) 392s 392s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 392s path_types: Sequence[str] 392s try: 392s path_types = next( 392s iter( 392s zip( 392s *filter( 392s lambda i: i[1], 392s [ 392s ("c", has_cmake_package), 392s ("cm", has_cmake_module), 392s ("h", has_hybrid_package), 392s ("p", has_pure_package), 392s ("pm", has_pure_module), 392s ], 392s ) 392s ) 392s ) 392s ) 392s except StopIteration: 392s path_types = [] 392s 392s def select_paths(annotated_paths): 392s """Return a filtered list paths considering ``path_types``. 392s 392s `annotated_paths`` is list of tuple ``(type, path)`` where type 392s is either `c`, 'cm', `h`, `p` or 'pm'. 392s 392s """ 392s return filter(lambda i: i[0] in path_types, annotated_paths) 392s 392s # Commented paths are the one expected to be installed by CMake. For 392s # this reason, corresponding files should NOT be created in the source 392s # tree. 392s for _type, path in select_paths( 392s [ 392s # ('c', 'cmake/__init__.py'), 392s # ('c', 'cmake/cmake.py'), 392s # ('cm', 'cmakeModule.py'), 392s ("h", "hybrid/__init__.py"), 392s # ('h', 'hybrid/hybrid_cmake.dat'), 392s # ('h', 'hybrid/hybrid_cmake.py'), 392s ("h", "hybrid/hybrid_pure.dat"), 392s ("h", "hybrid/hybrid_pure.py"), 392s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 392s ("h", "hybrid/data/hybrid_data_pure.dat"), 392s ("h", "hybrid/hybrid_2/__init__.py"), 392s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 392s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 392s ("p", "hybrid/hybrid_2_pure/__init__.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 392s ("pm", "pureModule.py"), 392s ("p", "pure/__init__.py"), 392s ("p", "pure/pure.py"), 392s ("p", "pure/data/pure.dat"), 392s ] 392s ): 392s assert _type in {"p", "pm", "h"} 392s root = package_base if _type in {"p", "pm"} else cmake_source_dir 392s tmp_dir.ensure(os.path.join(root, path)) 392s 392s # Do not call the real setup function. Instead, replace it with 392s # a MagicMock allowing to check with which arguments it was invoked. 392s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 392s 392s # Convenience print function 392s def _pprint(desc, value=None): 392s print( 392s "-----------------\n" 392s f"{desc}:\n" 392s "\n" 392s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 392s ) 392s 392s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 392s 392s _pprint = ._pprint at 0x7537df9b67a0> 392s _type = 'pm' 392s cmake_source_dir = 'to/the/base' 392s has_cmake_module = 0 392s has_cmake_package = 0 392s has_hybrid_package = 1 392s has_pure_module = 1 392s has_pure_package = 0 392s mock_setup = 392s mocker = 392s package_base = 'to/the/base' 392s package_base_dir = 'to/the/base/' 392s path = 'pureModule.py' 392s path_types = ('h', 'pm') 392s root = 'to/the/base' 392s select_paths = .select_paths at 0x7537df9f44a0> 392s src_dir = local('/tmp/pytest-of-ubuntu/pytest-133/test_setup_inputs0/to/the/base') 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-133/test_setup_inputs0') 392s with_package_base = 1 392s 392s tests/test_setup.py:849: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-133/test_setup_inputs0') 392s setup_args = ['build'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-133/test_setup_inputs0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s ________________________ test_setup_inputs[1-1-1-0-0-0] ________________________ 392s 392s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 0 392s has_pure_package = 1, has_pure_module = 1, with_package_base = 1 392s mocker = 392s 392s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 392s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 392s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_module", [0, 1]) 392s @pytest.mark.parametrize("with_package_base", [0, 1]) 392s def test_setup_inputs( 392s has_cmake_package, 392s has_cmake_module, 392s has_hybrid_package, 392s has_pure_package, 392s has_pure_module, 392s with_package_base, 392s mocker, 392s ): 392s """This test that a project can have a package with some modules 392s installed using setup.py and some other modules installed using CMake. 392s """ 392s 392s tmp_dir = _tmpdir("test_setup_inputs") 392s 392s package_base = "to/the/base" if with_package_base else "" 392s package_base_dir = package_base + "/" if package_base else "" 392s cmake_source_dir = package_base 392s 392s if cmake_source_dir and (has_cmake_package or has_cmake_module): 392s pytest.skip( 392s "unsupported configuration: " 392s "python package fully generated by CMake does *NOT* work. " 392s "At least __init__.py should be in the project source tree" 392s ) 392s 392s # ------------------------------------------------------------------------- 392s # Here is the "SOURCE" tree layout: 392s # 392s # ROOT/ 392s # 392s # setup.py 392s # 392s # [/] 392s # 392s # pureModule.py 392s # 392s # pure/ 392s # __init__.py 392s # pure.py 392s # 392s # data/ 392s # pure.dat 392s # 392s # [/] 392s # 392s # hybrid/ 392s # CMakeLists.txt 392s # __init__.py 392s # hybrid_pure.dat 392s # hybrid_pure.py 392s # 392s # data/ 392s # hybrid_data_pure.dat 392s # 392s # hybrid_2/ 392s # __init__.py 392s # hybrid_2_pure.py 392s # 392s # hybrid_2_pure/ 392s # __init__.py 392s # hybrid_2_pure_1.py 392s # hybrid_2_pure_2.py 392s # 392s # 392s # ------------------------------------------------------------------------- 392s # and here is the "BINARY" distribution layout: 392s # 392s # The comment "CMake" or "Setuptools" indicates which tool is responsible 392s # for placing the file in the tree used to create the binary distribution. 392s # 392s # ROOT/ 392s # 392s # cmakeModule.py # CMake 392s # 392s # cmake/ 392s # __init__.py # CMake 392s # cmake.py # CMake 392s # 392s # hybrid/ 392s # hybrid_cmake.dat # CMake 392s # hybrid_cmake.py # CMake 392s # hybrid_pure.dat # Setuptools 392s # hybrid_pure.py # Setuptools 392s # 392s # data/ 392s # hybrid_data_pure.dat # CMake or Setuptools 392s # hybrid_data_cmake.dat # CMake *NO TEST* 392s # 392s # hybrid_2/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure.py # CMake or Setuptools 392s # hybrid_2_cmake.py # CMake 392s # 392s # hybrid_2_pure/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure_1.py # CMake or Setuptools 392s # hybrid_2_pure_2.py # CMake or Setuptools 392s # 392s # pureModule.py # Setuptools 392s # 392s # pure/ 392s # __init__.py # Setuptools 392s # pure.py # Setuptools 392s # 392s # data/ 392s # pure.dat # Setuptools 392s 392s tmp_dir.join("setup.py").write( 392s textwrap.dedent( 392s """ 392s from skbuild import setup 392s #from setuptools import setup 392s setup( 392s name="test_hybrid_project", 392s version="1.2.3", 392s description=("an hybrid package mixing files installed by both " 392s "CMake and setuptools"), 392s author='The scikit-build team', 392s license="MIT", 392s cmake_source_dir='{cmake_source_dir}', 392s cmake_install_dir='{cmake_install_dir}', 392s # Arbitrary order of packages 392s packages=[ 392s {p_off} 'pure', 392s {h_off} 'hybrid.hybrid_2', 392s {h_off} 'hybrid', 392s {c_off} 'cmake', 392s {p_off} 'hybrid.hybrid_2_pure', 392s ], 392s py_modules=[ 392s {pm_off} '{package_base}pureModule', 392s {cm_off} '{package_base}cmakeModule', 392s ], 392s package_data={{ 392s {p_off} 'pure': ['data/pure.dat'], 392s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 392s }}, 392s # Arbitrary order of package_dir 392s package_dir = {{ 392s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 392s {p_off} 'pure': '{package_base}pure', 392s {h_off} 'hybrid': '{package_base}hybrid', 392s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 392s {c_off} 'cmake': '{package_base}cmake', 392s }} 392s ) 392s """.format( 392s cmake_source_dir=cmake_source_dir, 392s cmake_install_dir=package_base, 392s package_base=package_base_dir, 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s p_off="" if has_pure_package else "#", 392s pm_off="" if has_pure_module else "#", 392s ) 392s ) 392s ) 392s 392s src_dir = tmp_dir.ensure(package_base, dir=1) 392s 392s src_dir.join("CMakeLists.txt").write( 392s textwrap.dedent( 392s """ 392s cmake_minimum_required(VERSION 3.5.0) 392s project(hybrid NONE) 392s set(build_dir ${{CMAKE_BINARY_DIR}}) 392s 392s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 392s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 392s {c_off} install( 392s {c_off} FILES 392s {c_off} ${{build_dir}}/__init__.py 392s {c_off} ${{build_dir}}/cmake.py 392s {c_off} DESTINATION cmake 392s {c_off} ) 392s 392s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 392s {cm_off} install( 392s {cm_off} FILES ${{build_dir}}/cmakeModule.py 392s {cm_off} DESTINATION .) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 392s {h_off} DESTINATION hybrid/data) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 392s {h_off} DESTINATION hybrid/hybrid_2) 392s 392s install(CODE "message(STATUS \\\"Installation complete\\\")") 392s """.format( 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s ) 392s ) 392s ) 392s 392s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 392s path_types: Sequence[str] 392s try: 392s path_types = next( 392s iter( 392s zip( 392s *filter( 392s lambda i: i[1], 392s [ 392s ("c", has_cmake_package), 392s ("cm", has_cmake_module), 392s ("h", has_hybrid_package), 392s ("p", has_pure_package), 392s ("pm", has_pure_module), 392s ], 392s ) 392s ) 392s ) 392s ) 392s except StopIteration: 392s path_types = [] 392s 392s def select_paths(annotated_paths): 392s """Return a filtered list paths considering ``path_types``. 392s 392s `annotated_paths`` is list of tuple ``(type, path)`` where type 392s is either `c`, 'cm', `h`, `p` or 'pm'. 392s 392s """ 392s return filter(lambda i: i[0] in path_types, annotated_paths) 392s 392s # Commented paths are the one expected to be installed by CMake. For 392s # this reason, corresponding files should NOT be created in the source 392s # tree. 392s for _type, path in select_paths( 392s [ 392s # ('c', 'cmake/__init__.py'), 392s # ('c', 'cmake/cmake.py'), 392s # ('cm', 'cmakeModule.py'), 392s ("h", "hybrid/__init__.py"), 392s # ('h', 'hybrid/hybrid_cmake.dat'), 392s # ('h', 'hybrid/hybrid_cmake.py'), 392s ("h", "hybrid/hybrid_pure.dat"), 392s ("h", "hybrid/hybrid_pure.py"), 392s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 392s ("h", "hybrid/data/hybrid_data_pure.dat"), 392s ("h", "hybrid/hybrid_2/__init__.py"), 392s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 392s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 392s ("p", "hybrid/hybrid_2_pure/__init__.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 392s ("pm", "pureModule.py"), 392s ("p", "pure/__init__.py"), 392s ("p", "pure/pure.py"), 392s ("p", "pure/data/pure.dat"), 392s ] 392s ): 392s assert _type in {"p", "pm", "h"} 392s root = package_base if _type in {"p", "pm"} else cmake_source_dir 392s tmp_dir.ensure(os.path.join(root, path)) 392s 392s # Do not call the real setup function. Instead, replace it with 392s # a MagicMock allowing to check with which arguments it was invoked. 392s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 392s 392s # Convenience print function 392s def _pprint(desc, value=None): 392s print( 392s "-----------------\n" 392s f"{desc}:\n" 392s "\n" 392s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 392s ) 392s 392s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 392s 392s _pprint = ._pprint at 0x7537df9b5300> 392s _type = 'p' 392s cmake_source_dir = 'to/the/base' 392s has_cmake_module = 0 392s has_cmake_package = 0 392s has_hybrid_package = 0 392s has_pure_module = 1 392s has_pure_package = 1 392s mock_setup = 392s mocker = 392s package_base = 'to/the/base' 392s package_base_dir = 'to/the/base/' 392s path = 'pure/data/pure.dat' 392s path_types = ('p', 'pm') 392s root = 'to/the/base' 392s select_paths = .select_paths at 0x7537df9b4900> 392s src_dir = local('/tmp/pytest-of-ubuntu/pytest-137/test_setup_inputs0/to/the/base') 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-137/test_setup_inputs0') 392s with_package_base = 1 392s 392s tests/test_setup.py:849: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-137/test_setup_inputs0') 392s setup_args = ['build'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-137/test_setup_inputs0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s ________________________ test_setup_inputs[1-1-1-1-0-0] ________________________ 392s 392s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 1 392s has_pure_package = 1, has_pure_module = 1, with_package_base = 1 392s mocker = 392s 392s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 392s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 392s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_package", [0, 1]) 392s @pytest.mark.parametrize("has_pure_module", [0, 1]) 392s @pytest.mark.parametrize("with_package_base", [0, 1]) 392s def test_setup_inputs( 392s has_cmake_package, 392s has_cmake_module, 392s has_hybrid_package, 392s has_pure_package, 392s has_pure_module, 392s with_package_base, 392s mocker, 392s ): 392s """This test that a project can have a package with some modules 392s installed using setup.py and some other modules installed using CMake. 392s """ 392s 392s tmp_dir = _tmpdir("test_setup_inputs") 392s 392s package_base = "to/the/base" if with_package_base else "" 392s package_base_dir = package_base + "/" if package_base else "" 392s cmake_source_dir = package_base 392s 392s if cmake_source_dir and (has_cmake_package or has_cmake_module): 392s pytest.skip( 392s "unsupported configuration: " 392s "python package fully generated by CMake does *NOT* work. " 392s "At least __init__.py should be in the project source tree" 392s ) 392s 392s # ------------------------------------------------------------------------- 392s # Here is the "SOURCE" tree layout: 392s # 392s # ROOT/ 392s # 392s # setup.py 392s # 392s # [/] 392s # 392s # pureModule.py 392s # 392s # pure/ 392s # __init__.py 392s # pure.py 392s # 392s # data/ 392s # pure.dat 392s # 392s # [/] 392s # 392s # hybrid/ 392s # CMakeLists.txt 392s # __init__.py 392s # hybrid_pure.dat 392s # hybrid_pure.py 392s # 392s # data/ 392s # hybrid_data_pure.dat 392s # 392s # hybrid_2/ 392s # __init__.py 392s # hybrid_2_pure.py 392s # 392s # hybrid_2_pure/ 392s # __init__.py 392s # hybrid_2_pure_1.py 392s # hybrid_2_pure_2.py 392s # 392s # 392s # ------------------------------------------------------------------------- 392s # and here is the "BINARY" distribution layout: 392s # 392s # The comment "CMake" or "Setuptools" indicates which tool is responsible 392s # for placing the file in the tree used to create the binary distribution. 392s # 392s # ROOT/ 392s # 392s # cmakeModule.py # CMake 392s # 392s # cmake/ 392s # __init__.py # CMake 392s # cmake.py # CMake 392s # 392s # hybrid/ 392s # hybrid_cmake.dat # CMake 392s # hybrid_cmake.py # CMake 392s # hybrid_pure.dat # Setuptools 392s # hybrid_pure.py # Setuptools 392s # 392s # data/ 392s # hybrid_data_pure.dat # CMake or Setuptools 392s # hybrid_data_cmake.dat # CMake *NO TEST* 392s # 392s # hybrid_2/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure.py # CMake or Setuptools 392s # hybrid_2_cmake.py # CMake 392s # 392s # hybrid_2_pure/ 392s # __init__.py # CMake or Setuptools 392s # hybrid_2_pure_1.py # CMake or Setuptools 392s # hybrid_2_pure_2.py # CMake or Setuptools 392s # 392s # pureModule.py # Setuptools 392s # 392s # pure/ 392s # __init__.py # Setuptools 392s # pure.py # Setuptools 392s # 392s # data/ 392s # pure.dat # Setuptools 392s 392s tmp_dir.join("setup.py").write( 392s textwrap.dedent( 392s """ 392s from skbuild import setup 392s #from setuptools import setup 392s setup( 392s name="test_hybrid_project", 392s version="1.2.3", 392s description=("an hybrid package mixing files installed by both " 392s "CMake and setuptools"), 392s author='The scikit-build team', 392s license="MIT", 392s cmake_source_dir='{cmake_source_dir}', 392s cmake_install_dir='{cmake_install_dir}', 392s # Arbitrary order of packages 392s packages=[ 392s {p_off} 'pure', 392s {h_off} 'hybrid.hybrid_2', 392s {h_off} 'hybrid', 392s {c_off} 'cmake', 392s {p_off} 'hybrid.hybrid_2_pure', 392s ], 392s py_modules=[ 392s {pm_off} '{package_base}pureModule', 392s {cm_off} '{package_base}cmakeModule', 392s ], 392s package_data={{ 392s {p_off} 'pure': ['data/pure.dat'], 392s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 392s }}, 392s # Arbitrary order of package_dir 392s package_dir = {{ 392s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 392s {p_off} 'pure': '{package_base}pure', 392s {h_off} 'hybrid': '{package_base}hybrid', 392s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 392s {c_off} 'cmake': '{package_base}cmake', 392s }} 392s ) 392s """.format( 392s cmake_source_dir=cmake_source_dir, 392s cmake_install_dir=package_base, 392s package_base=package_base_dir, 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s p_off="" if has_pure_package else "#", 392s pm_off="" if has_pure_module else "#", 392s ) 392s ) 392s ) 392s 392s src_dir = tmp_dir.ensure(package_base, dir=1) 392s 392s src_dir.join("CMakeLists.txt").write( 392s textwrap.dedent( 392s """ 392s cmake_minimum_required(VERSION 3.5.0) 392s project(hybrid NONE) 392s set(build_dir ${{CMAKE_BINARY_DIR}}) 392s 392s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 392s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 392s {c_off} install( 392s {c_off} FILES 392s {c_off} ${{build_dir}}/__init__.py 392s {c_off} ${{build_dir}}/cmake.py 392s {c_off} DESTINATION cmake 392s {c_off} ) 392s 392s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 392s {cm_off} install( 392s {cm_off} FILES ${{build_dir}}/cmakeModule.py 392s {cm_off} DESTINATION .) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 392s {h_off} DESTINATION hybrid) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 392s {h_off} DESTINATION hybrid/data) 392s 392s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 392s {h_off} install( 392s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 392s {h_off} DESTINATION hybrid/hybrid_2) 392s 392s install(CODE "message(STATUS \\\"Installation complete\\\")") 392s """.format( 392s c_off="" if has_cmake_package else "#", 392s cm_off="" if has_cmake_module else "#", 392s h_off="" if has_hybrid_package else "#", 392s ) 392s ) 392s ) 392s 392s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 392s path_types: Sequence[str] 392s try: 392s path_types = next( 392s iter( 392s zip( 392s *filter( 392s lambda i: i[1], 392s [ 392s ("c", has_cmake_package), 392s ("cm", has_cmake_module), 392s ("h", has_hybrid_package), 392s ("p", has_pure_package), 392s ("pm", has_pure_module), 392s ], 392s ) 392s ) 392s ) 392s ) 392s except StopIteration: 392s path_types = [] 392s 392s def select_paths(annotated_paths): 392s """Return a filtered list paths considering ``path_types``. 392s 392s `annotated_paths`` is list of tuple ``(type, path)`` where type 392s is either `c`, 'cm', `h`, `p` or 'pm'. 392s 392s """ 392s return filter(lambda i: i[0] in path_types, annotated_paths) 392s 392s # Commented paths are the one expected to be installed by CMake. For 392s # this reason, corresponding files should NOT be created in the source 392s # tree. 392s for _type, path in select_paths( 392s [ 392s # ('c', 'cmake/__init__.py'), 392s # ('c', 'cmake/cmake.py'), 392s # ('cm', 'cmakeModule.py'), 392s ("h", "hybrid/__init__.py"), 392s # ('h', 'hybrid/hybrid_cmake.dat'), 392s # ('h', 'hybrid/hybrid_cmake.py'), 392s ("h", "hybrid/hybrid_pure.dat"), 392s ("h", "hybrid/hybrid_pure.py"), 392s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 392s ("h", "hybrid/data/hybrid_data_pure.dat"), 392s ("h", "hybrid/hybrid_2/__init__.py"), 392s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 392s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 392s ("p", "hybrid/hybrid_2_pure/__init__.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 392s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 392s ("pm", "pureModule.py"), 392s ("p", "pure/__init__.py"), 392s ("p", "pure/pure.py"), 392s ("p", "pure/data/pure.dat"), 392s ] 392s ): 392s assert _type in {"p", "pm", "h"} 392s root = package_base if _type in {"p", "pm"} else cmake_source_dir 392s tmp_dir.ensure(os.path.join(root, path)) 392s 392s # Do not call the real setup function. Instead, replace it with 392s # a MagicMock allowing to check with which arguments it was invoked. 392s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 392s 392s # Convenience print function 392s def _pprint(desc, value=None): 392s print( 392s "-----------------\n" 392s f"{desc}:\n" 392s "\n" 392s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 392s ) 392s 392s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 392s 392s _pprint = ._pprint at 0x7537df9b6700> 392s _type = 'p' 392s cmake_source_dir = 'to/the/base' 392s has_cmake_module = 0 392s has_cmake_package = 0 392s has_hybrid_package = 1 392s has_pure_module = 1 392s has_pure_package = 1 392s mock_setup = 392s mocker = 392s package_base = 'to/the/base' 392s package_base_dir = 'to/the/base/' 392s path = 'pure/data/pure.dat' 392s path_types = ('h', 'p', 'pm') 392s root = 'to/the/base' 392s select_paths = .select_paths at 0x7537df9b6200> 392s src_dir = local('/tmp/pytest-of-ubuntu/pytest-141/test_setup_inputs0/to/the/base') 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-141/test_setup_inputs0') 392s with_package_base = 1 392s 392s tests/test_setup.py:849: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-141/test_setup_inputs0') 392s setup_args = ['build'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-141/test_setup_inputs0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s ___________________ test_cmake_install_into_pure_package[0] ____________________ 392s 392s with_cmake_source_dir = 0 392s capsys = <_pytest.capture.CaptureFixture object at 0x7537df94aab0> 392s caplog = <_pytest.logging.LogCaptureFixture object at 0x7537df9495b0> 392s 392s @pytest.mark.parametrize("with_cmake_source_dir", [0, 1]) 392s def test_cmake_install_into_pure_package(with_cmake_source_dir, capsys, caplog): 392s # ------------------------------------------------------------------------- 392s # "SOURCE" tree layout: 392s # 392s # (1) with_cmake_source_dir == 0 392s # 392s # ROOT/ 392s # 392s # CMakeLists.txt 392s # setup.py 392s # 392s # fruits/ 392s # __init__.py 392s # 392s # 392s # (2) with_cmake_source_dir == 1 392s # 392s # ROOT/ 392s # 392s # setup.py 392s # 392s # fruits/ 392s # __init__.py 392s # 392s # src/ 392s # 392s # CMakeLists.txt 392s # 392s # ------------------------------------------------------------------------- 392s # "BINARY" distribution layout: 392s # 392s # ROOT/ 392s # 392s # fruits/ 392s # 392s # __init__.py 392s # apple.py 392s # banana.py 392s # 392s # data/ 392s # 392s # apple.dat 392s # banana.dat 392s # 392s 392s tmp_dir = _tmpdir("cmake_install_into_pure_package") 392s 392s cmake_source_dir = "src" if with_cmake_source_dir else "" 392s 392s tmp_dir.join("setup.py").write( 392s textwrap.dedent( 392s f""" 392s from skbuild import setup 392s setup( 392s name="test_py_modules_keyword", 392s version="1.2.3", 392s description="a package testing use of py_modules keyword", 392s author='The scikit-build team', 392s license="MIT", 392s packages=['fruits'], 392s cmake_install_dir='fruits', 392s cmake_source_dir='{cmake_source_dir}', 392s ) 392s """ 392s ) 392s ) 392s 392s cmake_src_dir = tmp_dir.ensure(cmake_source_dir, dir=1) 392s cmake_src_dir.join("CMakeLists.txt").write( 392s textwrap.dedent( 392s """ 392s cmake_minimum_required(VERSION 3.5.0) 392s project(test NONE) 392s file(WRITE "${CMAKE_BINARY_DIR}/apple.py" "# apple.py") 392s file(WRITE "${CMAKE_BINARY_DIR}/banana.py" "# banana.py") 392s install( 392s FILES 392s "${CMAKE_BINARY_DIR}/apple.py" 392s "${CMAKE_BINARY_DIR}/banana.py" 392s DESTINATION "." 392s ) 392s file(WRITE "${CMAKE_BINARY_DIR}/apple.dat" "# apple.dat") 392s file(WRITE "${CMAKE_BINARY_DIR}/banana.dat" "# banana.dat") 392s install( 392s FILES 392s "${CMAKE_BINARY_DIR}/apple.dat" 392s "${CMAKE_BINARY_DIR}/banana.dat" 392s DESTINATION "data" 392s ) 392s """ 392s ) 392s ) 392s 392s tmp_dir.ensure("fruits/__init__.py") 392s 392s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 392s 392s caplog = <_pytest.logging.LogCaptureFixture object at 0x7537df9495b0> 392s capsys = <_pytest.capture.CaptureFixture object at 0x7537df94aab0> 392s cmake_source_dir = '' 392s cmake_src_dir = local('/tmp/pytest-of-ubuntu/pytest-145/cmake_install_into_pure_packag0') 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-145/cmake_install_into_pure_packag0') 392s with_cmake_source_dir = 0 392s 392s tests/test_setup.py:1031: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-145/cmake_install_into_pure_packag0') 392s setup_args = ['build'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-145/cmake_install_into_pure_packag0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s ___________________ test_cmake_install_into_pure_package[1] ____________________ 392s 392s with_cmake_source_dir = 1 392s capsys = <_pytest.capture.CaptureFixture object at 0x7537df94bef0> 392s caplog = <_pytest.logging.LogCaptureFixture object at 0x7537df948200> 392s 392s @pytest.mark.parametrize("with_cmake_source_dir", [0, 1]) 392s def test_cmake_install_into_pure_package(with_cmake_source_dir, capsys, caplog): 392s # ------------------------------------------------------------------------- 392s # "SOURCE" tree layout: 392s # 392s # (1) with_cmake_source_dir == 0 392s # 392s # ROOT/ 392s # 392s # CMakeLists.txt 392s # setup.py 392s # 392s # fruits/ 392s # __init__.py 392s # 392s # 392s # (2) with_cmake_source_dir == 1 392s # 392s # ROOT/ 392s # 392s # setup.py 392s # 392s # fruits/ 392s # __init__.py 392s # 392s # src/ 392s # 392s # CMakeLists.txt 392s # 392s # ------------------------------------------------------------------------- 392s # "BINARY" distribution layout: 392s # 392s # ROOT/ 392s # 392s # fruits/ 392s # 392s # __init__.py 392s # apple.py 392s # banana.py 392s # 392s # data/ 392s # 392s # apple.dat 392s # banana.dat 392s # 392s 392s tmp_dir = _tmpdir("cmake_install_into_pure_package") 392s 392s cmake_source_dir = "src" if with_cmake_source_dir else "" 392s 392s tmp_dir.join("setup.py").write( 392s textwrap.dedent( 392s f""" 392s from skbuild import setup 392s setup( 392s name="test_py_modules_keyword", 392s version="1.2.3", 392s description="a package testing use of py_modules keyword", 392s author='The scikit-build team', 392s license="MIT", 392s packages=['fruits'], 392s cmake_install_dir='fruits', 392s cmake_source_dir='{cmake_source_dir}', 392s ) 392s """ 392s ) 392s ) 392s 392s cmake_src_dir = tmp_dir.ensure(cmake_source_dir, dir=1) 392s cmake_src_dir.join("CMakeLists.txt").write( 392s textwrap.dedent( 392s """ 392s cmake_minimum_required(VERSION 3.5.0) 392s project(test NONE) 392s file(WRITE "${CMAKE_BINARY_DIR}/apple.py" "# apple.py") 392s file(WRITE "${CMAKE_BINARY_DIR}/banana.py" "# banana.py") 392s install( 392s FILES 392s "${CMAKE_BINARY_DIR}/apple.py" 392s "${CMAKE_BINARY_DIR}/banana.py" 392s DESTINATION "." 392s ) 392s file(WRITE "${CMAKE_BINARY_DIR}/apple.dat" "# apple.dat") 392s file(WRITE "${CMAKE_BINARY_DIR}/banana.dat" "# banana.dat") 392s install( 392s FILES 392s "${CMAKE_BINARY_DIR}/apple.dat" 392s "${CMAKE_BINARY_DIR}/banana.dat" 392s DESTINATION "data" 392s ) 392s """ 392s ) 392s ) 392s 392s tmp_dir.ensure("fruits/__init__.py") 392s 392s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 392s 392s caplog = <_pytest.logging.LogCaptureFixture object at 0x7537df948200> 392s capsys = <_pytest.capture.CaptureFixture object at 0x7537df94bef0> 392s cmake_source_dir = 'src' 392s cmake_src_dir = local('/tmp/pytest-of-ubuntu/pytest-146/cmake_install_into_pure_packag0/src') 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-146/cmake_install_into_pure_packag0') 392s with_cmake_source_dir = 1 392s 392s tests/test_setup.py:1031: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-146/cmake_install_into_pure_packag0') 392s setup_args = ['build'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-146/cmake_install_into_pure_packag0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s _________________________ test_zip_safe_default[None] __________________________ 392s 392s zip_safe = None 392s mocker = 392s 392s @pytest.mark.parametrize("zip_safe", [None, False, True]) 392s def test_zip_safe_default(zip_safe, mocker): 392s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 392s 392s tmp_dir = _tmpdir("zip_safe_default") 392s 392s setup_kwarg = "" 392s if zip_safe is not None: 392s setup_kwarg = f"zip_safe={zip_safe}" 392s 392s tmp_dir.join("setup.py").write( 392s textwrap.dedent( 392s f""" 392s from skbuild import setup 392s setup( 392s name="zip_safe_default", 392s version="1.2.3", 392s description="a minimal example package", 392s author='The scikit-build team', 392s license="MIT", 392s {setup_kwarg} 392s ) 392s """ 392s ) 392s ) 392s tmp_dir.join("CMakeLists.txt").write( 392s textwrap.dedent( 392s """ 392s cmake_minimum_required(VERSION 3.5.0) 392s project(test NONE) 392s install(CODE "execute_process( 392s COMMAND \\${CMAKE_COMMAND} -E sleep 0)") 392s """ 392s ) 392s ) 392s 392s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 392s 392s mock_setup = 392s mocker = 392s setup_kwarg = '' 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-147/zip_safe_default0') 392s zip_safe = None 392s 392s tests/test_setup.py:1087: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-147/zip_safe_default0') 392s setup_args = ['build'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-147/zip_safe_default0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s _________________________ test_zip_safe_default[False] _________________________ 392s 392s zip_safe = False 392s mocker = 392s 392s @pytest.mark.parametrize("zip_safe", [None, False, True]) 392s def test_zip_safe_default(zip_safe, mocker): 392s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 392s 392s tmp_dir = _tmpdir("zip_safe_default") 392s 392s setup_kwarg = "" 392s if zip_safe is not None: 392s setup_kwarg = f"zip_safe={zip_safe}" 392s 392s tmp_dir.join("setup.py").write( 392s textwrap.dedent( 392s f""" 392s from skbuild import setup 392s setup( 392s name="zip_safe_default", 392s version="1.2.3", 392s description="a minimal example package", 392s author='The scikit-build team', 392s license="MIT", 392s {setup_kwarg} 392s ) 392s """ 392s ) 392s ) 392s tmp_dir.join("CMakeLists.txt").write( 392s textwrap.dedent( 392s """ 392s cmake_minimum_required(VERSION 3.5.0) 392s project(test NONE) 392s install(CODE "execute_process( 392s COMMAND \\${CMAKE_COMMAND} -E sleep 0)") 392s """ 392s ) 392s ) 392s 392s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 392s 392s mock_setup = 392s mocker = 392s setup_kwarg = 'zip_safe=False' 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-148/zip_safe_default0') 392s zip_safe = False 392s 392s tests/test_setup.py:1087: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-148/zip_safe_default0') 392s setup_args = ['build'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-148/zip_safe_default0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s _________________________ test_zip_safe_default[True] __________________________ 392s 392s zip_safe = True 392s mocker = 392s 392s @pytest.mark.parametrize("zip_safe", [None, False, True]) 392s def test_zip_safe_default(zip_safe, mocker): 392s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 392s 392s tmp_dir = _tmpdir("zip_safe_default") 392s 392s setup_kwarg = "" 392s if zip_safe is not None: 392s setup_kwarg = f"zip_safe={zip_safe}" 392s 392s tmp_dir.join("setup.py").write( 392s textwrap.dedent( 392s f""" 392s from skbuild import setup 392s setup( 392s name="zip_safe_default", 392s version="1.2.3", 392s description="a minimal example package", 392s author='The scikit-build team', 392s license="MIT", 392s {setup_kwarg} 392s ) 392s """ 392s ) 392s ) 392s tmp_dir.join("CMakeLists.txt").write( 392s textwrap.dedent( 392s """ 392s cmake_minimum_required(VERSION 3.5.0) 392s project(test NONE) 392s install(CODE "execute_process( 392s COMMAND \\${CMAKE_COMMAND} -E sleep 0)") 392s """ 392s ) 392s ) 392s 392s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 392s 392s mock_setup = 392s mocker = 392s setup_kwarg = 'zip_safe=True' 392s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-149/zip_safe_default0') 392s zip_safe = True 392s 392s tests/test_setup.py:1087: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-149/zip_safe_default0') 392s setup_args = ['build'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-149/zip_safe_default0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s _____________________ test_generator[Unix Makefiles-make] ______________________ 392s 392s generator = 'Unix Makefiles', expected_make_program = 'make' 392s 392s @pytest.mark.parametrize( 392s ("generator", "expected_make_program"), [("NMake Makefiles", "nmake"), ("Unix Makefiles", "make")] 392s ) 392s def test_generator(generator, expected_make_program): 392s generator_platform = {"NMake Makefiles": ["windows"], "Unix Makefiles": ["darwin", "linux"]} 392s assert generator in generator_platform 392s 392s this_platform = platform.system().lower() 392s if this_platform not in generator_platform[generator]: 392s pytest.skip(f"{generator} generator is not available on {this_platform.title()}") 392s 392s if shutil.which(expected_make_program) is None: 392s pytest.skip(f"{expected_make_program} not available") 392s 392s @project_setup_py_test("hello-cpp", ["build"], ret=True) 392s def run_build(): 392s pass 392s 392s with push_env(CMAKE_GENERATOR=generator): 392s > tmp_dir = run_build()[0] 392s 392s expected_make_program = 'make' 392s generator = 'Unix Makefiles' 392s generator_platform = {'NMake Makefiles': ['windows'], 'Unix Makefiles': ['darwin', 'linux']} 392s run_build = .run_build at 0x7537df9b6e80> 392s this_platform = 'linux' 392s 392s tests/test_skbuild.py:94: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s tests/__init__.py:255: in wrapped 392s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 392s disable_languages_test = False 392s fun = .run_build at 0x7537df9b53a0> 392s iargs = () 392s ikwargs = {} 392s ret = True 392s wrapped = .run_build at 0x7537df9b6e80> 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-150/run_build0') 392s setup_args = ['build'], disable_languages_test = False 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = False 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-150/run_build0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s ----------------------------- Captured stdout call ----------------------------- 392s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-150/run_build0/.git/ 392s [master (root-commit) 2503f57] Initial commit 392s 11 files changed, 115 insertions(+) 392s create mode 100644 CMakeLists.txt 392s create mode 100644 bonjour/__init__.py 392s create mode 100644 bonjour/data/ciel.txt 392s create mode 100644 bonjour/data/soleil.txt 392s create mode 100644 bonjour/data/terre.txt 392s create mode 100644 bonjourModule.py 392s create mode 100644 hello/CMakeLists.txt 392s create mode 100644 hello/__init__.py 392s create mode 100644 hello/__main__.py 392s create mode 100644 hello/_hello.cxx 392s create mode 100644 setup.py 392s ----------------------------- Captured stderr call ----------------------------- 392s hint: Using 'master' as the name for the initial branch. This default branch name 392s hint: is subject to change. To configure the initial branch name to use in all 392s hint: of your new repositories, which will suppress this warning, call: 392s hint: 392s hint: git config --global init.defaultBranch 392s hint: 392s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 392s hint: 'development'. The just-created branch can be renamed via this command: 392s hint: 392s hint: git branch -m 392s ___________________ test_invalid_generator[generator_args0] ____________________ 392s 392s generator_args = ['-G', 'invalid'] 392s 392s @pytest.mark.parametrize( 392s "generator_args", 392s [ 392s ["-G", "invalid"], 392s ["--", "-G", "invalid"], 392s ], 392s ) 392s def test_invalid_generator(generator_args): 392s with push_dir(): 392s build_args = ["build"] 392s build_args.extend(generator_args) 392s 392s @project_setup_py_test("hello-no-language", build_args, disable_languages_test=True) 392s def run(): 392s pass 392s 392s failed = False 392s message = "" 392s try: 392s > run() 392s 392s build_args = ['build', '-G', 'invalid'] 392s failed = False 392s generator_args = ['-G', 'invalid'] 392s message = '' 392s run = .run at 0x7537df9b71a0> 392s 392s tests/test_skbuild.py:121: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s tests/__init__.py:255: in wrapped 392s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 392s disable_languages_test = True 392s fun = .run at 0x7537df9b4680> 392s iargs = () 392s ikwargs = {} 392s ret = False 392s wrapped = .run at 0x7537df9b71a0> 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-151/run0') 392s setup_args = ['build', '-G', 'invalid'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-151/run0') 392s setup_args = ['build', '-G', 'invalid'] 392s 392s tests/__init__.py:218: AttributeError 392s ----------------------------- Captured stdout call ----------------------------- 392s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-151/run0/.git/ 392s [master (root-commit) 5706ee1] Initial commit 392s 2 files changed, 16 insertions(+) 392s create mode 100644 CMakeLists.txt 392s create mode 100644 setup.py 392s ----------------------------- Captured stderr call ----------------------------- 392s hint: Using 'master' as the name for the initial branch. This default branch name 392s hint: is subject to change. To configure the initial branch name to use in all 392s hint: of your new repositories, which will suppress this warning, call: 392s hint: 392s hint: git config --global init.defaultBranch 392s hint: 392s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 392s hint: 'development'. The just-created branch can be renamed via this command: 392s hint: 392s hint: git branch -m 392s ___________________ test_invalid_generator[generator_args1] ____________________ 392s 392s generator_args = ['--', '-G', 'invalid'] 392s 392s @pytest.mark.parametrize( 392s "generator_args", 392s [ 392s ["-G", "invalid"], 392s ["--", "-G", "invalid"], 392s ], 392s ) 392s def test_invalid_generator(generator_args): 392s with push_dir(): 392s build_args = ["build"] 392s build_args.extend(generator_args) 392s 392s @project_setup_py_test("hello-no-language", build_args, disable_languages_test=True) 392s def run(): 392s pass 392s 392s failed = False 392s message = "" 392s try: 392s > run() 392s 392s build_args = ['build', '--', '-G', 'invalid'] 392s failed = False 392s generator_args = ['--', '-G', 'invalid'] 392s message = '' 392s run = .run at 0x7537df9b7740> 392s 392s tests/test_skbuild.py:121: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s tests/__init__.py:255: in wrapped 392s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 392s disable_languages_test = True 392s fun = .run at 0x7537df9b7600> 392s iargs = () 392s ikwargs = {} 392s ret = False 392s wrapped = .run at 0x7537df9b7740> 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-152/run0') 392s setup_args = ['build', '--', '-G', 'invalid'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-152/run0') 392s setup_args = ['build', '--', '-G', 'invalid'] 392s 392s tests/__init__.py:218: AttributeError 392s ----------------------------- Captured stdout call ----------------------------- 392s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-152/run0/.git/ 392s [master (root-commit) 5706ee1] Initial commit 392s 2 files changed, 16 insertions(+) 392s create mode 100644 CMakeLists.txt 392s create mode 100644 setup.py 392s ----------------------------- Captured stderr call ----------------------------- 392s hint: Using 'master' as the name for the initial branch. This default branch name 392s hint: is subject to change. To configure the initial branch name to use in all 392s hint: of your new repositories, which will suppress this warning, call: 392s hint: 392s hint: git config --global init.defaultBranch 392s hint: 392s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 392s hint: 'development'. The just-created branch can be renamed via this command: 392s hint: 392s hint: git branch -m 392s _________________________ test_skbuild_variable_builds _________________________ 392s 392s iargs = (), ikwargs = {} 392s 392s @functools.wraps(fun) 392s def wrapped(*iargs, **ikwargs): 392s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 392s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 392s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 392s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 392s 392s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 392s 392s disable_languages_test = True 392s fun = 392s iargs = () 392s ikwargs = {} 392s ret = False 392s wrapped = 392s 392s tests/__init__.py:255: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-153/test_skbuild_variable_builds0') 392s setup_args = ['build'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-153/test_skbuild_variable_builds0') 392s setup_args = ['build'] 392s 392s tests/__init__.py:218: AttributeError 392s ----------------------------- Captured stdout call ----------------------------- 392s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-153/test_skbuild_variable_builds0/.git/ 392s [master (root-commit) fb95557] Initial commit 392s 2 files changed, 20 insertions(+) 392s create mode 100644 CMakeLists.txt 392s create mode 100644 setup.py 392s ----------------------------- Captured stderr call ----------------------------- 392s hint: Using 'master' as the name for the initial branch. This default branch name 392s hint: is subject to change. To configure the initial branch name to use in all 392s hint: of your new repositories, which will suppress this warning, call: 392s hint: 392s hint: git config --global init.defaultBranch 392s hint: 392s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 392s hint: 'development'. The just-created branch can be renamed via this command: 392s hint: 392s hint: git branch -m 392s _________________________ test_skbuild_variable_sdist __________________________ 392s 392s iargs = (), ikwargs = {} 392s 392s @functools.wraps(fun) 392s def wrapped(*iargs, **ikwargs): 392s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 392s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 392s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 392s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 392s 392s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 392s 392s disable_languages_test = True 392s fun = 392s iargs = () 392s ikwargs = {} 392s ret = False 392s wrapped = 392s 392s tests/__init__.py:255: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-154/test_skbuild_variable_sdist0') 392s setup_args = ['sdist'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-154/test_skbuild_variable_sdist0') 392s setup_args = ['sdist'] 392s 392s tests/__init__.py:218: AttributeError 392s ----------------------------- Captured stdout call ----------------------------- 392s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-154/test_skbuild_variable_sdist0/.git/ 392s [master (root-commit) fb95557] Initial commit 392s 2 files changed, 20 insertions(+) 392s create mode 100644 CMakeLists.txt 392s create mode 100644 setup.py 392s ----------------------------- Captured stderr call ----------------------------- 392s hint: Using 'master' as the name for the initial branch. This default branch name 392s hint: is subject to change. To configure the initial branch name to use in all 392s hint: of your new repositories, which will suppress this warning, call: 392s hint: 392s hint: git config --global init.defaultBranch 392s hint: 392s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 392s hint: 'development'. The just-created branch can be renamed via this command: 392s hint: 392s hint: git branch -m 392s _________________________ test_skbuild_variable_wheel __________________________ 392s 392s iargs = (), ikwargs = {} 392s 392s @functools.wraps(fun) 392s def wrapped(*iargs, **ikwargs): 392s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 392s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 392s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 392s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 392s 392s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 392s 392s disable_languages_test = True 392s fun = 392s iargs = () 392s ikwargs = {} 392s ret = False 392s wrapped = 392s 392s tests/__init__.py:255: 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s /usr/lib/python3.12/contextlib.py:137: in __enter__ 392s return next(self.gen) 392s self = 392s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 392s 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-155/test_skbuild_variable_wheel0') 392s setup_args = ['bdist_wheel'], disable_languages_test = True 392s 392s @contextmanager 392s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 392s """Context manager executing ``setup.py`` with the given arguments. 392s 392s It yields after changing the current working directory 392s to ``project_dir``. 392s """ 392s 392s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 392s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 392s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 392s 392s disable_languages_test = True 392s project_dir = local('/tmp/pytest-of-ubuntu/pytest-155/test_skbuild_variable_wheel0') 392s setup_args = ['bdist_wheel'] 392s 392s tests/__init__.py:218: AttributeError 392s ----------------------------- Captured stdout call ----------------------------- 392s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-155/test_skbuild_variable_wheel0/.git/ 392s [master (root-commit) fb95557] Initial commit 392s 2 files changed, 20 insertions(+) 392s create mode 100644 CMakeLists.txt 392s create mode 100644 setup.py 392s ----------------------------- Captured stderr call ----------------------------- 392s hint: Using 'master' as the name for the initial branch. This default branch name 392s hint: is subject to change. To configure the initial branch name to use in all 392s hint: of your new repositories, which will suppress this warning, call: 392s hint: 392s hint: git config --global init.defaultBranch 392s hint: 392s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 392s hint: 'development'. The just-created branch can be renamed via this command: 392s hint: 392s hint: git branch -m 392s =========================== short test summary info ============================ 392s SKIPPED [1] tests/test_hello_fortran.py:19: could not import 'numpy': No module named 'numpy' 392s SKIPPED [1] tests/test_platform.py:120: Requires Windows 392s SKIPPED [1] tests/test_setup.py:319: pypi.org website not reachable 392s 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 392s SKIPPED [1] tests/test_skbuild.py:84: NMake Makefiles generator is not available on Linux 392s SKIPPED [3] tests/test_skbuild.py:130: Requires Windows 392s SKIPPED [1] tests/test_skbuild.py:154: Requires Windows 392s FAILED tests/test_broken_project.py::test_cmakelists_with_fatalerror_fails - ... 392s FAILED tests/test_broken_project.py::test_cmakelists_with_syntaxerror_fails 392s FAILED tests/test_broken_project.py::test_hello_with_compileerror_fails - Att... 392s FAILED tests/test_broken_project.py::test_invalid_cmake[CalledProcessError] 392s FAILED tests/test_broken_project.py::test_invalid_cmake[OSError] - AttributeE... 392s FAILED tests/test_broken_project.py::test_first_invalid_generator - Attribute... 392s FAILED tests/test_broken_project.py::test_invalid_generator - AttributeError:... 392s FAILED tests/test_cmake_target.py::test_cmake_target_build - AttributeError: ... 392s FAILED tests/test_cmakelists_not_in_top_level_dir.py::test_build - AttributeE... 392s FAILED tests/test_cmakelists_not_in_top_level_dir.py::test_cmake_source_dir[invalid-True] 392s FAILED tests/test_cmakelists_not_in_top_level_dir.py::test_cmake_source_dir[-False] 392s FAILED tests/test_cmakelists_not_in_top_level_dir.py::test_cmake_source_dir[.-False] 392s FAILED tests/test_command_line.py::test_help - AttributeError: module 'distut... 392s FAILED tests/test_command_line.py::test_metadata_display - AttributeError: mo... 392s FAILED tests/test_command_line.py::test_no_command - AttributeError: module '... 392s FAILED tests/test_command_line.py::test_invalid_command - AttributeError: mod... 392s FAILED tests/test_command_line.py::test_too_many_separators - AttributeError:... 392s FAILED tests/test_command_line.py::test_cmake_initial_cache_as_global_option 392s FAILED tests/test_command_line.py::test_cmake_executable_arg - AttributeError... 392s FAILED tests/test_command_line.py::test_hide_listing[True-sdist] - AttributeE... 392s FAILED tests/test_command_line.py::test_hide_listing[True-bdist_wheel] - Attr... 392s FAILED tests/test_command_line.py::test_hide_listing[False-sdist] - Attribute... 392s FAILED tests/test_command_line.py::test_hide_listing[False-bdist_wheel] - Att... 392s FAILED tests/test_command_line.py::test_run_cmake_arg - AttributeError: modul... 392s FAILED tests/test_command_line.py::test_skip_cmake_arg - AttributeError: modu... 392s FAILED tests/test_cython_flags.py::test_hello_cython_builds - AttributeError:... 392s FAILED tests/test_filter_manifest.py::test_bdist_wheel_command - AttributeErr... 392s FAILED tests/test_hello_cpp.py::test_hello_builds - AttributeError: module 'd... 392s FAILED tests/test_hello_cpp.py::test_hello_wheel - AttributeError: module 'di... 392s FAILED tests/test_hello_cpp.py::test_hello_clean[with-dry-run] - AttributeErr... 392s FAILED tests/test_hello_cpp.py::test_hello_clean[without-dry-run] - Attribute... 392s FAILED tests/test_hello_cpp.py::test_hello_cleans - AttributeError: module 'd... 392s FAILED tests/test_hello_cython.py::test_hello_cython_builds - AttributeError:... 392s FAILED tests/test_hello_cython.py::test_hello_cython_sdist - AttributeError: ... 392s FAILED tests/test_hello_cython.py::test_hello_cython_wheel - AttributeError: ... 392s FAILED tests/test_hello_pure.py::test_hello_pure_builds - AttributeError: mod... 392s FAILED tests/test_hello_pure.py::test_hello_pure_sdist - AttributeError: modu... 392s FAILED tests/test_hello_pure.py::test_hello_pure_wheel - AttributeError: modu... 392s FAILED tests/test_hello_pure.py::test_hello_clean - AttributeError: module 'd... 392s FAILED tests/test_include_exclude_data.py::test_include_exclude_data - Attrib... 392s FAILED tests/test_include_exclude_data.py::test_include_exclude_data_with_base 392s FAILED tests/test_issue284_build_ext_inplace.py::test_build_ext_inplace_command 392s FAILED tests/test_issue335_support_cmake_source_dir.py::test_bdist_wheel_command 392s 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] 392s 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] 392s 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] 392s 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] 392s 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] 392s 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] 392s 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] 392s 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] 392s 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] 392s FAILED tests/test_issue352_isolated_environment_support.py::test_isolated_env_trigger_reconfigure 392s FAILED tests/test_issue668_symbol_visibility.py::test_symbol_visibility[ON] 392s FAILED tests/test_issue668_symbol_visibility.py::test_symbol_visibility[OFF] 392s FAILED tests/test_manifest_in.py::test_manifest_in_wheel - AttributeError: mo... 392s FAILED tests/test_outside_project_root.py::test_outside_project_root_fails[None] 392s FAILED tests/test_outside_project_root.py::test_outside_project_root_fails[-DINSTALL_FILE:BOOL=1] 392s FAILED tests/test_outside_project_root.py::test_outside_project_root_fails[-DINSTALL_PROJECT:BOOL=1] 392s FAILED tests/test_setup.py::test_cmake_args_keyword[cmake_args0] - AttributeE... 392s FAILED tests/test_setup.py::test_cmake_args_keyword[cmake_args1] - AttributeE... 392s FAILED tests/test_setup.py::test_cmake_install_dir_keyword[None-True-str] - A... 392s FAILED tests/test_setup.py::test_cmake_install_dir_keyword[-True-str] - Attri... 392s FAILED tests/test_setup.py::test_cmake_install_dir_keyword[/tmp/scikit-build-True-SKBuildError] 392s FAILED tests/test_setup.py::test_cmake_install_dir_keyword[banana-False-str] 392s FAILED tests/test_setup.py::test_cmake_with_sdist_keyword[True] - AttributeEr... 392s FAILED tests/test_setup.py::test_cmake_with_sdist_keyword[False] - AttributeE... 392s FAILED tests/test_setup.py::test_cmake_minimum_required_version_keyword - Att... 392s FAILED tests/test_setup.py::test_script_keyword[pure] - AttributeError: modul... 392s FAILED tests/test_setup.py::test_script_keyword[skbuild] - AttributeError: mo... 392s FAILED tests/test_setup.py::test_py_modules_keyword[pure] - AttributeError: m... 392s FAILED tests/test_setup.py::test_py_modules_keyword[skbuild] - AttributeError... 392s FAILED tests/test_setup.py::test_setup_inputs[0-0-0-0-0-0] - AttributeError: ... 392s FAILED tests/test_setup.py::test_setup_inputs[0-0-0-0-0-1] - AttributeError: ... 392s FAILED tests/test_setup.py::test_setup_inputs[0-0-0-0-1-0] - AttributeError: ... 392s FAILED tests/test_setup.py::test_setup_inputs[0-0-0-0-1-1] - AttributeError: ... 392s FAILED tests/test_setup.py::test_setup_inputs[0-0-0-1-0-0] - AttributeError: ... 392s FAILED tests/test_setup.py::test_setup_inputs[0-0-0-1-0-1] - AttributeError: ... 392s FAILED tests/test_setup.py::test_setup_inputs[0-0-0-1-1-0] - AttributeError: ... 392s FAILED tests/test_setup.py::test_setup_inputs[0-0-0-1-1-1] - AttributeError: ... 392s FAILED tests/test_setup.py::test_setup_inputs[0-0-1-0-0-0] - AttributeError: ... 392s FAILED tests/test_setup.py::test_setup_inputs[0-0-1-0-0-1] - AttributeError: ... 392s FAILED tests/test_setup.py::test_setup_inputs[0-0-1-0-1-0] - AttributeError: ... 392s FAILED tests/test_setup.py::test_setup_inputs[0-0-1-0-1-1] - AttributeError: ... 392s FAILED tests/test_setup.py::test_setup_inputs[0-0-1-1-0-0] - AttributeError: ... 392s FAILED tests/test_setup.py::test_setup_inputs[0-0-1-1-0-1] - AttributeError: ... 392s FAILED tests/test_setup.py::test_setup_inputs[0-0-1-1-1-0] - AttributeError: ... 392s FAILED tests/test_setup.py::test_setup_inputs[0-0-1-1-1-1] - AttributeError: ... 392s FAILED tests/test_setup.py::test_setup_inputs[0-1-0-0-0-0] - AttributeError: ... 392s FAILED tests/test_setup.py::test_setup_inputs[0-1-0-0-0-1] - AttributeError: ... 392s FAILED tests/test_setup.py::test_setup_inputs[0-1-0-0-1-0] - AttributeError: ... 392s FAILED tests/test_setup.py::test_setup_inputs[0-1-0-0-1-1] - AttributeError: ... 392s FAILED tests/test_setup.py::test_setup_inputs[0-1-0-1-0-0] - AttributeError: ... 392s FAILED tests/test_setup.py::test_setup_inputs[0-1-0-1-0-1] - AttributeError: ... 392s FAILED tests/test_setup.py::test_setup_inputs[0-1-0-1-1-0] - AttributeError: ... 392s FAILED tests/test_setup.py::test_setup_inputs[0-1-0-1-1-1] - AttributeError: ... 392s FAILED tests/test_setup.py::test_setup_inputs[0-1-1-0-0-0] - AttributeError: ... 392s FAILED tests/test_setup.py::test_setup_inputs[0-1-1-0-0-1] - AttributeError: ... 392s FAILED tests/test_setup.py::test_setup_inputs[0-1-1-0-1-0] - AttributeError: ... 392s FAILED tests/test_setup.py::test_setup_inputs[0-1-1-0-1-1] - AttributeError: ... 392s FAILED tests/test_setup.py::test_setup_inputs[0-1-1-1-0-0] - AttributeError: ... 392s FAILED tests/test_setup.py::test_setup_inputs[0-1-1-1-0-1] - AttributeError: ... 392s FAILED tests/test_setup.py::test_setup_inputs[0-1-1-1-1-0] - AttributeError: ... 392s FAILED tests/test_setup.py::test_setup_inputs[0-1-1-1-1-1] - AttributeError: ... 392s FAILED tests/test_setup.py::test_setup_inputs[1-0-0-0-0-0] - AttributeError: ... 392s FAILED tests/test_setup.py::test_setup_inputs[1-0-0-1-0-0] - AttributeError: ... 392s FAILED tests/test_setup.py::test_setup_inputs[1-0-1-0-0-0] - AttributeError: ... 392s FAILED tests/test_setup.py::test_setup_inputs[1-0-1-1-0-0] - AttributeError: ... 392s FAILED tests/test_setup.py::test_setup_inputs[1-1-0-0-0-0] - AttributeError: ... 392s FAILED tests/test_setup.py::test_setup_inputs[1-1-0-1-0-0] - AttributeError: ... 392s FAILED tests/test_setup.py::test_setup_inputs[1-1-1-0-0-0] - AttributeError: ... 392s FAILED tests/test_setup.py::test_setup_inputs[1-1-1-1-0-0] - AttributeError: ... 392s FAILED tests/test_setup.py::test_cmake_install_into_pure_package[0] - Attribu... 392s FAILED tests/test_setup.py::test_cmake_install_into_pure_package[1] - Attribu... 392s FAILED tests/test_setup.py::test_zip_safe_default[None] - AttributeError: mod... 392s FAILED tests/test_setup.py::test_zip_safe_default[False] - AttributeError: mo... 392s FAILED tests/test_setup.py::test_zip_safe_default[True] - AttributeError: mod... 392s FAILED tests/test_skbuild.py::test_generator[Unix Makefiles-make] - Attribute... 392s FAILED tests/test_skbuild.py::test_invalid_generator[generator_args0] - Attri... 392s FAILED tests/test_skbuild.py::test_invalid_generator[generator_args1] - Attri... 392s FAILED tests/test_skbuild_variable.py::test_skbuild_variable_builds - Attribu... 392s FAILED tests/test_skbuild_variable.py::test_skbuild_variable_sdist - Attribut... 392s FAILED tests/test_skbuild_variable.py::test_skbuild_variable_wheel - Attribut... 392s ========== 123 failed, 67 passed, 32 skipped, 17 deselected in 8.42s =========== 392s autopkgtest [16:05:30]: test testsuite: -----------------------] 393s testsuite FAIL non-zero exit status 1 393s autopkgtest [16:05:31]: test testsuite: - - - - - - - - - - results - - - - - - - - - - 393s autopkgtest [16:05:31]: @@@@@@@@@@@@@@@@@@@@ summary 393s testsuite FAIL non-zero exit status 1 398s virt: nova [W] Skipping flock for amd64 398s virt: Creating nova instance adt-plucky-amd64-scikit-build-20241112-155858-juju-7f2275-prod-proposed-migration-environment-2-11bb3aa1-d7d2-46ed-b341-4e1322a47b7a from image adt/ubuntu-plucky-amd64-server-20241112.img (UUID ffe5c62a-46f4-4ffb-a07e-3a95d5bf45c0)... 398s virt: nova [W] nova quota exceeded (attempt #0)