<?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>13208</bug_id>
          
          <creation_ts>2019-02-28 00:49:45 +0000</creation_ts>
          <short_desc>Python2.7 check in oe-buildenv-internal is erroring</short_desc>
          <delta_ts>2019-05-08 22:20:50 +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>deployment</component>
          <version>2.6.1</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>major</bug_severity>
          <target_milestone>2.8 M1</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Jaewon Lee">jaewon</reporter>
          <assigned_to name="Richard Purdie">richard.purdie</assigned_to>
          <cc>akuster</cc>
    
    <cc>randy.macleod</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>83137</commentid>
    <comment_count>0</comment_count>
    <who name="Jaewon Lee">jaewon</who>
    <bug_when>2019-02-28 00:49:45 +0000</bug_when>
    <thetext>python3_3.5.6 recipe in thud has the python3.5 wrapper set PYTHONHOME in this line:
create_wrapper ${D}${bindir}/python${PYTHON_MAJMIN} PYTHONHOME=&apos;${prefix}&apos; TERMINFO_DIRS=&apos;${sysconfdir}/terminfo:/etc/terminfo:/usr/share/terminfo:/usr/share/misc/terminfo:/lib/terminfo&apos; PYTHONNOUSERSITE=&apos;1&apos;

This causes an error during the python2 check in oe-buildenv-internal as the system will look in buildtools/sysroots/ for the python2 libraries when only python3 libraries are there.

steps to reproduce: build an esdk using thud branch on upstream, extract and use command devtool command.

error that is seen is: 
ImportError: No module named site
OpenEmbedded requires &apos;python&apos; to be python v2 (&gt;= 2.7.3), not python v3.
Please upgrade your python v2</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83210</commentid>
    <comment_count>1</comment_count>
    <who name="Armin Kuster">akuster</who>
    <bug_when>2019-03-07 16:13:40 +0000</bug_when>
    <thetext>with backport</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83211</commentid>
    <comment_count>2</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2019-03-07 16:23:22 +0000</bug_when>
    <thetext>I think we need to create our own equivalent variable to PYTHONHOME (OEPYTHON3HOME) which we can set in the wrapper which would then not affect any python2. We&apos;d need to patch this into python and it wouldn&apos;t be an upstreamable patch but would solve this problem and yet still allow relocation (which is why we need it).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83215</commentid>
    <comment_count>3</comment_count>
    <who name="Jaewon Lee">jaewon</who>
    <bug_when>2019-03-07 20:18:48 +0000</bug_when>
    <thetext>I agree that would be ideal, but how is this breaking relocation? just so I know how this variable is being used during relocation</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83226</commentid>
    <comment_count>4</comment_count>
    <who name="Armin Kuster">akuster</who>
    <bug_when>2019-03-09 20:34:09 +0000</bug_when>
    <thetext>merge of patch on hold for now.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83447</commentid>
    <comment_count>5</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2019-04-04 15:36:37 +0000</bug_when>
    <thetext>In Python/pythonrun.c there is:

char *
Py_GetPythonHome(void)
{
    char *home = default_home;
    if (home == NULL &amp;&amp; !Py_IgnoreEnvironmentFlag)
        home = Py_GETENV(&quot;PYTHONHOME&quot;);
    return home;
}

We probably need to patch this to first check OEPYTHON3HOME and then fall back to checking PYTHONHOME, then we use the OEPYTHON3HOME to set the override in our wrapper.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83750</commentid>
    <comment_count>6</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2019-05-08 22:20:50 +0000</bug_when>
    <thetext>http://git.yoctoproject.org/cgit.cgi/poky/commit/?h=master-next&amp;id=4a42d6907ab3fb1e890b82c2ac9427b742ad5a4b</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>