<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>14736</bug_id>
          
          <creation_ts>2022-02-22 23:00:08 +0000</creation_ts>
          <short_desc>setuptools3.bbclass: Add check for pyproject.toml and [build-system] to advise users</short_desc>
          <delta_ts>2024-08-06 15:30:23 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>OE-Core</product>
          <component>core</component>
          <version>4.0</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium+</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>5.1</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Tim Orling">tim.orling</reporter>
          <assigned_to name="Ross Burton">ross.burton</assigned_to>
          <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
    
    <cc>peter.kjellerstedt</cc>
    
    <cc>randy.macleod</cc>
    
    <cc>ross.burton</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>Yes (doc changes required)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>92631</commentid>
    <comment_count>0</comment_count>
    <who name="Tim Orling">tim.orling</who>
    <bug_when>2022-02-22 23:00:08 +0000</bug_when>
    <thetext>Add a function to check for the presence of a pyproject.toml file in the source.
If so check if it has a [build-system]
If so check if it has a build-backend= that matches one of the classes in oe-core (currently flit_core and setuptools_build_meta)
If it matches &apos;poetry.core.masonry.api&apos;, recommend (WIP) class from meta-python
If it is some other value, give a warning.

The intent is to identify recipes which _already_ have a proper pyproject.toml and move them to the new PEP-517 compliant tooling.

The presence of a pyproject.toml is not enough and no guarantee that the source is compliant with PEP-517.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>92642</commentid>
    <comment_count>1</comment_count>
    <who name="Tim Orling">tim.orling</who>
    <bug_when>2022-02-24 04:14:37 +0000</bug_when>
    <thetext>Patch submitted:
https://lore.kernel.org/openembedded-core/20220224041200.2645054-1-tim.orling@konsulko.com/T/#t</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>92643</commentid>
    <comment_count>2</comment_count>
    <who name="Peter Kjellerstedt">peter.kjellerstedt</who>
    <bug_when>2022-02-24 11:09:24 +0000</bug_when>
    <thetext>You can simplify guess_pip_install_package_name() to:

+def guess_pip_install_package_name(d):
+    &apos;&apos;&apos;https://www.python.org/dev/peps/pep-0491/#escaping-and-unicode&apos;&apos;&apos;
+    return (d.getVar(&apos;PYPI_PACKAGE&apos;) or d.getVar(&apos;PN&apos;)).replace(&apos;-&apos;, &apos;_&apos;))</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>92644</commentid>
    <comment_count>3</comment_count>
    <who name="Peter Kjellerstedt">peter.kjellerstedt</who>
    <bug_when>2022-02-24 11:10:47 +0000</bug_when>
    <thetext>Correction:

+def guess_pip_install_package_name(d):
+    &apos;&apos;&apos;https://www.python.org/dev/peps/pep-0491/#escaping-and-unicode&apos;&apos;&apos;
+    return (d.getVar(&apos;PYPI_PACKAGE&apos;) or d.getVar(&apos;PN&apos;)).replace(&apos;-&apos;, &apos;_&apos;)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>92680</commentid>
    <comment_count>4</comment_count>
    <who name="Tim Orling">tim.orling</who>
    <bug_when>2022-02-25 21:02:47 +0000</bug_when>
    <thetext>Merged.
https://git.openembedded.org/openembedded-core/commit/?id=9fc8e55892374f1e63b4c995fe1a5539c42d24e0

If there are any further issues, please send an email to oe-core mailing list or file a new bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>92681</commentid>
    <comment_count>5</comment_count>
    <who name="Tim Orling">tim.orling</who>
    <bug_when>2022-02-25 21:03:28 +0000</bug_when>
    <thetext>Oops. Wrong patch.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>92682</commentid>
    <comment_count>6</comment_count>
    <who name="Tim Orling">tim.orling</who>
    <bug_when>2022-02-25 23:57:10 +0000</bug_when>
    <thetext>version 3 of the setuptools3.bbclass patch:

https://patchwork.yoctoproject.org/project/oe-core/patch/20220225234317.668778-1-tim.orling@konsulko.com/</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>92683</commentid>
    <comment_count>7</comment_count>
    <who name="Peter Kjellerstedt">peter.kjellerstedt</who>
    <bug_when>2022-02-26 03:06:16 +0000</bug_when>
    <thetext>You can do away with one of the warn*string variables if you use:

warn_string = &quot;The source has a pyproject.toml which declares &apos;%s&apos; as a build backend, please consider &apos;inherit %s&apos; %sinstead of inheriting setuptools3.&quot;

and then either pass &apos;&apos; or &apos;from meta-python &apos; as third argument.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>92687</commentid>
    <comment_count>8</comment_count>
    <who name="Tim Orling">tim.orling</who>
    <bug_when>2022-02-28 21:55:24 +0000</bug_when>
    <thetext>The main issue is that we need a TOML parser, e.g. python3-tomli on the host. The reason this worked was because I already had the deb installed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>92688</commentid>
    <comment_count>9</comment_count>
    <who name="Peter Kjellerstedt">peter.kjellerstedt</who>
    <bug_when>2022-02-28 23:09:43 +0000</bug_when>
    <thetext>While using something like python3-tomli certainly is more correct, for the purpose of setuptools3.bbclass, reading the file and looking for the first line that matches r&apos;build-backend\s*=\s*&quot;(.*)&quot;&apos; is probably good enough. You can of course also make sure it is inside the &quot;[build-system]&quot; section, but it is most likely not really needed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>92765</commentid>
    <comment_count>10</comment_count>
    <who name="Tim Orling">tim.orling</who>
    <bug_when>2022-03-10 20:21:20 +0000</bug_when>
    <thetext>New commit from RP fixes Toaster:
https://patchwork.yoctoproject.org/project/bitbake/patch/20220310135344.612089-1-richard.purdie@linuxfoundation.org/

For unknown _reasons_ this is still failing on my local machine (Debian 11 and Python 3.9.2).

However, I can confirm that a web UI build of quilt-native succeeds using master-next and the following toaster-container distro combinations:

ubuntu-18.04
ubutnu-20.04
debian-10
debian-11

That is significant evidence that this issue has been fixed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>92766</commentid>
    <comment_count>11</comment_count>
    <who name="Tim Orling">tim.orling</who>
    <bug_when>2022-03-10 20:26:22 +0000</bug_when>
    <thetext>and that was the wrong bug again</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94238</commentid>
    <comment_count>12</comment_count>
    <who name="Tim Orling">tim.orling</who>
    <bug_when>2022-10-24 22:45:29 +0000</bug_when>
    <thetext>Needs to be revisited when Python 3.11 (with built-in toml support) lands in &quot;master&quot;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94861</commentid>
    <comment_count>13</comment_count>
    <who name="Tim Orling">tim.orling</who>
    <bug_when>2023-02-02 16:01:35 +0000</bug_when>
    <thetext>&quot;master&quot; has Python 3.11 now, so time to revisit this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>98236</commentid>
    <comment_count>14</comment_count>
    <who name="Tim Orling">tim.orling</who>
    <bug_when>2024-02-20 16:59:42 +0000</bug_when>
    <thetext>Bumping to 5.1, since we are too late in the 5.0M3 cycle to be introducing new warnings.

Changing to IN PROGRESS IMPLEMENTATION, since the regex check (not needing tomli nor tomllib on the host python) has not yet been implemented.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>98237</commentid>
    <comment_count>15</comment_count>
    <who name="Tim Orling">tim.orling</who>
    <bug_when>2024-02-20 17:02:36 +0000</bug_when>
    <thetext>WIP branch with a check for tomllib and then falling back to tomli (but not then falling back to regex yet):
https://git.yoctoproject.org/poky-contrib/log/?h=timo/setuptools3-pyproject.toml-check</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99451</commentid>
    <comment_count>16</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2024-07-25 15:31:53 +0000</bug_when>
    <thetext>Patch on the list.

https://lore.kernel.org/openembedded-core/20240725153029.828624-1-ross.burton@arm.com/T/#t</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99503</commentid>
    <comment_count>17</comment_count>
    <who name="Tim Orling">tim.orling</who>
    <bug_when>2024-08-06 15:30:23 +0000</bug_when>
    <thetext>Merged. Hurrah! Thank you Ross for carrying this across the finish line.

https://git.openembedded.org/openembedded-core/commit/?id=a9d800f6cdfcedbe3de8366d935ee5f0c8557c06
https://git.openembedded.org/openembedded-core/commit/?id=27597d986ad7b3a6c2d36150a163951be7c640f1

An examples of how to turn it off:
https://git.openembedded.org/openembedded-core/commit/?id=a09ad3838a00d2b4781850759ca857822ba330e1
https://git.openembedded.org/openembedded-core/commit/?id=824009560776933922a92a00c2199c28c9c8379c</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>