0s autopkgtest [15:09:19]: starting date and time: 2024-11-09 15:09:19+0000 0s autopkgtest [15:09:19]: git checkout: 6f3be7a8 Fix armhf LXD image generation for plucky 0s autopkgtest [15:09:19]: host juju-7f2275-prod-proposed-migration-environment-15; command line: /home/ubuntu/autopkgtest/runner/autopkgtest --output-dir /tmp/autopkgtest-work.fvycgexb/out --timeout-copy=6000 --setup-commands /home/ubuntu/autopkgtest-cloud/worker-config-production/setup-canonical.sh --apt-pocket=proposed=src:setuptools --apt-upgrade scikit-build --timeout-short=300 --timeout-copy=20000 --timeout-build=20000 --env=ADT_TEST_TRIGGERS=setuptools/75.2.0-1 -- ssh -s /home/ubuntu/autopkgtest/ssh-setup/nova -- --flavor autopkgtest-s390x --security-groups autopkgtest-juju-7f2275-prod-proposed-migration-environment-15@bos03-s390x-30.secgroup --name adt-plucky-s390x-scikit-build-20241109-150919-juju-7f2275-prod-proposed-migration-environment-15-2306f199-b41d-410e-943f-aea27dae3d30 --image adt/ubuntu-plucky-s390x-server --keyname testbed-juju-7f2275-prod-proposed-migration-environment-15 --net-id=net_prod-proposed-migration-s390x -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/ 152s autopkgtest [15:11:51]: testbed dpkg architecture: s390x 152s autopkgtest [15:11:51]: testbed apt version: 2.9.8 152s autopkgtest [15:11:51]: @@@@@@@@@@@@@@@@@@@@ test bed setup 153s Get:1 http://ftpmaster.internal/ubuntu plucky-proposed InRelease [73.9 kB] 153s Get:2 http://ftpmaster.internal/ubuntu plucky-proposed/multiverse Sources [15.3 kB] 153s Get:3 http://ftpmaster.internal/ubuntu plucky-proposed/universe Sources [1004 kB] 155s Get:4 http://ftpmaster.internal/ubuntu plucky-proposed/main Sources [104 kB] 155s Get:5 http://ftpmaster.internal/ubuntu plucky-proposed/restricted Sources [7016 B] 155s Get:6 http://ftpmaster.internal/ubuntu plucky-proposed/main s390x Packages [125 kB] 155s Get:7 http://ftpmaster.internal/ubuntu plucky-proposed/universe s390x Packages [696 kB] 157s Get:8 http://ftpmaster.internal/ubuntu plucky-proposed/multiverse s390x Packages [16.6 kB] 157s Fetched 2043 kB in 4s (493 kB/s) 157s Reading package lists... 159s Reading package lists... 159s Building dependency tree... 159s Reading state information... 159s Calculating upgrade... 159s The following NEW packages will be installed: 159s python3-jaraco.text 159s The following packages will be upgraded: 159s python3-pkg-resources python3-setuptools 159s 2 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. 159s Need to get 802 kB of archives. 159s After this operation, 12.3 kB of additional disk space will be used. 159s Get:1 http://ftpmaster.internal/ubuntu plucky/main s390x python3-jaraco.text all 4.0.0-1 [11.5 kB] 159s Get:2 http://ftpmaster.internal/ubuntu plucky-proposed/main s390x python3-pkg-resources all 75.2.0-1 [134 kB] 159s Get:3 http://ftpmaster.internal/ubuntu plucky-proposed/main s390x python3-setuptools all 75.2.0-1 [657 kB] 160s Fetched 802 kB in 1s (688 kB/s) 160s Selecting previously unselected package python3-jaraco.text. 161s (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 ... 55520 files and directories currently installed.) 161s Preparing to unpack .../python3-jaraco.text_4.0.0-1_all.deb ... 161s Unpacking python3-jaraco.text (4.0.0-1) ... 161s Preparing to unpack .../python3-pkg-resources_75.2.0-1_all.deb ... 161s Unpacking python3-pkg-resources (75.2.0-1) over (74.1.2-1) ... 161s Preparing to unpack .../python3-setuptools_75.2.0-1_all.deb ... 161s Unpacking python3-setuptools (75.2.0-1) over (74.1.2-1) ... 161s Setting up python3-pkg-resources (75.2.0-1) ... 161s Setting up python3-jaraco.text (4.0.0-1) ... 161s Setting up python3-setuptools (75.2.0-1) ... 163s Reading package lists...Hit:1 http://ftpmaster.internal/ubuntu plucky-proposed InRelease 163s Hit:2 http://ftpmaster.internal/ubuntu plucky InRelease 163s Hit:3 http://ftpmaster.internal/ubuntu plucky-updates InRelease 163s Hit:4 http://ftpmaster.internal/ubuntu plucky-security InRelease 163s 163s Building dependency tree... 163s Reading state information... 163s 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 163s Reading package lists... 163s Reading package lists... 164s Building dependency tree... 164s Reading state information... 164s Calculating upgrade... 164s 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 164s Reading package lists... 164s Building dependency tree... 164s Reading state information... 164s 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 166s autopkgtest [15:12:05]: testbed running kernel: Linux 6.11.0-8-generic #8-Ubuntu SMP Mon Sep 16 12:49:35 UTC 2024 167s autopkgtest [15:12:06]: @@@@@@@@@@@@@@@@@@@@ apt-source scikit-build 169s Get:1 http://ftpmaster.internal/ubuntu plucky/universe scikit-build 0.18.1-1 (dsc) [2733 B] 169s Get:2 http://ftpmaster.internal/ubuntu plucky/universe scikit-build 0.18.1-1 (tar) [273 kB] 169s Get:3 http://ftpmaster.internal/ubuntu plucky/universe scikit-build 0.18.1-1 (diff) [5768 B] 169s gpgv: Signature made Fri Aug 30 01:03:13 2024 UTC 169s gpgv: using RSA key 13796755BBC72BB8ABE2AEB5FA9DEC5DE11C63F1 169s gpgv: issuer "eamanu@debian.org" 169s gpgv: Can't check signature: No public key 169s dpkg-source: warning: cannot verify inline signature for ./scikit-build_0.18.1-1.dsc: no acceptable signature found 169s autopkgtest [15:12:08]: testing package scikit-build version 0.18.1-1 169s autopkgtest [15:12:08]: build not needed 169s autopkgtest [15:12:08]: test testsuite: preparing testbed 171s Reading package lists... 171s Building dependency tree... 171s Reading state information... 171s Starting pkgProblemResolver with broken count: 0 171s Starting 2 pkgProblemResolver with broken count: 0 171s Done 171s The following additional packages will be installed: 171s build-essential cmake cmake-data cpp cpp-14 cpp-14-s390x-linux-gnu 171s cpp-s390x-linux-gnu cython3 fonts-font-awesome fonts-lato g++ g++-14 171s g++-14-s390x-linux-gnu g++-s390x-linux-gnu gcc gcc-14 gcc-14-s390x-linux-gnu 171s gcc-s390x-linux-gnu git git-man libasan8 libcc1-0 liberror-perl 171s libexpat1-dev libgcc-14-dev libgomp1 libisl23 libitm1 libjs-jquery 171s libjs-sphinxdoc libjs-underscore libjsoncpp25 libmpc3 libpython3-all-dev 171s libpython3-dev libpython3.12-dev librhash0 libstdc++-14-dev libubsan1 171s python-skbuild-doc python3-all python3-all-dev python3-build python3-dev 171s python3-distlib python3-filelock python3-iniconfig python3-packaging 171s python3-pip python3-pip-whl python3-platformdirs python3-pluggy 171s python3-pyproject-hooks python3-pytest python3-pytest-mock 171s python3-setuptools-whl python3-skbuild python3-toml python3-virtualenv 171s python3-wheel python3-wheel-whl python3.12-dev sphinx-rtd-theme-common 171s zlib1g-dev 171s Suggested packages: 171s cmake-doc cmake-format elpa-cmake-mode ninja-build cpp-doc gcc-14-locales 171s cpp-14-doc cython-doc gcc-14-doc gcc-multilib manpages-dev autoconf automake 171s libtool flex bison gdb gcc-doc gdb-s390x-linux-gnu git-daemon-run 171s | git-daemon-sysvinit git-doc git-email git-gui gitk gitweb git-cvs 171s git-mediawiki git-svn libstdc++-14-doc python3-venv python-build-doc 171s python-pytest-mock-doc 171s Recommended packages: 171s javascript-common 171s The following NEW packages will be installed: 171s autopkgtest-satdep build-essential cmake cmake-data cpp cpp-14 171s cpp-14-s390x-linux-gnu cpp-s390x-linux-gnu cython3 fonts-font-awesome 171s fonts-lato g++ g++-14 g++-14-s390x-linux-gnu g++-s390x-linux-gnu gcc gcc-14 171s gcc-14-s390x-linux-gnu gcc-s390x-linux-gnu git git-man libasan8 libcc1-0 171s liberror-perl libexpat1-dev libgcc-14-dev libgomp1 libisl23 libitm1 171s libjs-jquery libjs-sphinxdoc libjs-underscore libjsoncpp25 libmpc3 171s libpython3-all-dev libpython3-dev libpython3.12-dev librhash0 171s libstdc++-14-dev libubsan1 python-skbuild-doc python3-all python3-all-dev 171s python3-build python3-dev python3-distlib python3-filelock python3-iniconfig 171s python3-packaging python3-pip python3-pip-whl python3-platformdirs 171s python3-pluggy python3-pyproject-hooks python3-pytest python3-pytest-mock 171s python3-setuptools-whl python3-skbuild python3-toml python3-virtualenv 171s python3-wheel python3-wheel-whl python3.12-dev sphinx-rtd-theme-common 171s zlib1g-dev 171s 0 upgraded, 65 newly installed, 0 to remove and 0 not upgraded. 171s Need to get 88.7 MB/88.7 MB of archives. 171s After this operation, 312 MB of additional disk space will be used. 171s Get:1 /tmp/autopkgtest.EmfYpF/1-autopkgtest-satdep.deb autopkgtest-satdep s390x 0 [784 B] 171s Get:2 http://ftpmaster.internal/ubuntu plucky/main s390x fonts-lato all 2.015-1 [2781 kB] 177s Get:3 http://ftpmaster.internal/ubuntu plucky/main s390x libisl23 s390x 0.27-1 [704 kB] 178s Get:4 http://ftpmaster.internal/ubuntu plucky/main s390x libmpc3 s390x 1.3.1-1build2 [57.8 kB] 178s Get:5 http://ftpmaster.internal/ubuntu plucky/main s390x cpp-14-s390x-linux-gnu s390x 14.2.0-7ubuntu1 [9570 kB] 196s Get:6 http://ftpmaster.internal/ubuntu plucky/main s390x cpp-14 s390x 14.2.0-7ubuntu1 [1022 B] 196s Get:7 http://ftpmaster.internal/ubuntu plucky/main s390x cpp-s390x-linux-gnu s390x 4:14.1.0-2ubuntu1 [5452 B] 196s Get:8 http://ftpmaster.internal/ubuntu plucky/main s390x cpp s390x 4:14.1.0-2ubuntu1 [22.4 kB] 196s Get:9 http://ftpmaster.internal/ubuntu plucky/main s390x libcc1-0 s390x 14.2.0-7ubuntu1 [50.6 kB] 196s Get:10 http://ftpmaster.internal/ubuntu plucky/main s390x libgomp1 s390x 14.2.0-7ubuntu1 [151 kB] 196s Get:11 http://ftpmaster.internal/ubuntu plucky/main s390x libitm1 s390x 14.2.0-7ubuntu1 [30.9 kB] 196s Get:12 http://ftpmaster.internal/ubuntu plucky/main s390x libasan8 s390x 14.2.0-7ubuntu1 [2963 kB] 202s Get:13 http://ftpmaster.internal/ubuntu plucky/main s390x libubsan1 s390x 14.2.0-7ubuntu1 [1184 kB] 205s Get:14 http://ftpmaster.internal/ubuntu plucky/main s390x libgcc-14-dev s390x 14.2.0-7ubuntu1 [1037 kB] 207s Get:15 http://ftpmaster.internal/ubuntu plucky/main s390x gcc-14-s390x-linux-gnu s390x 14.2.0-7ubuntu1 [18.7 MB] 248s Get:16 http://ftpmaster.internal/ubuntu plucky/main s390x gcc-14 s390x 14.2.0-7ubuntu1 [515 kB] 249s Get:17 http://ftpmaster.internal/ubuntu plucky/main s390x gcc-s390x-linux-gnu s390x 4:14.1.0-2ubuntu1 [1204 B] 249s Get:18 http://ftpmaster.internal/ubuntu plucky/main s390x gcc s390x 4:14.1.0-2ubuntu1 [4996 B] 249s Get:19 http://ftpmaster.internal/ubuntu plucky/main s390x libstdc++-14-dev s390x 14.2.0-7ubuntu1 [2607 kB] 255s Get:20 http://ftpmaster.internal/ubuntu plucky/main s390x g++-14-s390x-linux-gnu s390x 14.2.0-7ubuntu1 [11.0 MB] 286s Get:21 http://ftpmaster.internal/ubuntu plucky/main s390x g++-14 s390x 14.2.0-7ubuntu1 [19.8 kB] 286s Get:22 http://ftpmaster.internal/ubuntu plucky/main s390x g++-s390x-linux-gnu s390x 4:14.1.0-2ubuntu1 [956 B] 286s Get:23 http://ftpmaster.internal/ubuntu plucky/main s390x g++ s390x 4:14.1.0-2ubuntu1 [1076 B] 286s Get:24 http://ftpmaster.internal/ubuntu plucky/main s390x build-essential s390x 12.10ubuntu1 [4930 B] 286s Get:25 http://ftpmaster.internal/ubuntu plucky/main s390x libjsoncpp25 s390x 1.9.5-6build1 [82.5 kB] 286s Get:26 http://ftpmaster.internal/ubuntu plucky/main s390x librhash0 s390x 1.4.3-3build1 [133 kB] 287s Get:27 http://ftpmaster.internal/ubuntu plucky/main s390x cmake-data all 3.30.3-1 [2246 kB] 292s Get:28 http://ftpmaster.internal/ubuntu plucky/main s390x cmake s390x 3.30.3-1 [12.3 MB] 313s Get:29 http://ftpmaster.internal/ubuntu plucky/universe s390x cython3 s390x 3.0.11+dfsg-1ubuntu1 [2524 kB] 317s Get:30 http://ftpmaster.internal/ubuntu plucky/main s390x fonts-font-awesome all 5.0.10+really4.7.0~dfsg-4.1 [516 kB] 318s Get:31 http://ftpmaster.internal/ubuntu plucky/main s390x liberror-perl all 0.17029-2 [25.6 kB] 318s Get:32 http://ftpmaster.internal/ubuntu plucky/main s390x git-man all 1:2.45.2-1ubuntu1 [1122 kB] 320s Get:33 http://ftpmaster.internal/ubuntu plucky/main s390x git s390x 1:2.45.2-1ubuntu1 [4071 kB] 335s Get:34 http://ftpmaster.internal/ubuntu plucky/main s390x libexpat1-dev s390x 2.6.2-2 [146 kB] 335s Get:35 http://ftpmaster.internal/ubuntu plucky/main s390x libjs-jquery all 3.6.1+dfsg+~3.5.14-1 [328 kB] 337s Get:36 http://ftpmaster.internal/ubuntu plucky/main s390x libjs-underscore all 1.13.4~dfsg+~1.11.4-3 [118 kB] 337s Get:37 http://ftpmaster.internal/ubuntu plucky/main s390x libjs-sphinxdoc all 7.4.7-3 [157 kB] 337s Get:38 http://ftpmaster.internal/ubuntu plucky/main s390x zlib1g-dev s390x 1:1.3.dfsg+really1.3.1-1ubuntu1 [898 kB] 340s Get:39 http://ftpmaster.internal/ubuntu plucky/main s390x libpython3.12-dev s390x 3.12.7-2 [5832 kB] 350s Get:40 http://ftpmaster.internal/ubuntu plucky/main s390x libpython3-dev s390x 3.12.6-0ubuntu1 [10.2 kB] 350s Get:41 http://ftpmaster.internal/ubuntu plucky/main s390x libpython3-all-dev s390x 3.12.6-0ubuntu1 [918 B] 350s Get:42 http://ftpmaster.internal/ubuntu plucky/main s390x sphinx-rtd-theme-common all 3.0.1+dfsg-1 [1012 kB] 351s Get:43 http://ftpmaster.internal/ubuntu plucky/universe s390x python-skbuild-doc all 0.18.1-1 [136 kB] 352s Get:44 http://ftpmaster.internal/ubuntu plucky/main s390x python3-all s390x 3.12.6-0ubuntu1 [890 B] 352s Get:45 http://ftpmaster.internal/ubuntu plucky/main s390x python3.12-dev s390x 3.12.7-2 [505 kB] 353s Get:46 http://ftpmaster.internal/ubuntu plucky/main s390x python3-dev s390x 3.12.6-0ubuntu1 [26.7 kB] 353s Get:47 http://ftpmaster.internal/ubuntu plucky/main s390x python3-all-dev s390x 3.12.6-0ubuntu1 [912 B] 353s Get:48 http://ftpmaster.internal/ubuntu plucky/main s390x python3-packaging all 24.1-1 [41.4 kB] 353s Get:49 http://ftpmaster.internal/ubuntu plucky/universe s390x python3-pyproject-hooks all 1.2.0-1 [10.2 kB] 353s Get:50 http://ftpmaster.internal/ubuntu plucky/universe s390x python3-toml all 0.10.2-1 [16.5 kB] 353s Get:51 http://ftpmaster.internal/ubuntu plucky/universe s390x python3-wheel all 0.44.0-1 [54.2 kB] 353s Get:52 http://ftpmaster.internal/ubuntu plucky/universe s390x python3-build all 1.2.2-1 [31.0 kB] 353s Get:53 http://ftpmaster.internal/ubuntu plucky/universe s390x python3-distlib all 0.3.8-1 [318 kB] 354s Get:54 http://ftpmaster.internal/ubuntu plucky/universe s390x python3-filelock all 3.15.4-1 [12.8 kB] 354s Get:55 http://ftpmaster.internal/ubuntu plucky/universe s390x python3-iniconfig all 1.1.1-2 [6024 B] 354s Get:56 http://ftpmaster.internal/ubuntu plucky/universe s390x python3-pip all 24.2+dfsg-1 [1398 kB] 356s Get:57 http://ftpmaster.internal/ubuntu plucky/universe s390x python3-pip-whl all 24.2+dfsg-1 [1420 kB] 358s Get:58 http://ftpmaster.internal/ubuntu plucky/main s390x python3-platformdirs all 4.2.2-1 [16.6 kB] 358s Get:59 http://ftpmaster.internal/ubuntu plucky/universe s390x python3-pluggy all 1.5.0-1 [21.0 kB] 358s Get:60 http://ftpmaster.internal/ubuntu plucky/universe s390x python3-pytest all 8.3.2-1 [251 kB] 359s Get:61 http://ftpmaster.internal/ubuntu plucky/universe s390x python3-pytest-mock all 3.14.0-1 [11.6 kB] 359s Get:62 http://ftpmaster.internal/ubuntu plucky-proposed/universe s390x python3-setuptools-whl all 75.2.0-1 [1158 kB] 360s Get:63 http://ftpmaster.internal/ubuntu plucky/universe s390x python3-skbuild all 0.18.1-1 [60.3 kB] 360s Get:64 http://ftpmaster.internal/ubuntu plucky/universe s390x python3-wheel-whl all 0.44.0-1 [69.5 kB] 361s Get:65 http://ftpmaster.internal/ubuntu plucky/universe s390x python3-virtualenv all 20.26.2+ds-1 [71.6 kB] 361s Fetched 88.7 MB in 3min 9s (468 kB/s) 361s Selecting previously unselected package fonts-lato. 361s (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 ... 55529 files and directories currently installed.) 361s Preparing to unpack .../00-fonts-lato_2.015-1_all.deb ... 361s Unpacking fonts-lato (2.015-1) ... 361s Selecting previously unselected package libisl23:s390x. 361s Preparing to unpack .../01-libisl23_0.27-1_s390x.deb ... 361s Unpacking libisl23:s390x (0.27-1) ... 361s Selecting previously unselected package libmpc3:s390x. 361s Preparing to unpack .../02-libmpc3_1.3.1-1build2_s390x.deb ... 361s Unpacking libmpc3:s390x (1.3.1-1build2) ... 361s Selecting previously unselected package cpp-14-s390x-linux-gnu. 361s Preparing to unpack .../03-cpp-14-s390x-linux-gnu_14.2.0-7ubuntu1_s390x.deb ... 361s Unpacking cpp-14-s390x-linux-gnu (14.2.0-7ubuntu1) ... 361s Selecting previously unselected package cpp-14. 361s Preparing to unpack .../04-cpp-14_14.2.0-7ubuntu1_s390x.deb ... 361s Unpacking cpp-14 (14.2.0-7ubuntu1) ... 361s Selecting previously unselected package cpp-s390x-linux-gnu. 361s Preparing to unpack .../05-cpp-s390x-linux-gnu_4%3a14.1.0-2ubuntu1_s390x.deb ... 361s Unpacking cpp-s390x-linux-gnu (4:14.1.0-2ubuntu1) ... 361s Selecting previously unselected package cpp. 361s Preparing to unpack .../06-cpp_4%3a14.1.0-2ubuntu1_s390x.deb ... 361s Unpacking cpp (4:14.1.0-2ubuntu1) ... 361s Selecting previously unselected package libcc1-0:s390x. 361s Preparing to unpack .../07-libcc1-0_14.2.0-7ubuntu1_s390x.deb ... 361s Unpacking libcc1-0:s390x (14.2.0-7ubuntu1) ... 361s Selecting previously unselected package libgomp1:s390x. 361s Preparing to unpack .../08-libgomp1_14.2.0-7ubuntu1_s390x.deb ... 361s Unpacking libgomp1:s390x (14.2.0-7ubuntu1) ... 361s Selecting previously unselected package libitm1:s390x. 361s Preparing to unpack .../09-libitm1_14.2.0-7ubuntu1_s390x.deb ... 361s Unpacking libitm1:s390x (14.2.0-7ubuntu1) ... 361s Selecting previously unselected package libasan8:s390x. 361s Preparing to unpack .../10-libasan8_14.2.0-7ubuntu1_s390x.deb ... 361s Unpacking libasan8:s390x (14.2.0-7ubuntu1) ... 362s Selecting previously unselected package libubsan1:s390x. 362s Preparing to unpack .../11-libubsan1_14.2.0-7ubuntu1_s390x.deb ... 362s Unpacking libubsan1:s390x (14.2.0-7ubuntu1) ... 362s Selecting previously unselected package libgcc-14-dev:s390x. 362s Preparing to unpack .../12-libgcc-14-dev_14.2.0-7ubuntu1_s390x.deb ... 362s Unpacking libgcc-14-dev:s390x (14.2.0-7ubuntu1) ... 362s Selecting previously unselected package gcc-14-s390x-linux-gnu. 362s Preparing to unpack .../13-gcc-14-s390x-linux-gnu_14.2.0-7ubuntu1_s390x.deb ... 362s Unpacking gcc-14-s390x-linux-gnu (14.2.0-7ubuntu1) ... 362s Selecting previously unselected package gcc-14. 362s Preparing to unpack .../14-gcc-14_14.2.0-7ubuntu1_s390x.deb ... 362s Unpacking gcc-14 (14.2.0-7ubuntu1) ... 362s Selecting previously unselected package gcc-s390x-linux-gnu. 362s Preparing to unpack .../15-gcc-s390x-linux-gnu_4%3a14.1.0-2ubuntu1_s390x.deb ... 362s Unpacking gcc-s390x-linux-gnu (4:14.1.0-2ubuntu1) ... 362s Selecting previously unselected package gcc. 362s Preparing to unpack .../16-gcc_4%3a14.1.0-2ubuntu1_s390x.deb ... 362s Unpacking gcc (4:14.1.0-2ubuntu1) ... 362s Selecting previously unselected package libstdc++-14-dev:s390x. 362s Preparing to unpack .../17-libstdc++-14-dev_14.2.0-7ubuntu1_s390x.deb ... 362s Unpacking libstdc++-14-dev:s390x (14.2.0-7ubuntu1) ... 362s Selecting previously unselected package g++-14-s390x-linux-gnu. 362s Preparing to unpack .../18-g++-14-s390x-linux-gnu_14.2.0-7ubuntu1_s390x.deb ... 362s Unpacking g++-14-s390x-linux-gnu (14.2.0-7ubuntu1) ... 362s Selecting previously unselected package g++-14. 362s Preparing to unpack .../19-g++-14_14.2.0-7ubuntu1_s390x.deb ... 362s Unpacking g++-14 (14.2.0-7ubuntu1) ... 362s Selecting previously unselected package g++-s390x-linux-gnu. 362s Preparing to unpack .../20-g++-s390x-linux-gnu_4%3a14.1.0-2ubuntu1_s390x.deb ... 362s Unpacking g++-s390x-linux-gnu (4:14.1.0-2ubuntu1) ... 362s Selecting previously unselected package g++. 362s Preparing to unpack .../21-g++_4%3a14.1.0-2ubuntu1_s390x.deb ... 362s Unpacking g++ (4:14.1.0-2ubuntu1) ... 362s Selecting previously unselected package build-essential. 362s Preparing to unpack .../22-build-essential_12.10ubuntu1_s390x.deb ... 362s Unpacking build-essential (12.10ubuntu1) ... 362s Selecting previously unselected package libjsoncpp25:s390x. 362s Preparing to unpack .../23-libjsoncpp25_1.9.5-6build1_s390x.deb ... 362s Unpacking libjsoncpp25:s390x (1.9.5-6build1) ... 362s Selecting previously unselected package librhash0:s390x. 362s Preparing to unpack .../24-librhash0_1.4.3-3build1_s390x.deb ... 362s Unpacking librhash0:s390x (1.4.3-3build1) ... 362s Selecting previously unselected package cmake-data. 362s Preparing to unpack .../25-cmake-data_3.30.3-1_all.deb ... 362s Unpacking cmake-data (3.30.3-1) ... 362s Selecting previously unselected package cmake. 362s Preparing to unpack .../26-cmake_3.30.3-1_s390x.deb ... 362s Unpacking cmake (3.30.3-1) ... 363s Selecting previously unselected package cython3. 363s Preparing to unpack .../27-cython3_3.0.11+dfsg-1ubuntu1_s390x.deb ... 363s Unpacking cython3 (3.0.11+dfsg-1ubuntu1) ... 363s Selecting previously unselected package fonts-font-awesome. 363s Preparing to unpack .../28-fonts-font-awesome_5.0.10+really4.7.0~dfsg-4.1_all.deb ... 363s Unpacking fonts-font-awesome (5.0.10+really4.7.0~dfsg-4.1) ... 363s Selecting previously unselected package liberror-perl. 363s Preparing to unpack .../29-liberror-perl_0.17029-2_all.deb ... 363s Unpacking liberror-perl (0.17029-2) ... 363s Selecting previously unselected package git-man. 363s Preparing to unpack .../30-git-man_1%3a2.45.2-1ubuntu1_all.deb ... 363s Unpacking git-man (1:2.45.2-1ubuntu1) ... 363s Selecting previously unselected package git. 363s Preparing to unpack .../31-git_1%3a2.45.2-1ubuntu1_s390x.deb ... 363s Unpacking git (1:2.45.2-1ubuntu1) ... 363s Selecting previously unselected package libexpat1-dev:s390x. 363s Preparing to unpack .../32-libexpat1-dev_2.6.2-2_s390x.deb ... 363s Unpacking libexpat1-dev:s390x (2.6.2-2) ... 363s Selecting previously unselected package libjs-jquery. 363s Preparing to unpack .../33-libjs-jquery_3.6.1+dfsg+~3.5.14-1_all.deb ... 363s Unpacking libjs-jquery (3.6.1+dfsg+~3.5.14-1) ... 363s Selecting previously unselected package libjs-underscore. 363s Preparing to unpack .../34-libjs-underscore_1.13.4~dfsg+~1.11.4-3_all.deb ... 363s Unpacking libjs-underscore (1.13.4~dfsg+~1.11.4-3) ... 363s Selecting previously unselected package libjs-sphinxdoc. 363s Preparing to unpack .../35-libjs-sphinxdoc_7.4.7-3_all.deb ... 363s Unpacking libjs-sphinxdoc (7.4.7-3) ... 363s Selecting previously unselected package zlib1g-dev:s390x. 363s Preparing to unpack .../36-zlib1g-dev_1%3a1.3.dfsg+really1.3.1-1ubuntu1_s390x.deb ... 363s Unpacking zlib1g-dev:s390x (1:1.3.dfsg+really1.3.1-1ubuntu1) ... 363s Selecting previously unselected package libpython3.12-dev:s390x. 363s Preparing to unpack .../37-libpython3.12-dev_3.12.7-2_s390x.deb ... 363s Unpacking libpython3.12-dev:s390x (3.12.7-2) ... 363s Selecting previously unselected package libpython3-dev:s390x. 363s Preparing to unpack .../38-libpython3-dev_3.12.6-0ubuntu1_s390x.deb ... 363s Unpacking libpython3-dev:s390x (3.12.6-0ubuntu1) ... 363s Selecting previously unselected package libpython3-all-dev:s390x. 363s Preparing to unpack .../39-libpython3-all-dev_3.12.6-0ubuntu1_s390x.deb ... 363s Unpacking libpython3-all-dev:s390x (3.12.6-0ubuntu1) ... 363s Selecting previously unselected package sphinx-rtd-theme-common. 363s Preparing to unpack .../40-sphinx-rtd-theme-common_3.0.1+dfsg-1_all.deb ... 363s Unpacking sphinx-rtd-theme-common (3.0.1+dfsg-1) ... 363s Selecting previously unselected package python-skbuild-doc. 363s Preparing to unpack .../41-python-skbuild-doc_0.18.1-1_all.deb ... 363s Unpacking python-skbuild-doc (0.18.1-1) ... 363s Selecting previously unselected package python3-all. 363s Preparing to unpack .../42-python3-all_3.12.6-0ubuntu1_s390x.deb ... 363s Unpacking python3-all (3.12.6-0ubuntu1) ... 363s Selecting previously unselected package python3.12-dev. 363s Preparing to unpack .../43-python3.12-dev_3.12.7-2_s390x.deb ... 363s Unpacking python3.12-dev (3.12.7-2) ... 363s Selecting previously unselected package python3-dev. 363s Preparing to unpack .../44-python3-dev_3.12.6-0ubuntu1_s390x.deb ... 363s Unpacking python3-dev (3.12.6-0ubuntu1) ... 363s Selecting previously unselected package python3-all-dev. 363s Preparing to unpack .../45-python3-all-dev_3.12.6-0ubuntu1_s390x.deb ... 363s Unpacking python3-all-dev (3.12.6-0ubuntu1) ... 363s Selecting previously unselected package python3-packaging. 363s Preparing to unpack .../46-python3-packaging_24.1-1_all.deb ... 363s Unpacking python3-packaging (24.1-1) ... 363s Selecting previously unselected package python3-pyproject-hooks. 363s Preparing to unpack .../47-python3-pyproject-hooks_1.2.0-1_all.deb ... 363s Unpacking python3-pyproject-hooks (1.2.0-1) ... 363s Selecting previously unselected package python3-toml. 363s Preparing to unpack .../48-python3-toml_0.10.2-1_all.deb ... 363s Unpacking python3-toml (0.10.2-1) ... 363s Selecting previously unselected package python3-wheel. 363s Preparing to unpack .../49-python3-wheel_0.44.0-1_all.deb ... 363s Unpacking python3-wheel (0.44.0-1) ... 363s Selecting previously unselected package python3-build. 363s Preparing to unpack .../50-python3-build_1.2.2-1_all.deb ... 363s Unpacking python3-build (1.2.2-1) ... 363s Selecting previously unselected package python3-distlib. 363s Preparing to unpack .../51-python3-distlib_0.3.8-1_all.deb ... 363s Unpacking python3-distlib (0.3.8-1) ... 363s Selecting previously unselected package python3-filelock. 363s Preparing to unpack .../52-python3-filelock_3.15.4-1_all.deb ... 363s Unpacking python3-filelock (3.15.4-1) ... 363s Selecting previously unselected package python3-iniconfig. 363s Preparing to unpack .../53-python3-iniconfig_1.1.1-2_all.deb ... 363s Unpacking python3-iniconfig (1.1.1-2) ... 363s Selecting previously unselected package python3-pip. 363s Preparing to unpack .../54-python3-pip_24.2+dfsg-1_all.deb ... 363s Unpacking python3-pip (24.2+dfsg-1) ... 363s Selecting previously unselected package python3-pip-whl. 363s Preparing to unpack .../55-python3-pip-whl_24.2+dfsg-1_all.deb ... 363s Unpacking python3-pip-whl (24.2+dfsg-1) ... 363s Selecting previously unselected package python3-platformdirs. 363s Preparing to unpack .../56-python3-platformdirs_4.2.2-1_all.deb ... 363s Unpacking python3-platformdirs (4.2.2-1) ... 363s Selecting previously unselected package python3-pluggy. 363s Preparing to unpack .../57-python3-pluggy_1.5.0-1_all.deb ... 363s Unpacking python3-pluggy (1.5.0-1) ... 363s Selecting previously unselected package python3-pytest. 363s Preparing to unpack .../58-python3-pytest_8.3.2-1_all.deb ... 363s Unpacking python3-pytest (8.3.2-1) ... 363s Selecting previously unselected package python3-pytest-mock. 363s Preparing to unpack .../59-python3-pytest-mock_3.14.0-1_all.deb ... 363s Unpacking python3-pytest-mock (3.14.0-1) ... 363s Selecting previously unselected package python3-setuptools-whl. 363s Preparing to unpack .../60-python3-setuptools-whl_75.2.0-1_all.deb ... 363s Unpacking python3-setuptools-whl (75.2.0-1) ... 363s Selecting previously unselected package python3-skbuild. 363s Preparing to unpack .../61-python3-skbuild_0.18.1-1_all.deb ... 363s Unpacking python3-skbuild (0.18.1-1) ... 363s Selecting previously unselected package python3-wheel-whl. 363s Preparing to unpack .../62-python3-wheel-whl_0.44.0-1_all.deb ... 363s Unpacking python3-wheel-whl (0.44.0-1) ... 363s Selecting previously unselected package python3-virtualenv. 363s Preparing to unpack .../63-python3-virtualenv_20.26.2+ds-1_all.deb ... 363s Unpacking python3-virtualenv (20.26.2+ds-1) ... 363s Selecting previously unselected package autopkgtest-satdep. 363s Preparing to unpack .../64-1-autopkgtest-satdep.deb ... 363s Unpacking autopkgtest-satdep (0) ... 363s Setting up python3-iniconfig (1.1.1-2) ... 363s Setting up python3-setuptools-whl (75.2.0-1) ... 363s Setting up python3-filelock (3.15.4-1) ... 364s Setting up fonts-lato (2.015-1) ... 364s Setting up python3-pip-whl (24.2+dfsg-1) ... 364s Setting up python3-all (3.12.6-0ubuntu1) ... 364s Setting up python3-distlib (0.3.8-1) ... 364s Setting up libgomp1:s390x (14.2.0-7ubuntu1) ... 364s Setting up python3-wheel (0.44.0-1) ... 364s Setting up python3-platformdirs (4.2.2-1) ... 364s Setting up liberror-perl (0.17029-2) ... 364s Setting up python3-packaging (24.1-1) ... 364s Setting up libexpat1-dev:s390x (2.6.2-2) ... 364s Setting up python3-pyproject-hooks (1.2.0-1) ... 364s Setting up libmpc3:s390x (1.3.1-1build2) ... 364s Setting up cython3 (3.0.11+dfsg-1ubuntu1) ... 365s Setting up libjsoncpp25:s390x (1.9.5-6build1) ... 365s Setting up python3-pip (24.2+dfsg-1) ... 366s Setting up python3-toml (0.10.2-1) ... 366s Setting up python3-pluggy (1.5.0-1) ... 366s Setting up libubsan1:s390x (14.2.0-7ubuntu1) ... 366s Setting up zlib1g-dev:s390x (1:1.3.dfsg+really1.3.1-1ubuntu1) ... 366s Setting up librhash0:s390x (1.4.3-3build1) ... 366s Setting up libasan8:s390x (14.2.0-7ubuntu1) ... 366s Setting up git-man (1:2.45.2-1ubuntu1) ... 366s Setting up cmake-data (3.30.3-1) ... 366s Setting up libjs-jquery (3.6.1+dfsg+~3.5.14-1) ... 366s Setting up libisl23:s390x (0.27-1) ... 366s Setting up python3-build (1.2.2-1) ... 366s Setting up python3-wheel-whl (0.44.0-1) ... 366s Setting up fonts-font-awesome (5.0.10+really4.7.0~dfsg-4.1) ... 366s Setting up sphinx-rtd-theme-common (3.0.1+dfsg-1) ... 366s Setting up libcc1-0:s390x (14.2.0-7ubuntu1) ... 366s Setting up libitm1:s390x (14.2.0-7ubuntu1) ... 366s Setting up libjs-underscore (1.13.4~dfsg+~1.11.4-3) ... 366s Setting up python3-pytest (8.3.2-1) ... 366s Setting up python3-virtualenv (20.26.2+ds-1) ... 367s Setting up libpython3.12-dev:s390x (3.12.7-2) ... 367s Setting up python3.12-dev (3.12.7-2) ... 367s Setting up git (1:2.45.2-1ubuntu1) ... 367s Setting up libjs-sphinxdoc (7.4.7-3) ... 367s Setting up cpp-14-s390x-linux-gnu (14.2.0-7ubuntu1) ... 367s Setting up cpp-14 (14.2.0-7ubuntu1) ... 367s Setting up python3-pytest-mock (3.14.0-1) ... 367s Setting up cmake (3.30.3-1) ... 367s Setting up libgcc-14-dev:s390x (14.2.0-7ubuntu1) ... 367s Setting up libstdc++-14-dev:s390x (14.2.0-7ubuntu1) ... 367s Setting up libpython3-dev:s390x (3.12.6-0ubuntu1) ... 367s Setting up python-skbuild-doc (0.18.1-1) ... 367s Setting up cpp-s390x-linux-gnu (4:14.1.0-2ubuntu1) ... 367s Setting up python3-skbuild (0.18.1-1) ... 367s Setting up gcc-14-s390x-linux-gnu (14.2.0-7ubuntu1) ... 367s Setting up gcc-s390x-linux-gnu (4:14.1.0-2ubuntu1) ... 367s Setting up libpython3-all-dev:s390x (3.12.6-0ubuntu1) ... 367s Setting up python3-dev (3.12.6-0ubuntu1) ... 367s Setting up g++-14-s390x-linux-gnu (14.2.0-7ubuntu1) ... 367s Setting up cpp (4:14.1.0-2ubuntu1) ... 367s Setting up python3-all-dev (3.12.6-0ubuntu1) ... 367s Setting up g++-s390x-linux-gnu (4:14.1.0-2ubuntu1) ... 367s Setting up gcc-14 (14.2.0-7ubuntu1) ... 367s Setting up g++-14 (14.2.0-7ubuntu1) ... 367s Setting up gcc (4:14.1.0-2ubuntu1) ... 367s Setting up g++ (4:14.1.0-2ubuntu1) ... 367s update-alternatives: using /usr/bin/g++ to provide /usr/bin/c++ (c++) in auto mode 367s Setting up build-essential (12.10ubuntu1) ... 367s Setting up autopkgtest-satdep (0) ... 367s Processing triggers for man-db (2.12.1-3) ... 368s Processing triggers for libc-bin (2.40-1ubuntu3) ... 370s (Reading database ... 63514 files and directories currently installed.) 370s Removing autopkgtest-satdep (0) ... 370s autopkgtest [15:15:29]: test testsuite: [----------------------- 370s + cp -r tests /tmp/autopkgtest.EmfYpF/autopkgtest_tmp 370s + cp pyproject.toml /tmp/autopkgtest.EmfYpF/autopkgtest_tmp 370s + cd /tmp/autopkgtest.EmfYpF/autopkgtest_tmp 370s + py3versions -s 370s + 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 372s ============================= test session starts ============================== 372s platform linux -- Python 3.12.7+, pytest-8.3.2, pluggy-1.5.0 372s installed packages of interest: build==1.2.2 distro==1.9.0 packaging==24.1 pip==24.2 scikit-build==0.18.1 setuptools==75.2.0 virtualenv==20.26.2 wheel==0.44.0 372s No cmake3 executable found on PATH 372s /usr/bin/cmake: cmake version 3.30.3 372s No ninja executable found on PATH 372s rootdir: /tmp/autopkgtest.EmfYpF/autopkgtest_tmp 372s configfile: pyproject.toml 372s testpaths: tests 372s plugins: mock-3.14.0, typeguard-4.4.1 372s collected 238 items / 17 deselected / 1 skipped / 221 selected 372s 372s tests/test_broken_project.py FFFFFFF [ 3%] 372s tests/test_cmake_target.py F [ 3%] 372s tests/test_cmakelists_not_in_top_level_dir.py FFFF [ 5%] 374s tests/test_cmaker.py ............... [ 12%] 375s tests/test_command_line.py FFFFFFFFFFFFF [ 18%] 375s tests/test_constants.py . [ 18%] 375s tests/test_cython_flags.py F [ 19%] 375s tests/test_filter_manifest.py F [ 19%] 375s tests/test_hello_cpp.py FFFFF [ 21%] 375s tests/test_hello_cython.py FFF [ 23%] 375s tests/test_hello_pure.py FFFF [ 24%] 375s tests/test_include_exclude_data.py FF [ 25%] 375s tests/test_issue284_build_ext_inplace.py F [ 26%] 375s tests/test_issue335_support_cmake_source_dir.py F [ 26%] 375s tests/test_issue342_cmake_osx_args_in_setup.py FFFFFFFFF [ 30%] 375s tests/test_issue352_isolated_environment_support.py F [ 31%] 375s tests/test_issue668_symbol_visibility.py FF [ 32%] 375s tests/test_logging.py .. [ 33%] 375s tests/test_manifest_in.py F [ 33%] 375s tests/test_outside_project_root.py FFF [ 34%] 376s tests/test_platform.py .............s [ 41%] 377s tests/test_setup.py ....FFFFFFFFFFFFFF..........FFFFFFFFFFFFFFFFFFFFFFFF [ 64%] 377s FFFFFFFFFsssFsssFsssFsssFsssFsssFsssFsssFFFFF [ 85%] 378s tests/test_skbuild.py .sFFFssss [ 89%] 378s tests/test_skbuild_variable.py FFF [ 90%] 378s tests/test_utils.py ..................... [100%] 378s 378s =================================== FAILURES =================================== 378s ____________________ test_cmakelists_with_fatalerror_fails _____________________ 378s 378s capfd = <_pytest.capture.CaptureFixture object at 0x3ffb634bb30> 378s 378s def test_cmakelists_with_fatalerror_fails(capfd): 378s with push_dir(): 378s 378s @project_setup_py_test("fail-with-fatal-error-cmakelists", ["build"], disable_languages_test=True) 378s def should_fail(): 378s pass 378s 378s with pytest.raises(SystemExit) as excinfo: 378s > should_fail() 378s 378s capfd = <_pytest.capture.CaptureFixture object at 0x3ffb634bb30> 378s excinfo = 378s should_fail = .should_fail at 0x3ffb62bbce0> 378s 378s tests/test_broken_project.py:31: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s tests/__init__.py:255: in wrapped 378s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 378s disable_languages_test = True 378s fun = .should_fail at 0x3ffb62bbc40> 378s iargs = () 378s ikwargs = {} 378s ret = False 378s wrapped = .should_fail at 0x3ffb62bbce0> 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-0/should_fail0') 378s setup_args = ['build'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-0/should_fail0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s ----------------------------- Captured stdout call ----------------------------- 378s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-0/should_fail0/.git/ 378s [master (root-commit) d474162] Initial commit 378s 2 files changed, 20 insertions(+) 378s create mode 100644 CMakeLists.txt 378s create mode 100644 setup.py 378s ----------------------------- Captured stderr call ----------------------------- 378s hint: Using 'master' as the name for the initial branch. This default branch name 378s hint: is subject to change. To configure the initial branch name to use in all 378s hint: of your new repositories, which will suppress this warning, call: 378s hint: 378s hint: git config --global init.defaultBranch 378s hint: 378s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 378s hint: 'development'. The just-created branch can be renamed via this command: 378s hint: 378s hint: git branch -m 378s ____________________ test_cmakelists_with_syntaxerror_fails ____________________ 378s 378s capfd = <_pytest.capture.CaptureFixture object at 0x3ffb62ab350> 378s 378s def test_cmakelists_with_syntaxerror_fails(capfd): 378s with push_dir(): 378s 378s @project_setup_py_test("fail-with-syntax-error-cmakelists", ["build"], disable_languages_test=True) 378s def should_fail(): 378s pass 378s 378s with pytest.raises(SystemExit) as excinfo: 378s > should_fail() 378s 378s capfd = <_pytest.capture.CaptureFixture object at 0x3ffb62ab350> 378s excinfo = 378s should_fail = .should_fail at 0x3ffb62f8860> 378s 378s tests/test_broken_project.py:49: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s tests/__init__.py:255: in wrapped 378s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 378s disable_languages_test = True 378s fun = .should_fail at 0x3ffb62f8900> 378s iargs = () 378s ikwargs = {} 378s ret = False 378s wrapped = .should_fail at 0x3ffb62f8860> 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-1/should_fail0') 378s setup_args = ['build'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-1/should_fail0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s ----------------------------- Captured stdout call ----------------------------- 378s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-1/should_fail0/.git/ 378s [master (root-commit) a8d8b12] Initial commit 378s 2 files changed, 20 insertions(+) 378s create mode 100644 CMakeLists.txt 378s create mode 100644 setup.py 378s ----------------------------- Captured stderr call ----------------------------- 378s hint: Using 'master' as the name for the initial branch. This default branch name 378s hint: is subject to change. To configure the initial branch name to use in all 378s hint: of your new repositories, which will suppress this warning, call: 378s hint: 378s hint: git config --global init.defaultBranch 378s hint: 378s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 378s hint: 'development'. The just-created branch can be renamed via this command: 378s hint: 378s hint: git branch -m 378s ______________________ test_hello_with_compileerror_fails ______________________ 378s 378s capfd = <_pytest.capture.CaptureFixture object at 0x3ffb62aa870> 378s 378s def test_hello_with_compileerror_fails(capfd): 378s with push_dir(): 378s 378s @project_setup_py_test("fail-hello-with-compile-error", ["build"]) 378s def should_fail(): 378s pass 378s 378s with pytest.raises(SystemExit) as excinfo: 378s > should_fail() 378s 378s capfd = <_pytest.capture.CaptureFixture object at 0x3ffb62aa870> 378s excinfo = 378s should_fail = .should_fail at 0x3ffb62f8d60> 378s 378s tests/test_broken_project.py:67: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s tests/__init__.py:255: in wrapped 378s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 378s disable_languages_test = False 378s fun = .should_fail at 0x3ffb62f89a0> 378s iargs = () 378s ikwargs = {} 378s ret = False 378s wrapped = .should_fail at 0x3ffb62f8d60> 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-2/should_fail0') 378s setup_args = ['build'], disable_languages_test = False 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = False 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-2/should_fail0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s ----------------------------- Captured stdout call ----------------------------- 378s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-2/should_fail0/.git/ 378s [master (root-commit) 1db8b5b] Initial commit 378s 6 files changed, 97 insertions(+) 378s create mode 100644 CMakeLists.txt 378s create mode 100644 hello/CMakeLists.txt 378s create mode 100644 hello/__init__.py 378s create mode 100644 hello/__main__.py 378s create mode 100644 hello/_hello.cxx 378s create mode 100644 setup.py 378s ----------------------------- Captured stderr call ----------------------------- 378s hint: Using 'master' as the name for the initial branch. This default branch name 378s hint: is subject to change. To configure the initial branch name to use in all 378s hint: of your new repositories, which will suppress this warning, call: 378s hint: 378s hint: git config --global init.defaultBranch 378s hint: 378s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 378s hint: 'development'. The just-created branch can be renamed via this command: 378s hint: 378s hint: git branch -m 378s ____________________ test_invalid_cmake[CalledProcessError] ____________________ 378s 378s exception = 378s mocker = 378s 378s @pytest.mark.parametrize("exception", [CalledProcessError, OSError]) 378s def test_invalid_cmake(exception, mocker): 378s exceptions = { 378s OSError: OSError("Unknown error"), 378s CalledProcessError: CalledProcessError(1, [CMAKE_DEFAULT_EXECUTABLE, "--version"]), 378s } 378s 378s run_original = run 378s 378s def run_mock(*args, **kwargs): 378s if args[0] == [CMAKE_DEFAULT_EXECUTABLE, "--version"]: 378s raise exceptions[exception] 378s return run_original(*args, **kwargs) 378s 378s mocker.patch("skbuild.cmaker.subprocess.run", new=run_mock) 378s 378s with push_dir(): 378s 378s @project_setup_py_test("hello-no-language", ["build"], disable_languages_test=True) 378s def should_fail(): 378s pass 378s 378s with pytest.raises(SystemExit) as excinfo: 378s > should_fail() 378s 378s exception = 378s exceptions = {: OSError('Unknown error'), : CalledProcessError(1, ['/usr/bin/cmake', '--version'])} 378s excinfo = 378s mocker = 378s run_mock = .run_mock at 0x3ffb62bb380> 378s run_original = 378s should_fail = .should_fail at 0x3ffb62f8900> 378s 378s tests/test_broken_project.py:100: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s tests/__init__.py:255: in wrapped 378s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 378s disable_languages_test = True 378s fun = .should_fail at 0x3ffb62f8860> 378s iargs = () 378s ikwargs = {} 378s ret = False 378s wrapped = .should_fail at 0x3ffb62f8900> 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-3/should_fail0') 378s setup_args = ['build'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-3/should_fail0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s ----------------------------- Captured stdout call ----------------------------- 378s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-3/should_fail0/.git/ 378s [master (root-commit) 799eb12] Initial commit 378s 2 files changed, 16 insertions(+) 378s create mode 100644 CMakeLists.txt 378s create mode 100644 setup.py 378s ----------------------------- Captured stderr call ----------------------------- 378s hint: Using 'master' as the name for the initial branch. This default branch name 378s hint: is subject to change. To configure the initial branch name to use in all 378s hint: of your new repositories, which will suppress this warning, call: 378s hint: 378s hint: git config --global init.defaultBranch 378s hint: 378s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 378s hint: 'development'. The just-created branch can be renamed via this command: 378s hint: 378s hint: git branch -m 378s _________________________ test_invalid_cmake[OSError] __________________________ 378s 378s exception = 378s mocker = 378s 378s @pytest.mark.parametrize("exception", [CalledProcessError, OSError]) 378s def test_invalid_cmake(exception, mocker): 378s exceptions = { 378s OSError: OSError("Unknown error"), 378s CalledProcessError: CalledProcessError(1, [CMAKE_DEFAULT_EXECUTABLE, "--version"]), 378s } 378s 378s run_original = run 378s 378s def run_mock(*args, **kwargs): 378s if args[0] == [CMAKE_DEFAULT_EXECUTABLE, "--version"]: 378s raise exceptions[exception] 378s return run_original(*args, **kwargs) 378s 378s mocker.patch("skbuild.cmaker.subprocess.run", new=run_mock) 378s 378s with push_dir(): 378s 378s @project_setup_py_test("hello-no-language", ["build"], disable_languages_test=True) 378s def should_fail(): 378s pass 378s 378s with pytest.raises(SystemExit) as excinfo: 378s > should_fail() 378s 378s exception = 378s exceptions = {: OSError('Unknown error'), : CalledProcessError(1, ['/usr/bin/cmake', '--version'])} 378s excinfo = 378s mocker = 378s run_mock = .run_mock at 0x3ffb62f94e0> 378s run_original = 378s should_fail = .should_fail at 0x3ffb62f9800> 378s 378s tests/test_broken_project.py:100: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s tests/__init__.py:255: in wrapped 378s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 378s disable_languages_test = True 378s fun = .should_fail at 0x3ffb62f96c0> 378s iargs = () 378s ikwargs = {} 378s ret = False 378s wrapped = .should_fail at 0x3ffb62f9800> 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-4/should_fail0') 378s setup_args = ['build'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-4/should_fail0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s ----------------------------- Captured stdout call ----------------------------- 378s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-4/should_fail0/.git/ 378s [master (root-commit) 799eb12] Initial commit 378s 2 files changed, 16 insertions(+) 378s create mode 100644 CMakeLists.txt 378s create mode 100644 setup.py 378s ----------------------------- Captured stderr call ----------------------------- 378s hint: Using 'master' as the name for the initial branch. This default branch name 378s hint: is subject to change. To configure the initial branch name to use in all 378s hint: of your new repositories, which will suppress this warning, call: 378s hint: 378s hint: git config --global init.defaultBranch 378s hint: 378s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 378s hint: 'development'. The just-created branch can be renamed via this command: 378s hint: 378s hint: git branch -m 378s _________________________ test_first_invalid_generator _________________________ 378s 378s mocker = 378s capfd = <_pytest.capture.CaptureFixture object at 0x3ffb62e9ee0> 378s 378s def test_first_invalid_generator(mocker, capfd): 378s platform = get_platform() 378s default_generators = [CMakeGenerator("Invalid")] 378s default_generators.extend(platform.default_generators) 378s mocker.patch.object( 378s type(platform), "default_generators", new_callable=mocker.PropertyMock, return_value=default_generators 378s ) 378s 378s mocker.patch("skbuild.cmaker.get_platform", return_value=platform) 378s 378s with push_dir(), push_env(CMAKE_GENERATOR=None): 378s 378s @project_setup_py_test("hello-no-language", ["build"]) 378s def run_build(): 378s pass 378s 378s > run_build() 378s 378s capfd = <_pytest.capture.CaptureFixture object at 0x3ffb62e9ee0> 378s default_generators = [, , ] 378s mocker = 378s platform = 378s run_build = .run_build at 0x3ffb62fa2a0> 378s 378s tests/test_broken_project.py:124: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s tests/__init__.py:255: in wrapped 378s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 378s disable_languages_test = False 378s fun = .run_build at 0x3ffb62fa200> 378s iargs = () 378s ikwargs = {} 378s ret = False 378s wrapped = .run_build at 0x3ffb62fa2a0> 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-5/run_build0') 378s setup_args = ['build'], disable_languages_test = False 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = False 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-5/run_build0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s ----------------------------- Captured stdout call ----------------------------- 378s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-5/run_build0/.git/ 378s [master (root-commit) 799eb12] Initial commit 378s 2 files changed, 16 insertions(+) 378s create mode 100644 CMakeLists.txt 378s create mode 100644 setup.py 378s ----------------------------- Captured stderr call ----------------------------- 378s hint: Using 'master' as the name for the initial branch. This default branch name 378s hint: is subject to change. To configure the initial branch name to use in all 378s hint: of your new repositories, which will suppress this warning, call: 378s hint: 378s hint: git config --global init.defaultBranch 378s hint: 378s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 378s hint: 'development'. The just-created branch can be renamed via this command: 378s hint: 378s hint: git branch -m 378s ____________________________ test_invalid_generator ____________________________ 378s 378s mocker = 378s capfd = <_pytest.capture.CaptureFixture object at 0x3ffb62ebf20> 378s 378s def test_invalid_generator(mocker, capfd): 378s platform = get_platform() 378s mocker.patch.object( 378s type(platform), "default_generators", new_callable=mocker.PropertyMock, return_value=[CMakeGenerator("Invalid")] 378s ) 378s mocker.patch("skbuild.cmaker.get_platform", return_value=platform) 378s 378s with push_dir(), push_env(CMAKE_GENERATOR=None): 378s 378s @project_setup_py_test("hello-no-language", ["build"]) 378s def should_fail(): 378s pass 378s 378s with pytest.raises(SystemExit) as excinfo: 378s > should_fail() 378s 378s capfd = <_pytest.capture.CaptureFixture object at 0x3ffb62ebf20> 378s excinfo = 378s mocker = 378s platform = 378s should_fail = .should_fail at 0x3ffb62fa980> 378s 378s tests/test_broken_project.py:144: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s tests/__init__.py:255: in wrapped 378s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 378s disable_languages_test = False 378s fun = .should_fail at 0x3ffb62fa8e0> 378s iargs = () 378s ikwargs = {} 378s ret = False 378s wrapped = .should_fail at 0x3ffb62fa980> 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-6/should_fail0') 378s setup_args = ['build'], disable_languages_test = False 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = False 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-6/should_fail0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s ----------------------------- Captured stdout call ----------------------------- 378s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-6/should_fail0/.git/ 378s [master (root-commit) 799eb12] Initial commit 378s 2 files changed, 16 insertions(+) 378s create mode 100644 CMakeLists.txt 378s create mode 100644 setup.py 378s ----------------------------- Captured stderr call ----------------------------- 378s hint: Using 'master' as the name for the initial branch. This default branch name 378s hint: is subject to change. To configure the initial branch name to use in all 378s hint: of your new repositories, which will suppress this warning, call: 378s hint: 378s hint: git config --global init.defaultBranch 378s hint: 378s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 378s hint: 'development'. The just-created branch can be renamed via this command: 378s hint: 378s hint: git branch -m 378s ___________________________ test_cmake_target_build ____________________________ 378s 378s iargs = () 378s ikwargs = {'capsys': <_pytest.capture.CaptureFixture object at 0x3ffb62eae10>} 378s 378s @functools.wraps(fun) 378s def wrapped(*iargs, **ikwargs): 378s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 378s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 378s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 378s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 378s 378s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 378s 378s disable_languages_test = True 378s fun = 378s iargs = () 378s ikwargs = {'capsys': <_pytest.capture.CaptureFixture object at 0x3ffb62eae10>} 378s ret = False 378s wrapped = 378s 378s tests/__init__.py:255: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-7/test_cmake_target_build0') 378s setup_args = ['build'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-7/test_cmake_target_build0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s ----------------------------- Captured stdout call ----------------------------- 378s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-7/test_cmake_target_build0/.git/ 378s [master (root-commit) 07cc9f0] Initial commit 378s 2 files changed, 26 insertions(+) 378s create mode 100644 CMakeLists.txt 378s create mode 100644 setup.py 378s ----------------------------- Captured stderr call ----------------------------- 378s hint: Using 'master' as the name for the initial branch. This default branch name 378s hint: is subject to change. To configure the initial branch name to use in all 378s hint: of your new repositories, which will suppress this warning, call: 378s hint: 378s hint: git config --global init.defaultBranch 378s hint: 378s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 378s hint: 'development'. The just-created branch can be renamed via this command: 378s hint: 378s hint: git branch -m 378s __________________________________ test_build __________________________________ 378s 378s iargs = () 378s ikwargs = {'capsys': <_pytest.capture.CaptureFixture object at 0x3ffb62e82f0>} 378s 378s @functools.wraps(fun) 378s def wrapped(*iargs, **ikwargs): 378s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 378s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 378s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 378s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 378s 378s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 378s 378s disable_languages_test = True 378s fun = 378s iargs = () 378s ikwargs = {'capsys': <_pytest.capture.CaptureFixture object at 0x3ffb62e82f0>} 378s ret = False 378s wrapped = 378s 378s tests/__init__.py:255: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-8/test_build0') 378s setup_args = ['build'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-8/test_build0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s ----------------------------- Captured stdout call ----------------------------- 378s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-8/test_build0/.git/ 378s [master (root-commit) 59463f7] Initial commit 378s 5 files changed, 94 insertions(+) 378s create mode 100644 hello/CMakeLists.txt 378s create mode 100644 hello/__init__.py 378s create mode 100644 hello/__main__.py 378s create mode 100644 hello/_hello.cxx 378s create mode 100644 setup.py 378s ----------------------------- Captured stderr call ----------------------------- 378s hint: Using 'master' as the name for the initial branch. This default branch name 378s hint: is subject to change. To configure the initial branch name to use in all 378s hint: of your new repositories, which will suppress this warning, call: 378s hint: 378s hint: git config --global init.defaultBranch 378s hint: 378s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 378s hint: 'development'. The just-created branch can be renamed via this command: 378s hint: 378s hint: git branch -m 378s _____________________ test_cmake_source_dir[invalid-True] ______________________ 378s 378s cmake_source_dir = 'invalid', expected_failed = True 378s 378s @pytest.mark.parametrize( 378s ("cmake_source_dir", "expected_failed"), 378s [ 378s ("invalid", True), 378s ("", False), 378s (".", False), 378s ], 378s ) 378s def test_cmake_source_dir(cmake_source_dir, expected_failed): 378s tmp_dir = _tmpdir("test_cmake_source_dir") 378s 378s tmp_dir.join("setup.py").write( 378s textwrap.dedent( 378s f""" 378s from skbuild import setup 378s setup( 378s name="test_cmake_source_dir", 378s version="1.2.3", 378s description="a minimal example package", 378s author='The scikit-build team', 378s license="MIT", 378s cmake_source_dir="{cmake_source_dir}" 378s ) 378s """ 378s ) 378s ) 378s 378s failed = False 378s message = "" 378s try: 378s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 378s 378s cmake_source_dir = 'invalid' 378s expected_failed = True 378s failed = False 378s message = '' 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-9/test_cmake_source_dir0') 378s 378s tests/test_cmakelists_not_in_top_level_dir.py:60: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-9/test_cmake_source_dir0') 378s setup_args = ['build'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-9/test_cmake_source_dir0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s ________________________ test_cmake_source_dir[-False] _________________________ 378s 378s cmake_source_dir = '', expected_failed = False 378s 378s @pytest.mark.parametrize( 378s ("cmake_source_dir", "expected_failed"), 378s [ 378s ("invalid", True), 378s ("", False), 378s (".", False), 378s ], 378s ) 378s def test_cmake_source_dir(cmake_source_dir, expected_failed): 378s tmp_dir = _tmpdir("test_cmake_source_dir") 378s 378s tmp_dir.join("setup.py").write( 378s textwrap.dedent( 378s f""" 378s from skbuild import setup 378s setup( 378s name="test_cmake_source_dir", 378s version="1.2.3", 378s description="a minimal example package", 378s author='The scikit-build team', 378s license="MIT", 378s cmake_source_dir="{cmake_source_dir}" 378s ) 378s """ 378s ) 378s ) 378s 378s failed = False 378s message = "" 378s try: 378s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 378s 378s cmake_source_dir = '' 378s expected_failed = False 378s failed = False 378s message = '' 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-10/test_cmake_source_dir0') 378s 378s tests/test_cmakelists_not_in_top_level_dir.py:60: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-10/test_cmake_source_dir0') 378s setup_args = ['build'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-10/test_cmake_source_dir0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s ________________________ test_cmake_source_dir[.-False] ________________________ 378s 378s cmake_source_dir = '.', expected_failed = False 378s 378s @pytest.mark.parametrize( 378s ("cmake_source_dir", "expected_failed"), 378s [ 378s ("invalid", True), 378s ("", False), 378s (".", False), 378s ], 378s ) 378s def test_cmake_source_dir(cmake_source_dir, expected_failed): 378s tmp_dir = _tmpdir("test_cmake_source_dir") 378s 378s tmp_dir.join("setup.py").write( 378s textwrap.dedent( 378s f""" 378s from skbuild import setup 378s setup( 378s name="test_cmake_source_dir", 378s version="1.2.3", 378s description="a minimal example package", 378s author='The scikit-build team', 378s license="MIT", 378s cmake_source_dir="{cmake_source_dir}" 378s ) 378s """ 378s ) 378s ) 378s 378s failed = False 378s message = "" 378s try: 378s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 378s 378s cmake_source_dir = '.' 378s expected_failed = False 378s failed = False 378s message = '' 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-11/test_cmake_source_dir0') 378s 378s tests/test_cmakelists_not_in_top_level_dir.py:60: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-11/test_cmake_source_dir0') 378s setup_args = ['build'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-11/test_cmake_source_dir0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s __________________________________ test_help ___________________________________ 378s 378s iargs = () 378s ikwargs = {'capsys': <_pytest.capture.CaptureFixture object at 0x3ffb6138710>} 378s 378s @functools.wraps(fun) 378s def wrapped(*iargs, **ikwargs): 378s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 378s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 378s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 378s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 378s 378s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 378s 378s disable_languages_test = True 378s fun = 378s iargs = () 378s ikwargs = {'capsys': <_pytest.capture.CaptureFixture object at 0x3ffb6138710>} 378s ret = False 378s wrapped = 378s 378s tests/__init__.py:255: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-22/test_help0') 378s setup_args = ['--help'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-22/test_help0') 378s setup_args = ['--help'] 378s 378s tests/__init__.py:218: AttributeError 378s ----------------------------- Captured stdout call ----------------------------- 378s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-22/test_help0/.git/ 378s [master (root-commit) b816969] Initial commit 378s 2 files changed, 16 insertions(+) 378s create mode 100644 CMakeLists.txt 378s create mode 100644 setup.py 378s ----------------------------- Captured stderr call ----------------------------- 378s hint: Using 'master' as the name for the initial branch. This default branch name 378s hint: is subject to change. To configure the initial branch name to use in all 378s hint: of your new repositories, which will suppress this warning, call: 378s hint: 378s hint: git config --global init.defaultBranch 378s hint: 378s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 378s hint: 'development'. The just-created branch can be renamed via this command: 378s hint: 378s hint: git branch -m 378s ____________________________ test_metadata_display _____________________________ 378s 378s iargs = () 378s ikwargs = {'capsys': <_pytest.capture.CaptureFixture object at 0x3ffb62e64b0>} 378s 378s @functools.wraps(fun) 378s def wrapped(*iargs, **ikwargs): 378s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 378s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 378s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 378s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 378s 378s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 378s 378s disable_languages_test = True 378s fun = 378s iargs = () 378s ikwargs = {'capsys': <_pytest.capture.CaptureFixture object at 0x3ffb62e64b0>} 378s ret = False 378s wrapped = 378s 378s tests/__init__.py:255: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-23/test_metadata_display0') 378s setup_args = ['--author', '--name'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-23/test_metadata_display0') 378s setup_args = ['--author', '--name'] 378s 378s tests/__init__.py:218: AttributeError 378s ----------------------------- Captured stdout call ----------------------------- 378s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-23/test_metadata_display0/.git/ 378s [master (root-commit) b816969] Initial commit 378s 2 files changed, 16 insertions(+) 378s create mode 100644 CMakeLists.txt 378s create mode 100644 setup.py 378s ----------------------------- Captured stderr call ----------------------------- 378s hint: Using 'master' as the name for the initial branch. This default branch name 378s hint: is subject to change. To configure the initial branch name to use in all 378s hint: of your new repositories, which will suppress this warning, call: 378s hint: 378s hint: git config --global init.defaultBranch 378s hint: 378s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 378s hint: 'development'. The just-created branch can be renamed via this command: 378s hint: 378s hint: git branch -m 378s _______________________________ test_no_command ________________________________ 378s 378s def test_no_command(): 378s with push_dir(): 378s 378s @project_setup_py_test("hello-no-language", [], disable_languages_test=True) 378s def run(): 378s pass 378s 378s failed = False 378s try: 378s > run() 378s 378s failed = False 378s run = .run at 0x3ffb62faa20> 378s 378s tests/test_command_line.py:62: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s tests/__init__.py:255: in wrapped 378s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 378s disable_languages_test = True 378s fun = .run at 0x3ffb62faac0> 378s iargs = () 378s ikwargs = {} 378s ret = False 378s wrapped = .run at 0x3ffb62faa20> 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-24/run0'), setup_args = [] 378s disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-24/run0') 378s setup_args = [] 378s 378s tests/__init__.py:218: AttributeError 378s ----------------------------- Captured stdout call ----------------------------- 378s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-24/run0/.git/ 378s [master (root-commit) b816969] Initial commit 378s 2 files changed, 16 insertions(+) 378s create mode 100644 CMakeLists.txt 378s create mode 100644 setup.py 378s ----------------------------- Captured stderr call ----------------------------- 378s hint: Using 'master' as the name for the initial branch. This default branch name 378s hint: is subject to change. To configure the initial branch name to use in all 378s hint: of your new repositories, which will suppress this warning, call: 378s hint: 378s hint: git config --global init.defaultBranch 378s hint: 378s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 378s hint: 'development'. The just-created branch can be renamed via this command: 378s hint: 378s hint: git branch -m 378s _____________________________ test_invalid_command _____________________________ 378s 378s def test_invalid_command(): 378s with push_dir(): 378s 378s @project_setup_py_test("hello-no-language", ["unknown"], disable_languages_test=True) 378s def run(): 378s pass 378s 378s failed = False 378s try: 378s > run() 378s 378s failed = False 378s run = .run at 0x3ffb62f8e00> 378s 378s tests/test_command_line.py:79: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s tests/__init__.py:255: in wrapped 378s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 378s disable_languages_test = True 378s fun = .run at 0x3ffb62f8cc0> 378s iargs = () 378s ikwargs = {} 378s ret = False 378s wrapped = .run at 0x3ffb62f8e00> 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-25/run0') 378s setup_args = ['unknown'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-25/run0') 378s setup_args = ['unknown'] 378s 378s tests/__init__.py:218: AttributeError 378s ----------------------------- Captured stdout call ----------------------------- 378s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-25/run0/.git/ 378s [master (root-commit) b816969] Initial commit 378s 2 files changed, 16 insertions(+) 378s create mode 100644 CMakeLists.txt 378s create mode 100644 setup.py 378s ----------------------------- Captured stderr call ----------------------------- 378s hint: Using 'master' as the name for the initial branch. This default branch name 378s hint: is subject to change. To configure the initial branch name to use in all 378s hint: of your new repositories, which will suppress this warning, call: 378s hint: 378s hint: git config --global init.defaultBranch 378s hint: 378s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 378s hint: 'development'. The just-created branch can be renamed via this command: 378s hint: 378s hint: git branch -m 378s ___________________________ test_too_many_separators ___________________________ 378s 378s def test_too_many_separators(): 378s with push_dir(): 378s 378s @project_setup_py_test("hello-no-language", ["--"] * 3, disable_languages_test=True) 378s def run(): 378s pass 378s 378s failed = False 378s try: 378s > run() 378s 378s failed = False 378s run = .run at 0x3ffb62fb600> 378s 378s tests/test_command_line.py:96: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s tests/__init__.py:255: in wrapped 378s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 378s disable_languages_test = True 378s fun = .run at 0x3ffb62f9760> 378s iargs = () 378s ikwargs = {} 378s ret = False 378s wrapped = .run at 0x3ffb62fb600> 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-26/run0') 378s setup_args = ['--', '--', '--'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-26/run0') 378s setup_args = ['--', '--', '--'] 378s 378s tests/__init__.py:218: AttributeError 378s ----------------------------- Captured stdout call ----------------------------- 378s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-26/run0/.git/ 378s [master (root-commit) b816969] Initial commit 378s 2 files changed, 16 insertions(+) 378s create mode 100644 CMakeLists.txt 378s create mode 100644 setup.py 378s ----------------------------- Captured stderr call ----------------------------- 378s hint: Using 'master' as the name for the initial branch. This default branch name 378s hint: is subject to change. To configure the initial branch name to use in all 378s hint: of your new repositories, which will suppress this warning, call: 378s hint: 378s hint: git config --global init.defaultBranch 378s hint: 378s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 378s hint: 'development'. The just-created branch can be renamed via this command: 378s hint: 378s hint: git branch -m 378s __________________ test_cmake_initial_cache_as_global_option ___________________ 378s 378s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-21/test_cmake_initial_cache_as_gl0') 378s 378s def test_cmake_initial_cache_as_global_option(tmpdir): 378s project = "hello-no-language" 378s prepare_project(project, tmpdir) 378s initialize_git_repo_and_commit(tmpdir, verbose=True) 378s 378s initial_cache = tmpdir.join("initial-cache.txt") 378s initial_cache.write("""set(MY_CMAKE_VARIABLE "1" CACHE BOOL "My cache variable")""") 378s 378s try: 378s > with execute_setup_py(tmpdir, [f"-C{initial_cache}", "build"], disable_languages_test=True): 378s 378s initial_cache = local('/tmp/pytest-of-ubuntu/pytest-21/test_cmake_initial_cache_as_gl0/initial-cache.txt') 378s project = 'hello-no-language' 378s tmpdir = local('/tmp/pytest-of-ubuntu/pytest-21/test_cmake_initial_cache_as_gl0') 378s 378s tests/test_command_line.py:112: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-21/test_cmake_initial_cache_as_gl0') 378s setup_args = ['-C/tmp/pytest-of-ubuntu/pytest-21/test_cmake_initial_cache_as_gl0/initial-cache.txt', 'build'] 378s disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-21/test_cmake_initial_cache_as_gl0') 378s setup_args = ['-C/tmp/pytest-of-ubuntu/pytest-21/test_cmake_initial_cache_as_gl0/initial-cache.txt', 'build'] 378s 378s tests/__init__.py:218: AttributeError 378s ----------------------------- Captured stdout call ----------------------------- 378s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-21/test_cmake_initial_cache_as_gl0/.git/ 378s [master (root-commit) b816969] Initial commit 378s 2 files changed, 16 insertions(+) 378s create mode 100644 CMakeLists.txt 378s create mode 100644 setup.py 378s ----------------------------- Captured stderr call ----------------------------- 378s hint: Using 'master' as the name for the initial branch. This default branch name 378s hint: is subject to change. To configure the initial branch name to use in all 378s hint: of your new repositories, which will suppress this warning, call: 378s hint: 378s hint: git config --global init.defaultBranch 378s hint: 378s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 378s hint: 'development'. The just-created branch can be renamed via this command: 378s hint: 378s hint: git branch -m 378s __________________________ test_cmake_executable_arg ___________________________ 378s 378s def test_cmake_executable_arg(): 378s cmake_executable = "/path/to/invalid/cmake" 378s 378s @project_setup_py_test( 378s "hello-no-language", ["--cmake-executable", cmake_executable, "build"], disable_languages_test=True 378s ) 378s def should_fail(): 378s pass 378s 378s failed = False 378s message = "" 378s try: 378s > should_fail() 378s 378s cmake_executable = '/path/to/invalid/cmake' 378s failed = False 378s message = '' 378s should_fail = .should_fail at 0x3ffb62f9760> 378s 378s tests/test_command_line.py:134: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s tests/__init__.py:255: in wrapped 378s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 378s disable_languages_test = True 378s fun = .should_fail at 0x3ffb62f8860> 378s iargs = () 378s ikwargs = {} 378s ret = False 378s wrapped = .should_fail at 0x3ffb62f9760> 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-27/should_fail0') 378s setup_args = ['--cmake-executable', '/path/to/invalid/cmake', 'build'] 378s disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-27/should_fail0') 378s setup_args = ['--cmake-executable', '/path/to/invalid/cmake', 'build'] 378s 378s tests/__init__.py:218: AttributeError 378s ----------------------------- Captured stdout call ----------------------------- 378s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-27/should_fail0/.git/ 378s [master (root-commit) b816969] Initial commit 378s 2 files changed, 16 insertions(+) 378s create mode 100644 CMakeLists.txt 378s create mode 100644 setup.py 378s ----------------------------- Captured stderr call ----------------------------- 378s hint: Using 'master' as the name for the initial branch. This default branch name 378s hint: is subject to change. To configure the initial branch name to use in all 378s hint: of your new repositories, which will suppress this warning, call: 378s hint: 378s hint: git config --global init.defaultBranch 378s hint: 378s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 378s hint: 'development'. The just-created branch can be renamed via this command: 378s hint: 378s hint: git branch -m 378s ________________________ test_hide_listing[True-sdist] _________________________ 378s 378s action = 'sdist', hide_listing = True 378s capfd = <_pytest.capture.CaptureFixture object at 0x3ffb6154350> 378s caplog = <_pytest.logging.LogCaptureFixture object at 0x3ffb6157770> 378s 378s @pytest.mark.parametrize("action", ["sdist", "bdist_wheel"]) 378s @pytest.mark.parametrize("hide_listing", [True, False]) 378s def test_hide_listing(action, hide_listing, capfd, caplog): 378s cmd = [action] 378s if hide_listing: 378s cmd.insert(0, "--hide-listing") 378s 378s @project_setup_py_test("test-hide-listing", cmd, verbose_git=False, disable_languages_test=True) 378s def run(): 378s pass 378s 378s > run() 378s 378s action = 'sdist' 378s capfd = <_pytest.capture.CaptureFixture object at 0x3ffb6154350> 378s caplog = <_pytest.logging.LogCaptureFixture object at 0x3ffb6157770> 378s cmd = ['--hide-listing', 'sdist'] 378s hide_listing = True 378s run = .run at 0x3ffb62fb2e0> 378s 378s tests/test_command_line.py:154: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s tests/__init__.py:255: in wrapped 378s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 378s disable_languages_test = True 378s fun = .run at 0x3ffb62f8e00> 378s iargs = () 378s ikwargs = {} 378s ret = False 378s wrapped = .run at 0x3ffb62fb2e0> 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-28/run0') 378s setup_args = ['--hide-listing', 'sdist'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-28/run0') 378s setup_args = ['--hide-listing', 'sdist'] 378s 378s tests/__init__.py:218: AttributeError 378s ----------------------------- Captured stderr call ----------------------------- 378s hint: Using 'master' as the name for the initial branch. This default branch name 378s hint: is subject to change. To configure the initial branch name to use in all 378s hint: of your new repositories, which will suppress this warning, call: 378s hint: 378s hint: git config --global init.defaultBranch 378s hint: 378s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 378s hint: 'development'. The just-created branch can be renamed via this command: 378s hint: 378s hint: git branch -m 378s _____________________ test_hide_listing[True-bdist_wheel] ______________________ 378s 378s action = 'bdist_wheel', hide_listing = True 378s capfd = <_pytest.capture.CaptureFixture object at 0x3ffb6154f20> 378s caplog = <_pytest.logging.LogCaptureFixture object at 0x3ffb6155430> 378s 378s @pytest.mark.parametrize("action", ["sdist", "bdist_wheel"]) 378s @pytest.mark.parametrize("hide_listing", [True, False]) 378s def test_hide_listing(action, hide_listing, capfd, caplog): 378s cmd = [action] 378s if hide_listing: 378s cmd.insert(0, "--hide-listing") 378s 378s @project_setup_py_test("test-hide-listing", cmd, verbose_git=False, disable_languages_test=True) 378s def run(): 378s pass 378s 378s > run() 378s 378s action = 'bdist_wheel' 378s capfd = <_pytest.capture.CaptureFixture object at 0x3ffb6154f20> 378s caplog = <_pytest.logging.LogCaptureFixture object at 0x3ffb6155430> 378s cmd = ['--hide-listing', 'bdist_wheel'] 378s hide_listing = True 378s run = .run at 0x3ffb62f93a0> 378s 378s tests/test_command_line.py:154: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s tests/__init__.py:255: in wrapped 378s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 378s disable_languages_test = True 378s fun = .run at 0x3ffb62fa700> 378s iargs = () 378s ikwargs = {} 378s ret = False 378s wrapped = .run at 0x3ffb62f93a0> 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-29/run0') 378s setup_args = ['--hide-listing', 'bdist_wheel'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-29/run0') 378s setup_args = ['--hide-listing', 'bdist_wheel'] 378s 378s tests/__init__.py:218: AttributeError 378s ----------------------------- Captured stderr call ----------------------------- 378s hint: Using 'master' as the name for the initial branch. This default branch name 378s hint: is subject to change. To configure the initial branch name to use in all 378s hint: of your new repositories, which will suppress this warning, call: 378s hint: 378s hint: git config --global init.defaultBranch 378s hint: 378s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 378s hint: 'development'. The just-created branch can be renamed via this command: 378s hint: 378s hint: git branch -m 378s ________________________ test_hide_listing[False-sdist] ________________________ 378s 378s action = 'sdist', hide_listing = False 378s capfd = <_pytest.capture.CaptureFixture object at 0x3ffb6157980> 378s caplog = <_pytest.logging.LogCaptureFixture object at 0x3ffb62aacc0> 378s 378s @pytest.mark.parametrize("action", ["sdist", "bdist_wheel"]) 378s @pytest.mark.parametrize("hide_listing", [True, False]) 378s def test_hide_listing(action, hide_listing, capfd, caplog): 378s cmd = [action] 378s if hide_listing: 378s cmd.insert(0, "--hide-listing") 378s 378s @project_setup_py_test("test-hide-listing", cmd, verbose_git=False, disable_languages_test=True) 378s def run(): 378s pass 378s 378s > run() 378s 378s action = 'sdist' 378s capfd = <_pytest.capture.CaptureFixture object at 0x3ffb6157980> 378s caplog = <_pytest.logging.LogCaptureFixture object at 0x3ffb62aacc0> 378s cmd = ['sdist'] 378s hide_listing = False 378s run = .run at 0x3ffb62bae80> 378s 378s tests/test_command_line.py:154: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s tests/__init__.py:255: in wrapped 378s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 378s disable_languages_test = True 378s fun = .run at 0x3ffb62bade0> 378s iargs = () 378s ikwargs = {} 378s ret = False 378s wrapped = .run at 0x3ffb62bae80> 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-30/run0') 378s setup_args = ['sdist'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-30/run0') 378s setup_args = ['sdist'] 378s 378s tests/__init__.py:218: AttributeError 378s ----------------------------- Captured stderr call ----------------------------- 378s hint: Using 'master' as the name for the initial branch. This default branch name 378s hint: is subject to change. To configure the initial branch name to use in all 378s hint: of your new repositories, which will suppress this warning, call: 378s hint: 378s hint: git config --global init.defaultBranch 378s hint: 378s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 378s hint: 'development'. The just-created branch can be renamed via this command: 378s hint: 378s hint: git branch -m 378s _____________________ test_hide_listing[False-bdist_wheel] _____________________ 378s 378s action = 'bdist_wheel', hide_listing = False 378s capfd = <_pytest.capture.CaptureFixture object at 0x3ffb6154110> 378s caplog = <_pytest.logging.LogCaptureFixture object at 0x3ffb6157d40> 378s 378s @pytest.mark.parametrize("action", ["sdist", "bdist_wheel"]) 378s @pytest.mark.parametrize("hide_listing", [True, False]) 378s def test_hide_listing(action, hide_listing, capfd, caplog): 378s cmd = [action] 378s if hide_listing: 378s cmd.insert(0, "--hide-listing") 378s 378s @project_setup_py_test("test-hide-listing", cmd, verbose_git=False, disable_languages_test=True) 378s def run(): 378s pass 378s 378s > run() 378s 378s action = 'bdist_wheel' 378s capfd = <_pytest.capture.CaptureFixture object at 0x3ffb6154110> 378s caplog = <_pytest.logging.LogCaptureFixture object at 0x3ffb6157d40> 378s cmd = ['bdist_wheel'] 378s hide_listing = False 378s run = .run at 0x3ffb62f9e40> 378s 378s tests/test_command_line.py:154: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s tests/__init__.py:255: in wrapped 378s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 378s disable_languages_test = True 378s fun = .run at 0x3ffb62fa0c0> 378s iargs = () 378s ikwargs = {} 378s ret = False 378s wrapped = .run at 0x3ffb62f9e40> 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-31/run0') 378s setup_args = ['bdist_wheel'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-31/run0') 378s setup_args = ['bdist_wheel'] 378s 378s tests/__init__.py:218: AttributeError 378s ----------------------------- Captured stderr call ----------------------------- 378s hint: Using 'master' as the name for the initial branch. This default branch name 378s hint: is subject to change. To configure the initial branch name to use in all 378s hint: of your new repositories, which will suppress this warning, call: 378s hint: 378s hint: git config --global init.defaultBranch 378s hint: 378s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 378s hint: 'development'. The just-created branch can be renamed via this command: 378s hint: 378s hint: git branch -m 378s ______________________________ test_run_cmake_arg ______________________________ 378s 378s iargs = () 378s ikwargs = {'capfd': <_pytest.capture.CaptureFixture object at 0x3ffb6349ca0>} 378s 378s @functools.wraps(fun) 378s def wrapped(*iargs, **ikwargs): 378s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 378s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 378s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 378s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 378s 378s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 378s 378s disable_languages_test = True 378s fun = 378s iargs = () 378s ikwargs = {'capfd': <_pytest.capture.CaptureFixture object at 0x3ffb6349ca0>} 378s ret = False 378s wrapped = 378s 378s tests/__init__.py:255: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-32/test_run_cmake_arg0') 378s setup_args = ['--force-cmake', '--help'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-32/test_run_cmake_arg0') 378s setup_args = ['--force-cmake', '--help'] 378s 378s tests/__init__.py:218: AttributeError 378s ----------------------------- Captured stdout call ----------------------------- 378s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-32/test_run_cmake_arg0/.git/ 378s [master (root-commit) 445b079] Initial commit 378s 2 files changed, 16 insertions(+) 378s create mode 100644 CMakeLists.txt 378s create mode 100644 setup.py 378s ----------------------------- Captured stderr call ----------------------------- 378s hint: Using 'master' as the name for the initial branch. This default branch name 378s hint: is subject to change. To configure the initial branch name to use in all 378s hint: of your new repositories, which will suppress this warning, call: 378s hint: 378s hint: git config --global init.defaultBranch 378s hint: 378s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 378s hint: 'development'. The just-created branch can be renamed via this command: 378s hint: 378s hint: git branch -m 378s _____________________________ test_skip_cmake_arg ______________________________ 378s 378s iargs = () 378s ikwargs = {'capfd': <_pytest.capture.CaptureFixture object at 0x3ffb62ab200>} 378s 378s @functools.wraps(fun) 378s def wrapped(*iargs, **ikwargs): 378s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 378s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 378s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 378s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 378s 378s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 378s 378s disable_languages_test = True 378s fun = 378s iargs = () 378s ikwargs = {'capfd': <_pytest.capture.CaptureFixture object at 0x3ffb62ab200>} 378s ret = False 378s wrapped = 378s 378s tests/__init__.py:255: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-33/test_skip_cmake_arg0') 378s setup_args = ['--skip-cmake', 'build'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-33/test_skip_cmake_arg0') 378s setup_args = ['--skip-cmake', 'build'] 378s 378s tests/__init__.py:218: AttributeError 378s ----------------------------- Captured stdout call ----------------------------- 378s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-33/test_skip_cmake_arg0/.git/ 378s [master (root-commit) 445b079] Initial commit 378s 2 files changed, 16 insertions(+) 378s create mode 100644 CMakeLists.txt 378s create mode 100644 setup.py 378s ----------------------------- Captured stderr call ----------------------------- 378s hint: Using 'master' as the name for the initial branch. This default branch name 378s hint: is subject to change. To configure the initial branch name to use in all 378s hint: of your new repositories, which will suppress this warning, call: 378s hint: 378s hint: git config --global init.defaultBranch 378s hint: 378s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 378s hint: 'development'. The just-created branch can be renamed via this command: 378s hint: 378s hint: git branch -m 378s ___________________________ test_hello_cython_builds ___________________________ 378s 378s iargs = (), ikwargs = {} 378s 378s @functools.wraps(fun) 378s def wrapped(*iargs, **ikwargs): 378s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 378s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 378s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 378s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 378s 378s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 378s 378s disable_languages_test = False 378s fun = 378s iargs = () 378s ikwargs = {} 378s ret = False 378s wrapped = 378s 378s tests/__init__.py:255: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-34/test_hello_cython_builds0') 378s setup_args = ['build'], disable_languages_test = False 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = False 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-34/test_hello_cython_builds0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s ----------------------------- Captured stdout call ----------------------------- 378s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-34/test_hello_cython_builds0/.git/ 378s [master (root-commit) 87fb002] Initial commit 378s 6 files changed, 40 insertions(+) 378s create mode 100644 CMakeLists.txt 378s create mode 100644 hello/CMakeLists.txt 378s create mode 100644 hello/__init__.py 378s create mode 100644 hello/__main__.py 378s create mode 100644 hello/_hello.pyx 378s create mode 100644 setup.py 378s ----------------------------- Captured stderr call ----------------------------- 378s hint: Using 'master' as the name for the initial branch. This default branch name 378s hint: is subject to change. To configure the initial branch name to use in all 378s hint: of your new repositories, which will suppress this warning, call: 378s hint: 378s hint: git config --global init.defaultBranch 378s hint: 378s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 378s hint: 'development'. The just-created branch can be renamed via this command: 378s hint: 378s hint: git branch -m 378s ___________________________ test_bdist_wheel_command ___________________________ 378s 378s def test_bdist_wheel_command(): 378s project = "test-filter-manifest" 378s 378s expected_content = [ 378s "hello/__init__.py", 378s "hello/swig_mwe.py", 378s "hello/_swig_mwe.pyd", 378s "hello-1.2.3.data/data/bin/hello", 378s ] 378s 378s expected_distribution_name = "hello-1.2.3" 378s 378s tmp_dir = _tmpdir("test_bdist_wheel_command") 378s prepare_project(project, tmp_dir) 378s initialize_git_repo_and_commit(tmp_dir, verbose=True) 378s 378s relative_setup_path = "wrapping/python/" 378s 378s > with execute_setup_py(tmp_dir.join(relative_setup_path), ["bdist_wheel"]): 378s 378s expected_content = ['hello/__init__.py', 'hello/swig_mwe.py', 'hello/_swig_mwe.pyd', 'hello-1.2.3.data/data/bin/hello'] 378s expected_distribution_name = 'hello-1.2.3' 378s project = 'test-filter-manifest' 378s relative_setup_path = 'wrapping/python/' 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-35/test_bdist_wheel_command0') 378s 378s tests/test_filter_manifest.py:27: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-35/test_bdist_wheel_command0/wrapping/python') 378s setup_args = ['bdist_wheel'], disable_languages_test = False 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = False 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-35/test_bdist_wheel_command0/wrapping/python') 378s setup_args = ['bdist_wheel'] 378s 378s tests/__init__.py:218: AttributeError 378s ----------------------------- Captured stdout call ----------------------------- 378s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-35/test_bdist_wheel_command0/.git/ 378s [master (root-commit) 238b988] Initial commit 378s 4 files changed, 59 insertions(+) 378s create mode 100644 CMakeLists.txt 378s create mode 100644 wrapping/python/CMakeLists.txt 378s create mode 100644 wrapping/python/hello/__init__.py 378s create mode 100644 wrapping/python/setup.py 378s ----------------------------- Captured stderr call ----------------------------- 378s hint: Using 'master' as the name for the initial branch. This default branch name 378s hint: is subject to change. To configure the initial branch name to use in all 378s hint: of your new repositories, which will suppress this warning, call: 378s hint: 378s hint: git config --global init.defaultBranch 378s hint: 378s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 378s hint: 'development'. The just-created branch can be renamed via this command: 378s hint: 378s hint: git branch -m 378s ______________________________ test_hello_builds _______________________________ 378s 378s def test_hello_builds(): 378s with push_dir(): 378s 378s @project_setup_py_test("hello-cpp", ["build"], ret=True) 378s def run(): 378s pass 378s 378s # Check that a project can be build twice in a row 378s # See issue scikit-build#120 378s > tmp_dir = run()[0] 378s 378s run = .run at 0x3ffb62f8860> 378s 378s tests/test_hello_cpp.py:30: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s tests/__init__.py:255: in wrapped 378s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 378s disable_languages_test = False 378s fun = .run at 0x3ffb62faa20> 378s iargs = () 378s ikwargs = {} 378s ret = True 378s wrapped = .run at 0x3ffb62f8860> 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-36/run0') 378s setup_args = ['build'], disable_languages_test = False 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = False 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-36/run0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s ----------------------------- Captured stdout call ----------------------------- 378s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-36/run0/.git/ 378s [master (root-commit) a9e5e13] Initial commit 378s 11 files changed, 115 insertions(+) 378s create mode 100644 CMakeLists.txt 378s create mode 100644 bonjour/__init__.py 378s create mode 100644 bonjour/data/ciel.txt 378s create mode 100644 bonjour/data/soleil.txt 378s create mode 100644 bonjour/data/terre.txt 378s create mode 100644 bonjourModule.py 378s create mode 100644 hello/CMakeLists.txt 378s create mode 100644 hello/__init__.py 378s create mode 100644 hello/__main__.py 378s create mode 100644 hello/_hello.cxx 378s create mode 100644 setup.py 378s ----------------------------- Captured stderr call ----------------------------- 378s hint: Using 'master' as the name for the initial branch. This default branch name 378s hint: is subject to change. To configure the initial branch name to use in all 378s hint: of your new repositories, which will suppress this warning, call: 378s hint: 378s hint: git config --global init.defaultBranch 378s hint: 378s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 378s hint: 'development'. The just-created branch can be renamed via this command: 378s hint: 378s hint: git branch -m 378s _______________________________ test_hello_wheel _______________________________ 378s 378s def test_hello_wheel(): 378s expected_content = [ 378s f"hello/_hello{get_ext_suffix()}", 378s "hello/__init__.py", 378s "hello/__main__.py", 378s "hello/world.py", 378s "helloModule.py", 378s "bonjour/__init__.py", 378s "bonjour/data/ciel.txt", 378s "bonjour/data/soleil.txt", 378s "bonjour/data/terre.txt", 378s "bonjourModule.py", 378s ] 378s 378s expected_distribution_name = "hello-1.2.3" 378s 378s @project_setup_py_test("hello-cpp", ["bdist_wheel"], ret=True) 378s def build_wheel(): 378s whls = glob.glob("dist/*.whl") 378s assert len(whls) == 1 378s check_wheel_content(whls[0], expected_distribution_name, expected_content) 378s os.remove(whls[0]) 378s assert not os.path.exists(whls[0]) 378s 378s assert os.path.exists(os.path.join(CMAKE_BUILD_DIR(), "CMakeCache.txt")) 378s os.remove(os.path.join(CMAKE_BUILD_DIR(), "CMakeCache.txt")) 378s 378s > tmp_dir = build_wheel()[0] 378s 378s build_wheel = .build_wheel at 0x3ffb6160ea0> 378s expected_content = ['hello/_hello.cpython-312-s390x-linux-gnu.so', 'hello/__init__.py', 'hello/__main__.py', 'hello/world.py', 'helloModule.py', 'bonjour/__init__.py', ...] 378s expected_distribution_name = 'hello-1.2.3' 378s 378s tests/test_hello_cpp.py:93: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s tests/__init__.py:255: in wrapped 378s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 378s disable_languages_test = False 378s fun = .build_wheel at 0x3ffb6161440> 378s iargs = () 378s ikwargs = {} 378s ret = True 378s wrapped = .build_wheel at 0x3ffb6160ea0> 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-37/build_wheel0') 378s setup_args = ['bdist_wheel'], disable_languages_test = False 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = False 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-37/build_wheel0') 378s setup_args = ['bdist_wheel'] 378s 378s tests/__init__.py:218: AttributeError 378s ----------------------------- Captured stdout call ----------------------------- 378s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-37/build_wheel0/.git/ 378s [master (root-commit) a9e5e13] Initial commit 378s 11 files changed, 115 insertions(+) 378s create mode 100644 CMakeLists.txt 378s create mode 100644 bonjour/__init__.py 378s create mode 100644 bonjour/data/ciel.txt 378s create mode 100644 bonjour/data/soleil.txt 378s create mode 100644 bonjour/data/terre.txt 378s create mode 100644 bonjourModule.py 378s create mode 100644 hello/CMakeLists.txt 378s create mode 100644 hello/__init__.py 378s create mode 100644 hello/__main__.py 378s create mode 100644 hello/_hello.cxx 378s create mode 100644 setup.py 378s ----------------------------- Captured stderr call ----------------------------- 378s hint: Using 'master' as the name for the initial branch. This default branch name 378s hint: is subject to change. To configure the initial branch name to use in all 378s hint: of your new repositories, which will suppress this warning, call: 378s hint: 378s hint: git config --global init.defaultBranch 378s hint: 378s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 378s hint: 'development'. The just-created branch can be renamed via this command: 378s hint: 378s hint: git branch -m 378s ________________________ test_hello_clean[with-dry-run] ________________________ 378s 378s dry_run = True, capfd = <_pytest.capture.CaptureFixture object at 0x3ffb62e8bf0> 378s 378s @pytest.mark.parametrize("dry_run", ["with-dry-run", "without-dry-run"]) 378s def test_hello_clean(dry_run, capfd): 378s with push_dir(): 378s dry_run = dry_run == "with-dry-run" 378s 378s @project_setup_py_test("hello-cpp", ["build"], ret=True) 378s def run_build(): 378s pass 378s 378s > tmp_dir = run_build()[0] 378s 378s capfd = <_pytest.capture.CaptureFixture object at 0x3ffb62e8bf0> 378s dry_run = True 378s run_build = .run_build at 0x3ffb6161940> 378s 378s tests/test_hello_cpp.py:114: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s tests/__init__.py:255: in wrapped 378s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 378s disable_languages_test = False 378s fun = .run_build at 0x3ffb61600e0> 378s iargs = () 378s ikwargs = {} 378s ret = True 378s wrapped = .run_build at 0x3ffb6161940> 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-38/run_build0') 378s setup_args = ['build'], disable_languages_test = False 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = False 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-38/run_build0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s ----------------------------- Captured stdout call ----------------------------- 378s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-38/run_build0/.git/ 378s [master (root-commit) a9e5e13] Initial commit 378s 11 files changed, 115 insertions(+) 378s create mode 100644 CMakeLists.txt 378s create mode 100644 bonjour/__init__.py 378s create mode 100644 bonjour/data/ciel.txt 378s create mode 100644 bonjour/data/soleil.txt 378s create mode 100644 bonjour/data/terre.txt 378s create mode 100644 bonjourModule.py 378s create mode 100644 hello/CMakeLists.txt 378s create mode 100644 hello/__init__.py 378s create mode 100644 hello/__main__.py 378s create mode 100644 hello/_hello.cxx 378s create mode 100644 setup.py 378s ----------------------------- Captured stderr call ----------------------------- 378s hint: Using 'master' as the name for the initial branch. This default branch name 378s hint: is subject to change. To configure the initial branch name to use in all 378s hint: of your new repositories, which will suppress this warning, call: 378s hint: 378s hint: git config --global init.defaultBranch 378s hint: 378s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 378s hint: 'development'. The just-created branch can be renamed via this command: 378s hint: 378s hint: git branch -m 378s ______________________ test_hello_clean[without-dry-run] _______________________ 378s 378s dry_run = False 378s capfd = <_pytest.capture.CaptureFixture object at 0x3ffb613afc0> 378s 378s @pytest.mark.parametrize("dry_run", ["with-dry-run", "without-dry-run"]) 378s def test_hello_clean(dry_run, capfd): 378s with push_dir(): 378s dry_run = dry_run == "with-dry-run" 378s 378s @project_setup_py_test("hello-cpp", ["build"], ret=True) 378s def run_build(): 378s pass 378s 378s > tmp_dir = run_build()[0] 378s 378s capfd = <_pytest.capture.CaptureFixture object at 0x3ffb613afc0> 378s dry_run = False 378s run_build = .run_build at 0x3ffb6161da0> 378s 378s tests/test_hello_cpp.py:114: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s tests/__init__.py:255: in wrapped 378s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 378s disable_languages_test = False 378s fun = .run_build at 0x3ffb6161bc0> 378s iargs = () 378s ikwargs = {} 378s ret = True 378s wrapped = .run_build at 0x3ffb6161da0> 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-39/run_build0') 378s setup_args = ['build'], disable_languages_test = False 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = False 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-39/run_build0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s ----------------------------- Captured stdout call ----------------------------- 378s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-39/run_build0/.git/ 378s [master (root-commit) a9e5e13] Initial commit 378s 11 files changed, 115 insertions(+) 378s create mode 100644 CMakeLists.txt 378s create mode 100644 bonjour/__init__.py 378s create mode 100644 bonjour/data/ciel.txt 378s create mode 100644 bonjour/data/soleil.txt 378s create mode 100644 bonjour/data/terre.txt 378s create mode 100644 bonjourModule.py 378s create mode 100644 hello/CMakeLists.txt 378s create mode 100644 hello/__init__.py 378s create mode 100644 hello/__main__.py 378s create mode 100644 hello/_hello.cxx 378s create mode 100644 setup.py 378s ----------------------------- Captured stderr call ----------------------------- 378s hint: Using 'master' as the name for the initial branch. This default branch name 378s hint: is subject to change. To configure the initial branch name to use in all 378s hint: of your new repositories, which will suppress this warning, call: 378s hint: 378s hint: git config --global init.defaultBranch 378s hint: 378s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 378s hint: 'development'. The just-created branch can be renamed via this command: 378s hint: 378s hint: git branch -m 378s ______________________________ test_hello_cleans _______________________________ 378s 378s capfd = <_pytest.capture.CaptureFixture object at 0x3ffb62e87a0> 378s caplog = <_pytest.logging.LogCaptureFixture object at 0x3ffb62eac30> 378s 378s def test_hello_cleans(capfd, caplog): 378s with push_dir(): 378s tmp_dir = _tmpdir("test_hello_cleans") 378s 378s _copy_dir(tmp_dir, os.path.join(SAMPLES_DIR, "hello-cpp")) 378s 378s @project_setup_py_test("hello-cpp", ["build"], tmp_dir=tmp_dir) 378s def run_build(): 378s pass 378s 378s @project_setup_py_test("hello-cpp", ["clean"], tmp_dir=tmp_dir) 378s def run_clean(): 378s pass 378s 378s # Check that a project can be cleaned twice in a row 378s > run_build() 378s 378s capfd = <_pytest.capture.CaptureFixture object at 0x3ffb62e87a0> 378s caplog = <_pytest.logging.LogCaptureFixture object at 0x3ffb62eac30> 378s run_build = .run_build at 0x3ffb62f8860> 378s run_clean = .run_clean at 0x3ffb6161e40> 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-40/test_hello_cleans0') 378s 378s tests/test_hello_cpp.py:158: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s tests/__init__.py:255: in wrapped 378s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 378s disable_languages_test = False 378s fun = .run_build at 0x3ffb62faa20> 378s iargs = () 378s ikwargs = {} 378s ret = False 378s wrapped = .run_build at 0x3ffb62f8860> 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-40/test_hello_cleans0') 378s setup_args = ['build'], disable_languages_test = False 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = False 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-40/test_hello_cleans0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s ___________________________ test_hello_cython_builds ___________________________ 378s 378s iargs = (), ikwargs = {} 378s 378s @functools.wraps(fun) 378s def wrapped(*iargs, **ikwargs): 378s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 378s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 378s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 378s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 378s 378s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 378s 378s disable_languages_test = False 378s fun = 378s iargs = () 378s ikwargs = {} 378s ret = False 378s wrapped = 378s 378s tests/__init__.py:255: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-41/test_hello_cython_builds0') 378s setup_args = ['build'], disable_languages_test = False 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = False 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-41/test_hello_cython_builds0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s ----------------------------- Captured stdout call ----------------------------- 378s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-41/test_hello_cython_builds0/.git/ 378s [master (root-commit) f24fd28] Initial commit 378s 6 files changed, 42 insertions(+) 378s create mode 100644 CMakeLists.txt 378s create mode 100644 hello/CMakeLists.txt 378s create mode 100644 hello/__init__.py 378s create mode 100644 hello/__main__.py 378s create mode 100644 hello/_hello.pyx 378s create mode 100644 setup.py 378s ----------------------------- Captured stderr call ----------------------------- 378s hint: Using 'master' as the name for the initial branch. This default branch name 378s hint: is subject to change. To configure the initial branch name to use in all 378s hint: of your new repositories, which will suppress this warning, call: 378s hint: 378s hint: git config --global init.defaultBranch 378s hint: 378s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 378s hint: 'development'. The just-created branch can be renamed via this command: 378s hint: 378s hint: git branch -m 378s ___________________________ test_hello_cython_sdist ____________________________ 378s 378s iargs = (), ikwargs = {} 378s 378s @functools.wraps(fun) 378s def wrapped(*iargs, **ikwargs): 378s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 378s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 378s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 378s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 378s 378s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 378s 378s disable_languages_test = False 378s fun = 378s iargs = () 378s ikwargs = {} 378s ret = False 378s wrapped = 378s 378s tests/__init__.py:255: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-42/test_hello_cython_sdist0') 378s setup_args = ['sdist'], disable_languages_test = False 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = False 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-42/test_hello_cython_sdist0') 378s setup_args = ['sdist'] 378s 378s tests/__init__.py:218: AttributeError 378s ----------------------------- Captured stdout call ----------------------------- 378s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-42/test_hello_cython_sdist0/.git/ 378s [master (root-commit) f24fd28] Initial commit 378s 6 files changed, 42 insertions(+) 378s create mode 100644 CMakeLists.txt 378s create mode 100644 hello/CMakeLists.txt 378s create mode 100644 hello/__init__.py 378s create mode 100644 hello/__main__.py 378s create mode 100644 hello/_hello.pyx 378s create mode 100644 setup.py 378s ----------------------------- Captured stderr call ----------------------------- 378s hint: Using 'master' as the name for the initial branch. This default branch name 378s hint: is subject to change. To configure the initial branch name to use in all 378s hint: of your new repositories, which will suppress this warning, call: 378s hint: 378s hint: git config --global init.defaultBranch 378s hint: 378s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 378s hint: 'development'. The just-created branch can be renamed via this command: 378s hint: 378s hint: git branch -m 378s ___________________________ test_hello_cython_wheel ____________________________ 378s 378s iargs = (), ikwargs = {} 378s 378s @functools.wraps(fun) 378s def wrapped(*iargs, **ikwargs): 378s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 378s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 378s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 378s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 378s 378s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 378s 378s disable_languages_test = False 378s fun = 378s iargs = () 378s ikwargs = {} 378s ret = False 378s wrapped = 378s 378s tests/__init__.py:255: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-43/test_hello_cython_wheel0') 378s setup_args = ['bdist_wheel'], disable_languages_test = False 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = False 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-43/test_hello_cython_wheel0') 378s setup_args = ['bdist_wheel'] 378s 378s tests/__init__.py:218: AttributeError 378s ----------------------------- Captured stdout call ----------------------------- 378s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-43/test_hello_cython_wheel0/.git/ 378s [master (root-commit) f24fd28] Initial commit 378s 6 files changed, 42 insertions(+) 378s create mode 100644 CMakeLists.txt 378s create mode 100644 hello/CMakeLists.txt 378s create mode 100644 hello/__init__.py 378s create mode 100644 hello/__main__.py 378s create mode 100644 hello/_hello.pyx 378s create mode 100644 setup.py 378s ----------------------------- Captured stderr call ----------------------------- 378s hint: Using 'master' as the name for the initial branch. This default branch name 378s hint: is subject to change. To configure the initial branch name to use in all 378s hint: of your new repositories, which will suppress this warning, call: 378s hint: 378s hint: git config --global init.defaultBranch 378s hint: 378s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 378s hint: 'development'. The just-created branch can be renamed via this command: 378s hint: 378s hint: git branch -m 378s ____________________________ test_hello_pure_builds ____________________________ 378s 378s iargs = () 378s ikwargs = {'capsys': <_pytest.capture.CaptureFixture object at 0x3ffb613b890>} 378s 378s @functools.wraps(fun) 378s def wrapped(*iargs, **ikwargs): 378s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 378s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 378s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 378s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 378s 378s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 378s 378s disable_languages_test = True 378s fun = 378s iargs = () 378s ikwargs = {'capsys': <_pytest.capture.CaptureFixture object at 0x3ffb613b890>} 378s ret = False 378s wrapped = 378s 378s tests/__init__.py:255: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-44/test_hello_pure_builds0') 378s setup_args = ['build'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-44/test_hello_pure_builds0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s ----------------------------- Captured stdout call ----------------------------- 378s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-44/test_hello_pure_builds0/.git/ 378s [master (root-commit) ca8da3b] Initial commit 378s 2 files changed, 12 insertions(+) 378s create mode 100644 hello/__init__.py 378s create mode 100644 setup.py 378s ----------------------------- Captured stderr call ----------------------------- 378s hint: Using 'master' as the name for the initial branch. This default branch name 378s hint: is subject to change. To configure the initial branch name to use in all 378s hint: of your new repositories, which will suppress this warning, call: 378s hint: 378s hint: git config --global init.defaultBranch 378s hint: 378s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 378s hint: 'development'. The just-created branch can be renamed via this command: 378s hint: 378s hint: git branch -m 378s ____________________________ test_hello_pure_sdist _____________________________ 378s 378s iargs = (), ikwargs = {} 378s 378s @functools.wraps(fun) 378s def wrapped(*iargs, **ikwargs): 378s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 378s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 378s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 378s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 378s 378s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 378s 378s disable_languages_test = True 378s fun = 378s iargs = () 378s ikwargs = {} 378s ret = False 378s wrapped = 378s 378s tests/__init__.py:255: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-45/test_hello_pure_sdist0') 378s setup_args = ['sdist'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-45/test_hello_pure_sdist0') 378s setup_args = ['sdist'] 378s 378s tests/__init__.py:218: AttributeError 378s ----------------------------- Captured stdout call ----------------------------- 378s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-45/test_hello_pure_sdist0/.git/ 378s [master (root-commit) ca8da3b] Initial commit 378s 2 files changed, 12 insertions(+) 378s create mode 100644 hello/__init__.py 378s create mode 100644 setup.py 378s ----------------------------- Captured stderr call ----------------------------- 378s hint: Using 'master' as the name for the initial branch. This default branch name 378s hint: is subject to change. To configure the initial branch name to use in all 378s hint: of your new repositories, which will suppress this warning, call: 378s hint: 378s hint: git config --global init.defaultBranch 378s hint: 378s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 378s hint: 'development'. The just-created branch can be renamed via this command: 378s hint: 378s hint: git branch -m 378s ____________________________ test_hello_pure_wheel _____________________________ 378s 378s iargs = (), ikwargs = {} 378s 378s @functools.wraps(fun) 378s def wrapped(*iargs, **ikwargs): 378s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 378s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 378s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 378s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 378s 378s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 378s 378s disable_languages_test = True 378s fun = 378s iargs = () 378s ikwargs = {} 378s ret = False 378s wrapped = 378s 378s tests/__init__.py:255: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-46/test_hello_pure_wheel0') 378s setup_args = ['bdist_wheel'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-46/test_hello_pure_wheel0') 378s setup_args = ['bdist_wheel'] 378s 378s tests/__init__.py:218: AttributeError 378s ----------------------------- Captured stdout call ----------------------------- 378s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-46/test_hello_pure_wheel0/.git/ 378s [master (root-commit) ca8da3b] Initial commit 378s 2 files changed, 12 insertions(+) 378s create mode 100644 hello/__init__.py 378s create mode 100644 setup.py 378s ----------------------------- Captured stderr call ----------------------------- 378s hint: Using 'master' as the name for the initial branch. This default branch name 378s hint: is subject to change. To configure the initial branch name to use in all 378s hint: of your new repositories, which will suppress this warning, call: 378s hint: 378s hint: git config --global init.defaultBranch 378s hint: 378s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 378s hint: 'development'. The just-created branch can be renamed via this command: 378s hint: 378s hint: git branch -m 378s _______________________________ test_hello_clean _______________________________ 378s 378s capfd = <_pytest.capture.CaptureFixture object at 0x3ffb62eb890> 378s 378s def test_hello_clean(capfd): 378s with push_dir(): 378s 378s @project_setup_py_test("hello-pure", ["build"], disable_languages_test=True, ret=True) 378s def run_build(): 378s pass 378s 378s > tmp_dir = run_build()[0] 378s 378s capfd = <_pytest.capture.CaptureFixture object at 0x3ffb62eb890> 378s run_build = .run_build at 0x3ffb6162a20> 378s 378s tests/test_hello_pure.py:65: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s tests/__init__.py:255: in wrapped 378s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 378s disable_languages_test = True 378s fun = .run_build at 0x3ffb6161e40> 378s iargs = () 378s ikwargs = {} 378s ret = True 378s wrapped = .run_build at 0x3ffb6162a20> 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-47/run_build0') 378s setup_args = ['build'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-47/run_build0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s ----------------------------- Captured stdout call ----------------------------- 378s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-47/run_build0/.git/ 378s [master (root-commit) ca8da3b] Initial commit 378s 2 files changed, 12 insertions(+) 378s create mode 100644 hello/__init__.py 378s create mode 100644 setup.py 378s ----------------------------- Captured stderr call ----------------------------- 378s hint: Using 'master' as the name for the initial branch. This default branch name 378s hint: is subject to change. To configure the initial branch name to use in all 378s hint: of your new repositories, which will suppress this warning, call: 378s hint: 378s hint: git config --global init.defaultBranch 378s hint: 378s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 378s hint: 'development'. The just-created branch can be renamed via this command: 378s hint: 378s hint: git branch -m 378s __________________________ test_include_exclude_data ___________________________ 378s 378s iargs = (), ikwargs = {} 378s 378s @functools.wraps(fun) 378s def wrapped(*iargs, **ikwargs): 378s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 378s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 378s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 378s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 378s 378s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 378s 378s disable_languages_test = False 378s fun = 378s iargs = () 378s ikwargs = {} 378s ret = False 378s wrapped = 378s 378s tests/__init__.py:255: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-48/test_include_exclude_data0') 378s setup_args = ['bdist_wheel'], disable_languages_test = False 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = False 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-48/test_include_exclude_data0') 378s setup_args = ['bdist_wheel'] 378s 378s tests/__init__.py:218: AttributeError 378s ----------------------------- Captured stdout call ----------------------------- 378s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-48/test_include_exclude_data0/.git/ 378s [master (root-commit) d436dfd] Initial commit 378s 15 files changed, 79 insertions(+) 378s create mode 100644 CMakeLists.txt 378s create mode 100644 MANIFEST.in 378s create mode 100644 hello/__init__.py 378s create mode 100644 hello/data/subdata/hello_data1_include_from_manifest.txt 378s create mode 100644 hello/data/subdata/hello_data2_include_from_manifest.txt 378s create mode 100644 hello/data/subdata/hello_data3_include_from_manifest_and_exclude_from_manifest.txt 378s create mode 100644 hello/data/subdata/hello_data4_include_from_manifest_and_exclude_from_setup.txt 378s create mode 100644 hello/hello_include_from_manifest.txt 378s create mode 100644 hello2/__init__.py 378s create mode 100644 hello2/data2/subdata2/hello2_data1_include_from_manifest.txt 378s create mode 100644 hello2/data2/subdata2/hello2_data2_include_from_manifest.txt 378s create mode 100644 hello2/data2/subdata2/hello2_data3_include_from_manifest_and_exclude_from_manifest.txt 378s create mode 100644 hello2/data2/subdata2/hello2_data4_include_from_manifest_and_exclude_from_setup.txt 378s create mode 100644 hello2/hello2_include_from_manifest.txt 378s create mode 100644 setup.py 378s ----------------------------- Captured stderr call ----------------------------- 378s hint: Using 'master' as the name for the initial branch. This default branch name 378s hint: is subject to change. To configure the initial branch name to use in all 378s hint: of your new repositories, which will suppress this warning, call: 378s hint: 378s hint: git config --global init.defaultBranch 378s hint: 378s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 378s hint: 'development'. The just-created branch can be renamed via this command: 378s hint: 378s hint: git branch -m 378s _____________________ test_include_exclude_data_with_base ______________________ 378s 378s iargs = (), ikwargs = {} 378s 378s @functools.wraps(fun) 378s def wrapped(*iargs, **ikwargs): 378s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 378s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 378s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 378s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 378s 378s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 378s 378s disable_languages_test = False 378s fun = 378s iargs = () 378s ikwargs = {} 378s ret = False 378s wrapped = 378s 378s tests/__init__.py:255: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-49/test_include_exclude_data_with0') 378s setup_args = ['bdist_wheel'], disable_languages_test = False 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = False 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-49/test_include_exclude_data_with0') 378s setup_args = ['bdist_wheel'] 378s 378s tests/__init__.py:218: AttributeError 378s ----------------------------- Captured stdout call ----------------------------- 378s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-49/test_include_exclude_data_with0/.git/ 378s [master (root-commit) a34ac0b] Initial commit 378s 15 files changed, 80 insertions(+) 378s create mode 100644 CMakeLists.txt 378s create mode 100644 MANIFEST.in 378s create mode 100644 setup.py 378s create mode 100644 src/hello/__init__.py 378s create mode 100644 src/hello/data/subdata/hello_data1_include_from_manifest.txt 378s create mode 100644 src/hello/data/subdata/hello_data2_include_from_manifest.txt 378s create mode 100644 src/hello/data/subdata/hello_data3_include_from_manifest_and_exclude_from_manifest.txt 378s create mode 100644 src/hello/data/subdata/hello_data4_include_from_manifest_and_exclude_from_setup.txt 378s create mode 100644 src/hello/hello_include_from_manifest.txt 378s create mode 100644 src/hello2/__init__.py 378s create mode 100644 src/hello2/data2/subdata2/hello2_data1_include_from_manifest.txt 378s create mode 100644 src/hello2/data2/subdata2/hello2_data2_include_from_manifest.txt 378s create mode 100644 src/hello2/data2/subdata2/hello2_data3_include_from_manifest_and_exclude_from_manifest.txt 378s create mode 100644 src/hello2/data2/subdata2/hello2_data4_include_from_manifest_and_exclude_from_setup.txt 378s create mode 100644 src/hello2/hello2_include_from_manifest.txt 378s ----------------------------- Captured stderr call ----------------------------- 378s hint: Using 'master' as the name for the initial branch. This default branch name 378s hint: is subject to change. To configure the initial branch name to use in all 378s hint: of your new repositories, which will suppress this warning, call: 378s hint: 378s hint: git config --global init.defaultBranch 378s hint: 378s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 378s hint: 'development'. The just-created branch can be renamed via this command: 378s hint: 378s hint: git branch -m 378s ________________________ test_build_ext_inplace_command ________________________ 378s 378s iargs = (), ikwargs = {} 378s 378s @functools.wraps(fun) 378s def wrapped(*iargs, **ikwargs): 378s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 378s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 378s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 378s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 378s 378s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 378s 378s disable_languages_test = True 378s fun = 378s iargs = () 378s ikwargs = {} 378s ret = False 378s wrapped = 378s 378s tests/__init__.py:255: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-50/test_build_ext_inplace_command0') 378s setup_args = ['build_ext', '--inplace'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-50/test_build_ext_inplace_command0') 378s setup_args = ['build_ext', '--inplace'] 378s 378s tests/__init__.py:218: AttributeError 378s ----------------------------- Captured stdout call ----------------------------- 378s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-50/test_build_ext_inplace_command0/.git/ 378s [master (root-commit) 4a731bb] Initial commit 378s 5 files changed, 160 insertions(+) 378s create mode 100644 CMakeLists.txt 378s create mode 100644 hello/__init__.py 378s create mode 100644 hello/_hello_ext.cxx 378s create mode 100644 hello/_hello_sk.cxx 378s create mode 100644 setup.py 378s ----------------------------- Captured stderr call ----------------------------- 378s hint: Using 'master' as the name for the initial branch. This default branch name 378s hint: is subject to change. To configure the initial branch name to use in all 378s hint: of your new repositories, which will suppress this warning, call: 378s hint: 378s hint: git config --global init.defaultBranch 378s hint: 378s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 378s hint: 'development'. The just-created branch can be renamed via this command: 378s hint: 378s hint: git branch -m 378s ___________________________ test_bdist_wheel_command ___________________________ 378s 378s def test_bdist_wheel_command(): 378s project = "issue-335-support-cmake-source-dir" 378s 378s expected_content = [ 378s "hello/__init__.py", 378s "hello/swig_mwe.py", 378s "hello/_swig_mwe.pyd", 378s "hello-1.2.3.data/data/bin/hello", 378s "hello-1.2.3.data/data/lib/static/libbar.a", 378s "hello-1.2.3.data/data/lib/static/libfoo.a", 378s "hello-1.2.3.data/data/include/bar.h", 378s "hello-1.2.3.data/data/include/foo.h", 378s ] 378s 378s expected_distribution_name = "hello-1.2.3" 378s 378s tmp_dir = _tmpdir("test_bdist_wheel_command") 378s prepare_project(project, tmp_dir) 378s initialize_git_repo_and_commit(tmp_dir, verbose=True) 378s 378s relative_setup_path = "wrapping/python/" 378s 378s > with execute_setup_py(tmp_dir.join(relative_setup_path), ["bdist_wheel"]): 378s 378s 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', ...] 378s expected_distribution_name = 'hello-1.2.3' 378s project = 'issue-335-support-cmake-source-dir' 378s relative_setup_path = 'wrapping/python/' 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-51/test_bdist_wheel_command0') 378s 378s tests/test_issue335_support_cmake_source_dir.py:31: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-51/test_bdist_wheel_command0/wrapping/python') 378s setup_args = ['bdist_wheel'], disable_languages_test = False 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = False 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-51/test_bdist_wheel_command0/wrapping/python') 378s setup_args = ['bdist_wheel'] 378s 378s tests/__init__.py:218: AttributeError 378s ----------------------------- Captured stdout call ----------------------------- 378s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-51/test_bdist_wheel_command0/.git/ 378s [master (root-commit) 90abd27] Initial commit 378s 4 files changed, 52 insertions(+) 378s create mode 100644 CMakeLists.txt 378s create mode 100644 wrapping/python/CMakeLists.txt 378s create mode 100644 wrapping/python/hello/__init__.py 378s create mode 100644 wrapping/python/setup.py 378s ----------------------------- Captured stderr call ----------------------------- 378s hint: Using 'master' as the name for the initial branch. This default branch name 378s hint: is subject to change. To configure the initial branch name to use in all 378s hint: of your new repositories, which will suppress this warning, call: 378s hint: 378s hint: git config --global init.defaultBranch 378s hint: 378s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 378s hint: 'development'. The just-created branch can be renamed via this command: 378s hint: 378s hint: git branch -m 378s _ test_cmake_args_keyword_osx_default[None-cli_setup_args0-keyword_cmake_args0-cli_cmake_args0-10.9] _ 378s 378s osx_deployment_target_env_var = None, cli_setup_args = [] 378s keyword_cmake_args = [], cli_cmake_args = [] 378s expected_cmake_osx_deployment_target = '10.9' 378s mocker = 378s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x3ffb6138a70> 378s 378s @pytest.mark.parametrize( 378s params, 378s [ 378s # default plat_name is 'macosx-10.9-x86_64' 378s ( 378s # osx_deployment_target_env_var 378s None, 378s # cli_setup_args 378s [], 378s # keyword_cmake_args 378s [], 378s # cli_cmake_args 378s [], 378s # expected_cmake_osx_deployment_target 378s "10.9", 378s ), 378s ( 378s # osx_deployment_target_env_var 378s "10.7", 378s # cli_setup_args 378s [], 378s # keyword_cmake_args 378s [], 378s # cli_cmake_args 378s [], 378s # expected_cmake_osx_deployment_target 378s "10.7", 378s ), 378s ( 378s # osx_deployment_target_env_var 378s "10.7", 378s # cli_setup_args 378s ["--plat-name", "macosx-10.9-x86_64"], 378s # keyword_cmake_args 378s [], 378s # cli_cmake_args 378s [], 378s # expected_cmake_osx_deployment_target 378s "10.9", 378s ), 378s ( 378s # osx_deployment_target_env_var 378s None, 378s # cli_setup_args 378s ["--plat-name", "macosx-10.6-x86_64"], 378s # keyword_cmake_args 378s [], 378s # cli_cmake_args 378s [], 378s # expected_cmake_osx_deployment_target 378s "10.6", 378s ), 378s ( 378s # osx_deployment_target_env_var 378s None, 378s # cli_setup_args 378s ["--plat-name", "macosx-10.7-x86_64"], 378s # keyword_cmake_args 378s [], 378s # cli_cmake_args 378s [], 378s # expected_cmake_osx_deployment_target 378s "10.7", 378s ), 378s ( 378s # osx_deployment_target_env_var 378s None, 378s # cli_setup_args 378s [], 378s # keyword_cmake_args 378s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 378s # cli_cmake_args 378s [], 378s # expected_cmake_osx_deployment_target 378s "10.7", 378s ), 378s ( 378s # osx_deployment_target_env_var 378s None, 378s # cli_setup_args 378s ["--plat-name", "macosx-10.12-x86_64"], 378s # keyword_cmake_args 378s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 378s # cli_cmake_args 378s [], 378s # expected_cmake_osx_deployment_target 378s "10.7", 378s ), 378s ( 378s # osx_deployment_target_env_var 378s None, 378s # cli_setup_args 378s [], 378s # keyword_cmake_args 378s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 378s # cli_cmake_args 378s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 378s # expected_cmake_osx_deployment_target 378s "10.8", 378s ), 378s ( 378s # osx_deployment_target_env_var 378s None, 378s # cli_setup_args 378s ["--plat-name", "macosx-10.12-x86_64"], 378s # keyword_cmake_args 378s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 378s # cli_cmake_args 378s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 378s # expected_cmake_osx_deployment_target 378s "10.8", 378s ), 378s ], 378s ) 378s def test_cmake_args_keyword_osx_default( 378s osx_deployment_target_env_var, 378s cli_setup_args, 378s keyword_cmake_args, 378s cli_cmake_args, 378s expected_cmake_osx_deployment_target, 378s mocker, 378s monkeypatch, 378s ): 378s tmp_dir = _tmpdir("cmake_args_keyword_osx_default") 378s 378s tmp_dir.join("setup.py").write( 378s textwrap.dedent( 378s """ 378s from skbuild import setup 378s setup( 378s name="test_cmake_args_keyword_osx_default", 378s version="1.2.3", 378s description="A minimal example package", 378s author="The scikit-build team", 378s license="MIT", 378s cmake_args=[{cmake_args}] 378s ) 378s """.format(cmake_args=",".join([f"'{arg}'" for arg in keyword_cmake_args])) 378s ) 378s ) 378s tmp_dir.join("CMakeLists.txt").write( 378s textwrap.dedent( 378s """ 378s message(FATAL_ERROR "This error message should not be displayed") 378s """ 378s ) 378s ) 378s 378s mock_configure = mocker.patch("skbuild.cmaker.CMaker.configure", side_effect=RuntimeError("exit skbuild")) 378s 378s monkeypatch.setattr(platform, "mac_ver", lambda: ("10.9", None, "x84_64")) 378s monkeypatch.setattr(platform, "machine", lambda: "x86_64") 378s monkeypatch.setattr(sys, "platform", "darwin") 378s 378s with push_env(MACOSX_DEPLOYMENT_TARGET=osx_deployment_target_env_var): 378s monkeypatch.setattr(skbuild.constants, "_SKBUILD_PLAT_NAME", skbuild.constants._default_skbuild_plat_name()) 378s with pytest.raises(RuntimeError, match="exit skbuild"): 378s > with execute_setup_py(tmp_dir, ["build", *cli_setup_args, "--", *cli_cmake_args]): 378s 378s cli_cmake_args = [] 378s cli_setup_args = [] 378s expected_cmake_osx_deployment_target = '10.9' 378s keyword_cmake_args = [] 378s mock_configure = 378s mocker = 378s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x3ffb6138a70> 378s osx_deployment_target_env_var = None 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-52/cmake_args_keyword_osx_default0') 378s 378s tests/test_issue342_cmake_osx_args_in_setup.py:176: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-52/cmake_args_keyword_osx_default0') 378s setup_args = ['build', '--'], disable_languages_test = False 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = False 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-52/cmake_args_keyword_osx_default0') 378s setup_args = ['build', '--'] 378s 378s tests/__init__.py:218: AttributeError 378s _ test_cmake_args_keyword_osx_default[10.7-cli_setup_args1-keyword_cmake_args1-cli_cmake_args1-10.7] _ 378s 378s osx_deployment_target_env_var = '10.7', cli_setup_args = [] 378s keyword_cmake_args = [], cli_cmake_args = [] 378s expected_cmake_osx_deployment_target = '10.7' 378s mocker = 378s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x3ffb61a5010> 378s 378s @pytest.mark.parametrize( 378s params, 378s [ 378s # default plat_name is 'macosx-10.9-x86_64' 378s ( 378s # osx_deployment_target_env_var 378s None, 378s # cli_setup_args 378s [], 378s # keyword_cmake_args 378s [], 378s # cli_cmake_args 378s [], 378s # expected_cmake_osx_deployment_target 378s "10.9", 378s ), 378s ( 378s # osx_deployment_target_env_var 378s "10.7", 378s # cli_setup_args 378s [], 378s # keyword_cmake_args 378s [], 378s # cli_cmake_args 378s [], 378s # expected_cmake_osx_deployment_target 378s "10.7", 378s ), 378s ( 378s # osx_deployment_target_env_var 378s "10.7", 378s # cli_setup_args 378s ["--plat-name", "macosx-10.9-x86_64"], 378s # keyword_cmake_args 378s [], 378s # cli_cmake_args 378s [], 378s # expected_cmake_osx_deployment_target 378s "10.9", 378s ), 378s ( 378s # osx_deployment_target_env_var 378s None, 378s # cli_setup_args 378s ["--plat-name", "macosx-10.6-x86_64"], 378s # keyword_cmake_args 378s [], 378s # cli_cmake_args 378s [], 378s # expected_cmake_osx_deployment_target 378s "10.6", 378s ), 378s ( 378s # osx_deployment_target_env_var 378s None, 378s # cli_setup_args 378s ["--plat-name", "macosx-10.7-x86_64"], 378s # keyword_cmake_args 378s [], 378s # cli_cmake_args 378s [], 378s # expected_cmake_osx_deployment_target 378s "10.7", 378s ), 378s ( 378s # osx_deployment_target_env_var 378s None, 378s # cli_setup_args 378s [], 378s # keyword_cmake_args 378s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 378s # cli_cmake_args 378s [], 378s # expected_cmake_osx_deployment_target 378s "10.7", 378s ), 378s ( 378s # osx_deployment_target_env_var 378s None, 378s # cli_setup_args 378s ["--plat-name", "macosx-10.12-x86_64"], 378s # keyword_cmake_args 378s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 378s # cli_cmake_args 378s [], 378s # expected_cmake_osx_deployment_target 378s "10.7", 378s ), 378s ( 378s # osx_deployment_target_env_var 378s None, 378s # cli_setup_args 378s [], 378s # keyword_cmake_args 378s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 378s # cli_cmake_args 378s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 378s # expected_cmake_osx_deployment_target 378s "10.8", 378s ), 378s ( 378s # osx_deployment_target_env_var 378s None, 378s # cli_setup_args 378s ["--plat-name", "macosx-10.12-x86_64"], 378s # keyword_cmake_args 378s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 378s # cli_cmake_args 378s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 378s # expected_cmake_osx_deployment_target 378s "10.8", 378s ), 378s ], 378s ) 378s def test_cmake_args_keyword_osx_default( 378s osx_deployment_target_env_var, 378s cli_setup_args, 378s keyword_cmake_args, 378s cli_cmake_args, 378s expected_cmake_osx_deployment_target, 378s mocker, 378s monkeypatch, 378s ): 378s tmp_dir = _tmpdir("cmake_args_keyword_osx_default") 378s 378s tmp_dir.join("setup.py").write( 378s textwrap.dedent( 378s """ 378s from skbuild import setup 378s setup( 378s name="test_cmake_args_keyword_osx_default", 378s version="1.2.3", 378s description="A minimal example package", 378s author="The scikit-build team", 378s license="MIT", 378s cmake_args=[{cmake_args}] 378s ) 378s """.format(cmake_args=",".join([f"'{arg}'" for arg in keyword_cmake_args])) 378s ) 378s ) 378s tmp_dir.join("CMakeLists.txt").write( 378s textwrap.dedent( 378s """ 378s message(FATAL_ERROR "This error message should not be displayed") 378s """ 378s ) 378s ) 378s 378s mock_configure = mocker.patch("skbuild.cmaker.CMaker.configure", side_effect=RuntimeError("exit skbuild")) 378s 378s monkeypatch.setattr(platform, "mac_ver", lambda: ("10.9", None, "x84_64")) 378s monkeypatch.setattr(platform, "machine", lambda: "x86_64") 378s monkeypatch.setattr(sys, "platform", "darwin") 378s 378s with push_env(MACOSX_DEPLOYMENT_TARGET=osx_deployment_target_env_var): 378s monkeypatch.setattr(skbuild.constants, "_SKBUILD_PLAT_NAME", skbuild.constants._default_skbuild_plat_name()) 378s with pytest.raises(RuntimeError, match="exit skbuild"): 378s > with execute_setup_py(tmp_dir, ["build", *cli_setup_args, "--", *cli_cmake_args]): 378s 378s cli_cmake_args = [] 378s cli_setup_args = [] 378s expected_cmake_osx_deployment_target = '10.7' 378s keyword_cmake_args = [] 378s mock_configure = 378s mocker = 378s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x3ffb61a5010> 378s osx_deployment_target_env_var = '10.7' 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-53/cmake_args_keyword_osx_default0') 378s 378s tests/test_issue342_cmake_osx_args_in_setup.py:176: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-53/cmake_args_keyword_osx_default0') 378s setup_args = ['build', '--'], disable_languages_test = False 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = False 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-53/cmake_args_keyword_osx_default0') 378s setup_args = ['build', '--'] 378s 378s tests/__init__.py:218: AttributeError 378s _ test_cmake_args_keyword_osx_default[10.7-cli_setup_args2-keyword_cmake_args2-cli_cmake_args2-10.9] _ 378s 378s osx_deployment_target_env_var = '10.7' 378s cli_setup_args = ['--plat-name', 'macosx-10.9-x86_64'], keyword_cmake_args = [] 378s cli_cmake_args = [], expected_cmake_osx_deployment_target = '10.9' 378s mocker = 378s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x3ffb61a7980> 378s 378s @pytest.mark.parametrize( 378s params, 378s [ 378s # default plat_name is 'macosx-10.9-x86_64' 378s ( 378s # osx_deployment_target_env_var 378s None, 378s # cli_setup_args 378s [], 378s # keyword_cmake_args 378s [], 378s # cli_cmake_args 378s [], 378s # expected_cmake_osx_deployment_target 378s "10.9", 378s ), 378s ( 378s # osx_deployment_target_env_var 378s "10.7", 378s # cli_setup_args 378s [], 378s # keyword_cmake_args 378s [], 378s # cli_cmake_args 378s [], 378s # expected_cmake_osx_deployment_target 378s "10.7", 378s ), 378s ( 378s # osx_deployment_target_env_var 378s "10.7", 378s # cli_setup_args 378s ["--plat-name", "macosx-10.9-x86_64"], 378s # keyword_cmake_args 378s [], 378s # cli_cmake_args 378s [], 378s # expected_cmake_osx_deployment_target 378s "10.9", 378s ), 378s ( 378s # osx_deployment_target_env_var 378s None, 378s # cli_setup_args 378s ["--plat-name", "macosx-10.6-x86_64"], 378s # keyword_cmake_args 378s [], 378s # cli_cmake_args 378s [], 378s # expected_cmake_osx_deployment_target 378s "10.6", 378s ), 378s ( 378s # osx_deployment_target_env_var 378s None, 378s # cli_setup_args 378s ["--plat-name", "macosx-10.7-x86_64"], 378s # keyword_cmake_args 378s [], 378s # cli_cmake_args 378s [], 378s # expected_cmake_osx_deployment_target 378s "10.7", 378s ), 378s ( 378s # osx_deployment_target_env_var 378s None, 378s # cli_setup_args 378s [], 378s # keyword_cmake_args 378s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 378s # cli_cmake_args 378s [], 378s # expected_cmake_osx_deployment_target 378s "10.7", 378s ), 378s ( 378s # osx_deployment_target_env_var 378s None, 378s # cli_setup_args 378s ["--plat-name", "macosx-10.12-x86_64"], 378s # keyword_cmake_args 378s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 378s # cli_cmake_args 378s [], 378s # expected_cmake_osx_deployment_target 378s "10.7", 378s ), 378s ( 378s # osx_deployment_target_env_var 378s None, 378s # cli_setup_args 378s [], 378s # keyword_cmake_args 378s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 378s # cli_cmake_args 378s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 378s # expected_cmake_osx_deployment_target 378s "10.8", 378s ), 378s ( 378s # osx_deployment_target_env_var 378s None, 378s # cli_setup_args 378s ["--plat-name", "macosx-10.12-x86_64"], 378s # keyword_cmake_args 378s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 378s # cli_cmake_args 378s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 378s # expected_cmake_osx_deployment_target 378s "10.8", 378s ), 378s ], 378s ) 378s def test_cmake_args_keyword_osx_default( 378s osx_deployment_target_env_var, 378s cli_setup_args, 378s keyword_cmake_args, 378s cli_cmake_args, 378s expected_cmake_osx_deployment_target, 378s mocker, 378s monkeypatch, 378s ): 378s tmp_dir = _tmpdir("cmake_args_keyword_osx_default") 378s 378s tmp_dir.join("setup.py").write( 378s textwrap.dedent( 378s """ 378s from skbuild import setup 378s setup( 378s name="test_cmake_args_keyword_osx_default", 378s version="1.2.3", 378s description="A minimal example package", 378s author="The scikit-build team", 378s license="MIT", 378s cmake_args=[{cmake_args}] 378s ) 378s """.format(cmake_args=",".join([f"'{arg}'" for arg in keyword_cmake_args])) 378s ) 378s ) 378s tmp_dir.join("CMakeLists.txt").write( 378s textwrap.dedent( 378s """ 378s message(FATAL_ERROR "This error message should not be displayed") 378s """ 378s ) 378s ) 378s 378s mock_configure = mocker.patch("skbuild.cmaker.CMaker.configure", side_effect=RuntimeError("exit skbuild")) 378s 378s monkeypatch.setattr(platform, "mac_ver", lambda: ("10.9", None, "x84_64")) 378s monkeypatch.setattr(platform, "machine", lambda: "x86_64") 378s monkeypatch.setattr(sys, "platform", "darwin") 378s 378s with push_env(MACOSX_DEPLOYMENT_TARGET=osx_deployment_target_env_var): 378s monkeypatch.setattr(skbuild.constants, "_SKBUILD_PLAT_NAME", skbuild.constants._default_skbuild_plat_name()) 378s with pytest.raises(RuntimeError, match="exit skbuild"): 378s > with execute_setup_py(tmp_dir, ["build", *cli_setup_args, "--", *cli_cmake_args]): 378s 378s cli_cmake_args = [] 378s cli_setup_args = ['--plat-name', 'macosx-10.9-x86_64'] 378s expected_cmake_osx_deployment_target = '10.9' 378s keyword_cmake_args = [] 378s mock_configure = 378s mocker = 378s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x3ffb61a7980> 378s osx_deployment_target_env_var = '10.7' 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-54/cmake_args_keyword_osx_default0') 378s 378s tests/test_issue342_cmake_osx_args_in_setup.py:176: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-54/cmake_args_keyword_osx_default0') 378s setup_args = ['build', '--plat-name', 'macosx-10.9-x86_64', '--'] 378s disable_languages_test = False 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = False 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-54/cmake_args_keyword_osx_default0') 378s setup_args = ['build', '--plat-name', 'macosx-10.9-x86_64', '--'] 378s 378s tests/__init__.py:218: AttributeError 378s _ test_cmake_args_keyword_osx_default[None-cli_setup_args3-keyword_cmake_args3-cli_cmake_args3-10.6] _ 378s 378s osx_deployment_target_env_var = None 378s cli_setup_args = ['--plat-name', 'macosx-10.6-x86_64'], keyword_cmake_args = [] 378s cli_cmake_args = [], expected_cmake_osx_deployment_target = '10.6' 378s mocker = 378s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x3ffb6196c90> 378s 378s @pytest.mark.parametrize( 378s params, 378s [ 378s # default plat_name is 'macosx-10.9-x86_64' 378s ( 378s # osx_deployment_target_env_var 378s None, 378s # cli_setup_args 378s [], 378s # keyword_cmake_args 378s [], 378s # cli_cmake_args 378s [], 378s # expected_cmake_osx_deployment_target 378s "10.9", 378s ), 378s ( 378s # osx_deployment_target_env_var 378s "10.7", 378s # cli_setup_args 378s [], 378s # keyword_cmake_args 378s [], 378s # cli_cmake_args 378s [], 378s # expected_cmake_osx_deployment_target 378s "10.7", 378s ), 378s ( 378s # osx_deployment_target_env_var 378s "10.7", 378s # cli_setup_args 378s ["--plat-name", "macosx-10.9-x86_64"], 378s # keyword_cmake_args 378s [], 378s # cli_cmake_args 378s [], 378s # expected_cmake_osx_deployment_target 378s "10.9", 378s ), 378s ( 378s # osx_deployment_target_env_var 378s None, 378s # cli_setup_args 378s ["--plat-name", "macosx-10.6-x86_64"], 378s # keyword_cmake_args 378s [], 378s # cli_cmake_args 378s [], 378s # expected_cmake_osx_deployment_target 378s "10.6", 378s ), 378s ( 378s # osx_deployment_target_env_var 378s None, 378s # cli_setup_args 378s ["--plat-name", "macosx-10.7-x86_64"], 378s # keyword_cmake_args 378s [], 378s # cli_cmake_args 378s [], 378s # expected_cmake_osx_deployment_target 378s "10.7", 378s ), 378s ( 378s # osx_deployment_target_env_var 378s None, 378s # cli_setup_args 378s [], 378s # keyword_cmake_args 378s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 378s # cli_cmake_args 378s [], 378s # expected_cmake_osx_deployment_target 378s "10.7", 378s ), 378s ( 378s # osx_deployment_target_env_var 378s None, 378s # cli_setup_args 378s ["--plat-name", "macosx-10.12-x86_64"], 378s # keyword_cmake_args 378s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 378s # cli_cmake_args 378s [], 378s # expected_cmake_osx_deployment_target 378s "10.7", 378s ), 378s ( 378s # osx_deployment_target_env_var 378s None, 378s # cli_setup_args 378s [], 378s # keyword_cmake_args 378s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 378s # cli_cmake_args 378s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 378s # expected_cmake_osx_deployment_target 378s "10.8", 378s ), 378s ( 378s # osx_deployment_target_env_var 378s None, 378s # cli_setup_args 378s ["--plat-name", "macosx-10.12-x86_64"], 378s # keyword_cmake_args 378s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 378s # cli_cmake_args 378s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 378s # expected_cmake_osx_deployment_target 378s "10.8", 378s ), 378s ], 378s ) 378s def test_cmake_args_keyword_osx_default( 378s osx_deployment_target_env_var, 378s cli_setup_args, 378s keyword_cmake_args, 378s cli_cmake_args, 378s expected_cmake_osx_deployment_target, 378s mocker, 378s monkeypatch, 378s ): 378s tmp_dir = _tmpdir("cmake_args_keyword_osx_default") 378s 378s tmp_dir.join("setup.py").write( 378s textwrap.dedent( 378s """ 378s from skbuild import setup 378s setup( 378s name="test_cmake_args_keyword_osx_default", 378s version="1.2.3", 378s description="A minimal example package", 378s author="The scikit-build team", 378s license="MIT", 378s cmake_args=[{cmake_args}] 378s ) 378s """.format(cmake_args=",".join([f"'{arg}'" for arg in keyword_cmake_args])) 378s ) 378s ) 378s tmp_dir.join("CMakeLists.txt").write( 378s textwrap.dedent( 378s """ 378s message(FATAL_ERROR "This error message should not be displayed") 378s """ 378s ) 378s ) 378s 378s mock_configure = mocker.patch("skbuild.cmaker.CMaker.configure", side_effect=RuntimeError("exit skbuild")) 378s 378s monkeypatch.setattr(platform, "mac_ver", lambda: ("10.9", None, "x84_64")) 378s monkeypatch.setattr(platform, "machine", lambda: "x86_64") 378s monkeypatch.setattr(sys, "platform", "darwin") 378s 378s with push_env(MACOSX_DEPLOYMENT_TARGET=osx_deployment_target_env_var): 378s monkeypatch.setattr(skbuild.constants, "_SKBUILD_PLAT_NAME", skbuild.constants._default_skbuild_plat_name()) 378s with pytest.raises(RuntimeError, match="exit skbuild"): 378s > with execute_setup_py(tmp_dir, ["build", *cli_setup_args, "--", *cli_cmake_args]): 378s 378s cli_cmake_args = [] 378s cli_setup_args = ['--plat-name', 'macosx-10.6-x86_64'] 378s expected_cmake_osx_deployment_target = '10.6' 378s keyword_cmake_args = [] 378s mock_configure = 378s mocker = 378s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x3ffb6196c90> 378s osx_deployment_target_env_var = None 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-55/cmake_args_keyword_osx_default0') 378s 378s tests/test_issue342_cmake_osx_args_in_setup.py:176: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-55/cmake_args_keyword_osx_default0') 378s setup_args = ['build', '--plat-name', 'macosx-10.6-x86_64', '--'] 378s disable_languages_test = False 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = False 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-55/cmake_args_keyword_osx_default0') 378s setup_args = ['build', '--plat-name', 'macosx-10.6-x86_64', '--'] 378s 378s tests/__init__.py:218: AttributeError 378s _ test_cmake_args_keyword_osx_default[None-cli_setup_args4-keyword_cmake_args4-cli_cmake_args4-10.7] _ 378s 378s osx_deployment_target_env_var = None 378s cli_setup_args = ['--plat-name', 'macosx-10.7-x86_64'], keyword_cmake_args = [] 378s cli_cmake_args = [], expected_cmake_osx_deployment_target = '10.7' 378s mocker = 378s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x3ffb6195340> 378s 378s @pytest.mark.parametrize( 378s params, 378s [ 378s # default plat_name is 'macosx-10.9-x86_64' 378s ( 378s # osx_deployment_target_env_var 378s None, 378s # cli_setup_args 378s [], 378s # keyword_cmake_args 378s [], 378s # cli_cmake_args 378s [], 378s # expected_cmake_osx_deployment_target 378s "10.9", 378s ), 378s ( 378s # osx_deployment_target_env_var 378s "10.7", 378s # cli_setup_args 378s [], 378s # keyword_cmake_args 378s [], 378s # cli_cmake_args 378s [], 378s # expected_cmake_osx_deployment_target 378s "10.7", 378s ), 378s ( 378s # osx_deployment_target_env_var 378s "10.7", 378s # cli_setup_args 378s ["--plat-name", "macosx-10.9-x86_64"], 378s # keyword_cmake_args 378s [], 378s # cli_cmake_args 378s [], 378s # expected_cmake_osx_deployment_target 378s "10.9", 378s ), 378s ( 378s # osx_deployment_target_env_var 378s None, 378s # cli_setup_args 378s ["--plat-name", "macosx-10.6-x86_64"], 378s # keyword_cmake_args 378s [], 378s # cli_cmake_args 378s [], 378s # expected_cmake_osx_deployment_target 378s "10.6", 378s ), 378s ( 378s # osx_deployment_target_env_var 378s None, 378s # cli_setup_args 378s ["--plat-name", "macosx-10.7-x86_64"], 378s # keyword_cmake_args 378s [], 378s # cli_cmake_args 378s [], 378s # expected_cmake_osx_deployment_target 378s "10.7", 378s ), 378s ( 378s # osx_deployment_target_env_var 378s None, 378s # cli_setup_args 378s [], 378s # keyword_cmake_args 378s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 378s # cli_cmake_args 378s [], 378s # expected_cmake_osx_deployment_target 378s "10.7", 378s ), 378s ( 378s # osx_deployment_target_env_var 378s None, 378s # cli_setup_args 378s ["--plat-name", "macosx-10.12-x86_64"], 378s # keyword_cmake_args 378s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 378s # cli_cmake_args 378s [], 378s # expected_cmake_osx_deployment_target 378s "10.7", 378s ), 378s ( 378s # osx_deployment_target_env_var 378s None, 378s # cli_setup_args 378s [], 378s # keyword_cmake_args 378s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 378s # cli_cmake_args 378s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 378s # expected_cmake_osx_deployment_target 378s "10.8", 378s ), 378s ( 378s # osx_deployment_target_env_var 378s None, 378s # cli_setup_args 378s ["--plat-name", "macosx-10.12-x86_64"], 378s # keyword_cmake_args 378s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 378s # cli_cmake_args 378s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 378s # expected_cmake_osx_deployment_target 378s "10.8", 378s ), 378s ], 378s ) 378s def test_cmake_args_keyword_osx_default( 378s osx_deployment_target_env_var, 378s cli_setup_args, 378s keyword_cmake_args, 378s cli_cmake_args, 378s expected_cmake_osx_deployment_target, 378s mocker, 378s monkeypatch, 378s ): 378s tmp_dir = _tmpdir("cmake_args_keyword_osx_default") 378s 378s tmp_dir.join("setup.py").write( 378s textwrap.dedent( 378s """ 378s from skbuild import setup 378s setup( 378s name="test_cmake_args_keyword_osx_default", 378s version="1.2.3", 378s description="A minimal example package", 378s author="The scikit-build team", 378s license="MIT", 378s cmake_args=[{cmake_args}] 378s ) 378s """.format(cmake_args=",".join([f"'{arg}'" for arg in keyword_cmake_args])) 378s ) 378s ) 378s tmp_dir.join("CMakeLists.txt").write( 378s textwrap.dedent( 378s """ 378s message(FATAL_ERROR "This error message should not be displayed") 378s """ 378s ) 378s ) 378s 378s mock_configure = mocker.patch("skbuild.cmaker.CMaker.configure", side_effect=RuntimeError("exit skbuild")) 378s 378s monkeypatch.setattr(platform, "mac_ver", lambda: ("10.9", None, "x84_64")) 378s monkeypatch.setattr(platform, "machine", lambda: "x86_64") 378s monkeypatch.setattr(sys, "platform", "darwin") 378s 378s with push_env(MACOSX_DEPLOYMENT_TARGET=osx_deployment_target_env_var): 378s monkeypatch.setattr(skbuild.constants, "_SKBUILD_PLAT_NAME", skbuild.constants._default_skbuild_plat_name()) 378s with pytest.raises(RuntimeError, match="exit skbuild"): 378s > with execute_setup_py(tmp_dir, ["build", *cli_setup_args, "--", *cli_cmake_args]): 378s 378s cli_cmake_args = [] 378s cli_setup_args = ['--plat-name', 'macosx-10.7-x86_64'] 378s expected_cmake_osx_deployment_target = '10.7' 378s keyword_cmake_args = [] 378s mock_configure = 378s mocker = 378s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x3ffb6195340> 378s osx_deployment_target_env_var = None 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-56/cmake_args_keyword_osx_default0') 378s 378s tests/test_issue342_cmake_osx_args_in_setup.py:176: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-56/cmake_args_keyword_osx_default0') 378s setup_args = ['build', '--plat-name', 'macosx-10.7-x86_64', '--'] 378s disable_languages_test = False 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = False 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-56/cmake_args_keyword_osx_default0') 378s setup_args = ['build', '--plat-name', 'macosx-10.7-x86_64', '--'] 378s 378s tests/__init__.py:218: AttributeError 378s _ test_cmake_args_keyword_osx_default[None-cli_setup_args5-keyword_cmake_args5-cli_cmake_args5-10.7] _ 378s 378s osx_deployment_target_env_var = None, cli_setup_args = [] 378s keyword_cmake_args = ['-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7'] 378s cli_cmake_args = [], expected_cmake_osx_deployment_target = '10.7' 378s mocker = 378s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x3ffb612a360> 378s 378s @pytest.mark.parametrize( 378s params, 378s [ 378s # default plat_name is 'macosx-10.9-x86_64' 378s ( 378s # osx_deployment_target_env_var 378s None, 378s # cli_setup_args 378s [], 378s # keyword_cmake_args 378s [], 378s # cli_cmake_args 378s [], 378s # expected_cmake_osx_deployment_target 378s "10.9", 378s ), 378s ( 378s # osx_deployment_target_env_var 378s "10.7", 378s # cli_setup_args 378s [], 378s # keyword_cmake_args 378s [], 378s # cli_cmake_args 378s [], 378s # expected_cmake_osx_deployment_target 378s "10.7", 378s ), 378s ( 378s # osx_deployment_target_env_var 378s "10.7", 378s # cli_setup_args 378s ["--plat-name", "macosx-10.9-x86_64"], 378s # keyword_cmake_args 378s [], 378s # cli_cmake_args 378s [], 378s # expected_cmake_osx_deployment_target 378s "10.9", 378s ), 378s ( 378s # osx_deployment_target_env_var 378s None, 378s # cli_setup_args 378s ["--plat-name", "macosx-10.6-x86_64"], 378s # keyword_cmake_args 378s [], 378s # cli_cmake_args 378s [], 378s # expected_cmake_osx_deployment_target 378s "10.6", 378s ), 378s ( 378s # osx_deployment_target_env_var 378s None, 378s # cli_setup_args 378s ["--plat-name", "macosx-10.7-x86_64"], 378s # keyword_cmake_args 378s [], 378s # cli_cmake_args 378s [], 378s # expected_cmake_osx_deployment_target 378s "10.7", 378s ), 378s ( 378s # osx_deployment_target_env_var 378s None, 378s # cli_setup_args 378s [], 378s # keyword_cmake_args 378s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 378s # cli_cmake_args 378s [], 378s # expected_cmake_osx_deployment_target 378s "10.7", 378s ), 378s ( 378s # osx_deployment_target_env_var 378s None, 378s # cli_setup_args 378s ["--plat-name", "macosx-10.12-x86_64"], 378s # keyword_cmake_args 378s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 378s # cli_cmake_args 378s [], 378s # expected_cmake_osx_deployment_target 378s "10.7", 378s ), 378s ( 378s # osx_deployment_target_env_var 378s None, 378s # cli_setup_args 378s [], 378s # keyword_cmake_args 378s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 378s # cli_cmake_args 378s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 378s # expected_cmake_osx_deployment_target 378s "10.8", 378s ), 378s ( 378s # osx_deployment_target_env_var 378s None, 378s # cli_setup_args 378s ["--plat-name", "macosx-10.12-x86_64"], 378s # keyword_cmake_args 378s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 378s # cli_cmake_args 378s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 378s # expected_cmake_osx_deployment_target 378s "10.8", 378s ), 378s ], 378s ) 378s def test_cmake_args_keyword_osx_default( 378s osx_deployment_target_env_var, 378s cli_setup_args, 378s keyword_cmake_args, 378s cli_cmake_args, 378s expected_cmake_osx_deployment_target, 378s mocker, 378s monkeypatch, 378s ): 378s tmp_dir = _tmpdir("cmake_args_keyword_osx_default") 378s 378s tmp_dir.join("setup.py").write( 378s textwrap.dedent( 378s """ 378s from skbuild import setup 378s setup( 378s name="test_cmake_args_keyword_osx_default", 378s version="1.2.3", 378s description="A minimal example package", 378s author="The scikit-build team", 378s license="MIT", 378s cmake_args=[{cmake_args}] 378s ) 378s """.format(cmake_args=",".join([f"'{arg}'" for arg in keyword_cmake_args])) 378s ) 378s ) 378s tmp_dir.join("CMakeLists.txt").write( 378s textwrap.dedent( 378s """ 378s message(FATAL_ERROR "This error message should not be displayed") 378s """ 378s ) 378s ) 378s 378s mock_configure = mocker.patch("skbuild.cmaker.CMaker.configure", side_effect=RuntimeError("exit skbuild")) 378s 378s monkeypatch.setattr(platform, "mac_ver", lambda: ("10.9", None, "x84_64")) 378s monkeypatch.setattr(platform, "machine", lambda: "x86_64") 378s monkeypatch.setattr(sys, "platform", "darwin") 378s 378s with push_env(MACOSX_DEPLOYMENT_TARGET=osx_deployment_target_env_var): 378s monkeypatch.setattr(skbuild.constants, "_SKBUILD_PLAT_NAME", skbuild.constants._default_skbuild_plat_name()) 378s with pytest.raises(RuntimeError, match="exit skbuild"): 378s > with execute_setup_py(tmp_dir, ["build", *cli_setup_args, "--", *cli_cmake_args]): 378s 378s cli_cmake_args = [] 378s cli_setup_args = [] 378s expected_cmake_osx_deployment_target = '10.7' 378s keyword_cmake_args = ['-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7'] 378s mock_configure = 378s mocker = 378s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x3ffb612a360> 378s osx_deployment_target_env_var = None 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-57/cmake_args_keyword_osx_default0') 378s 378s tests/test_issue342_cmake_osx_args_in_setup.py:176: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-57/cmake_args_keyword_osx_default0') 378s setup_args = ['build', '--'], disable_languages_test = False 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = False 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-57/cmake_args_keyword_osx_default0') 378s setup_args = ['build', '--'] 378s 378s tests/__init__.py:218: AttributeError 378s _ test_cmake_args_keyword_osx_default[None-cli_setup_args6-keyword_cmake_args6-cli_cmake_args6-10.7] _ 378s 378s osx_deployment_target_env_var = None 378s cli_setup_args = ['--plat-name', 'macosx-10.12-x86_64'] 378s keyword_cmake_args = ['-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7'] 378s cli_cmake_args = [], expected_cmake_osx_deployment_target = '10.7' 378s mocker = 378s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x3ffb61a4110> 378s 378s @pytest.mark.parametrize( 378s params, 378s [ 378s # default plat_name is 'macosx-10.9-x86_64' 378s ( 378s # osx_deployment_target_env_var 378s None, 378s # cli_setup_args 378s [], 378s # keyword_cmake_args 378s [], 378s # cli_cmake_args 378s [], 378s # expected_cmake_osx_deployment_target 378s "10.9", 378s ), 378s ( 378s # osx_deployment_target_env_var 378s "10.7", 378s # cli_setup_args 378s [], 378s # keyword_cmake_args 378s [], 378s # cli_cmake_args 378s [], 378s # expected_cmake_osx_deployment_target 378s "10.7", 378s ), 378s ( 378s # osx_deployment_target_env_var 378s "10.7", 378s # cli_setup_args 378s ["--plat-name", "macosx-10.9-x86_64"], 378s # keyword_cmake_args 378s [], 378s # cli_cmake_args 378s [], 378s # expected_cmake_osx_deployment_target 378s "10.9", 378s ), 378s ( 378s # osx_deployment_target_env_var 378s None, 378s # cli_setup_args 378s ["--plat-name", "macosx-10.6-x86_64"], 378s # keyword_cmake_args 378s [], 378s # cli_cmake_args 378s [], 378s # expected_cmake_osx_deployment_target 378s "10.6", 378s ), 378s ( 378s # osx_deployment_target_env_var 378s None, 378s # cli_setup_args 378s ["--plat-name", "macosx-10.7-x86_64"], 378s # keyword_cmake_args 378s [], 378s # cli_cmake_args 378s [], 378s # expected_cmake_osx_deployment_target 378s "10.7", 378s ), 378s ( 378s # osx_deployment_target_env_var 378s None, 378s # cli_setup_args 378s [], 378s # keyword_cmake_args 378s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 378s # cli_cmake_args 378s [], 378s # expected_cmake_osx_deployment_target 378s "10.7", 378s ), 378s ( 378s # osx_deployment_target_env_var 378s None, 378s # cli_setup_args 378s ["--plat-name", "macosx-10.12-x86_64"], 378s # keyword_cmake_args 378s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 378s # cli_cmake_args 378s [], 378s # expected_cmake_osx_deployment_target 378s "10.7", 378s ), 378s ( 378s # osx_deployment_target_env_var 378s None, 378s # cli_setup_args 378s [], 378s # keyword_cmake_args 378s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 378s # cli_cmake_args 378s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 378s # expected_cmake_osx_deployment_target 378s "10.8", 378s ), 378s ( 378s # osx_deployment_target_env_var 378s None, 378s # cli_setup_args 378s ["--plat-name", "macosx-10.12-x86_64"], 378s # keyword_cmake_args 378s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 378s # cli_cmake_args 378s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 378s # expected_cmake_osx_deployment_target 378s "10.8", 378s ), 378s ], 378s ) 378s def test_cmake_args_keyword_osx_default( 378s osx_deployment_target_env_var, 378s cli_setup_args, 378s keyword_cmake_args, 378s cli_cmake_args, 378s expected_cmake_osx_deployment_target, 378s mocker, 378s monkeypatch, 378s ): 378s tmp_dir = _tmpdir("cmake_args_keyword_osx_default") 378s 378s tmp_dir.join("setup.py").write( 378s textwrap.dedent( 378s """ 378s from skbuild import setup 378s setup( 378s name="test_cmake_args_keyword_osx_default", 378s version="1.2.3", 378s description="A minimal example package", 378s author="The scikit-build team", 378s license="MIT", 378s cmake_args=[{cmake_args}] 378s ) 378s """.format(cmake_args=",".join([f"'{arg}'" for arg in keyword_cmake_args])) 378s ) 378s ) 378s tmp_dir.join("CMakeLists.txt").write( 378s textwrap.dedent( 378s """ 378s message(FATAL_ERROR "This error message should not be displayed") 378s """ 378s ) 378s ) 378s 378s mock_configure = mocker.patch("skbuild.cmaker.CMaker.configure", side_effect=RuntimeError("exit skbuild")) 378s 378s monkeypatch.setattr(platform, "mac_ver", lambda: ("10.9", None, "x84_64")) 378s monkeypatch.setattr(platform, "machine", lambda: "x86_64") 378s monkeypatch.setattr(sys, "platform", "darwin") 378s 378s with push_env(MACOSX_DEPLOYMENT_TARGET=osx_deployment_target_env_var): 378s monkeypatch.setattr(skbuild.constants, "_SKBUILD_PLAT_NAME", skbuild.constants._default_skbuild_plat_name()) 378s with pytest.raises(RuntimeError, match="exit skbuild"): 378s > with execute_setup_py(tmp_dir, ["build", *cli_setup_args, "--", *cli_cmake_args]): 378s 378s cli_cmake_args = [] 378s cli_setup_args = ['--plat-name', 'macosx-10.12-x86_64'] 378s expected_cmake_osx_deployment_target = '10.7' 378s keyword_cmake_args = ['-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7'] 378s mock_configure = 378s mocker = 378s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x3ffb61a4110> 378s osx_deployment_target_env_var = None 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-58/cmake_args_keyword_osx_default0') 378s 378s tests/test_issue342_cmake_osx_args_in_setup.py:176: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-58/cmake_args_keyword_osx_default0') 378s setup_args = ['build', '--plat-name', 'macosx-10.12-x86_64', '--'] 378s disable_languages_test = False 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = False 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-58/cmake_args_keyword_osx_default0') 378s setup_args = ['build', '--plat-name', 'macosx-10.12-x86_64', '--'] 378s 378s tests/__init__.py:218: AttributeError 378s _ test_cmake_args_keyword_osx_default[None-cli_setup_args7-keyword_cmake_args7-cli_cmake_args7-10.8] _ 378s 378s osx_deployment_target_env_var = None, cli_setup_args = [] 378s keyword_cmake_args = ['-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7'] 378s cli_cmake_args = ['-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8'] 378s expected_cmake_osx_deployment_target = '10.8' 378s mocker = 378s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x3ffb617b410> 378s 378s @pytest.mark.parametrize( 378s params, 378s [ 378s # default plat_name is 'macosx-10.9-x86_64' 378s ( 378s # osx_deployment_target_env_var 378s None, 378s # cli_setup_args 378s [], 378s # keyword_cmake_args 378s [], 378s # cli_cmake_args 378s [], 378s # expected_cmake_osx_deployment_target 378s "10.9", 378s ), 378s ( 378s # osx_deployment_target_env_var 378s "10.7", 378s # cli_setup_args 378s [], 378s # keyword_cmake_args 378s [], 378s # cli_cmake_args 378s [], 378s # expected_cmake_osx_deployment_target 378s "10.7", 378s ), 378s ( 378s # osx_deployment_target_env_var 378s "10.7", 378s # cli_setup_args 378s ["--plat-name", "macosx-10.9-x86_64"], 378s # keyword_cmake_args 378s [], 378s # cli_cmake_args 378s [], 378s # expected_cmake_osx_deployment_target 378s "10.9", 378s ), 378s ( 378s # osx_deployment_target_env_var 378s None, 378s # cli_setup_args 378s ["--plat-name", "macosx-10.6-x86_64"], 378s # keyword_cmake_args 378s [], 378s # cli_cmake_args 378s [], 378s # expected_cmake_osx_deployment_target 378s "10.6", 378s ), 378s ( 378s # osx_deployment_target_env_var 378s None, 378s # cli_setup_args 378s ["--plat-name", "macosx-10.7-x86_64"], 378s # keyword_cmake_args 378s [], 378s # cli_cmake_args 378s [], 378s # expected_cmake_osx_deployment_target 378s "10.7", 378s ), 378s ( 378s # osx_deployment_target_env_var 378s None, 378s # cli_setup_args 378s [], 378s # keyword_cmake_args 378s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 378s # cli_cmake_args 378s [], 378s # expected_cmake_osx_deployment_target 378s "10.7", 378s ), 378s ( 378s # osx_deployment_target_env_var 378s None, 378s # cli_setup_args 378s ["--plat-name", "macosx-10.12-x86_64"], 378s # keyword_cmake_args 378s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 378s # cli_cmake_args 378s [], 378s # expected_cmake_osx_deployment_target 378s "10.7", 378s ), 378s ( 378s # osx_deployment_target_env_var 378s None, 378s # cli_setup_args 378s [], 378s # keyword_cmake_args 378s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 378s # cli_cmake_args 378s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 378s # expected_cmake_osx_deployment_target 378s "10.8", 378s ), 378s ( 378s # osx_deployment_target_env_var 378s None, 378s # cli_setup_args 378s ["--plat-name", "macosx-10.12-x86_64"], 378s # keyword_cmake_args 378s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 378s # cli_cmake_args 378s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 378s # expected_cmake_osx_deployment_target 378s "10.8", 378s ), 378s ], 378s ) 378s def test_cmake_args_keyword_osx_default( 378s osx_deployment_target_env_var, 378s cli_setup_args, 378s keyword_cmake_args, 378s cli_cmake_args, 378s expected_cmake_osx_deployment_target, 378s mocker, 378s monkeypatch, 378s ): 378s tmp_dir = _tmpdir("cmake_args_keyword_osx_default") 378s 378s tmp_dir.join("setup.py").write( 378s textwrap.dedent( 378s """ 378s from skbuild import setup 378s setup( 378s name="test_cmake_args_keyword_osx_default", 378s version="1.2.3", 378s description="A minimal example package", 378s author="The scikit-build team", 378s license="MIT", 378s cmake_args=[{cmake_args}] 378s ) 378s """.format(cmake_args=",".join([f"'{arg}'" for arg in keyword_cmake_args])) 378s ) 378s ) 378s tmp_dir.join("CMakeLists.txt").write( 378s textwrap.dedent( 378s """ 378s message(FATAL_ERROR "This error message should not be displayed") 378s """ 378s ) 378s ) 378s 378s mock_configure = mocker.patch("skbuild.cmaker.CMaker.configure", side_effect=RuntimeError("exit skbuild")) 378s 378s monkeypatch.setattr(platform, "mac_ver", lambda: ("10.9", None, "x84_64")) 378s monkeypatch.setattr(platform, "machine", lambda: "x86_64") 378s monkeypatch.setattr(sys, "platform", "darwin") 378s 378s with push_env(MACOSX_DEPLOYMENT_TARGET=osx_deployment_target_env_var): 378s monkeypatch.setattr(skbuild.constants, "_SKBUILD_PLAT_NAME", skbuild.constants._default_skbuild_plat_name()) 378s with pytest.raises(RuntimeError, match="exit skbuild"): 378s > with execute_setup_py(tmp_dir, ["build", *cli_setup_args, "--", *cli_cmake_args]): 378s 378s cli_cmake_args = ['-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8'] 378s cli_setup_args = [] 378s expected_cmake_osx_deployment_target = '10.8' 378s keyword_cmake_args = ['-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7'] 378s mock_configure = 378s mocker = 378s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x3ffb617b410> 378s osx_deployment_target_env_var = None 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-59/cmake_args_keyword_osx_default0') 378s 378s tests/test_issue342_cmake_osx_args_in_setup.py:176: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-59/cmake_args_keyword_osx_default0') 378s setup_args = ['build', '--', '-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8'] 378s disable_languages_test = False 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = False 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-59/cmake_args_keyword_osx_default0') 378s setup_args = ['build', '--', '-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8'] 378s 378s tests/__init__.py:218: AttributeError 378s _ test_cmake_args_keyword_osx_default[None-cli_setup_args8-keyword_cmake_args8-cli_cmake_args8-10.8] _ 378s 378s osx_deployment_target_env_var = None 378s cli_setup_args = ['--plat-name', 'macosx-10.12-x86_64'] 378s keyword_cmake_args = ['-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7'] 378s cli_cmake_args = ['-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8'] 378s expected_cmake_osx_deployment_target = '10.8' 378s mocker = 378s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x3ffb639e6f0> 378s 378s @pytest.mark.parametrize( 378s params, 378s [ 378s # default plat_name is 'macosx-10.9-x86_64' 378s ( 378s # osx_deployment_target_env_var 378s None, 378s # cli_setup_args 378s [], 378s # keyword_cmake_args 378s [], 378s # cli_cmake_args 378s [], 378s # expected_cmake_osx_deployment_target 378s "10.9", 378s ), 378s ( 378s # osx_deployment_target_env_var 378s "10.7", 378s # cli_setup_args 378s [], 378s # keyword_cmake_args 378s [], 378s # cli_cmake_args 378s [], 378s # expected_cmake_osx_deployment_target 378s "10.7", 378s ), 378s ( 378s # osx_deployment_target_env_var 378s "10.7", 378s # cli_setup_args 378s ["--plat-name", "macosx-10.9-x86_64"], 378s # keyword_cmake_args 378s [], 378s # cli_cmake_args 378s [], 378s # expected_cmake_osx_deployment_target 378s "10.9", 378s ), 378s ( 378s # osx_deployment_target_env_var 378s None, 378s # cli_setup_args 378s ["--plat-name", "macosx-10.6-x86_64"], 378s # keyword_cmake_args 378s [], 378s # cli_cmake_args 378s [], 378s # expected_cmake_osx_deployment_target 378s "10.6", 378s ), 378s ( 378s # osx_deployment_target_env_var 378s None, 378s # cli_setup_args 378s ["--plat-name", "macosx-10.7-x86_64"], 378s # keyword_cmake_args 378s [], 378s # cli_cmake_args 378s [], 378s # expected_cmake_osx_deployment_target 378s "10.7", 378s ), 378s ( 378s # osx_deployment_target_env_var 378s None, 378s # cli_setup_args 378s [], 378s # keyword_cmake_args 378s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 378s # cli_cmake_args 378s [], 378s # expected_cmake_osx_deployment_target 378s "10.7", 378s ), 378s ( 378s # osx_deployment_target_env_var 378s None, 378s # cli_setup_args 378s ["--plat-name", "macosx-10.12-x86_64"], 378s # keyword_cmake_args 378s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 378s # cli_cmake_args 378s [], 378s # expected_cmake_osx_deployment_target 378s "10.7", 378s ), 378s ( 378s # osx_deployment_target_env_var 378s None, 378s # cli_setup_args 378s [], 378s # keyword_cmake_args 378s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 378s # cli_cmake_args 378s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 378s # expected_cmake_osx_deployment_target 378s "10.8", 378s ), 378s ( 378s # osx_deployment_target_env_var 378s None, 378s # cli_setup_args 378s ["--plat-name", "macosx-10.12-x86_64"], 378s # keyword_cmake_args 378s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7"], 378s # cli_cmake_args 378s ["-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8"], 378s # expected_cmake_osx_deployment_target 378s "10.8", 378s ), 378s ], 378s ) 378s def test_cmake_args_keyword_osx_default( 378s osx_deployment_target_env_var, 378s cli_setup_args, 378s keyword_cmake_args, 378s cli_cmake_args, 378s expected_cmake_osx_deployment_target, 378s mocker, 378s monkeypatch, 378s ): 378s tmp_dir = _tmpdir("cmake_args_keyword_osx_default") 378s 378s tmp_dir.join("setup.py").write( 378s textwrap.dedent( 378s """ 378s from skbuild import setup 378s setup( 378s name="test_cmake_args_keyword_osx_default", 378s version="1.2.3", 378s description="A minimal example package", 378s author="The scikit-build team", 378s license="MIT", 378s cmake_args=[{cmake_args}] 378s ) 378s """.format(cmake_args=",".join([f"'{arg}'" for arg in keyword_cmake_args])) 378s ) 378s ) 378s tmp_dir.join("CMakeLists.txt").write( 378s textwrap.dedent( 378s """ 378s message(FATAL_ERROR "This error message should not be displayed") 378s """ 378s ) 378s ) 378s 378s mock_configure = mocker.patch("skbuild.cmaker.CMaker.configure", side_effect=RuntimeError("exit skbuild")) 378s 378s monkeypatch.setattr(platform, "mac_ver", lambda: ("10.9", None, "x84_64")) 378s monkeypatch.setattr(platform, "machine", lambda: "x86_64") 378s monkeypatch.setattr(sys, "platform", "darwin") 378s 378s with push_env(MACOSX_DEPLOYMENT_TARGET=osx_deployment_target_env_var): 378s monkeypatch.setattr(skbuild.constants, "_SKBUILD_PLAT_NAME", skbuild.constants._default_skbuild_plat_name()) 378s with pytest.raises(RuntimeError, match="exit skbuild"): 378s > with execute_setup_py(tmp_dir, ["build", *cli_setup_args, "--", *cli_cmake_args]): 378s 378s cli_cmake_args = ['-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8'] 378s cli_setup_args = ['--plat-name', 'macosx-10.12-x86_64'] 378s expected_cmake_osx_deployment_target = '10.8' 378s keyword_cmake_args = ['-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7'] 378s mock_configure = 378s mocker = 378s monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x3ffb639e6f0> 378s osx_deployment_target_env_var = None 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-60/cmake_args_keyword_osx_default0') 378s 378s tests/test_issue342_cmake_osx_args_in_setup.py:176: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-60/cmake_args_keyword_osx_default0') 378s setup_args = ['build', '--plat-name', 'macosx-10.12-x86_64', '--', '-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8'] 378s disable_languages_test = False 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = False 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-60/cmake_args_keyword_osx_default0') 378s setup_args = ['build', '--plat-name', 'macosx-10.12-x86_64', '--', '-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.8'] 378s 378s tests/__init__.py:218: AttributeError 378s ____________________ test_isolated_env_trigger_reconfigure _____________________ 378s 378s mocker = 378s 378s def test_isolated_env_trigger_reconfigure(mocker): 378s tmp_dir = _tmpdir("isolated_env_trigger_reconfigure") 378s 378s tmp_dir.join("setup.py").write( 378s textwrap.dedent( 378s """ 378s from skbuild import setup 378s setup( 378s name="test_isolated_env_trigger_reconfigure", 378s version="1.2.3", 378s description="A minimal example package", 378s author="The scikit-build team", 378s license="MIT", 378s ) 378s """ 378s ) 378s ) 378s tmp_dir.join("CMakeLists.txt").write( 378s textwrap.dedent( 378s """ 378s message(FATAL_ERROR "This error message should not be displayed") 378s """ 378s ) 378s ) 378s 378s # 378s # mock configure 378s # 378s def fake_configure(*args, **kwargs): 378s # Simulate a successful configuration creating a CMakeCache.txt 378s tmp_dir.ensure(CMAKE_BUILD_DIR(), dir=1).join("CMakeCache.txt").write( 378s textwrap.dedent( 378s """ 378s //Name of generator. 378s CMAKE_GENERATOR:INTERNAL=Ninja 378s """ 378s ) 378s ) 378s 378s # Skip real configuration creating the CMakeCache.txt expected by 378s # "skbuild.setuptools_wrap._load_cmake_spec()" function 378s mocker.patch("skbuild.cmaker.CMaker.configure", new=fake_configure) 378s 378s # 378s # mock _save_cmake_spec 378s # 378s _save_cmake_spec_original = skbuild.setuptools_wrap._save_cmake_spec 378s 378s exit_after_saving_cmake_spec = "exit skbuild saving cmake spec" 378s 378s def _save_cmake_spec_mock(args): 378s _save_cmake_spec_original(args) 378s raise RuntimeError(exit_after_saving_cmake_spec) 378s 378s mocker.patch("skbuild.setuptools_wrap._save_cmake_spec", new=_save_cmake_spec_mock) 378s 378s # 378s # mock make 378s # 378s exit_before_running_cmake = "exit skbuild running make" 378s mocker.patch("skbuild.cmaker.CMaker.make", side_effect=RuntimeError(exit_before_running_cmake)) 378s 378s # first build: "configure" and "_save_cmake_spec" are expected to be called 378s with pytest.raises(RuntimeError, match=exit_after_saving_cmake_spec): 378s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 378s 378s _save_cmake_spec_mock = ._save_cmake_spec_mock at 0x3ffb61c4ea0> 378s _save_cmake_spec_original = 378s exit_after_saving_cmake_spec = 'exit skbuild saving cmake spec' 378s exit_before_running_cmake = 'exit skbuild running make' 378s fake_configure = .fake_configure at 0x3ffb61c4860> 378s mocker = 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-61/isolated_env_trigger_reconfigu0') 378s 378s tests/test_issue352_isolated_environment_support.py:78: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-61/isolated_env_trigger_reconfigu0') 378s setup_args = ['build'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-61/isolated_env_trigger_reconfigu0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s __________________________ test_symbol_visibility[ON] __________________________ 378s 378s skip_override = 'ON' 378s 378s @pytest.mark.skipif( 378s platform.system().lower() not in ["linux"], reason="Executable and Linkable Format (ELF) is specific to Linux" 378s ) 378s @pytest.mark.parametrize("skip_override", ["ON", "OFF"]) 378s def test_symbol_visibility(skip_override): 378s with push_dir(): 378s tmp_dir = _tmpdir("test_issue668_symbol_visibility") 378s project = "issue-668-symbol-visibility" 378s prepare_project(project, tmp_dir) 378s initialize_git_repo_and_commit(tmp_dir, verbose=True) 378s 378s > with execute_setup_py( 378s tmp_dir, ["build", f"-DSKBUILD_GNU_SKIP_LOCAL_SYMBOL_EXPORT_OVERRIDE:BOOL={skip_override}"] 378s ): 378s 378s project = 'issue-668-symbol-visibility' 378s skip_override = 'ON' 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-62/test_issue668_symbol_visibilit0') 378s 378s tests/test_issue668_symbol_visibility.py:32: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-62/test_issue668_symbol_visibilit0') 378s setup_args = ['build', '-DSKBUILD_GNU_SKIP_LOCAL_SYMBOL_EXPORT_OVERRIDE:BOOL=ON'] 378s disable_languages_test = False 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = False 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-62/test_issue668_symbol_visibilit0') 378s setup_args = ['build', '-DSKBUILD_GNU_SKIP_LOCAL_SYMBOL_EXPORT_OVERRIDE:BOOL=ON'] 378s 378s tests/__init__.py:218: AttributeError 378s ----------------------------- Captured stdout call ----------------------------- 378s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-62/test_issue668_symbol_visibilit0/.git/ 378s [master (root-commit) 5442894] Initial commit 378s 5 files changed, 121 insertions(+) 378s create mode 100644 CMakeLists.txt 378s create mode 100644 hello/__init__.py 378s create mode 100644 hello/_hello.cxx 378s create mode 100644 pyproject.toml 378s create mode 100644 setup.py 378s ----------------------------- Captured stderr call ----------------------------- 378s hint: Using 'master' as the name for the initial branch. This default branch name 378s hint: is subject to change. To configure the initial branch name to use in all 378s hint: of your new repositories, which will suppress this warning, call: 378s hint: 378s hint: git config --global init.defaultBranch 378s hint: 378s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 378s hint: 'development'. The just-created branch can be renamed via this command: 378s hint: 378s hint: git branch -m 378s _________________________ test_symbol_visibility[OFF] __________________________ 378s 378s skip_override = 'OFF' 378s 378s @pytest.mark.skipif( 378s platform.system().lower() not in ["linux"], reason="Executable and Linkable Format (ELF) is specific to Linux" 378s ) 378s @pytest.mark.parametrize("skip_override", ["ON", "OFF"]) 378s def test_symbol_visibility(skip_override): 378s with push_dir(): 378s tmp_dir = _tmpdir("test_issue668_symbol_visibility") 378s project = "issue-668-symbol-visibility" 378s prepare_project(project, tmp_dir) 378s initialize_git_repo_and_commit(tmp_dir, verbose=True) 378s 378s > with execute_setup_py( 378s tmp_dir, ["build", f"-DSKBUILD_GNU_SKIP_LOCAL_SYMBOL_EXPORT_OVERRIDE:BOOL={skip_override}"] 378s ): 378s 378s project = 'issue-668-symbol-visibility' 378s skip_override = 'OFF' 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-63/test_issue668_symbol_visibilit0') 378s 378s tests/test_issue668_symbol_visibility.py:32: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-63/test_issue668_symbol_visibilit0') 378s setup_args = ['build', '-DSKBUILD_GNU_SKIP_LOCAL_SYMBOL_EXPORT_OVERRIDE:BOOL=OFF'] 378s disable_languages_test = False 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = False 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-63/test_issue668_symbol_visibilit0') 378s setup_args = ['build', '-DSKBUILD_GNU_SKIP_LOCAL_SYMBOL_EXPORT_OVERRIDE:BOOL=OFF'] 378s 378s tests/__init__.py:218: AttributeError 378s ----------------------------- Captured stdout call ----------------------------- 378s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-63/test_issue668_symbol_visibilit0/.git/ 378s [master (root-commit) 5442894] Initial commit 378s 5 files changed, 121 insertions(+) 378s create mode 100644 CMakeLists.txt 378s create mode 100644 hello/__init__.py 378s create mode 100644 hello/_hello.cxx 378s create mode 100644 pyproject.toml 378s create mode 100644 setup.py 378s ----------------------------- Captured stderr call ----------------------------- 378s hint: Using 'master' as the name for the initial branch. This default branch name 378s hint: is subject to change. To configure the initial branch name to use in all 378s hint: of your new repositories, which will suppress this warning, call: 378s hint: 378s hint: git config --global init.defaultBranch 378s hint: 378s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 378s hint: 'development'. The just-created branch can be renamed via this command: 378s hint: 378s hint: git branch -m 378s ____________________________ test_manifest_in_wheel ____________________________ 378s 378s iargs = (), ikwargs = {} 378s 378s @functools.wraps(fun) 378s def wrapped(*iargs, **ikwargs): 378s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 378s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 378s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 378s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 378s 378s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 378s 378s disable_languages_test = True 378s fun = 378s iargs = () 378s ikwargs = {} 378s ret = False 378s wrapped = 378s 378s tests/__init__.py:255: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-64/test_manifest_in_wheel0') 378s setup_args = ['bdist_wheel'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-64/test_manifest_in_wheel0') 378s setup_args = ['bdist_wheel'] 378s 378s tests/__init__.py:218: AttributeError 378s ----------------------------- Captured stdout call ----------------------------- 378s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-64/test_manifest_in_wheel0/.git/ 378s [master (root-commit) df0e563] Initial commit 378s 4 files changed, 14 insertions(+) 378s create mode 100644 MANIFEST.in 378s create mode 100644 hello/__init__.py 378s create mode 100644 not_included.txt 378s create mode 100644 setup.py 378s ----------------------------- Captured stderr call ----------------------------- 378s hint: Using 'master' as the name for the initial branch. This default branch name 378s hint: is subject to change. To configure the initial branch name to use in all 378s hint: of your new repositories, which will suppress this warning, call: 378s hint: 378s hint: git config --global init.defaultBranch 378s hint: 378s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 378s hint: 'development'. The just-created branch can be renamed via this command: 378s hint: 378s hint: git branch -m 378s ____________________ test_outside_project_root_fails[None] _____________________ 378s 378s option = None 378s 378s @pytest.mark.parametrize("option", [None, "-DINSTALL_FILE:BOOL=1", "-DINSTALL_PROJECT:BOOL=1"]) 378s def test_outside_project_root_fails(option): 378s with push_dir(): 378s expected_failure = False 378s 378s cmd = ["install"] 378s if option is not None: 378s expected_failure = True 378s cmd.extend(["--", option]) 378s 378s @project_setup_py_test("fail-outside-project-root", cmd, disable_languages_test=True) 378s def should_fail(): 378s pass 378s 378s failed = False 378s msg = "" 378s try: 378s > should_fail() 378s 378s cmd = ['install'] 378s expected_failure = False 378s failed = False 378s msg = '' 378s option = None 378s should_fail = .should_fail at 0x3ffb61c5300> 378s 378s tests/test_outside_project_root.py:36: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s tests/__init__.py:255: in wrapped 378s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 378s disable_languages_test = True 378s fun = .should_fail at 0x3ffb61c5120> 378s iargs = () 378s ikwargs = {} 378s ret = False 378s wrapped = .should_fail at 0x3ffb61c5300> 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-65/should_fail0') 378s setup_args = ['install'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-65/should_fail0') 378s setup_args = ['install'] 378s 378s tests/__init__.py:218: AttributeError 378s ----------------------------- Captured stdout call ----------------------------- 378s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-65/should_fail0/.git/ 378s [master (root-commit) ce0989f] Initial commit 378s 4 files changed, 51 insertions(+) 378s create mode 100644 CMakeLists.txt 378s create mode 100644 dummy 378s create mode 100644 other_project/CMakeLists.txt 378s create mode 100644 setup.py 378s ----------------------------- Captured stderr call ----------------------------- 378s hint: Using 'master' as the name for the initial branch. This default branch name 378s hint: is subject to change. To configure the initial branch name to use in all 378s hint: of your new repositories, which will suppress this warning, call: 378s hint: 378s hint: git config --global init.defaultBranch 378s hint: 378s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 378s hint: 'development'. The just-created branch can be renamed via this command: 378s hint: 378s hint: git branch -m 378s ____________ test_outside_project_root_fails[-DINSTALL_FILE:BOOL=1] ____________ 378s 378s option = '-DINSTALL_FILE:BOOL=1' 378s 378s @pytest.mark.parametrize("option", [None, "-DINSTALL_FILE:BOOL=1", "-DINSTALL_PROJECT:BOOL=1"]) 378s def test_outside_project_root_fails(option): 378s with push_dir(): 378s expected_failure = False 378s 378s cmd = ["install"] 378s if option is not None: 378s expected_failure = True 378s cmd.extend(["--", option]) 378s 378s @project_setup_py_test("fail-outside-project-root", cmd, disable_languages_test=True) 378s def should_fail(): 378s pass 378s 378s failed = False 378s msg = "" 378s try: 378s > should_fail() 378s 378s cmd = ['install', '--', '-DINSTALL_FILE:BOOL=1'] 378s expected_failure = True 378s failed = False 378s msg = '' 378s option = '-DINSTALL_FILE:BOOL=1' 378s should_fail = .should_fail at 0x3ffb61c4a40> 378s 378s tests/test_outside_project_root.py:36: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s tests/__init__.py:255: in wrapped 378s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 378s disable_languages_test = True 378s fun = .should_fail at 0x3ffb61c51c0> 378s iargs = () 378s ikwargs = {} 378s ret = False 378s wrapped = .should_fail at 0x3ffb61c4a40> 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-66/should_fail0') 378s setup_args = ['install', '--', '-DINSTALL_FILE:BOOL=1'] 378s disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-66/should_fail0') 378s setup_args = ['install', '--', '-DINSTALL_FILE:BOOL=1'] 378s 378s tests/__init__.py:218: AttributeError 378s ----------------------------- Captured stdout call ----------------------------- 378s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-66/should_fail0/.git/ 378s [master (root-commit) ce0989f] Initial commit 378s 4 files changed, 51 insertions(+) 378s create mode 100644 CMakeLists.txt 378s create mode 100644 dummy 378s create mode 100644 other_project/CMakeLists.txt 378s create mode 100644 setup.py 378s ----------------------------- Captured stderr call ----------------------------- 378s hint: Using 'master' as the name for the initial branch. This default branch name 378s hint: is subject to change. To configure the initial branch name to use in all 378s hint: of your new repositories, which will suppress this warning, call: 378s hint: 378s hint: git config --global init.defaultBranch 378s hint: 378s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 378s hint: 'development'. The just-created branch can be renamed via this command: 378s hint: 378s hint: git branch -m 378s __________ test_outside_project_root_fails[-DINSTALL_PROJECT:BOOL=1] ___________ 378s 378s option = '-DINSTALL_PROJECT:BOOL=1' 378s 378s @pytest.mark.parametrize("option", [None, "-DINSTALL_FILE:BOOL=1", "-DINSTALL_PROJECT:BOOL=1"]) 378s def test_outside_project_root_fails(option): 378s with push_dir(): 378s expected_failure = False 378s 378s cmd = ["install"] 378s if option is not None: 378s expected_failure = True 378s cmd.extend(["--", option]) 378s 378s @project_setup_py_test("fail-outside-project-root", cmd, disable_languages_test=True) 378s def should_fail(): 378s pass 378s 378s failed = False 378s msg = "" 378s try: 378s > should_fail() 378s 378s cmd = ['install', '--', '-DINSTALL_PROJECT:BOOL=1'] 378s expected_failure = True 378s failed = False 378s msg = '' 378s option = '-DINSTALL_PROJECT:BOOL=1' 378s should_fail = .should_fail at 0x3ffb61c6200> 378s 378s tests/test_outside_project_root.py:36: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s tests/__init__.py:255: in wrapped 378s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 378s disable_languages_test = True 378s fun = .should_fail at 0x3ffb61c6020> 378s iargs = () 378s ikwargs = {} 378s ret = False 378s wrapped = .should_fail at 0x3ffb61c6200> 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-67/should_fail0') 378s setup_args = ['install', '--', '-DINSTALL_PROJECT:BOOL=1'] 378s disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-67/should_fail0') 378s setup_args = ['install', '--', '-DINSTALL_PROJECT:BOOL=1'] 378s 378s tests/__init__.py:218: AttributeError 378s ----------------------------- Captured stdout call ----------------------------- 378s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-67/should_fail0/.git/ 378s [master (root-commit) ce0989f] Initial commit 378s 4 files changed, 51 insertions(+) 378s create mode 100644 CMakeLists.txt 378s create mode 100644 dummy 378s create mode 100644 other_project/CMakeLists.txt 378s create mode 100644 setup.py 378s ----------------------------- Captured stderr call ----------------------------- 378s hint: Using 'master' as the name for the initial branch. This default branch name 378s hint: is subject to change. To configure the initial branch name to use in all 378s hint: of your new repositories, which will suppress this warning, call: 378s hint: 378s hint: git config --global init.defaultBranch 378s hint: 378s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 378s hint: 'development'. The just-created branch can be renamed via this command: 378s hint: 378s hint: git branch -m 378s _____________________ test_cmake_args_keyword[cmake_args0] _____________________ 378s 378s cmake_args = [] 378s capfd = <_pytest.capture.CaptureFixture object at 0x3ffb610ac60> 378s 378s @pytest.mark.parametrize("cmake_args", [[], ["--", "-DVAR:STRING=43", "-DVAR_WITH_SPACE:STRING=Ciao Mondo"]]) 378s def test_cmake_args_keyword(cmake_args, capfd): 378s tmp_dir = _tmpdir("cmake_args_keyword") 378s 378s tmp_dir.join("setup.py").write( 378s textwrap.dedent( 378s """ 378s from skbuild import setup 378s setup( 378s name="test_cmake_args_keyword", 378s version="1.2.3", 378s description="a minimal example package", 378s author='The scikit-build team', 378s license="MIT", 378s cmake_args=[ 378s "-DVAR:STRING=42", 378s "-DVAR_WITH_SPACE:STRING=Hello World" 378s ] 378s 378s ) 378s """ 378s ) 378s ) 378s tmp_dir.join("CMakeLists.txt").write( 378s textwrap.dedent( 378s """ 378s cmake_minimum_required(VERSION 3.5.0) 378s project(test NONE) 378s message(STATUS "VAR[${VAR}]") 378s message(STATUS "VAR_WITH_SPACE[${VAR_WITH_SPACE}]") 378s install(CODE "execute_process( 378s COMMAND \\${CMAKE_COMMAND} -E sleep 0)") 378s """ 378s ) 378s ) 378s 378s > with execute_setup_py(tmp_dir, ["build", *cmake_args], disable_languages_test=True): 378s 378s capfd = <_pytest.capture.CaptureFixture object at 0x3ffb610ac60> 378s cmake_args = [] 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-68/cmake_args_keyword0') 378s 378s tests/test_setup.py:127: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-68/cmake_args_keyword0') 378s setup_args = ['build'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-68/cmake_args_keyword0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s _____________________ test_cmake_args_keyword[cmake_args1] _____________________ 378s 378s cmake_args = ['--', '-DVAR:STRING=43', '-DVAR_WITH_SPACE:STRING=Ciao Mondo'] 378s capfd = <_pytest.capture.CaptureFixture object at 0x3ffb60ff770> 378s 378s @pytest.mark.parametrize("cmake_args", [[], ["--", "-DVAR:STRING=43", "-DVAR_WITH_SPACE:STRING=Ciao Mondo"]]) 378s def test_cmake_args_keyword(cmake_args, capfd): 378s tmp_dir = _tmpdir("cmake_args_keyword") 378s 378s tmp_dir.join("setup.py").write( 378s textwrap.dedent( 378s """ 378s from skbuild import setup 378s setup( 378s name="test_cmake_args_keyword", 378s version="1.2.3", 378s description="a minimal example package", 378s author='The scikit-build team', 378s license="MIT", 378s cmake_args=[ 378s "-DVAR:STRING=42", 378s "-DVAR_WITH_SPACE:STRING=Hello World" 378s ] 378s 378s ) 378s """ 378s ) 378s ) 378s tmp_dir.join("CMakeLists.txt").write( 378s textwrap.dedent( 378s """ 378s cmake_minimum_required(VERSION 3.5.0) 378s project(test NONE) 378s message(STATUS "VAR[${VAR}]") 378s message(STATUS "VAR_WITH_SPACE[${VAR_WITH_SPACE}]") 378s install(CODE "execute_process( 378s COMMAND \\${CMAKE_COMMAND} -E sleep 0)") 378s """ 378s ) 378s ) 378s 378s > with execute_setup_py(tmp_dir, ["build", *cmake_args], disable_languages_test=True): 378s 378s capfd = <_pytest.capture.CaptureFixture object at 0x3ffb60ff770> 378s cmake_args = ['--', '-DVAR:STRING=43', '-DVAR_WITH_SPACE:STRING=Ciao Mondo'] 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-69/cmake_args_keyword0') 378s 378s tests/test_setup.py:127: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-69/cmake_args_keyword0') 378s setup_args = ['build', '--', '-DVAR:STRING=43', '-DVAR_WITH_SPACE:STRING=Ciao Mondo'] 378s disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-69/cmake_args_keyword0') 378s setup_args = ['build', '--', '-DVAR:STRING=43', '-DVAR_WITH_SPACE:STRING=Ciao Mondo'] 378s 378s tests/__init__.py:218: AttributeError 378s ________________ test_cmake_install_dir_keyword[None-True-str] _________________ 378s 378s cmake_install_dir = None, expected_failed = True 378s error_code_type = 378s capsys = <_pytest.capture.CaptureFixture object at 0x3ffb6108740> 378s caplog = <_pytest.logging.LogCaptureFixture object at 0x3ffb64e42c0> 378s 378s @pytest.mark.parametrize( 378s ("cmake_install_dir", "expected_failed", "error_code_type"), 378s [ 378s (None, True, str), 378s ("", True, str), 378s (str(py.path.local.get_temproot().join("scikit-build")), True, SKBuildError), 378s ("banana", False, str), 378s ], 378s ) 378s def test_cmake_install_dir_keyword(cmake_install_dir, expected_failed, error_code_type, capsys, caplog): 378s # ------------------------------------------------------------------------- 378s # "SOURCE" tree layout: 378s # 378s # ROOT/ 378s # 378s # CMakeLists.txt 378s # setup.py 378s # 378s # apple/ 378s # __init__.py 378s # 378s # ------------------------------------------------------------------------- 378s # "BINARY" distribution layout 378s # 378s # ROOT/ 378s # 378s # apple/ 378s # __init__.py 378s # 378s 378s tmp_dir = _tmpdir("cmake_install_dir_keyword") 378s 378s setup_kwarg = "" 378s if cmake_install_dir is not None: 378s setup_kwarg = f"cmake_install_dir={str(cmake_install_dir)!r}" 378s 378s tmp_dir.join("setup.py").write( 378s textwrap.dedent( 378s f""" 378s from skbuild import setup 378s setup( 378s name="test_cmake_install_dir", 378s version="1.2.3", 378s description="a package testing use of cmake_install_dir", 378s author='The scikit-build team', 378s license="MIT", 378s packages=['apple', 'banana'], 378s {setup_kwarg} 378s ) 378s """ 378s ) 378s ) 378s 378s # Install location purposely set to "." so that we can test 378s # usage of "cmake_install_dir" skbuild.setup keyword. 378s tmp_dir.join("CMakeLists.txt").write( 378s textwrap.dedent( 378s """ 378s cmake_minimum_required(VERSION 3.5.0) 378s project(banana NONE) 378s file(WRITE "${CMAKE_BINARY_DIR}/__init__.py" "") 378s install(FILES "${CMAKE_BINARY_DIR}/__init__.py" DESTINATION ".") 378s """ 378s ) 378s ) 378s 378s tmp_dir.ensure("apple", "__init__.py") 378s 378s failed = False 378s message = "" 378s try: 378s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 378s 378s caplog = <_pytest.logging.LogCaptureFixture object at 0x3ffb64e42c0> 378s capsys = <_pytest.capture.CaptureFixture object at 0x3ffb6108740> 378s cmake_install_dir = None 378s error_code_type = 378s expected_failed = True 378s failed = False 378s message = '' 378s setup_kwarg = '' 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-70/cmake_install_dir_keyword0') 378s 378s tests/test_setup.py:211: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-70/cmake_install_dir_keyword0') 378s setup_args = ['build'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-70/cmake_install_dir_keyword0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s __________________ test_cmake_install_dir_keyword[-True-str] ___________________ 378s 378s cmake_install_dir = '', expected_failed = True, error_code_type = 378s capsys = <_pytest.capture.CaptureFixture object at 0x3ffb60fe570> 378s caplog = <_pytest.logging.LogCaptureFixture object at 0x3ffb60ff170> 378s 378s @pytest.mark.parametrize( 378s ("cmake_install_dir", "expected_failed", "error_code_type"), 378s [ 378s (None, True, str), 378s ("", True, str), 378s (str(py.path.local.get_temproot().join("scikit-build")), True, SKBuildError), 378s ("banana", False, str), 378s ], 378s ) 378s def test_cmake_install_dir_keyword(cmake_install_dir, expected_failed, error_code_type, capsys, caplog): 378s # ------------------------------------------------------------------------- 378s # "SOURCE" tree layout: 378s # 378s # ROOT/ 378s # 378s # CMakeLists.txt 378s # setup.py 378s # 378s # apple/ 378s # __init__.py 378s # 378s # ------------------------------------------------------------------------- 378s # "BINARY" distribution layout 378s # 378s # ROOT/ 378s # 378s # apple/ 378s # __init__.py 378s # 378s 378s tmp_dir = _tmpdir("cmake_install_dir_keyword") 378s 378s setup_kwarg = "" 378s if cmake_install_dir is not None: 378s setup_kwarg = f"cmake_install_dir={str(cmake_install_dir)!r}" 378s 378s tmp_dir.join("setup.py").write( 378s textwrap.dedent( 378s f""" 378s from skbuild import setup 378s setup( 378s name="test_cmake_install_dir", 378s version="1.2.3", 378s description="a package testing use of cmake_install_dir", 378s author='The scikit-build team', 378s license="MIT", 378s packages=['apple', 'banana'], 378s {setup_kwarg} 378s ) 378s """ 378s ) 378s ) 378s 378s # Install location purposely set to "." so that we can test 378s # usage of "cmake_install_dir" skbuild.setup keyword. 378s tmp_dir.join("CMakeLists.txt").write( 378s textwrap.dedent( 378s """ 378s cmake_minimum_required(VERSION 3.5.0) 378s project(banana NONE) 378s file(WRITE "${CMAKE_BINARY_DIR}/__init__.py" "") 378s install(FILES "${CMAKE_BINARY_DIR}/__init__.py" DESTINATION ".") 378s """ 378s ) 378s ) 378s 378s tmp_dir.ensure("apple", "__init__.py") 378s 378s failed = False 378s message = "" 378s try: 378s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 378s 378s caplog = <_pytest.logging.LogCaptureFixture object at 0x3ffb60ff170> 378s capsys = <_pytest.capture.CaptureFixture object at 0x3ffb60fe570> 378s cmake_install_dir = '' 378s error_code_type = 378s expected_failed = True 378s failed = False 378s message = '' 378s setup_kwarg = "cmake_install_dir=''" 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-71/cmake_install_dir_keyword0') 378s 378s tests/test_setup.py:211: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-71/cmake_install_dir_keyword0') 378s setup_args = ['build'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-71/cmake_install_dir_keyword0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s _____ test_cmake_install_dir_keyword[/tmp/scikit-build-True-SKBuildError] ______ 378s 378s cmake_install_dir = '/tmp/scikit-build', expected_failed = True 378s error_code_type = 378s capsys = <_pytest.capture.CaptureFixture object at 0x3ffb60fefc0> 378s caplog = <_pytest.logging.LogCaptureFixture object at 0x3ffb60fd640> 378s 378s @pytest.mark.parametrize( 378s ("cmake_install_dir", "expected_failed", "error_code_type"), 378s [ 378s (None, True, str), 378s ("", True, str), 378s (str(py.path.local.get_temproot().join("scikit-build")), True, SKBuildError), 378s ("banana", False, str), 378s ], 378s ) 378s def test_cmake_install_dir_keyword(cmake_install_dir, expected_failed, error_code_type, capsys, caplog): 378s # ------------------------------------------------------------------------- 378s # "SOURCE" tree layout: 378s # 378s # ROOT/ 378s # 378s # CMakeLists.txt 378s # setup.py 378s # 378s # apple/ 378s # __init__.py 378s # 378s # ------------------------------------------------------------------------- 378s # "BINARY" distribution layout 378s # 378s # ROOT/ 378s # 378s # apple/ 378s # __init__.py 378s # 378s 378s tmp_dir = _tmpdir("cmake_install_dir_keyword") 378s 378s setup_kwarg = "" 378s if cmake_install_dir is not None: 378s setup_kwarg = f"cmake_install_dir={str(cmake_install_dir)!r}" 378s 378s tmp_dir.join("setup.py").write( 378s textwrap.dedent( 378s f""" 378s from skbuild import setup 378s setup( 378s name="test_cmake_install_dir", 378s version="1.2.3", 378s description="a package testing use of cmake_install_dir", 378s author='The scikit-build team', 378s license="MIT", 378s packages=['apple', 'banana'], 378s {setup_kwarg} 378s ) 378s """ 378s ) 378s ) 378s 378s # Install location purposely set to "." so that we can test 378s # usage of "cmake_install_dir" skbuild.setup keyword. 378s tmp_dir.join("CMakeLists.txt").write( 378s textwrap.dedent( 378s """ 378s cmake_minimum_required(VERSION 3.5.0) 378s project(banana NONE) 378s file(WRITE "${CMAKE_BINARY_DIR}/__init__.py" "") 378s install(FILES "${CMAKE_BINARY_DIR}/__init__.py" DESTINATION ".") 378s """ 378s ) 378s ) 378s 378s tmp_dir.ensure("apple", "__init__.py") 378s 378s failed = False 378s message = "" 378s try: 378s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 378s 378s caplog = <_pytest.logging.LogCaptureFixture object at 0x3ffb60fd640> 378s capsys = <_pytest.capture.CaptureFixture object at 0x3ffb60fefc0> 378s cmake_install_dir = '/tmp/scikit-build' 378s error_code_type = 378s expected_failed = True 378s failed = False 378s message = '' 378s setup_kwarg = "cmake_install_dir='/tmp/scikit-build'" 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-72/cmake_install_dir_keyword0') 378s 378s tests/test_setup.py:211: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-72/cmake_install_dir_keyword0') 378s setup_args = ['build'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-72/cmake_install_dir_keyword0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s _______________ test_cmake_install_dir_keyword[banana-False-str] _______________ 378s 378s cmake_install_dir = 'banana', expected_failed = False 378s error_code_type = 378s capsys = <_pytest.capture.CaptureFixture object at 0x3ffb60fe7b0> 378s caplog = <_pytest.logging.LogCaptureFixture object at 0x3ffb60fcb00> 378s 378s @pytest.mark.parametrize( 378s ("cmake_install_dir", "expected_failed", "error_code_type"), 378s [ 378s (None, True, str), 378s ("", True, str), 378s (str(py.path.local.get_temproot().join("scikit-build")), True, SKBuildError), 378s ("banana", False, str), 378s ], 378s ) 378s def test_cmake_install_dir_keyword(cmake_install_dir, expected_failed, error_code_type, capsys, caplog): 378s # ------------------------------------------------------------------------- 378s # "SOURCE" tree layout: 378s # 378s # ROOT/ 378s # 378s # CMakeLists.txt 378s # setup.py 378s # 378s # apple/ 378s # __init__.py 378s # 378s # ------------------------------------------------------------------------- 378s # "BINARY" distribution layout 378s # 378s # ROOT/ 378s # 378s # apple/ 378s # __init__.py 378s # 378s 378s tmp_dir = _tmpdir("cmake_install_dir_keyword") 378s 378s setup_kwarg = "" 378s if cmake_install_dir is not None: 378s setup_kwarg = f"cmake_install_dir={str(cmake_install_dir)!r}" 378s 378s tmp_dir.join("setup.py").write( 378s textwrap.dedent( 378s f""" 378s from skbuild import setup 378s setup( 378s name="test_cmake_install_dir", 378s version="1.2.3", 378s description="a package testing use of cmake_install_dir", 378s author='The scikit-build team', 378s license="MIT", 378s packages=['apple', 'banana'], 378s {setup_kwarg} 378s ) 378s """ 378s ) 378s ) 378s 378s # Install location purposely set to "." so that we can test 378s # usage of "cmake_install_dir" skbuild.setup keyword. 378s tmp_dir.join("CMakeLists.txt").write( 378s textwrap.dedent( 378s """ 378s cmake_minimum_required(VERSION 3.5.0) 378s project(banana NONE) 378s file(WRITE "${CMAKE_BINARY_DIR}/__init__.py" "") 378s install(FILES "${CMAKE_BINARY_DIR}/__init__.py" DESTINATION ".") 378s """ 378s ) 378s ) 378s 378s tmp_dir.ensure("apple", "__init__.py") 378s 378s failed = False 378s message = "" 378s try: 378s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 378s 378s caplog = <_pytest.logging.LogCaptureFixture object at 0x3ffb60fcb00> 378s capsys = <_pytest.capture.CaptureFixture object at 0x3ffb60fe7b0> 378s cmake_install_dir = 'banana' 378s error_code_type = 378s expected_failed = False 378s failed = False 378s message = '' 378s setup_kwarg = "cmake_install_dir='banana'" 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-73/cmake_install_dir_keyword0') 378s 378s tests/test_setup.py:211: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-73/cmake_install_dir_keyword0') 378s setup_args = ['build'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-73/cmake_install_dir_keyword0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s _____________________ test_cmake_with_sdist_keyword[True] ______________________ 378s 378s cmake_with_sdist = True 378s capfd = <_pytest.capture.CaptureFixture object at 0x3ffb610b860> 378s 378s @pytest.mark.parametrize("cmake_with_sdist", [True, False]) 378s def test_cmake_with_sdist_keyword(cmake_with_sdist, capfd): 378s tmp_dir = _tmpdir("cmake_with_sdist") 378s 378s tmp_dir.join("setup.py").write( 378s textwrap.dedent( 378s f""" 378s from skbuild import setup 378s setup( 378s name="cmake_with_sdist_keyword", 378s version="1.2.3", 378s description="a minimal example package", 378s author='The scikit-build team', 378s license="MIT", 378s cmake_with_sdist={cmake_with_sdist} 378s ) 378s """ 378s ) 378s ) 378s tmp_dir.join("CMakeLists.txt").write( 378s textwrap.dedent( 378s """ 378s cmake_minimum_required(VERSION 3.5.0) 378s project(test NONE) 378s install(CODE "execute_process( 378s COMMAND \\${CMAKE_COMMAND} -E sleep 0)") 378s """ 378s ) 378s ) 378s 378s initialize_git_repo_and_commit(tmp_dir) 378s 378s > with execute_setup_py(tmp_dir, ["sdist"], disable_languages_test=True): 378s 378s capfd = <_pytest.capture.CaptureFixture object at 0x3ffb610b860> 378s cmake_with_sdist = True 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-74/cmake_with_sdist0') 378s 378s tests/test_setup.py:267: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-74/cmake_with_sdist0') 378s setup_args = ['sdist'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-74/cmake_with_sdist0') 378s setup_args = ['sdist'] 378s 378s tests/__init__.py:218: AttributeError 378s ----------------------------- Captured stdout call ----------------------------- 378s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-74/cmake_with_sdist0/.git/ 378s [master (root-commit) dd29599] Initial commit 378s 2 files changed, 15 insertions(+) 378s create mode 100644 CMakeLists.txt 378s create mode 100644 setup.py 378s ----------------------------- Captured stderr call ----------------------------- 378s hint: Using 'master' as the name for the initial branch. This default branch name 378s hint: is subject to change. To configure the initial branch name to use in all 378s hint: of your new repositories, which will suppress this warning, call: 378s hint: 378s hint: git config --global init.defaultBranch 378s hint: 378s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 378s hint: 'development'. The just-created branch can be renamed via this command: 378s hint: 378s hint: git branch -m 378s _____________________ test_cmake_with_sdist_keyword[False] _____________________ 378s 378s cmake_with_sdist = False 378s capfd = <_pytest.capture.CaptureFixture object at 0x3ffb60fe1e0> 378s 378s @pytest.mark.parametrize("cmake_with_sdist", [True, False]) 378s def test_cmake_with_sdist_keyword(cmake_with_sdist, capfd): 378s tmp_dir = _tmpdir("cmake_with_sdist") 378s 378s tmp_dir.join("setup.py").write( 378s textwrap.dedent( 378s f""" 378s from skbuild import setup 378s setup( 378s name="cmake_with_sdist_keyword", 378s version="1.2.3", 378s description="a minimal example package", 378s author='The scikit-build team', 378s license="MIT", 378s cmake_with_sdist={cmake_with_sdist} 378s ) 378s """ 378s ) 378s ) 378s tmp_dir.join("CMakeLists.txt").write( 378s textwrap.dedent( 378s """ 378s cmake_minimum_required(VERSION 3.5.0) 378s project(test NONE) 378s install(CODE "execute_process( 378s COMMAND \\${CMAKE_COMMAND} -E sleep 0)") 378s """ 378s ) 378s ) 378s 378s initialize_git_repo_and_commit(tmp_dir) 378s 378s > with execute_setup_py(tmp_dir, ["sdist"], disable_languages_test=True): 378s 378s capfd = <_pytest.capture.CaptureFixture object at 0x3ffb60fe1e0> 378s cmake_with_sdist = False 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-75/cmake_with_sdist0') 378s 378s tests/test_setup.py:267: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-75/cmake_with_sdist0') 378s setup_args = ['sdist'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-75/cmake_with_sdist0') 378s setup_args = ['sdist'] 378s 378s tests/__init__.py:218: AttributeError 378s ----------------------------- Captured stdout call ----------------------------- 378s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-75/cmake_with_sdist0/.git/ 378s [master (root-commit) ce450cf] Initial commit 378s 2 files changed, 15 insertions(+) 378s create mode 100644 CMakeLists.txt 378s create mode 100644 setup.py 378s ----------------------------- Captured stderr call ----------------------------- 378s hint: Using 'master' as the name for the initial branch. This default branch name 378s hint: is subject to change. To configure the initial branch name to use in all 378s hint: of your new repositories, which will suppress this warning, call: 378s hint: 378s hint: git config --global init.defaultBranch 378s hint: 378s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 378s hint: 'development'. The just-created branch can be renamed via this command: 378s hint: 378s hint: git branch -m 378s _________________ test_cmake_minimum_required_version_keyword __________________ 378s 378s def test_cmake_minimum_required_version_keyword(): 378s tmp_dir = _tmpdir("cmake_minimum_required_version") 378s 378s tmp_dir.join("setup.py").write( 378s textwrap.dedent( 378s """ 378s from skbuild import setup 378s setup( 378s name="cmake_with_sdist_keyword", 378s version="1.2.3", 378s description="a minimal example package", 378s author='The scikit-build team', 378s license="MIT", 378s cmake_minimum_required_version='99.98.97' 378s ) 378s """ 378s ) 378s ) 378s tmp_dir.join("CMakeLists.txt").write( 378s textwrap.dedent( 378s """ 378s cmake_minimum_required(VERSION 3.5.0) 378s project(test NONE) 378s install(CODE "execute_process( 378s COMMAND \\${CMAKE_COMMAND} -E sleep 0)") 378s """ 378s ) 378s ) 378s 378s try: 378s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 378s 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-76/cmake_minimum_required_version0') 378s 378s tests/test_setup.py:308: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-76/cmake_minimum_required_version0') 378s setup_args = ['build'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-76/cmake_minimum_required_version0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s __________________ test_setup_requires_keyword_include_cmake ___________________ 378s 378s mocker = 378s capsys = <_pytest.capture.CaptureFixture object at 0x3ffb6109e80> 378s 378s @pytest.mark.deprecated() 378s @pytest.mark.filterwarnings("ignore:setuptools.installer is deprecated:Warning") 378s @pytest.mark.skipif( 378s os.environ.get("CONDA_BUILD", "0") == "1", 378s reason="running tests expecting network connection in Conda is not possible. " 378s "See https://github.com/conda/conda/issues/508", 378s ) 378s @pytest.mark.skipif(not is_site_reachable("https://pypi.org/simple/cmake/"), reason="pypi.org website not reachable") 378s @pytest.mark.xfail( 378s sys.platform.startswith("cygwin"), strict=False, reason="Cygwin needs a release of scikit-build first" 378s ) 378s def test_setup_requires_keyword_include_cmake(mocker, capsys): 378s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 378s 378s tmp_dir = _tmpdir("setup_requires_keyword_include_cmake") 378s 378s setup_requires = ["cmake>=3.10"] 378s 378s tmp_dir.join("setup.py").write( 378s textwrap.dedent( 378s """ 378s from skbuild import setup 378s setup( 378s name="cmake_with_sdist_keyword", 378s version="1.2.3", 378s description="a minimal example package", 378s author='The scikit-build team', 378s license="MIT", 378s setup_requires=[{setup_requires}] 378s ) 378s """.format(setup_requires=",".join([f"'{package}'" for package in setup_requires])) 378s ) 378s ) 378s tmp_dir.join("CMakeLists.txt").write( 378s textwrap.dedent( 378s """ 378s cmake_minimum_required(VERSION 3.5.0) 378s project(test NONE) 378s install(CODE "execute_process( 378s COMMAND \\${CMAKE_COMMAND} -E sleep 0)") 378s """ 378s ) 378s ) 378s 378s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 378s 378s capsys = <_pytest.capture.CaptureFixture object at 0x3ffb6109e80> 378s mock_setup = 378s mocker = 378s setup_requires = ['cmake>=3.10'] 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-77/setup_requires_keyword_include0') 378s 378s tests/test_setup.py:363: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-77/setup_requires_keyword_include0') 378s setup_args = ['build'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-77/setup_requires_keyword_include0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s __________________________ test_script_keyword[pure] ___________________________ 378s 378s distribution_type = 'pure' 378s capsys = <_pytest.capture.CaptureFixture object at 0x3ffb61558b0> 378s caplog = <_pytest.logging.LogCaptureFixture object at 0x3ffb613bbf0> 378s 378s @pytest.mark.parametrize("distribution_type", ["pure", "skbuild"]) 378s def test_script_keyword(distribution_type, capsys, caplog): 378s # ------------------------------------------------------------------------- 378s # 378s # "SOURCE" tree layout for "pure" distribution: 378s # 378s # ROOT/ 378s # setup.py 378s # foo.py 378s # bar.py 378s # 378s # "SOURCE" tree layout for "pure" distribution: 378s # 378s # ROOT/ 378s # setup.py 378s # CMakeLists.txt 378s # 378s # ------------------------------------------------------------------------- 378s # "BINARY" distribution layout is identical for both 378s # 378s # ROOT/ 378s # foo.py 378s # bar.py 378s # 378s 378s tmp_dir = _tmpdir("script_keyword") 378s 378s tmp_dir.join("setup.py").write( 378s textwrap.dedent( 378s """ 378s from skbuild import setup 378s setup( 378s name="test_script_keyword", 378s version="1.2.3", 378s description="a package testing use of script keyword", 378s author='The scikit-build team', 378s license="MIT", 378s scripts=['foo.py', 'bar.py'], 378s packages=[], 378s ) 378s """ 378s ) 378s ) 378s 378s if distribution_type == "skbuild": 378s tmp_dir.join("CMakeLists.txt").write( 378s textwrap.dedent( 378s """ 378s cmake_minimum_required(VERSION 3.5.0) 378s project(foo NONE) 378s file(WRITE "${CMAKE_BINARY_DIR}/foo.py" "# foo.py") 378s file(WRITE "${CMAKE_BINARY_DIR}/bar.py" "# bar.py") 378s install( 378s FILES 378s "${CMAKE_BINARY_DIR}/foo.py" 378s "${CMAKE_BINARY_DIR}/bar.py" 378s DESTINATION "." 378s ) 378s """ 378s ) 378s ) 378s 378s messages = [ 378s f"copying {CMAKE_INSTALL_DIR()}/{module}.py -> {SKBUILD_DIR()}/setuptools/scripts-" 378s for module in ["foo", "bar"] 378s ] 378s 378s elif distribution_type == "pure": 378s tmp_dir.join("foo.py").write("# foo.py") 378s tmp_dir.join("bar.py").write("# bar.py") 378s 378s messages = [f"copying {module}.py -> {SKBUILD_DIR()}/setuptools/scripts-" for module in ["foo", "bar"]] 378s 378s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 378s 378s caplog = <_pytest.logging.LogCaptureFixture object at 0x3ffb613bbf0> 378s capsys = <_pytest.capture.CaptureFixture object at 0x3ffb61558b0> 378s distribution_type = 'pure' 378s messages = ['copying foo.py -> _skbuild/linux-s390x-3.12/setuptools/scripts-', 'copying bar.py -> _skbuild/linux-s390x-3.12/setuptools/scripts-'] 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-78/script_keyword0') 378s 378s tests/test_setup.py:448: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-78/script_keyword0') 378s setup_args = ['build'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-78/script_keyword0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s _________________________ test_script_keyword[skbuild] _________________________ 378s 378s distribution_type = 'skbuild' 378s capsys = <_pytest.capture.CaptureFixture object at 0x3ffb613a5d0> 378s caplog = <_pytest.logging.LogCaptureFixture object at 0x3ffb613a5a0> 378s 378s @pytest.mark.parametrize("distribution_type", ["pure", "skbuild"]) 378s def test_script_keyword(distribution_type, capsys, caplog): 378s # ------------------------------------------------------------------------- 378s # 378s # "SOURCE" tree layout for "pure" distribution: 378s # 378s # ROOT/ 378s # setup.py 378s # foo.py 378s # bar.py 378s # 378s # "SOURCE" tree layout for "pure" distribution: 378s # 378s # ROOT/ 378s # setup.py 378s # CMakeLists.txt 378s # 378s # ------------------------------------------------------------------------- 378s # "BINARY" distribution layout is identical for both 378s # 378s # ROOT/ 378s # foo.py 378s # bar.py 378s # 378s 378s tmp_dir = _tmpdir("script_keyword") 378s 378s tmp_dir.join("setup.py").write( 378s textwrap.dedent( 378s """ 378s from skbuild import setup 378s setup( 378s name="test_script_keyword", 378s version="1.2.3", 378s description="a package testing use of script keyword", 378s author='The scikit-build team', 378s license="MIT", 378s scripts=['foo.py', 'bar.py'], 378s packages=[], 378s ) 378s """ 378s ) 378s ) 378s 378s if distribution_type == "skbuild": 378s tmp_dir.join("CMakeLists.txt").write( 378s textwrap.dedent( 378s """ 378s cmake_minimum_required(VERSION 3.5.0) 378s project(foo NONE) 378s file(WRITE "${CMAKE_BINARY_DIR}/foo.py" "# foo.py") 378s file(WRITE "${CMAKE_BINARY_DIR}/bar.py" "# bar.py") 378s install( 378s FILES 378s "${CMAKE_BINARY_DIR}/foo.py" 378s "${CMAKE_BINARY_DIR}/bar.py" 378s DESTINATION "." 378s ) 378s """ 378s ) 378s ) 378s 378s messages = [ 378s f"copying {CMAKE_INSTALL_DIR()}/{module}.py -> {SKBUILD_DIR()}/setuptools/scripts-" 378s for module in ["foo", "bar"] 378s ] 378s 378s elif distribution_type == "pure": 378s tmp_dir.join("foo.py").write("# foo.py") 378s tmp_dir.join("bar.py").write("# bar.py") 378s 378s messages = [f"copying {module}.py -> {SKBUILD_DIR()}/setuptools/scripts-" for module in ["foo", "bar"]] 378s 378s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 378s 378s caplog = <_pytest.logging.LogCaptureFixture object at 0x3ffb613a5a0> 378s capsys = <_pytest.capture.CaptureFixture object at 0x3ffb613a5d0> 378s distribution_type = 'skbuild' 378s messages = ['copying _skbuild/linux-s390x-3.12/cmake-install/foo.py -> _skbuild/linux-s390x-3.12/setuptools/scripts-', 'copying _skbuild/linux-s390x-3.12/cmake-install/bar.py -> _skbuild/linux-s390x-3.12/setuptools/scripts-'] 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-79/script_keyword0') 378s 378s tests/test_setup.py:448: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-79/script_keyword0') 378s setup_args = ['build'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-79/script_keyword0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s ________________________ test_py_modules_keyword[pure] _________________________ 378s 378s distribution_type = 'pure' 378s capsys = <_pytest.capture.CaptureFixture object at 0x3ffb62eadb0> 378s caplog = <_pytest.logging.LogCaptureFixture object at 0x3ffb613a240> 378s 378s @pytest.mark.parametrize("distribution_type", ["pure", "skbuild"]) 378s def test_py_modules_keyword(distribution_type, capsys, caplog): 378s # ------------------------------------------------------------------------- 378s # 378s # "SOURCE" tree layout for "pure" distribution: 378s # 378s # ROOT/ 378s # setup.py 378s # foo.py 378s # bar.py 378s # 378s # "SOURCE" tree layout for "skbuild" distribution: 378s # 378s # ROOT/ 378s # setup.py 378s # CMakeLists.txt 378s # 378s # ------------------------------------------------------------------------- 378s # "BINARY" distribution layout is identical for both 378s # 378s # ROOT/ 378s # foo.py 378s # bar.py 378s # 378s 378s tmp_dir = _tmpdir("py_modules_keyword") 378s 378s tmp_dir.join("setup.py").write( 378s textwrap.dedent( 378s """ 378s from skbuild import setup 378s setup( 378s name="test_py_modules_keyword", 378s version="1.2.3", 378s description="a package testing use of py_modules keyword", 378s author='The scikit-build team', 378s license="MIT", 378s py_modules=['foo', 'bar'] 378s ) 378s """ 378s ) 378s ) 378s 378s if distribution_type == "skbuild": 378s tmp_dir.join("CMakeLists.txt").write( 378s textwrap.dedent( 378s """ 378s cmake_minimum_required(VERSION 3.5.0) 378s project(foobar NONE) 378s file(WRITE "${CMAKE_BINARY_DIR}/foo.py" "# foo.py") 378s file(WRITE "${CMAKE_BINARY_DIR}/bar.py" "# bar.py") 378s install( 378s FILES 378s "${CMAKE_BINARY_DIR}/foo.py" 378s "${CMAKE_BINARY_DIR}/bar.py" 378s DESTINATION "." 378s ) 378s """ 378s ) 378s ) 378s 378s messages = [ 378s f"copying {CMAKE_INSTALL_DIR()}/{module}.py -> {SKBUILD_DIR()}/setuptools/lib" for module in ["foo", "bar"] 378s ] 378s 378s elif distribution_type == "pure": 378s tmp_dir.join("foo.py").write("# foo.py") 378s tmp_dir.join("bar.py").write("# bar.py") 378s 378s messages = [f"copying {module}.py -> {SKBUILD_DIR()}/setuptools/lib" for module in ["foo", "bar"]] 378s 378s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 378s 378s caplog = <_pytest.logging.LogCaptureFixture object at 0x3ffb613a240> 378s capsys = <_pytest.capture.CaptureFixture object at 0x3ffb62eadb0> 378s distribution_type = 'pure' 378s messages = ['copying foo.py -> _skbuild/linux-s390x-3.12/setuptools/lib', 'copying bar.py -> _skbuild/linux-s390x-3.12/setuptools/lib'] 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-80/py_modules_keyword0') 378s 378s tests/test_setup.py:528: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-80/py_modules_keyword0') 378s setup_args = ['build'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-80/py_modules_keyword0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s _______________________ test_py_modules_keyword[skbuild] _______________________ 378s 378s distribution_type = 'skbuild' 378s capsys = <_pytest.capture.CaptureFixture object at 0x3ffb61541a0> 378s caplog = <_pytest.logging.LogCaptureFixture object at 0x3ffb61560c0> 378s 378s @pytest.mark.parametrize("distribution_type", ["pure", "skbuild"]) 378s def test_py_modules_keyword(distribution_type, capsys, caplog): 378s # ------------------------------------------------------------------------- 378s # 378s # "SOURCE" tree layout for "pure" distribution: 378s # 378s # ROOT/ 378s # setup.py 378s # foo.py 378s # bar.py 378s # 378s # "SOURCE" tree layout for "skbuild" distribution: 378s # 378s # ROOT/ 378s # setup.py 378s # CMakeLists.txt 378s # 378s # ------------------------------------------------------------------------- 378s # "BINARY" distribution layout is identical for both 378s # 378s # ROOT/ 378s # foo.py 378s # bar.py 378s # 378s 378s tmp_dir = _tmpdir("py_modules_keyword") 378s 378s tmp_dir.join("setup.py").write( 378s textwrap.dedent( 378s """ 378s from skbuild import setup 378s setup( 378s name="test_py_modules_keyword", 378s version="1.2.3", 378s description="a package testing use of py_modules keyword", 378s author='The scikit-build team', 378s license="MIT", 378s py_modules=['foo', 'bar'] 378s ) 378s """ 378s ) 378s ) 378s 378s if distribution_type == "skbuild": 378s tmp_dir.join("CMakeLists.txt").write( 378s textwrap.dedent( 378s """ 378s cmake_minimum_required(VERSION 3.5.0) 378s project(foobar NONE) 378s file(WRITE "${CMAKE_BINARY_DIR}/foo.py" "# foo.py") 378s file(WRITE "${CMAKE_BINARY_DIR}/bar.py" "# bar.py") 378s install( 378s FILES 378s "${CMAKE_BINARY_DIR}/foo.py" 378s "${CMAKE_BINARY_DIR}/bar.py" 378s DESTINATION "." 378s ) 378s """ 378s ) 378s ) 378s 378s messages = [ 378s f"copying {CMAKE_INSTALL_DIR()}/{module}.py -> {SKBUILD_DIR()}/setuptools/lib" for module in ["foo", "bar"] 378s ] 378s 378s elif distribution_type == "pure": 378s tmp_dir.join("foo.py").write("# foo.py") 378s tmp_dir.join("bar.py").write("# bar.py") 378s 378s messages = [f"copying {module}.py -> {SKBUILD_DIR()}/setuptools/lib" for module in ["foo", "bar"]] 378s 378s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 378s 378s caplog = <_pytest.logging.LogCaptureFixture object at 0x3ffb61560c0> 378s capsys = <_pytest.capture.CaptureFixture object at 0x3ffb61541a0> 378s distribution_type = 'skbuild' 378s messages = ['copying _skbuild/linux-s390x-3.12/cmake-install/foo.py -> _skbuild/linux-s390x-3.12/setuptools/lib', 'copying _skbuild/linux-s390x-3.12/cmake-install/bar.py -> _skbuild/linux-s390x-3.12/setuptools/lib'] 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-81/py_modules_keyword0') 378s 378s tests/test_setup.py:528: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-81/py_modules_keyword0') 378s setup_args = ['build'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-81/py_modules_keyword0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s ________________________ test_setup_inputs[0-0-0-0-0-0] ________________________ 378s 378s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 0 378s has_pure_package = 0, has_pure_module = 0, with_package_base = 0 378s mocker = 378s 378s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 378s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 378s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_module", [0, 1]) 378s @pytest.mark.parametrize("with_package_base", [0, 1]) 378s def test_setup_inputs( 378s has_cmake_package, 378s has_cmake_module, 378s has_hybrid_package, 378s has_pure_package, 378s has_pure_module, 378s with_package_base, 378s mocker, 378s ): 378s """This test that a project can have a package with some modules 378s installed using setup.py and some other modules installed using CMake. 378s """ 378s 378s tmp_dir = _tmpdir("test_setup_inputs") 378s 378s package_base = "to/the/base" if with_package_base else "" 378s package_base_dir = package_base + "/" if package_base else "" 378s cmake_source_dir = package_base 378s 378s if cmake_source_dir and (has_cmake_package or has_cmake_module): 378s pytest.skip( 378s "unsupported configuration: " 378s "python package fully generated by CMake does *NOT* work. " 378s "At least __init__.py should be in the project source tree" 378s ) 378s 378s # ------------------------------------------------------------------------- 378s # Here is the "SOURCE" tree layout: 378s # 378s # ROOT/ 378s # 378s # setup.py 378s # 378s # [/] 378s # 378s # pureModule.py 378s # 378s # pure/ 378s # __init__.py 378s # pure.py 378s # 378s # data/ 378s # pure.dat 378s # 378s # [/] 378s # 378s # hybrid/ 378s # CMakeLists.txt 378s # __init__.py 378s # hybrid_pure.dat 378s # hybrid_pure.py 378s # 378s # data/ 378s # hybrid_data_pure.dat 378s # 378s # hybrid_2/ 378s # __init__.py 378s # hybrid_2_pure.py 378s # 378s # hybrid_2_pure/ 378s # __init__.py 378s # hybrid_2_pure_1.py 378s # hybrid_2_pure_2.py 378s # 378s # 378s # ------------------------------------------------------------------------- 378s # and here is the "BINARY" distribution layout: 378s # 378s # The comment "CMake" or "Setuptools" indicates which tool is responsible 378s # for placing the file in the tree used to create the binary distribution. 378s # 378s # ROOT/ 378s # 378s # cmakeModule.py # CMake 378s # 378s # cmake/ 378s # __init__.py # CMake 378s # cmake.py # CMake 378s # 378s # hybrid/ 378s # hybrid_cmake.dat # CMake 378s # hybrid_cmake.py # CMake 378s # hybrid_pure.dat # Setuptools 378s # hybrid_pure.py # Setuptools 378s # 378s # data/ 378s # hybrid_data_pure.dat # CMake or Setuptools 378s # hybrid_data_cmake.dat # CMake *NO TEST* 378s # 378s # hybrid_2/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure.py # CMake or Setuptools 378s # hybrid_2_cmake.py # CMake 378s # 378s # hybrid_2_pure/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure_1.py # CMake or Setuptools 378s # hybrid_2_pure_2.py # CMake or Setuptools 378s # 378s # pureModule.py # Setuptools 378s # 378s # pure/ 378s # __init__.py # Setuptools 378s # pure.py # Setuptools 378s # 378s # data/ 378s # pure.dat # Setuptools 378s 378s tmp_dir.join("setup.py").write( 378s textwrap.dedent( 378s """ 378s from skbuild import setup 378s #from setuptools import setup 378s setup( 378s name="test_hybrid_project", 378s version="1.2.3", 378s description=("an hybrid package mixing files installed by both " 378s "CMake and setuptools"), 378s author='The scikit-build team', 378s license="MIT", 378s cmake_source_dir='{cmake_source_dir}', 378s cmake_install_dir='{cmake_install_dir}', 378s # Arbitrary order of packages 378s packages=[ 378s {p_off} 'pure', 378s {h_off} 'hybrid.hybrid_2', 378s {h_off} 'hybrid', 378s {c_off} 'cmake', 378s {p_off} 'hybrid.hybrid_2_pure', 378s ], 378s py_modules=[ 378s {pm_off} '{package_base}pureModule', 378s {cm_off} '{package_base}cmakeModule', 378s ], 378s package_data={{ 378s {p_off} 'pure': ['data/pure.dat'], 378s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 378s }}, 378s # Arbitrary order of package_dir 378s package_dir = {{ 378s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 378s {p_off} 'pure': '{package_base}pure', 378s {h_off} 'hybrid': '{package_base}hybrid', 378s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 378s {c_off} 'cmake': '{package_base}cmake', 378s }} 378s ) 378s """.format( 378s cmake_source_dir=cmake_source_dir, 378s cmake_install_dir=package_base, 378s package_base=package_base_dir, 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s p_off="" if has_pure_package else "#", 378s pm_off="" if has_pure_module else "#", 378s ) 378s ) 378s ) 378s 378s src_dir = tmp_dir.ensure(package_base, dir=1) 378s 378s src_dir.join("CMakeLists.txt").write( 378s textwrap.dedent( 378s """ 378s cmake_minimum_required(VERSION 3.5.0) 378s project(hybrid NONE) 378s set(build_dir ${{CMAKE_BINARY_DIR}}) 378s 378s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 378s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 378s {c_off} install( 378s {c_off} FILES 378s {c_off} ${{build_dir}}/__init__.py 378s {c_off} ${{build_dir}}/cmake.py 378s {c_off} DESTINATION cmake 378s {c_off} ) 378s 378s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 378s {cm_off} install( 378s {cm_off} FILES ${{build_dir}}/cmakeModule.py 378s {cm_off} DESTINATION .) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 378s {h_off} DESTINATION hybrid/data) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 378s {h_off} DESTINATION hybrid/hybrid_2) 378s 378s install(CODE "message(STATUS \\\"Installation complete\\\")") 378s """.format( 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s ) 378s ) 378s ) 378s 378s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 378s path_types: Sequence[str] 378s try: 378s path_types = next( 378s iter( 378s zip( 378s *filter( 378s lambda i: i[1], 378s [ 378s ("c", has_cmake_package), 378s ("cm", has_cmake_module), 378s ("h", has_hybrid_package), 378s ("p", has_pure_package), 378s ("pm", has_pure_module), 378s ], 378s ) 378s ) 378s ) 378s ) 378s except StopIteration: 378s path_types = [] 378s 378s def select_paths(annotated_paths): 378s """Return a filtered list paths considering ``path_types``. 378s 378s `annotated_paths`` is list of tuple ``(type, path)`` where type 378s is either `c`, 'cm', `h`, `p` or 'pm'. 378s 378s """ 378s return filter(lambda i: i[0] in path_types, annotated_paths) 378s 378s # Commented paths are the one expected to be installed by CMake. For 378s # this reason, corresponding files should NOT be created in the source 378s # tree. 378s for _type, path in select_paths( 378s [ 378s # ('c', 'cmake/__init__.py'), 378s # ('c', 'cmake/cmake.py'), 378s # ('cm', 'cmakeModule.py'), 378s ("h", "hybrid/__init__.py"), 378s # ('h', 'hybrid/hybrid_cmake.dat'), 378s # ('h', 'hybrid/hybrid_cmake.py'), 378s ("h", "hybrid/hybrid_pure.dat"), 378s ("h", "hybrid/hybrid_pure.py"), 378s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 378s ("h", "hybrid/data/hybrid_data_pure.dat"), 378s ("h", "hybrid/hybrid_2/__init__.py"), 378s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 378s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 378s ("p", "hybrid/hybrid_2_pure/__init__.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 378s ("pm", "pureModule.py"), 378s ("p", "pure/__init__.py"), 378s ("p", "pure/pure.py"), 378s ("p", "pure/data/pure.dat"), 378s ] 378s ): 378s assert _type in {"p", "pm", "h"} 378s root = package_base if _type in {"p", "pm"} else cmake_source_dir 378s tmp_dir.ensure(os.path.join(root, path)) 378s 378s # Do not call the real setup function. Instead, replace it with 378s # a MagicMock allowing to check with which arguments it was invoked. 378s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 378s 378s # Convenience print function 378s def _pprint(desc, value=None): 378s print( 378s "-----------------\n" 378s f"{desc}:\n" 378s "\n" 378s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 378s ) 378s 378s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 378s 378s _pprint = ._pprint at 0x3ffb6028b80> 378s cmake_source_dir = '' 378s has_cmake_module = 0 378s has_cmake_package = 0 378s has_hybrid_package = 0 378s has_pure_module = 0 378s has_pure_package = 0 378s mock_setup = 378s mocker = 378s package_base = '' 378s package_base_dir = '' 378s path_types = [] 378s select_paths = .select_paths at 0x3ffb6323060> 378s src_dir = local('/tmp/pytest-of-ubuntu/pytest-82/test_setup_inputs0') 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-82/test_setup_inputs0') 378s with_package_base = 0 378s 378s tests/test_setup.py:849: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-82/test_setup_inputs0') 378s setup_args = ['build'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-82/test_setup_inputs0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s ________________________ test_setup_inputs[0-0-0-0-0-1] ________________________ 378s 378s has_cmake_package = 1, has_cmake_module = 0, has_hybrid_package = 0 378s has_pure_package = 0, has_pure_module = 0, with_package_base = 0 378s mocker = 378s 378s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 378s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 378s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_module", [0, 1]) 378s @pytest.mark.parametrize("with_package_base", [0, 1]) 378s def test_setup_inputs( 378s has_cmake_package, 378s has_cmake_module, 378s has_hybrid_package, 378s has_pure_package, 378s has_pure_module, 378s with_package_base, 378s mocker, 378s ): 378s """This test that a project can have a package with some modules 378s installed using setup.py and some other modules installed using CMake. 378s """ 378s 378s tmp_dir = _tmpdir("test_setup_inputs") 378s 378s package_base = "to/the/base" if with_package_base else "" 378s package_base_dir = package_base + "/" if package_base else "" 378s cmake_source_dir = package_base 378s 378s if cmake_source_dir and (has_cmake_package or has_cmake_module): 378s pytest.skip( 378s "unsupported configuration: " 378s "python package fully generated by CMake does *NOT* work. " 378s "At least __init__.py should be in the project source tree" 378s ) 378s 378s # ------------------------------------------------------------------------- 378s # Here is the "SOURCE" tree layout: 378s # 378s # ROOT/ 378s # 378s # setup.py 378s # 378s # [/] 378s # 378s # pureModule.py 378s # 378s # pure/ 378s # __init__.py 378s # pure.py 378s # 378s # data/ 378s # pure.dat 378s # 378s # [/] 378s # 378s # hybrid/ 378s # CMakeLists.txt 378s # __init__.py 378s # hybrid_pure.dat 378s # hybrid_pure.py 378s # 378s # data/ 378s # hybrid_data_pure.dat 378s # 378s # hybrid_2/ 378s # __init__.py 378s # hybrid_2_pure.py 378s # 378s # hybrid_2_pure/ 378s # __init__.py 378s # hybrid_2_pure_1.py 378s # hybrid_2_pure_2.py 378s # 378s # 378s # ------------------------------------------------------------------------- 378s # and here is the "BINARY" distribution layout: 378s # 378s # The comment "CMake" or "Setuptools" indicates which tool is responsible 378s # for placing the file in the tree used to create the binary distribution. 378s # 378s # ROOT/ 378s # 378s # cmakeModule.py # CMake 378s # 378s # cmake/ 378s # __init__.py # CMake 378s # cmake.py # CMake 378s # 378s # hybrid/ 378s # hybrid_cmake.dat # CMake 378s # hybrid_cmake.py # CMake 378s # hybrid_pure.dat # Setuptools 378s # hybrid_pure.py # Setuptools 378s # 378s # data/ 378s # hybrid_data_pure.dat # CMake or Setuptools 378s # hybrid_data_cmake.dat # CMake *NO TEST* 378s # 378s # hybrid_2/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure.py # CMake or Setuptools 378s # hybrid_2_cmake.py # CMake 378s # 378s # hybrid_2_pure/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure_1.py # CMake or Setuptools 378s # hybrid_2_pure_2.py # CMake or Setuptools 378s # 378s # pureModule.py # Setuptools 378s # 378s # pure/ 378s # __init__.py # Setuptools 378s # pure.py # Setuptools 378s # 378s # data/ 378s # pure.dat # Setuptools 378s 378s tmp_dir.join("setup.py").write( 378s textwrap.dedent( 378s """ 378s from skbuild import setup 378s #from setuptools import setup 378s setup( 378s name="test_hybrid_project", 378s version="1.2.3", 378s description=("an hybrid package mixing files installed by both " 378s "CMake and setuptools"), 378s author='The scikit-build team', 378s license="MIT", 378s cmake_source_dir='{cmake_source_dir}', 378s cmake_install_dir='{cmake_install_dir}', 378s # Arbitrary order of packages 378s packages=[ 378s {p_off} 'pure', 378s {h_off} 'hybrid.hybrid_2', 378s {h_off} 'hybrid', 378s {c_off} 'cmake', 378s {p_off} 'hybrid.hybrid_2_pure', 378s ], 378s py_modules=[ 378s {pm_off} '{package_base}pureModule', 378s {cm_off} '{package_base}cmakeModule', 378s ], 378s package_data={{ 378s {p_off} 'pure': ['data/pure.dat'], 378s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 378s }}, 378s # Arbitrary order of package_dir 378s package_dir = {{ 378s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 378s {p_off} 'pure': '{package_base}pure', 378s {h_off} 'hybrid': '{package_base}hybrid', 378s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 378s {c_off} 'cmake': '{package_base}cmake', 378s }} 378s ) 378s """.format( 378s cmake_source_dir=cmake_source_dir, 378s cmake_install_dir=package_base, 378s package_base=package_base_dir, 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s p_off="" if has_pure_package else "#", 378s pm_off="" if has_pure_module else "#", 378s ) 378s ) 378s ) 378s 378s src_dir = tmp_dir.ensure(package_base, dir=1) 378s 378s src_dir.join("CMakeLists.txt").write( 378s textwrap.dedent( 378s """ 378s cmake_minimum_required(VERSION 3.5.0) 378s project(hybrid NONE) 378s set(build_dir ${{CMAKE_BINARY_DIR}}) 378s 378s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 378s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 378s {c_off} install( 378s {c_off} FILES 378s {c_off} ${{build_dir}}/__init__.py 378s {c_off} ${{build_dir}}/cmake.py 378s {c_off} DESTINATION cmake 378s {c_off} ) 378s 378s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 378s {cm_off} install( 378s {cm_off} FILES ${{build_dir}}/cmakeModule.py 378s {cm_off} DESTINATION .) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 378s {h_off} DESTINATION hybrid/data) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 378s {h_off} DESTINATION hybrid/hybrid_2) 378s 378s install(CODE "message(STATUS \\\"Installation complete\\\")") 378s """.format( 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s ) 378s ) 378s ) 378s 378s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 378s path_types: Sequence[str] 378s try: 378s path_types = next( 378s iter( 378s zip( 378s *filter( 378s lambda i: i[1], 378s [ 378s ("c", has_cmake_package), 378s ("cm", has_cmake_module), 378s ("h", has_hybrid_package), 378s ("p", has_pure_package), 378s ("pm", has_pure_module), 378s ], 378s ) 378s ) 378s ) 378s ) 378s except StopIteration: 378s path_types = [] 378s 378s def select_paths(annotated_paths): 378s """Return a filtered list paths considering ``path_types``. 378s 378s `annotated_paths`` is list of tuple ``(type, path)`` where type 378s is either `c`, 'cm', `h`, `p` or 'pm'. 378s 378s """ 378s return filter(lambda i: i[0] in path_types, annotated_paths) 378s 378s # Commented paths are the one expected to be installed by CMake. For 378s # this reason, corresponding files should NOT be created in the source 378s # tree. 378s for _type, path in select_paths( 378s [ 378s # ('c', 'cmake/__init__.py'), 378s # ('c', 'cmake/cmake.py'), 378s # ('cm', 'cmakeModule.py'), 378s ("h", "hybrid/__init__.py"), 378s # ('h', 'hybrid/hybrid_cmake.dat'), 378s # ('h', 'hybrid/hybrid_cmake.py'), 378s ("h", "hybrid/hybrid_pure.dat"), 378s ("h", "hybrid/hybrid_pure.py"), 378s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 378s ("h", "hybrid/data/hybrid_data_pure.dat"), 378s ("h", "hybrid/hybrid_2/__init__.py"), 378s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 378s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 378s ("p", "hybrid/hybrid_2_pure/__init__.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 378s ("pm", "pureModule.py"), 378s ("p", "pure/__init__.py"), 378s ("p", "pure/pure.py"), 378s ("p", "pure/data/pure.dat"), 378s ] 378s ): 378s assert _type in {"p", "pm", "h"} 378s root = package_base if _type in {"p", "pm"} else cmake_source_dir 378s tmp_dir.ensure(os.path.join(root, path)) 378s 378s # Do not call the real setup function. Instead, replace it with 378s # a MagicMock allowing to check with which arguments it was invoked. 378s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 378s 378s # Convenience print function 378s def _pprint(desc, value=None): 378s print( 378s "-----------------\n" 378s f"{desc}:\n" 378s "\n" 378s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 378s ) 378s 378s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 378s 378s _pprint = ._pprint at 0x3ffb61c58a0> 378s cmake_source_dir = '' 378s has_cmake_module = 0 378s has_cmake_package = 1 378s has_hybrid_package = 0 378s has_pure_module = 0 378s has_pure_package = 0 378s mock_setup = 378s mocker = 378s package_base = '' 378s package_base_dir = '' 378s path_types = ('c',) 378s select_paths = .select_paths at 0x3ffb62bae80> 378s src_dir = local('/tmp/pytest-of-ubuntu/pytest-83/test_setup_inputs0') 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-83/test_setup_inputs0') 378s with_package_base = 0 378s 378s tests/test_setup.py:849: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-83/test_setup_inputs0') 378s setup_args = ['build'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-83/test_setup_inputs0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s ________________________ test_setup_inputs[0-0-0-0-1-0] ________________________ 378s 378s has_cmake_package = 0, has_cmake_module = 1, has_hybrid_package = 0 378s has_pure_package = 0, has_pure_module = 0, with_package_base = 0 378s mocker = 378s 378s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 378s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 378s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_module", [0, 1]) 378s @pytest.mark.parametrize("with_package_base", [0, 1]) 378s def test_setup_inputs( 378s has_cmake_package, 378s has_cmake_module, 378s has_hybrid_package, 378s has_pure_package, 378s has_pure_module, 378s with_package_base, 378s mocker, 378s ): 378s """This test that a project can have a package with some modules 378s installed using setup.py and some other modules installed using CMake. 378s """ 378s 378s tmp_dir = _tmpdir("test_setup_inputs") 378s 378s package_base = "to/the/base" if with_package_base else "" 378s package_base_dir = package_base + "/" if package_base else "" 378s cmake_source_dir = package_base 378s 378s if cmake_source_dir and (has_cmake_package or has_cmake_module): 378s pytest.skip( 378s "unsupported configuration: " 378s "python package fully generated by CMake does *NOT* work. " 378s "At least __init__.py should be in the project source tree" 378s ) 378s 378s # ------------------------------------------------------------------------- 378s # Here is the "SOURCE" tree layout: 378s # 378s # ROOT/ 378s # 378s # setup.py 378s # 378s # [/] 378s # 378s # pureModule.py 378s # 378s # pure/ 378s # __init__.py 378s # pure.py 378s # 378s # data/ 378s # pure.dat 378s # 378s # [/] 378s # 378s # hybrid/ 378s # CMakeLists.txt 378s # __init__.py 378s # hybrid_pure.dat 378s # hybrid_pure.py 378s # 378s # data/ 378s # hybrid_data_pure.dat 378s # 378s # hybrid_2/ 378s # __init__.py 378s # hybrid_2_pure.py 378s # 378s # hybrid_2_pure/ 378s # __init__.py 378s # hybrid_2_pure_1.py 378s # hybrid_2_pure_2.py 378s # 378s # 378s # ------------------------------------------------------------------------- 378s # and here is the "BINARY" distribution layout: 378s # 378s # The comment "CMake" or "Setuptools" indicates which tool is responsible 378s # for placing the file in the tree used to create the binary distribution. 378s # 378s # ROOT/ 378s # 378s # cmakeModule.py # CMake 378s # 378s # cmake/ 378s # __init__.py # CMake 378s # cmake.py # CMake 378s # 378s # hybrid/ 378s # hybrid_cmake.dat # CMake 378s # hybrid_cmake.py # CMake 378s # hybrid_pure.dat # Setuptools 378s # hybrid_pure.py # Setuptools 378s # 378s # data/ 378s # hybrid_data_pure.dat # CMake or Setuptools 378s # hybrid_data_cmake.dat # CMake *NO TEST* 378s # 378s # hybrid_2/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure.py # CMake or Setuptools 378s # hybrid_2_cmake.py # CMake 378s # 378s # hybrid_2_pure/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure_1.py # CMake or Setuptools 378s # hybrid_2_pure_2.py # CMake or Setuptools 378s # 378s # pureModule.py # Setuptools 378s # 378s # pure/ 378s # __init__.py # Setuptools 378s # pure.py # Setuptools 378s # 378s # data/ 378s # pure.dat # Setuptools 378s 378s tmp_dir.join("setup.py").write( 378s textwrap.dedent( 378s """ 378s from skbuild import setup 378s #from setuptools import setup 378s setup( 378s name="test_hybrid_project", 378s version="1.2.3", 378s description=("an hybrid package mixing files installed by both " 378s "CMake and setuptools"), 378s author='The scikit-build team', 378s license="MIT", 378s cmake_source_dir='{cmake_source_dir}', 378s cmake_install_dir='{cmake_install_dir}', 378s # Arbitrary order of packages 378s packages=[ 378s {p_off} 'pure', 378s {h_off} 'hybrid.hybrid_2', 378s {h_off} 'hybrid', 378s {c_off} 'cmake', 378s {p_off} 'hybrid.hybrid_2_pure', 378s ], 378s py_modules=[ 378s {pm_off} '{package_base}pureModule', 378s {cm_off} '{package_base}cmakeModule', 378s ], 378s package_data={{ 378s {p_off} 'pure': ['data/pure.dat'], 378s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 378s }}, 378s # Arbitrary order of package_dir 378s package_dir = {{ 378s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 378s {p_off} 'pure': '{package_base}pure', 378s {h_off} 'hybrid': '{package_base}hybrid', 378s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 378s {c_off} 'cmake': '{package_base}cmake', 378s }} 378s ) 378s """.format( 378s cmake_source_dir=cmake_source_dir, 378s cmake_install_dir=package_base, 378s package_base=package_base_dir, 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s p_off="" if has_pure_package else "#", 378s pm_off="" if has_pure_module else "#", 378s ) 378s ) 378s ) 378s 378s src_dir = tmp_dir.ensure(package_base, dir=1) 378s 378s src_dir.join("CMakeLists.txt").write( 378s textwrap.dedent( 378s """ 378s cmake_minimum_required(VERSION 3.5.0) 378s project(hybrid NONE) 378s set(build_dir ${{CMAKE_BINARY_DIR}}) 378s 378s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 378s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 378s {c_off} install( 378s {c_off} FILES 378s {c_off} ${{build_dir}}/__init__.py 378s {c_off} ${{build_dir}}/cmake.py 378s {c_off} DESTINATION cmake 378s {c_off} ) 378s 378s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 378s {cm_off} install( 378s {cm_off} FILES ${{build_dir}}/cmakeModule.py 378s {cm_off} DESTINATION .) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 378s {h_off} DESTINATION hybrid/data) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 378s {h_off} DESTINATION hybrid/hybrid_2) 378s 378s install(CODE "message(STATUS \\\"Installation complete\\\")") 378s """.format( 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s ) 378s ) 378s ) 378s 378s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 378s path_types: Sequence[str] 378s try: 378s path_types = next( 378s iter( 378s zip( 378s *filter( 378s lambda i: i[1], 378s [ 378s ("c", has_cmake_package), 378s ("cm", has_cmake_module), 378s ("h", has_hybrid_package), 378s ("p", has_pure_package), 378s ("pm", has_pure_module), 378s ], 378s ) 378s ) 378s ) 378s ) 378s except StopIteration: 378s path_types = [] 378s 378s def select_paths(annotated_paths): 378s """Return a filtered list paths considering ``path_types``. 378s 378s `annotated_paths`` is list of tuple ``(type, path)`` where type 378s is either `c`, 'cm', `h`, `p` or 'pm'. 378s 378s """ 378s return filter(lambda i: i[0] in path_types, annotated_paths) 378s 378s # Commented paths are the one expected to be installed by CMake. For 378s # this reason, corresponding files should NOT be created in the source 378s # tree. 378s for _type, path in select_paths( 378s [ 378s # ('c', 'cmake/__init__.py'), 378s # ('c', 'cmake/cmake.py'), 378s # ('cm', 'cmakeModule.py'), 378s ("h", "hybrid/__init__.py"), 378s # ('h', 'hybrid/hybrid_cmake.dat'), 378s # ('h', 'hybrid/hybrid_cmake.py'), 378s ("h", "hybrid/hybrid_pure.dat"), 378s ("h", "hybrid/hybrid_pure.py"), 378s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 378s ("h", "hybrid/data/hybrid_data_pure.dat"), 378s ("h", "hybrid/hybrid_2/__init__.py"), 378s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 378s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 378s ("p", "hybrid/hybrid_2_pure/__init__.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 378s ("pm", "pureModule.py"), 378s ("p", "pure/__init__.py"), 378s ("p", "pure/pure.py"), 378s ("p", "pure/data/pure.dat"), 378s ] 378s ): 378s assert _type in {"p", "pm", "h"} 378s root = package_base if _type in {"p", "pm"} else cmake_source_dir 378s tmp_dir.ensure(os.path.join(root, path)) 378s 378s # Do not call the real setup function. Instead, replace it with 378s # a MagicMock allowing to check with which arguments it was invoked. 378s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 378s 378s # Convenience print function 378s def _pprint(desc, value=None): 378s print( 378s "-----------------\n" 378s f"{desc}:\n" 378s "\n" 378s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 378s ) 378s 378s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 378s 378s _pprint = ._pprint at 0x3ffb61c7880> 378s cmake_source_dir = '' 378s has_cmake_module = 1 378s has_cmake_package = 0 378s has_hybrid_package = 0 378s has_pure_module = 0 378s has_pure_package = 0 378s mock_setup = 378s mocker = 378s package_base = '' 378s package_base_dir = '' 378s path_types = ('cm',) 378s select_paths = .select_paths at 0x3ffb6029760> 378s src_dir = local('/tmp/pytest-of-ubuntu/pytest-84/test_setup_inputs0') 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-84/test_setup_inputs0') 378s with_package_base = 0 378s 378s tests/test_setup.py:849: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-84/test_setup_inputs0') 378s setup_args = ['build'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-84/test_setup_inputs0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s ________________________ test_setup_inputs[0-0-0-0-1-1] ________________________ 378s 378s has_cmake_package = 1, has_cmake_module = 1, has_hybrid_package = 0 378s has_pure_package = 0, has_pure_module = 0, with_package_base = 0 378s mocker = 378s 378s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 378s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 378s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_module", [0, 1]) 378s @pytest.mark.parametrize("with_package_base", [0, 1]) 378s def test_setup_inputs( 378s has_cmake_package, 378s has_cmake_module, 378s has_hybrid_package, 378s has_pure_package, 378s has_pure_module, 378s with_package_base, 378s mocker, 378s ): 378s """This test that a project can have a package with some modules 378s installed using setup.py and some other modules installed using CMake. 378s """ 378s 378s tmp_dir = _tmpdir("test_setup_inputs") 378s 378s package_base = "to/the/base" if with_package_base else "" 378s package_base_dir = package_base + "/" if package_base else "" 378s cmake_source_dir = package_base 378s 378s if cmake_source_dir and (has_cmake_package or has_cmake_module): 378s pytest.skip( 378s "unsupported configuration: " 378s "python package fully generated by CMake does *NOT* work. " 378s "At least __init__.py should be in the project source tree" 378s ) 378s 378s # ------------------------------------------------------------------------- 378s # Here is the "SOURCE" tree layout: 378s # 378s # ROOT/ 378s # 378s # setup.py 378s # 378s # [/] 378s # 378s # pureModule.py 378s # 378s # pure/ 378s # __init__.py 378s # pure.py 378s # 378s # data/ 378s # pure.dat 378s # 378s # [/] 378s # 378s # hybrid/ 378s # CMakeLists.txt 378s # __init__.py 378s # hybrid_pure.dat 378s # hybrid_pure.py 378s # 378s # data/ 378s # hybrid_data_pure.dat 378s # 378s # hybrid_2/ 378s # __init__.py 378s # hybrid_2_pure.py 378s # 378s # hybrid_2_pure/ 378s # __init__.py 378s # hybrid_2_pure_1.py 378s # hybrid_2_pure_2.py 378s # 378s # 378s # ------------------------------------------------------------------------- 378s # and here is the "BINARY" distribution layout: 378s # 378s # The comment "CMake" or "Setuptools" indicates which tool is responsible 378s # for placing the file in the tree used to create the binary distribution. 378s # 378s # ROOT/ 378s # 378s # cmakeModule.py # CMake 378s # 378s # cmake/ 378s # __init__.py # CMake 378s # cmake.py # CMake 378s # 378s # hybrid/ 378s # hybrid_cmake.dat # CMake 378s # hybrid_cmake.py # CMake 378s # hybrid_pure.dat # Setuptools 378s # hybrid_pure.py # Setuptools 378s # 378s # data/ 378s # hybrid_data_pure.dat # CMake or Setuptools 378s # hybrid_data_cmake.dat # CMake *NO TEST* 378s # 378s # hybrid_2/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure.py # CMake or Setuptools 378s # hybrid_2_cmake.py # CMake 378s # 378s # hybrid_2_pure/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure_1.py # CMake or Setuptools 378s # hybrid_2_pure_2.py # CMake or Setuptools 378s # 378s # pureModule.py # Setuptools 378s # 378s # pure/ 378s # __init__.py # Setuptools 378s # pure.py # Setuptools 378s # 378s # data/ 378s # pure.dat # Setuptools 378s 378s tmp_dir.join("setup.py").write( 378s textwrap.dedent( 378s """ 378s from skbuild import setup 378s #from setuptools import setup 378s setup( 378s name="test_hybrid_project", 378s version="1.2.3", 378s description=("an hybrid package mixing files installed by both " 378s "CMake and setuptools"), 378s author='The scikit-build team', 378s license="MIT", 378s cmake_source_dir='{cmake_source_dir}', 378s cmake_install_dir='{cmake_install_dir}', 378s # Arbitrary order of packages 378s packages=[ 378s {p_off} 'pure', 378s {h_off} 'hybrid.hybrid_2', 378s {h_off} 'hybrid', 378s {c_off} 'cmake', 378s {p_off} 'hybrid.hybrid_2_pure', 378s ], 378s py_modules=[ 378s {pm_off} '{package_base}pureModule', 378s {cm_off} '{package_base}cmakeModule', 378s ], 378s package_data={{ 378s {p_off} 'pure': ['data/pure.dat'], 378s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 378s }}, 378s # Arbitrary order of package_dir 378s package_dir = {{ 378s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 378s {p_off} 'pure': '{package_base}pure', 378s {h_off} 'hybrid': '{package_base}hybrid', 378s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 378s {c_off} 'cmake': '{package_base}cmake', 378s }} 378s ) 378s """.format( 378s cmake_source_dir=cmake_source_dir, 378s cmake_install_dir=package_base, 378s package_base=package_base_dir, 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s p_off="" if has_pure_package else "#", 378s pm_off="" if has_pure_module else "#", 378s ) 378s ) 378s ) 378s 378s src_dir = tmp_dir.ensure(package_base, dir=1) 378s 378s src_dir.join("CMakeLists.txt").write( 378s textwrap.dedent( 378s """ 378s cmake_minimum_required(VERSION 3.5.0) 378s project(hybrid NONE) 378s set(build_dir ${{CMAKE_BINARY_DIR}}) 378s 378s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 378s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 378s {c_off} install( 378s {c_off} FILES 378s {c_off} ${{build_dir}}/__init__.py 378s {c_off} ${{build_dir}}/cmake.py 378s {c_off} DESTINATION cmake 378s {c_off} ) 378s 378s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 378s {cm_off} install( 378s {cm_off} FILES ${{build_dir}}/cmakeModule.py 378s {cm_off} DESTINATION .) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 378s {h_off} DESTINATION hybrid/data) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 378s {h_off} DESTINATION hybrid/hybrid_2) 378s 378s install(CODE "message(STATUS \\\"Installation complete\\\")") 378s """.format( 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s ) 378s ) 378s ) 378s 378s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 378s path_types: Sequence[str] 378s try: 378s path_types = next( 378s iter( 378s zip( 378s *filter( 378s lambda i: i[1], 378s [ 378s ("c", has_cmake_package), 378s ("cm", has_cmake_module), 378s ("h", has_hybrid_package), 378s ("p", has_pure_package), 378s ("pm", has_pure_module), 378s ], 378s ) 378s ) 378s ) 378s ) 378s except StopIteration: 378s path_types = [] 378s 378s def select_paths(annotated_paths): 378s """Return a filtered list paths considering ``path_types``. 378s 378s `annotated_paths`` is list of tuple ``(type, path)`` where type 378s is either `c`, 'cm', `h`, `p` or 'pm'. 378s 378s """ 378s return filter(lambda i: i[0] in path_types, annotated_paths) 378s 378s # Commented paths are the one expected to be installed by CMake. For 378s # this reason, corresponding files should NOT be created in the source 378s # tree. 378s for _type, path in select_paths( 378s [ 378s # ('c', 'cmake/__init__.py'), 378s # ('c', 'cmake/cmake.py'), 378s # ('cm', 'cmakeModule.py'), 378s ("h", "hybrid/__init__.py"), 378s # ('h', 'hybrid/hybrid_cmake.dat'), 378s # ('h', 'hybrid/hybrid_cmake.py'), 378s ("h", "hybrid/hybrid_pure.dat"), 378s ("h", "hybrid/hybrid_pure.py"), 378s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 378s ("h", "hybrid/data/hybrid_data_pure.dat"), 378s ("h", "hybrid/hybrid_2/__init__.py"), 378s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 378s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 378s ("p", "hybrid/hybrid_2_pure/__init__.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 378s ("pm", "pureModule.py"), 378s ("p", "pure/__init__.py"), 378s ("p", "pure/pure.py"), 378s ("p", "pure/data/pure.dat"), 378s ] 378s ): 378s assert _type in {"p", "pm", "h"} 378s root = package_base if _type in {"p", "pm"} else cmake_source_dir 378s tmp_dir.ensure(os.path.join(root, path)) 378s 378s # Do not call the real setup function. Instead, replace it with 378s # a MagicMock allowing to check with which arguments it was invoked. 378s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 378s 378s # Convenience print function 378s def _pprint(desc, value=None): 378s print( 378s "-----------------\n" 378s f"{desc}:\n" 378s "\n" 378s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 378s ) 378s 378s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 378s 378s _pprint = ._pprint at 0x3ffb6028180> 378s cmake_source_dir = '' 378s has_cmake_module = 1 378s has_cmake_package = 1 378s has_hybrid_package = 0 378s has_pure_module = 0 378s has_pure_package = 0 378s mock_setup = 378s mocker = 378s package_base = '' 378s package_base_dir = '' 378s path_types = ('c', 'cm') 378s select_paths = .select_paths at 0x3ffb6029580> 378s src_dir = local('/tmp/pytest-of-ubuntu/pytest-85/test_setup_inputs0') 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-85/test_setup_inputs0') 378s with_package_base = 0 378s 378s tests/test_setup.py:849: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-85/test_setup_inputs0') 378s setup_args = ['build'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-85/test_setup_inputs0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s ________________________ test_setup_inputs[0-0-0-1-0-0] ________________________ 378s 378s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 1 378s has_pure_package = 0, has_pure_module = 0, with_package_base = 0 378s mocker = 378s 378s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 378s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 378s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_module", [0, 1]) 378s @pytest.mark.parametrize("with_package_base", [0, 1]) 378s def test_setup_inputs( 378s has_cmake_package, 378s has_cmake_module, 378s has_hybrid_package, 378s has_pure_package, 378s has_pure_module, 378s with_package_base, 378s mocker, 378s ): 378s """This test that a project can have a package with some modules 378s installed using setup.py and some other modules installed using CMake. 378s """ 378s 378s tmp_dir = _tmpdir("test_setup_inputs") 378s 378s package_base = "to/the/base" if with_package_base else "" 378s package_base_dir = package_base + "/" if package_base else "" 378s cmake_source_dir = package_base 378s 378s if cmake_source_dir and (has_cmake_package or has_cmake_module): 378s pytest.skip( 378s "unsupported configuration: " 378s "python package fully generated by CMake does *NOT* work. " 378s "At least __init__.py should be in the project source tree" 378s ) 378s 378s # ------------------------------------------------------------------------- 378s # Here is the "SOURCE" tree layout: 378s # 378s # ROOT/ 378s # 378s # setup.py 378s # 378s # [/] 378s # 378s # pureModule.py 378s # 378s # pure/ 378s # __init__.py 378s # pure.py 378s # 378s # data/ 378s # pure.dat 378s # 378s # [/] 378s # 378s # hybrid/ 378s # CMakeLists.txt 378s # __init__.py 378s # hybrid_pure.dat 378s # hybrid_pure.py 378s # 378s # data/ 378s # hybrid_data_pure.dat 378s # 378s # hybrid_2/ 378s # __init__.py 378s # hybrid_2_pure.py 378s # 378s # hybrid_2_pure/ 378s # __init__.py 378s # hybrid_2_pure_1.py 378s # hybrid_2_pure_2.py 378s # 378s # 378s # ------------------------------------------------------------------------- 378s # and here is the "BINARY" distribution layout: 378s # 378s # The comment "CMake" or "Setuptools" indicates which tool is responsible 378s # for placing the file in the tree used to create the binary distribution. 378s # 378s # ROOT/ 378s # 378s # cmakeModule.py # CMake 378s # 378s # cmake/ 378s # __init__.py # CMake 378s # cmake.py # CMake 378s # 378s # hybrid/ 378s # hybrid_cmake.dat # CMake 378s # hybrid_cmake.py # CMake 378s # hybrid_pure.dat # Setuptools 378s # hybrid_pure.py # Setuptools 378s # 378s # data/ 378s # hybrid_data_pure.dat # CMake or Setuptools 378s # hybrid_data_cmake.dat # CMake *NO TEST* 378s # 378s # hybrid_2/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure.py # CMake or Setuptools 378s # hybrid_2_cmake.py # CMake 378s # 378s # hybrid_2_pure/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure_1.py # CMake or Setuptools 378s # hybrid_2_pure_2.py # CMake or Setuptools 378s # 378s # pureModule.py # Setuptools 378s # 378s # pure/ 378s # __init__.py # Setuptools 378s # pure.py # Setuptools 378s # 378s # data/ 378s # pure.dat # Setuptools 378s 378s tmp_dir.join("setup.py").write( 378s textwrap.dedent( 378s """ 378s from skbuild import setup 378s #from setuptools import setup 378s setup( 378s name="test_hybrid_project", 378s version="1.2.3", 378s description=("an hybrid package mixing files installed by both " 378s "CMake and setuptools"), 378s author='The scikit-build team', 378s license="MIT", 378s cmake_source_dir='{cmake_source_dir}', 378s cmake_install_dir='{cmake_install_dir}', 378s # Arbitrary order of packages 378s packages=[ 378s {p_off} 'pure', 378s {h_off} 'hybrid.hybrid_2', 378s {h_off} 'hybrid', 378s {c_off} 'cmake', 378s {p_off} 'hybrid.hybrid_2_pure', 378s ], 378s py_modules=[ 378s {pm_off} '{package_base}pureModule', 378s {cm_off} '{package_base}cmakeModule', 378s ], 378s package_data={{ 378s {p_off} 'pure': ['data/pure.dat'], 378s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 378s }}, 378s # Arbitrary order of package_dir 378s package_dir = {{ 378s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 378s {p_off} 'pure': '{package_base}pure', 378s {h_off} 'hybrid': '{package_base}hybrid', 378s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 378s {c_off} 'cmake': '{package_base}cmake', 378s }} 378s ) 378s """.format( 378s cmake_source_dir=cmake_source_dir, 378s cmake_install_dir=package_base, 378s package_base=package_base_dir, 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s p_off="" if has_pure_package else "#", 378s pm_off="" if has_pure_module else "#", 378s ) 378s ) 378s ) 378s 378s src_dir = tmp_dir.ensure(package_base, dir=1) 378s 378s src_dir.join("CMakeLists.txt").write( 378s textwrap.dedent( 378s """ 378s cmake_minimum_required(VERSION 3.5.0) 378s project(hybrid NONE) 378s set(build_dir ${{CMAKE_BINARY_DIR}}) 378s 378s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 378s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 378s {c_off} install( 378s {c_off} FILES 378s {c_off} ${{build_dir}}/__init__.py 378s {c_off} ${{build_dir}}/cmake.py 378s {c_off} DESTINATION cmake 378s {c_off} ) 378s 378s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 378s {cm_off} install( 378s {cm_off} FILES ${{build_dir}}/cmakeModule.py 378s {cm_off} DESTINATION .) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 378s {h_off} DESTINATION hybrid/data) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 378s {h_off} DESTINATION hybrid/hybrid_2) 378s 378s install(CODE "message(STATUS \\\"Installation complete\\\")") 378s """.format( 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s ) 378s ) 378s ) 378s 378s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 378s path_types: Sequence[str] 378s try: 378s path_types = next( 378s iter( 378s zip( 378s *filter( 378s lambda i: i[1], 378s [ 378s ("c", has_cmake_package), 378s ("cm", has_cmake_module), 378s ("h", has_hybrid_package), 378s ("p", has_pure_package), 378s ("pm", has_pure_module), 378s ], 378s ) 378s ) 378s ) 378s ) 378s except StopIteration: 378s path_types = [] 378s 378s def select_paths(annotated_paths): 378s """Return a filtered list paths considering ``path_types``. 378s 378s `annotated_paths`` is list of tuple ``(type, path)`` where type 378s is either `c`, 'cm', `h`, `p` or 'pm'. 378s 378s """ 378s return filter(lambda i: i[0] in path_types, annotated_paths) 378s 378s # Commented paths are the one expected to be installed by CMake. For 378s # this reason, corresponding files should NOT be created in the source 378s # tree. 378s for _type, path in select_paths( 378s [ 378s # ('c', 'cmake/__init__.py'), 378s # ('c', 'cmake/cmake.py'), 378s # ('cm', 'cmakeModule.py'), 378s ("h", "hybrid/__init__.py"), 378s # ('h', 'hybrid/hybrid_cmake.dat'), 378s # ('h', 'hybrid/hybrid_cmake.py'), 378s ("h", "hybrid/hybrid_pure.dat"), 378s ("h", "hybrid/hybrid_pure.py"), 378s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 378s ("h", "hybrid/data/hybrid_data_pure.dat"), 378s ("h", "hybrid/hybrid_2/__init__.py"), 378s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 378s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 378s ("p", "hybrid/hybrid_2_pure/__init__.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 378s ("pm", "pureModule.py"), 378s ("p", "pure/__init__.py"), 378s ("p", "pure/pure.py"), 378s ("p", "pure/data/pure.dat"), 378s ] 378s ): 378s assert _type in {"p", "pm", "h"} 378s root = package_base if _type in {"p", "pm"} else cmake_source_dir 378s tmp_dir.ensure(os.path.join(root, path)) 378s 378s # Do not call the real setup function. Instead, replace it with 378s # a MagicMock allowing to check with which arguments it was invoked. 378s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 378s 378s # Convenience print function 378s def _pprint(desc, value=None): 378s print( 378s "-----------------\n" 378s f"{desc}:\n" 378s "\n" 378s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 378s ) 378s 378s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 378s 378s _pprint = ._pprint at 0x3ffb60289a0> 378s _type = 'h' 378s cmake_source_dir = '' 378s has_cmake_module = 0 378s has_cmake_package = 0 378s has_hybrid_package = 1 378s has_pure_module = 0 378s has_pure_package = 0 378s mock_setup = 378s mocker = 378s package_base = '' 378s package_base_dir = '' 378s path = 'hybrid/hybrid_2/hybrid_2_pure.py' 378s path_types = ('h',) 378s root = '' 378s select_paths = .select_paths at 0x3ffb6028c20> 378s src_dir = local('/tmp/pytest-of-ubuntu/pytest-86/test_setup_inputs0') 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-86/test_setup_inputs0') 378s with_package_base = 0 378s 378s tests/test_setup.py:849: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-86/test_setup_inputs0') 378s setup_args = ['build'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-86/test_setup_inputs0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s ________________________ test_setup_inputs[0-0-0-1-0-1] ________________________ 378s 378s has_cmake_package = 1, has_cmake_module = 0, has_hybrid_package = 1 378s has_pure_package = 0, has_pure_module = 0, with_package_base = 0 378s mocker = 378s 378s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 378s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 378s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_module", [0, 1]) 378s @pytest.mark.parametrize("with_package_base", [0, 1]) 378s def test_setup_inputs( 378s has_cmake_package, 378s has_cmake_module, 378s has_hybrid_package, 378s has_pure_package, 378s has_pure_module, 378s with_package_base, 378s mocker, 378s ): 378s """This test that a project can have a package with some modules 378s installed using setup.py and some other modules installed using CMake. 378s """ 378s 378s tmp_dir = _tmpdir("test_setup_inputs") 378s 378s package_base = "to/the/base" if with_package_base else "" 378s package_base_dir = package_base + "/" if package_base else "" 378s cmake_source_dir = package_base 378s 378s if cmake_source_dir and (has_cmake_package or has_cmake_module): 378s pytest.skip( 378s "unsupported configuration: " 378s "python package fully generated by CMake does *NOT* work. " 378s "At least __init__.py should be in the project source tree" 378s ) 378s 378s # ------------------------------------------------------------------------- 378s # Here is the "SOURCE" tree layout: 378s # 378s # ROOT/ 378s # 378s # setup.py 378s # 378s # [/] 378s # 378s # pureModule.py 378s # 378s # pure/ 378s # __init__.py 378s # pure.py 378s # 378s # data/ 378s # pure.dat 378s # 378s # [/] 378s # 378s # hybrid/ 378s # CMakeLists.txt 378s # __init__.py 378s # hybrid_pure.dat 378s # hybrid_pure.py 378s # 378s # data/ 378s # hybrid_data_pure.dat 378s # 378s # hybrid_2/ 378s # __init__.py 378s # hybrid_2_pure.py 378s # 378s # hybrid_2_pure/ 378s # __init__.py 378s # hybrid_2_pure_1.py 378s # hybrid_2_pure_2.py 378s # 378s # 378s # ------------------------------------------------------------------------- 378s # and here is the "BINARY" distribution layout: 378s # 378s # The comment "CMake" or "Setuptools" indicates which tool is responsible 378s # for placing the file in the tree used to create the binary distribution. 378s # 378s # ROOT/ 378s # 378s # cmakeModule.py # CMake 378s # 378s # cmake/ 378s # __init__.py # CMake 378s # cmake.py # CMake 378s # 378s # hybrid/ 378s # hybrid_cmake.dat # CMake 378s # hybrid_cmake.py # CMake 378s # hybrid_pure.dat # Setuptools 378s # hybrid_pure.py # Setuptools 378s # 378s # data/ 378s # hybrid_data_pure.dat # CMake or Setuptools 378s # hybrid_data_cmake.dat # CMake *NO TEST* 378s # 378s # hybrid_2/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure.py # CMake or Setuptools 378s # hybrid_2_cmake.py # CMake 378s # 378s # hybrid_2_pure/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure_1.py # CMake or Setuptools 378s # hybrid_2_pure_2.py # CMake or Setuptools 378s # 378s # pureModule.py # Setuptools 378s # 378s # pure/ 378s # __init__.py # Setuptools 378s # pure.py # Setuptools 378s # 378s # data/ 378s # pure.dat # Setuptools 378s 378s tmp_dir.join("setup.py").write( 378s textwrap.dedent( 378s """ 378s from skbuild import setup 378s #from setuptools import setup 378s setup( 378s name="test_hybrid_project", 378s version="1.2.3", 378s description=("an hybrid package mixing files installed by both " 378s "CMake and setuptools"), 378s author='The scikit-build team', 378s license="MIT", 378s cmake_source_dir='{cmake_source_dir}', 378s cmake_install_dir='{cmake_install_dir}', 378s # Arbitrary order of packages 378s packages=[ 378s {p_off} 'pure', 378s {h_off} 'hybrid.hybrid_2', 378s {h_off} 'hybrid', 378s {c_off} 'cmake', 378s {p_off} 'hybrid.hybrid_2_pure', 378s ], 378s py_modules=[ 378s {pm_off} '{package_base}pureModule', 378s {cm_off} '{package_base}cmakeModule', 378s ], 378s package_data={{ 378s {p_off} 'pure': ['data/pure.dat'], 378s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 378s }}, 378s # Arbitrary order of package_dir 378s package_dir = {{ 378s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 378s {p_off} 'pure': '{package_base}pure', 378s {h_off} 'hybrid': '{package_base}hybrid', 378s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 378s {c_off} 'cmake': '{package_base}cmake', 378s }} 378s ) 378s """.format( 378s cmake_source_dir=cmake_source_dir, 378s cmake_install_dir=package_base, 378s package_base=package_base_dir, 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s p_off="" if has_pure_package else "#", 378s pm_off="" if has_pure_module else "#", 378s ) 378s ) 378s ) 378s 378s src_dir = tmp_dir.ensure(package_base, dir=1) 378s 378s src_dir.join("CMakeLists.txt").write( 378s textwrap.dedent( 378s """ 378s cmake_minimum_required(VERSION 3.5.0) 378s project(hybrid NONE) 378s set(build_dir ${{CMAKE_BINARY_DIR}}) 378s 378s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 378s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 378s {c_off} install( 378s {c_off} FILES 378s {c_off} ${{build_dir}}/__init__.py 378s {c_off} ${{build_dir}}/cmake.py 378s {c_off} DESTINATION cmake 378s {c_off} ) 378s 378s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 378s {cm_off} install( 378s {cm_off} FILES ${{build_dir}}/cmakeModule.py 378s {cm_off} DESTINATION .) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 378s {h_off} DESTINATION hybrid/data) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 378s {h_off} DESTINATION hybrid/hybrid_2) 378s 378s install(CODE "message(STATUS \\\"Installation complete\\\")") 378s """.format( 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s ) 378s ) 378s ) 378s 378s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 378s path_types: Sequence[str] 378s try: 378s path_types = next( 378s iter( 378s zip( 378s *filter( 378s lambda i: i[1], 378s [ 378s ("c", has_cmake_package), 378s ("cm", has_cmake_module), 378s ("h", has_hybrid_package), 378s ("p", has_pure_package), 378s ("pm", has_pure_module), 378s ], 378s ) 378s ) 378s ) 378s ) 378s except StopIteration: 378s path_types = [] 378s 378s def select_paths(annotated_paths): 378s """Return a filtered list paths considering ``path_types``. 378s 378s `annotated_paths`` is list of tuple ``(type, path)`` where type 378s is either `c`, 'cm', `h`, `p` or 'pm'. 378s 378s """ 378s return filter(lambda i: i[0] in path_types, annotated_paths) 378s 378s # Commented paths are the one expected to be installed by CMake. For 378s # this reason, corresponding files should NOT be created in the source 378s # tree. 378s for _type, path in select_paths( 378s [ 378s # ('c', 'cmake/__init__.py'), 378s # ('c', 'cmake/cmake.py'), 378s # ('cm', 'cmakeModule.py'), 378s ("h", "hybrid/__init__.py"), 378s # ('h', 'hybrid/hybrid_cmake.dat'), 378s # ('h', 'hybrid/hybrid_cmake.py'), 378s ("h", "hybrid/hybrid_pure.dat"), 378s ("h", "hybrid/hybrid_pure.py"), 378s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 378s ("h", "hybrid/data/hybrid_data_pure.dat"), 378s ("h", "hybrid/hybrid_2/__init__.py"), 378s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 378s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 378s ("p", "hybrid/hybrid_2_pure/__init__.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 378s ("pm", "pureModule.py"), 378s ("p", "pure/__init__.py"), 378s ("p", "pure/pure.py"), 378s ("p", "pure/data/pure.dat"), 378s ] 378s ): 378s assert _type in {"p", "pm", "h"} 378s root = package_base if _type in {"p", "pm"} else cmake_source_dir 378s tmp_dir.ensure(os.path.join(root, path)) 378s 378s # Do not call the real setup function. Instead, replace it with 378s # a MagicMock allowing to check with which arguments it was invoked. 378s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 378s 378s # Convenience print function 378s def _pprint(desc, value=None): 378s print( 378s "-----------------\n" 378s f"{desc}:\n" 378s "\n" 378s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 378s ) 378s 378s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 378s 378s _pprint = ._pprint at 0x3ffb61c4720> 378s _type = 'h' 378s cmake_source_dir = '' 378s has_cmake_module = 0 378s has_cmake_package = 1 378s has_hybrid_package = 1 378s has_pure_module = 0 378s has_pure_package = 0 378s mock_setup = 378s mocker = 378s package_base = '' 378s package_base_dir = '' 378s path = 'hybrid/hybrid_2/hybrid_2_pure.py' 378s path_types = ('c', 'h') 378s root = '' 378s select_paths = .select_paths at 0x3ffb61c6c00> 378s src_dir = local('/tmp/pytest-of-ubuntu/pytest-87/test_setup_inputs0') 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-87/test_setup_inputs0') 378s with_package_base = 0 378s 378s tests/test_setup.py:849: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-87/test_setup_inputs0') 378s setup_args = ['build'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-87/test_setup_inputs0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s ________________________ test_setup_inputs[0-0-0-1-1-0] ________________________ 378s 378s has_cmake_package = 0, has_cmake_module = 1, has_hybrid_package = 1 378s has_pure_package = 0, has_pure_module = 0, with_package_base = 0 378s mocker = 378s 378s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 378s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 378s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_module", [0, 1]) 378s @pytest.mark.parametrize("with_package_base", [0, 1]) 378s def test_setup_inputs( 378s has_cmake_package, 378s has_cmake_module, 378s has_hybrid_package, 378s has_pure_package, 378s has_pure_module, 378s with_package_base, 378s mocker, 378s ): 378s """This test that a project can have a package with some modules 378s installed using setup.py and some other modules installed using CMake. 378s """ 378s 378s tmp_dir = _tmpdir("test_setup_inputs") 378s 378s package_base = "to/the/base" if with_package_base else "" 378s package_base_dir = package_base + "/" if package_base else "" 378s cmake_source_dir = package_base 378s 378s if cmake_source_dir and (has_cmake_package or has_cmake_module): 378s pytest.skip( 378s "unsupported configuration: " 378s "python package fully generated by CMake does *NOT* work. " 378s "At least __init__.py should be in the project source tree" 378s ) 378s 378s # ------------------------------------------------------------------------- 378s # Here is the "SOURCE" tree layout: 378s # 378s # ROOT/ 378s # 378s # setup.py 378s # 378s # [/] 378s # 378s # pureModule.py 378s # 378s # pure/ 378s # __init__.py 378s # pure.py 378s # 378s # data/ 378s # pure.dat 378s # 378s # [/] 378s # 378s # hybrid/ 378s # CMakeLists.txt 378s # __init__.py 378s # hybrid_pure.dat 378s # hybrid_pure.py 378s # 378s # data/ 378s # hybrid_data_pure.dat 378s # 378s # hybrid_2/ 378s # __init__.py 378s # hybrid_2_pure.py 378s # 378s # hybrid_2_pure/ 378s # __init__.py 378s # hybrid_2_pure_1.py 378s # hybrid_2_pure_2.py 378s # 378s # 378s # ------------------------------------------------------------------------- 378s # and here is the "BINARY" distribution layout: 378s # 378s # The comment "CMake" or "Setuptools" indicates which tool is responsible 378s # for placing the file in the tree used to create the binary distribution. 378s # 378s # ROOT/ 378s # 378s # cmakeModule.py # CMake 378s # 378s # cmake/ 378s # __init__.py # CMake 378s # cmake.py # CMake 378s # 378s # hybrid/ 378s # hybrid_cmake.dat # CMake 378s # hybrid_cmake.py # CMake 378s # hybrid_pure.dat # Setuptools 378s # hybrid_pure.py # Setuptools 378s # 378s # data/ 378s # hybrid_data_pure.dat # CMake or Setuptools 378s # hybrid_data_cmake.dat # CMake *NO TEST* 378s # 378s # hybrid_2/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure.py # CMake or Setuptools 378s # hybrid_2_cmake.py # CMake 378s # 378s # hybrid_2_pure/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure_1.py # CMake or Setuptools 378s # hybrid_2_pure_2.py # CMake or Setuptools 378s # 378s # pureModule.py # Setuptools 378s # 378s # pure/ 378s # __init__.py # Setuptools 378s # pure.py # Setuptools 378s # 378s # data/ 378s # pure.dat # Setuptools 378s 378s tmp_dir.join("setup.py").write( 378s textwrap.dedent( 378s """ 378s from skbuild import setup 378s #from setuptools import setup 378s setup( 378s name="test_hybrid_project", 378s version="1.2.3", 378s description=("an hybrid package mixing files installed by both " 378s "CMake and setuptools"), 378s author='The scikit-build team', 378s license="MIT", 378s cmake_source_dir='{cmake_source_dir}', 378s cmake_install_dir='{cmake_install_dir}', 378s # Arbitrary order of packages 378s packages=[ 378s {p_off} 'pure', 378s {h_off} 'hybrid.hybrid_2', 378s {h_off} 'hybrid', 378s {c_off} 'cmake', 378s {p_off} 'hybrid.hybrid_2_pure', 378s ], 378s py_modules=[ 378s {pm_off} '{package_base}pureModule', 378s {cm_off} '{package_base}cmakeModule', 378s ], 378s package_data={{ 378s {p_off} 'pure': ['data/pure.dat'], 378s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 378s }}, 378s # Arbitrary order of package_dir 378s package_dir = {{ 378s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 378s {p_off} 'pure': '{package_base}pure', 378s {h_off} 'hybrid': '{package_base}hybrid', 378s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 378s {c_off} 'cmake': '{package_base}cmake', 378s }} 378s ) 378s """.format( 378s cmake_source_dir=cmake_source_dir, 378s cmake_install_dir=package_base, 378s package_base=package_base_dir, 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s p_off="" if has_pure_package else "#", 378s pm_off="" if has_pure_module else "#", 378s ) 378s ) 378s ) 378s 378s src_dir = tmp_dir.ensure(package_base, dir=1) 378s 378s src_dir.join("CMakeLists.txt").write( 378s textwrap.dedent( 378s """ 378s cmake_minimum_required(VERSION 3.5.0) 378s project(hybrid NONE) 378s set(build_dir ${{CMAKE_BINARY_DIR}}) 378s 378s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 378s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 378s {c_off} install( 378s {c_off} FILES 378s {c_off} ${{build_dir}}/__init__.py 378s {c_off} ${{build_dir}}/cmake.py 378s {c_off} DESTINATION cmake 378s {c_off} ) 378s 378s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 378s {cm_off} install( 378s {cm_off} FILES ${{build_dir}}/cmakeModule.py 378s {cm_off} DESTINATION .) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 378s {h_off} DESTINATION hybrid/data) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 378s {h_off} DESTINATION hybrid/hybrid_2) 378s 378s install(CODE "message(STATUS \\\"Installation complete\\\")") 378s """.format( 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s ) 378s ) 378s ) 378s 378s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 378s path_types: Sequence[str] 378s try: 378s path_types = next( 378s iter( 378s zip( 378s *filter( 378s lambda i: i[1], 378s [ 378s ("c", has_cmake_package), 378s ("cm", has_cmake_module), 378s ("h", has_hybrid_package), 378s ("p", has_pure_package), 378s ("pm", has_pure_module), 378s ], 378s ) 378s ) 378s ) 378s ) 378s except StopIteration: 378s path_types = [] 378s 378s def select_paths(annotated_paths): 378s """Return a filtered list paths considering ``path_types``. 378s 378s `annotated_paths`` is list of tuple ``(type, path)`` where type 378s is either `c`, 'cm', `h`, `p` or 'pm'. 378s 378s """ 378s return filter(lambda i: i[0] in path_types, annotated_paths) 378s 378s # Commented paths are the one expected to be installed by CMake. For 378s # this reason, corresponding files should NOT be created in the source 378s # tree. 378s for _type, path in select_paths( 378s [ 378s # ('c', 'cmake/__init__.py'), 378s # ('c', 'cmake/cmake.py'), 378s # ('cm', 'cmakeModule.py'), 378s ("h", "hybrid/__init__.py"), 378s # ('h', 'hybrid/hybrid_cmake.dat'), 378s # ('h', 'hybrid/hybrid_cmake.py'), 378s ("h", "hybrid/hybrid_pure.dat"), 378s ("h", "hybrid/hybrid_pure.py"), 378s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 378s ("h", "hybrid/data/hybrid_data_pure.dat"), 378s ("h", "hybrid/hybrid_2/__init__.py"), 378s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 378s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 378s ("p", "hybrid/hybrid_2_pure/__init__.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 378s ("pm", "pureModule.py"), 378s ("p", "pure/__init__.py"), 378s ("p", "pure/pure.py"), 378s ("p", "pure/data/pure.dat"), 378s ] 378s ): 378s assert _type in {"p", "pm", "h"} 378s root = package_base if _type in {"p", "pm"} else cmake_source_dir 378s tmp_dir.ensure(os.path.join(root, path)) 378s 378s # Do not call the real setup function. Instead, replace it with 378s # a MagicMock allowing to check with which arguments it was invoked. 378s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 378s 378s # Convenience print function 378s def _pprint(desc, value=None): 378s print( 378s "-----------------\n" 378s f"{desc}:\n" 378s "\n" 378s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 378s ) 378s 378s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 378s 378s _pprint = ._pprint at 0x3ffb6029bc0> 378s _type = 'h' 378s cmake_source_dir = '' 378s has_cmake_module = 1 378s has_cmake_package = 0 378s has_hybrid_package = 1 378s has_pure_module = 0 378s has_pure_package = 0 378s mock_setup = 378s mocker = 378s package_base = '' 378s package_base_dir = '' 378s path = 'hybrid/hybrid_2/hybrid_2_pure.py' 378s path_types = ('cm', 'h') 378s root = '' 378s select_paths = .select_paths at 0x3ffb602a340> 378s src_dir = local('/tmp/pytest-of-ubuntu/pytest-88/test_setup_inputs0') 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-88/test_setup_inputs0') 378s with_package_base = 0 378s 378s tests/test_setup.py:849: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-88/test_setup_inputs0') 378s setup_args = ['build'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-88/test_setup_inputs0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s ________________________ test_setup_inputs[0-0-0-1-1-1] ________________________ 378s 378s has_cmake_package = 1, has_cmake_module = 1, has_hybrid_package = 1 378s has_pure_package = 0, has_pure_module = 0, with_package_base = 0 378s mocker = 378s 378s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 378s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 378s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_module", [0, 1]) 378s @pytest.mark.parametrize("with_package_base", [0, 1]) 378s def test_setup_inputs( 378s has_cmake_package, 378s has_cmake_module, 378s has_hybrid_package, 378s has_pure_package, 378s has_pure_module, 378s with_package_base, 378s mocker, 378s ): 378s """This test that a project can have a package with some modules 378s installed using setup.py and some other modules installed using CMake. 378s """ 378s 378s tmp_dir = _tmpdir("test_setup_inputs") 378s 378s package_base = "to/the/base" if with_package_base else "" 378s package_base_dir = package_base + "/" if package_base else "" 378s cmake_source_dir = package_base 378s 378s if cmake_source_dir and (has_cmake_package or has_cmake_module): 378s pytest.skip( 378s "unsupported configuration: " 378s "python package fully generated by CMake does *NOT* work. " 378s "At least __init__.py should be in the project source tree" 378s ) 378s 378s # ------------------------------------------------------------------------- 378s # Here is the "SOURCE" tree layout: 378s # 378s # ROOT/ 378s # 378s # setup.py 378s # 378s # [/] 378s # 378s # pureModule.py 378s # 378s # pure/ 378s # __init__.py 378s # pure.py 378s # 378s # data/ 378s # pure.dat 378s # 378s # [/] 378s # 378s # hybrid/ 378s # CMakeLists.txt 378s # __init__.py 378s # hybrid_pure.dat 378s # hybrid_pure.py 378s # 378s # data/ 378s # hybrid_data_pure.dat 378s # 378s # hybrid_2/ 378s # __init__.py 378s # hybrid_2_pure.py 378s # 378s # hybrid_2_pure/ 378s # __init__.py 378s # hybrid_2_pure_1.py 378s # hybrid_2_pure_2.py 378s # 378s # 378s # ------------------------------------------------------------------------- 378s # and here is the "BINARY" distribution layout: 378s # 378s # The comment "CMake" or "Setuptools" indicates which tool is responsible 378s # for placing the file in the tree used to create the binary distribution. 378s # 378s # ROOT/ 378s # 378s # cmakeModule.py # CMake 378s # 378s # cmake/ 378s # __init__.py # CMake 378s # cmake.py # CMake 378s # 378s # hybrid/ 378s # hybrid_cmake.dat # CMake 378s # hybrid_cmake.py # CMake 378s # hybrid_pure.dat # Setuptools 378s # hybrid_pure.py # Setuptools 378s # 378s # data/ 378s # hybrid_data_pure.dat # CMake or Setuptools 378s # hybrid_data_cmake.dat # CMake *NO TEST* 378s # 378s # hybrid_2/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure.py # CMake or Setuptools 378s # hybrid_2_cmake.py # CMake 378s # 378s # hybrid_2_pure/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure_1.py # CMake or Setuptools 378s # hybrid_2_pure_2.py # CMake or Setuptools 378s # 378s # pureModule.py # Setuptools 378s # 378s # pure/ 378s # __init__.py # Setuptools 378s # pure.py # Setuptools 378s # 378s # data/ 378s # pure.dat # Setuptools 378s 378s tmp_dir.join("setup.py").write( 378s textwrap.dedent( 378s """ 378s from skbuild import setup 378s #from setuptools import setup 378s setup( 378s name="test_hybrid_project", 378s version="1.2.3", 378s description=("an hybrid package mixing files installed by both " 378s "CMake and setuptools"), 378s author='The scikit-build team', 378s license="MIT", 378s cmake_source_dir='{cmake_source_dir}', 378s cmake_install_dir='{cmake_install_dir}', 378s # Arbitrary order of packages 378s packages=[ 378s {p_off} 'pure', 378s {h_off} 'hybrid.hybrid_2', 378s {h_off} 'hybrid', 378s {c_off} 'cmake', 378s {p_off} 'hybrid.hybrid_2_pure', 378s ], 378s py_modules=[ 378s {pm_off} '{package_base}pureModule', 378s {cm_off} '{package_base}cmakeModule', 378s ], 378s package_data={{ 378s {p_off} 'pure': ['data/pure.dat'], 378s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 378s }}, 378s # Arbitrary order of package_dir 378s package_dir = {{ 378s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 378s {p_off} 'pure': '{package_base}pure', 378s {h_off} 'hybrid': '{package_base}hybrid', 378s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 378s {c_off} 'cmake': '{package_base}cmake', 378s }} 378s ) 378s """.format( 378s cmake_source_dir=cmake_source_dir, 378s cmake_install_dir=package_base, 378s package_base=package_base_dir, 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s p_off="" if has_pure_package else "#", 378s pm_off="" if has_pure_module else "#", 378s ) 378s ) 378s ) 378s 378s src_dir = tmp_dir.ensure(package_base, dir=1) 378s 378s src_dir.join("CMakeLists.txt").write( 378s textwrap.dedent( 378s """ 378s cmake_minimum_required(VERSION 3.5.0) 378s project(hybrid NONE) 378s set(build_dir ${{CMAKE_BINARY_DIR}}) 378s 378s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 378s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 378s {c_off} install( 378s {c_off} FILES 378s {c_off} ${{build_dir}}/__init__.py 378s {c_off} ${{build_dir}}/cmake.py 378s {c_off} DESTINATION cmake 378s {c_off} ) 378s 378s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 378s {cm_off} install( 378s {cm_off} FILES ${{build_dir}}/cmakeModule.py 378s {cm_off} DESTINATION .) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 378s {h_off} DESTINATION hybrid/data) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 378s {h_off} DESTINATION hybrid/hybrid_2) 378s 378s install(CODE "message(STATUS \\\"Installation complete\\\")") 378s """.format( 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s ) 378s ) 378s ) 378s 378s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 378s path_types: Sequence[str] 378s try: 378s path_types = next( 378s iter( 378s zip( 378s *filter( 378s lambda i: i[1], 378s [ 378s ("c", has_cmake_package), 378s ("cm", has_cmake_module), 378s ("h", has_hybrid_package), 378s ("p", has_pure_package), 378s ("pm", has_pure_module), 378s ], 378s ) 378s ) 378s ) 378s ) 378s except StopIteration: 378s path_types = [] 378s 378s def select_paths(annotated_paths): 378s """Return a filtered list paths considering ``path_types``. 378s 378s `annotated_paths`` is list of tuple ``(type, path)`` where type 378s is either `c`, 'cm', `h`, `p` or 'pm'. 378s 378s """ 378s return filter(lambda i: i[0] in path_types, annotated_paths) 378s 378s # Commented paths are the one expected to be installed by CMake. For 378s # this reason, corresponding files should NOT be created in the source 378s # tree. 378s for _type, path in select_paths( 378s [ 378s # ('c', 'cmake/__init__.py'), 378s # ('c', 'cmake/cmake.py'), 378s # ('cm', 'cmakeModule.py'), 378s ("h", "hybrid/__init__.py"), 378s # ('h', 'hybrid/hybrid_cmake.dat'), 378s # ('h', 'hybrid/hybrid_cmake.py'), 378s ("h", "hybrid/hybrid_pure.dat"), 378s ("h", "hybrid/hybrid_pure.py"), 378s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 378s ("h", "hybrid/data/hybrid_data_pure.dat"), 378s ("h", "hybrid/hybrid_2/__init__.py"), 378s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 378s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 378s ("p", "hybrid/hybrid_2_pure/__init__.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 378s ("pm", "pureModule.py"), 378s ("p", "pure/__init__.py"), 378s ("p", "pure/pure.py"), 378s ("p", "pure/data/pure.dat"), 378s ] 378s ): 378s assert _type in {"p", "pm", "h"} 378s root = package_base if _type in {"p", "pm"} else cmake_source_dir 378s tmp_dir.ensure(os.path.join(root, path)) 378s 378s # Do not call the real setup function. Instead, replace it with 378s # a MagicMock allowing to check with which arguments it was invoked. 378s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 378s 378s # Convenience print function 378s def _pprint(desc, value=None): 378s print( 378s "-----------------\n" 378s f"{desc}:\n" 378s "\n" 378s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 378s ) 378s 378s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 378s 378s _pprint = ._pprint at 0x3ffb60284a0> 378s _type = 'h' 378s cmake_source_dir = '' 378s has_cmake_module = 1 378s has_cmake_package = 1 378s has_hybrid_package = 1 378s has_pure_module = 0 378s has_pure_package = 0 378s mock_setup = 378s mocker = 378s package_base = '' 378s package_base_dir = '' 378s path = 'hybrid/hybrid_2/hybrid_2_pure.py' 378s path_types = ('c', 'cm', 'h') 378s root = '' 378s select_paths = .select_paths at 0x3ffb6029ee0> 378s src_dir = local('/tmp/pytest-of-ubuntu/pytest-89/test_setup_inputs0') 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-89/test_setup_inputs0') 378s with_package_base = 0 378s 378s tests/test_setup.py:849: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-89/test_setup_inputs0') 378s setup_args = ['build'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-89/test_setup_inputs0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s ________________________ test_setup_inputs[0-0-1-0-0-0] ________________________ 378s 378s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 0 378s has_pure_package = 1, has_pure_module = 0, with_package_base = 0 378s mocker = 378s 378s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 378s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 378s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_module", [0, 1]) 378s @pytest.mark.parametrize("with_package_base", [0, 1]) 378s def test_setup_inputs( 378s has_cmake_package, 378s has_cmake_module, 378s has_hybrid_package, 378s has_pure_package, 378s has_pure_module, 378s with_package_base, 378s mocker, 378s ): 378s """This test that a project can have a package with some modules 378s installed using setup.py and some other modules installed using CMake. 378s """ 378s 378s tmp_dir = _tmpdir("test_setup_inputs") 378s 378s package_base = "to/the/base" if with_package_base else "" 378s package_base_dir = package_base + "/" if package_base else "" 378s cmake_source_dir = package_base 378s 378s if cmake_source_dir and (has_cmake_package or has_cmake_module): 378s pytest.skip( 378s "unsupported configuration: " 378s "python package fully generated by CMake does *NOT* work. " 378s "At least __init__.py should be in the project source tree" 378s ) 378s 378s # ------------------------------------------------------------------------- 378s # Here is the "SOURCE" tree layout: 378s # 378s # ROOT/ 378s # 378s # setup.py 378s # 378s # [/] 378s # 378s # pureModule.py 378s # 378s # pure/ 378s # __init__.py 378s # pure.py 378s # 378s # data/ 378s # pure.dat 378s # 378s # [/] 378s # 378s # hybrid/ 378s # CMakeLists.txt 378s # __init__.py 378s # hybrid_pure.dat 378s # hybrid_pure.py 378s # 378s # data/ 378s # hybrid_data_pure.dat 378s # 378s # hybrid_2/ 378s # __init__.py 378s # hybrid_2_pure.py 378s # 378s # hybrid_2_pure/ 378s # __init__.py 378s # hybrid_2_pure_1.py 378s # hybrid_2_pure_2.py 378s # 378s # 378s # ------------------------------------------------------------------------- 378s # and here is the "BINARY" distribution layout: 378s # 378s # The comment "CMake" or "Setuptools" indicates which tool is responsible 378s # for placing the file in the tree used to create the binary distribution. 378s # 378s # ROOT/ 378s # 378s # cmakeModule.py # CMake 378s # 378s # cmake/ 378s # __init__.py # CMake 378s # cmake.py # CMake 378s # 378s # hybrid/ 378s # hybrid_cmake.dat # CMake 378s # hybrid_cmake.py # CMake 378s # hybrid_pure.dat # Setuptools 378s # hybrid_pure.py # Setuptools 378s # 378s # data/ 378s # hybrid_data_pure.dat # CMake or Setuptools 378s # hybrid_data_cmake.dat # CMake *NO TEST* 378s # 378s # hybrid_2/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure.py # CMake or Setuptools 378s # hybrid_2_cmake.py # CMake 378s # 378s # hybrid_2_pure/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure_1.py # CMake or Setuptools 378s # hybrid_2_pure_2.py # CMake or Setuptools 378s # 378s # pureModule.py # Setuptools 378s # 378s # pure/ 378s # __init__.py # Setuptools 378s # pure.py # Setuptools 378s # 378s # data/ 378s # pure.dat # Setuptools 378s 378s tmp_dir.join("setup.py").write( 378s textwrap.dedent( 378s """ 378s from skbuild import setup 378s #from setuptools import setup 378s setup( 378s name="test_hybrid_project", 378s version="1.2.3", 378s description=("an hybrid package mixing files installed by both " 378s "CMake and setuptools"), 378s author='The scikit-build team', 378s license="MIT", 378s cmake_source_dir='{cmake_source_dir}', 378s cmake_install_dir='{cmake_install_dir}', 378s # Arbitrary order of packages 378s packages=[ 378s {p_off} 'pure', 378s {h_off} 'hybrid.hybrid_2', 378s {h_off} 'hybrid', 378s {c_off} 'cmake', 378s {p_off} 'hybrid.hybrid_2_pure', 378s ], 378s py_modules=[ 378s {pm_off} '{package_base}pureModule', 378s {cm_off} '{package_base}cmakeModule', 378s ], 378s package_data={{ 378s {p_off} 'pure': ['data/pure.dat'], 378s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 378s }}, 378s # Arbitrary order of package_dir 378s package_dir = {{ 378s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 378s {p_off} 'pure': '{package_base}pure', 378s {h_off} 'hybrid': '{package_base}hybrid', 378s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 378s {c_off} 'cmake': '{package_base}cmake', 378s }} 378s ) 378s """.format( 378s cmake_source_dir=cmake_source_dir, 378s cmake_install_dir=package_base, 378s package_base=package_base_dir, 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s p_off="" if has_pure_package else "#", 378s pm_off="" if has_pure_module else "#", 378s ) 378s ) 378s ) 378s 378s src_dir = tmp_dir.ensure(package_base, dir=1) 378s 378s src_dir.join("CMakeLists.txt").write( 378s textwrap.dedent( 378s """ 378s cmake_minimum_required(VERSION 3.5.0) 378s project(hybrid NONE) 378s set(build_dir ${{CMAKE_BINARY_DIR}}) 378s 378s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 378s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 378s {c_off} install( 378s {c_off} FILES 378s {c_off} ${{build_dir}}/__init__.py 378s {c_off} ${{build_dir}}/cmake.py 378s {c_off} DESTINATION cmake 378s {c_off} ) 378s 378s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 378s {cm_off} install( 378s {cm_off} FILES ${{build_dir}}/cmakeModule.py 378s {cm_off} DESTINATION .) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 378s {h_off} DESTINATION hybrid/data) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 378s {h_off} DESTINATION hybrid/hybrid_2) 378s 378s install(CODE "message(STATUS \\\"Installation complete\\\")") 378s """.format( 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s ) 378s ) 378s ) 378s 378s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 378s path_types: Sequence[str] 378s try: 378s path_types = next( 378s iter( 378s zip( 378s *filter( 378s lambda i: i[1], 378s [ 378s ("c", has_cmake_package), 378s ("cm", has_cmake_module), 378s ("h", has_hybrid_package), 378s ("p", has_pure_package), 378s ("pm", has_pure_module), 378s ], 378s ) 378s ) 378s ) 378s ) 378s except StopIteration: 378s path_types = [] 378s 378s def select_paths(annotated_paths): 378s """Return a filtered list paths considering ``path_types``. 378s 378s `annotated_paths`` is list of tuple ``(type, path)`` where type 378s is either `c`, 'cm', `h`, `p` or 'pm'. 378s 378s """ 378s return filter(lambda i: i[0] in path_types, annotated_paths) 378s 378s # Commented paths are the one expected to be installed by CMake. For 378s # this reason, corresponding files should NOT be created in the source 378s # tree. 378s for _type, path in select_paths( 378s [ 378s # ('c', 'cmake/__init__.py'), 378s # ('c', 'cmake/cmake.py'), 378s # ('cm', 'cmakeModule.py'), 378s ("h", "hybrid/__init__.py"), 378s # ('h', 'hybrid/hybrid_cmake.dat'), 378s # ('h', 'hybrid/hybrid_cmake.py'), 378s ("h", "hybrid/hybrid_pure.dat"), 378s ("h", "hybrid/hybrid_pure.py"), 378s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 378s ("h", "hybrid/data/hybrid_data_pure.dat"), 378s ("h", "hybrid/hybrid_2/__init__.py"), 378s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 378s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 378s ("p", "hybrid/hybrid_2_pure/__init__.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 378s ("pm", "pureModule.py"), 378s ("p", "pure/__init__.py"), 378s ("p", "pure/pure.py"), 378s ("p", "pure/data/pure.dat"), 378s ] 378s ): 378s assert _type in {"p", "pm", "h"} 378s root = package_base if _type in {"p", "pm"} else cmake_source_dir 378s tmp_dir.ensure(os.path.join(root, path)) 378s 378s # Do not call the real setup function. Instead, replace it with 378s # a MagicMock allowing to check with which arguments it was invoked. 378s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 378s 378s # Convenience print function 378s def _pprint(desc, value=None): 378s print( 378s "-----------------\n" 378s f"{desc}:\n" 378s "\n" 378s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 378s ) 378s 378s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 378s 378s _pprint = ._pprint at 0x3ffb6028ea0> 378s _type = 'p' 378s cmake_source_dir = '' 378s has_cmake_module = 0 378s has_cmake_package = 0 378s has_hybrid_package = 0 378s has_pure_module = 0 378s has_pure_package = 1 378s mock_setup = 378s mocker = 378s package_base = '' 378s package_base_dir = '' 378s path = 'pure/data/pure.dat' 378s path_types = ('p',) 378s root = '' 378s select_paths = .select_paths at 0x3ffb60296c0> 378s src_dir = local('/tmp/pytest-of-ubuntu/pytest-90/test_setup_inputs0') 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-90/test_setup_inputs0') 378s with_package_base = 0 378s 378s tests/test_setup.py:849: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-90/test_setup_inputs0') 378s setup_args = ['build'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-90/test_setup_inputs0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s ________________________ test_setup_inputs[0-0-1-0-0-1] ________________________ 378s 378s has_cmake_package = 1, has_cmake_module = 0, has_hybrid_package = 0 378s has_pure_package = 1, has_pure_module = 0, with_package_base = 0 378s mocker = 378s 378s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 378s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 378s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_module", [0, 1]) 378s @pytest.mark.parametrize("with_package_base", [0, 1]) 378s def test_setup_inputs( 378s has_cmake_package, 378s has_cmake_module, 378s has_hybrid_package, 378s has_pure_package, 378s has_pure_module, 378s with_package_base, 378s mocker, 378s ): 378s """This test that a project can have a package with some modules 378s installed using setup.py and some other modules installed using CMake. 378s """ 378s 378s tmp_dir = _tmpdir("test_setup_inputs") 378s 378s package_base = "to/the/base" if with_package_base else "" 378s package_base_dir = package_base + "/" if package_base else "" 378s cmake_source_dir = package_base 378s 378s if cmake_source_dir and (has_cmake_package or has_cmake_module): 378s pytest.skip( 378s "unsupported configuration: " 378s "python package fully generated by CMake does *NOT* work. " 378s "At least __init__.py should be in the project source tree" 378s ) 378s 378s # ------------------------------------------------------------------------- 378s # Here is the "SOURCE" tree layout: 378s # 378s # ROOT/ 378s # 378s # setup.py 378s # 378s # [/] 378s # 378s # pureModule.py 378s # 378s # pure/ 378s # __init__.py 378s # pure.py 378s # 378s # data/ 378s # pure.dat 378s # 378s # [/] 378s # 378s # hybrid/ 378s # CMakeLists.txt 378s # __init__.py 378s # hybrid_pure.dat 378s # hybrid_pure.py 378s # 378s # data/ 378s # hybrid_data_pure.dat 378s # 378s # hybrid_2/ 378s # __init__.py 378s # hybrid_2_pure.py 378s # 378s # hybrid_2_pure/ 378s # __init__.py 378s # hybrid_2_pure_1.py 378s # hybrid_2_pure_2.py 378s # 378s # 378s # ------------------------------------------------------------------------- 378s # and here is the "BINARY" distribution layout: 378s # 378s # The comment "CMake" or "Setuptools" indicates which tool is responsible 378s # for placing the file in the tree used to create the binary distribution. 378s # 378s # ROOT/ 378s # 378s # cmakeModule.py # CMake 378s # 378s # cmake/ 378s # __init__.py # CMake 378s # cmake.py # CMake 378s # 378s # hybrid/ 378s # hybrid_cmake.dat # CMake 378s # hybrid_cmake.py # CMake 378s # hybrid_pure.dat # Setuptools 378s # hybrid_pure.py # Setuptools 378s # 378s # data/ 378s # hybrid_data_pure.dat # CMake or Setuptools 378s # hybrid_data_cmake.dat # CMake *NO TEST* 378s # 378s # hybrid_2/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure.py # CMake or Setuptools 378s # hybrid_2_cmake.py # CMake 378s # 378s # hybrid_2_pure/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure_1.py # CMake or Setuptools 378s # hybrid_2_pure_2.py # CMake or Setuptools 378s # 378s # pureModule.py # Setuptools 378s # 378s # pure/ 378s # __init__.py # Setuptools 378s # pure.py # Setuptools 378s # 378s # data/ 378s # pure.dat # Setuptools 378s 378s tmp_dir.join("setup.py").write( 378s textwrap.dedent( 378s """ 378s from skbuild import setup 378s #from setuptools import setup 378s setup( 378s name="test_hybrid_project", 378s version="1.2.3", 378s description=("an hybrid package mixing files installed by both " 378s "CMake and setuptools"), 378s author='The scikit-build team', 378s license="MIT", 378s cmake_source_dir='{cmake_source_dir}', 378s cmake_install_dir='{cmake_install_dir}', 378s # Arbitrary order of packages 378s packages=[ 378s {p_off} 'pure', 378s {h_off} 'hybrid.hybrid_2', 378s {h_off} 'hybrid', 378s {c_off} 'cmake', 378s {p_off} 'hybrid.hybrid_2_pure', 378s ], 378s py_modules=[ 378s {pm_off} '{package_base}pureModule', 378s {cm_off} '{package_base}cmakeModule', 378s ], 378s package_data={{ 378s {p_off} 'pure': ['data/pure.dat'], 378s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 378s }}, 378s # Arbitrary order of package_dir 378s package_dir = {{ 378s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 378s {p_off} 'pure': '{package_base}pure', 378s {h_off} 'hybrid': '{package_base}hybrid', 378s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 378s {c_off} 'cmake': '{package_base}cmake', 378s }} 378s ) 378s """.format( 378s cmake_source_dir=cmake_source_dir, 378s cmake_install_dir=package_base, 378s package_base=package_base_dir, 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s p_off="" if has_pure_package else "#", 378s pm_off="" if has_pure_module else "#", 378s ) 378s ) 378s ) 378s 378s src_dir = tmp_dir.ensure(package_base, dir=1) 378s 378s src_dir.join("CMakeLists.txt").write( 378s textwrap.dedent( 378s """ 378s cmake_minimum_required(VERSION 3.5.0) 378s project(hybrid NONE) 378s set(build_dir ${{CMAKE_BINARY_DIR}}) 378s 378s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 378s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 378s {c_off} install( 378s {c_off} FILES 378s {c_off} ${{build_dir}}/__init__.py 378s {c_off} ${{build_dir}}/cmake.py 378s {c_off} DESTINATION cmake 378s {c_off} ) 378s 378s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 378s {cm_off} install( 378s {cm_off} FILES ${{build_dir}}/cmakeModule.py 378s {cm_off} DESTINATION .) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 378s {h_off} DESTINATION hybrid/data) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 378s {h_off} DESTINATION hybrid/hybrid_2) 378s 378s install(CODE "message(STATUS \\\"Installation complete\\\")") 378s """.format( 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s ) 378s ) 378s ) 378s 378s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 378s path_types: Sequence[str] 378s try: 378s path_types = next( 378s iter( 378s zip( 378s *filter( 378s lambda i: i[1], 378s [ 378s ("c", has_cmake_package), 378s ("cm", has_cmake_module), 378s ("h", has_hybrid_package), 378s ("p", has_pure_package), 378s ("pm", has_pure_module), 378s ], 378s ) 378s ) 378s ) 378s ) 378s except StopIteration: 378s path_types = [] 378s 378s def select_paths(annotated_paths): 378s """Return a filtered list paths considering ``path_types``. 378s 378s `annotated_paths`` is list of tuple ``(type, path)`` where type 378s is either `c`, 'cm', `h`, `p` or 'pm'. 378s 378s """ 378s return filter(lambda i: i[0] in path_types, annotated_paths) 378s 378s # Commented paths are the one expected to be installed by CMake. For 378s # this reason, corresponding files should NOT be created in the source 378s # tree. 378s for _type, path in select_paths( 378s [ 378s # ('c', 'cmake/__init__.py'), 378s # ('c', 'cmake/cmake.py'), 378s # ('cm', 'cmakeModule.py'), 378s ("h", "hybrid/__init__.py"), 378s # ('h', 'hybrid/hybrid_cmake.dat'), 378s # ('h', 'hybrid/hybrid_cmake.py'), 378s ("h", "hybrid/hybrid_pure.dat"), 378s ("h", "hybrid/hybrid_pure.py"), 378s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 378s ("h", "hybrid/data/hybrid_data_pure.dat"), 378s ("h", "hybrid/hybrid_2/__init__.py"), 378s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 378s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 378s ("p", "hybrid/hybrid_2_pure/__init__.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 378s ("pm", "pureModule.py"), 378s ("p", "pure/__init__.py"), 378s ("p", "pure/pure.py"), 378s ("p", "pure/data/pure.dat"), 378s ] 378s ): 378s assert _type in {"p", "pm", "h"} 378s root = package_base if _type in {"p", "pm"} else cmake_source_dir 378s tmp_dir.ensure(os.path.join(root, path)) 378s 378s # Do not call the real setup function. Instead, replace it with 378s # a MagicMock allowing to check with which arguments it was invoked. 378s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 378s 378s # Convenience print function 378s def _pprint(desc, value=None): 378s print( 378s "-----------------\n" 378s f"{desc}:\n" 378s "\n" 378s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 378s ) 378s 378s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 378s 378s _pprint = ._pprint at 0x3ffb602a160> 378s _type = 'p' 378s cmake_source_dir = '' 378s has_cmake_module = 0 378s has_cmake_package = 1 378s has_hybrid_package = 0 378s has_pure_module = 0 378s has_pure_package = 1 378s mock_setup = 378s mocker = 378s package_base = '' 378s package_base_dir = '' 378s path = 'pure/data/pure.dat' 378s path_types = ('c', 'p') 378s root = '' 378s select_paths = .select_paths at 0x3ffb61c58a0> 378s src_dir = local('/tmp/pytest-of-ubuntu/pytest-91/test_setup_inputs0') 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-91/test_setup_inputs0') 378s with_package_base = 0 378s 378s tests/test_setup.py:849: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-91/test_setup_inputs0') 378s setup_args = ['build'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-91/test_setup_inputs0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s ________________________ test_setup_inputs[0-0-1-0-1-0] ________________________ 378s 378s has_cmake_package = 0, has_cmake_module = 1, has_hybrid_package = 0 378s has_pure_package = 1, has_pure_module = 0, with_package_base = 0 378s mocker = 378s 378s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 378s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 378s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_module", [0, 1]) 378s @pytest.mark.parametrize("with_package_base", [0, 1]) 378s def test_setup_inputs( 378s has_cmake_package, 378s has_cmake_module, 378s has_hybrid_package, 378s has_pure_package, 378s has_pure_module, 378s with_package_base, 378s mocker, 378s ): 378s """This test that a project can have a package with some modules 378s installed using setup.py and some other modules installed using CMake. 378s """ 378s 378s tmp_dir = _tmpdir("test_setup_inputs") 378s 378s package_base = "to/the/base" if with_package_base else "" 378s package_base_dir = package_base + "/" if package_base else "" 378s cmake_source_dir = package_base 378s 378s if cmake_source_dir and (has_cmake_package or has_cmake_module): 378s pytest.skip( 378s "unsupported configuration: " 378s "python package fully generated by CMake does *NOT* work. " 378s "At least __init__.py should be in the project source tree" 378s ) 378s 378s # ------------------------------------------------------------------------- 378s # Here is the "SOURCE" tree layout: 378s # 378s # ROOT/ 378s # 378s # setup.py 378s # 378s # [/] 378s # 378s # pureModule.py 378s # 378s # pure/ 378s # __init__.py 378s # pure.py 378s # 378s # data/ 378s # pure.dat 378s # 378s # [/] 378s # 378s # hybrid/ 378s # CMakeLists.txt 378s # __init__.py 378s # hybrid_pure.dat 378s # hybrid_pure.py 378s # 378s # data/ 378s # hybrid_data_pure.dat 378s # 378s # hybrid_2/ 378s # __init__.py 378s # hybrid_2_pure.py 378s # 378s # hybrid_2_pure/ 378s # __init__.py 378s # hybrid_2_pure_1.py 378s # hybrid_2_pure_2.py 378s # 378s # 378s # ------------------------------------------------------------------------- 378s # and here is the "BINARY" distribution layout: 378s # 378s # The comment "CMake" or "Setuptools" indicates which tool is responsible 378s # for placing the file in the tree used to create the binary distribution. 378s # 378s # ROOT/ 378s # 378s # cmakeModule.py # CMake 378s # 378s # cmake/ 378s # __init__.py # CMake 378s # cmake.py # CMake 378s # 378s # hybrid/ 378s # hybrid_cmake.dat # CMake 378s # hybrid_cmake.py # CMake 378s # hybrid_pure.dat # Setuptools 378s # hybrid_pure.py # Setuptools 378s # 378s # data/ 378s # hybrid_data_pure.dat # CMake or Setuptools 378s # hybrid_data_cmake.dat # CMake *NO TEST* 378s # 378s # hybrid_2/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure.py # CMake or Setuptools 378s # hybrid_2_cmake.py # CMake 378s # 378s # hybrid_2_pure/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure_1.py # CMake or Setuptools 378s # hybrid_2_pure_2.py # CMake or Setuptools 378s # 378s # pureModule.py # Setuptools 378s # 378s # pure/ 378s # __init__.py # Setuptools 378s # pure.py # Setuptools 378s # 378s # data/ 378s # pure.dat # Setuptools 378s 378s tmp_dir.join("setup.py").write( 378s textwrap.dedent( 378s """ 378s from skbuild import setup 378s #from setuptools import setup 378s setup( 378s name="test_hybrid_project", 378s version="1.2.3", 378s description=("an hybrid package mixing files installed by both " 378s "CMake and setuptools"), 378s author='The scikit-build team', 378s license="MIT", 378s cmake_source_dir='{cmake_source_dir}', 378s cmake_install_dir='{cmake_install_dir}', 378s # Arbitrary order of packages 378s packages=[ 378s {p_off} 'pure', 378s {h_off} 'hybrid.hybrid_2', 378s {h_off} 'hybrid', 378s {c_off} 'cmake', 378s {p_off} 'hybrid.hybrid_2_pure', 378s ], 378s py_modules=[ 378s {pm_off} '{package_base}pureModule', 378s {cm_off} '{package_base}cmakeModule', 378s ], 378s package_data={{ 378s {p_off} 'pure': ['data/pure.dat'], 378s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 378s }}, 378s # Arbitrary order of package_dir 378s package_dir = {{ 378s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 378s {p_off} 'pure': '{package_base}pure', 378s {h_off} 'hybrid': '{package_base}hybrid', 378s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 378s {c_off} 'cmake': '{package_base}cmake', 378s }} 378s ) 378s """.format( 378s cmake_source_dir=cmake_source_dir, 378s cmake_install_dir=package_base, 378s package_base=package_base_dir, 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s p_off="" if has_pure_package else "#", 378s pm_off="" if has_pure_module else "#", 378s ) 378s ) 378s ) 378s 378s src_dir = tmp_dir.ensure(package_base, dir=1) 378s 378s src_dir.join("CMakeLists.txt").write( 378s textwrap.dedent( 378s """ 378s cmake_minimum_required(VERSION 3.5.0) 378s project(hybrid NONE) 378s set(build_dir ${{CMAKE_BINARY_DIR}}) 378s 378s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 378s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 378s {c_off} install( 378s {c_off} FILES 378s {c_off} ${{build_dir}}/__init__.py 378s {c_off} ${{build_dir}}/cmake.py 378s {c_off} DESTINATION cmake 378s {c_off} ) 378s 378s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 378s {cm_off} install( 378s {cm_off} FILES ${{build_dir}}/cmakeModule.py 378s {cm_off} DESTINATION .) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 378s {h_off} DESTINATION hybrid/data) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 378s {h_off} DESTINATION hybrid/hybrid_2) 378s 378s install(CODE "message(STATUS \\\"Installation complete\\\")") 378s """.format( 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s ) 378s ) 378s ) 378s 378s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 378s path_types: Sequence[str] 378s try: 378s path_types = next( 378s iter( 378s zip( 378s *filter( 378s lambda i: i[1], 378s [ 378s ("c", has_cmake_package), 378s ("cm", has_cmake_module), 378s ("h", has_hybrid_package), 378s ("p", has_pure_package), 378s ("pm", has_pure_module), 378s ], 378s ) 378s ) 378s ) 378s ) 378s except StopIteration: 378s path_types = [] 378s 378s def select_paths(annotated_paths): 378s """Return a filtered list paths considering ``path_types``. 378s 378s `annotated_paths`` is list of tuple ``(type, path)`` where type 378s is either `c`, 'cm', `h`, `p` or 'pm'. 378s 378s """ 378s return filter(lambda i: i[0] in path_types, annotated_paths) 378s 378s # Commented paths are the one expected to be installed by CMake. For 378s # this reason, corresponding files should NOT be created in the source 378s # tree. 378s for _type, path in select_paths( 378s [ 378s # ('c', 'cmake/__init__.py'), 378s # ('c', 'cmake/cmake.py'), 378s # ('cm', 'cmakeModule.py'), 378s ("h", "hybrid/__init__.py"), 378s # ('h', 'hybrid/hybrid_cmake.dat'), 378s # ('h', 'hybrid/hybrid_cmake.py'), 378s ("h", "hybrid/hybrid_pure.dat"), 378s ("h", "hybrid/hybrid_pure.py"), 378s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 378s ("h", "hybrid/data/hybrid_data_pure.dat"), 378s ("h", "hybrid/hybrid_2/__init__.py"), 378s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 378s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 378s ("p", "hybrid/hybrid_2_pure/__init__.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 378s ("pm", "pureModule.py"), 378s ("p", "pure/__init__.py"), 378s ("p", "pure/pure.py"), 378s ("p", "pure/data/pure.dat"), 378s ] 378s ): 378s assert _type in {"p", "pm", "h"} 378s root = package_base if _type in {"p", "pm"} else cmake_source_dir 378s tmp_dir.ensure(os.path.join(root, path)) 378s 378s # Do not call the real setup function. Instead, replace it with 378s # a MagicMock allowing to check with which arguments it was invoked. 378s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 378s 378s # Convenience print function 378s def _pprint(desc, value=None): 378s print( 378s "-----------------\n" 378s f"{desc}:\n" 378s "\n" 378s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 378s ) 378s 378s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 378s 378s _pprint = ._pprint at 0x3ffb602a700> 378s _type = 'p' 378s cmake_source_dir = '' 378s has_cmake_module = 1 378s has_cmake_package = 0 378s has_hybrid_package = 0 378s has_pure_module = 0 378s has_pure_package = 1 378s mock_setup = 378s mocker = 378s package_base = '' 378s package_base_dir = '' 378s path = 'pure/data/pure.dat' 378s path_types = ('cm', 'p') 378s root = '' 378s select_paths = .select_paths at 0x3ffb602a480> 378s src_dir = local('/tmp/pytest-of-ubuntu/pytest-92/test_setup_inputs0') 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-92/test_setup_inputs0') 378s with_package_base = 0 378s 378s tests/test_setup.py:849: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-92/test_setup_inputs0') 378s setup_args = ['build'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-92/test_setup_inputs0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s ________________________ test_setup_inputs[0-0-1-0-1-1] ________________________ 378s 378s has_cmake_package = 1, has_cmake_module = 1, has_hybrid_package = 0 378s has_pure_package = 1, has_pure_module = 0, with_package_base = 0 378s mocker = 378s 378s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 378s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 378s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_module", [0, 1]) 378s @pytest.mark.parametrize("with_package_base", [0, 1]) 378s def test_setup_inputs( 378s has_cmake_package, 378s has_cmake_module, 378s has_hybrid_package, 378s has_pure_package, 378s has_pure_module, 378s with_package_base, 378s mocker, 378s ): 378s """This test that a project can have a package with some modules 378s installed using setup.py and some other modules installed using CMake. 378s """ 378s 378s tmp_dir = _tmpdir("test_setup_inputs") 378s 378s package_base = "to/the/base" if with_package_base else "" 378s package_base_dir = package_base + "/" if package_base else "" 378s cmake_source_dir = package_base 378s 378s if cmake_source_dir and (has_cmake_package or has_cmake_module): 378s pytest.skip( 378s "unsupported configuration: " 378s "python package fully generated by CMake does *NOT* work. " 378s "At least __init__.py should be in the project source tree" 378s ) 378s 378s # ------------------------------------------------------------------------- 378s # Here is the "SOURCE" tree layout: 378s # 378s # ROOT/ 378s # 378s # setup.py 378s # 378s # [/] 378s # 378s # pureModule.py 378s # 378s # pure/ 378s # __init__.py 378s # pure.py 378s # 378s # data/ 378s # pure.dat 378s # 378s # [/] 378s # 378s # hybrid/ 378s # CMakeLists.txt 378s # __init__.py 378s # hybrid_pure.dat 378s # hybrid_pure.py 378s # 378s # data/ 378s # hybrid_data_pure.dat 378s # 378s # hybrid_2/ 378s # __init__.py 378s # hybrid_2_pure.py 378s # 378s # hybrid_2_pure/ 378s # __init__.py 378s # hybrid_2_pure_1.py 378s # hybrid_2_pure_2.py 378s # 378s # 378s # ------------------------------------------------------------------------- 378s # and here is the "BINARY" distribution layout: 378s # 378s # The comment "CMake" or "Setuptools" indicates which tool is responsible 378s # for placing the file in the tree used to create the binary distribution. 378s # 378s # ROOT/ 378s # 378s # cmakeModule.py # CMake 378s # 378s # cmake/ 378s # __init__.py # CMake 378s # cmake.py # CMake 378s # 378s # hybrid/ 378s # hybrid_cmake.dat # CMake 378s # hybrid_cmake.py # CMake 378s # hybrid_pure.dat # Setuptools 378s # hybrid_pure.py # Setuptools 378s # 378s # data/ 378s # hybrid_data_pure.dat # CMake or Setuptools 378s # hybrid_data_cmake.dat # CMake *NO TEST* 378s # 378s # hybrid_2/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure.py # CMake or Setuptools 378s # hybrid_2_cmake.py # CMake 378s # 378s # hybrid_2_pure/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure_1.py # CMake or Setuptools 378s # hybrid_2_pure_2.py # CMake or Setuptools 378s # 378s # pureModule.py # Setuptools 378s # 378s # pure/ 378s # __init__.py # Setuptools 378s # pure.py # Setuptools 378s # 378s # data/ 378s # pure.dat # Setuptools 378s 378s tmp_dir.join("setup.py").write( 378s textwrap.dedent( 378s """ 378s from skbuild import setup 378s #from setuptools import setup 378s setup( 378s name="test_hybrid_project", 378s version="1.2.3", 378s description=("an hybrid package mixing files installed by both " 378s "CMake and setuptools"), 378s author='The scikit-build team', 378s license="MIT", 378s cmake_source_dir='{cmake_source_dir}', 378s cmake_install_dir='{cmake_install_dir}', 378s # Arbitrary order of packages 378s packages=[ 378s {p_off} 'pure', 378s {h_off} 'hybrid.hybrid_2', 378s {h_off} 'hybrid', 378s {c_off} 'cmake', 378s {p_off} 'hybrid.hybrid_2_pure', 378s ], 378s py_modules=[ 378s {pm_off} '{package_base}pureModule', 378s {cm_off} '{package_base}cmakeModule', 378s ], 378s package_data={{ 378s {p_off} 'pure': ['data/pure.dat'], 378s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 378s }}, 378s # Arbitrary order of package_dir 378s package_dir = {{ 378s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 378s {p_off} 'pure': '{package_base}pure', 378s {h_off} 'hybrid': '{package_base}hybrid', 378s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 378s {c_off} 'cmake': '{package_base}cmake', 378s }} 378s ) 378s """.format( 378s cmake_source_dir=cmake_source_dir, 378s cmake_install_dir=package_base, 378s package_base=package_base_dir, 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s p_off="" if has_pure_package else "#", 378s pm_off="" if has_pure_module else "#", 378s ) 378s ) 378s ) 378s 378s src_dir = tmp_dir.ensure(package_base, dir=1) 378s 378s src_dir.join("CMakeLists.txt").write( 378s textwrap.dedent( 378s """ 378s cmake_minimum_required(VERSION 3.5.0) 378s project(hybrid NONE) 378s set(build_dir ${{CMAKE_BINARY_DIR}}) 378s 378s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 378s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 378s {c_off} install( 378s {c_off} FILES 378s {c_off} ${{build_dir}}/__init__.py 378s {c_off} ${{build_dir}}/cmake.py 378s {c_off} DESTINATION cmake 378s {c_off} ) 378s 378s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 378s {cm_off} install( 378s {cm_off} FILES ${{build_dir}}/cmakeModule.py 378s {cm_off} DESTINATION .) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 378s {h_off} DESTINATION hybrid/data) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 378s {h_off} DESTINATION hybrid/hybrid_2) 378s 378s install(CODE "message(STATUS \\\"Installation complete\\\")") 378s """.format( 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s ) 378s ) 378s ) 378s 378s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 378s path_types: Sequence[str] 378s try: 378s path_types = next( 378s iter( 378s zip( 378s *filter( 378s lambda i: i[1], 378s [ 378s ("c", has_cmake_package), 378s ("cm", has_cmake_module), 378s ("h", has_hybrid_package), 378s ("p", has_pure_package), 378s ("pm", has_pure_module), 378s ], 378s ) 378s ) 378s ) 378s ) 378s except StopIteration: 378s path_types = [] 378s 378s def select_paths(annotated_paths): 378s """Return a filtered list paths considering ``path_types``. 378s 378s `annotated_paths`` is list of tuple ``(type, path)`` where type 378s is either `c`, 'cm', `h`, `p` or 'pm'. 378s 378s """ 378s return filter(lambda i: i[0] in path_types, annotated_paths) 378s 378s # Commented paths are the one expected to be installed by CMake. For 378s # this reason, corresponding files should NOT be created in the source 378s # tree. 378s for _type, path in select_paths( 378s [ 378s # ('c', 'cmake/__init__.py'), 378s # ('c', 'cmake/cmake.py'), 378s # ('cm', 'cmakeModule.py'), 378s ("h", "hybrid/__init__.py"), 378s # ('h', 'hybrid/hybrid_cmake.dat'), 378s # ('h', 'hybrid/hybrid_cmake.py'), 378s ("h", "hybrid/hybrid_pure.dat"), 378s ("h", "hybrid/hybrid_pure.py"), 378s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 378s ("h", "hybrid/data/hybrid_data_pure.dat"), 378s ("h", "hybrid/hybrid_2/__init__.py"), 378s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 378s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 378s ("p", "hybrid/hybrid_2_pure/__init__.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 378s ("pm", "pureModule.py"), 378s ("p", "pure/__init__.py"), 378s ("p", "pure/pure.py"), 378s ("p", "pure/data/pure.dat"), 378s ] 378s ): 378s assert _type in {"p", "pm", "h"} 378s root = package_base if _type in {"p", "pm"} else cmake_source_dir 378s tmp_dir.ensure(os.path.join(root, path)) 378s 378s # Do not call the real setup function. Instead, replace it with 378s # a MagicMock allowing to check with which arguments it was invoked. 378s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 378s 378s # Convenience print function 378s def _pprint(desc, value=None): 378s print( 378s "-----------------\n" 378s f"{desc}:\n" 378s "\n" 378s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 378s ) 378s 378s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 378s 378s _pprint = ._pprint at 0x3ffb602aca0> 378s _type = 'p' 378s cmake_source_dir = '' 378s has_cmake_module = 1 378s has_cmake_package = 1 378s has_hybrid_package = 0 378s has_pure_module = 0 378s has_pure_package = 1 378s mock_setup = 378s mocker = 378s package_base = '' 378s package_base_dir = '' 378s path = 'pure/data/pure.dat' 378s path_types = ('c', 'cm', 'p') 378s root = '' 378s select_paths = .select_paths at 0x3ffb602aac0> 378s src_dir = local('/tmp/pytest-of-ubuntu/pytest-93/test_setup_inputs0') 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-93/test_setup_inputs0') 378s with_package_base = 0 378s 378s tests/test_setup.py:849: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-93/test_setup_inputs0') 378s setup_args = ['build'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-93/test_setup_inputs0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s ________________________ test_setup_inputs[0-0-1-1-0-0] ________________________ 378s 378s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 1 378s has_pure_package = 1, has_pure_module = 0, with_package_base = 0 378s mocker = 378s 378s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 378s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 378s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_module", [0, 1]) 378s @pytest.mark.parametrize("with_package_base", [0, 1]) 378s def test_setup_inputs( 378s has_cmake_package, 378s has_cmake_module, 378s has_hybrid_package, 378s has_pure_package, 378s has_pure_module, 378s with_package_base, 378s mocker, 378s ): 378s """This test that a project can have a package with some modules 378s installed using setup.py and some other modules installed using CMake. 378s """ 378s 378s tmp_dir = _tmpdir("test_setup_inputs") 378s 378s package_base = "to/the/base" if with_package_base else "" 378s package_base_dir = package_base + "/" if package_base else "" 378s cmake_source_dir = package_base 378s 378s if cmake_source_dir and (has_cmake_package or has_cmake_module): 378s pytest.skip( 378s "unsupported configuration: " 378s "python package fully generated by CMake does *NOT* work. " 378s "At least __init__.py should be in the project source tree" 378s ) 378s 378s # ------------------------------------------------------------------------- 378s # Here is the "SOURCE" tree layout: 378s # 378s # ROOT/ 378s # 378s # setup.py 378s # 378s # [/] 378s # 378s # pureModule.py 378s # 378s # pure/ 378s # __init__.py 378s # pure.py 378s # 378s # data/ 378s # pure.dat 378s # 378s # [/] 378s # 378s # hybrid/ 378s # CMakeLists.txt 378s # __init__.py 378s # hybrid_pure.dat 378s # hybrid_pure.py 378s # 378s # data/ 378s # hybrid_data_pure.dat 378s # 378s # hybrid_2/ 378s # __init__.py 378s # hybrid_2_pure.py 378s # 378s # hybrid_2_pure/ 378s # __init__.py 378s # hybrid_2_pure_1.py 378s # hybrid_2_pure_2.py 378s # 378s # 378s # ------------------------------------------------------------------------- 378s # and here is the "BINARY" distribution layout: 378s # 378s # The comment "CMake" or "Setuptools" indicates which tool is responsible 378s # for placing the file in the tree used to create the binary distribution. 378s # 378s # ROOT/ 378s # 378s # cmakeModule.py # CMake 378s # 378s # cmake/ 378s # __init__.py # CMake 378s # cmake.py # CMake 378s # 378s # hybrid/ 378s # hybrid_cmake.dat # CMake 378s # hybrid_cmake.py # CMake 378s # hybrid_pure.dat # Setuptools 378s # hybrid_pure.py # Setuptools 378s # 378s # data/ 378s # hybrid_data_pure.dat # CMake or Setuptools 378s # hybrid_data_cmake.dat # CMake *NO TEST* 378s # 378s # hybrid_2/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure.py # CMake or Setuptools 378s # hybrid_2_cmake.py # CMake 378s # 378s # hybrid_2_pure/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure_1.py # CMake or Setuptools 378s # hybrid_2_pure_2.py # CMake or Setuptools 378s # 378s # pureModule.py # Setuptools 378s # 378s # pure/ 378s # __init__.py # Setuptools 378s # pure.py # Setuptools 378s # 378s # data/ 378s # pure.dat # Setuptools 378s 378s tmp_dir.join("setup.py").write( 378s textwrap.dedent( 378s """ 378s from skbuild import setup 378s #from setuptools import setup 378s setup( 378s name="test_hybrid_project", 378s version="1.2.3", 378s description=("an hybrid package mixing files installed by both " 378s "CMake and setuptools"), 378s author='The scikit-build team', 378s license="MIT", 378s cmake_source_dir='{cmake_source_dir}', 378s cmake_install_dir='{cmake_install_dir}', 378s # Arbitrary order of packages 378s packages=[ 378s {p_off} 'pure', 378s {h_off} 'hybrid.hybrid_2', 378s {h_off} 'hybrid', 378s {c_off} 'cmake', 378s {p_off} 'hybrid.hybrid_2_pure', 378s ], 378s py_modules=[ 378s {pm_off} '{package_base}pureModule', 378s {cm_off} '{package_base}cmakeModule', 378s ], 378s package_data={{ 378s {p_off} 'pure': ['data/pure.dat'], 378s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 378s }}, 378s # Arbitrary order of package_dir 378s package_dir = {{ 378s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 378s {p_off} 'pure': '{package_base}pure', 378s {h_off} 'hybrid': '{package_base}hybrid', 378s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 378s {c_off} 'cmake': '{package_base}cmake', 378s }} 378s ) 378s """.format( 378s cmake_source_dir=cmake_source_dir, 378s cmake_install_dir=package_base, 378s package_base=package_base_dir, 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s p_off="" if has_pure_package else "#", 378s pm_off="" if has_pure_module else "#", 378s ) 378s ) 378s ) 378s 378s src_dir = tmp_dir.ensure(package_base, dir=1) 378s 378s src_dir.join("CMakeLists.txt").write( 378s textwrap.dedent( 378s """ 378s cmake_minimum_required(VERSION 3.5.0) 378s project(hybrid NONE) 378s set(build_dir ${{CMAKE_BINARY_DIR}}) 378s 378s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 378s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 378s {c_off} install( 378s {c_off} FILES 378s {c_off} ${{build_dir}}/__init__.py 378s {c_off} ${{build_dir}}/cmake.py 378s {c_off} DESTINATION cmake 378s {c_off} ) 378s 378s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 378s {cm_off} install( 378s {cm_off} FILES ${{build_dir}}/cmakeModule.py 378s {cm_off} DESTINATION .) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 378s {h_off} DESTINATION hybrid/data) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 378s {h_off} DESTINATION hybrid/hybrid_2) 378s 378s install(CODE "message(STATUS \\\"Installation complete\\\")") 378s """.format( 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s ) 378s ) 378s ) 378s 378s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 378s path_types: Sequence[str] 378s try: 378s path_types = next( 378s iter( 378s zip( 378s *filter( 378s lambda i: i[1], 378s [ 378s ("c", has_cmake_package), 378s ("cm", has_cmake_module), 378s ("h", has_hybrid_package), 378s ("p", has_pure_package), 378s ("pm", has_pure_module), 378s ], 378s ) 378s ) 378s ) 378s ) 378s except StopIteration: 378s path_types = [] 378s 378s def select_paths(annotated_paths): 378s """Return a filtered list paths considering ``path_types``. 378s 378s `annotated_paths`` is list of tuple ``(type, path)`` where type 378s is either `c`, 'cm', `h`, `p` or 'pm'. 378s 378s """ 378s return filter(lambda i: i[0] in path_types, annotated_paths) 378s 378s # Commented paths are the one expected to be installed by CMake. For 378s # this reason, corresponding files should NOT be created in the source 378s # tree. 378s for _type, path in select_paths( 378s [ 378s # ('c', 'cmake/__init__.py'), 378s # ('c', 'cmake/cmake.py'), 378s # ('cm', 'cmakeModule.py'), 378s ("h", "hybrid/__init__.py"), 378s # ('h', 'hybrid/hybrid_cmake.dat'), 378s # ('h', 'hybrid/hybrid_cmake.py'), 378s ("h", "hybrid/hybrid_pure.dat"), 378s ("h", "hybrid/hybrid_pure.py"), 378s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 378s ("h", "hybrid/data/hybrid_data_pure.dat"), 378s ("h", "hybrid/hybrid_2/__init__.py"), 378s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 378s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 378s ("p", "hybrid/hybrid_2_pure/__init__.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 378s ("pm", "pureModule.py"), 378s ("p", "pure/__init__.py"), 378s ("p", "pure/pure.py"), 378s ("p", "pure/data/pure.dat"), 378s ] 378s ): 378s assert _type in {"p", "pm", "h"} 378s root = package_base if _type in {"p", "pm"} else cmake_source_dir 378s tmp_dir.ensure(os.path.join(root, path)) 378s 378s # Do not call the real setup function. Instead, replace it with 378s # a MagicMock allowing to check with which arguments it was invoked. 378s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 378s 378s # Convenience print function 378s def _pprint(desc, value=None): 378s print( 378s "-----------------\n" 378s f"{desc}:\n" 378s "\n" 378s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 378s ) 378s 378s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 378s 378s _pprint = ._pprint at 0x3ffb6029da0> 378s _type = 'p' 378s cmake_source_dir = '' 378s has_cmake_module = 0 378s has_cmake_package = 0 378s has_hybrid_package = 1 378s has_pure_module = 0 378s has_pure_package = 1 378s mock_setup = 378s mocker = 378s package_base = '' 378s package_base_dir = '' 378s path = 'pure/data/pure.dat' 378s path_types = ('h', 'p') 378s root = '' 378s select_paths = .select_paths at 0x3ffb602a0c0> 378s src_dir = local('/tmp/pytest-of-ubuntu/pytest-94/test_setup_inputs0') 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-94/test_setup_inputs0') 378s with_package_base = 0 378s 378s tests/test_setup.py:849: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-94/test_setup_inputs0') 378s setup_args = ['build'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-94/test_setup_inputs0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s ________________________ test_setup_inputs[0-0-1-1-0-1] ________________________ 378s 378s has_cmake_package = 1, has_cmake_module = 0, has_hybrid_package = 1 378s has_pure_package = 1, has_pure_module = 0, with_package_base = 0 378s mocker = 378s 378s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 378s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 378s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_module", [0, 1]) 378s @pytest.mark.parametrize("with_package_base", [0, 1]) 378s def test_setup_inputs( 378s has_cmake_package, 378s has_cmake_module, 378s has_hybrid_package, 378s has_pure_package, 378s has_pure_module, 378s with_package_base, 378s mocker, 378s ): 378s """This test that a project can have a package with some modules 378s installed using setup.py and some other modules installed using CMake. 378s """ 378s 378s tmp_dir = _tmpdir("test_setup_inputs") 378s 378s package_base = "to/the/base" if with_package_base else "" 378s package_base_dir = package_base + "/" if package_base else "" 378s cmake_source_dir = package_base 378s 378s if cmake_source_dir and (has_cmake_package or has_cmake_module): 378s pytest.skip( 378s "unsupported configuration: " 378s "python package fully generated by CMake does *NOT* work. " 378s "At least __init__.py should be in the project source tree" 378s ) 378s 378s # ------------------------------------------------------------------------- 378s # Here is the "SOURCE" tree layout: 378s # 378s # ROOT/ 378s # 378s # setup.py 378s # 378s # [/] 378s # 378s # pureModule.py 378s # 378s # pure/ 378s # __init__.py 378s # pure.py 378s # 378s # data/ 378s # pure.dat 378s # 378s # [/] 378s # 378s # hybrid/ 378s # CMakeLists.txt 378s # __init__.py 378s # hybrid_pure.dat 378s # hybrid_pure.py 378s # 378s # data/ 378s # hybrid_data_pure.dat 378s # 378s # hybrid_2/ 378s # __init__.py 378s # hybrid_2_pure.py 378s # 378s # hybrid_2_pure/ 378s # __init__.py 378s # hybrid_2_pure_1.py 378s # hybrid_2_pure_2.py 378s # 378s # 378s # ------------------------------------------------------------------------- 378s # and here is the "BINARY" distribution layout: 378s # 378s # The comment "CMake" or "Setuptools" indicates which tool is responsible 378s # for placing the file in the tree used to create the binary distribution. 378s # 378s # ROOT/ 378s # 378s # cmakeModule.py # CMake 378s # 378s # cmake/ 378s # __init__.py # CMake 378s # cmake.py # CMake 378s # 378s # hybrid/ 378s # hybrid_cmake.dat # CMake 378s # hybrid_cmake.py # CMake 378s # hybrid_pure.dat # Setuptools 378s # hybrid_pure.py # Setuptools 378s # 378s # data/ 378s # hybrid_data_pure.dat # CMake or Setuptools 378s # hybrid_data_cmake.dat # CMake *NO TEST* 378s # 378s # hybrid_2/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure.py # CMake or Setuptools 378s # hybrid_2_cmake.py # CMake 378s # 378s # hybrid_2_pure/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure_1.py # CMake or Setuptools 378s # hybrid_2_pure_2.py # CMake or Setuptools 378s # 378s # pureModule.py # Setuptools 378s # 378s # pure/ 378s # __init__.py # Setuptools 378s # pure.py # Setuptools 378s # 378s # data/ 378s # pure.dat # Setuptools 378s 378s tmp_dir.join("setup.py").write( 378s textwrap.dedent( 378s """ 378s from skbuild import setup 378s #from setuptools import setup 378s setup( 378s name="test_hybrid_project", 378s version="1.2.3", 378s description=("an hybrid package mixing files installed by both " 378s "CMake and setuptools"), 378s author='The scikit-build team', 378s license="MIT", 378s cmake_source_dir='{cmake_source_dir}', 378s cmake_install_dir='{cmake_install_dir}', 378s # Arbitrary order of packages 378s packages=[ 378s {p_off} 'pure', 378s {h_off} 'hybrid.hybrid_2', 378s {h_off} 'hybrid', 378s {c_off} 'cmake', 378s {p_off} 'hybrid.hybrid_2_pure', 378s ], 378s py_modules=[ 378s {pm_off} '{package_base}pureModule', 378s {cm_off} '{package_base}cmakeModule', 378s ], 378s package_data={{ 378s {p_off} 'pure': ['data/pure.dat'], 378s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 378s }}, 378s # Arbitrary order of package_dir 378s package_dir = {{ 378s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 378s {p_off} 'pure': '{package_base}pure', 378s {h_off} 'hybrid': '{package_base}hybrid', 378s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 378s {c_off} 'cmake': '{package_base}cmake', 378s }} 378s ) 378s """.format( 378s cmake_source_dir=cmake_source_dir, 378s cmake_install_dir=package_base, 378s package_base=package_base_dir, 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s p_off="" if has_pure_package else "#", 378s pm_off="" if has_pure_module else "#", 378s ) 378s ) 378s ) 378s 378s src_dir = tmp_dir.ensure(package_base, dir=1) 378s 378s src_dir.join("CMakeLists.txt").write( 378s textwrap.dedent( 378s """ 378s cmake_minimum_required(VERSION 3.5.0) 378s project(hybrid NONE) 378s set(build_dir ${{CMAKE_BINARY_DIR}}) 378s 378s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 378s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 378s {c_off} install( 378s {c_off} FILES 378s {c_off} ${{build_dir}}/__init__.py 378s {c_off} ${{build_dir}}/cmake.py 378s {c_off} DESTINATION cmake 378s {c_off} ) 378s 378s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 378s {cm_off} install( 378s {cm_off} FILES ${{build_dir}}/cmakeModule.py 378s {cm_off} DESTINATION .) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 378s {h_off} DESTINATION hybrid/data) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 378s {h_off} DESTINATION hybrid/hybrid_2) 378s 378s install(CODE "message(STATUS \\\"Installation complete\\\")") 378s """.format( 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s ) 378s ) 378s ) 378s 378s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 378s path_types: Sequence[str] 378s try: 378s path_types = next( 378s iter( 378s zip( 378s *filter( 378s lambda i: i[1], 378s [ 378s ("c", has_cmake_package), 378s ("cm", has_cmake_module), 378s ("h", has_hybrid_package), 378s ("p", has_pure_package), 378s ("pm", has_pure_module), 378s ], 378s ) 378s ) 378s ) 378s ) 378s except StopIteration: 378s path_types = [] 378s 378s def select_paths(annotated_paths): 378s """Return a filtered list paths considering ``path_types``. 378s 378s `annotated_paths`` is list of tuple ``(type, path)`` where type 378s is either `c`, 'cm', `h`, `p` or 'pm'. 378s 378s """ 378s return filter(lambda i: i[0] in path_types, annotated_paths) 378s 378s # Commented paths are the one expected to be installed by CMake. For 378s # this reason, corresponding files should NOT be created in the source 378s # tree. 378s for _type, path in select_paths( 378s [ 378s # ('c', 'cmake/__init__.py'), 378s # ('c', 'cmake/cmake.py'), 378s # ('cm', 'cmakeModule.py'), 378s ("h", "hybrid/__init__.py"), 378s # ('h', 'hybrid/hybrid_cmake.dat'), 378s # ('h', 'hybrid/hybrid_cmake.py'), 378s ("h", "hybrid/hybrid_pure.dat"), 378s ("h", "hybrid/hybrid_pure.py"), 378s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 378s ("h", "hybrid/data/hybrid_data_pure.dat"), 378s ("h", "hybrid/hybrid_2/__init__.py"), 378s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 378s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 378s ("p", "hybrid/hybrid_2_pure/__init__.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 378s ("pm", "pureModule.py"), 378s ("p", "pure/__init__.py"), 378s ("p", "pure/pure.py"), 378s ("p", "pure/data/pure.dat"), 378s ] 378s ): 378s assert _type in {"p", "pm", "h"} 378s root = package_base if _type in {"p", "pm"} else cmake_source_dir 378s tmp_dir.ensure(os.path.join(root, path)) 378s 378s # Do not call the real setup function. Instead, replace it with 378s # a MagicMock allowing to check with which arguments it was invoked. 378s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 378s 378s # Convenience print function 378s def _pprint(desc, value=None): 378s print( 378s "-----------------\n" 378s f"{desc}:\n" 378s "\n" 378s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 378s ) 378s 378s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 378s 378s _pprint = ._pprint at 0x3ffb602ade0> 378s _type = 'p' 378s cmake_source_dir = '' 378s has_cmake_module = 0 378s has_cmake_package = 1 378s has_hybrid_package = 1 378s has_pure_module = 0 378s has_pure_package = 1 378s mock_setup = 378s mocker = 378s package_base = '' 378s package_base_dir = '' 378s path = 'pure/data/pure.dat' 378s path_types = ('c', 'h', 'p') 378s root = '' 378s select_paths = .select_paths at 0x3ffb61c4720> 378s src_dir = local('/tmp/pytest-of-ubuntu/pytest-95/test_setup_inputs0') 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-95/test_setup_inputs0') 378s with_package_base = 0 378s 378s tests/test_setup.py:849: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-95/test_setup_inputs0') 378s setup_args = ['build'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-95/test_setup_inputs0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s ________________________ test_setup_inputs[0-0-1-1-1-0] ________________________ 378s 378s has_cmake_package = 0, has_cmake_module = 1, has_hybrid_package = 1 378s has_pure_package = 1, has_pure_module = 0, with_package_base = 0 378s mocker = 378s 378s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 378s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 378s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_module", [0, 1]) 378s @pytest.mark.parametrize("with_package_base", [0, 1]) 378s def test_setup_inputs( 378s has_cmake_package, 378s has_cmake_module, 378s has_hybrid_package, 378s has_pure_package, 378s has_pure_module, 378s with_package_base, 378s mocker, 378s ): 378s """This test that a project can have a package with some modules 378s installed using setup.py and some other modules installed using CMake. 378s """ 378s 378s tmp_dir = _tmpdir("test_setup_inputs") 378s 378s package_base = "to/the/base" if with_package_base else "" 378s package_base_dir = package_base + "/" if package_base else "" 378s cmake_source_dir = package_base 378s 378s if cmake_source_dir and (has_cmake_package or has_cmake_module): 378s pytest.skip( 378s "unsupported configuration: " 378s "python package fully generated by CMake does *NOT* work. " 378s "At least __init__.py should be in the project source tree" 378s ) 378s 378s # ------------------------------------------------------------------------- 378s # Here is the "SOURCE" tree layout: 378s # 378s # ROOT/ 378s # 378s # setup.py 378s # 378s # [/] 378s # 378s # pureModule.py 378s # 378s # pure/ 378s # __init__.py 378s # pure.py 378s # 378s # data/ 378s # pure.dat 378s # 378s # [/] 378s # 378s # hybrid/ 378s # CMakeLists.txt 378s # __init__.py 378s # hybrid_pure.dat 378s # hybrid_pure.py 378s # 378s # data/ 378s # hybrid_data_pure.dat 378s # 378s # hybrid_2/ 378s # __init__.py 378s # hybrid_2_pure.py 378s # 378s # hybrid_2_pure/ 378s # __init__.py 378s # hybrid_2_pure_1.py 378s # hybrid_2_pure_2.py 378s # 378s # 378s # ------------------------------------------------------------------------- 378s # and here is the "BINARY" distribution layout: 378s # 378s # The comment "CMake" or "Setuptools" indicates which tool is responsible 378s # for placing the file in the tree used to create the binary distribution. 378s # 378s # ROOT/ 378s # 378s # cmakeModule.py # CMake 378s # 378s # cmake/ 378s # __init__.py # CMake 378s # cmake.py # CMake 378s # 378s # hybrid/ 378s # hybrid_cmake.dat # CMake 378s # hybrid_cmake.py # CMake 378s # hybrid_pure.dat # Setuptools 378s # hybrid_pure.py # Setuptools 378s # 378s # data/ 378s # hybrid_data_pure.dat # CMake or Setuptools 378s # hybrid_data_cmake.dat # CMake *NO TEST* 378s # 378s # hybrid_2/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure.py # CMake or Setuptools 378s # hybrid_2_cmake.py # CMake 378s # 378s # hybrid_2_pure/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure_1.py # CMake or Setuptools 378s # hybrid_2_pure_2.py # CMake or Setuptools 378s # 378s # pureModule.py # Setuptools 378s # 378s # pure/ 378s # __init__.py # Setuptools 378s # pure.py # Setuptools 378s # 378s # data/ 378s # pure.dat # Setuptools 378s 378s tmp_dir.join("setup.py").write( 378s textwrap.dedent( 378s """ 378s from skbuild import setup 378s #from setuptools import setup 378s setup( 378s name="test_hybrid_project", 378s version="1.2.3", 378s description=("an hybrid package mixing files installed by both " 378s "CMake and setuptools"), 378s author='The scikit-build team', 378s license="MIT", 378s cmake_source_dir='{cmake_source_dir}', 378s cmake_install_dir='{cmake_install_dir}', 378s # Arbitrary order of packages 378s packages=[ 378s {p_off} 'pure', 378s {h_off} 'hybrid.hybrid_2', 378s {h_off} 'hybrid', 378s {c_off} 'cmake', 378s {p_off} 'hybrid.hybrid_2_pure', 378s ], 378s py_modules=[ 378s {pm_off} '{package_base}pureModule', 378s {cm_off} '{package_base}cmakeModule', 378s ], 378s package_data={{ 378s {p_off} 'pure': ['data/pure.dat'], 378s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 378s }}, 378s # Arbitrary order of package_dir 378s package_dir = {{ 378s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 378s {p_off} 'pure': '{package_base}pure', 378s {h_off} 'hybrid': '{package_base}hybrid', 378s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 378s {c_off} 'cmake': '{package_base}cmake', 378s }} 378s ) 378s """.format( 378s cmake_source_dir=cmake_source_dir, 378s cmake_install_dir=package_base, 378s package_base=package_base_dir, 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s p_off="" if has_pure_package else "#", 378s pm_off="" if has_pure_module else "#", 378s ) 378s ) 378s ) 378s 378s src_dir = tmp_dir.ensure(package_base, dir=1) 378s 378s src_dir.join("CMakeLists.txt").write( 378s textwrap.dedent( 378s """ 378s cmake_minimum_required(VERSION 3.5.0) 378s project(hybrid NONE) 378s set(build_dir ${{CMAKE_BINARY_DIR}}) 378s 378s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 378s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 378s {c_off} install( 378s {c_off} FILES 378s {c_off} ${{build_dir}}/__init__.py 378s {c_off} ${{build_dir}}/cmake.py 378s {c_off} DESTINATION cmake 378s {c_off} ) 378s 378s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 378s {cm_off} install( 378s {cm_off} FILES ${{build_dir}}/cmakeModule.py 378s {cm_off} DESTINATION .) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 378s {h_off} DESTINATION hybrid/data) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 378s {h_off} DESTINATION hybrid/hybrid_2) 378s 378s install(CODE "message(STATUS \\\"Installation complete\\\")") 378s """.format( 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s ) 378s ) 378s ) 378s 378s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 378s path_types: Sequence[str] 378s try: 378s path_types = next( 378s iter( 378s zip( 378s *filter( 378s lambda i: i[1], 378s [ 378s ("c", has_cmake_package), 378s ("cm", has_cmake_module), 378s ("h", has_hybrid_package), 378s ("p", has_pure_package), 378s ("pm", has_pure_module), 378s ], 378s ) 378s ) 378s ) 378s ) 378s except StopIteration: 378s path_types = [] 378s 378s def select_paths(annotated_paths): 378s """Return a filtered list paths considering ``path_types``. 378s 378s `annotated_paths`` is list of tuple ``(type, path)`` where type 378s is either `c`, 'cm', `h`, `p` or 'pm'. 378s 378s """ 378s return filter(lambda i: i[0] in path_types, annotated_paths) 378s 378s # Commented paths are the one expected to be installed by CMake. For 378s # this reason, corresponding files should NOT be created in the source 378s # tree. 378s for _type, path in select_paths( 378s [ 378s # ('c', 'cmake/__init__.py'), 378s # ('c', 'cmake/cmake.py'), 378s # ('cm', 'cmakeModule.py'), 378s ("h", "hybrid/__init__.py"), 378s # ('h', 'hybrid/hybrid_cmake.dat'), 378s # ('h', 'hybrid/hybrid_cmake.py'), 378s ("h", "hybrid/hybrid_pure.dat"), 378s ("h", "hybrid/hybrid_pure.py"), 378s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 378s ("h", "hybrid/data/hybrid_data_pure.dat"), 378s ("h", "hybrid/hybrid_2/__init__.py"), 378s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 378s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 378s ("p", "hybrid/hybrid_2_pure/__init__.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 378s ("pm", "pureModule.py"), 378s ("p", "pure/__init__.py"), 378s ("p", "pure/pure.py"), 378s ("p", "pure/data/pure.dat"), 378s ] 378s ): 378s assert _type in {"p", "pm", "h"} 378s root = package_base if _type in {"p", "pm"} else cmake_source_dir 378s tmp_dir.ensure(os.path.join(root, path)) 378s 378s # Do not call the real setup function. Instead, replace it with 378s # a MagicMock allowing to check with which arguments it was invoked. 378s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 378s 378s # Convenience print function 378s def _pprint(desc, value=None): 378s print( 378s "-----------------\n" 378s f"{desc}:\n" 378s "\n" 378s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 378s ) 378s 378s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 378s 378s _pprint = ._pprint at 0x3ffb6029d00> 378s _type = 'p' 378s cmake_source_dir = '' 378s has_cmake_module = 1 378s has_cmake_package = 0 378s has_hybrid_package = 1 378s has_pure_module = 0 378s has_pure_package = 1 378s mock_setup = 378s mocker = 378s package_base = '' 378s package_base_dir = '' 378s path = 'pure/data/pure.dat' 378s path_types = ('cm', 'h', 'p') 378s root = '' 378s select_paths = .select_paths at 0x3ffb602b060> 378s src_dir = local('/tmp/pytest-of-ubuntu/pytest-96/test_setup_inputs0') 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-96/test_setup_inputs0') 378s with_package_base = 0 378s 378s tests/test_setup.py:849: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-96/test_setup_inputs0') 378s setup_args = ['build'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-96/test_setup_inputs0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s ________________________ test_setup_inputs[0-0-1-1-1-1] ________________________ 378s 378s has_cmake_package = 1, has_cmake_module = 1, has_hybrid_package = 1 378s has_pure_package = 1, has_pure_module = 0, with_package_base = 0 378s mocker = 378s 378s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 378s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 378s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_module", [0, 1]) 378s @pytest.mark.parametrize("with_package_base", [0, 1]) 378s def test_setup_inputs( 378s has_cmake_package, 378s has_cmake_module, 378s has_hybrid_package, 378s has_pure_package, 378s has_pure_module, 378s with_package_base, 378s mocker, 378s ): 378s """This test that a project can have a package with some modules 378s installed using setup.py and some other modules installed using CMake. 378s """ 378s 378s tmp_dir = _tmpdir("test_setup_inputs") 378s 378s package_base = "to/the/base" if with_package_base else "" 378s package_base_dir = package_base + "/" if package_base else "" 378s cmake_source_dir = package_base 378s 378s if cmake_source_dir and (has_cmake_package or has_cmake_module): 378s pytest.skip( 378s "unsupported configuration: " 378s "python package fully generated by CMake does *NOT* work. " 378s "At least __init__.py should be in the project source tree" 378s ) 378s 378s # ------------------------------------------------------------------------- 378s # Here is the "SOURCE" tree layout: 378s # 378s # ROOT/ 378s # 378s # setup.py 378s # 378s # [/] 378s # 378s # pureModule.py 378s # 378s # pure/ 378s # __init__.py 378s # pure.py 378s # 378s # data/ 378s # pure.dat 378s # 378s # [/] 378s # 378s # hybrid/ 378s # CMakeLists.txt 378s # __init__.py 378s # hybrid_pure.dat 378s # hybrid_pure.py 378s # 378s # data/ 378s # hybrid_data_pure.dat 378s # 378s # hybrid_2/ 378s # __init__.py 378s # hybrid_2_pure.py 378s # 378s # hybrid_2_pure/ 378s # __init__.py 378s # hybrid_2_pure_1.py 378s # hybrid_2_pure_2.py 378s # 378s # 378s # ------------------------------------------------------------------------- 378s # and here is the "BINARY" distribution layout: 378s # 378s # The comment "CMake" or "Setuptools" indicates which tool is responsible 378s # for placing the file in the tree used to create the binary distribution. 378s # 378s # ROOT/ 378s # 378s # cmakeModule.py # CMake 378s # 378s # cmake/ 378s # __init__.py # CMake 378s # cmake.py # CMake 378s # 378s # hybrid/ 378s # hybrid_cmake.dat # CMake 378s # hybrid_cmake.py # CMake 378s # hybrid_pure.dat # Setuptools 378s # hybrid_pure.py # Setuptools 378s # 378s # data/ 378s # hybrid_data_pure.dat # CMake or Setuptools 378s # hybrid_data_cmake.dat # CMake *NO TEST* 378s # 378s # hybrid_2/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure.py # CMake or Setuptools 378s # hybrid_2_cmake.py # CMake 378s # 378s # hybrid_2_pure/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure_1.py # CMake or Setuptools 378s # hybrid_2_pure_2.py # CMake or Setuptools 378s # 378s # pureModule.py # Setuptools 378s # 378s # pure/ 378s # __init__.py # Setuptools 378s # pure.py # Setuptools 378s # 378s # data/ 378s # pure.dat # Setuptools 378s 378s tmp_dir.join("setup.py").write( 378s textwrap.dedent( 378s """ 378s from skbuild import setup 378s #from setuptools import setup 378s setup( 378s name="test_hybrid_project", 378s version="1.2.3", 378s description=("an hybrid package mixing files installed by both " 378s "CMake and setuptools"), 378s author='The scikit-build team', 378s license="MIT", 378s cmake_source_dir='{cmake_source_dir}', 378s cmake_install_dir='{cmake_install_dir}', 378s # Arbitrary order of packages 378s packages=[ 378s {p_off} 'pure', 378s {h_off} 'hybrid.hybrid_2', 378s {h_off} 'hybrid', 378s {c_off} 'cmake', 378s {p_off} 'hybrid.hybrid_2_pure', 378s ], 378s py_modules=[ 378s {pm_off} '{package_base}pureModule', 378s {cm_off} '{package_base}cmakeModule', 378s ], 378s package_data={{ 378s {p_off} 'pure': ['data/pure.dat'], 378s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 378s }}, 378s # Arbitrary order of package_dir 378s package_dir = {{ 378s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 378s {p_off} 'pure': '{package_base}pure', 378s {h_off} 'hybrid': '{package_base}hybrid', 378s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 378s {c_off} 'cmake': '{package_base}cmake', 378s }} 378s ) 378s """.format( 378s cmake_source_dir=cmake_source_dir, 378s cmake_install_dir=package_base, 378s package_base=package_base_dir, 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s p_off="" if has_pure_package else "#", 378s pm_off="" if has_pure_module else "#", 378s ) 378s ) 378s ) 378s 378s src_dir = tmp_dir.ensure(package_base, dir=1) 378s 378s src_dir.join("CMakeLists.txt").write( 378s textwrap.dedent( 378s """ 378s cmake_minimum_required(VERSION 3.5.0) 378s project(hybrid NONE) 378s set(build_dir ${{CMAKE_BINARY_DIR}}) 378s 378s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 378s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 378s {c_off} install( 378s {c_off} FILES 378s {c_off} ${{build_dir}}/__init__.py 378s {c_off} ${{build_dir}}/cmake.py 378s {c_off} DESTINATION cmake 378s {c_off} ) 378s 378s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 378s {cm_off} install( 378s {cm_off} FILES ${{build_dir}}/cmakeModule.py 378s {cm_off} DESTINATION .) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 378s {h_off} DESTINATION hybrid/data) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 378s {h_off} DESTINATION hybrid/hybrid_2) 378s 378s install(CODE "message(STATUS \\\"Installation complete\\\")") 378s """.format( 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s ) 378s ) 378s ) 378s 378s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 378s path_types: Sequence[str] 378s try: 378s path_types = next( 378s iter( 378s zip( 378s *filter( 378s lambda i: i[1], 378s [ 378s ("c", has_cmake_package), 378s ("cm", has_cmake_module), 378s ("h", has_hybrid_package), 378s ("p", has_pure_package), 378s ("pm", has_pure_module), 378s ], 378s ) 378s ) 378s ) 378s ) 378s except StopIteration: 378s path_types = [] 378s 378s def select_paths(annotated_paths): 378s """Return a filtered list paths considering ``path_types``. 378s 378s `annotated_paths`` is list of tuple ``(type, path)`` where type 378s is either `c`, 'cm', `h`, `p` or 'pm'. 378s 378s """ 378s return filter(lambda i: i[0] in path_types, annotated_paths) 378s 378s # Commented paths are the one expected to be installed by CMake. For 378s # this reason, corresponding files should NOT be created in the source 378s # tree. 378s for _type, path in select_paths( 378s [ 378s # ('c', 'cmake/__init__.py'), 378s # ('c', 'cmake/cmake.py'), 378s # ('cm', 'cmakeModule.py'), 378s ("h", "hybrid/__init__.py"), 378s # ('h', 'hybrid/hybrid_cmake.dat'), 378s # ('h', 'hybrid/hybrid_cmake.py'), 378s ("h", "hybrid/hybrid_pure.dat"), 378s ("h", "hybrid/hybrid_pure.py"), 378s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 378s ("h", "hybrid/data/hybrid_data_pure.dat"), 378s ("h", "hybrid/hybrid_2/__init__.py"), 378s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 378s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 378s ("p", "hybrid/hybrid_2_pure/__init__.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 378s ("pm", "pureModule.py"), 378s ("p", "pure/__init__.py"), 378s ("p", "pure/pure.py"), 378s ("p", "pure/data/pure.dat"), 378s ] 378s ): 378s assert _type in {"p", "pm", "h"} 378s root = package_base if _type in {"p", "pm"} else cmake_source_dir 378s tmp_dir.ensure(os.path.join(root, path)) 378s 378s # Do not call the real setup function. Instead, replace it with 378s # a MagicMock allowing to check with which arguments it was invoked. 378s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 378s 378s # Convenience print function 378s def _pprint(desc, value=None): 378s print( 378s "-----------------\n" 378s f"{desc}:\n" 378s "\n" 378s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 378s ) 378s 378s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 378s 378s _pprint = ._pprint at 0x3ffb60284a0> 378s _type = 'p' 378s cmake_source_dir = '' 378s has_cmake_module = 1 378s has_cmake_package = 1 378s has_hybrid_package = 1 378s has_pure_module = 0 378s has_pure_package = 1 378s mock_setup = 378s mocker = 378s package_base = '' 378s package_base_dir = '' 378s path = 'pure/data/pure.dat' 378s path_types = ('c', 'cm', 'h', 'p') 378s root = '' 378s select_paths = .select_paths at 0x3ffb602b600> 378s src_dir = local('/tmp/pytest-of-ubuntu/pytest-97/test_setup_inputs0') 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-97/test_setup_inputs0') 378s with_package_base = 0 378s 378s tests/test_setup.py:849: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-97/test_setup_inputs0') 378s setup_args = ['build'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-97/test_setup_inputs0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s ________________________ test_setup_inputs[0-1-0-0-0-0] ________________________ 378s 378s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 0 378s has_pure_package = 0, has_pure_module = 1, with_package_base = 0 378s mocker = 378s 378s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 378s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 378s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_module", [0, 1]) 378s @pytest.mark.parametrize("with_package_base", [0, 1]) 378s def test_setup_inputs( 378s has_cmake_package, 378s has_cmake_module, 378s has_hybrid_package, 378s has_pure_package, 378s has_pure_module, 378s with_package_base, 378s mocker, 378s ): 378s """This test that a project can have a package with some modules 378s installed using setup.py and some other modules installed using CMake. 378s """ 378s 378s tmp_dir = _tmpdir("test_setup_inputs") 378s 378s package_base = "to/the/base" if with_package_base else "" 378s package_base_dir = package_base + "/" if package_base else "" 378s cmake_source_dir = package_base 378s 378s if cmake_source_dir and (has_cmake_package or has_cmake_module): 378s pytest.skip( 378s "unsupported configuration: " 378s "python package fully generated by CMake does *NOT* work. " 378s "At least __init__.py should be in the project source tree" 378s ) 378s 378s # ------------------------------------------------------------------------- 378s # Here is the "SOURCE" tree layout: 378s # 378s # ROOT/ 378s # 378s # setup.py 378s # 378s # [/] 378s # 378s # pureModule.py 378s # 378s # pure/ 378s # __init__.py 378s # pure.py 378s # 378s # data/ 378s # pure.dat 378s # 378s # [/] 378s # 378s # hybrid/ 378s # CMakeLists.txt 378s # __init__.py 378s # hybrid_pure.dat 378s # hybrid_pure.py 378s # 378s # data/ 378s # hybrid_data_pure.dat 378s # 378s # hybrid_2/ 378s # __init__.py 378s # hybrid_2_pure.py 378s # 378s # hybrid_2_pure/ 378s # __init__.py 378s # hybrid_2_pure_1.py 378s # hybrid_2_pure_2.py 378s # 378s # 378s # ------------------------------------------------------------------------- 378s # and here is the "BINARY" distribution layout: 378s # 378s # The comment "CMake" or "Setuptools" indicates which tool is responsible 378s # for placing the file in the tree used to create the binary distribution. 378s # 378s # ROOT/ 378s # 378s # cmakeModule.py # CMake 378s # 378s # cmake/ 378s # __init__.py # CMake 378s # cmake.py # CMake 378s # 378s # hybrid/ 378s # hybrid_cmake.dat # CMake 378s # hybrid_cmake.py # CMake 378s # hybrid_pure.dat # Setuptools 378s # hybrid_pure.py # Setuptools 378s # 378s # data/ 378s # hybrid_data_pure.dat # CMake or Setuptools 378s # hybrid_data_cmake.dat # CMake *NO TEST* 378s # 378s # hybrid_2/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure.py # CMake or Setuptools 378s # hybrid_2_cmake.py # CMake 378s # 378s # hybrid_2_pure/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure_1.py # CMake or Setuptools 378s # hybrid_2_pure_2.py # CMake or Setuptools 378s # 378s # pureModule.py # Setuptools 378s # 378s # pure/ 378s # __init__.py # Setuptools 378s # pure.py # Setuptools 378s # 378s # data/ 378s # pure.dat # Setuptools 378s 378s tmp_dir.join("setup.py").write( 378s textwrap.dedent( 378s """ 378s from skbuild import setup 378s #from setuptools import setup 378s setup( 378s name="test_hybrid_project", 378s version="1.2.3", 378s description=("an hybrid package mixing files installed by both " 378s "CMake and setuptools"), 378s author='The scikit-build team', 378s license="MIT", 378s cmake_source_dir='{cmake_source_dir}', 378s cmake_install_dir='{cmake_install_dir}', 378s # Arbitrary order of packages 378s packages=[ 378s {p_off} 'pure', 378s {h_off} 'hybrid.hybrid_2', 378s {h_off} 'hybrid', 378s {c_off} 'cmake', 378s {p_off} 'hybrid.hybrid_2_pure', 378s ], 378s py_modules=[ 378s {pm_off} '{package_base}pureModule', 378s {cm_off} '{package_base}cmakeModule', 378s ], 378s package_data={{ 378s {p_off} 'pure': ['data/pure.dat'], 378s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 378s }}, 378s # Arbitrary order of package_dir 378s package_dir = {{ 378s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 378s {p_off} 'pure': '{package_base}pure', 378s {h_off} 'hybrid': '{package_base}hybrid', 378s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 378s {c_off} 'cmake': '{package_base}cmake', 378s }} 378s ) 378s """.format( 378s cmake_source_dir=cmake_source_dir, 378s cmake_install_dir=package_base, 378s package_base=package_base_dir, 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s p_off="" if has_pure_package else "#", 378s pm_off="" if has_pure_module else "#", 378s ) 378s ) 378s ) 378s 378s src_dir = tmp_dir.ensure(package_base, dir=1) 378s 378s src_dir.join("CMakeLists.txt").write( 378s textwrap.dedent( 378s """ 378s cmake_minimum_required(VERSION 3.5.0) 378s project(hybrid NONE) 378s set(build_dir ${{CMAKE_BINARY_DIR}}) 378s 378s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 378s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 378s {c_off} install( 378s {c_off} FILES 378s {c_off} ${{build_dir}}/__init__.py 378s {c_off} ${{build_dir}}/cmake.py 378s {c_off} DESTINATION cmake 378s {c_off} ) 378s 378s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 378s {cm_off} install( 378s {cm_off} FILES ${{build_dir}}/cmakeModule.py 378s {cm_off} DESTINATION .) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 378s {h_off} DESTINATION hybrid/data) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 378s {h_off} DESTINATION hybrid/hybrid_2) 378s 378s install(CODE "message(STATUS \\\"Installation complete\\\")") 378s """.format( 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s ) 378s ) 378s ) 378s 378s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 378s path_types: Sequence[str] 378s try: 378s path_types = next( 378s iter( 378s zip( 378s *filter( 378s lambda i: i[1], 378s [ 378s ("c", has_cmake_package), 378s ("cm", has_cmake_module), 378s ("h", has_hybrid_package), 378s ("p", has_pure_package), 378s ("pm", has_pure_module), 378s ], 378s ) 378s ) 378s ) 378s ) 378s except StopIteration: 378s path_types = [] 378s 378s def select_paths(annotated_paths): 378s """Return a filtered list paths considering ``path_types``. 378s 378s `annotated_paths`` is list of tuple ``(type, path)`` where type 378s is either `c`, 'cm', `h`, `p` or 'pm'. 378s 378s """ 378s return filter(lambda i: i[0] in path_types, annotated_paths) 378s 378s # Commented paths are the one expected to be installed by CMake. For 378s # this reason, corresponding files should NOT be created in the source 378s # tree. 378s for _type, path in select_paths( 378s [ 378s # ('c', 'cmake/__init__.py'), 378s # ('c', 'cmake/cmake.py'), 378s # ('cm', 'cmakeModule.py'), 378s ("h", "hybrid/__init__.py"), 378s # ('h', 'hybrid/hybrid_cmake.dat'), 378s # ('h', 'hybrid/hybrid_cmake.py'), 378s ("h", "hybrid/hybrid_pure.dat"), 378s ("h", "hybrid/hybrid_pure.py"), 378s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 378s ("h", "hybrid/data/hybrid_data_pure.dat"), 378s ("h", "hybrid/hybrid_2/__init__.py"), 378s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 378s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 378s ("p", "hybrid/hybrid_2_pure/__init__.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 378s ("pm", "pureModule.py"), 378s ("p", "pure/__init__.py"), 378s ("p", "pure/pure.py"), 378s ("p", "pure/data/pure.dat"), 378s ] 378s ): 378s assert _type in {"p", "pm", "h"} 378s root = package_base if _type in {"p", "pm"} else cmake_source_dir 378s tmp_dir.ensure(os.path.join(root, path)) 378s 378s # Do not call the real setup function. Instead, replace it with 378s # a MagicMock allowing to check with which arguments it was invoked. 378s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 378s 378s # Convenience print function 378s def _pprint(desc, value=None): 378s print( 378s "-----------------\n" 378s f"{desc}:\n" 378s "\n" 378s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 378s ) 378s 378s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 378s 378s _pprint = ._pprint at 0x3ffb602a660> 378s _type = 'pm' 378s cmake_source_dir = '' 378s has_cmake_module = 0 378s has_cmake_package = 0 378s has_hybrid_package = 0 378s has_pure_module = 1 378s has_pure_package = 0 378s mock_setup = 378s mocker = 378s package_base = '' 378s package_base_dir = '' 378s path = 'pureModule.py' 378s path_types = ('pm',) 378s root = '' 378s select_paths = .select_paths at 0x3ffb602a980> 378s src_dir = local('/tmp/pytest-of-ubuntu/pytest-98/test_setup_inputs0') 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-98/test_setup_inputs0') 378s with_package_base = 0 378s 378s tests/test_setup.py:849: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-98/test_setup_inputs0') 378s setup_args = ['build'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-98/test_setup_inputs0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s ________________________ test_setup_inputs[0-1-0-0-0-1] ________________________ 378s 378s has_cmake_package = 1, has_cmake_module = 0, has_hybrid_package = 0 378s has_pure_package = 0, has_pure_module = 1, with_package_base = 0 378s mocker = 378s 378s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 378s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 378s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_module", [0, 1]) 378s @pytest.mark.parametrize("with_package_base", [0, 1]) 378s def test_setup_inputs( 378s has_cmake_package, 378s has_cmake_module, 378s has_hybrid_package, 378s has_pure_package, 378s has_pure_module, 378s with_package_base, 378s mocker, 378s ): 378s """This test that a project can have a package with some modules 378s installed using setup.py and some other modules installed using CMake. 378s """ 378s 378s tmp_dir = _tmpdir("test_setup_inputs") 378s 378s package_base = "to/the/base" if with_package_base else "" 378s package_base_dir = package_base + "/" if package_base else "" 378s cmake_source_dir = package_base 378s 378s if cmake_source_dir and (has_cmake_package or has_cmake_module): 378s pytest.skip( 378s "unsupported configuration: " 378s "python package fully generated by CMake does *NOT* work. " 378s "At least __init__.py should be in the project source tree" 378s ) 378s 378s # ------------------------------------------------------------------------- 378s # Here is the "SOURCE" tree layout: 378s # 378s # ROOT/ 378s # 378s # setup.py 378s # 378s # [/] 378s # 378s # pureModule.py 378s # 378s # pure/ 378s # __init__.py 378s # pure.py 378s # 378s # data/ 378s # pure.dat 378s # 378s # [/] 378s # 378s # hybrid/ 378s # CMakeLists.txt 378s # __init__.py 378s # hybrid_pure.dat 378s # hybrid_pure.py 378s # 378s # data/ 378s # hybrid_data_pure.dat 378s # 378s # hybrid_2/ 378s # __init__.py 378s # hybrid_2_pure.py 378s # 378s # hybrid_2_pure/ 378s # __init__.py 378s # hybrid_2_pure_1.py 378s # hybrid_2_pure_2.py 378s # 378s # 378s # ------------------------------------------------------------------------- 378s # and here is the "BINARY" distribution layout: 378s # 378s # The comment "CMake" or "Setuptools" indicates which tool is responsible 378s # for placing the file in the tree used to create the binary distribution. 378s # 378s # ROOT/ 378s # 378s # cmakeModule.py # CMake 378s # 378s # cmake/ 378s # __init__.py # CMake 378s # cmake.py # CMake 378s # 378s # hybrid/ 378s # hybrid_cmake.dat # CMake 378s # hybrid_cmake.py # CMake 378s # hybrid_pure.dat # Setuptools 378s # hybrid_pure.py # Setuptools 378s # 378s # data/ 378s # hybrid_data_pure.dat # CMake or Setuptools 378s # hybrid_data_cmake.dat # CMake *NO TEST* 378s # 378s # hybrid_2/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure.py # CMake or Setuptools 378s # hybrid_2_cmake.py # CMake 378s # 378s # hybrid_2_pure/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure_1.py # CMake or Setuptools 378s # hybrid_2_pure_2.py # CMake or Setuptools 378s # 378s # pureModule.py # Setuptools 378s # 378s # pure/ 378s # __init__.py # Setuptools 378s # pure.py # Setuptools 378s # 378s # data/ 378s # pure.dat # Setuptools 378s 378s tmp_dir.join("setup.py").write( 378s textwrap.dedent( 378s """ 378s from skbuild import setup 378s #from setuptools import setup 378s setup( 378s name="test_hybrid_project", 378s version="1.2.3", 378s description=("an hybrid package mixing files installed by both " 378s "CMake and setuptools"), 378s author='The scikit-build team', 378s license="MIT", 378s cmake_source_dir='{cmake_source_dir}', 378s cmake_install_dir='{cmake_install_dir}', 378s # Arbitrary order of packages 378s packages=[ 378s {p_off} 'pure', 378s {h_off} 'hybrid.hybrid_2', 378s {h_off} 'hybrid', 378s {c_off} 'cmake', 378s {p_off} 'hybrid.hybrid_2_pure', 378s ], 378s py_modules=[ 378s {pm_off} '{package_base}pureModule', 378s {cm_off} '{package_base}cmakeModule', 378s ], 378s package_data={{ 378s {p_off} 'pure': ['data/pure.dat'], 378s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 378s }}, 378s # Arbitrary order of package_dir 378s package_dir = {{ 378s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 378s {p_off} 'pure': '{package_base}pure', 378s {h_off} 'hybrid': '{package_base}hybrid', 378s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 378s {c_off} 'cmake': '{package_base}cmake', 378s }} 378s ) 378s """.format( 378s cmake_source_dir=cmake_source_dir, 378s cmake_install_dir=package_base, 378s package_base=package_base_dir, 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s p_off="" if has_pure_package else "#", 378s pm_off="" if has_pure_module else "#", 378s ) 378s ) 378s ) 378s 378s src_dir = tmp_dir.ensure(package_base, dir=1) 378s 378s src_dir.join("CMakeLists.txt").write( 378s textwrap.dedent( 378s """ 378s cmake_minimum_required(VERSION 3.5.0) 378s project(hybrid NONE) 378s set(build_dir ${{CMAKE_BINARY_DIR}}) 378s 378s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 378s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 378s {c_off} install( 378s {c_off} FILES 378s {c_off} ${{build_dir}}/__init__.py 378s {c_off} ${{build_dir}}/cmake.py 378s {c_off} DESTINATION cmake 378s {c_off} ) 378s 378s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 378s {cm_off} install( 378s {cm_off} FILES ${{build_dir}}/cmakeModule.py 378s {cm_off} DESTINATION .) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 378s {h_off} DESTINATION hybrid/data) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 378s {h_off} DESTINATION hybrid/hybrid_2) 378s 378s install(CODE "message(STATUS \\\"Installation complete\\\")") 378s """.format( 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s ) 378s ) 378s ) 378s 378s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 378s path_types: Sequence[str] 378s try: 378s path_types = next( 378s iter( 378s zip( 378s *filter( 378s lambda i: i[1], 378s [ 378s ("c", has_cmake_package), 378s ("cm", has_cmake_module), 378s ("h", has_hybrid_package), 378s ("p", has_pure_package), 378s ("pm", has_pure_module), 378s ], 378s ) 378s ) 378s ) 378s ) 378s except StopIteration: 378s path_types = [] 378s 378s def select_paths(annotated_paths): 378s """Return a filtered list paths considering ``path_types``. 378s 378s `annotated_paths`` is list of tuple ``(type, path)`` where type 378s is either `c`, 'cm', `h`, `p` or 'pm'. 378s 378s """ 378s return filter(lambda i: i[0] in path_types, annotated_paths) 378s 378s # Commented paths are the one expected to be installed by CMake. For 378s # this reason, corresponding files should NOT be created in the source 378s # tree. 378s for _type, path in select_paths( 378s [ 378s # ('c', 'cmake/__init__.py'), 378s # ('c', 'cmake/cmake.py'), 378s # ('cm', 'cmakeModule.py'), 378s ("h", "hybrid/__init__.py"), 378s # ('h', 'hybrid/hybrid_cmake.dat'), 378s # ('h', 'hybrid/hybrid_cmake.py'), 378s ("h", "hybrid/hybrid_pure.dat"), 378s ("h", "hybrid/hybrid_pure.py"), 378s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 378s ("h", "hybrid/data/hybrid_data_pure.dat"), 378s ("h", "hybrid/hybrid_2/__init__.py"), 378s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 378s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 378s ("p", "hybrid/hybrid_2_pure/__init__.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 378s ("pm", "pureModule.py"), 378s ("p", "pure/__init__.py"), 378s ("p", "pure/pure.py"), 378s ("p", "pure/data/pure.dat"), 378s ] 378s ): 378s assert _type in {"p", "pm", "h"} 378s root = package_base if _type in {"p", "pm"} else cmake_source_dir 378s tmp_dir.ensure(os.path.join(root, path)) 378s 378s # Do not call the real setup function. Instead, replace it with 378s # a MagicMock allowing to check with which arguments it was invoked. 378s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 378s 378s # Convenience print function 378s def _pprint(desc, value=None): 378s print( 378s "-----------------\n" 378s f"{desc}:\n" 378s "\n" 378s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 378s ) 378s 378s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 378s 378s _pprint = ._pprint at 0x3ffb602b380> 378s _type = 'pm' 378s cmake_source_dir = '' 378s has_cmake_module = 0 378s has_cmake_package = 1 378s has_hybrid_package = 0 378s has_pure_module = 1 378s has_pure_package = 0 378s mock_setup = 378s mocker = 378s package_base = '' 378s package_base_dir = '' 378s path = 'pureModule.py' 378s path_types = ('c', 'pm') 378s root = '' 378s select_paths = .select_paths at 0x3ffb602b880> 378s src_dir = local('/tmp/pytest-of-ubuntu/pytest-99/test_setup_inputs0') 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-99/test_setup_inputs0') 378s with_package_base = 0 378s 378s tests/test_setup.py:849: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-99/test_setup_inputs0') 378s setup_args = ['build'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-99/test_setup_inputs0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s ________________________ test_setup_inputs[0-1-0-0-1-0] ________________________ 378s 378s has_cmake_package = 0, has_cmake_module = 1, has_hybrid_package = 0 378s has_pure_package = 0, has_pure_module = 1, with_package_base = 0 378s mocker = 378s 378s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 378s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 378s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_module", [0, 1]) 378s @pytest.mark.parametrize("with_package_base", [0, 1]) 378s def test_setup_inputs( 378s has_cmake_package, 378s has_cmake_module, 378s has_hybrid_package, 378s has_pure_package, 378s has_pure_module, 378s with_package_base, 378s mocker, 378s ): 378s """This test that a project can have a package with some modules 378s installed using setup.py and some other modules installed using CMake. 378s """ 378s 378s tmp_dir = _tmpdir("test_setup_inputs") 378s 378s package_base = "to/the/base" if with_package_base else "" 378s package_base_dir = package_base + "/" if package_base else "" 378s cmake_source_dir = package_base 378s 378s if cmake_source_dir and (has_cmake_package or has_cmake_module): 378s pytest.skip( 378s "unsupported configuration: " 378s "python package fully generated by CMake does *NOT* work. " 378s "At least __init__.py should be in the project source tree" 378s ) 378s 378s # ------------------------------------------------------------------------- 378s # Here is the "SOURCE" tree layout: 378s # 378s # ROOT/ 378s # 378s # setup.py 378s # 378s # [/] 378s # 378s # pureModule.py 378s # 378s # pure/ 378s # __init__.py 378s # pure.py 378s # 378s # data/ 378s # pure.dat 378s # 378s # [/] 378s # 378s # hybrid/ 378s # CMakeLists.txt 378s # __init__.py 378s # hybrid_pure.dat 378s # hybrid_pure.py 378s # 378s # data/ 378s # hybrid_data_pure.dat 378s # 378s # hybrid_2/ 378s # __init__.py 378s # hybrid_2_pure.py 378s # 378s # hybrid_2_pure/ 378s # __init__.py 378s # hybrid_2_pure_1.py 378s # hybrid_2_pure_2.py 378s # 378s # 378s # ------------------------------------------------------------------------- 378s # and here is the "BINARY" distribution layout: 378s # 378s # The comment "CMake" or "Setuptools" indicates which tool is responsible 378s # for placing the file in the tree used to create the binary distribution. 378s # 378s # ROOT/ 378s # 378s # cmakeModule.py # CMake 378s # 378s # cmake/ 378s # __init__.py # CMake 378s # cmake.py # CMake 378s # 378s # hybrid/ 378s # hybrid_cmake.dat # CMake 378s # hybrid_cmake.py # CMake 378s # hybrid_pure.dat # Setuptools 378s # hybrid_pure.py # Setuptools 378s # 378s # data/ 378s # hybrid_data_pure.dat # CMake or Setuptools 378s # hybrid_data_cmake.dat # CMake *NO TEST* 378s # 378s # hybrid_2/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure.py # CMake or Setuptools 378s # hybrid_2_cmake.py # CMake 378s # 378s # hybrid_2_pure/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure_1.py # CMake or Setuptools 378s # hybrid_2_pure_2.py # CMake or Setuptools 378s # 378s # pureModule.py # Setuptools 378s # 378s # pure/ 378s # __init__.py # Setuptools 378s # pure.py # Setuptools 378s # 378s # data/ 378s # pure.dat # Setuptools 378s 378s tmp_dir.join("setup.py").write( 378s textwrap.dedent( 378s """ 378s from skbuild import setup 378s #from setuptools import setup 378s setup( 378s name="test_hybrid_project", 378s version="1.2.3", 378s description=("an hybrid package mixing files installed by both " 378s "CMake and setuptools"), 378s author='The scikit-build team', 378s license="MIT", 378s cmake_source_dir='{cmake_source_dir}', 378s cmake_install_dir='{cmake_install_dir}', 378s # Arbitrary order of packages 378s packages=[ 378s {p_off} 'pure', 378s {h_off} 'hybrid.hybrid_2', 378s {h_off} 'hybrid', 378s {c_off} 'cmake', 378s {p_off} 'hybrid.hybrid_2_pure', 378s ], 378s py_modules=[ 378s {pm_off} '{package_base}pureModule', 378s {cm_off} '{package_base}cmakeModule', 378s ], 378s package_data={{ 378s {p_off} 'pure': ['data/pure.dat'], 378s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 378s }}, 378s # Arbitrary order of package_dir 378s package_dir = {{ 378s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 378s {p_off} 'pure': '{package_base}pure', 378s {h_off} 'hybrid': '{package_base}hybrid', 378s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 378s {c_off} 'cmake': '{package_base}cmake', 378s }} 378s ) 378s """.format( 378s cmake_source_dir=cmake_source_dir, 378s cmake_install_dir=package_base, 378s package_base=package_base_dir, 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s p_off="" if has_pure_package else "#", 378s pm_off="" if has_pure_module else "#", 378s ) 378s ) 378s ) 378s 378s src_dir = tmp_dir.ensure(package_base, dir=1) 378s 378s src_dir.join("CMakeLists.txt").write( 378s textwrap.dedent( 378s """ 378s cmake_minimum_required(VERSION 3.5.0) 378s project(hybrid NONE) 378s set(build_dir ${{CMAKE_BINARY_DIR}}) 378s 378s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 378s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 378s {c_off} install( 378s {c_off} FILES 378s {c_off} ${{build_dir}}/__init__.py 378s {c_off} ${{build_dir}}/cmake.py 378s {c_off} DESTINATION cmake 378s {c_off} ) 378s 378s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 378s {cm_off} install( 378s {cm_off} FILES ${{build_dir}}/cmakeModule.py 378s {cm_off} DESTINATION .) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 378s {h_off} DESTINATION hybrid/data) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 378s {h_off} DESTINATION hybrid/hybrid_2) 378s 378s install(CODE "message(STATUS \\\"Installation complete\\\")") 378s """.format( 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s ) 378s ) 378s ) 378s 378s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 378s path_types: Sequence[str] 378s try: 378s path_types = next( 378s iter( 378s zip( 378s *filter( 378s lambda i: i[1], 378s [ 378s ("c", has_cmake_package), 378s ("cm", has_cmake_module), 378s ("h", has_hybrid_package), 378s ("p", has_pure_package), 378s ("pm", has_pure_module), 378s ], 378s ) 378s ) 378s ) 378s ) 378s except StopIteration: 378s path_types = [] 378s 378s def select_paths(annotated_paths): 378s """Return a filtered list paths considering ``path_types``. 378s 378s `annotated_paths`` is list of tuple ``(type, path)`` where type 378s is either `c`, 'cm', `h`, `p` or 'pm'. 378s 378s """ 378s return filter(lambda i: i[0] in path_types, annotated_paths) 378s 378s # Commented paths are the one expected to be installed by CMake. For 378s # this reason, corresponding files should NOT be created in the source 378s # tree. 378s for _type, path in select_paths( 378s [ 378s # ('c', 'cmake/__init__.py'), 378s # ('c', 'cmake/cmake.py'), 378s # ('cm', 'cmakeModule.py'), 378s ("h", "hybrid/__init__.py"), 378s # ('h', 'hybrid/hybrid_cmake.dat'), 378s # ('h', 'hybrid/hybrid_cmake.py'), 378s ("h", "hybrid/hybrid_pure.dat"), 378s ("h", "hybrid/hybrid_pure.py"), 378s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 378s ("h", "hybrid/data/hybrid_data_pure.dat"), 378s ("h", "hybrid/hybrid_2/__init__.py"), 378s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 378s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 378s ("p", "hybrid/hybrid_2_pure/__init__.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 378s ("pm", "pureModule.py"), 378s ("p", "pure/__init__.py"), 378s ("p", "pure/pure.py"), 378s ("p", "pure/data/pure.dat"), 378s ] 378s ): 378s assert _type in {"p", "pm", "h"} 378s root = package_base if _type in {"p", "pm"} else cmake_source_dir 378s tmp_dir.ensure(os.path.join(root, path)) 378s 378s # Do not call the real setup function. Instead, replace it with 378s # a MagicMock allowing to check with which arguments it was invoked. 378s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 378s 378s # Convenience print function 378s def _pprint(desc, value=None): 378s print( 378s "-----------------\n" 378s f"{desc}:\n" 378s "\n" 378s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 378s ) 378s 378s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 378s 378s _pprint = ._pprint at 0x3ffb6028360> 378s _type = 'pm' 378s cmake_source_dir = '' 378s has_cmake_module = 1 378s has_cmake_package = 0 378s has_hybrid_package = 0 378s has_pure_module = 1 378s has_pure_package = 0 378s mock_setup = 378s mocker = 378s package_base = '' 378s package_base_dir = '' 378s path = 'pureModule.py' 378s path_types = ('cm', 'pm') 378s root = '' 378s select_paths = .select_paths at 0x3ffb602be20> 378s src_dir = local('/tmp/pytest-of-ubuntu/pytest-100/test_setup_inputs0') 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-100/test_setup_inputs0') 378s with_package_base = 0 378s 378s tests/test_setup.py:849: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-100/test_setup_inputs0') 378s setup_args = ['build'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-100/test_setup_inputs0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s ________________________ test_setup_inputs[0-1-0-0-1-1] ________________________ 378s 378s has_cmake_package = 1, has_cmake_module = 1, has_hybrid_package = 0 378s has_pure_package = 0, has_pure_module = 1, with_package_base = 0 378s mocker = 378s 378s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 378s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 378s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_module", [0, 1]) 378s @pytest.mark.parametrize("with_package_base", [0, 1]) 378s def test_setup_inputs( 378s has_cmake_package, 378s has_cmake_module, 378s has_hybrid_package, 378s has_pure_package, 378s has_pure_module, 378s with_package_base, 378s mocker, 378s ): 378s """This test that a project can have a package with some modules 378s installed using setup.py and some other modules installed using CMake. 378s """ 378s 378s tmp_dir = _tmpdir("test_setup_inputs") 378s 378s package_base = "to/the/base" if with_package_base else "" 378s package_base_dir = package_base + "/" if package_base else "" 378s cmake_source_dir = package_base 378s 378s if cmake_source_dir and (has_cmake_package or has_cmake_module): 378s pytest.skip( 378s "unsupported configuration: " 378s "python package fully generated by CMake does *NOT* work. " 378s "At least __init__.py should be in the project source tree" 378s ) 378s 378s # ------------------------------------------------------------------------- 378s # Here is the "SOURCE" tree layout: 378s # 378s # ROOT/ 378s # 378s # setup.py 378s # 378s # [/] 378s # 378s # pureModule.py 378s # 378s # pure/ 378s # __init__.py 378s # pure.py 378s # 378s # data/ 378s # pure.dat 378s # 378s # [/] 378s # 378s # hybrid/ 378s # CMakeLists.txt 378s # __init__.py 378s # hybrid_pure.dat 378s # hybrid_pure.py 378s # 378s # data/ 378s # hybrid_data_pure.dat 378s # 378s # hybrid_2/ 378s # __init__.py 378s # hybrid_2_pure.py 378s # 378s # hybrid_2_pure/ 378s # __init__.py 378s # hybrid_2_pure_1.py 378s # hybrid_2_pure_2.py 378s # 378s # 378s # ------------------------------------------------------------------------- 378s # and here is the "BINARY" distribution layout: 378s # 378s # The comment "CMake" or "Setuptools" indicates which tool is responsible 378s # for placing the file in the tree used to create the binary distribution. 378s # 378s # ROOT/ 378s # 378s # cmakeModule.py # CMake 378s # 378s # cmake/ 378s # __init__.py # CMake 378s # cmake.py # CMake 378s # 378s # hybrid/ 378s # hybrid_cmake.dat # CMake 378s # hybrid_cmake.py # CMake 378s # hybrid_pure.dat # Setuptools 378s # hybrid_pure.py # Setuptools 378s # 378s # data/ 378s # hybrid_data_pure.dat # CMake or Setuptools 378s # hybrid_data_cmake.dat # CMake *NO TEST* 378s # 378s # hybrid_2/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure.py # CMake or Setuptools 378s # hybrid_2_cmake.py # CMake 378s # 378s # hybrid_2_pure/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure_1.py # CMake or Setuptools 378s # hybrid_2_pure_2.py # CMake or Setuptools 378s # 378s # pureModule.py # Setuptools 378s # 378s # pure/ 378s # __init__.py # Setuptools 378s # pure.py # Setuptools 378s # 378s # data/ 378s # pure.dat # Setuptools 378s 378s tmp_dir.join("setup.py").write( 378s textwrap.dedent( 378s """ 378s from skbuild import setup 378s #from setuptools import setup 378s setup( 378s name="test_hybrid_project", 378s version="1.2.3", 378s description=("an hybrid package mixing files installed by both " 378s "CMake and setuptools"), 378s author='The scikit-build team', 378s license="MIT", 378s cmake_source_dir='{cmake_source_dir}', 378s cmake_install_dir='{cmake_install_dir}', 378s # Arbitrary order of packages 378s packages=[ 378s {p_off} 'pure', 378s {h_off} 'hybrid.hybrid_2', 378s {h_off} 'hybrid', 378s {c_off} 'cmake', 378s {p_off} 'hybrid.hybrid_2_pure', 378s ], 378s py_modules=[ 378s {pm_off} '{package_base}pureModule', 378s {cm_off} '{package_base}cmakeModule', 378s ], 378s package_data={{ 378s {p_off} 'pure': ['data/pure.dat'], 378s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 378s }}, 378s # Arbitrary order of package_dir 378s package_dir = {{ 378s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 378s {p_off} 'pure': '{package_base}pure', 378s {h_off} 'hybrid': '{package_base}hybrid', 378s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 378s {c_off} 'cmake': '{package_base}cmake', 378s }} 378s ) 378s """.format( 378s cmake_source_dir=cmake_source_dir, 378s cmake_install_dir=package_base, 378s package_base=package_base_dir, 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s p_off="" if has_pure_package else "#", 378s pm_off="" if has_pure_module else "#", 378s ) 378s ) 378s ) 378s 378s src_dir = tmp_dir.ensure(package_base, dir=1) 378s 378s src_dir.join("CMakeLists.txt").write( 378s textwrap.dedent( 378s """ 378s cmake_minimum_required(VERSION 3.5.0) 378s project(hybrid NONE) 378s set(build_dir ${{CMAKE_BINARY_DIR}}) 378s 378s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 378s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 378s {c_off} install( 378s {c_off} FILES 378s {c_off} ${{build_dir}}/__init__.py 378s {c_off} ${{build_dir}}/cmake.py 378s {c_off} DESTINATION cmake 378s {c_off} ) 378s 378s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 378s {cm_off} install( 378s {cm_off} FILES ${{build_dir}}/cmakeModule.py 378s {cm_off} DESTINATION .) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 378s {h_off} DESTINATION hybrid/data) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 378s {h_off} DESTINATION hybrid/hybrid_2) 378s 378s install(CODE "message(STATUS \\\"Installation complete\\\")") 378s """.format( 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s ) 378s ) 378s ) 378s 378s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 378s path_types: Sequence[str] 378s try: 378s path_types = next( 378s iter( 378s zip( 378s *filter( 378s lambda i: i[1], 378s [ 378s ("c", has_cmake_package), 378s ("cm", has_cmake_module), 378s ("h", has_hybrid_package), 378s ("p", has_pure_package), 378s ("pm", has_pure_module), 378s ], 378s ) 378s ) 378s ) 378s ) 378s except StopIteration: 378s path_types = [] 378s 378s def select_paths(annotated_paths): 378s """Return a filtered list paths considering ``path_types``. 378s 378s `annotated_paths`` is list of tuple ``(type, path)`` where type 378s is either `c`, 'cm', `h`, `p` or 'pm'. 378s 378s """ 378s return filter(lambda i: i[0] in path_types, annotated_paths) 378s 378s # Commented paths are the one expected to be installed by CMake. For 378s # this reason, corresponding files should NOT be created in the source 378s # tree. 378s for _type, path in select_paths( 378s [ 378s # ('c', 'cmake/__init__.py'), 378s # ('c', 'cmake/cmake.py'), 378s # ('cm', 'cmakeModule.py'), 378s ("h", "hybrid/__init__.py"), 378s # ('h', 'hybrid/hybrid_cmake.dat'), 378s # ('h', 'hybrid/hybrid_cmake.py'), 378s ("h", "hybrid/hybrid_pure.dat"), 378s ("h", "hybrid/hybrid_pure.py"), 378s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 378s ("h", "hybrid/data/hybrid_data_pure.dat"), 378s ("h", "hybrid/hybrid_2/__init__.py"), 378s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 378s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 378s ("p", "hybrid/hybrid_2_pure/__init__.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 378s ("pm", "pureModule.py"), 378s ("p", "pure/__init__.py"), 378s ("p", "pure/pure.py"), 378s ("p", "pure/data/pure.dat"), 378s ] 378s ): 378s assert _type in {"p", "pm", "h"} 378s root = package_base if _type in {"p", "pm"} else cmake_source_dir 378s tmp_dir.ensure(os.path.join(root, path)) 378s 378s # Do not call the real setup function. Instead, replace it with 378s # a MagicMock allowing to check with which arguments it was invoked. 378s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 378s 378s # Convenience print function 378s def _pprint(desc, value=None): 378s print( 378s "-----------------\n" 378s f"{desc}:\n" 378s "\n" 378s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 378s ) 378s 378s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 378s 378s _pprint = ._pprint at 0x3ffb602bc40> 378s _type = 'pm' 378s cmake_source_dir = '' 378s has_cmake_module = 1 378s has_cmake_package = 1 378s has_hybrid_package = 0 378s has_pure_module = 1 378s has_pure_package = 0 378s mock_setup = 378s mocker = 378s package_base = '' 378s package_base_dir = '' 378s path = 'pureModule.py' 378s path_types = ('c', 'cm', 'pm') 378s root = '' 378s select_paths = .select_paths at 0x3ffb6028180> 378s src_dir = local('/tmp/pytest-of-ubuntu/pytest-101/test_setup_inputs0') 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-101/test_setup_inputs0') 378s with_package_base = 0 378s 378s tests/test_setup.py:849: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-101/test_setup_inputs0') 378s setup_args = ['build'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-101/test_setup_inputs0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s ________________________ test_setup_inputs[0-1-0-1-0-0] ________________________ 378s 378s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 1 378s has_pure_package = 0, has_pure_module = 1, with_package_base = 0 378s mocker = 378s 378s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 378s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 378s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_module", [0, 1]) 378s @pytest.mark.parametrize("with_package_base", [0, 1]) 378s def test_setup_inputs( 378s has_cmake_package, 378s has_cmake_module, 378s has_hybrid_package, 378s has_pure_package, 378s has_pure_module, 378s with_package_base, 378s mocker, 378s ): 378s """This test that a project can have a package with some modules 378s installed using setup.py and some other modules installed using CMake. 378s """ 378s 378s tmp_dir = _tmpdir("test_setup_inputs") 378s 378s package_base = "to/the/base" if with_package_base else "" 378s package_base_dir = package_base + "/" if package_base else "" 378s cmake_source_dir = package_base 378s 378s if cmake_source_dir and (has_cmake_package or has_cmake_module): 378s pytest.skip( 378s "unsupported configuration: " 378s "python package fully generated by CMake does *NOT* work. " 378s "At least __init__.py should be in the project source tree" 378s ) 378s 378s # ------------------------------------------------------------------------- 378s # Here is the "SOURCE" tree layout: 378s # 378s # ROOT/ 378s # 378s # setup.py 378s # 378s # [/] 378s # 378s # pureModule.py 378s # 378s # pure/ 378s # __init__.py 378s # pure.py 378s # 378s # data/ 378s # pure.dat 378s # 378s # [/] 378s # 378s # hybrid/ 378s # CMakeLists.txt 378s # __init__.py 378s # hybrid_pure.dat 378s # hybrid_pure.py 378s # 378s # data/ 378s # hybrid_data_pure.dat 378s # 378s # hybrid_2/ 378s # __init__.py 378s # hybrid_2_pure.py 378s # 378s # hybrid_2_pure/ 378s # __init__.py 378s # hybrid_2_pure_1.py 378s # hybrid_2_pure_2.py 378s # 378s # 378s # ------------------------------------------------------------------------- 378s # and here is the "BINARY" distribution layout: 378s # 378s # The comment "CMake" or "Setuptools" indicates which tool is responsible 378s # for placing the file in the tree used to create the binary distribution. 378s # 378s # ROOT/ 378s # 378s # cmakeModule.py # CMake 378s # 378s # cmake/ 378s # __init__.py # CMake 378s # cmake.py # CMake 378s # 378s # hybrid/ 378s # hybrid_cmake.dat # CMake 378s # hybrid_cmake.py # CMake 378s # hybrid_pure.dat # Setuptools 378s # hybrid_pure.py # Setuptools 378s # 378s # data/ 378s # hybrid_data_pure.dat # CMake or Setuptools 378s # hybrid_data_cmake.dat # CMake *NO TEST* 378s # 378s # hybrid_2/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure.py # CMake or Setuptools 378s # hybrid_2_cmake.py # CMake 378s # 378s # hybrid_2_pure/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure_1.py # CMake or Setuptools 378s # hybrid_2_pure_2.py # CMake or Setuptools 378s # 378s # pureModule.py # Setuptools 378s # 378s # pure/ 378s # __init__.py # Setuptools 378s # pure.py # Setuptools 378s # 378s # data/ 378s # pure.dat # Setuptools 378s 378s tmp_dir.join("setup.py").write( 378s textwrap.dedent( 378s """ 378s from skbuild import setup 378s #from setuptools import setup 378s setup( 378s name="test_hybrid_project", 378s version="1.2.3", 378s description=("an hybrid package mixing files installed by both " 378s "CMake and setuptools"), 378s author='The scikit-build team', 378s license="MIT", 378s cmake_source_dir='{cmake_source_dir}', 378s cmake_install_dir='{cmake_install_dir}', 378s # Arbitrary order of packages 378s packages=[ 378s {p_off} 'pure', 378s {h_off} 'hybrid.hybrid_2', 378s {h_off} 'hybrid', 378s {c_off} 'cmake', 378s {p_off} 'hybrid.hybrid_2_pure', 378s ], 378s py_modules=[ 378s {pm_off} '{package_base}pureModule', 378s {cm_off} '{package_base}cmakeModule', 378s ], 378s package_data={{ 378s {p_off} 'pure': ['data/pure.dat'], 378s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 378s }}, 378s # Arbitrary order of package_dir 378s package_dir = {{ 378s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 378s {p_off} 'pure': '{package_base}pure', 378s {h_off} 'hybrid': '{package_base}hybrid', 378s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 378s {c_off} 'cmake': '{package_base}cmake', 378s }} 378s ) 378s """.format( 378s cmake_source_dir=cmake_source_dir, 378s cmake_install_dir=package_base, 378s package_base=package_base_dir, 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s p_off="" if has_pure_package else "#", 378s pm_off="" if has_pure_module else "#", 378s ) 378s ) 378s ) 378s 378s src_dir = tmp_dir.ensure(package_base, dir=1) 378s 378s src_dir.join("CMakeLists.txt").write( 378s textwrap.dedent( 378s """ 378s cmake_minimum_required(VERSION 3.5.0) 378s project(hybrid NONE) 378s set(build_dir ${{CMAKE_BINARY_DIR}}) 378s 378s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 378s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 378s {c_off} install( 378s {c_off} FILES 378s {c_off} ${{build_dir}}/__init__.py 378s {c_off} ${{build_dir}}/cmake.py 378s {c_off} DESTINATION cmake 378s {c_off} ) 378s 378s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 378s {cm_off} install( 378s {cm_off} FILES ${{build_dir}}/cmakeModule.py 378s {cm_off} DESTINATION .) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 378s {h_off} DESTINATION hybrid/data) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 378s {h_off} DESTINATION hybrid/hybrid_2) 378s 378s install(CODE "message(STATUS \\\"Installation complete\\\")") 378s """.format( 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s ) 378s ) 378s ) 378s 378s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 378s path_types: Sequence[str] 378s try: 378s path_types = next( 378s iter( 378s zip( 378s *filter( 378s lambda i: i[1], 378s [ 378s ("c", has_cmake_package), 378s ("cm", has_cmake_module), 378s ("h", has_hybrid_package), 378s ("p", has_pure_package), 378s ("pm", has_pure_module), 378s ], 378s ) 378s ) 378s ) 378s ) 378s except StopIteration: 378s path_types = [] 378s 378s def select_paths(annotated_paths): 378s """Return a filtered list paths considering ``path_types``. 378s 378s `annotated_paths`` is list of tuple ``(type, path)`` where type 378s is either `c`, 'cm', `h`, `p` or 'pm'. 378s 378s """ 378s return filter(lambda i: i[0] in path_types, annotated_paths) 378s 378s # Commented paths are the one expected to be installed by CMake. For 378s # this reason, corresponding files should NOT be created in the source 378s # tree. 378s for _type, path in select_paths( 378s [ 378s # ('c', 'cmake/__init__.py'), 378s # ('c', 'cmake/cmake.py'), 378s # ('cm', 'cmakeModule.py'), 378s ("h", "hybrid/__init__.py"), 378s # ('h', 'hybrid/hybrid_cmake.dat'), 378s # ('h', 'hybrid/hybrid_cmake.py'), 378s ("h", "hybrid/hybrid_pure.dat"), 378s ("h", "hybrid/hybrid_pure.py"), 378s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 378s ("h", "hybrid/data/hybrid_data_pure.dat"), 378s ("h", "hybrid/hybrid_2/__init__.py"), 378s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 378s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 378s ("p", "hybrid/hybrid_2_pure/__init__.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 378s ("pm", "pureModule.py"), 378s ("p", "pure/__init__.py"), 378s ("p", "pure/pure.py"), 378s ("p", "pure/data/pure.dat"), 378s ] 378s ): 378s assert _type in {"p", "pm", "h"} 378s root = package_base if _type in {"p", "pm"} else cmake_source_dir 378s tmp_dir.ensure(os.path.join(root, path)) 378s 378s # Do not call the real setup function. Instead, replace it with 378s # a MagicMock allowing to check with which arguments it was invoked. 378s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 378s 378s # Convenience print function 378s def _pprint(desc, value=None): 378s print( 378s "-----------------\n" 378s f"{desc}:\n" 378s "\n" 378s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 378s ) 378s 378s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 378s 378s _pprint = ._pprint at 0x3ffb5e380e0> 378s _type = 'pm' 378s cmake_source_dir = '' 378s has_cmake_module = 0 378s has_cmake_package = 0 378s has_hybrid_package = 1 378s has_pure_module = 1 378s has_pure_package = 0 378s mock_setup = 378s mocker = 378s package_base = '' 378s package_base_dir = '' 378s path = 'pureModule.py' 378s path_types = ('h', 'pm') 378s root = '' 378s select_paths = .select_paths at 0x3ffb61c49a0> 378s src_dir = local('/tmp/pytest-of-ubuntu/pytest-102/test_setup_inputs0') 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-102/test_setup_inputs0') 378s with_package_base = 0 378s 378s tests/test_setup.py:849: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-102/test_setup_inputs0') 378s setup_args = ['build'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-102/test_setup_inputs0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s ________________________ test_setup_inputs[0-1-0-1-0-1] ________________________ 378s 378s has_cmake_package = 1, has_cmake_module = 0, has_hybrid_package = 1 378s has_pure_package = 0, has_pure_module = 1, with_package_base = 0 378s mocker = 378s 378s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 378s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 378s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_module", [0, 1]) 378s @pytest.mark.parametrize("with_package_base", [0, 1]) 378s def test_setup_inputs( 378s has_cmake_package, 378s has_cmake_module, 378s has_hybrid_package, 378s has_pure_package, 378s has_pure_module, 378s with_package_base, 378s mocker, 378s ): 378s """This test that a project can have a package with some modules 378s installed using setup.py and some other modules installed using CMake. 378s """ 378s 378s tmp_dir = _tmpdir("test_setup_inputs") 378s 378s package_base = "to/the/base" if with_package_base else "" 378s package_base_dir = package_base + "/" if package_base else "" 378s cmake_source_dir = package_base 378s 378s if cmake_source_dir and (has_cmake_package or has_cmake_module): 378s pytest.skip( 378s "unsupported configuration: " 378s "python package fully generated by CMake does *NOT* work. " 378s "At least __init__.py should be in the project source tree" 378s ) 378s 378s # ------------------------------------------------------------------------- 378s # Here is the "SOURCE" tree layout: 378s # 378s # ROOT/ 378s # 378s # setup.py 378s # 378s # [/] 378s # 378s # pureModule.py 378s # 378s # pure/ 378s # __init__.py 378s # pure.py 378s # 378s # data/ 378s # pure.dat 378s # 378s # [/] 378s # 378s # hybrid/ 378s # CMakeLists.txt 378s # __init__.py 378s # hybrid_pure.dat 378s # hybrid_pure.py 378s # 378s # data/ 378s # hybrid_data_pure.dat 378s # 378s # hybrid_2/ 378s # __init__.py 378s # hybrid_2_pure.py 378s # 378s # hybrid_2_pure/ 378s # __init__.py 378s # hybrid_2_pure_1.py 378s # hybrid_2_pure_2.py 378s # 378s # 378s # ------------------------------------------------------------------------- 378s # and here is the "BINARY" distribution layout: 378s # 378s # The comment "CMake" or "Setuptools" indicates which tool is responsible 378s # for placing the file in the tree used to create the binary distribution. 378s # 378s # ROOT/ 378s # 378s # cmakeModule.py # CMake 378s # 378s # cmake/ 378s # __init__.py # CMake 378s # cmake.py # CMake 378s # 378s # hybrid/ 378s # hybrid_cmake.dat # CMake 378s # hybrid_cmake.py # CMake 378s # hybrid_pure.dat # Setuptools 378s # hybrid_pure.py # Setuptools 378s # 378s # data/ 378s # hybrid_data_pure.dat # CMake or Setuptools 378s # hybrid_data_cmake.dat # CMake *NO TEST* 378s # 378s # hybrid_2/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure.py # CMake or Setuptools 378s # hybrid_2_cmake.py # CMake 378s # 378s # hybrid_2_pure/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure_1.py # CMake or Setuptools 378s # hybrid_2_pure_2.py # CMake or Setuptools 378s # 378s # pureModule.py # Setuptools 378s # 378s # pure/ 378s # __init__.py # Setuptools 378s # pure.py # Setuptools 378s # 378s # data/ 378s # pure.dat # Setuptools 378s 378s tmp_dir.join("setup.py").write( 378s textwrap.dedent( 378s """ 378s from skbuild import setup 378s #from setuptools import setup 378s setup( 378s name="test_hybrid_project", 378s version="1.2.3", 378s description=("an hybrid package mixing files installed by both " 378s "CMake and setuptools"), 378s author='The scikit-build team', 378s license="MIT", 378s cmake_source_dir='{cmake_source_dir}', 378s cmake_install_dir='{cmake_install_dir}', 378s # Arbitrary order of packages 378s packages=[ 378s {p_off} 'pure', 378s {h_off} 'hybrid.hybrid_2', 378s {h_off} 'hybrid', 378s {c_off} 'cmake', 378s {p_off} 'hybrid.hybrid_2_pure', 378s ], 378s py_modules=[ 378s {pm_off} '{package_base}pureModule', 378s {cm_off} '{package_base}cmakeModule', 378s ], 378s package_data={{ 378s {p_off} 'pure': ['data/pure.dat'], 378s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 378s }}, 378s # Arbitrary order of package_dir 378s package_dir = {{ 378s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 378s {p_off} 'pure': '{package_base}pure', 378s {h_off} 'hybrid': '{package_base}hybrid', 378s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 378s {c_off} 'cmake': '{package_base}cmake', 378s }} 378s ) 378s """.format( 378s cmake_source_dir=cmake_source_dir, 378s cmake_install_dir=package_base, 378s package_base=package_base_dir, 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s p_off="" if has_pure_package else "#", 378s pm_off="" if has_pure_module else "#", 378s ) 378s ) 378s ) 378s 378s src_dir = tmp_dir.ensure(package_base, dir=1) 378s 378s src_dir.join("CMakeLists.txt").write( 378s textwrap.dedent( 378s """ 378s cmake_minimum_required(VERSION 3.5.0) 378s project(hybrid NONE) 378s set(build_dir ${{CMAKE_BINARY_DIR}}) 378s 378s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 378s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 378s {c_off} install( 378s {c_off} FILES 378s {c_off} ${{build_dir}}/__init__.py 378s {c_off} ${{build_dir}}/cmake.py 378s {c_off} DESTINATION cmake 378s {c_off} ) 378s 378s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 378s {cm_off} install( 378s {cm_off} FILES ${{build_dir}}/cmakeModule.py 378s {cm_off} DESTINATION .) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 378s {h_off} DESTINATION hybrid/data) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 378s {h_off} DESTINATION hybrid/hybrid_2) 378s 378s install(CODE "message(STATUS \\\"Installation complete\\\")") 378s """.format( 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s ) 378s ) 378s ) 378s 378s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 378s path_types: Sequence[str] 378s try: 378s path_types = next( 378s iter( 378s zip( 378s *filter( 378s lambda i: i[1], 378s [ 378s ("c", has_cmake_package), 378s ("cm", has_cmake_module), 378s ("h", has_hybrid_package), 378s ("p", has_pure_package), 378s ("pm", has_pure_module), 378s ], 378s ) 378s ) 378s ) 378s ) 378s except StopIteration: 378s path_types = [] 378s 378s def select_paths(annotated_paths): 378s """Return a filtered list paths considering ``path_types``. 378s 378s `annotated_paths`` is list of tuple ``(type, path)`` where type 378s is either `c`, 'cm', `h`, `p` or 'pm'. 378s 378s """ 378s return filter(lambda i: i[0] in path_types, annotated_paths) 378s 378s # Commented paths are the one expected to be installed by CMake. For 378s # this reason, corresponding files should NOT be created in the source 378s # tree. 378s for _type, path in select_paths( 378s [ 378s # ('c', 'cmake/__init__.py'), 378s # ('c', 'cmake/cmake.py'), 378s # ('cm', 'cmakeModule.py'), 378s ("h", "hybrid/__init__.py"), 378s # ('h', 'hybrid/hybrid_cmake.dat'), 378s # ('h', 'hybrid/hybrid_cmake.py'), 378s ("h", "hybrid/hybrid_pure.dat"), 378s ("h", "hybrid/hybrid_pure.py"), 378s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 378s ("h", "hybrid/data/hybrid_data_pure.dat"), 378s ("h", "hybrid/hybrid_2/__init__.py"), 378s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 378s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 378s ("p", "hybrid/hybrid_2_pure/__init__.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 378s ("pm", "pureModule.py"), 378s ("p", "pure/__init__.py"), 378s ("p", "pure/pure.py"), 378s ("p", "pure/data/pure.dat"), 378s ] 378s ): 378s assert _type in {"p", "pm", "h"} 378s root = package_base if _type in {"p", "pm"} else cmake_source_dir 378s tmp_dir.ensure(os.path.join(root, path)) 378s 378s # Do not call the real setup function. Instead, replace it with 378s # a MagicMock allowing to check with which arguments it was invoked. 378s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 378s 378s # Convenience print function 378s def _pprint(desc, value=None): 378s print( 378s "-----------------\n" 378s f"{desc}:\n" 378s "\n" 378s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 378s ) 378s 378s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 378s 378s _pprint = ._pprint at 0x3ffb602b560> 378s _type = 'pm' 378s cmake_source_dir = '' 378s has_cmake_module = 0 378s has_cmake_package = 1 378s has_hybrid_package = 1 378s has_pure_module = 1 378s has_pure_package = 0 378s mock_setup = 378s mocker = 378s package_base = '' 378s package_base_dir = '' 378s path = 'pureModule.py' 378s path_types = ('c', 'h', 'pm') 378s root = '' 378s select_paths = .select_paths at 0x3ffb602af20> 378s src_dir = local('/tmp/pytest-of-ubuntu/pytest-103/test_setup_inputs0') 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-103/test_setup_inputs0') 378s with_package_base = 0 378s 378s tests/test_setup.py:849: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-103/test_setup_inputs0') 378s setup_args = ['build'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-103/test_setup_inputs0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s ________________________ test_setup_inputs[0-1-0-1-1-0] ________________________ 378s 378s has_cmake_package = 0, has_cmake_module = 1, has_hybrid_package = 1 378s has_pure_package = 0, has_pure_module = 1, with_package_base = 0 378s mocker = 378s 378s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 378s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 378s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_module", [0, 1]) 378s @pytest.mark.parametrize("with_package_base", [0, 1]) 378s def test_setup_inputs( 378s has_cmake_package, 378s has_cmake_module, 378s has_hybrid_package, 378s has_pure_package, 378s has_pure_module, 378s with_package_base, 378s mocker, 378s ): 378s """This test that a project can have a package with some modules 378s installed using setup.py and some other modules installed using CMake. 378s """ 378s 378s tmp_dir = _tmpdir("test_setup_inputs") 378s 378s package_base = "to/the/base" if with_package_base else "" 378s package_base_dir = package_base + "/" if package_base else "" 378s cmake_source_dir = package_base 378s 378s if cmake_source_dir and (has_cmake_package or has_cmake_module): 378s pytest.skip( 378s "unsupported configuration: " 378s "python package fully generated by CMake does *NOT* work. " 378s "At least __init__.py should be in the project source tree" 378s ) 378s 378s # ------------------------------------------------------------------------- 378s # Here is the "SOURCE" tree layout: 378s # 378s # ROOT/ 378s # 378s # setup.py 378s # 378s # [/] 378s # 378s # pureModule.py 378s # 378s # pure/ 378s # __init__.py 378s # pure.py 378s # 378s # data/ 378s # pure.dat 378s # 378s # [/] 378s # 378s # hybrid/ 378s # CMakeLists.txt 378s # __init__.py 378s # hybrid_pure.dat 378s # hybrid_pure.py 378s # 378s # data/ 378s # hybrid_data_pure.dat 378s # 378s # hybrid_2/ 378s # __init__.py 378s # hybrid_2_pure.py 378s # 378s # hybrid_2_pure/ 378s # __init__.py 378s # hybrid_2_pure_1.py 378s # hybrid_2_pure_2.py 378s # 378s # 378s # ------------------------------------------------------------------------- 378s # and here is the "BINARY" distribution layout: 378s # 378s # The comment "CMake" or "Setuptools" indicates which tool is responsible 378s # for placing the file in the tree used to create the binary distribution. 378s # 378s # ROOT/ 378s # 378s # cmakeModule.py # CMake 378s # 378s # cmake/ 378s # __init__.py # CMake 378s # cmake.py # CMake 378s # 378s # hybrid/ 378s # hybrid_cmake.dat # CMake 378s # hybrid_cmake.py # CMake 378s # hybrid_pure.dat # Setuptools 378s # hybrid_pure.py # Setuptools 378s # 378s # data/ 378s # hybrid_data_pure.dat # CMake or Setuptools 378s # hybrid_data_cmake.dat # CMake *NO TEST* 378s # 378s # hybrid_2/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure.py # CMake or Setuptools 378s # hybrid_2_cmake.py # CMake 378s # 378s # hybrid_2_pure/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure_1.py # CMake or Setuptools 378s # hybrid_2_pure_2.py # CMake or Setuptools 378s # 378s # pureModule.py # Setuptools 378s # 378s # pure/ 378s # __init__.py # Setuptools 378s # pure.py # Setuptools 378s # 378s # data/ 378s # pure.dat # Setuptools 378s 378s tmp_dir.join("setup.py").write( 378s textwrap.dedent( 378s """ 378s from skbuild import setup 378s #from setuptools import setup 378s setup( 378s name="test_hybrid_project", 378s version="1.2.3", 378s description=("an hybrid package mixing files installed by both " 378s "CMake and setuptools"), 378s author='The scikit-build team', 378s license="MIT", 378s cmake_source_dir='{cmake_source_dir}', 378s cmake_install_dir='{cmake_install_dir}', 378s # Arbitrary order of packages 378s packages=[ 378s {p_off} 'pure', 378s {h_off} 'hybrid.hybrid_2', 378s {h_off} 'hybrid', 378s {c_off} 'cmake', 378s {p_off} 'hybrid.hybrid_2_pure', 378s ], 378s py_modules=[ 378s {pm_off} '{package_base}pureModule', 378s {cm_off} '{package_base}cmakeModule', 378s ], 378s package_data={{ 378s {p_off} 'pure': ['data/pure.dat'], 378s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 378s }}, 378s # Arbitrary order of package_dir 378s package_dir = {{ 378s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 378s {p_off} 'pure': '{package_base}pure', 378s {h_off} 'hybrid': '{package_base}hybrid', 378s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 378s {c_off} 'cmake': '{package_base}cmake', 378s }} 378s ) 378s """.format( 378s cmake_source_dir=cmake_source_dir, 378s cmake_install_dir=package_base, 378s package_base=package_base_dir, 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s p_off="" if has_pure_package else "#", 378s pm_off="" if has_pure_module else "#", 378s ) 378s ) 378s ) 378s 378s src_dir = tmp_dir.ensure(package_base, dir=1) 378s 378s src_dir.join("CMakeLists.txt").write( 378s textwrap.dedent( 378s """ 378s cmake_minimum_required(VERSION 3.5.0) 378s project(hybrid NONE) 378s set(build_dir ${{CMAKE_BINARY_DIR}}) 378s 378s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 378s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 378s {c_off} install( 378s {c_off} FILES 378s {c_off} ${{build_dir}}/__init__.py 378s {c_off} ${{build_dir}}/cmake.py 378s {c_off} DESTINATION cmake 378s {c_off} ) 378s 378s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 378s {cm_off} install( 378s {cm_off} FILES ${{build_dir}}/cmakeModule.py 378s {cm_off} DESTINATION .) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 378s {h_off} DESTINATION hybrid/data) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 378s {h_off} DESTINATION hybrid/hybrid_2) 378s 378s install(CODE "message(STATUS \\\"Installation complete\\\")") 378s """.format( 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s ) 378s ) 378s ) 378s 378s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 378s path_types: Sequence[str] 378s try: 378s path_types = next( 378s iter( 378s zip( 378s *filter( 378s lambda i: i[1], 378s [ 378s ("c", has_cmake_package), 378s ("cm", has_cmake_module), 378s ("h", has_hybrid_package), 378s ("p", has_pure_package), 378s ("pm", has_pure_module), 378s ], 378s ) 378s ) 378s ) 378s ) 378s except StopIteration: 378s path_types = [] 378s 378s def select_paths(annotated_paths): 378s """Return a filtered list paths considering ``path_types``. 378s 378s `annotated_paths`` is list of tuple ``(type, path)`` where type 378s is either `c`, 'cm', `h`, `p` or 'pm'. 378s 378s """ 378s return filter(lambda i: i[0] in path_types, annotated_paths) 378s 378s # Commented paths are the one expected to be installed by CMake. For 378s # this reason, corresponding files should NOT be created in the source 378s # tree. 378s for _type, path in select_paths( 378s [ 378s # ('c', 'cmake/__init__.py'), 378s # ('c', 'cmake/cmake.py'), 378s # ('cm', 'cmakeModule.py'), 378s ("h", "hybrid/__init__.py"), 378s # ('h', 'hybrid/hybrid_cmake.dat'), 378s # ('h', 'hybrid/hybrid_cmake.py'), 378s ("h", "hybrid/hybrid_pure.dat"), 378s ("h", "hybrid/hybrid_pure.py"), 378s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 378s ("h", "hybrid/data/hybrid_data_pure.dat"), 378s ("h", "hybrid/hybrid_2/__init__.py"), 378s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 378s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 378s ("p", "hybrid/hybrid_2_pure/__init__.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 378s ("pm", "pureModule.py"), 378s ("p", "pure/__init__.py"), 378s ("p", "pure/pure.py"), 378s ("p", "pure/data/pure.dat"), 378s ] 378s ): 378s assert _type in {"p", "pm", "h"} 378s root = package_base if _type in {"p", "pm"} else cmake_source_dir 378s tmp_dir.ensure(os.path.join(root, path)) 378s 378s # Do not call the real setup function. Instead, replace it with 378s # a MagicMock allowing to check with which arguments it was invoked. 378s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 378s 378s # Convenience print function 378s def _pprint(desc, value=None): 378s print( 378s "-----------------\n" 378s f"{desc}:\n" 378s "\n" 378s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 378s ) 378s 378s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 378s 378s _pprint = ._pprint at 0x3ffb602ac00> 378s _type = 'pm' 378s cmake_source_dir = '' 378s has_cmake_module = 1 378s has_cmake_package = 0 378s has_hybrid_package = 1 378s has_pure_module = 1 378s has_pure_package = 0 378s mock_setup = 378s mocker = 378s package_base = '' 378s package_base_dir = '' 378s path = 'pureModule.py' 378s path_types = ('cm', 'h', 'pm') 378s root = '' 378s select_paths = .select_paths at 0x3ffb602a520> 378s src_dir = local('/tmp/pytest-of-ubuntu/pytest-104/test_setup_inputs0') 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-104/test_setup_inputs0') 378s with_package_base = 0 378s 378s tests/test_setup.py:849: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-104/test_setup_inputs0') 378s setup_args = ['build'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-104/test_setup_inputs0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s ________________________ test_setup_inputs[0-1-0-1-1-1] ________________________ 378s 378s has_cmake_package = 1, has_cmake_module = 1, has_hybrid_package = 1 378s has_pure_package = 0, has_pure_module = 1, with_package_base = 0 378s mocker = 378s 378s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 378s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 378s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_module", [0, 1]) 378s @pytest.mark.parametrize("with_package_base", [0, 1]) 378s def test_setup_inputs( 378s has_cmake_package, 378s has_cmake_module, 378s has_hybrid_package, 378s has_pure_package, 378s has_pure_module, 378s with_package_base, 378s mocker, 378s ): 378s """This test that a project can have a package with some modules 378s installed using setup.py and some other modules installed using CMake. 378s """ 378s 378s tmp_dir = _tmpdir("test_setup_inputs") 378s 378s package_base = "to/the/base" if with_package_base else "" 378s package_base_dir = package_base + "/" if package_base else "" 378s cmake_source_dir = package_base 378s 378s if cmake_source_dir and (has_cmake_package or has_cmake_module): 378s pytest.skip( 378s "unsupported configuration: " 378s "python package fully generated by CMake does *NOT* work. " 378s "At least __init__.py should be in the project source tree" 378s ) 378s 378s # ------------------------------------------------------------------------- 378s # Here is the "SOURCE" tree layout: 378s # 378s # ROOT/ 378s # 378s # setup.py 378s # 378s # [/] 378s # 378s # pureModule.py 378s # 378s # pure/ 378s # __init__.py 378s # pure.py 378s # 378s # data/ 378s # pure.dat 378s # 378s # [/] 378s # 378s # hybrid/ 378s # CMakeLists.txt 378s # __init__.py 378s # hybrid_pure.dat 378s # hybrid_pure.py 378s # 378s # data/ 378s # hybrid_data_pure.dat 378s # 378s # hybrid_2/ 378s # __init__.py 378s # hybrid_2_pure.py 378s # 378s # hybrid_2_pure/ 378s # __init__.py 378s # hybrid_2_pure_1.py 378s # hybrid_2_pure_2.py 378s # 378s # 378s # ------------------------------------------------------------------------- 378s # and here is the "BINARY" distribution layout: 378s # 378s # The comment "CMake" or "Setuptools" indicates which tool is responsible 378s # for placing the file in the tree used to create the binary distribution. 378s # 378s # ROOT/ 378s # 378s # cmakeModule.py # CMake 378s # 378s # cmake/ 378s # __init__.py # CMake 378s # cmake.py # CMake 378s # 378s # hybrid/ 378s # hybrid_cmake.dat # CMake 378s # hybrid_cmake.py # CMake 378s # hybrid_pure.dat # Setuptools 378s # hybrid_pure.py # Setuptools 378s # 378s # data/ 378s # hybrid_data_pure.dat # CMake or Setuptools 378s # hybrid_data_cmake.dat # CMake *NO TEST* 378s # 378s # hybrid_2/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure.py # CMake or Setuptools 378s # hybrid_2_cmake.py # CMake 378s # 378s # hybrid_2_pure/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure_1.py # CMake or Setuptools 378s # hybrid_2_pure_2.py # CMake or Setuptools 378s # 378s # pureModule.py # Setuptools 378s # 378s # pure/ 378s # __init__.py # Setuptools 378s # pure.py # Setuptools 378s # 378s # data/ 378s # pure.dat # Setuptools 378s 378s tmp_dir.join("setup.py").write( 378s textwrap.dedent( 378s """ 378s from skbuild import setup 378s #from setuptools import setup 378s setup( 378s name="test_hybrid_project", 378s version="1.2.3", 378s description=("an hybrid package mixing files installed by both " 378s "CMake and setuptools"), 378s author='The scikit-build team', 378s license="MIT", 378s cmake_source_dir='{cmake_source_dir}', 378s cmake_install_dir='{cmake_install_dir}', 378s # Arbitrary order of packages 378s packages=[ 378s {p_off} 'pure', 378s {h_off} 'hybrid.hybrid_2', 378s {h_off} 'hybrid', 378s {c_off} 'cmake', 378s {p_off} 'hybrid.hybrid_2_pure', 378s ], 378s py_modules=[ 378s {pm_off} '{package_base}pureModule', 378s {cm_off} '{package_base}cmakeModule', 378s ], 378s package_data={{ 378s {p_off} 'pure': ['data/pure.dat'], 378s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 378s }}, 378s # Arbitrary order of package_dir 378s package_dir = {{ 378s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 378s {p_off} 'pure': '{package_base}pure', 378s {h_off} 'hybrid': '{package_base}hybrid', 378s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 378s {c_off} 'cmake': '{package_base}cmake', 378s }} 378s ) 378s """.format( 378s cmake_source_dir=cmake_source_dir, 378s cmake_install_dir=package_base, 378s package_base=package_base_dir, 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s p_off="" if has_pure_package else "#", 378s pm_off="" if has_pure_module else "#", 378s ) 378s ) 378s ) 378s 378s src_dir = tmp_dir.ensure(package_base, dir=1) 378s 378s src_dir.join("CMakeLists.txt").write( 378s textwrap.dedent( 378s """ 378s cmake_minimum_required(VERSION 3.5.0) 378s project(hybrid NONE) 378s set(build_dir ${{CMAKE_BINARY_DIR}}) 378s 378s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 378s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 378s {c_off} install( 378s {c_off} FILES 378s {c_off} ${{build_dir}}/__init__.py 378s {c_off} ${{build_dir}}/cmake.py 378s {c_off} DESTINATION cmake 378s {c_off} ) 378s 378s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 378s {cm_off} install( 378s {cm_off} FILES ${{build_dir}}/cmakeModule.py 378s {cm_off} DESTINATION .) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 378s {h_off} DESTINATION hybrid/data) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 378s {h_off} DESTINATION hybrid/hybrid_2) 378s 378s install(CODE "message(STATUS \\\"Installation complete\\\")") 378s """.format( 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s ) 378s ) 378s ) 378s 378s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 378s path_types: Sequence[str] 378s try: 378s path_types = next( 378s iter( 378s zip( 378s *filter( 378s lambda i: i[1], 378s [ 378s ("c", has_cmake_package), 378s ("cm", has_cmake_module), 378s ("h", has_hybrid_package), 378s ("p", has_pure_package), 378s ("pm", has_pure_module), 378s ], 378s ) 378s ) 378s ) 378s ) 378s except StopIteration: 378s path_types = [] 378s 378s def select_paths(annotated_paths): 378s """Return a filtered list paths considering ``path_types``. 378s 378s `annotated_paths`` is list of tuple ``(type, path)`` where type 378s is either `c`, 'cm', `h`, `p` or 'pm'. 378s 378s """ 378s return filter(lambda i: i[0] in path_types, annotated_paths) 378s 378s # Commented paths are the one expected to be installed by CMake. For 378s # this reason, corresponding files should NOT be created in the source 378s # tree. 378s for _type, path in select_paths( 378s [ 378s # ('c', 'cmake/__init__.py'), 378s # ('c', 'cmake/cmake.py'), 378s # ('cm', 'cmakeModule.py'), 378s ("h", "hybrid/__init__.py"), 378s # ('h', 'hybrid/hybrid_cmake.dat'), 378s # ('h', 'hybrid/hybrid_cmake.py'), 378s ("h", "hybrid/hybrid_pure.dat"), 378s ("h", "hybrid/hybrid_pure.py"), 378s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 378s ("h", "hybrid/data/hybrid_data_pure.dat"), 378s ("h", "hybrid/hybrid_2/__init__.py"), 378s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 378s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 378s ("p", "hybrid/hybrid_2_pure/__init__.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 378s ("pm", "pureModule.py"), 378s ("p", "pure/__init__.py"), 378s ("p", "pure/pure.py"), 378s ("p", "pure/data/pure.dat"), 378s ] 378s ): 378s assert _type in {"p", "pm", "h"} 378s root = package_base if _type in {"p", "pm"} else cmake_source_dir 378s tmp_dir.ensure(os.path.join(root, path)) 378s 378s # Do not call the real setup function. Instead, replace it with 378s # a MagicMock allowing to check with which arguments it was invoked. 378s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 378s 378s # Convenience print function 378s def _pprint(desc, value=None): 378s print( 378s "-----------------\n" 378s f"{desc}:\n" 378s "\n" 378s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 378s ) 378s 378s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 378s 378s _pprint = ._pprint at 0x3ffb5e382c0> 378s _type = 'pm' 378s cmake_source_dir = '' 378s has_cmake_module = 1 378s has_cmake_package = 1 378s has_hybrid_package = 1 378s has_pure_module = 1 378s has_pure_package = 0 378s mock_setup = 378s mocker = 378s package_base = '' 378s package_base_dir = '' 378s path = 'pureModule.py' 378s path_types = ('c', 'cm', 'h', 'pm') 378s root = '' 378s select_paths = .select_paths at 0x3ffb602bb00> 378s src_dir = local('/tmp/pytest-of-ubuntu/pytest-105/test_setup_inputs0') 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-105/test_setup_inputs0') 378s with_package_base = 0 378s 378s tests/test_setup.py:849: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-105/test_setup_inputs0') 378s setup_args = ['build'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-105/test_setup_inputs0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s ________________________ test_setup_inputs[0-1-1-0-0-0] ________________________ 378s 378s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 0 378s has_pure_package = 1, has_pure_module = 1, with_package_base = 0 378s mocker = 378s 378s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 378s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 378s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_module", [0, 1]) 378s @pytest.mark.parametrize("with_package_base", [0, 1]) 378s def test_setup_inputs( 378s has_cmake_package, 378s has_cmake_module, 378s has_hybrid_package, 378s has_pure_package, 378s has_pure_module, 378s with_package_base, 378s mocker, 378s ): 378s """This test that a project can have a package with some modules 378s installed using setup.py and some other modules installed using CMake. 378s """ 378s 378s tmp_dir = _tmpdir("test_setup_inputs") 378s 378s package_base = "to/the/base" if with_package_base else "" 378s package_base_dir = package_base + "/" if package_base else "" 378s cmake_source_dir = package_base 378s 378s if cmake_source_dir and (has_cmake_package or has_cmake_module): 378s pytest.skip( 378s "unsupported configuration: " 378s "python package fully generated by CMake does *NOT* work. " 378s "At least __init__.py should be in the project source tree" 378s ) 378s 378s # ------------------------------------------------------------------------- 378s # Here is the "SOURCE" tree layout: 378s # 378s # ROOT/ 378s # 378s # setup.py 378s # 378s # [/] 378s # 378s # pureModule.py 378s # 378s # pure/ 378s # __init__.py 378s # pure.py 378s # 378s # data/ 378s # pure.dat 378s # 378s # [/] 378s # 378s # hybrid/ 378s # CMakeLists.txt 378s # __init__.py 378s # hybrid_pure.dat 378s # hybrid_pure.py 378s # 378s # data/ 378s # hybrid_data_pure.dat 378s # 378s # hybrid_2/ 378s # __init__.py 378s # hybrid_2_pure.py 378s # 378s # hybrid_2_pure/ 378s # __init__.py 378s # hybrid_2_pure_1.py 378s # hybrid_2_pure_2.py 378s # 378s # 378s # ------------------------------------------------------------------------- 378s # and here is the "BINARY" distribution layout: 378s # 378s # The comment "CMake" or "Setuptools" indicates which tool is responsible 378s # for placing the file in the tree used to create the binary distribution. 378s # 378s # ROOT/ 378s # 378s # cmakeModule.py # CMake 378s # 378s # cmake/ 378s # __init__.py # CMake 378s # cmake.py # CMake 378s # 378s # hybrid/ 378s # hybrid_cmake.dat # CMake 378s # hybrid_cmake.py # CMake 378s # hybrid_pure.dat # Setuptools 378s # hybrid_pure.py # Setuptools 378s # 378s # data/ 378s # hybrid_data_pure.dat # CMake or Setuptools 378s # hybrid_data_cmake.dat # CMake *NO TEST* 378s # 378s # hybrid_2/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure.py # CMake or Setuptools 378s # hybrid_2_cmake.py # CMake 378s # 378s # hybrid_2_pure/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure_1.py # CMake or Setuptools 378s # hybrid_2_pure_2.py # CMake or Setuptools 378s # 378s # pureModule.py # Setuptools 378s # 378s # pure/ 378s # __init__.py # Setuptools 378s # pure.py # Setuptools 378s # 378s # data/ 378s # pure.dat # Setuptools 378s 378s tmp_dir.join("setup.py").write( 378s textwrap.dedent( 378s """ 378s from skbuild import setup 378s #from setuptools import setup 378s setup( 378s name="test_hybrid_project", 378s version="1.2.3", 378s description=("an hybrid package mixing files installed by both " 378s "CMake and setuptools"), 378s author='The scikit-build team', 378s license="MIT", 378s cmake_source_dir='{cmake_source_dir}', 378s cmake_install_dir='{cmake_install_dir}', 378s # Arbitrary order of packages 378s packages=[ 378s {p_off} 'pure', 378s {h_off} 'hybrid.hybrid_2', 378s {h_off} 'hybrid', 378s {c_off} 'cmake', 378s {p_off} 'hybrid.hybrid_2_pure', 378s ], 378s py_modules=[ 378s {pm_off} '{package_base}pureModule', 378s {cm_off} '{package_base}cmakeModule', 378s ], 378s package_data={{ 378s {p_off} 'pure': ['data/pure.dat'], 378s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 378s }}, 378s # Arbitrary order of package_dir 378s package_dir = {{ 378s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 378s {p_off} 'pure': '{package_base}pure', 378s {h_off} 'hybrid': '{package_base}hybrid', 378s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 378s {c_off} 'cmake': '{package_base}cmake', 378s }} 378s ) 378s """.format( 378s cmake_source_dir=cmake_source_dir, 378s cmake_install_dir=package_base, 378s package_base=package_base_dir, 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s p_off="" if has_pure_package else "#", 378s pm_off="" if has_pure_module else "#", 378s ) 378s ) 378s ) 378s 378s src_dir = tmp_dir.ensure(package_base, dir=1) 378s 378s src_dir.join("CMakeLists.txt").write( 378s textwrap.dedent( 378s """ 378s cmake_minimum_required(VERSION 3.5.0) 378s project(hybrid NONE) 378s set(build_dir ${{CMAKE_BINARY_DIR}}) 378s 378s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 378s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 378s {c_off} install( 378s {c_off} FILES 378s {c_off} ${{build_dir}}/__init__.py 378s {c_off} ${{build_dir}}/cmake.py 378s {c_off} DESTINATION cmake 378s {c_off} ) 378s 378s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 378s {cm_off} install( 378s {cm_off} FILES ${{build_dir}}/cmakeModule.py 378s {cm_off} DESTINATION .) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 378s {h_off} DESTINATION hybrid/data) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 378s {h_off} DESTINATION hybrid/hybrid_2) 378s 378s install(CODE "message(STATUS \\\"Installation complete\\\")") 378s """.format( 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s ) 378s ) 378s ) 378s 378s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 378s path_types: Sequence[str] 378s try: 378s path_types = next( 378s iter( 378s zip( 378s *filter( 378s lambda i: i[1], 378s [ 378s ("c", has_cmake_package), 378s ("cm", has_cmake_module), 378s ("h", has_hybrid_package), 378s ("p", has_pure_package), 378s ("pm", has_pure_module), 378s ], 378s ) 378s ) 378s ) 378s ) 378s except StopIteration: 378s path_types = [] 378s 378s def select_paths(annotated_paths): 378s """Return a filtered list paths considering ``path_types``. 378s 378s `annotated_paths`` is list of tuple ``(type, path)`` where type 378s is either `c`, 'cm', `h`, `p` or 'pm'. 378s 378s """ 378s return filter(lambda i: i[0] in path_types, annotated_paths) 378s 378s # Commented paths are the one expected to be installed by CMake. For 378s # this reason, corresponding files should NOT be created in the source 378s # tree. 378s for _type, path in select_paths( 378s [ 378s # ('c', 'cmake/__init__.py'), 378s # ('c', 'cmake/cmake.py'), 378s # ('cm', 'cmakeModule.py'), 378s ("h", "hybrid/__init__.py"), 378s # ('h', 'hybrid/hybrid_cmake.dat'), 378s # ('h', 'hybrid/hybrid_cmake.py'), 378s ("h", "hybrid/hybrid_pure.dat"), 378s ("h", "hybrid/hybrid_pure.py"), 378s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 378s ("h", "hybrid/data/hybrid_data_pure.dat"), 378s ("h", "hybrid/hybrid_2/__init__.py"), 378s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 378s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 378s ("p", "hybrid/hybrid_2_pure/__init__.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 378s ("pm", "pureModule.py"), 378s ("p", "pure/__init__.py"), 378s ("p", "pure/pure.py"), 378s ("p", "pure/data/pure.dat"), 378s ] 378s ): 378s assert _type in {"p", "pm", "h"} 378s root = package_base if _type in {"p", "pm"} else cmake_source_dir 378s tmp_dir.ensure(os.path.join(root, path)) 378s 378s # Do not call the real setup function. Instead, replace it with 378s # a MagicMock allowing to check with which arguments it was invoked. 378s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 378s 378s # Convenience print function 378s def _pprint(desc, value=None): 378s print( 378s "-----------------\n" 378s f"{desc}:\n" 378s "\n" 378s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 378s ) 378s 378s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 378s 378s _pprint = ._pprint at 0x3ffb5e385e0> 378s _type = 'p' 378s cmake_source_dir = '' 378s has_cmake_module = 0 378s has_cmake_package = 0 378s has_hybrid_package = 0 378s has_pure_module = 1 378s has_pure_package = 1 378s mock_setup = 378s mocker = 378s package_base = '' 378s package_base_dir = '' 378s path = 'pure/data/pure.dat' 378s path_types = ('p', 'pm') 378s root = '' 378s select_paths = .select_paths at 0x3ffb5e384a0> 378s src_dir = local('/tmp/pytest-of-ubuntu/pytest-106/test_setup_inputs0') 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-106/test_setup_inputs0') 378s with_package_base = 0 378s 378s tests/test_setup.py:849: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-106/test_setup_inputs0') 378s setup_args = ['build'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-106/test_setup_inputs0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s ________________________ test_setup_inputs[0-1-1-0-0-1] ________________________ 378s 378s has_cmake_package = 1, has_cmake_module = 0, has_hybrid_package = 0 378s has_pure_package = 1, has_pure_module = 1, with_package_base = 0 378s mocker = 378s 378s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 378s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 378s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_module", [0, 1]) 378s @pytest.mark.parametrize("with_package_base", [0, 1]) 378s def test_setup_inputs( 378s has_cmake_package, 378s has_cmake_module, 378s has_hybrid_package, 378s has_pure_package, 378s has_pure_module, 378s with_package_base, 378s mocker, 378s ): 378s """This test that a project can have a package with some modules 378s installed using setup.py and some other modules installed using CMake. 378s """ 378s 378s tmp_dir = _tmpdir("test_setup_inputs") 378s 378s package_base = "to/the/base" if with_package_base else "" 378s package_base_dir = package_base + "/" if package_base else "" 378s cmake_source_dir = package_base 378s 378s if cmake_source_dir and (has_cmake_package or has_cmake_module): 378s pytest.skip( 378s "unsupported configuration: " 378s "python package fully generated by CMake does *NOT* work. " 378s "At least __init__.py should be in the project source tree" 378s ) 378s 378s # ------------------------------------------------------------------------- 378s # Here is the "SOURCE" tree layout: 378s # 378s # ROOT/ 378s # 378s # setup.py 378s # 378s # [/] 378s # 378s # pureModule.py 378s # 378s # pure/ 378s # __init__.py 378s # pure.py 378s # 378s # data/ 378s # pure.dat 378s # 378s # [/] 378s # 378s # hybrid/ 378s # CMakeLists.txt 378s # __init__.py 378s # hybrid_pure.dat 378s # hybrid_pure.py 378s # 378s # data/ 378s # hybrid_data_pure.dat 378s # 378s # hybrid_2/ 378s # __init__.py 378s # hybrid_2_pure.py 378s # 378s # hybrid_2_pure/ 378s # __init__.py 378s # hybrid_2_pure_1.py 378s # hybrid_2_pure_2.py 378s # 378s # 378s # ------------------------------------------------------------------------- 378s # and here is the "BINARY" distribution layout: 378s # 378s # The comment "CMake" or "Setuptools" indicates which tool is responsible 378s # for placing the file in the tree used to create the binary distribution. 378s # 378s # ROOT/ 378s # 378s # cmakeModule.py # CMake 378s # 378s # cmake/ 378s # __init__.py # CMake 378s # cmake.py # CMake 378s # 378s # hybrid/ 378s # hybrid_cmake.dat # CMake 378s # hybrid_cmake.py # CMake 378s # hybrid_pure.dat # Setuptools 378s # hybrid_pure.py # Setuptools 378s # 378s # data/ 378s # hybrid_data_pure.dat # CMake or Setuptools 378s # hybrid_data_cmake.dat # CMake *NO TEST* 378s # 378s # hybrid_2/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure.py # CMake or Setuptools 378s # hybrid_2_cmake.py # CMake 378s # 378s # hybrid_2_pure/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure_1.py # CMake or Setuptools 378s # hybrid_2_pure_2.py # CMake or Setuptools 378s # 378s # pureModule.py # Setuptools 378s # 378s # pure/ 378s # __init__.py # Setuptools 378s # pure.py # Setuptools 378s # 378s # data/ 378s # pure.dat # Setuptools 378s 378s tmp_dir.join("setup.py").write( 378s textwrap.dedent( 378s """ 378s from skbuild import setup 378s #from setuptools import setup 378s setup( 378s name="test_hybrid_project", 378s version="1.2.3", 378s description=("an hybrid package mixing files installed by both " 378s "CMake and setuptools"), 378s author='The scikit-build team', 378s license="MIT", 378s cmake_source_dir='{cmake_source_dir}', 378s cmake_install_dir='{cmake_install_dir}', 378s # Arbitrary order of packages 378s packages=[ 378s {p_off} 'pure', 378s {h_off} 'hybrid.hybrid_2', 378s {h_off} 'hybrid', 378s {c_off} 'cmake', 378s {p_off} 'hybrid.hybrid_2_pure', 378s ], 378s py_modules=[ 378s {pm_off} '{package_base}pureModule', 378s {cm_off} '{package_base}cmakeModule', 378s ], 378s package_data={{ 378s {p_off} 'pure': ['data/pure.dat'], 378s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 378s }}, 378s # Arbitrary order of package_dir 378s package_dir = {{ 378s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 378s {p_off} 'pure': '{package_base}pure', 378s {h_off} 'hybrid': '{package_base}hybrid', 378s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 378s {c_off} 'cmake': '{package_base}cmake', 378s }} 378s ) 378s """.format( 378s cmake_source_dir=cmake_source_dir, 378s cmake_install_dir=package_base, 378s package_base=package_base_dir, 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s p_off="" if has_pure_package else "#", 378s pm_off="" if has_pure_module else "#", 378s ) 378s ) 378s ) 378s 378s src_dir = tmp_dir.ensure(package_base, dir=1) 378s 378s src_dir.join("CMakeLists.txt").write( 378s textwrap.dedent( 378s """ 378s cmake_minimum_required(VERSION 3.5.0) 378s project(hybrid NONE) 378s set(build_dir ${{CMAKE_BINARY_DIR}}) 378s 378s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 378s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 378s {c_off} install( 378s {c_off} FILES 378s {c_off} ${{build_dir}}/__init__.py 378s {c_off} ${{build_dir}}/cmake.py 378s {c_off} DESTINATION cmake 378s {c_off} ) 378s 378s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 378s {cm_off} install( 378s {cm_off} FILES ${{build_dir}}/cmakeModule.py 378s {cm_off} DESTINATION .) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 378s {h_off} DESTINATION hybrid/data) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 378s {h_off} DESTINATION hybrid/hybrid_2) 378s 378s install(CODE "message(STATUS \\\"Installation complete\\\")") 378s """.format( 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s ) 378s ) 378s ) 378s 378s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 378s path_types: Sequence[str] 378s try: 378s path_types = next( 378s iter( 378s zip( 378s *filter( 378s lambda i: i[1], 378s [ 378s ("c", has_cmake_package), 378s ("cm", has_cmake_module), 378s ("h", has_hybrid_package), 378s ("p", has_pure_package), 378s ("pm", has_pure_module), 378s ], 378s ) 378s ) 378s ) 378s ) 378s except StopIteration: 378s path_types = [] 378s 378s def select_paths(annotated_paths): 378s """Return a filtered list paths considering ``path_types``. 378s 378s `annotated_paths`` is list of tuple ``(type, path)`` where type 378s is either `c`, 'cm', `h`, `p` or 'pm'. 378s 378s """ 378s return filter(lambda i: i[0] in path_types, annotated_paths) 378s 378s # Commented paths are the one expected to be installed by CMake. For 378s # this reason, corresponding files should NOT be created in the source 378s # tree. 378s for _type, path in select_paths( 378s [ 378s # ('c', 'cmake/__init__.py'), 378s # ('c', 'cmake/cmake.py'), 378s # ('cm', 'cmakeModule.py'), 378s ("h", "hybrid/__init__.py"), 378s # ('h', 'hybrid/hybrid_cmake.dat'), 378s # ('h', 'hybrid/hybrid_cmake.py'), 378s ("h", "hybrid/hybrid_pure.dat"), 378s ("h", "hybrid/hybrid_pure.py"), 378s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 378s ("h", "hybrid/data/hybrid_data_pure.dat"), 378s ("h", "hybrid/hybrid_2/__init__.py"), 378s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 378s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 378s ("p", "hybrid/hybrid_2_pure/__init__.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 378s ("pm", "pureModule.py"), 378s ("p", "pure/__init__.py"), 378s ("p", "pure/pure.py"), 378s ("p", "pure/data/pure.dat"), 378s ] 378s ): 378s assert _type in {"p", "pm", "h"} 378s root = package_base if _type in {"p", "pm"} else cmake_source_dir 378s tmp_dir.ensure(os.path.join(root, path)) 378s 378s # Do not call the real setup function. Instead, replace it with 378s # a MagicMock allowing to check with which arguments it was invoked. 378s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 378s 378s # Convenience print function 378s def _pprint(desc, value=None): 378s print( 378s "-----------------\n" 378s f"{desc}:\n" 378s "\n" 378s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 378s ) 378s 378s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 378s 378s _pprint = ._pprint at 0x3ffb602ac00> 378s _type = 'p' 378s cmake_source_dir = '' 378s has_cmake_module = 0 378s has_cmake_package = 1 378s has_hybrid_package = 0 378s has_pure_module = 1 378s has_pure_package = 1 378s mock_setup = 378s mocker = 378s package_base = '' 378s package_base_dir = '' 378s path = 'pure/data/pure.dat' 378s path_types = ('c', 'p', 'pm') 378s root = '' 378s select_paths = .select_paths at 0x3ffb602b880> 378s src_dir = local('/tmp/pytest-of-ubuntu/pytest-107/test_setup_inputs0') 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-107/test_setup_inputs0') 378s with_package_base = 0 378s 378s tests/test_setup.py:849: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-107/test_setup_inputs0') 378s setup_args = ['build'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-107/test_setup_inputs0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s ________________________ test_setup_inputs[0-1-1-0-1-0] ________________________ 378s 378s has_cmake_package = 0, has_cmake_module = 1, has_hybrid_package = 0 378s has_pure_package = 1, has_pure_module = 1, with_package_base = 0 378s mocker = 378s 378s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 378s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 378s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_module", [0, 1]) 378s @pytest.mark.parametrize("with_package_base", [0, 1]) 378s def test_setup_inputs( 378s has_cmake_package, 378s has_cmake_module, 378s has_hybrid_package, 378s has_pure_package, 378s has_pure_module, 378s with_package_base, 378s mocker, 378s ): 378s """This test that a project can have a package with some modules 378s installed using setup.py and some other modules installed using CMake. 378s """ 378s 378s tmp_dir = _tmpdir("test_setup_inputs") 378s 378s package_base = "to/the/base" if with_package_base else "" 378s package_base_dir = package_base + "/" if package_base else "" 378s cmake_source_dir = package_base 378s 378s if cmake_source_dir and (has_cmake_package or has_cmake_module): 378s pytest.skip( 378s "unsupported configuration: " 378s "python package fully generated by CMake does *NOT* work. " 378s "At least __init__.py should be in the project source tree" 378s ) 378s 378s # ------------------------------------------------------------------------- 378s # Here is the "SOURCE" tree layout: 378s # 378s # ROOT/ 378s # 378s # setup.py 378s # 378s # [/] 378s # 378s # pureModule.py 378s # 378s # pure/ 378s # __init__.py 378s # pure.py 378s # 378s # data/ 378s # pure.dat 378s # 378s # [/] 378s # 378s # hybrid/ 378s # CMakeLists.txt 378s # __init__.py 378s # hybrid_pure.dat 378s # hybrid_pure.py 378s # 378s # data/ 378s # hybrid_data_pure.dat 378s # 378s # hybrid_2/ 378s # __init__.py 378s # hybrid_2_pure.py 378s # 378s # hybrid_2_pure/ 378s # __init__.py 378s # hybrid_2_pure_1.py 378s # hybrid_2_pure_2.py 378s # 378s # 378s # ------------------------------------------------------------------------- 378s # and here is the "BINARY" distribution layout: 378s # 378s # The comment "CMake" or "Setuptools" indicates which tool is responsible 378s # for placing the file in the tree used to create the binary distribution. 378s # 378s # ROOT/ 378s # 378s # cmakeModule.py # CMake 378s # 378s # cmake/ 378s # __init__.py # CMake 378s # cmake.py # CMake 378s # 378s # hybrid/ 378s # hybrid_cmake.dat # CMake 378s # hybrid_cmake.py # CMake 378s # hybrid_pure.dat # Setuptools 378s # hybrid_pure.py # Setuptools 378s # 378s # data/ 378s # hybrid_data_pure.dat # CMake or Setuptools 378s # hybrid_data_cmake.dat # CMake *NO TEST* 378s # 378s # hybrid_2/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure.py # CMake or Setuptools 378s # hybrid_2_cmake.py # CMake 378s # 378s # hybrid_2_pure/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure_1.py # CMake or Setuptools 378s # hybrid_2_pure_2.py # CMake or Setuptools 378s # 378s # pureModule.py # Setuptools 378s # 378s # pure/ 378s # __init__.py # Setuptools 378s # pure.py # Setuptools 378s # 378s # data/ 378s # pure.dat # Setuptools 378s 378s tmp_dir.join("setup.py").write( 378s textwrap.dedent( 378s """ 378s from skbuild import setup 378s #from setuptools import setup 378s setup( 378s name="test_hybrid_project", 378s version="1.2.3", 378s description=("an hybrid package mixing files installed by both " 378s "CMake and setuptools"), 378s author='The scikit-build team', 378s license="MIT", 378s cmake_source_dir='{cmake_source_dir}', 378s cmake_install_dir='{cmake_install_dir}', 378s # Arbitrary order of packages 378s packages=[ 378s {p_off} 'pure', 378s {h_off} 'hybrid.hybrid_2', 378s {h_off} 'hybrid', 378s {c_off} 'cmake', 378s {p_off} 'hybrid.hybrid_2_pure', 378s ], 378s py_modules=[ 378s {pm_off} '{package_base}pureModule', 378s {cm_off} '{package_base}cmakeModule', 378s ], 378s package_data={{ 378s {p_off} 'pure': ['data/pure.dat'], 378s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 378s }}, 378s # Arbitrary order of package_dir 378s package_dir = {{ 378s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 378s {p_off} 'pure': '{package_base}pure', 378s {h_off} 'hybrid': '{package_base}hybrid', 378s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 378s {c_off} 'cmake': '{package_base}cmake', 378s }} 378s ) 378s """.format( 378s cmake_source_dir=cmake_source_dir, 378s cmake_install_dir=package_base, 378s package_base=package_base_dir, 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s p_off="" if has_pure_package else "#", 378s pm_off="" if has_pure_module else "#", 378s ) 378s ) 378s ) 378s 378s src_dir = tmp_dir.ensure(package_base, dir=1) 378s 378s src_dir.join("CMakeLists.txt").write( 378s textwrap.dedent( 378s """ 378s cmake_minimum_required(VERSION 3.5.0) 378s project(hybrid NONE) 378s set(build_dir ${{CMAKE_BINARY_DIR}}) 378s 378s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 378s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 378s {c_off} install( 378s {c_off} FILES 378s {c_off} ${{build_dir}}/__init__.py 378s {c_off} ${{build_dir}}/cmake.py 378s {c_off} DESTINATION cmake 378s {c_off} ) 378s 378s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 378s {cm_off} install( 378s {cm_off} FILES ${{build_dir}}/cmakeModule.py 378s {cm_off} DESTINATION .) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 378s {h_off} DESTINATION hybrid/data) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 378s {h_off} DESTINATION hybrid/hybrid_2) 378s 378s install(CODE "message(STATUS \\\"Installation complete\\\")") 378s """.format( 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s ) 378s ) 378s ) 378s 378s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 378s path_types: Sequence[str] 378s try: 378s path_types = next( 378s iter( 378s zip( 378s *filter( 378s lambda i: i[1], 378s [ 378s ("c", has_cmake_package), 378s ("cm", has_cmake_module), 378s ("h", has_hybrid_package), 378s ("p", has_pure_package), 378s ("pm", has_pure_module), 378s ], 378s ) 378s ) 378s ) 378s ) 378s except StopIteration: 378s path_types = [] 378s 378s def select_paths(annotated_paths): 378s """Return a filtered list paths considering ``path_types``. 378s 378s `annotated_paths`` is list of tuple ``(type, path)`` where type 378s is either `c`, 'cm', `h`, `p` or 'pm'. 378s 378s """ 378s return filter(lambda i: i[0] in path_types, annotated_paths) 378s 378s # Commented paths are the one expected to be installed by CMake. For 378s # this reason, corresponding files should NOT be created in the source 378s # tree. 378s for _type, path in select_paths( 378s [ 378s # ('c', 'cmake/__init__.py'), 378s # ('c', 'cmake/cmake.py'), 378s # ('cm', 'cmakeModule.py'), 378s ("h", "hybrid/__init__.py"), 378s # ('h', 'hybrid/hybrid_cmake.dat'), 378s # ('h', 'hybrid/hybrid_cmake.py'), 378s ("h", "hybrid/hybrid_pure.dat"), 378s ("h", "hybrid/hybrid_pure.py"), 378s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 378s ("h", "hybrid/data/hybrid_data_pure.dat"), 378s ("h", "hybrid/hybrid_2/__init__.py"), 378s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 378s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 378s ("p", "hybrid/hybrid_2_pure/__init__.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 378s ("pm", "pureModule.py"), 378s ("p", "pure/__init__.py"), 378s ("p", "pure/pure.py"), 378s ("p", "pure/data/pure.dat"), 378s ] 378s ): 378s assert _type in {"p", "pm", "h"} 378s root = package_base if _type in {"p", "pm"} else cmake_source_dir 378s tmp_dir.ensure(os.path.join(root, path)) 378s 378s # Do not call the real setup function. Instead, replace it with 378s # a MagicMock allowing to check with which arguments it was invoked. 378s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 378s 378s # Convenience print function 378s def _pprint(desc, value=None): 378s print( 378s "-----------------\n" 378s f"{desc}:\n" 378s "\n" 378s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 378s ) 378s 378s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 378s 378s _pprint = ._pprint at 0x3ffb602b600> 378s _type = 'p' 378s cmake_source_dir = '' 378s has_cmake_module = 1 378s has_cmake_package = 0 378s has_hybrid_package = 0 378s has_pure_module = 1 378s has_pure_package = 1 378s mock_setup = 378s mocker = 378s package_base = '' 378s package_base_dir = '' 378s path = 'pure/data/pure.dat' 378s path_types = ('cm', 'p', 'pm') 378s root = '' 378s select_paths = .select_paths at 0x3ffb6029ee0> 378s src_dir = local('/tmp/pytest-of-ubuntu/pytest-108/test_setup_inputs0') 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-108/test_setup_inputs0') 378s with_package_base = 0 378s 378s tests/test_setup.py:849: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-108/test_setup_inputs0') 378s setup_args = ['build'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-108/test_setup_inputs0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s ________________________ test_setup_inputs[0-1-1-0-1-1] ________________________ 378s 378s has_cmake_package = 1, has_cmake_module = 1, has_hybrid_package = 0 378s has_pure_package = 1, has_pure_module = 1, with_package_base = 0 378s mocker = 378s 378s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 378s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 378s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_module", [0, 1]) 378s @pytest.mark.parametrize("with_package_base", [0, 1]) 378s def test_setup_inputs( 378s has_cmake_package, 378s has_cmake_module, 378s has_hybrid_package, 378s has_pure_package, 378s has_pure_module, 378s with_package_base, 378s mocker, 378s ): 378s """This test that a project can have a package with some modules 378s installed using setup.py and some other modules installed using CMake. 378s """ 378s 378s tmp_dir = _tmpdir("test_setup_inputs") 378s 378s package_base = "to/the/base" if with_package_base else "" 378s package_base_dir = package_base + "/" if package_base else "" 378s cmake_source_dir = package_base 378s 378s if cmake_source_dir and (has_cmake_package or has_cmake_module): 378s pytest.skip( 378s "unsupported configuration: " 378s "python package fully generated by CMake does *NOT* work. " 378s "At least __init__.py should be in the project source tree" 378s ) 378s 378s # ------------------------------------------------------------------------- 378s # Here is the "SOURCE" tree layout: 378s # 378s # ROOT/ 378s # 378s # setup.py 378s # 378s # [/] 378s # 378s # pureModule.py 378s # 378s # pure/ 378s # __init__.py 378s # pure.py 378s # 378s # data/ 378s # pure.dat 378s # 378s # [/] 378s # 378s # hybrid/ 378s # CMakeLists.txt 378s # __init__.py 378s # hybrid_pure.dat 378s # hybrid_pure.py 378s # 378s # data/ 378s # hybrid_data_pure.dat 378s # 378s # hybrid_2/ 378s # __init__.py 378s # hybrid_2_pure.py 378s # 378s # hybrid_2_pure/ 378s # __init__.py 378s # hybrid_2_pure_1.py 378s # hybrid_2_pure_2.py 378s # 378s # 378s # ------------------------------------------------------------------------- 378s # and here is the "BINARY" distribution layout: 378s # 378s # The comment "CMake" or "Setuptools" indicates which tool is responsible 378s # for placing the file in the tree used to create the binary distribution. 378s # 378s # ROOT/ 378s # 378s # cmakeModule.py # CMake 378s # 378s # cmake/ 378s # __init__.py # CMake 378s # cmake.py # CMake 378s # 378s # hybrid/ 378s # hybrid_cmake.dat # CMake 378s # hybrid_cmake.py # CMake 378s # hybrid_pure.dat # Setuptools 378s # hybrid_pure.py # Setuptools 378s # 378s # data/ 378s # hybrid_data_pure.dat # CMake or Setuptools 378s # hybrid_data_cmake.dat # CMake *NO TEST* 378s # 378s # hybrid_2/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure.py # CMake or Setuptools 378s # hybrid_2_cmake.py # CMake 378s # 378s # hybrid_2_pure/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure_1.py # CMake or Setuptools 378s # hybrid_2_pure_2.py # CMake or Setuptools 378s # 378s # pureModule.py # Setuptools 378s # 378s # pure/ 378s # __init__.py # Setuptools 378s # pure.py # Setuptools 378s # 378s # data/ 378s # pure.dat # Setuptools 378s 378s tmp_dir.join("setup.py").write( 378s textwrap.dedent( 378s """ 378s from skbuild import setup 378s #from setuptools import setup 378s setup( 378s name="test_hybrid_project", 378s version="1.2.3", 378s description=("an hybrid package mixing files installed by both " 378s "CMake and setuptools"), 378s author='The scikit-build team', 378s license="MIT", 378s cmake_source_dir='{cmake_source_dir}', 378s cmake_install_dir='{cmake_install_dir}', 378s # Arbitrary order of packages 378s packages=[ 378s {p_off} 'pure', 378s {h_off} 'hybrid.hybrid_2', 378s {h_off} 'hybrid', 378s {c_off} 'cmake', 378s {p_off} 'hybrid.hybrid_2_pure', 378s ], 378s py_modules=[ 378s {pm_off} '{package_base}pureModule', 378s {cm_off} '{package_base}cmakeModule', 378s ], 378s package_data={{ 378s {p_off} 'pure': ['data/pure.dat'], 378s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 378s }}, 378s # Arbitrary order of package_dir 378s package_dir = {{ 378s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 378s {p_off} 'pure': '{package_base}pure', 378s {h_off} 'hybrid': '{package_base}hybrid', 378s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 378s {c_off} 'cmake': '{package_base}cmake', 378s }} 378s ) 378s """.format( 378s cmake_source_dir=cmake_source_dir, 378s cmake_install_dir=package_base, 378s package_base=package_base_dir, 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s p_off="" if has_pure_package else "#", 378s pm_off="" if has_pure_module else "#", 378s ) 378s ) 378s ) 378s 378s src_dir = tmp_dir.ensure(package_base, dir=1) 378s 378s src_dir.join("CMakeLists.txt").write( 378s textwrap.dedent( 378s """ 378s cmake_minimum_required(VERSION 3.5.0) 378s project(hybrid NONE) 378s set(build_dir ${{CMAKE_BINARY_DIR}}) 378s 378s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 378s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 378s {c_off} install( 378s {c_off} FILES 378s {c_off} ${{build_dir}}/__init__.py 378s {c_off} ${{build_dir}}/cmake.py 378s {c_off} DESTINATION cmake 378s {c_off} ) 378s 378s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 378s {cm_off} install( 378s {cm_off} FILES ${{build_dir}}/cmakeModule.py 378s {cm_off} DESTINATION .) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 378s {h_off} DESTINATION hybrid/data) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 378s {h_off} DESTINATION hybrid/hybrid_2) 378s 378s install(CODE "message(STATUS \\\"Installation complete\\\")") 378s """.format( 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s ) 378s ) 378s ) 378s 378s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 378s path_types: Sequence[str] 378s try: 378s path_types = next( 378s iter( 378s zip( 378s *filter( 378s lambda i: i[1], 378s [ 378s ("c", has_cmake_package), 378s ("cm", has_cmake_module), 378s ("h", has_hybrid_package), 378s ("p", has_pure_package), 378s ("pm", has_pure_module), 378s ], 378s ) 378s ) 378s ) 378s ) 378s except StopIteration: 378s path_types = [] 378s 378s def select_paths(annotated_paths): 378s """Return a filtered list paths considering ``path_types``. 378s 378s `annotated_paths`` is list of tuple ``(type, path)`` where type 378s is either `c`, 'cm', `h`, `p` or 'pm'. 378s 378s """ 378s return filter(lambda i: i[0] in path_types, annotated_paths) 378s 378s # Commented paths are the one expected to be installed by CMake. For 378s # this reason, corresponding files should NOT be created in the source 378s # tree. 378s for _type, path in select_paths( 378s [ 378s # ('c', 'cmake/__init__.py'), 378s # ('c', 'cmake/cmake.py'), 378s # ('cm', 'cmakeModule.py'), 378s ("h", "hybrid/__init__.py"), 378s # ('h', 'hybrid/hybrid_cmake.dat'), 378s # ('h', 'hybrid/hybrid_cmake.py'), 378s ("h", "hybrid/hybrid_pure.dat"), 378s ("h", "hybrid/hybrid_pure.py"), 378s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 378s ("h", "hybrid/data/hybrid_data_pure.dat"), 378s ("h", "hybrid/hybrid_2/__init__.py"), 378s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 378s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 378s ("p", "hybrid/hybrid_2_pure/__init__.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 378s ("pm", "pureModule.py"), 378s ("p", "pure/__init__.py"), 378s ("p", "pure/pure.py"), 378s ("p", "pure/data/pure.dat"), 378s ] 378s ): 378s assert _type in {"p", "pm", "h"} 378s root = package_base if _type in {"p", "pm"} else cmake_source_dir 378s tmp_dir.ensure(os.path.join(root, path)) 378s 378s # Do not call the real setup function. Instead, replace it with 378s # a MagicMock allowing to check with which arguments it was invoked. 378s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 378s 378s # Convenience print function 378s def _pprint(desc, value=None): 378s print( 378s "-----------------\n" 378s f"{desc}:\n" 378s "\n" 378s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 378s ) 378s 378s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 378s 378s _pprint = ._pprint at 0x3ffb5e38680> 378s _type = 'p' 378s cmake_source_dir = '' 378s has_cmake_module = 1 378s has_cmake_package = 1 378s has_hybrid_package = 0 378s has_pure_module = 1 378s has_pure_package = 1 378s mock_setup = 378s mocker = 378s package_base = '' 378s package_base_dir = '' 378s path = 'pure/data/pure.dat' 378s path_types = ('c', 'cm', 'p', 'pm') 378s root = '' 378s select_paths = .select_paths at 0x3ffb5e38540> 378s src_dir = local('/tmp/pytest-of-ubuntu/pytest-109/test_setup_inputs0') 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-109/test_setup_inputs0') 378s with_package_base = 0 378s 378s tests/test_setup.py:849: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-109/test_setup_inputs0') 378s setup_args = ['build'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-109/test_setup_inputs0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s ________________________ test_setup_inputs[0-1-1-1-0-0] ________________________ 378s 378s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 1 378s has_pure_package = 1, has_pure_module = 1, with_package_base = 0 378s mocker = 378s 378s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 378s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 378s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_module", [0, 1]) 378s @pytest.mark.parametrize("with_package_base", [0, 1]) 378s def test_setup_inputs( 378s has_cmake_package, 378s has_cmake_module, 378s has_hybrid_package, 378s has_pure_package, 378s has_pure_module, 378s with_package_base, 378s mocker, 378s ): 378s """This test that a project can have a package with some modules 378s installed using setup.py and some other modules installed using CMake. 378s """ 378s 378s tmp_dir = _tmpdir("test_setup_inputs") 378s 378s package_base = "to/the/base" if with_package_base else "" 378s package_base_dir = package_base + "/" if package_base else "" 378s cmake_source_dir = package_base 378s 378s if cmake_source_dir and (has_cmake_package or has_cmake_module): 378s pytest.skip( 378s "unsupported configuration: " 378s "python package fully generated by CMake does *NOT* work. " 378s "At least __init__.py should be in the project source tree" 378s ) 378s 378s # ------------------------------------------------------------------------- 378s # Here is the "SOURCE" tree layout: 378s # 378s # ROOT/ 378s # 378s # setup.py 378s # 378s # [/] 378s # 378s # pureModule.py 378s # 378s # pure/ 378s # __init__.py 378s # pure.py 378s # 378s # data/ 378s # pure.dat 378s # 378s # [/] 378s # 378s # hybrid/ 378s # CMakeLists.txt 378s # __init__.py 378s # hybrid_pure.dat 378s # hybrid_pure.py 378s # 378s # data/ 378s # hybrid_data_pure.dat 378s # 378s # hybrid_2/ 378s # __init__.py 378s # hybrid_2_pure.py 378s # 378s # hybrid_2_pure/ 378s # __init__.py 378s # hybrid_2_pure_1.py 378s # hybrid_2_pure_2.py 378s # 378s # 378s # ------------------------------------------------------------------------- 378s # and here is the "BINARY" distribution layout: 378s # 378s # The comment "CMake" or "Setuptools" indicates which tool is responsible 378s # for placing the file in the tree used to create the binary distribution. 378s # 378s # ROOT/ 378s # 378s # cmakeModule.py # CMake 378s # 378s # cmake/ 378s # __init__.py # CMake 378s # cmake.py # CMake 378s # 378s # hybrid/ 378s # hybrid_cmake.dat # CMake 378s # hybrid_cmake.py # CMake 378s # hybrid_pure.dat # Setuptools 378s # hybrid_pure.py # Setuptools 378s # 378s # data/ 378s # hybrid_data_pure.dat # CMake or Setuptools 378s # hybrid_data_cmake.dat # CMake *NO TEST* 378s # 378s # hybrid_2/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure.py # CMake or Setuptools 378s # hybrid_2_cmake.py # CMake 378s # 378s # hybrid_2_pure/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure_1.py # CMake or Setuptools 378s # hybrid_2_pure_2.py # CMake or Setuptools 378s # 378s # pureModule.py # Setuptools 378s # 378s # pure/ 378s # __init__.py # Setuptools 378s # pure.py # Setuptools 378s # 378s # data/ 378s # pure.dat # Setuptools 378s 378s tmp_dir.join("setup.py").write( 378s textwrap.dedent( 378s """ 378s from skbuild import setup 378s #from setuptools import setup 378s setup( 378s name="test_hybrid_project", 378s version="1.2.3", 378s description=("an hybrid package mixing files installed by both " 378s "CMake and setuptools"), 378s author='The scikit-build team', 378s license="MIT", 378s cmake_source_dir='{cmake_source_dir}', 378s cmake_install_dir='{cmake_install_dir}', 378s # Arbitrary order of packages 378s packages=[ 378s {p_off} 'pure', 378s {h_off} 'hybrid.hybrid_2', 378s {h_off} 'hybrid', 378s {c_off} 'cmake', 378s {p_off} 'hybrid.hybrid_2_pure', 378s ], 378s py_modules=[ 378s {pm_off} '{package_base}pureModule', 378s {cm_off} '{package_base}cmakeModule', 378s ], 378s package_data={{ 378s {p_off} 'pure': ['data/pure.dat'], 378s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 378s }}, 378s # Arbitrary order of package_dir 378s package_dir = {{ 378s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 378s {p_off} 'pure': '{package_base}pure', 378s {h_off} 'hybrid': '{package_base}hybrid', 378s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 378s {c_off} 'cmake': '{package_base}cmake', 378s }} 378s ) 378s """.format( 378s cmake_source_dir=cmake_source_dir, 378s cmake_install_dir=package_base, 378s package_base=package_base_dir, 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s p_off="" if has_pure_package else "#", 378s pm_off="" if has_pure_module else "#", 378s ) 378s ) 378s ) 378s 378s src_dir = tmp_dir.ensure(package_base, dir=1) 378s 378s src_dir.join("CMakeLists.txt").write( 378s textwrap.dedent( 378s """ 378s cmake_minimum_required(VERSION 3.5.0) 378s project(hybrid NONE) 378s set(build_dir ${{CMAKE_BINARY_DIR}}) 378s 378s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 378s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 378s {c_off} install( 378s {c_off} FILES 378s {c_off} ${{build_dir}}/__init__.py 378s {c_off} ${{build_dir}}/cmake.py 378s {c_off} DESTINATION cmake 378s {c_off} ) 378s 378s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 378s {cm_off} install( 378s {cm_off} FILES ${{build_dir}}/cmakeModule.py 378s {cm_off} DESTINATION .) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 378s {h_off} DESTINATION hybrid/data) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 378s {h_off} DESTINATION hybrid/hybrid_2) 378s 378s install(CODE "message(STATUS \\\"Installation complete\\\")") 378s """.format( 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s ) 378s ) 378s ) 378s 378s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 378s path_types: Sequence[str] 378s try: 378s path_types = next( 378s iter( 378s zip( 378s *filter( 378s lambda i: i[1], 378s [ 378s ("c", has_cmake_package), 378s ("cm", has_cmake_module), 378s ("h", has_hybrid_package), 378s ("p", has_pure_package), 378s ("pm", has_pure_module), 378s ], 378s ) 378s ) 378s ) 378s ) 378s except StopIteration: 378s path_types = [] 378s 378s def select_paths(annotated_paths): 378s """Return a filtered list paths considering ``path_types``. 378s 378s `annotated_paths`` is list of tuple ``(type, path)`` where type 378s is either `c`, 'cm', `h`, `p` or 'pm'. 378s 378s """ 378s return filter(lambda i: i[0] in path_types, annotated_paths) 378s 378s # Commented paths are the one expected to be installed by CMake. For 378s # this reason, corresponding files should NOT be created in the source 378s # tree. 378s for _type, path in select_paths( 378s [ 378s # ('c', 'cmake/__init__.py'), 378s # ('c', 'cmake/cmake.py'), 378s # ('cm', 'cmakeModule.py'), 378s ("h", "hybrid/__init__.py"), 378s # ('h', 'hybrid/hybrid_cmake.dat'), 378s # ('h', 'hybrid/hybrid_cmake.py'), 378s ("h", "hybrid/hybrid_pure.dat"), 378s ("h", "hybrid/hybrid_pure.py"), 378s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 378s ("h", "hybrid/data/hybrid_data_pure.dat"), 378s ("h", "hybrid/hybrid_2/__init__.py"), 378s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 378s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 378s ("p", "hybrid/hybrid_2_pure/__init__.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 378s ("pm", "pureModule.py"), 378s ("p", "pure/__init__.py"), 378s ("p", "pure/pure.py"), 378s ("p", "pure/data/pure.dat"), 378s ] 378s ): 378s assert _type in {"p", "pm", "h"} 378s root = package_base if _type in {"p", "pm"} else cmake_source_dir 378s tmp_dir.ensure(os.path.join(root, path)) 378s 378s # Do not call the real setup function. Instead, replace it with 378s # a MagicMock allowing to check with which arguments it was invoked. 378s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 378s 378s # Convenience print function 378s def _pprint(desc, value=None): 378s print( 378s "-----------------\n" 378s f"{desc}:\n" 378s "\n" 378s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 378s ) 378s 378s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 378s 378s _pprint = ._pprint at 0x3ffb5e39260> 378s _type = 'p' 378s cmake_source_dir = '' 378s has_cmake_module = 0 378s has_cmake_package = 0 378s has_hybrid_package = 1 378s has_pure_module = 1 378s has_pure_package = 1 378s mock_setup = 378s mocker = 378s package_base = '' 378s package_base_dir = '' 378s path = 'pure/data/pure.dat' 378s path_types = ('h', 'p', 'pm') 378s root = '' 378s select_paths = .select_paths at 0x3ffb5e39080> 378s src_dir = local('/tmp/pytest-of-ubuntu/pytest-110/test_setup_inputs0') 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-110/test_setup_inputs0') 378s with_package_base = 0 378s 378s tests/test_setup.py:849: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-110/test_setup_inputs0') 378s setup_args = ['build'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-110/test_setup_inputs0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s ________________________ test_setup_inputs[0-1-1-1-0-1] ________________________ 378s 378s has_cmake_package = 1, has_cmake_module = 0, has_hybrid_package = 1 378s has_pure_package = 1, has_pure_module = 1, with_package_base = 0 378s mocker = 378s 378s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 378s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 378s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_module", [0, 1]) 378s @pytest.mark.parametrize("with_package_base", [0, 1]) 378s def test_setup_inputs( 378s has_cmake_package, 378s has_cmake_module, 378s has_hybrid_package, 378s has_pure_package, 378s has_pure_module, 378s with_package_base, 378s mocker, 378s ): 378s """This test that a project can have a package with some modules 378s installed using setup.py and some other modules installed using CMake. 378s """ 378s 378s tmp_dir = _tmpdir("test_setup_inputs") 378s 378s package_base = "to/the/base" if with_package_base else "" 378s package_base_dir = package_base + "/" if package_base else "" 378s cmake_source_dir = package_base 378s 378s if cmake_source_dir and (has_cmake_package or has_cmake_module): 378s pytest.skip( 378s "unsupported configuration: " 378s "python package fully generated by CMake does *NOT* work. " 378s "At least __init__.py should be in the project source tree" 378s ) 378s 378s # ------------------------------------------------------------------------- 378s # Here is the "SOURCE" tree layout: 378s # 378s # ROOT/ 378s # 378s # setup.py 378s # 378s # [/] 378s # 378s # pureModule.py 378s # 378s # pure/ 378s # __init__.py 378s # pure.py 378s # 378s # data/ 378s # pure.dat 378s # 378s # [/] 378s # 378s # hybrid/ 378s # CMakeLists.txt 378s # __init__.py 378s # hybrid_pure.dat 378s # hybrid_pure.py 378s # 378s # data/ 378s # hybrid_data_pure.dat 378s # 378s # hybrid_2/ 378s # __init__.py 378s # hybrid_2_pure.py 378s # 378s # hybrid_2_pure/ 378s # __init__.py 378s # hybrid_2_pure_1.py 378s # hybrid_2_pure_2.py 378s # 378s # 378s # ------------------------------------------------------------------------- 378s # and here is the "BINARY" distribution layout: 378s # 378s # The comment "CMake" or "Setuptools" indicates which tool is responsible 378s # for placing the file in the tree used to create the binary distribution. 378s # 378s # ROOT/ 378s # 378s # cmakeModule.py # CMake 378s # 378s # cmake/ 378s # __init__.py # CMake 378s # cmake.py # CMake 378s # 378s # hybrid/ 378s # hybrid_cmake.dat # CMake 378s # hybrid_cmake.py # CMake 378s # hybrid_pure.dat # Setuptools 378s # hybrid_pure.py # Setuptools 378s # 378s # data/ 378s # hybrid_data_pure.dat # CMake or Setuptools 378s # hybrid_data_cmake.dat # CMake *NO TEST* 378s # 378s # hybrid_2/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure.py # CMake or Setuptools 378s # hybrid_2_cmake.py # CMake 378s # 378s # hybrid_2_pure/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure_1.py # CMake or Setuptools 378s # hybrid_2_pure_2.py # CMake or Setuptools 378s # 378s # pureModule.py # Setuptools 378s # 378s # pure/ 378s # __init__.py # Setuptools 378s # pure.py # Setuptools 378s # 378s # data/ 378s # pure.dat # Setuptools 378s 378s tmp_dir.join("setup.py").write( 378s textwrap.dedent( 378s """ 378s from skbuild import setup 378s #from setuptools import setup 378s setup( 378s name="test_hybrid_project", 378s version="1.2.3", 378s description=("an hybrid package mixing files installed by both " 378s "CMake and setuptools"), 378s author='The scikit-build team', 378s license="MIT", 378s cmake_source_dir='{cmake_source_dir}', 378s cmake_install_dir='{cmake_install_dir}', 378s # Arbitrary order of packages 378s packages=[ 378s {p_off} 'pure', 378s {h_off} 'hybrid.hybrid_2', 378s {h_off} 'hybrid', 378s {c_off} 'cmake', 378s {p_off} 'hybrid.hybrid_2_pure', 378s ], 378s py_modules=[ 378s {pm_off} '{package_base}pureModule', 378s {cm_off} '{package_base}cmakeModule', 378s ], 378s package_data={{ 378s {p_off} 'pure': ['data/pure.dat'], 378s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 378s }}, 378s # Arbitrary order of package_dir 378s package_dir = {{ 378s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 378s {p_off} 'pure': '{package_base}pure', 378s {h_off} 'hybrid': '{package_base}hybrid', 378s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 378s {c_off} 'cmake': '{package_base}cmake', 378s }} 378s ) 378s """.format( 378s cmake_source_dir=cmake_source_dir, 378s cmake_install_dir=package_base, 378s package_base=package_base_dir, 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s p_off="" if has_pure_package else "#", 378s pm_off="" if has_pure_module else "#", 378s ) 378s ) 378s ) 378s 378s src_dir = tmp_dir.ensure(package_base, dir=1) 378s 378s src_dir.join("CMakeLists.txt").write( 378s textwrap.dedent( 378s """ 378s cmake_minimum_required(VERSION 3.5.0) 378s project(hybrid NONE) 378s set(build_dir ${{CMAKE_BINARY_DIR}}) 378s 378s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 378s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 378s {c_off} install( 378s {c_off} FILES 378s {c_off} ${{build_dir}}/__init__.py 378s {c_off} ${{build_dir}}/cmake.py 378s {c_off} DESTINATION cmake 378s {c_off} ) 378s 378s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 378s {cm_off} install( 378s {cm_off} FILES ${{build_dir}}/cmakeModule.py 378s {cm_off} DESTINATION .) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 378s {h_off} DESTINATION hybrid/data) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 378s {h_off} DESTINATION hybrid/hybrid_2) 378s 378s install(CODE "message(STATUS \\\"Installation complete\\\")") 378s """.format( 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s ) 378s ) 378s ) 378s 378s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 378s path_types: Sequence[str] 378s try: 378s path_types = next( 378s iter( 378s zip( 378s *filter( 378s lambda i: i[1], 378s [ 378s ("c", has_cmake_package), 378s ("cm", has_cmake_module), 378s ("h", has_hybrid_package), 378s ("p", has_pure_package), 378s ("pm", has_pure_module), 378s ], 378s ) 378s ) 378s ) 378s ) 378s except StopIteration: 378s path_types = [] 378s 378s def select_paths(annotated_paths): 378s """Return a filtered list paths considering ``path_types``. 378s 378s `annotated_paths`` is list of tuple ``(type, path)`` where type 378s is either `c`, 'cm', `h`, `p` or 'pm'. 378s 378s """ 378s return filter(lambda i: i[0] in path_types, annotated_paths) 378s 378s # Commented paths are the one expected to be installed by CMake. For 378s # this reason, corresponding files should NOT be created in the source 378s # tree. 378s for _type, path in select_paths( 378s [ 378s # ('c', 'cmake/__init__.py'), 378s # ('c', 'cmake/cmake.py'), 378s # ('cm', 'cmakeModule.py'), 378s ("h", "hybrid/__init__.py"), 378s # ('h', 'hybrid/hybrid_cmake.dat'), 378s # ('h', 'hybrid/hybrid_cmake.py'), 378s ("h", "hybrid/hybrid_pure.dat"), 378s ("h", "hybrid/hybrid_pure.py"), 378s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 378s ("h", "hybrid/data/hybrid_data_pure.dat"), 378s ("h", "hybrid/hybrid_2/__init__.py"), 378s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 378s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 378s ("p", "hybrid/hybrid_2_pure/__init__.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 378s ("pm", "pureModule.py"), 378s ("p", "pure/__init__.py"), 378s ("p", "pure/pure.py"), 378s ("p", "pure/data/pure.dat"), 378s ] 378s ): 378s assert _type in {"p", "pm", "h"} 378s root = package_base if _type in {"p", "pm"} else cmake_source_dir 378s tmp_dir.ensure(os.path.join(root, path)) 378s 378s # Do not call the real setup function. Instead, replace it with 378s # a MagicMock allowing to check with which arguments it was invoked. 378s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 378s 378s # Convenience print function 378s def _pprint(desc, value=None): 378s print( 378s "-----------------\n" 378s f"{desc}:\n" 378s "\n" 378s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 378s ) 378s 378s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 378s 378s _pprint = ._pprint at 0x3ffb602a520> 378s _type = 'p' 378s cmake_source_dir = '' 378s has_cmake_module = 0 378s has_cmake_package = 1 378s has_hybrid_package = 1 378s has_pure_module = 1 378s has_pure_package = 1 378s mock_setup = 378s mocker = 378s package_base = '' 378s package_base_dir = '' 378s path = 'pure/data/pure.dat' 378s path_types = ('c', 'h', 'p', 'pm') 378s root = '' 378s select_paths = .select_paths at 0x3ffb602b600> 378s src_dir = local('/tmp/pytest-of-ubuntu/pytest-111/test_setup_inputs0') 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-111/test_setup_inputs0') 378s with_package_base = 0 378s 378s tests/test_setup.py:849: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-111/test_setup_inputs0') 378s setup_args = ['build'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-111/test_setup_inputs0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s ________________________ test_setup_inputs[0-1-1-1-1-0] ________________________ 378s 378s has_cmake_package = 0, has_cmake_module = 1, has_hybrid_package = 1 378s has_pure_package = 1, has_pure_module = 1, with_package_base = 0 378s mocker = 378s 378s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 378s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 378s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_module", [0, 1]) 378s @pytest.mark.parametrize("with_package_base", [0, 1]) 378s def test_setup_inputs( 378s has_cmake_package, 378s has_cmake_module, 378s has_hybrid_package, 378s has_pure_package, 378s has_pure_module, 378s with_package_base, 378s mocker, 378s ): 378s """This test that a project can have a package with some modules 378s installed using setup.py and some other modules installed using CMake. 378s """ 378s 378s tmp_dir = _tmpdir("test_setup_inputs") 378s 378s package_base = "to/the/base" if with_package_base else "" 378s package_base_dir = package_base + "/" if package_base else "" 378s cmake_source_dir = package_base 378s 378s if cmake_source_dir and (has_cmake_package or has_cmake_module): 378s pytest.skip( 378s "unsupported configuration: " 378s "python package fully generated by CMake does *NOT* work. " 378s "At least __init__.py should be in the project source tree" 378s ) 378s 378s # ------------------------------------------------------------------------- 378s # Here is the "SOURCE" tree layout: 378s # 378s # ROOT/ 378s # 378s # setup.py 378s # 378s # [/] 378s # 378s # pureModule.py 378s # 378s # pure/ 378s # __init__.py 378s # pure.py 378s # 378s # data/ 378s # pure.dat 378s # 378s # [/] 378s # 378s # hybrid/ 378s # CMakeLists.txt 378s # __init__.py 378s # hybrid_pure.dat 378s # hybrid_pure.py 378s # 378s # data/ 378s # hybrid_data_pure.dat 378s # 378s # hybrid_2/ 378s # __init__.py 378s # hybrid_2_pure.py 378s # 378s # hybrid_2_pure/ 378s # __init__.py 378s # hybrid_2_pure_1.py 378s # hybrid_2_pure_2.py 378s # 378s # 378s # ------------------------------------------------------------------------- 378s # and here is the "BINARY" distribution layout: 378s # 378s # The comment "CMake" or "Setuptools" indicates which tool is responsible 378s # for placing the file in the tree used to create the binary distribution. 378s # 378s # ROOT/ 378s # 378s # cmakeModule.py # CMake 378s # 378s # cmake/ 378s # __init__.py # CMake 378s # cmake.py # CMake 378s # 378s # hybrid/ 378s # hybrid_cmake.dat # CMake 378s # hybrid_cmake.py # CMake 378s # hybrid_pure.dat # Setuptools 378s # hybrid_pure.py # Setuptools 378s # 378s # data/ 378s # hybrid_data_pure.dat # CMake or Setuptools 378s # hybrid_data_cmake.dat # CMake *NO TEST* 378s # 378s # hybrid_2/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure.py # CMake or Setuptools 378s # hybrid_2_cmake.py # CMake 378s # 378s # hybrid_2_pure/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure_1.py # CMake or Setuptools 378s # hybrid_2_pure_2.py # CMake or Setuptools 378s # 378s # pureModule.py # Setuptools 378s # 378s # pure/ 378s # __init__.py # Setuptools 378s # pure.py # Setuptools 378s # 378s # data/ 378s # pure.dat # Setuptools 378s 378s tmp_dir.join("setup.py").write( 378s textwrap.dedent( 378s """ 378s from skbuild import setup 378s #from setuptools import setup 378s setup( 378s name="test_hybrid_project", 378s version="1.2.3", 378s description=("an hybrid package mixing files installed by both " 378s "CMake and setuptools"), 378s author='The scikit-build team', 378s license="MIT", 378s cmake_source_dir='{cmake_source_dir}', 378s cmake_install_dir='{cmake_install_dir}', 378s # Arbitrary order of packages 378s packages=[ 378s {p_off} 'pure', 378s {h_off} 'hybrid.hybrid_2', 378s {h_off} 'hybrid', 378s {c_off} 'cmake', 378s {p_off} 'hybrid.hybrid_2_pure', 378s ], 378s py_modules=[ 378s {pm_off} '{package_base}pureModule', 378s {cm_off} '{package_base}cmakeModule', 378s ], 378s package_data={{ 378s {p_off} 'pure': ['data/pure.dat'], 378s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 378s }}, 378s # Arbitrary order of package_dir 378s package_dir = {{ 378s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 378s {p_off} 'pure': '{package_base}pure', 378s {h_off} 'hybrid': '{package_base}hybrid', 378s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 378s {c_off} 'cmake': '{package_base}cmake', 378s }} 378s ) 378s """.format( 378s cmake_source_dir=cmake_source_dir, 378s cmake_install_dir=package_base, 378s package_base=package_base_dir, 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s p_off="" if has_pure_package else "#", 378s pm_off="" if has_pure_module else "#", 378s ) 378s ) 378s ) 378s 378s src_dir = tmp_dir.ensure(package_base, dir=1) 378s 378s src_dir.join("CMakeLists.txt").write( 378s textwrap.dedent( 378s """ 378s cmake_minimum_required(VERSION 3.5.0) 378s project(hybrid NONE) 378s set(build_dir ${{CMAKE_BINARY_DIR}}) 378s 378s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 378s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 378s {c_off} install( 378s {c_off} FILES 378s {c_off} ${{build_dir}}/__init__.py 378s {c_off} ${{build_dir}}/cmake.py 378s {c_off} DESTINATION cmake 378s {c_off} ) 378s 378s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 378s {cm_off} install( 378s {cm_off} FILES ${{build_dir}}/cmakeModule.py 378s {cm_off} DESTINATION .) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 378s {h_off} DESTINATION hybrid/data) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 378s {h_off} DESTINATION hybrid/hybrid_2) 378s 378s install(CODE "message(STATUS \\\"Installation complete\\\")") 378s """.format( 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s ) 378s ) 378s ) 378s 378s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 378s path_types: Sequence[str] 378s try: 378s path_types = next( 378s iter( 378s zip( 378s *filter( 378s lambda i: i[1], 378s [ 378s ("c", has_cmake_package), 378s ("cm", has_cmake_module), 378s ("h", has_hybrid_package), 378s ("p", has_pure_package), 378s ("pm", has_pure_module), 378s ], 378s ) 378s ) 378s ) 378s ) 378s except StopIteration: 378s path_types = [] 378s 378s def select_paths(annotated_paths): 378s """Return a filtered list paths considering ``path_types``. 378s 378s `annotated_paths`` is list of tuple ``(type, path)`` where type 378s is either `c`, 'cm', `h`, `p` or 'pm'. 378s 378s """ 378s return filter(lambda i: i[0] in path_types, annotated_paths) 378s 378s # Commented paths are the one expected to be installed by CMake. For 378s # this reason, corresponding files should NOT be created in the source 378s # tree. 378s for _type, path in select_paths( 378s [ 378s # ('c', 'cmake/__init__.py'), 378s # ('c', 'cmake/cmake.py'), 378s # ('cm', 'cmakeModule.py'), 378s ("h", "hybrid/__init__.py"), 378s # ('h', 'hybrid/hybrid_cmake.dat'), 378s # ('h', 'hybrid/hybrid_cmake.py'), 378s ("h", "hybrid/hybrid_pure.dat"), 378s ("h", "hybrid/hybrid_pure.py"), 378s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 378s ("h", "hybrid/data/hybrid_data_pure.dat"), 378s ("h", "hybrid/hybrid_2/__init__.py"), 378s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 378s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 378s ("p", "hybrid/hybrid_2_pure/__init__.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 378s ("pm", "pureModule.py"), 378s ("p", "pure/__init__.py"), 378s ("p", "pure/pure.py"), 378s ("p", "pure/data/pure.dat"), 378s ] 378s ): 378s assert _type in {"p", "pm", "h"} 378s root = package_base if _type in {"p", "pm"} else cmake_source_dir 378s tmp_dir.ensure(os.path.join(root, path)) 378s 378s # Do not call the real setup function. Instead, replace it with 378s # a MagicMock allowing to check with which arguments it was invoked. 378s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 378s 378s # Convenience print function 378s def _pprint(desc, value=None): 378s print( 378s "-----------------\n" 378s f"{desc}:\n" 378s "\n" 378s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 378s ) 378s 378s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 378s 378s _pprint = ._pprint at 0x3ffb5e39120> 378s _type = 'p' 378s cmake_source_dir = '' 378s has_cmake_module = 1 378s has_cmake_package = 0 378s has_hybrid_package = 1 378s has_pure_module = 1 378s has_pure_package = 1 378s mock_setup = 378s mocker = 378s package_base = '' 378s package_base_dir = '' 378s path = 'pure/data/pure.dat' 378s path_types = ('cm', 'h', 'p', 'pm') 378s root = '' 378s select_paths = .select_paths at 0x3ffb5e39940> 378s src_dir = local('/tmp/pytest-of-ubuntu/pytest-112/test_setup_inputs0') 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-112/test_setup_inputs0') 378s with_package_base = 0 378s 378s tests/test_setup.py:849: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-112/test_setup_inputs0') 378s setup_args = ['build'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-112/test_setup_inputs0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s ________________________ test_setup_inputs[0-1-1-1-1-1] ________________________ 378s 378s has_cmake_package = 1, has_cmake_module = 1, has_hybrid_package = 1 378s has_pure_package = 1, has_pure_module = 1, with_package_base = 0 378s mocker = 378s 378s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 378s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 378s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_module", [0, 1]) 378s @pytest.mark.parametrize("with_package_base", [0, 1]) 378s def test_setup_inputs( 378s has_cmake_package, 378s has_cmake_module, 378s has_hybrid_package, 378s has_pure_package, 378s has_pure_module, 378s with_package_base, 378s mocker, 378s ): 378s """This test that a project can have a package with some modules 378s installed using setup.py and some other modules installed using CMake. 378s """ 378s 378s tmp_dir = _tmpdir("test_setup_inputs") 378s 378s package_base = "to/the/base" if with_package_base else "" 378s package_base_dir = package_base + "/" if package_base else "" 378s cmake_source_dir = package_base 378s 378s if cmake_source_dir and (has_cmake_package or has_cmake_module): 378s pytest.skip( 378s "unsupported configuration: " 378s "python package fully generated by CMake does *NOT* work. " 378s "At least __init__.py should be in the project source tree" 378s ) 378s 378s # ------------------------------------------------------------------------- 378s # Here is the "SOURCE" tree layout: 378s # 378s # ROOT/ 378s # 378s # setup.py 378s # 378s # [/] 378s # 378s # pureModule.py 378s # 378s # pure/ 378s # __init__.py 378s # pure.py 378s # 378s # data/ 378s # pure.dat 378s # 378s # [/] 378s # 378s # hybrid/ 378s # CMakeLists.txt 378s # __init__.py 378s # hybrid_pure.dat 378s # hybrid_pure.py 378s # 378s # data/ 378s # hybrid_data_pure.dat 378s # 378s # hybrid_2/ 378s # __init__.py 378s # hybrid_2_pure.py 378s # 378s # hybrid_2_pure/ 378s # __init__.py 378s # hybrid_2_pure_1.py 378s # hybrid_2_pure_2.py 378s # 378s # 378s # ------------------------------------------------------------------------- 378s # and here is the "BINARY" distribution layout: 378s # 378s # The comment "CMake" or "Setuptools" indicates which tool is responsible 378s # for placing the file in the tree used to create the binary distribution. 378s # 378s # ROOT/ 378s # 378s # cmakeModule.py # CMake 378s # 378s # cmake/ 378s # __init__.py # CMake 378s # cmake.py # CMake 378s # 378s # hybrid/ 378s # hybrid_cmake.dat # CMake 378s # hybrid_cmake.py # CMake 378s # hybrid_pure.dat # Setuptools 378s # hybrid_pure.py # Setuptools 378s # 378s # data/ 378s # hybrid_data_pure.dat # CMake or Setuptools 378s # hybrid_data_cmake.dat # CMake *NO TEST* 378s # 378s # hybrid_2/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure.py # CMake or Setuptools 378s # hybrid_2_cmake.py # CMake 378s # 378s # hybrid_2_pure/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure_1.py # CMake or Setuptools 378s # hybrid_2_pure_2.py # CMake or Setuptools 378s # 378s # pureModule.py # Setuptools 378s # 378s # pure/ 378s # __init__.py # Setuptools 378s # pure.py # Setuptools 378s # 378s # data/ 378s # pure.dat # Setuptools 378s 378s tmp_dir.join("setup.py").write( 378s textwrap.dedent( 378s """ 378s from skbuild import setup 378s #from setuptools import setup 378s setup( 378s name="test_hybrid_project", 378s version="1.2.3", 378s description=("an hybrid package mixing files installed by both " 378s "CMake and setuptools"), 378s author='The scikit-build team', 378s license="MIT", 378s cmake_source_dir='{cmake_source_dir}', 378s cmake_install_dir='{cmake_install_dir}', 378s # Arbitrary order of packages 378s packages=[ 378s {p_off} 'pure', 378s {h_off} 'hybrid.hybrid_2', 378s {h_off} 'hybrid', 378s {c_off} 'cmake', 378s {p_off} 'hybrid.hybrid_2_pure', 378s ], 378s py_modules=[ 378s {pm_off} '{package_base}pureModule', 378s {cm_off} '{package_base}cmakeModule', 378s ], 378s package_data={{ 378s {p_off} 'pure': ['data/pure.dat'], 378s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 378s }}, 378s # Arbitrary order of package_dir 378s package_dir = {{ 378s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 378s {p_off} 'pure': '{package_base}pure', 378s {h_off} 'hybrid': '{package_base}hybrid', 378s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 378s {c_off} 'cmake': '{package_base}cmake', 378s }} 378s ) 378s """.format( 378s cmake_source_dir=cmake_source_dir, 378s cmake_install_dir=package_base, 378s package_base=package_base_dir, 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s p_off="" if has_pure_package else "#", 378s pm_off="" if has_pure_module else "#", 378s ) 378s ) 378s ) 378s 378s src_dir = tmp_dir.ensure(package_base, dir=1) 378s 378s src_dir.join("CMakeLists.txt").write( 378s textwrap.dedent( 378s """ 378s cmake_minimum_required(VERSION 3.5.0) 378s project(hybrid NONE) 378s set(build_dir ${{CMAKE_BINARY_DIR}}) 378s 378s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 378s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 378s {c_off} install( 378s {c_off} FILES 378s {c_off} ${{build_dir}}/__init__.py 378s {c_off} ${{build_dir}}/cmake.py 378s {c_off} DESTINATION cmake 378s {c_off} ) 378s 378s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 378s {cm_off} install( 378s {cm_off} FILES ${{build_dir}}/cmakeModule.py 378s {cm_off} DESTINATION .) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 378s {h_off} DESTINATION hybrid/data) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 378s {h_off} DESTINATION hybrid/hybrid_2) 378s 378s install(CODE "message(STATUS \\\"Installation complete\\\")") 378s """.format( 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s ) 378s ) 378s ) 378s 378s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 378s path_types: Sequence[str] 378s try: 378s path_types = next( 378s iter( 378s zip( 378s *filter( 378s lambda i: i[1], 378s [ 378s ("c", has_cmake_package), 378s ("cm", has_cmake_module), 378s ("h", has_hybrid_package), 378s ("p", has_pure_package), 378s ("pm", has_pure_module), 378s ], 378s ) 378s ) 378s ) 378s ) 378s except StopIteration: 378s path_types = [] 378s 378s def select_paths(annotated_paths): 378s """Return a filtered list paths considering ``path_types``. 378s 378s `annotated_paths`` is list of tuple ``(type, path)`` where type 378s is either `c`, 'cm', `h`, `p` or 'pm'. 378s 378s """ 378s return filter(lambda i: i[0] in path_types, annotated_paths) 378s 378s # Commented paths are the one expected to be installed by CMake. For 378s # this reason, corresponding files should NOT be created in the source 378s # tree. 378s for _type, path in select_paths( 378s [ 378s # ('c', 'cmake/__init__.py'), 378s # ('c', 'cmake/cmake.py'), 378s # ('cm', 'cmakeModule.py'), 378s ("h", "hybrid/__init__.py"), 378s # ('h', 'hybrid/hybrid_cmake.dat'), 378s # ('h', 'hybrid/hybrid_cmake.py'), 378s ("h", "hybrid/hybrid_pure.dat"), 378s ("h", "hybrid/hybrid_pure.py"), 378s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 378s ("h", "hybrid/data/hybrid_data_pure.dat"), 378s ("h", "hybrid/hybrid_2/__init__.py"), 378s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 378s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 378s ("p", "hybrid/hybrid_2_pure/__init__.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 378s ("pm", "pureModule.py"), 378s ("p", "pure/__init__.py"), 378s ("p", "pure/pure.py"), 378s ("p", "pure/data/pure.dat"), 378s ] 378s ): 378s assert _type in {"p", "pm", "h"} 378s root = package_base if _type in {"p", "pm"} else cmake_source_dir 378s tmp_dir.ensure(os.path.join(root, path)) 378s 378s # Do not call the real setup function. Instead, replace it with 378s # a MagicMock allowing to check with which arguments it was invoked. 378s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 378s 378s # Convenience print function 378s def _pprint(desc, value=None): 378s print( 378s "-----------------\n" 378s f"{desc}:\n" 378s "\n" 378s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 378s ) 378s 378s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 378s 378s _pprint = ._pprint at 0x3ffb5e398a0> 378s _type = 'p' 378s cmake_source_dir = '' 378s has_cmake_module = 1 378s has_cmake_package = 1 378s has_hybrid_package = 1 378s has_pure_module = 1 378s has_pure_package = 1 378s mock_setup = 378s mocker = 378s package_base = '' 378s package_base_dir = '' 378s path = 'pure/data/pure.dat' 378s path_types = ('c', 'cm', 'h', 'p', 'pm') 378s root = '' 378s select_paths = .select_paths at 0x3ffb5e39580> 378s src_dir = local('/tmp/pytest-of-ubuntu/pytest-113/test_setup_inputs0') 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-113/test_setup_inputs0') 378s with_package_base = 0 378s 378s tests/test_setup.py:849: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-113/test_setup_inputs0') 378s setup_args = ['build'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-113/test_setup_inputs0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s ________________________ test_setup_inputs[1-0-0-0-0-0] ________________________ 378s 378s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 0 378s has_pure_package = 0, has_pure_module = 0, with_package_base = 1 378s mocker = 378s 378s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 378s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 378s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_module", [0, 1]) 378s @pytest.mark.parametrize("with_package_base", [0, 1]) 378s def test_setup_inputs( 378s has_cmake_package, 378s has_cmake_module, 378s has_hybrid_package, 378s has_pure_package, 378s has_pure_module, 378s with_package_base, 378s mocker, 378s ): 378s """This test that a project can have a package with some modules 378s installed using setup.py and some other modules installed using CMake. 378s """ 378s 378s tmp_dir = _tmpdir("test_setup_inputs") 378s 378s package_base = "to/the/base" if with_package_base else "" 378s package_base_dir = package_base + "/" if package_base else "" 378s cmake_source_dir = package_base 378s 378s if cmake_source_dir and (has_cmake_package or has_cmake_module): 378s pytest.skip( 378s "unsupported configuration: " 378s "python package fully generated by CMake does *NOT* work. " 378s "At least __init__.py should be in the project source tree" 378s ) 378s 378s # ------------------------------------------------------------------------- 378s # Here is the "SOURCE" tree layout: 378s # 378s # ROOT/ 378s # 378s # setup.py 378s # 378s # [/] 378s # 378s # pureModule.py 378s # 378s # pure/ 378s # __init__.py 378s # pure.py 378s # 378s # data/ 378s # pure.dat 378s # 378s # [/] 378s # 378s # hybrid/ 378s # CMakeLists.txt 378s # __init__.py 378s # hybrid_pure.dat 378s # hybrid_pure.py 378s # 378s # data/ 378s # hybrid_data_pure.dat 378s # 378s # hybrid_2/ 378s # __init__.py 378s # hybrid_2_pure.py 378s # 378s # hybrid_2_pure/ 378s # __init__.py 378s # hybrid_2_pure_1.py 378s # hybrid_2_pure_2.py 378s # 378s # 378s # ------------------------------------------------------------------------- 378s # and here is the "BINARY" distribution layout: 378s # 378s # The comment "CMake" or "Setuptools" indicates which tool is responsible 378s # for placing the file in the tree used to create the binary distribution. 378s # 378s # ROOT/ 378s # 378s # cmakeModule.py # CMake 378s # 378s # cmake/ 378s # __init__.py # CMake 378s # cmake.py # CMake 378s # 378s # hybrid/ 378s # hybrid_cmake.dat # CMake 378s # hybrid_cmake.py # CMake 378s # hybrid_pure.dat # Setuptools 378s # hybrid_pure.py # Setuptools 378s # 378s # data/ 378s # hybrid_data_pure.dat # CMake or Setuptools 378s # hybrid_data_cmake.dat # CMake *NO TEST* 378s # 378s # hybrid_2/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure.py # CMake or Setuptools 378s # hybrid_2_cmake.py # CMake 378s # 378s # hybrid_2_pure/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure_1.py # CMake or Setuptools 378s # hybrid_2_pure_2.py # CMake or Setuptools 378s # 378s # pureModule.py # Setuptools 378s # 378s # pure/ 378s # __init__.py # Setuptools 378s # pure.py # Setuptools 378s # 378s # data/ 378s # pure.dat # Setuptools 378s 378s tmp_dir.join("setup.py").write( 378s textwrap.dedent( 378s """ 378s from skbuild import setup 378s #from setuptools import setup 378s setup( 378s name="test_hybrid_project", 378s version="1.2.3", 378s description=("an hybrid package mixing files installed by both " 378s "CMake and setuptools"), 378s author='The scikit-build team', 378s license="MIT", 378s cmake_source_dir='{cmake_source_dir}', 378s cmake_install_dir='{cmake_install_dir}', 378s # Arbitrary order of packages 378s packages=[ 378s {p_off} 'pure', 378s {h_off} 'hybrid.hybrid_2', 378s {h_off} 'hybrid', 378s {c_off} 'cmake', 378s {p_off} 'hybrid.hybrid_2_pure', 378s ], 378s py_modules=[ 378s {pm_off} '{package_base}pureModule', 378s {cm_off} '{package_base}cmakeModule', 378s ], 378s package_data={{ 378s {p_off} 'pure': ['data/pure.dat'], 378s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 378s }}, 378s # Arbitrary order of package_dir 378s package_dir = {{ 378s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 378s {p_off} 'pure': '{package_base}pure', 378s {h_off} 'hybrid': '{package_base}hybrid', 378s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 378s {c_off} 'cmake': '{package_base}cmake', 378s }} 378s ) 378s """.format( 378s cmake_source_dir=cmake_source_dir, 378s cmake_install_dir=package_base, 378s package_base=package_base_dir, 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s p_off="" if has_pure_package else "#", 378s pm_off="" if has_pure_module else "#", 378s ) 378s ) 378s ) 378s 378s src_dir = tmp_dir.ensure(package_base, dir=1) 378s 378s src_dir.join("CMakeLists.txt").write( 378s textwrap.dedent( 378s """ 378s cmake_minimum_required(VERSION 3.5.0) 378s project(hybrid NONE) 378s set(build_dir ${{CMAKE_BINARY_DIR}}) 378s 378s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 378s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 378s {c_off} install( 378s {c_off} FILES 378s {c_off} ${{build_dir}}/__init__.py 378s {c_off} ${{build_dir}}/cmake.py 378s {c_off} DESTINATION cmake 378s {c_off} ) 378s 378s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 378s {cm_off} install( 378s {cm_off} FILES ${{build_dir}}/cmakeModule.py 378s {cm_off} DESTINATION .) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 378s {h_off} DESTINATION hybrid/data) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 378s {h_off} DESTINATION hybrid/hybrid_2) 378s 378s install(CODE "message(STATUS \\\"Installation complete\\\")") 378s """.format( 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s ) 378s ) 378s ) 378s 378s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 378s path_types: Sequence[str] 378s try: 378s path_types = next( 378s iter( 378s zip( 378s *filter( 378s lambda i: i[1], 378s [ 378s ("c", has_cmake_package), 378s ("cm", has_cmake_module), 378s ("h", has_hybrid_package), 378s ("p", has_pure_package), 378s ("pm", has_pure_module), 378s ], 378s ) 378s ) 378s ) 378s ) 378s except StopIteration: 378s path_types = [] 378s 378s def select_paths(annotated_paths): 378s """Return a filtered list paths considering ``path_types``. 378s 378s `annotated_paths`` is list of tuple ``(type, path)`` where type 378s is either `c`, 'cm', `h`, `p` or 'pm'. 378s 378s """ 378s return filter(lambda i: i[0] in path_types, annotated_paths) 378s 378s # Commented paths are the one expected to be installed by CMake. For 378s # this reason, corresponding files should NOT be created in the source 378s # tree. 378s for _type, path in select_paths( 378s [ 378s # ('c', 'cmake/__init__.py'), 378s # ('c', 'cmake/cmake.py'), 378s # ('cm', 'cmakeModule.py'), 378s ("h", "hybrid/__init__.py"), 378s # ('h', 'hybrid/hybrid_cmake.dat'), 378s # ('h', 'hybrid/hybrid_cmake.py'), 378s ("h", "hybrid/hybrid_pure.dat"), 378s ("h", "hybrid/hybrid_pure.py"), 378s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 378s ("h", "hybrid/data/hybrid_data_pure.dat"), 378s ("h", "hybrid/hybrid_2/__init__.py"), 378s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 378s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 378s ("p", "hybrid/hybrid_2_pure/__init__.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 378s ("pm", "pureModule.py"), 378s ("p", "pure/__init__.py"), 378s ("p", "pure/pure.py"), 378s ("p", "pure/data/pure.dat"), 378s ] 378s ): 378s assert _type in {"p", "pm", "h"} 378s root = package_base if _type in {"p", "pm"} else cmake_source_dir 378s tmp_dir.ensure(os.path.join(root, path)) 378s 378s # Do not call the real setup function. Instead, replace it with 378s # a MagicMock allowing to check with which arguments it was invoked. 378s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 378s 378s # Convenience print function 378s def _pprint(desc, value=None): 378s print( 378s "-----------------\n" 378s f"{desc}:\n" 378s "\n" 378s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 378s ) 378s 378s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 378s 378s _pprint = ._pprint at 0x3ffb5e38680> 378s cmake_source_dir = 'to/the/base' 378s has_cmake_module = 0 378s has_cmake_package = 0 378s has_hybrid_package = 0 378s has_pure_module = 0 378s has_pure_package = 0 378s mock_setup = 378s mocker = 378s package_base = 'to/the/base' 378s package_base_dir = 'to/the/base/' 378s path_types = [] 378s select_paths = .select_paths at 0x3ffb5e38fe0> 378s src_dir = local('/tmp/pytest-of-ubuntu/pytest-114/test_setup_inputs0/to/the/base') 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-114/test_setup_inputs0') 378s with_package_base = 1 378s 378s tests/test_setup.py:849: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-114/test_setup_inputs0') 378s setup_args = ['build'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-114/test_setup_inputs0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s ________________________ test_setup_inputs[1-0-0-1-0-0] ________________________ 378s 378s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 1 378s has_pure_package = 0, has_pure_module = 0, with_package_base = 1 378s mocker = 378s 378s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 378s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 378s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_module", [0, 1]) 378s @pytest.mark.parametrize("with_package_base", [0, 1]) 378s def test_setup_inputs( 378s has_cmake_package, 378s has_cmake_module, 378s has_hybrid_package, 378s has_pure_package, 378s has_pure_module, 378s with_package_base, 378s mocker, 378s ): 378s """This test that a project can have a package with some modules 378s installed using setup.py and some other modules installed using CMake. 378s """ 378s 378s tmp_dir = _tmpdir("test_setup_inputs") 378s 378s package_base = "to/the/base" if with_package_base else "" 378s package_base_dir = package_base + "/" if package_base else "" 378s cmake_source_dir = package_base 378s 378s if cmake_source_dir and (has_cmake_package or has_cmake_module): 378s pytest.skip( 378s "unsupported configuration: " 378s "python package fully generated by CMake does *NOT* work. " 378s "At least __init__.py should be in the project source tree" 378s ) 378s 378s # ------------------------------------------------------------------------- 378s # Here is the "SOURCE" tree layout: 378s # 378s # ROOT/ 378s # 378s # setup.py 378s # 378s # [/] 378s # 378s # pureModule.py 378s # 378s # pure/ 378s # __init__.py 378s # pure.py 378s # 378s # data/ 378s # pure.dat 378s # 378s # [/] 378s # 378s # hybrid/ 378s # CMakeLists.txt 378s # __init__.py 378s # hybrid_pure.dat 378s # hybrid_pure.py 378s # 378s # data/ 378s # hybrid_data_pure.dat 378s # 378s # hybrid_2/ 378s # __init__.py 378s # hybrid_2_pure.py 378s # 378s # hybrid_2_pure/ 378s # __init__.py 378s # hybrid_2_pure_1.py 378s # hybrid_2_pure_2.py 378s # 378s # 378s # ------------------------------------------------------------------------- 378s # and here is the "BINARY" distribution layout: 378s # 378s # The comment "CMake" or "Setuptools" indicates which tool is responsible 378s # for placing the file in the tree used to create the binary distribution. 378s # 378s # ROOT/ 378s # 378s # cmakeModule.py # CMake 378s # 378s # cmake/ 378s # __init__.py # CMake 378s # cmake.py # CMake 378s # 378s # hybrid/ 378s # hybrid_cmake.dat # CMake 378s # hybrid_cmake.py # CMake 378s # hybrid_pure.dat # Setuptools 378s # hybrid_pure.py # Setuptools 378s # 378s # data/ 378s # hybrid_data_pure.dat # CMake or Setuptools 378s # hybrid_data_cmake.dat # CMake *NO TEST* 378s # 378s # hybrid_2/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure.py # CMake or Setuptools 378s # hybrid_2_cmake.py # CMake 378s # 378s # hybrid_2_pure/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure_1.py # CMake or Setuptools 378s # hybrid_2_pure_2.py # CMake or Setuptools 378s # 378s # pureModule.py # Setuptools 378s # 378s # pure/ 378s # __init__.py # Setuptools 378s # pure.py # Setuptools 378s # 378s # data/ 378s # pure.dat # Setuptools 378s 378s tmp_dir.join("setup.py").write( 378s textwrap.dedent( 378s """ 378s from skbuild import setup 378s #from setuptools import setup 378s setup( 378s name="test_hybrid_project", 378s version="1.2.3", 378s description=("an hybrid package mixing files installed by both " 378s "CMake and setuptools"), 378s author='The scikit-build team', 378s license="MIT", 378s cmake_source_dir='{cmake_source_dir}', 378s cmake_install_dir='{cmake_install_dir}', 378s # Arbitrary order of packages 378s packages=[ 378s {p_off} 'pure', 378s {h_off} 'hybrid.hybrid_2', 378s {h_off} 'hybrid', 378s {c_off} 'cmake', 378s {p_off} 'hybrid.hybrid_2_pure', 378s ], 378s py_modules=[ 378s {pm_off} '{package_base}pureModule', 378s {cm_off} '{package_base}cmakeModule', 378s ], 378s package_data={{ 378s {p_off} 'pure': ['data/pure.dat'], 378s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 378s }}, 378s # Arbitrary order of package_dir 378s package_dir = {{ 378s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 378s {p_off} 'pure': '{package_base}pure', 378s {h_off} 'hybrid': '{package_base}hybrid', 378s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 378s {c_off} 'cmake': '{package_base}cmake', 378s }} 378s ) 378s """.format( 378s cmake_source_dir=cmake_source_dir, 378s cmake_install_dir=package_base, 378s package_base=package_base_dir, 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s p_off="" if has_pure_package else "#", 378s pm_off="" if has_pure_module else "#", 378s ) 378s ) 378s ) 378s 378s src_dir = tmp_dir.ensure(package_base, dir=1) 378s 378s src_dir.join("CMakeLists.txt").write( 378s textwrap.dedent( 378s """ 378s cmake_minimum_required(VERSION 3.5.0) 378s project(hybrid NONE) 378s set(build_dir ${{CMAKE_BINARY_DIR}}) 378s 378s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 378s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 378s {c_off} install( 378s {c_off} FILES 378s {c_off} ${{build_dir}}/__init__.py 378s {c_off} ${{build_dir}}/cmake.py 378s {c_off} DESTINATION cmake 378s {c_off} ) 378s 378s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 378s {cm_off} install( 378s {cm_off} FILES ${{build_dir}}/cmakeModule.py 378s {cm_off} DESTINATION .) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 378s {h_off} DESTINATION hybrid/data) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 378s {h_off} DESTINATION hybrid/hybrid_2) 378s 378s install(CODE "message(STATUS \\\"Installation complete\\\")") 378s """.format( 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s ) 378s ) 378s ) 378s 378s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 378s path_types: Sequence[str] 378s try: 378s path_types = next( 378s iter( 378s zip( 378s *filter( 378s lambda i: i[1], 378s [ 378s ("c", has_cmake_package), 378s ("cm", has_cmake_module), 378s ("h", has_hybrid_package), 378s ("p", has_pure_package), 378s ("pm", has_pure_module), 378s ], 378s ) 378s ) 378s ) 378s ) 378s except StopIteration: 378s path_types = [] 378s 378s def select_paths(annotated_paths): 378s """Return a filtered list paths considering ``path_types``. 378s 378s `annotated_paths`` is list of tuple ``(type, path)`` where type 378s is either `c`, 'cm', `h`, `p` or 'pm'. 378s 378s """ 378s return filter(lambda i: i[0] in path_types, annotated_paths) 378s 378s # Commented paths are the one expected to be installed by CMake. For 378s # this reason, corresponding files should NOT be created in the source 378s # tree. 378s for _type, path in select_paths( 378s [ 378s # ('c', 'cmake/__init__.py'), 378s # ('c', 'cmake/cmake.py'), 378s # ('cm', 'cmakeModule.py'), 378s ("h", "hybrid/__init__.py"), 378s # ('h', 'hybrid/hybrid_cmake.dat'), 378s # ('h', 'hybrid/hybrid_cmake.py'), 378s ("h", "hybrid/hybrid_pure.dat"), 378s ("h", "hybrid/hybrid_pure.py"), 378s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 378s ("h", "hybrid/data/hybrid_data_pure.dat"), 378s ("h", "hybrid/hybrid_2/__init__.py"), 378s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 378s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 378s ("p", "hybrid/hybrid_2_pure/__init__.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 378s ("pm", "pureModule.py"), 378s ("p", "pure/__init__.py"), 378s ("p", "pure/pure.py"), 378s ("p", "pure/data/pure.dat"), 378s ] 378s ): 378s assert _type in {"p", "pm", "h"} 378s root = package_base if _type in {"p", "pm"} else cmake_source_dir 378s tmp_dir.ensure(os.path.join(root, path)) 378s 378s # Do not call the real setup function. Instead, replace it with 378s # a MagicMock allowing to check with which arguments it was invoked. 378s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 378s 378s # Convenience print function 378s def _pprint(desc, value=None): 378s print( 378s "-----------------\n" 378s f"{desc}:\n" 378s "\n" 378s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 378s ) 378s 378s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 378s 378s _pprint = ._pprint at 0x3ffb61c5300> 378s _type = 'h' 378s cmake_source_dir = 'to/the/base' 378s has_cmake_module = 0 378s has_cmake_package = 0 378s has_hybrid_package = 1 378s has_pure_module = 0 378s has_pure_package = 0 378s mock_setup = 378s mocker = 378s package_base = 'to/the/base' 378s package_base_dir = 'to/the/base/' 378s path = 'hybrid/hybrid_2/hybrid_2_pure.py' 378s path_types = ('h',) 378s root = 'to/the/base' 378s select_paths = .select_paths at 0x3ffb602a160> 378s src_dir = local('/tmp/pytest-of-ubuntu/pytest-118/test_setup_inputs0/to/the/base') 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-118/test_setup_inputs0') 378s with_package_base = 1 378s 378s tests/test_setup.py:849: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-118/test_setup_inputs0') 378s setup_args = ['build'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-118/test_setup_inputs0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s ________________________ test_setup_inputs[1-0-1-0-0-0] ________________________ 378s 378s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 0 378s has_pure_package = 1, has_pure_module = 0, with_package_base = 1 378s mocker = 378s 378s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 378s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 378s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_module", [0, 1]) 378s @pytest.mark.parametrize("with_package_base", [0, 1]) 378s def test_setup_inputs( 378s has_cmake_package, 378s has_cmake_module, 378s has_hybrid_package, 378s has_pure_package, 378s has_pure_module, 378s with_package_base, 378s mocker, 378s ): 378s """This test that a project can have a package with some modules 378s installed using setup.py and some other modules installed using CMake. 378s """ 378s 378s tmp_dir = _tmpdir("test_setup_inputs") 378s 378s package_base = "to/the/base" if with_package_base else "" 378s package_base_dir = package_base + "/" if package_base else "" 378s cmake_source_dir = package_base 378s 378s if cmake_source_dir and (has_cmake_package or has_cmake_module): 378s pytest.skip( 378s "unsupported configuration: " 378s "python package fully generated by CMake does *NOT* work. " 378s "At least __init__.py should be in the project source tree" 378s ) 378s 378s # ------------------------------------------------------------------------- 378s # Here is the "SOURCE" tree layout: 378s # 378s # ROOT/ 378s # 378s # setup.py 378s # 378s # [/] 378s # 378s # pureModule.py 378s # 378s # pure/ 378s # __init__.py 378s # pure.py 378s # 378s # data/ 378s # pure.dat 378s # 378s # [/] 378s # 378s # hybrid/ 378s # CMakeLists.txt 378s # __init__.py 378s # hybrid_pure.dat 378s # hybrid_pure.py 378s # 378s # data/ 378s # hybrid_data_pure.dat 378s # 378s # hybrid_2/ 378s # __init__.py 378s # hybrid_2_pure.py 378s # 378s # hybrid_2_pure/ 378s # __init__.py 378s # hybrid_2_pure_1.py 378s # hybrid_2_pure_2.py 378s # 378s # 378s # ------------------------------------------------------------------------- 378s # and here is the "BINARY" distribution layout: 378s # 378s # The comment "CMake" or "Setuptools" indicates which tool is responsible 378s # for placing the file in the tree used to create the binary distribution. 378s # 378s # ROOT/ 378s # 378s # cmakeModule.py # CMake 378s # 378s # cmake/ 378s # __init__.py # CMake 378s # cmake.py # CMake 378s # 378s # hybrid/ 378s # hybrid_cmake.dat # CMake 378s # hybrid_cmake.py # CMake 378s # hybrid_pure.dat # Setuptools 378s # hybrid_pure.py # Setuptools 378s # 378s # data/ 378s # hybrid_data_pure.dat # CMake or Setuptools 378s # hybrid_data_cmake.dat # CMake *NO TEST* 378s # 378s # hybrid_2/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure.py # CMake or Setuptools 378s # hybrid_2_cmake.py # CMake 378s # 378s # hybrid_2_pure/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure_1.py # CMake or Setuptools 378s # hybrid_2_pure_2.py # CMake or Setuptools 378s # 378s # pureModule.py # Setuptools 378s # 378s # pure/ 378s # __init__.py # Setuptools 378s # pure.py # Setuptools 378s # 378s # data/ 378s # pure.dat # Setuptools 378s 378s tmp_dir.join("setup.py").write( 378s textwrap.dedent( 378s """ 378s from skbuild import setup 378s #from setuptools import setup 378s setup( 378s name="test_hybrid_project", 378s version="1.2.3", 378s description=("an hybrid package mixing files installed by both " 378s "CMake and setuptools"), 378s author='The scikit-build team', 378s license="MIT", 378s cmake_source_dir='{cmake_source_dir}', 378s cmake_install_dir='{cmake_install_dir}', 378s # Arbitrary order of packages 378s packages=[ 378s {p_off} 'pure', 378s {h_off} 'hybrid.hybrid_2', 378s {h_off} 'hybrid', 378s {c_off} 'cmake', 378s {p_off} 'hybrid.hybrid_2_pure', 378s ], 378s py_modules=[ 378s {pm_off} '{package_base}pureModule', 378s {cm_off} '{package_base}cmakeModule', 378s ], 378s package_data={{ 378s {p_off} 'pure': ['data/pure.dat'], 378s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 378s }}, 378s # Arbitrary order of package_dir 378s package_dir = {{ 378s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 378s {p_off} 'pure': '{package_base}pure', 378s {h_off} 'hybrid': '{package_base}hybrid', 378s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 378s {c_off} 'cmake': '{package_base}cmake', 378s }} 378s ) 378s """.format( 378s cmake_source_dir=cmake_source_dir, 378s cmake_install_dir=package_base, 378s package_base=package_base_dir, 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s p_off="" if has_pure_package else "#", 378s pm_off="" if has_pure_module else "#", 378s ) 378s ) 378s ) 378s 378s src_dir = tmp_dir.ensure(package_base, dir=1) 378s 378s src_dir.join("CMakeLists.txt").write( 378s textwrap.dedent( 378s """ 378s cmake_minimum_required(VERSION 3.5.0) 378s project(hybrid NONE) 378s set(build_dir ${{CMAKE_BINARY_DIR}}) 378s 378s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 378s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 378s {c_off} install( 378s {c_off} FILES 378s {c_off} ${{build_dir}}/__init__.py 378s {c_off} ${{build_dir}}/cmake.py 378s {c_off} DESTINATION cmake 378s {c_off} ) 378s 378s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 378s {cm_off} install( 378s {cm_off} FILES ${{build_dir}}/cmakeModule.py 378s {cm_off} DESTINATION .) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 378s {h_off} DESTINATION hybrid/data) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 378s {h_off} DESTINATION hybrid/hybrid_2) 378s 378s install(CODE "message(STATUS \\\"Installation complete\\\")") 378s """.format( 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s ) 378s ) 378s ) 378s 378s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 378s path_types: Sequence[str] 378s try: 378s path_types = next( 378s iter( 378s zip( 378s *filter( 378s lambda i: i[1], 378s [ 378s ("c", has_cmake_package), 378s ("cm", has_cmake_module), 378s ("h", has_hybrid_package), 378s ("p", has_pure_package), 378s ("pm", has_pure_module), 378s ], 378s ) 378s ) 378s ) 378s ) 378s except StopIteration: 378s path_types = [] 378s 378s def select_paths(annotated_paths): 378s """Return a filtered list paths considering ``path_types``. 378s 378s `annotated_paths`` is list of tuple ``(type, path)`` where type 378s is either `c`, 'cm', `h`, `p` or 'pm'. 378s 378s """ 378s return filter(lambda i: i[0] in path_types, annotated_paths) 378s 378s # Commented paths are the one expected to be installed by CMake. For 378s # this reason, corresponding files should NOT be created in the source 378s # tree. 378s for _type, path in select_paths( 378s [ 378s # ('c', 'cmake/__init__.py'), 378s # ('c', 'cmake/cmake.py'), 378s # ('cm', 'cmakeModule.py'), 378s ("h", "hybrid/__init__.py"), 378s # ('h', 'hybrid/hybrid_cmake.dat'), 378s # ('h', 'hybrid/hybrid_cmake.py'), 378s ("h", "hybrid/hybrid_pure.dat"), 378s ("h", "hybrid/hybrid_pure.py"), 378s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 378s ("h", "hybrid/data/hybrid_data_pure.dat"), 378s ("h", "hybrid/hybrid_2/__init__.py"), 378s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 378s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 378s ("p", "hybrid/hybrid_2_pure/__init__.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 378s ("pm", "pureModule.py"), 378s ("p", "pure/__init__.py"), 378s ("p", "pure/pure.py"), 378s ("p", "pure/data/pure.dat"), 378s ] 378s ): 378s assert _type in {"p", "pm", "h"} 378s root = package_base if _type in {"p", "pm"} else cmake_source_dir 378s tmp_dir.ensure(os.path.join(root, path)) 378s 378s # Do not call the real setup function. Instead, replace it with 378s # a MagicMock allowing to check with which arguments it was invoked. 378s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 378s 378s # Convenience print function 378s def _pprint(desc, value=None): 378s print( 378s "-----------------\n" 378s f"{desc}:\n" 378s "\n" 378s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 378s ) 378s 378s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 378s 378s _pprint = ._pprint at 0x3ffb6028a40> 378s _type = 'p' 378s cmake_source_dir = 'to/the/base' 378s has_cmake_module = 0 378s has_cmake_package = 0 378s has_hybrid_package = 0 378s has_pure_module = 0 378s has_pure_package = 1 378s mock_setup = 378s mocker = 378s package_base = 'to/the/base' 378s package_base_dir = 'to/the/base/' 378s path = 'pure/data/pure.dat' 378s path_types = ('p',) 378s root = 'to/the/base' 378s select_paths = .select_paths at 0x3ffb60296c0> 378s src_dir = local('/tmp/pytest-of-ubuntu/pytest-122/test_setup_inputs0/to/the/base') 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-122/test_setup_inputs0') 378s with_package_base = 1 378s 378s tests/test_setup.py:849: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-122/test_setup_inputs0') 378s setup_args = ['build'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-122/test_setup_inputs0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s ________________________ test_setup_inputs[1-0-1-1-0-0] ________________________ 378s 378s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 1 378s has_pure_package = 1, has_pure_module = 0, with_package_base = 1 378s mocker = 378s 378s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 378s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 378s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_module", [0, 1]) 378s @pytest.mark.parametrize("with_package_base", [0, 1]) 378s def test_setup_inputs( 378s has_cmake_package, 378s has_cmake_module, 378s has_hybrid_package, 378s has_pure_package, 378s has_pure_module, 378s with_package_base, 378s mocker, 378s ): 378s """This test that a project can have a package with some modules 378s installed using setup.py and some other modules installed using CMake. 378s """ 378s 378s tmp_dir = _tmpdir("test_setup_inputs") 378s 378s package_base = "to/the/base" if with_package_base else "" 378s package_base_dir = package_base + "/" if package_base else "" 378s cmake_source_dir = package_base 378s 378s if cmake_source_dir and (has_cmake_package or has_cmake_module): 378s pytest.skip( 378s "unsupported configuration: " 378s "python package fully generated by CMake does *NOT* work. " 378s "At least __init__.py should be in the project source tree" 378s ) 378s 378s # ------------------------------------------------------------------------- 378s # Here is the "SOURCE" tree layout: 378s # 378s # ROOT/ 378s # 378s # setup.py 378s # 378s # [/] 378s # 378s # pureModule.py 378s # 378s # pure/ 378s # __init__.py 378s # pure.py 378s # 378s # data/ 378s # pure.dat 378s # 378s # [/] 378s # 378s # hybrid/ 378s # CMakeLists.txt 378s # __init__.py 378s # hybrid_pure.dat 378s # hybrid_pure.py 378s # 378s # data/ 378s # hybrid_data_pure.dat 378s # 378s # hybrid_2/ 378s # __init__.py 378s # hybrid_2_pure.py 378s # 378s # hybrid_2_pure/ 378s # __init__.py 378s # hybrid_2_pure_1.py 378s # hybrid_2_pure_2.py 378s # 378s # 378s # ------------------------------------------------------------------------- 378s # and here is the "BINARY" distribution layout: 378s # 378s # The comment "CMake" or "Setuptools" indicates which tool is responsible 378s # for placing the file in the tree used to create the binary distribution. 378s # 378s # ROOT/ 378s # 378s # cmakeModule.py # CMake 378s # 378s # cmake/ 378s # __init__.py # CMake 378s # cmake.py # CMake 378s # 378s # hybrid/ 378s # hybrid_cmake.dat # CMake 378s # hybrid_cmake.py # CMake 378s # hybrid_pure.dat # Setuptools 378s # hybrid_pure.py # Setuptools 378s # 378s # data/ 378s # hybrid_data_pure.dat # CMake or Setuptools 378s # hybrid_data_cmake.dat # CMake *NO TEST* 378s # 378s # hybrid_2/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure.py # CMake or Setuptools 378s # hybrid_2_cmake.py # CMake 378s # 378s # hybrid_2_pure/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure_1.py # CMake or Setuptools 378s # hybrid_2_pure_2.py # CMake or Setuptools 378s # 378s # pureModule.py # Setuptools 378s # 378s # pure/ 378s # __init__.py # Setuptools 378s # pure.py # Setuptools 378s # 378s # data/ 378s # pure.dat # Setuptools 378s 378s tmp_dir.join("setup.py").write( 378s textwrap.dedent( 378s """ 378s from skbuild import setup 378s #from setuptools import setup 378s setup( 378s name="test_hybrid_project", 378s version="1.2.3", 378s description=("an hybrid package mixing files installed by both " 378s "CMake and setuptools"), 378s author='The scikit-build team', 378s license="MIT", 378s cmake_source_dir='{cmake_source_dir}', 378s cmake_install_dir='{cmake_install_dir}', 378s # Arbitrary order of packages 378s packages=[ 378s {p_off} 'pure', 378s {h_off} 'hybrid.hybrid_2', 378s {h_off} 'hybrid', 378s {c_off} 'cmake', 378s {p_off} 'hybrid.hybrid_2_pure', 378s ], 378s py_modules=[ 378s {pm_off} '{package_base}pureModule', 378s {cm_off} '{package_base}cmakeModule', 378s ], 378s package_data={{ 378s {p_off} 'pure': ['data/pure.dat'], 378s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 378s }}, 378s # Arbitrary order of package_dir 378s package_dir = {{ 378s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 378s {p_off} 'pure': '{package_base}pure', 378s {h_off} 'hybrid': '{package_base}hybrid', 378s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 378s {c_off} 'cmake': '{package_base}cmake', 378s }} 378s ) 378s """.format( 378s cmake_source_dir=cmake_source_dir, 378s cmake_install_dir=package_base, 378s package_base=package_base_dir, 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s p_off="" if has_pure_package else "#", 378s pm_off="" if has_pure_module else "#", 378s ) 378s ) 378s ) 378s 378s src_dir = tmp_dir.ensure(package_base, dir=1) 378s 378s src_dir.join("CMakeLists.txt").write( 378s textwrap.dedent( 378s """ 378s cmake_minimum_required(VERSION 3.5.0) 378s project(hybrid NONE) 378s set(build_dir ${{CMAKE_BINARY_DIR}}) 378s 378s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 378s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 378s {c_off} install( 378s {c_off} FILES 378s {c_off} ${{build_dir}}/__init__.py 378s {c_off} ${{build_dir}}/cmake.py 378s {c_off} DESTINATION cmake 378s {c_off} ) 378s 378s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 378s {cm_off} install( 378s {cm_off} FILES ${{build_dir}}/cmakeModule.py 378s {cm_off} DESTINATION .) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 378s {h_off} DESTINATION hybrid/data) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 378s {h_off} DESTINATION hybrid/hybrid_2) 378s 378s install(CODE "message(STATUS \\\"Installation complete\\\")") 378s """.format( 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s ) 378s ) 378s ) 378s 378s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 378s path_types: Sequence[str] 378s try: 378s path_types = next( 378s iter( 378s zip( 378s *filter( 378s lambda i: i[1], 378s [ 378s ("c", has_cmake_package), 378s ("cm", has_cmake_module), 378s ("h", has_hybrid_package), 378s ("p", has_pure_package), 378s ("pm", has_pure_module), 378s ], 378s ) 378s ) 378s ) 378s ) 378s except StopIteration: 378s path_types = [] 378s 378s def select_paths(annotated_paths): 378s """Return a filtered list paths considering ``path_types``. 378s 378s `annotated_paths`` is list of tuple ``(type, path)`` where type 378s is either `c`, 'cm', `h`, `p` or 'pm'. 378s 378s """ 378s return filter(lambda i: i[0] in path_types, annotated_paths) 378s 378s # Commented paths are the one expected to be installed by CMake. For 378s # this reason, corresponding files should NOT be created in the source 378s # tree. 378s for _type, path in select_paths( 378s [ 378s # ('c', 'cmake/__init__.py'), 378s # ('c', 'cmake/cmake.py'), 378s # ('cm', 'cmakeModule.py'), 378s ("h", "hybrid/__init__.py"), 378s # ('h', 'hybrid/hybrid_cmake.dat'), 378s # ('h', 'hybrid/hybrid_cmake.py'), 378s ("h", "hybrid/hybrid_pure.dat"), 378s ("h", "hybrid/hybrid_pure.py"), 378s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 378s ("h", "hybrid/data/hybrid_data_pure.dat"), 378s ("h", "hybrid/hybrid_2/__init__.py"), 378s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 378s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 378s ("p", "hybrid/hybrid_2_pure/__init__.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 378s ("pm", "pureModule.py"), 378s ("p", "pure/__init__.py"), 378s ("p", "pure/pure.py"), 378s ("p", "pure/data/pure.dat"), 378s ] 378s ): 378s assert _type in {"p", "pm", "h"} 378s root = package_base if _type in {"p", "pm"} else cmake_source_dir 378s tmp_dir.ensure(os.path.join(root, path)) 378s 378s # Do not call the real setup function. Instead, replace it with 378s # a MagicMock allowing to check with which arguments it was invoked. 378s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 378s 378s # Convenience print function 378s def _pprint(desc, value=None): 378s print( 378s "-----------------\n" 378s f"{desc}:\n" 378s "\n" 378s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 378s ) 378s 378s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 378s 378s _pprint = ._pprint at 0x3ffb6029ee0> 378s _type = 'p' 378s cmake_source_dir = 'to/the/base' 378s has_cmake_module = 0 378s has_cmake_package = 0 378s has_hybrid_package = 1 378s has_pure_module = 0 378s has_pure_package = 1 378s mock_setup = 378s mocker = 378s package_base = 'to/the/base' 378s package_base_dir = 'to/the/base/' 378s path = 'pure/data/pure.dat' 378s path_types = ('h', 'p') 378s root = 'to/the/base' 378s select_paths = .select_paths at 0x3ffb602b880> 378s src_dir = local('/tmp/pytest-of-ubuntu/pytest-126/test_setup_inputs0/to/the/base') 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-126/test_setup_inputs0') 378s with_package_base = 1 378s 378s tests/test_setup.py:849: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-126/test_setup_inputs0') 378s setup_args = ['build'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-126/test_setup_inputs0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s ________________________ test_setup_inputs[1-1-0-0-0-0] ________________________ 378s 378s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 0 378s has_pure_package = 0, has_pure_module = 1, with_package_base = 1 378s mocker = 378s 378s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 378s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 378s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_module", [0, 1]) 378s @pytest.mark.parametrize("with_package_base", [0, 1]) 378s def test_setup_inputs( 378s has_cmake_package, 378s has_cmake_module, 378s has_hybrid_package, 378s has_pure_package, 378s has_pure_module, 378s with_package_base, 378s mocker, 378s ): 378s """This test that a project can have a package with some modules 378s installed using setup.py and some other modules installed using CMake. 378s """ 378s 378s tmp_dir = _tmpdir("test_setup_inputs") 378s 378s package_base = "to/the/base" if with_package_base else "" 378s package_base_dir = package_base + "/" if package_base else "" 378s cmake_source_dir = package_base 378s 378s if cmake_source_dir and (has_cmake_package or has_cmake_module): 378s pytest.skip( 378s "unsupported configuration: " 378s "python package fully generated by CMake does *NOT* work. " 378s "At least __init__.py should be in the project source tree" 378s ) 378s 378s # ------------------------------------------------------------------------- 378s # Here is the "SOURCE" tree layout: 378s # 378s # ROOT/ 378s # 378s # setup.py 378s # 378s # [/] 378s # 378s # pureModule.py 378s # 378s # pure/ 378s # __init__.py 378s # pure.py 378s # 378s # data/ 378s # pure.dat 378s # 378s # [/] 378s # 378s # hybrid/ 378s # CMakeLists.txt 378s # __init__.py 378s # hybrid_pure.dat 378s # hybrid_pure.py 378s # 378s # data/ 378s # hybrid_data_pure.dat 378s # 378s # hybrid_2/ 378s # __init__.py 378s # hybrid_2_pure.py 378s # 378s # hybrid_2_pure/ 378s # __init__.py 378s # hybrid_2_pure_1.py 378s # hybrid_2_pure_2.py 378s # 378s # 378s # ------------------------------------------------------------------------- 378s # and here is the "BINARY" distribution layout: 378s # 378s # The comment "CMake" or "Setuptools" indicates which tool is responsible 378s # for placing the file in the tree used to create the binary distribution. 378s # 378s # ROOT/ 378s # 378s # cmakeModule.py # CMake 378s # 378s # cmake/ 378s # __init__.py # CMake 378s # cmake.py # CMake 378s # 378s # hybrid/ 378s # hybrid_cmake.dat # CMake 378s # hybrid_cmake.py # CMake 378s # hybrid_pure.dat # Setuptools 378s # hybrid_pure.py # Setuptools 378s # 378s # data/ 378s # hybrid_data_pure.dat # CMake or Setuptools 378s # hybrid_data_cmake.dat # CMake *NO TEST* 378s # 378s # hybrid_2/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure.py # CMake or Setuptools 378s # hybrid_2_cmake.py # CMake 378s # 378s # hybrid_2_pure/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure_1.py # CMake or Setuptools 378s # hybrid_2_pure_2.py # CMake or Setuptools 378s # 378s # pureModule.py # Setuptools 378s # 378s # pure/ 378s # __init__.py # Setuptools 378s # pure.py # Setuptools 378s # 378s # data/ 378s # pure.dat # Setuptools 378s 378s tmp_dir.join("setup.py").write( 378s textwrap.dedent( 378s """ 378s from skbuild import setup 378s #from setuptools import setup 378s setup( 378s name="test_hybrid_project", 378s version="1.2.3", 378s description=("an hybrid package mixing files installed by both " 378s "CMake and setuptools"), 378s author='The scikit-build team', 378s license="MIT", 378s cmake_source_dir='{cmake_source_dir}', 378s cmake_install_dir='{cmake_install_dir}', 378s # Arbitrary order of packages 378s packages=[ 378s {p_off} 'pure', 378s {h_off} 'hybrid.hybrid_2', 378s {h_off} 'hybrid', 378s {c_off} 'cmake', 378s {p_off} 'hybrid.hybrid_2_pure', 378s ], 378s py_modules=[ 378s {pm_off} '{package_base}pureModule', 378s {cm_off} '{package_base}cmakeModule', 378s ], 378s package_data={{ 378s {p_off} 'pure': ['data/pure.dat'], 378s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 378s }}, 378s # Arbitrary order of package_dir 378s package_dir = {{ 378s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 378s {p_off} 'pure': '{package_base}pure', 378s {h_off} 'hybrid': '{package_base}hybrid', 378s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 378s {c_off} 'cmake': '{package_base}cmake', 378s }} 378s ) 378s """.format( 378s cmake_source_dir=cmake_source_dir, 378s cmake_install_dir=package_base, 378s package_base=package_base_dir, 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s p_off="" if has_pure_package else "#", 378s pm_off="" if has_pure_module else "#", 378s ) 378s ) 378s ) 378s 378s src_dir = tmp_dir.ensure(package_base, dir=1) 378s 378s src_dir.join("CMakeLists.txt").write( 378s textwrap.dedent( 378s """ 378s cmake_minimum_required(VERSION 3.5.0) 378s project(hybrid NONE) 378s set(build_dir ${{CMAKE_BINARY_DIR}}) 378s 378s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 378s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 378s {c_off} install( 378s {c_off} FILES 378s {c_off} ${{build_dir}}/__init__.py 378s {c_off} ${{build_dir}}/cmake.py 378s {c_off} DESTINATION cmake 378s {c_off} ) 378s 378s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 378s {cm_off} install( 378s {cm_off} FILES ${{build_dir}}/cmakeModule.py 378s {cm_off} DESTINATION .) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 378s {h_off} DESTINATION hybrid/data) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 378s {h_off} DESTINATION hybrid/hybrid_2) 378s 378s install(CODE "message(STATUS \\\"Installation complete\\\")") 378s """.format( 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s ) 378s ) 378s ) 378s 378s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 378s path_types: Sequence[str] 378s try: 378s path_types = next( 378s iter( 378s zip( 378s *filter( 378s lambda i: i[1], 378s [ 378s ("c", has_cmake_package), 378s ("cm", has_cmake_module), 378s ("h", has_hybrid_package), 378s ("p", has_pure_package), 378s ("pm", has_pure_module), 378s ], 378s ) 378s ) 378s ) 378s ) 378s except StopIteration: 378s path_types = [] 378s 378s def select_paths(annotated_paths): 378s """Return a filtered list paths considering ``path_types``. 378s 378s `annotated_paths`` is list of tuple ``(type, path)`` where type 378s is either `c`, 'cm', `h`, `p` or 'pm'. 378s 378s """ 378s return filter(lambda i: i[0] in path_types, annotated_paths) 378s 378s # Commented paths are the one expected to be installed by CMake. For 378s # this reason, corresponding files should NOT be created in the source 378s # tree. 378s for _type, path in select_paths( 378s [ 378s # ('c', 'cmake/__init__.py'), 378s # ('c', 'cmake/cmake.py'), 378s # ('cm', 'cmakeModule.py'), 378s ("h", "hybrid/__init__.py"), 378s # ('h', 'hybrid/hybrid_cmake.dat'), 378s # ('h', 'hybrid/hybrid_cmake.py'), 378s ("h", "hybrid/hybrid_pure.dat"), 378s ("h", "hybrid/hybrid_pure.py"), 378s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 378s ("h", "hybrid/data/hybrid_data_pure.dat"), 378s ("h", "hybrid/hybrid_2/__init__.py"), 378s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 378s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 378s ("p", "hybrid/hybrid_2_pure/__init__.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 378s ("pm", "pureModule.py"), 378s ("p", "pure/__init__.py"), 378s ("p", "pure/pure.py"), 378s ("p", "pure/data/pure.dat"), 378s ] 378s ): 378s assert _type in {"p", "pm", "h"} 378s root = package_base if _type in {"p", "pm"} else cmake_source_dir 378s tmp_dir.ensure(os.path.join(root, path)) 378s 378s # Do not call the real setup function. Instead, replace it with 378s # a MagicMock allowing to check with which arguments it was invoked. 378s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 378s 378s # Convenience print function 378s def _pprint(desc, value=None): 378s print( 378s "-----------------\n" 378s f"{desc}:\n" 378s "\n" 378s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 378s ) 378s 378s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 378s 378s _pprint = ._pprint at 0x3ffb60284a0> 378s _type = 'pm' 378s cmake_source_dir = 'to/the/base' 378s has_cmake_module = 0 378s has_cmake_package = 0 378s has_hybrid_package = 0 378s has_pure_module = 1 378s has_pure_package = 0 378s mock_setup = 378s mocker = 378s package_base = 'to/the/base' 378s package_base_dir = 'to/the/base/' 378s path = 'pureModule.py' 378s path_types = ('pm',) 378s root = 'to/the/base' 378s select_paths = .select_paths at 0x3ffb602a200> 378s src_dir = local('/tmp/pytest-of-ubuntu/pytest-130/test_setup_inputs0/to/the/base') 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-130/test_setup_inputs0') 378s with_package_base = 1 378s 378s tests/test_setup.py:849: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-130/test_setup_inputs0') 378s setup_args = ['build'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-130/test_setup_inputs0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s ________________________ test_setup_inputs[1-1-0-1-0-0] ________________________ 378s 378s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 1 378s has_pure_package = 0, has_pure_module = 1, with_package_base = 1 378s mocker = 378s 378s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 378s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 378s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_module", [0, 1]) 378s @pytest.mark.parametrize("with_package_base", [0, 1]) 378s def test_setup_inputs( 378s has_cmake_package, 378s has_cmake_module, 378s has_hybrid_package, 378s has_pure_package, 378s has_pure_module, 378s with_package_base, 378s mocker, 378s ): 378s """This test that a project can have a package with some modules 378s installed using setup.py and some other modules installed using CMake. 378s """ 378s 378s tmp_dir = _tmpdir("test_setup_inputs") 378s 378s package_base = "to/the/base" if with_package_base else "" 378s package_base_dir = package_base + "/" if package_base else "" 378s cmake_source_dir = package_base 378s 378s if cmake_source_dir and (has_cmake_package or has_cmake_module): 378s pytest.skip( 378s "unsupported configuration: " 378s "python package fully generated by CMake does *NOT* work. " 378s "At least __init__.py should be in the project source tree" 378s ) 378s 378s # ------------------------------------------------------------------------- 378s # Here is the "SOURCE" tree layout: 378s # 378s # ROOT/ 378s # 378s # setup.py 378s # 378s # [/] 378s # 378s # pureModule.py 378s # 378s # pure/ 378s # __init__.py 378s # pure.py 378s # 378s # data/ 378s # pure.dat 378s # 378s # [/] 378s # 378s # hybrid/ 378s # CMakeLists.txt 378s # __init__.py 378s # hybrid_pure.dat 378s # hybrid_pure.py 378s # 378s # data/ 378s # hybrid_data_pure.dat 378s # 378s # hybrid_2/ 378s # __init__.py 378s # hybrid_2_pure.py 378s # 378s # hybrid_2_pure/ 378s # __init__.py 378s # hybrid_2_pure_1.py 378s # hybrid_2_pure_2.py 378s # 378s # 378s # ------------------------------------------------------------------------- 378s # and here is the "BINARY" distribution layout: 378s # 378s # The comment "CMake" or "Setuptools" indicates which tool is responsible 378s # for placing the file in the tree used to create the binary distribution. 378s # 378s # ROOT/ 378s # 378s # cmakeModule.py # CMake 378s # 378s # cmake/ 378s # __init__.py # CMake 378s # cmake.py # CMake 378s # 378s # hybrid/ 378s # hybrid_cmake.dat # CMake 378s # hybrid_cmake.py # CMake 378s # hybrid_pure.dat # Setuptools 378s # hybrid_pure.py # Setuptools 378s # 378s # data/ 378s # hybrid_data_pure.dat # CMake or Setuptools 378s # hybrid_data_cmake.dat # CMake *NO TEST* 378s # 378s # hybrid_2/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure.py # CMake or Setuptools 378s # hybrid_2_cmake.py # CMake 378s # 378s # hybrid_2_pure/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure_1.py # CMake or Setuptools 378s # hybrid_2_pure_2.py # CMake or Setuptools 378s # 378s # pureModule.py # Setuptools 378s # 378s # pure/ 378s # __init__.py # Setuptools 378s # pure.py # Setuptools 378s # 378s # data/ 378s # pure.dat # Setuptools 378s 378s tmp_dir.join("setup.py").write( 378s textwrap.dedent( 378s """ 378s from skbuild import setup 378s #from setuptools import setup 378s setup( 378s name="test_hybrid_project", 378s version="1.2.3", 378s description=("an hybrid package mixing files installed by both " 378s "CMake and setuptools"), 378s author='The scikit-build team', 378s license="MIT", 378s cmake_source_dir='{cmake_source_dir}', 378s cmake_install_dir='{cmake_install_dir}', 378s # Arbitrary order of packages 378s packages=[ 378s {p_off} 'pure', 378s {h_off} 'hybrid.hybrid_2', 378s {h_off} 'hybrid', 378s {c_off} 'cmake', 378s {p_off} 'hybrid.hybrid_2_pure', 378s ], 378s py_modules=[ 378s {pm_off} '{package_base}pureModule', 378s {cm_off} '{package_base}cmakeModule', 378s ], 378s package_data={{ 378s {p_off} 'pure': ['data/pure.dat'], 378s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 378s }}, 378s # Arbitrary order of package_dir 378s package_dir = {{ 378s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 378s {p_off} 'pure': '{package_base}pure', 378s {h_off} 'hybrid': '{package_base}hybrid', 378s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 378s {c_off} 'cmake': '{package_base}cmake', 378s }} 378s ) 378s """.format( 378s cmake_source_dir=cmake_source_dir, 378s cmake_install_dir=package_base, 378s package_base=package_base_dir, 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s p_off="" if has_pure_package else "#", 378s pm_off="" if has_pure_module else "#", 378s ) 378s ) 378s ) 378s 378s src_dir = tmp_dir.ensure(package_base, dir=1) 378s 378s src_dir.join("CMakeLists.txt").write( 378s textwrap.dedent( 378s """ 378s cmake_minimum_required(VERSION 3.5.0) 378s project(hybrid NONE) 378s set(build_dir ${{CMAKE_BINARY_DIR}}) 378s 378s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 378s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 378s {c_off} install( 378s {c_off} FILES 378s {c_off} ${{build_dir}}/__init__.py 378s {c_off} ${{build_dir}}/cmake.py 378s {c_off} DESTINATION cmake 378s {c_off} ) 378s 378s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 378s {cm_off} install( 378s {cm_off} FILES ${{build_dir}}/cmakeModule.py 378s {cm_off} DESTINATION .) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 378s {h_off} DESTINATION hybrid/data) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 378s {h_off} DESTINATION hybrid/hybrid_2) 378s 378s install(CODE "message(STATUS \\\"Installation complete\\\")") 378s """.format( 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s ) 378s ) 378s ) 378s 378s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 378s path_types: Sequence[str] 378s try: 378s path_types = next( 378s iter( 378s zip( 378s *filter( 378s lambda i: i[1], 378s [ 378s ("c", has_cmake_package), 378s ("cm", has_cmake_module), 378s ("h", has_hybrid_package), 378s ("p", has_pure_package), 378s ("pm", has_pure_module), 378s ], 378s ) 378s ) 378s ) 378s ) 378s except StopIteration: 378s path_types = [] 378s 378s def select_paths(annotated_paths): 378s """Return a filtered list paths considering ``path_types``. 378s 378s `annotated_paths`` is list of tuple ``(type, path)`` where type 378s is either `c`, 'cm', `h`, `p` or 'pm'. 378s 378s """ 378s return filter(lambda i: i[0] in path_types, annotated_paths) 378s 378s # Commented paths are the one expected to be installed by CMake. For 378s # this reason, corresponding files should NOT be created in the source 378s # tree. 378s for _type, path in select_paths( 378s [ 378s # ('c', 'cmake/__init__.py'), 378s # ('c', 'cmake/cmake.py'), 378s # ('cm', 'cmakeModule.py'), 378s ("h", "hybrid/__init__.py"), 378s # ('h', 'hybrid/hybrid_cmake.dat'), 378s # ('h', 'hybrid/hybrid_cmake.py'), 378s ("h", "hybrid/hybrid_pure.dat"), 378s ("h", "hybrid/hybrid_pure.py"), 378s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 378s ("h", "hybrid/data/hybrid_data_pure.dat"), 378s ("h", "hybrid/hybrid_2/__init__.py"), 378s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 378s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 378s ("p", "hybrid/hybrid_2_pure/__init__.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 378s ("pm", "pureModule.py"), 378s ("p", "pure/__init__.py"), 378s ("p", "pure/pure.py"), 378s ("p", "pure/data/pure.dat"), 378s ] 378s ): 378s assert _type in {"p", "pm", "h"} 378s root = package_base if _type in {"p", "pm"} else cmake_source_dir 378s tmp_dir.ensure(os.path.join(root, path)) 378s 378s # Do not call the real setup function. Instead, replace it with 378s # a MagicMock allowing to check with which arguments it was invoked. 378s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 378s 378s # Convenience print function 378s def _pprint(desc, value=None): 378s print( 378s "-----------------\n" 378s f"{desc}:\n" 378s "\n" 378s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 378s ) 378s 378s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 378s 378s _pprint = ._pprint at 0x3ffb5e38900> 378s _type = 'pm' 378s cmake_source_dir = 'to/the/base' 378s has_cmake_module = 0 378s has_cmake_package = 0 378s has_hybrid_package = 1 378s has_pure_module = 1 378s has_pure_package = 0 378s mock_setup = 378s mocker = 378s package_base = 'to/the/base' 378s package_base_dir = 'to/the/base/' 378s path = 'pureModule.py' 378s path_types = ('h', 'pm') 378s root = 'to/the/base' 378s select_paths = .select_paths at 0x3ffb5e38d60> 378s src_dir = local('/tmp/pytest-of-ubuntu/pytest-134/test_setup_inputs0/to/the/base') 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-134/test_setup_inputs0') 378s with_package_base = 1 378s 378s tests/test_setup.py:849: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-134/test_setup_inputs0') 378s setup_args = ['build'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-134/test_setup_inputs0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s ________________________ test_setup_inputs[1-1-1-0-0-0] ________________________ 378s 378s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 0 378s has_pure_package = 1, has_pure_module = 1, with_package_base = 1 378s mocker = 378s 378s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 378s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 378s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_module", [0, 1]) 378s @pytest.mark.parametrize("with_package_base", [0, 1]) 378s def test_setup_inputs( 378s has_cmake_package, 378s has_cmake_module, 378s has_hybrid_package, 378s has_pure_package, 378s has_pure_module, 378s with_package_base, 378s mocker, 378s ): 378s """This test that a project can have a package with some modules 378s installed using setup.py and some other modules installed using CMake. 378s """ 378s 378s tmp_dir = _tmpdir("test_setup_inputs") 378s 378s package_base = "to/the/base" if with_package_base else "" 378s package_base_dir = package_base + "/" if package_base else "" 378s cmake_source_dir = package_base 378s 378s if cmake_source_dir and (has_cmake_package or has_cmake_module): 378s pytest.skip( 378s "unsupported configuration: " 378s "python package fully generated by CMake does *NOT* work. " 378s "At least __init__.py should be in the project source tree" 378s ) 378s 378s # ------------------------------------------------------------------------- 378s # Here is the "SOURCE" tree layout: 378s # 378s # ROOT/ 378s # 378s # setup.py 378s # 378s # [/] 378s # 378s # pureModule.py 378s # 378s # pure/ 378s # __init__.py 378s # pure.py 378s # 378s # data/ 378s # pure.dat 378s # 378s # [/] 378s # 378s # hybrid/ 378s # CMakeLists.txt 378s # __init__.py 378s # hybrid_pure.dat 378s # hybrid_pure.py 378s # 378s # data/ 378s # hybrid_data_pure.dat 378s # 378s # hybrid_2/ 378s # __init__.py 378s # hybrid_2_pure.py 378s # 378s # hybrid_2_pure/ 378s # __init__.py 378s # hybrid_2_pure_1.py 378s # hybrid_2_pure_2.py 378s # 378s # 378s # ------------------------------------------------------------------------- 378s # and here is the "BINARY" distribution layout: 378s # 378s # The comment "CMake" or "Setuptools" indicates which tool is responsible 378s # for placing the file in the tree used to create the binary distribution. 378s # 378s # ROOT/ 378s # 378s # cmakeModule.py # CMake 378s # 378s # cmake/ 378s # __init__.py # CMake 378s # cmake.py # CMake 378s # 378s # hybrid/ 378s # hybrid_cmake.dat # CMake 378s # hybrid_cmake.py # CMake 378s # hybrid_pure.dat # Setuptools 378s # hybrid_pure.py # Setuptools 378s # 378s # data/ 378s # hybrid_data_pure.dat # CMake or Setuptools 378s # hybrid_data_cmake.dat # CMake *NO TEST* 378s # 378s # hybrid_2/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure.py # CMake or Setuptools 378s # hybrid_2_cmake.py # CMake 378s # 378s # hybrid_2_pure/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure_1.py # CMake or Setuptools 378s # hybrid_2_pure_2.py # CMake or Setuptools 378s # 378s # pureModule.py # Setuptools 378s # 378s # pure/ 378s # __init__.py # Setuptools 378s # pure.py # Setuptools 378s # 378s # data/ 378s # pure.dat # Setuptools 378s 378s tmp_dir.join("setup.py").write( 378s textwrap.dedent( 378s """ 378s from skbuild import setup 378s #from setuptools import setup 378s setup( 378s name="test_hybrid_project", 378s version="1.2.3", 378s description=("an hybrid package mixing files installed by both " 378s "CMake and setuptools"), 378s author='The scikit-build team', 378s license="MIT", 378s cmake_source_dir='{cmake_source_dir}', 378s cmake_install_dir='{cmake_install_dir}', 378s # Arbitrary order of packages 378s packages=[ 378s {p_off} 'pure', 378s {h_off} 'hybrid.hybrid_2', 378s {h_off} 'hybrid', 378s {c_off} 'cmake', 378s {p_off} 'hybrid.hybrid_2_pure', 378s ], 378s py_modules=[ 378s {pm_off} '{package_base}pureModule', 378s {cm_off} '{package_base}cmakeModule', 378s ], 378s package_data={{ 378s {p_off} 'pure': ['data/pure.dat'], 378s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 378s }}, 378s # Arbitrary order of package_dir 378s package_dir = {{ 378s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 378s {p_off} 'pure': '{package_base}pure', 378s {h_off} 'hybrid': '{package_base}hybrid', 378s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 378s {c_off} 'cmake': '{package_base}cmake', 378s }} 378s ) 378s """.format( 378s cmake_source_dir=cmake_source_dir, 378s cmake_install_dir=package_base, 378s package_base=package_base_dir, 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s p_off="" if has_pure_package else "#", 378s pm_off="" if has_pure_module else "#", 378s ) 378s ) 378s ) 378s 378s src_dir = tmp_dir.ensure(package_base, dir=1) 378s 378s src_dir.join("CMakeLists.txt").write( 378s textwrap.dedent( 378s """ 378s cmake_minimum_required(VERSION 3.5.0) 378s project(hybrid NONE) 378s set(build_dir ${{CMAKE_BINARY_DIR}}) 378s 378s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 378s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 378s {c_off} install( 378s {c_off} FILES 378s {c_off} ${{build_dir}}/__init__.py 378s {c_off} ${{build_dir}}/cmake.py 378s {c_off} DESTINATION cmake 378s {c_off} ) 378s 378s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 378s {cm_off} install( 378s {cm_off} FILES ${{build_dir}}/cmakeModule.py 378s {cm_off} DESTINATION .) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 378s {h_off} DESTINATION hybrid/data) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 378s {h_off} DESTINATION hybrid/hybrid_2) 378s 378s install(CODE "message(STATUS \\\"Installation complete\\\")") 378s """.format( 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s ) 378s ) 378s ) 378s 378s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 378s path_types: Sequence[str] 378s try: 378s path_types = next( 378s iter( 378s zip( 378s *filter( 378s lambda i: i[1], 378s [ 378s ("c", has_cmake_package), 378s ("cm", has_cmake_module), 378s ("h", has_hybrid_package), 378s ("p", has_pure_package), 378s ("pm", has_pure_module), 378s ], 378s ) 378s ) 378s ) 378s ) 378s except StopIteration: 378s path_types = [] 378s 378s def select_paths(annotated_paths): 378s """Return a filtered list paths considering ``path_types``. 378s 378s `annotated_paths`` is list of tuple ``(type, path)`` where type 378s is either `c`, 'cm', `h`, `p` or 'pm'. 378s 378s """ 378s return filter(lambda i: i[0] in path_types, annotated_paths) 378s 378s # Commented paths are the one expected to be installed by CMake. For 378s # this reason, corresponding files should NOT be created in the source 378s # tree. 378s for _type, path in select_paths( 378s [ 378s # ('c', 'cmake/__init__.py'), 378s # ('c', 'cmake/cmake.py'), 378s # ('cm', 'cmakeModule.py'), 378s ("h", "hybrid/__init__.py"), 378s # ('h', 'hybrid/hybrid_cmake.dat'), 378s # ('h', 'hybrid/hybrid_cmake.py'), 378s ("h", "hybrid/hybrid_pure.dat"), 378s ("h", "hybrid/hybrid_pure.py"), 378s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 378s ("h", "hybrid/data/hybrid_data_pure.dat"), 378s ("h", "hybrid/hybrid_2/__init__.py"), 378s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 378s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 378s ("p", "hybrid/hybrid_2_pure/__init__.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 378s ("pm", "pureModule.py"), 378s ("p", "pure/__init__.py"), 378s ("p", "pure/pure.py"), 378s ("p", "pure/data/pure.dat"), 378s ] 378s ): 378s assert _type in {"p", "pm", "h"} 378s root = package_base if _type in {"p", "pm"} else cmake_source_dir 378s tmp_dir.ensure(os.path.join(root, path)) 378s 378s # Do not call the real setup function. Instead, replace it with 378s # a MagicMock allowing to check with which arguments it was invoked. 378s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 378s 378s # Convenience print function 378s def _pprint(desc, value=None): 378s print( 378s "-----------------\n" 378s f"{desc}:\n" 378s "\n" 378s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 378s ) 378s 378s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 378s 378s _pprint = ._pprint at 0x3ffb5e3a520> 378s _type = 'p' 378s cmake_source_dir = 'to/the/base' 378s has_cmake_module = 0 378s has_cmake_package = 0 378s has_hybrid_package = 0 378s has_pure_module = 1 378s has_pure_package = 1 378s mock_setup = 378s mocker = 378s package_base = 'to/the/base' 378s package_base_dir = 'to/the/base/' 378s path = 'pure/data/pure.dat' 378s path_types = ('p', 'pm') 378s root = 'to/the/base' 378s select_paths = .select_paths at 0x3ffb5e3a2a0> 378s src_dir = local('/tmp/pytest-of-ubuntu/pytest-138/test_setup_inputs0/to/the/base') 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-138/test_setup_inputs0') 378s with_package_base = 1 378s 378s tests/test_setup.py:849: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-138/test_setup_inputs0') 378s setup_args = ['build'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-138/test_setup_inputs0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s ________________________ test_setup_inputs[1-1-1-1-0-0] ________________________ 378s 378s has_cmake_package = 0, has_cmake_module = 0, has_hybrid_package = 1 378s has_pure_package = 1, has_pure_module = 1, with_package_base = 1 378s mocker = 378s 378s @pytest.mark.parametrize("has_cmake_package", [0, 1]) 378s @pytest.mark.parametrize("has_cmake_module", [0, 1]) 378s @pytest.mark.parametrize("has_hybrid_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_package", [0, 1]) 378s @pytest.mark.parametrize("has_pure_module", [0, 1]) 378s @pytest.mark.parametrize("with_package_base", [0, 1]) 378s def test_setup_inputs( 378s has_cmake_package, 378s has_cmake_module, 378s has_hybrid_package, 378s has_pure_package, 378s has_pure_module, 378s with_package_base, 378s mocker, 378s ): 378s """This test that a project can have a package with some modules 378s installed using setup.py and some other modules installed using CMake. 378s """ 378s 378s tmp_dir = _tmpdir("test_setup_inputs") 378s 378s package_base = "to/the/base" if with_package_base else "" 378s package_base_dir = package_base + "/" if package_base else "" 378s cmake_source_dir = package_base 378s 378s if cmake_source_dir and (has_cmake_package or has_cmake_module): 378s pytest.skip( 378s "unsupported configuration: " 378s "python package fully generated by CMake does *NOT* work. " 378s "At least __init__.py should be in the project source tree" 378s ) 378s 378s # ------------------------------------------------------------------------- 378s # Here is the "SOURCE" tree layout: 378s # 378s # ROOT/ 378s # 378s # setup.py 378s # 378s # [/] 378s # 378s # pureModule.py 378s # 378s # pure/ 378s # __init__.py 378s # pure.py 378s # 378s # data/ 378s # pure.dat 378s # 378s # [/] 378s # 378s # hybrid/ 378s # CMakeLists.txt 378s # __init__.py 378s # hybrid_pure.dat 378s # hybrid_pure.py 378s # 378s # data/ 378s # hybrid_data_pure.dat 378s # 378s # hybrid_2/ 378s # __init__.py 378s # hybrid_2_pure.py 378s # 378s # hybrid_2_pure/ 378s # __init__.py 378s # hybrid_2_pure_1.py 378s # hybrid_2_pure_2.py 378s # 378s # 378s # ------------------------------------------------------------------------- 378s # and here is the "BINARY" distribution layout: 378s # 378s # The comment "CMake" or "Setuptools" indicates which tool is responsible 378s # for placing the file in the tree used to create the binary distribution. 378s # 378s # ROOT/ 378s # 378s # cmakeModule.py # CMake 378s # 378s # cmake/ 378s # __init__.py # CMake 378s # cmake.py # CMake 378s # 378s # hybrid/ 378s # hybrid_cmake.dat # CMake 378s # hybrid_cmake.py # CMake 378s # hybrid_pure.dat # Setuptools 378s # hybrid_pure.py # Setuptools 378s # 378s # data/ 378s # hybrid_data_pure.dat # CMake or Setuptools 378s # hybrid_data_cmake.dat # CMake *NO TEST* 378s # 378s # hybrid_2/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure.py # CMake or Setuptools 378s # hybrid_2_cmake.py # CMake 378s # 378s # hybrid_2_pure/ 378s # __init__.py # CMake or Setuptools 378s # hybrid_2_pure_1.py # CMake or Setuptools 378s # hybrid_2_pure_2.py # CMake or Setuptools 378s # 378s # pureModule.py # Setuptools 378s # 378s # pure/ 378s # __init__.py # Setuptools 378s # pure.py # Setuptools 378s # 378s # data/ 378s # pure.dat # Setuptools 378s 378s tmp_dir.join("setup.py").write( 378s textwrap.dedent( 378s """ 378s from skbuild import setup 378s #from setuptools import setup 378s setup( 378s name="test_hybrid_project", 378s version="1.2.3", 378s description=("an hybrid package mixing files installed by both " 378s "CMake and setuptools"), 378s author='The scikit-build team', 378s license="MIT", 378s cmake_source_dir='{cmake_source_dir}', 378s cmake_install_dir='{cmake_install_dir}', 378s # Arbitrary order of packages 378s packages=[ 378s {p_off} 'pure', 378s {h_off} 'hybrid.hybrid_2', 378s {h_off} 'hybrid', 378s {c_off} 'cmake', 378s {p_off} 'hybrid.hybrid_2_pure', 378s ], 378s py_modules=[ 378s {pm_off} '{package_base}pureModule', 378s {cm_off} '{package_base}cmakeModule', 378s ], 378s package_data={{ 378s {p_off} 'pure': ['data/pure.dat'], 378s {h_off} 'hybrid': ['hybrid_pure.dat', 'data/hybrid_data_pure.dat'], 378s }}, 378s # Arbitrary order of package_dir 378s package_dir = {{ 378s {p_off} 'hybrid.hybrid_2_pure': '{package_base}hybrid/hybrid_2_pure', 378s {p_off} 'pure': '{package_base}pure', 378s {h_off} 'hybrid': '{package_base}hybrid', 378s {h_off} 'hybrid.hybrid_2': '{package_base}hybrid/hybrid_2', 378s {c_off} 'cmake': '{package_base}cmake', 378s }} 378s ) 378s """.format( 378s cmake_source_dir=cmake_source_dir, 378s cmake_install_dir=package_base, 378s package_base=package_base_dir, 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s p_off="" if has_pure_package else "#", 378s pm_off="" if has_pure_module else "#", 378s ) 378s ) 378s ) 378s 378s src_dir = tmp_dir.ensure(package_base, dir=1) 378s 378s src_dir.join("CMakeLists.txt").write( 378s textwrap.dedent( 378s """ 378s cmake_minimum_required(VERSION 3.5.0) 378s project(hybrid NONE) 378s set(build_dir ${{CMAKE_BINARY_DIR}}) 378s 378s {c_off} file(WRITE ${{build_dir}}/__init__.py "") 378s {c_off} file(WRITE ${{build_dir}}/cmake.py "") 378s {c_off} install( 378s {c_off} FILES 378s {c_off} ${{build_dir}}/__init__.py 378s {c_off} ${{build_dir}}/cmake.py 378s {c_off} DESTINATION cmake 378s {c_off} ) 378s 378s {cm_off} file(WRITE ${{build_dir}}/cmakeModule.py "") 378s {cm_off} install( 378s {cm_off} FILES ${{build_dir}}/cmakeModule.py 378s {cm_off} DESTINATION .) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.dat 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_cmake.py 378s {h_off} DESTINATION hybrid) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_data_cmake.dat "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_data_cmake.dat 378s {h_off} DESTINATION hybrid/data) 378s 378s {h_off} file(WRITE ${{build_dir}}/hybrid_2_cmake.py "") 378s {h_off} install( 378s {h_off} FILES ${{build_dir}}/hybrid_2_cmake.py 378s {h_off} DESTINATION hybrid/hybrid_2) 378s 378s install(CODE "message(STATUS \\\"Installation complete\\\")") 378s """.format( 378s c_off="" if has_cmake_package else "#", 378s cm_off="" if has_cmake_module else "#", 378s h_off="" if has_hybrid_package else "#", 378s ) 378s ) 378s ) 378s 378s # List path types: 'c', 'cm', 'h', 'p' or 'pm' 378s path_types: Sequence[str] 378s try: 378s path_types = next( 378s iter( 378s zip( 378s *filter( 378s lambda i: i[1], 378s [ 378s ("c", has_cmake_package), 378s ("cm", has_cmake_module), 378s ("h", has_hybrid_package), 378s ("p", has_pure_package), 378s ("pm", has_pure_module), 378s ], 378s ) 378s ) 378s ) 378s ) 378s except StopIteration: 378s path_types = [] 378s 378s def select_paths(annotated_paths): 378s """Return a filtered list paths considering ``path_types``. 378s 378s `annotated_paths`` is list of tuple ``(type, path)`` where type 378s is either `c`, 'cm', `h`, `p` or 'pm'. 378s 378s """ 378s return filter(lambda i: i[0] in path_types, annotated_paths) 378s 378s # Commented paths are the one expected to be installed by CMake. For 378s # this reason, corresponding files should NOT be created in the source 378s # tree. 378s for _type, path in select_paths( 378s [ 378s # ('c', 'cmake/__init__.py'), 378s # ('c', 'cmake/cmake.py'), 378s # ('cm', 'cmakeModule.py'), 378s ("h", "hybrid/__init__.py"), 378s # ('h', 'hybrid/hybrid_cmake.dat'), 378s # ('h', 'hybrid/hybrid_cmake.py'), 378s ("h", "hybrid/hybrid_pure.dat"), 378s ("h", "hybrid/hybrid_pure.py"), 378s # ('h', 'hybrid/data/hybrid_data_cmake.dat'), 378s ("h", "hybrid/data/hybrid_data_pure.dat"), 378s ("h", "hybrid/hybrid_2/__init__.py"), 378s # ('h', 'hybrid/hybrid_2/hybrid_2_cmake.py'), 378s ("h", "hybrid/hybrid_2/hybrid_2_pure.py"), 378s ("p", "hybrid/hybrid_2_pure/__init__.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_1.py"), 378s ("p", "hybrid/hybrid_2_pure/hybrid_2_pure_2.py"), 378s ("pm", "pureModule.py"), 378s ("p", "pure/__init__.py"), 378s ("p", "pure/pure.py"), 378s ("p", "pure/data/pure.dat"), 378s ] 378s ): 378s assert _type in {"p", "pm", "h"} 378s root = package_base if _type in {"p", "pm"} else cmake_source_dir 378s tmp_dir.ensure(os.path.join(root, path)) 378s 378s # Do not call the real setup function. Instead, replace it with 378s # a MagicMock allowing to check with which arguments it was invoked. 378s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 378s 378s # Convenience print function 378s def _pprint(desc, value=None): 378s print( 378s "-----------------\n" 378s f"{desc}:\n" 378s "\n" 378s f"{pprint.pformat(setup_kw.get(desc, {}) if value is None else value, indent=2)}\n" 378s ) 378s 378s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 378s 378s _pprint = ._pprint at 0x3ffb5e384a0> 378s _type = 'p' 378s cmake_source_dir = 'to/the/base' 378s has_cmake_module = 0 378s has_cmake_package = 0 378s has_hybrid_package = 1 378s has_pure_module = 1 378s has_pure_package = 1 378s mock_setup = 378s mocker = 378s package_base = 'to/the/base' 378s package_base_dir = 'to/the/base/' 378s path = 'pure/data/pure.dat' 378s path_types = ('h', 'p', 'pm') 378s root = 'to/the/base' 378s select_paths = .select_paths at 0x3ffb5e39e40> 378s src_dir = local('/tmp/pytest-of-ubuntu/pytest-142/test_setup_inputs0/to/the/base') 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-142/test_setup_inputs0') 378s with_package_base = 1 378s 378s tests/test_setup.py:849: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-142/test_setup_inputs0') 378s setup_args = ['build'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-142/test_setup_inputs0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s ___________________ test_cmake_install_into_pure_package[0] ____________________ 378s 378s with_cmake_source_dir = 0 378s capsys = <_pytest.capture.CaptureFixture object at 0x3ffb60b8ef0> 378s caplog = <_pytest.logging.LogCaptureFixture object at 0x3ffb60ba5d0> 378s 378s @pytest.mark.parametrize("with_cmake_source_dir", [0, 1]) 378s def test_cmake_install_into_pure_package(with_cmake_source_dir, capsys, caplog): 378s # ------------------------------------------------------------------------- 378s # "SOURCE" tree layout: 378s # 378s # (1) with_cmake_source_dir == 0 378s # 378s # ROOT/ 378s # 378s # CMakeLists.txt 378s # setup.py 378s # 378s # fruits/ 378s # __init__.py 378s # 378s # 378s # (2) with_cmake_source_dir == 1 378s # 378s # ROOT/ 378s # 378s # setup.py 378s # 378s # fruits/ 378s # __init__.py 378s # 378s # src/ 378s # 378s # CMakeLists.txt 378s # 378s # ------------------------------------------------------------------------- 378s # "BINARY" distribution layout: 378s # 378s # ROOT/ 378s # 378s # fruits/ 378s # 378s # __init__.py 378s # apple.py 378s # banana.py 378s # 378s # data/ 378s # 378s # apple.dat 378s # banana.dat 378s # 378s 378s tmp_dir = _tmpdir("cmake_install_into_pure_package") 378s 378s cmake_source_dir = "src" if with_cmake_source_dir else "" 378s 378s tmp_dir.join("setup.py").write( 378s textwrap.dedent( 378s f""" 378s from skbuild import setup 378s setup( 378s name="test_py_modules_keyword", 378s version="1.2.3", 378s description="a package testing use of py_modules keyword", 378s author='The scikit-build team', 378s license="MIT", 378s packages=['fruits'], 378s cmake_install_dir='fruits', 378s cmake_source_dir='{cmake_source_dir}', 378s ) 378s """ 378s ) 378s ) 378s 378s cmake_src_dir = tmp_dir.ensure(cmake_source_dir, dir=1) 378s cmake_src_dir.join("CMakeLists.txt").write( 378s textwrap.dedent( 378s """ 378s cmake_minimum_required(VERSION 3.5.0) 378s project(test NONE) 378s file(WRITE "${CMAKE_BINARY_DIR}/apple.py" "# apple.py") 378s file(WRITE "${CMAKE_BINARY_DIR}/banana.py" "# banana.py") 378s install( 378s FILES 378s "${CMAKE_BINARY_DIR}/apple.py" 378s "${CMAKE_BINARY_DIR}/banana.py" 378s DESTINATION "." 378s ) 378s file(WRITE "${CMAKE_BINARY_DIR}/apple.dat" "# apple.dat") 378s file(WRITE "${CMAKE_BINARY_DIR}/banana.dat" "# banana.dat") 378s install( 378s FILES 378s "${CMAKE_BINARY_DIR}/apple.dat" 378s "${CMAKE_BINARY_DIR}/banana.dat" 378s DESTINATION "data" 378s ) 378s """ 378s ) 378s ) 378s 378s tmp_dir.ensure("fruits/__init__.py") 378s 378s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 378s 378s caplog = <_pytest.logging.LogCaptureFixture object at 0x3ffb60ba5d0> 378s capsys = <_pytest.capture.CaptureFixture object at 0x3ffb60b8ef0> 378s cmake_source_dir = '' 378s cmake_src_dir = local('/tmp/pytest-of-ubuntu/pytest-146/cmake_install_into_pure_packag0') 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-146/cmake_install_into_pure_packag0') 378s with_cmake_source_dir = 0 378s 378s tests/test_setup.py:1031: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-146/cmake_install_into_pure_packag0') 378s setup_args = ['build'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-146/cmake_install_into_pure_packag0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s ___________________ test_cmake_install_into_pure_package[1] ____________________ 378s 378s with_cmake_source_dir = 1 378s capsys = <_pytest.capture.CaptureFixture object at 0x3ffb60ba0c0> 378s caplog = <_pytest.logging.LogCaptureFixture object at 0x3ffb60b99d0> 378s 378s @pytest.mark.parametrize("with_cmake_source_dir", [0, 1]) 378s def test_cmake_install_into_pure_package(with_cmake_source_dir, capsys, caplog): 378s # ------------------------------------------------------------------------- 378s # "SOURCE" tree layout: 378s # 378s # (1) with_cmake_source_dir == 0 378s # 378s # ROOT/ 378s # 378s # CMakeLists.txt 378s # setup.py 378s # 378s # fruits/ 378s # __init__.py 378s # 378s # 378s # (2) with_cmake_source_dir == 1 378s # 378s # ROOT/ 378s # 378s # setup.py 378s # 378s # fruits/ 378s # __init__.py 378s # 378s # src/ 378s # 378s # CMakeLists.txt 378s # 378s # ------------------------------------------------------------------------- 378s # "BINARY" distribution layout: 378s # 378s # ROOT/ 378s # 378s # fruits/ 378s # 378s # __init__.py 378s # apple.py 378s # banana.py 378s # 378s # data/ 378s # 378s # apple.dat 378s # banana.dat 378s # 378s 378s tmp_dir = _tmpdir("cmake_install_into_pure_package") 378s 378s cmake_source_dir = "src" if with_cmake_source_dir else "" 378s 378s tmp_dir.join("setup.py").write( 378s textwrap.dedent( 378s f""" 378s from skbuild import setup 378s setup( 378s name="test_py_modules_keyword", 378s version="1.2.3", 378s description="a package testing use of py_modules keyword", 378s author='The scikit-build team', 378s license="MIT", 378s packages=['fruits'], 378s cmake_install_dir='fruits', 378s cmake_source_dir='{cmake_source_dir}', 378s ) 378s """ 378s ) 378s ) 378s 378s cmake_src_dir = tmp_dir.ensure(cmake_source_dir, dir=1) 378s cmake_src_dir.join("CMakeLists.txt").write( 378s textwrap.dedent( 378s """ 378s cmake_minimum_required(VERSION 3.5.0) 378s project(test NONE) 378s file(WRITE "${CMAKE_BINARY_DIR}/apple.py" "# apple.py") 378s file(WRITE "${CMAKE_BINARY_DIR}/banana.py" "# banana.py") 378s install( 378s FILES 378s "${CMAKE_BINARY_DIR}/apple.py" 378s "${CMAKE_BINARY_DIR}/banana.py" 378s DESTINATION "." 378s ) 378s file(WRITE "${CMAKE_BINARY_DIR}/apple.dat" "# apple.dat") 378s file(WRITE "${CMAKE_BINARY_DIR}/banana.dat" "# banana.dat") 378s install( 378s FILES 378s "${CMAKE_BINARY_DIR}/apple.dat" 378s "${CMAKE_BINARY_DIR}/banana.dat" 378s DESTINATION "data" 378s ) 378s """ 378s ) 378s ) 378s 378s tmp_dir.ensure("fruits/__init__.py") 378s 378s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 378s 378s caplog = <_pytest.logging.LogCaptureFixture object at 0x3ffb60b99d0> 378s capsys = <_pytest.capture.CaptureFixture object at 0x3ffb60ba0c0> 378s cmake_source_dir = 'src' 378s cmake_src_dir = local('/tmp/pytest-of-ubuntu/pytest-147/cmake_install_into_pure_packag0/src') 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-147/cmake_install_into_pure_packag0') 378s with_cmake_source_dir = 1 378s 378s tests/test_setup.py:1031: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-147/cmake_install_into_pure_packag0') 378s setup_args = ['build'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-147/cmake_install_into_pure_packag0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s _________________________ test_zip_safe_default[None] __________________________ 378s 378s zip_safe = None 378s mocker = 378s 378s @pytest.mark.parametrize("zip_safe", [None, False, True]) 378s def test_zip_safe_default(zip_safe, mocker): 378s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 378s 378s tmp_dir = _tmpdir("zip_safe_default") 378s 378s setup_kwarg = "" 378s if zip_safe is not None: 378s setup_kwarg = f"zip_safe={zip_safe}" 378s 378s tmp_dir.join("setup.py").write( 378s textwrap.dedent( 378s f""" 378s from skbuild import setup 378s setup( 378s name="zip_safe_default", 378s version="1.2.3", 378s description="a minimal example package", 378s author='The scikit-build team', 378s license="MIT", 378s {setup_kwarg} 378s ) 378s """ 378s ) 378s ) 378s tmp_dir.join("CMakeLists.txt").write( 378s textwrap.dedent( 378s """ 378s cmake_minimum_required(VERSION 3.5.0) 378s project(test NONE) 378s install(CODE "execute_process( 378s COMMAND \\${CMAKE_COMMAND} -E sleep 0)") 378s """ 378s ) 378s ) 378s 378s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 378s 378s mock_setup = 378s mocker = 378s setup_kwarg = '' 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-148/zip_safe_default0') 378s zip_safe = None 378s 378s tests/test_setup.py:1087: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-148/zip_safe_default0') 378s setup_args = ['build'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-148/zip_safe_default0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s _________________________ test_zip_safe_default[False] _________________________ 378s 378s zip_safe = False 378s mocker = 378s 378s @pytest.mark.parametrize("zip_safe", [None, False, True]) 378s def test_zip_safe_default(zip_safe, mocker): 378s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 378s 378s tmp_dir = _tmpdir("zip_safe_default") 378s 378s setup_kwarg = "" 378s if zip_safe is not None: 378s setup_kwarg = f"zip_safe={zip_safe}" 378s 378s tmp_dir.join("setup.py").write( 378s textwrap.dedent( 378s f""" 378s from skbuild import setup 378s setup( 378s name="zip_safe_default", 378s version="1.2.3", 378s description="a minimal example package", 378s author='The scikit-build team', 378s license="MIT", 378s {setup_kwarg} 378s ) 378s """ 378s ) 378s ) 378s tmp_dir.join("CMakeLists.txt").write( 378s textwrap.dedent( 378s """ 378s cmake_minimum_required(VERSION 3.5.0) 378s project(test NONE) 378s install(CODE "execute_process( 378s COMMAND \\${CMAKE_COMMAND} -E sleep 0)") 378s """ 378s ) 378s ) 378s 378s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 378s 378s mock_setup = 378s mocker = 378s setup_kwarg = 'zip_safe=False' 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-149/zip_safe_default0') 378s zip_safe = False 378s 378s tests/test_setup.py:1087: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-149/zip_safe_default0') 378s setup_args = ['build'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-149/zip_safe_default0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s _________________________ test_zip_safe_default[True] __________________________ 378s 378s zip_safe = True 378s mocker = 378s 378s @pytest.mark.parametrize("zip_safe", [None, False, True]) 378s def test_zip_safe_default(zip_safe, mocker): 378s mock_setup = mocker.patch("skbuild.setuptools_wrap.setuptools.setup") 378s 378s tmp_dir = _tmpdir("zip_safe_default") 378s 378s setup_kwarg = "" 378s if zip_safe is not None: 378s setup_kwarg = f"zip_safe={zip_safe}" 378s 378s tmp_dir.join("setup.py").write( 378s textwrap.dedent( 378s f""" 378s from skbuild import setup 378s setup( 378s name="zip_safe_default", 378s version="1.2.3", 378s description="a minimal example package", 378s author='The scikit-build team', 378s license="MIT", 378s {setup_kwarg} 378s ) 378s """ 378s ) 378s ) 378s tmp_dir.join("CMakeLists.txt").write( 378s textwrap.dedent( 378s """ 378s cmake_minimum_required(VERSION 3.5.0) 378s project(test NONE) 378s install(CODE "execute_process( 378s COMMAND \\${CMAKE_COMMAND} -E sleep 0)") 378s """ 378s ) 378s ) 378s 378s > with execute_setup_py(tmp_dir, ["build"], disable_languages_test=True): 378s 378s mock_setup = 378s mocker = 378s setup_kwarg = 'zip_safe=True' 378s tmp_dir = local('/tmp/pytest-of-ubuntu/pytest-150/zip_safe_default0') 378s zip_safe = True 378s 378s tests/test_setup.py:1087: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-150/zip_safe_default0') 378s setup_args = ['build'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-150/zip_safe_default0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s _____________________ test_generator[Unix Makefiles-make] ______________________ 378s 378s generator = 'Unix Makefiles', expected_make_program = 'make' 378s 378s @pytest.mark.parametrize( 378s ("generator", "expected_make_program"), [("NMake Makefiles", "nmake"), ("Unix Makefiles", "make")] 378s ) 378s def test_generator(generator, expected_make_program): 378s generator_platform = {"NMake Makefiles": ["windows"], "Unix Makefiles": ["darwin", "linux"]} 378s assert generator in generator_platform 378s 378s this_platform = platform.system().lower() 378s if this_platform not in generator_platform[generator]: 378s pytest.skip(f"{generator} generator is not available on {this_platform.title()}") 378s 378s if shutil.which(expected_make_program) is None: 378s pytest.skip(f"{expected_make_program} not available") 378s 378s @project_setup_py_test("hello-cpp", ["build"], ret=True) 378s def run_build(): 378s pass 378s 378s with push_env(CMAKE_GENERATOR=generator): 378s > tmp_dir = run_build()[0] 378s 378s expected_make_program = 'make' 378s generator = 'Unix Makefiles' 378s generator_platform = {'NMake Makefiles': ['windows'], 'Unix Makefiles': ['darwin', 'linux']} 378s run_build = .run_build at 0x3ffb5e39940> 378s this_platform = 'linux' 378s 378s tests/test_skbuild.py:94: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s tests/__init__.py:255: in wrapped 378s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 378s disable_languages_test = False 378s fun = .run_build at 0x3ffb5e394e0> 378s iargs = () 378s ikwargs = {} 378s ret = True 378s wrapped = .run_build at 0x3ffb5e39940> 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-151/run_build0') 378s setup_args = ['build'], disable_languages_test = False 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = False 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-151/run_build0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s ----------------------------- Captured stdout call ----------------------------- 378s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-151/run_build0/.git/ 378s [master (root-commit) adf3f71] Initial commit 378s 11 files changed, 115 insertions(+) 378s create mode 100644 CMakeLists.txt 378s create mode 100644 bonjour/__init__.py 378s create mode 100644 bonjour/data/ciel.txt 378s create mode 100644 bonjour/data/soleil.txt 378s create mode 100644 bonjour/data/terre.txt 378s create mode 100644 bonjourModule.py 378s create mode 100644 hello/CMakeLists.txt 378s create mode 100644 hello/__init__.py 378s create mode 100644 hello/__main__.py 378s create mode 100644 hello/_hello.cxx 378s create mode 100644 setup.py 378s ----------------------------- Captured stderr call ----------------------------- 378s hint: Using 'master' as the name for the initial branch. This default branch name 378s hint: is subject to change. To configure the initial branch name to use in all 378s hint: of your new repositories, which will suppress this warning, call: 378s hint: 378s hint: git config --global init.defaultBranch 378s hint: 378s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 378s hint: 'development'. The just-created branch can be renamed via this command: 378s hint: 378s hint: git branch -m 378s ___________________ test_invalid_generator[generator_args0] ____________________ 378s 378s generator_args = ['-G', 'invalid'] 378s 378s @pytest.mark.parametrize( 378s "generator_args", 378s [ 378s ["-G", "invalid"], 378s ["--", "-G", "invalid"], 378s ], 378s ) 378s def test_invalid_generator(generator_args): 378s with push_dir(): 378s build_args = ["build"] 378s build_args.extend(generator_args) 378s 378s @project_setup_py_test("hello-no-language", build_args, disable_languages_test=True) 378s def run(): 378s pass 378s 378s failed = False 378s message = "" 378s try: 378s > run() 378s 378s build_args = ['build', '-G', 'invalid'] 378s failed = False 378s generator_args = ['-G', 'invalid'] 378s message = '' 378s run = .run at 0x3ffb5e3b2e0> 378s 378s tests/test_skbuild.py:121: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s tests/__init__.py:255: in wrapped 378s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 378s disable_languages_test = True 378s fun = .run at 0x3ffb5e3b1a0> 378s iargs = () 378s ikwargs = {} 378s ret = False 378s wrapped = .run at 0x3ffb5e3b2e0> 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-152/run0') 378s setup_args = ['build', '-G', 'invalid'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-152/run0') 378s setup_args = ['build', '-G', 'invalid'] 378s 378s tests/__init__.py:218: AttributeError 378s ----------------------------- Captured stdout call ----------------------------- 378s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-152/run0/.git/ 378s [master (root-commit) bcac09e] Initial commit 378s 2 files changed, 16 insertions(+) 378s create mode 100644 CMakeLists.txt 378s create mode 100644 setup.py 378s ----------------------------- Captured stderr call ----------------------------- 378s hint: Using 'master' as the name for the initial branch. This default branch name 378s hint: is subject to change. To configure the initial branch name to use in all 378s hint: of your new repositories, which will suppress this warning, call: 378s hint: 378s hint: git config --global init.defaultBranch 378s hint: 378s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 378s hint: 'development'. The just-created branch can be renamed via this command: 378s hint: 378s hint: git branch -m 378s ___________________ test_invalid_generator[generator_args1] ____________________ 378s 378s generator_args = ['--', '-G', 'invalid'] 378s 378s @pytest.mark.parametrize( 378s "generator_args", 378s [ 378s ["-G", "invalid"], 378s ["--", "-G", "invalid"], 378s ], 378s ) 378s def test_invalid_generator(generator_args): 378s with push_dir(): 378s build_args = ["build"] 378s build_args.extend(generator_args) 378s 378s @project_setup_py_test("hello-no-language", build_args, disable_languages_test=True) 378s def run(): 378s pass 378s 378s failed = False 378s message = "" 378s try: 378s > run() 378s 378s build_args = ['build', '--', '-G', 'invalid'] 378s failed = False 378s generator_args = ['--', '-G', 'invalid'] 378s message = '' 378s run = .run at 0x3ffb5e39940> 378s 378s tests/test_skbuild.py:121: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s tests/__init__.py:255: in wrapped 378s with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 378s disable_languages_test = True 378s fun = .run at 0x3ffb5e3b380> 378s iargs = () 378s ikwargs = {} 378s ret = False 378s wrapped = .run at 0x3ffb5e39940> 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-153/run0') 378s setup_args = ['build', '--', '-G', 'invalid'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-153/run0') 378s setup_args = ['build', '--', '-G', 'invalid'] 378s 378s tests/__init__.py:218: AttributeError 378s ----------------------------- Captured stdout call ----------------------------- 378s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-153/run0/.git/ 378s [master (root-commit) bcac09e] Initial commit 378s 2 files changed, 16 insertions(+) 378s create mode 100644 CMakeLists.txt 378s create mode 100644 setup.py 378s ----------------------------- Captured stderr call ----------------------------- 378s hint: Using 'master' as the name for the initial branch. This default branch name 378s hint: is subject to change. To configure the initial branch name to use in all 378s hint: of your new repositories, which will suppress this warning, call: 378s hint: 378s hint: git config --global init.defaultBranch 378s hint: 378s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 378s hint: 'development'. The just-created branch can be renamed via this command: 378s hint: 378s hint: git branch -m 378s _________________________ test_skbuild_variable_builds _________________________ 378s 378s iargs = (), ikwargs = {} 378s 378s @functools.wraps(fun) 378s def wrapped(*iargs, **ikwargs): 378s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 378s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 378s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 378s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 378s 378s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 378s 378s disable_languages_test = True 378s fun = 378s iargs = () 378s ikwargs = {} 378s ret = False 378s wrapped = 378s 378s tests/__init__.py:255: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-154/test_skbuild_variable_builds0') 378s setup_args = ['build'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-154/test_skbuild_variable_builds0') 378s setup_args = ['build'] 378s 378s tests/__init__.py:218: AttributeError 378s ----------------------------- Captured stdout call ----------------------------- 378s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-154/test_skbuild_variable_builds0/.git/ 378s [master (root-commit) facbf45] Initial commit 378s 2 files changed, 20 insertions(+) 378s create mode 100644 CMakeLists.txt 378s create mode 100644 setup.py 378s ----------------------------- Captured stderr call ----------------------------- 378s hint: Using 'master' as the name for the initial branch. This default branch name 378s hint: is subject to change. To configure the initial branch name to use in all 378s hint: of your new repositories, which will suppress this warning, call: 378s hint: 378s hint: git config --global init.defaultBranch 378s hint: 378s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 378s hint: 'development'. The just-created branch can be renamed via this command: 378s hint: 378s hint: git branch -m 378s _________________________ test_skbuild_variable_sdist __________________________ 378s 378s iargs = (), ikwargs = {} 378s 378s @functools.wraps(fun) 378s def wrapped(*iargs, **ikwargs): 378s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 378s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 378s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 378s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 378s 378s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 378s 378s disable_languages_test = True 378s fun = 378s iargs = () 378s ikwargs = {} 378s ret = False 378s wrapped = 378s 378s tests/__init__.py:255: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-155/test_skbuild_variable_sdist0') 378s setup_args = ['sdist'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-155/test_skbuild_variable_sdist0') 378s setup_args = ['sdist'] 378s 378s tests/__init__.py:218: AttributeError 378s ----------------------------- Captured stdout call ----------------------------- 378s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-155/test_skbuild_variable_sdist0/.git/ 378s [master (root-commit) facbf45] Initial commit 378s 2 files changed, 20 insertions(+) 378s create mode 100644 CMakeLists.txt 378s create mode 100644 setup.py 378s ----------------------------- Captured stderr call ----------------------------- 378s hint: Using 'master' as the name for the initial branch. This default branch name 378s hint: is subject to change. To configure the initial branch name to use in all 378s hint: of your new repositories, which will suppress this warning, call: 378s hint: 378s hint: git config --global init.defaultBranch 378s hint: 378s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 378s hint: 'development'. The just-created branch can be renamed via this command: 378s hint: 378s hint: git branch -m 378s _________________________ test_skbuild_variable_wheel __________________________ 378s 378s iargs = (), ikwargs = {} 378s 378s @functools.wraps(fun) 378s def wrapped(*iargs, **ikwargs): 378s if wrapped.tmp_dir is None: # type: ignore[attr-defined] 378s wrapped.tmp_dir = _tmpdir(fun.__name__) # type: ignore[attr-defined] 378s prepare_project(wrapped.project, wrapped.tmp_dir) # type: ignore[attr-defined] 378s initialize_git_repo_and_commit(wrapped.tmp_dir, verbose=wrapped.verbose_git) # type: ignore[attr-defined] 378s 378s > with execute_setup_py(wrapped.tmp_dir, wrapped.setup_args, disable_languages_test=disable_languages_test): # type: ignore[attr-defined] 378s 378s disable_languages_test = True 378s fun = 378s iargs = () 378s ikwargs = {} 378s ret = False 378s wrapped = 378s 378s tests/__init__.py:255: 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s /usr/lib/python3.12/contextlib.py:137: in __enter__ 378s return next(self.gen) 378s self = 378s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 378s 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-156/test_skbuild_variable_wheel0') 378s setup_args = ['bdist_wheel'], disable_languages_test = True 378s 378s @contextmanager 378s def execute_setup_py(project_dir, setup_args, disable_languages_test=False): 378s """Context manager executing ``setup.py`` with the given arguments. 378s 378s It yields after changing the current working directory 378s to ``project_dir``. 378s """ 378s 378s # See https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree 378s > distutils.dir_util._path_created.clear() # type: ignore[attr-defined] 378s E AttributeError: module 'distutils.dir_util' has no attribute '_path_created' 378s 378s disable_languages_test = True 378s project_dir = local('/tmp/pytest-of-ubuntu/pytest-156/test_skbuild_variable_wheel0') 378s setup_args = ['bdist_wheel'] 378s 378s tests/__init__.py:218: AttributeError 378s ----------------------------- Captured stdout call ----------------------------- 378s Initialized empty Git repository in /tmp/pytest-of-ubuntu/pytest-156/test_skbuild_variable_wheel0/.git/ 378s [master (root-commit) facbf45] Initial commit 378s 2 files changed, 20 insertions(+) 378s create mode 100644 CMakeLists.txt 378s create mode 100644 setup.py 378s ----------------------------- Captured stderr call ----------------------------- 378s hint: Using 'master' as the name for the initial branch. This default branch name 378s hint: is subject to change. To configure the initial branch name to use in all 378s hint: of your new repositories, which will suppress this warning, call: 378s hint: 378s hint: git config --global init.defaultBranch 378s hint: 378s hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and 378s hint: 'development'. The just-created branch can be renamed via this command: 378s hint: 378s hint: git branch -m 378s =========================== short test summary info ============================ 378s SKIPPED [1] tests/test_hello_fortran.py:19: could not import 'numpy': No module named 'numpy' 378s SKIPPED [1] tests/test_platform.py:120: Requires Windows 378s 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 378s SKIPPED [1] tests/test_skbuild.py:84: NMake Makefiles generator is not available on Linux 378s SKIPPED [3] tests/test_skbuild.py:130: Requires Windows 378s SKIPPED [1] tests/test_skbuild.py:154: Requires Windows 378s FAILED tests/test_broken_project.py::test_cmakelists_with_fatalerror_fails - ... 378s FAILED tests/test_broken_project.py::test_cmakelists_with_syntaxerror_fails 378s FAILED tests/test_broken_project.py::test_hello_with_compileerror_fails - Att... 378s FAILED tests/test_broken_project.py::test_invalid_cmake[CalledProcessError] 378s FAILED tests/test_broken_project.py::test_invalid_cmake[OSError] - AttributeE... 378s FAILED tests/test_broken_project.py::test_first_invalid_generator - Attribute... 378s FAILED tests/test_broken_project.py::test_invalid_generator - AttributeError:... 378s FAILED tests/test_cmake_target.py::test_cmake_target_build - AttributeError: ... 378s FAILED tests/test_cmakelists_not_in_top_level_dir.py::test_build - AttributeE... 378s FAILED tests/test_cmakelists_not_in_top_level_dir.py::test_cmake_source_dir[invalid-True] 378s FAILED tests/test_cmakelists_not_in_top_level_dir.py::test_cmake_source_dir[-False] 378s FAILED tests/test_cmakelists_not_in_top_level_dir.py::test_cmake_source_dir[.-False] 378s FAILED tests/test_command_line.py::test_help - AttributeError: module 'distut... 378s FAILED tests/test_command_line.py::test_metadata_display - AttributeError: mo... 378s FAILED tests/test_command_line.py::test_no_command - AttributeError: module '... 378s FAILED tests/test_command_line.py::test_invalid_command - AttributeError: mod... 378s FAILED tests/test_command_line.py::test_too_many_separators - AttributeError:... 378s FAILED tests/test_command_line.py::test_cmake_initial_cache_as_global_option 378s FAILED tests/test_command_line.py::test_cmake_executable_arg - AttributeError... 378s FAILED tests/test_command_line.py::test_hide_listing[True-sdist] - AttributeE... 378s FAILED tests/test_command_line.py::test_hide_listing[True-bdist_wheel] - Attr... 378s FAILED tests/test_command_line.py::test_hide_listing[False-sdist] - Attribute... 378s FAILED tests/test_command_line.py::test_hide_listing[False-bdist_wheel] - Att... 378s FAILED tests/test_command_line.py::test_run_cmake_arg - AttributeError: modul... 378s FAILED tests/test_command_line.py::test_skip_cmake_arg - AttributeError: modu... 378s FAILED tests/test_cython_flags.py::test_hello_cython_builds - AttributeError:... 378s FAILED tests/test_filter_manifest.py::test_bdist_wheel_command - AttributeErr... 378s FAILED tests/test_hello_cpp.py::test_hello_builds - AttributeError: module 'd... 378s FAILED tests/test_hello_cpp.py::test_hello_wheel - AttributeError: module 'di... 378s FAILED tests/test_hello_cpp.py::test_hello_clean[with-dry-run] - AttributeErr... 378s FAILED tests/test_hello_cpp.py::test_hello_clean[without-dry-run] - Attribute... 378s FAILED tests/test_hello_cpp.py::test_hello_cleans - AttributeError: module 'd... 378s FAILED tests/test_hello_cython.py::test_hello_cython_builds - AttributeError:... 378s FAILED tests/test_hello_cython.py::test_hello_cython_sdist - AttributeError: ... 378s FAILED tests/test_hello_cython.py::test_hello_cython_wheel - AttributeError: ... 378s FAILED tests/test_hello_pure.py::test_hello_pure_builds - AttributeError: mod... 378s FAILED tests/test_hello_pure.py::test_hello_pure_sdist - AttributeError: modu... 378s FAILED tests/test_hello_pure.py::test_hello_pure_wheel - AttributeError: modu... 378s FAILED tests/test_hello_pure.py::test_hello_clean - AttributeError: module 'd... 378s FAILED tests/test_include_exclude_data.py::test_include_exclude_data - Attrib... 378s FAILED tests/test_include_exclude_data.py::test_include_exclude_data_with_base 378s FAILED tests/test_issue284_build_ext_inplace.py::test_build_ext_inplace_command 378s FAILED tests/test_issue335_support_cmake_source_dir.py::test_bdist_wheel_command 378s 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] 378s 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] 378s 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] 378s 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] 378s 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] 378s 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] 378s 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] 378s 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] 378s 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] 378s FAILED tests/test_issue352_isolated_environment_support.py::test_isolated_env_trigger_reconfigure 378s FAILED tests/test_issue668_symbol_visibility.py::test_symbol_visibility[ON] 378s FAILED tests/test_issue668_symbol_visibility.py::test_symbol_visibility[OFF] 378s FAILED tests/test_manifest_in.py::test_manifest_in_wheel - AttributeError: mo... 378s FAILED tests/test_outside_project_root.py::test_outside_project_root_fails[None] 378s FAILED tests/test_outside_project_root.py::test_outside_project_root_fails[-DINSTALL_FILE:BOOL=1] 378s FAILED tests/test_outside_project_root.py::test_outside_project_root_fails[-DINSTALL_PROJECT:BOOL=1] 378s FAILED tests/test_setup.py::test_cmake_args_keyword[cmake_args0] - AttributeE... 378s FAILED tests/test_setup.py::test_cmake_args_keyword[cmake_args1] - AttributeE... 378s FAILED tests/test_setup.py::test_cmake_install_dir_keyword[None-True-str] - A... 378s FAILED tests/test_setup.py::test_cmake_install_dir_keyword[-True-str] - Attri... 378s FAILED tests/test_setup.py::test_cmake_install_dir_keyword[/tmp/scikit-build-True-SKBuildError] 378s FAILED tests/test_setup.py::test_cmake_install_dir_keyword[banana-False-str] 378s FAILED tests/test_setup.py::test_cmake_with_sdist_keyword[True] - AttributeEr... 378s FAILED tests/test_setup.py::test_cmake_with_sdist_keyword[False] - AttributeE... 378s FAILED tests/test_setup.py::test_cmake_minimum_required_version_keyword - Att... 378s FAILED tests/test_setup.py::test_setup_requires_keyword_include_cmake - Attri... 378s FAILED tests/test_setup.py::test_script_keyword[pure] - AttributeError: modul... 378s FAILED tests/test_setup.py::test_script_keyword[skbuild] - AttributeError: mo... 378s FAILED tests/test_setup.py::test_py_modules_keyword[pure] - AttributeError: m... 378s FAILED tests/test_setup.py::test_py_modules_keyword[skbuild] - AttributeError... 378s FAILED tests/test_setup.py::test_setup_inputs[0-0-0-0-0-0] - AttributeError: ... 378s FAILED tests/test_setup.py::test_setup_inputs[0-0-0-0-0-1] - AttributeError: ... 378s FAILED tests/test_setup.py::test_setup_inputs[0-0-0-0-1-0] - AttributeError: ... 378s FAILED tests/test_setup.py::test_setup_inputs[0-0-0-0-1-1] - AttributeError: ... 378s FAILED tests/test_setup.py::test_setup_inputs[0-0-0-1-0-0] - AttributeError: ... 378s FAILED tests/test_setup.py::test_setup_inputs[0-0-0-1-0-1] - AttributeError: ... 378s FAILED tests/test_setup.py::test_setup_inputs[0-0-0-1-1-0] - AttributeError: ... 378s FAILED tests/test_setup.py::test_setup_inputs[0-0-0-1-1-1] - AttributeError: ... 378s FAILED tests/test_setup.py::test_setup_inputs[0-0-1-0-0-0] - AttributeError: ... 378s FAILED tests/test_setup.py::test_setup_inputs[0-0-1-0-0-1] - AttributeError: ... 378s FAILED tests/test_setup.py::test_setup_inputs[0-0-1-0-1-0] - AttributeError: ... 378s FAILED tests/test_setup.py::test_setup_inputs[0-0-1-0-1-1] - AttributeError: ... 378s FAILED tests/test_setup.py::test_setup_inputs[0-0-1-1-0-0] - AttributeError: ... 378s FAILED tests/test_setup.py::test_setup_inputs[0-0-1-1-0-1] - AttributeError: ... 378s FAILED tests/test_setup.py::test_setup_inputs[0-0-1-1-1-0] - AttributeError: ... 378s FAILED tests/test_setup.py::test_setup_inputs[0-0-1-1-1-1] - AttributeError: ... 378s FAILED tests/test_setup.py::test_setup_inputs[0-1-0-0-0-0] - AttributeError: ... 378s FAILED tests/test_setup.py::test_setup_inputs[0-1-0-0-0-1] - AttributeError: ... 378s FAILED tests/test_setup.py::test_setup_inputs[0-1-0-0-1-0] - AttributeError: ... 378s FAILED tests/test_setup.py::test_setup_inputs[0-1-0-0-1-1] - AttributeError: ... 378s FAILED tests/test_setup.py::test_setup_inputs[0-1-0-1-0-0] - AttributeError: ... 378s FAILED tests/test_setup.py::test_setup_inputs[0-1-0-1-0-1] - AttributeError: ... 378s FAILED tests/test_setup.py::test_setup_inputs[0-1-0-1-1-0] - AttributeError: ... 378s FAILED tests/test_setup.py::test_setup_inputs[0-1-0-1-1-1] - AttributeError: ... 378s FAILED tests/test_setup.py::test_setup_inputs[0-1-1-0-0-0] - AttributeError: ... 378s FAILED tests/test_setup.py::test_setup_inputs[0-1-1-0-0-1] - AttributeError: ... 378s FAILED tests/test_setup.py::test_setup_inputs[0-1-1-0-1-0] - AttributeError: ... 378s FAILED tests/test_setup.py::test_setup_inputs[0-1-1-0-1-1] - AttributeError: ... 378s FAILED tests/test_setup.py::test_setup_inputs[0-1-1-1-0-0] - AttributeError: ... 378s FAILED tests/test_setup.py::test_setup_inputs[0-1-1-1-0-1] - AttributeError: ... 378s FAILED tests/test_setup.py::test_setup_inputs[0-1-1-1-1-0] - AttributeError: ... 378s FAILED tests/test_setup.py::test_setup_inputs[0-1-1-1-1-1] - AttributeError: ... 378s FAILED tests/test_setup.py::test_setup_inputs[1-0-0-0-0-0] - AttributeError: ... 378s FAILED tests/test_setup.py::test_setup_inputs[1-0-0-1-0-0] - AttributeError: ... 378s FAILED tests/test_setup.py::test_setup_inputs[1-0-1-0-0-0] - AttributeError: ... 378s FAILED tests/test_setup.py::test_setup_inputs[1-0-1-1-0-0] - AttributeError: ... 378s FAILED tests/test_setup.py::test_setup_inputs[1-1-0-0-0-0] - AttributeError: ... 378s FAILED tests/test_setup.py::test_setup_inputs[1-1-0-1-0-0] - AttributeError: ... 378s FAILED tests/test_setup.py::test_setup_inputs[1-1-1-0-0-0] - AttributeError: ... 378s FAILED tests/test_setup.py::test_setup_inputs[1-1-1-1-0-0] - AttributeError: ... 378s FAILED tests/test_setup.py::test_cmake_install_into_pure_package[0] - Attribu... 378s FAILED tests/test_setup.py::test_cmake_install_into_pure_package[1] - Attribu... 378s FAILED tests/test_setup.py::test_zip_safe_default[None] - AttributeError: mod... 378s FAILED tests/test_setup.py::test_zip_safe_default[False] - AttributeError: mo... 378s FAILED tests/test_setup.py::test_zip_safe_default[True] - AttributeError: mod... 378s FAILED tests/test_skbuild.py::test_generator[Unix Makefiles-make] - Attribute... 378s FAILED tests/test_skbuild.py::test_invalid_generator[generator_args0] - Attri... 378s FAILED tests/test_skbuild.py::test_invalid_generator[generator_args1] - Attri... 378s FAILED tests/test_skbuild_variable.py::test_skbuild_variable_builds - Attribu... 378s FAILED tests/test_skbuild_variable.py::test_skbuild_variable_sdist - Attribut... 378s FAILED tests/test_skbuild_variable.py::test_skbuild_variable_wheel - Attribut... 378s ========== 124 failed, 67 passed, 31 skipped, 17 deselected in 7.06s =========== 378s autopkgtest [15:15:37]: test testsuite: -----------------------] 379s testsuite FAIL non-zero exit status 1 379s autopkgtest [15:15:38]: test testsuite: - - - - - - - - - - results - - - - - - - - - - 379s autopkgtest [15:15:38]: @@@@@@@@@@@@@@@@@@@@ summary 379s testsuite FAIL non-zero exit status 1 390s nova [W] Using flock in prodstack6-s390x 390s Creating nova instance adt-plucky-s390x-scikit-build-20241109-150919-juju-7f2275-prod-proposed-migration-environment-15-2306f199-b41d-410e-943f-aea27dae3d30 from image adt/ubuntu-plucky-s390x-server-20241109.img (UUID 3dcdd533-c66f-4d57-9732-52a74843bc00)...