<?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>14816</bug_id>
          
          <creation_ts>2022-05-25 23:00:28 +0000</creation_ts>
          <short_desc>Some Python recipes fail when rebuilding sometimes</short_desc>
          <delta_ts>2022-05-31 12:52:26 +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>devtools / tool chain</component>
          <version>unspecified</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>High</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>4.1 M1</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Peter Kjellerstedt">peter.kjellerstedt</reporter>
          <assigned_to name="Richard Purdie">richard.purdie</assigned_to>
          <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
    
    <cc>richard.purdie</cc>
    
    <cc>ross.burton</cc>
    
    <cc>tim.orling</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>Don&apos;t know</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>93318</commentid>
    <comment_count>0</comment_count>
    <who name="Peter Kjellerstedt">peter.kjellerstedt</who>
    <bug_when>2022-05-25 23:00:28 +0000</bug_when>
    <thetext>When rebuilding after updating some layers, a lot of the python recipes fails with the following error:

ERROR: python3-docutils-native-0.18.1-r0 do_compile: &apos;python3 setup.py bdist_wheel &apos; execution failed.
ERROR: python3-docutils-native-0.18.1-r0 do_compile: ExecutionError(&apos;.../tmp/work/x86_64-linux/python3-docutils-native/0.18.1-r0/temp/run.do_compile.20639&apos;, 1, None, None)
ERROR: Logfile of failure stored in: .../tmp/work/x86_64-linux/python3-docutils-native/0.18.1-r0/temp/log.do_compile.20639
Log data follows:
| DEBUG: Executing shell function do_compile
| + cd .../tmp/work/x86_64-linux/python3-docutils-native/0.18.1-r0/docutils-0.18.1
| + do_compile
| + setuptools3_do_compile
| + cd .../tmp/work/x86_64-linux/python3-docutils-native/0.18.1-r0/docutils-0.18.1
| + NO_FETCH_BUILD=1
| + STAGING_INCDIR=.../tmp/work/x86_64-linux/python3-docutils-native/0.18.1-r0/recipe-sysroot-native/usr/include
| + STAGING_LIBDIR=.../tmp/work/x86_64-linux/python3-docutils-native/0.18.1-r0/recipe-sysroot-native/usr/lib
| + .../tmp/work/x86_64-linux/python3-docutils-native/0.18.1-r0/recipe-sysroot-native/usr/bin/python3-native/python3 setup.py bdist_wheel --verbose --dist-dir .../tmp/work/x86_64-linux/python3-docutils-native/0.18.1-r0/dist
| .../tmp/work/x86_64-linux/python3-docutils-native/0.18.1-r0/recipe-sysroot-native/usr/lib/python3.10/site-packages/setuptools/_distutils/dist.py:275: UserWarning: Unknown distribution option: &apos;python_requires&apos;
|   warnings.warn(msg)
| .../tmp/work/x86_64-linux/python3-docutils-native/0.18.1-r0/recipe-sysroot-native/usr/lib/python3.10/site-packages/setuptools/_distutils/dist.py:275: UserWarning: Unknown distribution option: &apos;include_package_data&apos;
|   warnings.warn(msg)
| .../tmp/work/x86_64-linux/python3-docutils-native/0.18.1-r0/recipe-sysroot-native/usr/lib/python3.10/site-packages/setuptools/_distutils/dist.py:275: UserWarning: Unknown distribution option: &apos;exclude_package_data&apos;
|   warnings.warn(msg)
| Traceback (most recent call last):
|   File &quot;.../tmp/work/x86_64-linux/python3-docutils-native/0.18.1-r0/docutils-0.18.1/setup.py&quot;, line 144, in &lt;module&gt;
|     do_setup()
|   File &quot;.../tmp/work/x86_64-linux/python3-docutils-native/0.18.1-r0/docutils-0.18.1/setup.py&quot;, line 139, in do_setup
|     dist = setup(**package_data)
|   File &quot;.../tmp/work/x86_64-linux/python3-docutils-native/0.18.1-r0/recipe-sysroot-native/usr/lib/python3.10/site-packages/setuptools/__init__.py&quot;, line 87, in setup
|     return distutils.core.setup(**attrs)
|   File &quot;.../tmp/work/x86_64-linux/python3-docutils-native/0.18.1-r0/recipe-sysroot-native/usr/lib/python3.10/site-packages/setuptools/_distutils/core.py&quot;, line 135, in setup
|     ok = dist.parse_command_line()
|   File &quot;.../tmp/work/x86_64-linux/python3-docutils-native/0.18.1-r0/recipe-sysroot-native/usr/lib/python3.10/site-packages/setuptools/_distutils/dist.py&quot;, line 484, in parse_command_line
|     args = self._parse_command_opts(parser, args)
|   File &quot;.../tmp/work/x86_64-linux/python3-docutils-native/0.18.1-r0/recipe-sysroot-native/usr/lib/python3.10/site-packages/setuptools/dist.py&quot;, line 1119, in _parse_command_opts
|     nargs = _Distribution._parse_command_opts(self, parser, args)
|   File &quot;.../tmp/work/x86_64-linux/python3-docutils-native/0.18.1-r0/recipe-sysroot-native/usr/lib/python3.10/site-packages/setuptools/_distutils/dist.py&quot;, line 540, in _parse_command_opts
|     cmd_class = self.get_command_class(command)
|   File &quot;.../tmp/work/x86_64-linux/python3-docutils-native/0.18.1-r0/recipe-sysroot-native/usr/lib/python3.10/site-packages/setuptools/dist.py&quot;, line 965, in get_command_class
|     self._install_dependencies(ep)
|   File &quot;.../tmp/work/x86_64-linux/python3-docutils-native/0.18.1-r0/recipe-sysroot-native/usr/lib/python3.10/site-packages/setuptools/dist.py&quot;, line 929, in _install_dependencies
|     for req in nspektr.missing(ep):
|   File &quot;.../tmp/work/x86_64-linux/python3-docutils-native/0.18.1-r0/recipe-sysroot-native/usr/lib/python3.10/site-packages/setuptools/_vendor/jaraco/functools.py&quot;, line 35, in &lt;lambda&gt;
|     return lambda *args, **kwargs: f1(f2(*args, **kwargs))
|   File &quot;.../tmp/work/x86_64-linux/python3-docutils-native/0.18.1-r0/recipe-sysroot-native/usr/lib/python3.10/contextlib.py&quot;, line 79, in inner
|     return func(*args, **kwds)
|   File &quot;.../tmp/work/x86_64-linux/python3-docutils-native/0.18.1-r0/recipe-sysroot-native/usr/lib/python3.10/site-packages/setuptools/_vendor/nspektr/__init__.py&quot;, line 35, in is_satisfied
|     return resolve(req)
|   File &quot;.../tmp/work/x86_64-linux/python3-docutils-native/0.18.1-r0/recipe-sysroot-native/usr/lib/python3.10/site-packages/setuptools/_vendor/nspektr/__init__.py&quot;, line 26, in resolve
|     if not req.specifier.contains(Version(dist.version), prereleases=True):
|   File &quot;.../tmp/work/x86_64-linux/python3-docutils-native/0.18.1-r0/recipe-sysroot-native/usr/lib/python3.10/site-packages/setuptools/_vendor/packaging/version.py&quot;, line 264, in __init__
|     match = self._regex.search(version)
| TypeError: expected string or bytes-like object
| ERROR: &apos;python3 setup.py bdist_wheel &apos; execution failed.
| WARNING: .../tmp/work/x86_64-linux/python3-docutils-native/0.18.1-r0/temp/run.do_compile.20639:178 exit 1 from &apos;exit 1&apos;
| WARNING: Backtrace (BB generated script):
|       #1: bbfatal_log, .../tmp/work/x86_64-linux/python3-docutils-native/0.18.1-r0/temp/run.do_compile.20639, line 178
|       #2: setuptools3_do_compile, .../tmp/work/x86_64-linux/python3-docutils-native/0.18.1-r0/temp/run.do_compile.20639, line 168
|       #3: do_compile, .../tmp/work/x86_64-linux/python3-docutils-native/0.18.1-r0/temp/run.do_compile.20639, line 157
|       #4: main, .../tmp/work/x86_64-linux/python3-docutils-native/0.18.1-r0/temp/run.do_compile.20639, line 183

In this particular build, the following recipes failed:

  python3-docutils-native
  python3-mako-native
  python3-inflection-native
  python3-setuptools-scm-native
  python3-packaging-native
  python3-cython-native
  python3-pygments-native
  python3-scons-native
  python3-pytest-native
  python3-lark-native
  python3-sdbus++-native
  python3-numpy-native
  python3-six-native</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>93319</commentid>
    <comment_count>1</comment_count>
    <who name="Peter Kjellerstedt">peter.kjellerstedt</who>
    <bug_when>2022-05-26 00:41:49 +0000</bug_when>
    <thetext>Got one more:

  python3-iniparse-native</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>93320</commentid>
    <comment_count>2</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2022-05-26 09:03:41 +0000</bug_when>
    <thetext>I have actually seen something similar to this, where importlib finds a dependency but doesn&apos;t fill in the metadata, so version is None.

I only saw it once and didn&apos;t preserve a build tree though.  If this happens again, can you archive the work directory (including the sysroots) please?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>93333</commentid>
    <comment_count>3</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2022-05-26 17:14:00 +0000</bug_when>
    <thetext>I just replicated for python3-setuptools-scm-native.  I saved the broken work directory for that recipe, and in a new build tree built the recipe, then compared the trees.

They were identical.

My hunch is that a path isn&apos;t being mangled correctly so something is looking into another recipe&apos;s build tree for files, but I may be miles out.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>93340</commentid>
    <comment_count>4</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2022-05-27 12:36:24 +0000</bug_when>
    <thetext>I&apos;ve been digging and the most interesting thing I&apos;ve found so far is the warnings present in this log which I don&apos;t see in my build. Specifically:

| .../tmp/work/x86_64-linux/python3-docutils-native/0.18.1-r0/recipe-sysroot-native/usr/lib/python3.10/site-packages/setuptools/_distutils/dist.py:275: 

UserWarning: Unknown distribution option: &apos;python_requires&apos;

and I do see python_requires being tested in my build. The question is therefore what could be present or broken that could cause such a warning to be emitted...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>93342</commentid>
    <comment_count>5</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2022-05-27 13:46:23 +0000</bug_when>
    <thetext>If I comment out the lines:

        for ep in metadata.entry_points(group=&apos;distutils.setup_keywords&apos;):
            vars(self).setdefault(ep.name, None)

in recipe-sysroot-native/usr/lib/python3.10/site-packages/setuptools/dist.py

then I see the warnings as in Peter&apos;s log. I also then get an error:

  File &quot;/media/build1/poky/build/tmp-test/work/x86_64-linux/python3-docutils-native/0.18.1-r0/recipe-sysroot-native/usr/lib/python3.10/site-packages/setuptools/command/build_py.py&quot;, line 35, in finalize_options
    self.exclude_package_data = self.distribution.exclude_package_data or {}

AttributeError: &apos;Distribution&apos; object has no attribute &apos;exclude_package_data&apos;. Did you mean: &apos;exclude_package&apos;?

which reminds me of a failure seen by Bruce.

There is some horrible intercept/wrapping going on in setuptools of distutils and I think somehow this bug occurs when that wrapping breaks. Still don&apos;t know the cause of that though.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>93343</commentid>
    <comment_count>6</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2022-05-27 14:10:46 +0000</bug_when>
    <thetext>To add, the &quot;python_requires&quot; comes from the [distutils.setup_keywords] section of recipe-sysroot-native/usr/lib/python3.10/site-packages/setuptools-62.3.1.dist-info/ entry_points.txt. Removing that file causes the code in question to fail to add the argument.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>93344</commentid>
    <comment_count>7</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2022-05-27 14:15:07 +0000</bug_when>
    <thetext>The python3-setuptools 59.5.0 to 62.3.1 seems somehow implicated in this since there have been few other changes and docutils has minimal other dependencies. I can confirm that 59.5.0 does have an entry_points file that does mention python_requires. Upgrading my local build does see the old files removed and the new ones moved into place.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>93345</commentid>
    <comment_count>8</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2022-05-27 16:13:33 +0000</bug_when>
    <thetext>There are two issues. Python importlib is using the on disk file order to read files and there are empty directories being left behind by previous python modules. If you hit both issues together, your build fails. Patch on the list to tweak importlib.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>93357</commentid>
    <comment_count>9</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2022-05-31 12:52:26 +0000</bug_when>
    <thetext>https://git.yoctoproject.org/poky/commit/?id=012f2db86b96b35eaaefe7f9d33dd820e3a520ec</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>