<div dir="ltr">This was a really good question.  I wrote a blog post to document the answer: <a href="https://www.kc8apf.net/2017/10/snakes-in-a-sysroot/">https://www.kc8apf.net/2017/10/snakes-in-a-sysroot/</a>.</div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Oct 6, 2017 at 11:00 AM, Kun Yi <span dir="ltr"><<a href="mailto:kunyi@google.com" target="_blank">kunyi@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hello folks,<div><br></div><div>I searched through the mailing list but haven't seen anyone brought up. Here's a weird bug I found on my setup: pythonnative seems to be using python3.4.3 whereas the recipe specified 2.7.</div><div><br></div><div>Before diving into the layers of bitbake recipes to root cause what caused this, I want to post on the mailing list to see if it is reproducible on other setups, and if people have ideas why this went wrong (environment variable accidentally being overwritten?)</div><div><br></div><div><b>What I tested:</b></div><div>I found the code in phosphor-settings-manager, which inherits pythonnative, seems to be working per python 3, so added the following line into a native python function:</div><div><br></div><div>python do_check_version () {</div><div>  import sys</div><div>  bb.warn(sys.version)</div><div>}</div><div>addtask check_version after do_configure before do_compile<br></div><div><br></div><div>WARNING: phosphor-settings-manager-1.0-<wbr>r1 do_check_version: 3.4.3 (default, Nov 17 2016, 01:08:31) <br></div><div><br></div><div>This is with openbmc git tip, building MACHINE=zaius</div><div><br></div><div><b>What the recipe should be using is seemingly 2.7:</b></div><div><div>$ cat ../import-layers/yocto-poky/<wbr>meta/classes/pythonnative.<wbr>bbclass</div><div><br></div><div>inherit python-dir</div><div>[...]</div></div><div><br></div><div><div>$ cat ../import-layers/yocto-poky/<wbr>meta/classes/python-dir.<wbr>bbclass </div><div>PYTHON_BASEVERSION = "2.7"</div><div>PYTHON_ABI = ""</div><div>PYTHON_DIR = "python${PYTHON_BASEVERSION}"</div><div>PYTHON_PN = "python"</div><div>PYTHON_SITEPACKAGES_DIR = "${libdir}/${PYTHON_DIR}/site-<wbr>packages"</div></div><div><br></div><div><div><b>Why this is bad:</b></div><div>well, python2.7 and python3 have a ton of differences. A bug I discovered is due to usage of filter(), which returns different objects between Python2/3.</div><span class="HOEnZb"><font color="#888888"><div><br></div>-- <br><div class="m_942274962384234270gmail_signature"><div dir="ltr">Regards,<div>Kun</div></div></div>
</font></span></div></div>
</blockquote></div><br></div>