<?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>10315</bug_id>
          
          <creation_ts>2016-09-21 13:10:25 +0000</creation_ts>
          <short_desc>python3 bytecode files not installed</short_desc>
          <delta_ts>2017-01-06 20:30:44 +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>VERIFIED</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>2.3 M1</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Will Newton">will.newton</reporter>
          <assigned_to name="Joshua Lock">joshuagloe</assigned_to>
          <cc>jose.perez.carranza</cc>
    
    <cc>joshuagloe</cc>
    
    <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
    
    <cc>raj.khem</cc>
    
    <cc>ross.burton</cc>
          
          <qa_contact name="Juan Ramos">juan.fernandox.ramos.frayle</qa_contact>
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>66416</commentid>
    <comment_count>0</comment_count>
    <who name="Will Newton">will.newton</who>
    <bug_when>2016-09-21 13:10:25 +0000</bug_when>
    <thetext>Bytecode (*.pyc) files for python3 standard library packages are not installed which leads to slow startup times for many Python scripts.

There seems to be at least two problems. Firstly, the bytecode files don&apos;t get built for Python 3 even though they did for Python 2. The patch 020-dont-compile-python-files.patch is potentially the cause of this.

Secondly, the manifest files use a simple glob to install some files, e.g.:

FILES_${PN}-argparse=&quot;${libdir}/python3.5/argparse.* &quot;

This worked for Python 2 but will not work as well for Python 3 which puts .pyc files in a __pycache__ subdirectory rather than alongside source files.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>66434</commentid>
    <comment_count>1</comment_count>
    <who name="Paul Eggleton">bluelightning</who>
    <bug_when>2016-09-21 19:25:01 +0000</bug_when>
    <thetext>This may be covered by bug 6434.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>67009</commentid>
    <comment_count>2</comment_count>
    <who name="Joshua Lock">joshuagloe</who>
    <bug_when>2016-10-06 16:39:04 +0000</bug_when>
    <thetext>I&apos;m unfamiliar with our Python build and it&apos;s not entirely clear to me why 020-dont-compile-python-files.patch was added so I&apos;m adding Khem, the original author of the patch, to CC.

If I disable that patch I do get several pyc files written to __pycache__ directories during the build. Is it expected that we&apos;ll generate the bytecode during a later step during the build process (and therefore the bug is that we don&apos;t)?

---

The second part of the issue is that we don&apos;t include bytecode files from __pycache__ in packages.

__pycache__ was introduced in 3.2: 

https://docs.python.org/3/whatsnew/3.2.html#pep-3147-pyc-repository-directories

I&apos;ve started working on patches to include __pycache__ files in python packages, starting with the generate-manifest script.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>67011</commentid>
    <comment_count>3</comment_count>
    <who name="Khem Raj">raj.khem</who>
    <bug_when>2016-10-06 17:03:30 +0000</bug_when>
    <thetext>this patch was done for avoing pycache since they were not working well back in those early days on python3. If its reliable now, then it may be the time to revise it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>67015</commentid>
    <comment_count>4</comment_count>
    <who name="Joshua Lock">joshuagloe</who>
    <bug_when>2016-10-06 21:07:59 +0000</bug_when>
    <thetext>(In reply to comment #3)
&gt; this patch was done for avoing pycache since they were not working well back
&gt; in those early days on python3. If its reliable now, then it may be the time
&gt; to revise it.

Thanks Khem.

Sounds like we&apos;re right to target changing this in early 2.3 so that we can better assess the current state with a full development cycle ahead of us.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>68234</commentid>
    <comment_count>5</comment_count>
    <who name="Joshua Lock">joshuagloe</who>
    <bug_when>2016-11-11 10:19:00 +0000</bug_when>
    <thetext>Dominic Sacré submitted a patch for this in October:

http://lists.openembedded.org/pipermail/openembedded-core/2016-October/127989.html</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>68262</commentid>
    <comment_count>6</comment_count>
    <who name="Khem Raj">raj.khem</who>
    <bug_when>2016-11-11 18:20:00 +0000</bug_when>
    <thetext>this patch looks fine  to me.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>68716</commentid>
    <comment_count>7</comment_count>
    <who name="Joshua Lock">joshuagloe</who>
    <bug_when>2016-11-30 13:33:36 +0000</bug_when>
    <thetext>Still in review and currently queued in ross/mut</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>68729</commentid>
    <comment_count>8</comment_count>
    <who name="Joshua Lock">joshuagloe</who>
    <bug_when>2016-11-30 16:21:29 +0000</bug_when>
    <thetext>This change has merged: 

http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=3f2ab3f7cc1bf1646f2acfcace9b9cf546cc3a5d</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>69593</commentid>
    <comment_count>9</comment_count>
    <who name="Juan Ramos">juan.fernandox.ramos.frayle</who>
    <bug_when>2017-01-06 20:30:44 +0000</bug_when>
    <thetext>(In reply to comment #8)
&gt; This change has merged: 
&gt; 
&gt; http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/
&gt; ?id=3f2ab3f7cc1bf1646f2acfcace9b9cf546cc3a5d

I tested this with core-image-sato-sdk-qemux86 image downloaded from:

http://autobuilder.yoctoproject.org/pub/releases/yocto-2.3_M1.rc1/machines/qemu/qemux86/

Verified</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>