<?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>4562</bug_id>
          
          <creation_ts>2013-05-27 11:28:37 +0000</creation_ts>
          <short_desc>python-scons-native: invoke scons failed on Fedora-17 while the destro didn&apos;t install scons</short_desc>
          <delta_ts>2013-06-03 01:20:47 +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>1.5</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>1.5</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Hongxu Jia">hongxu.jia</reporter>
          <assigned_to name="Hongxu Jia">hongxu.jia</assigned_to>
          <cc>hongxu.jia</cc>
    
    <cc>kai.kang</cc>
    
    <cc>liezhi.yang</cc>
    
    <cc>mark.hatle</cc>
    
    <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
    
    <cc>ning.zhang</cc>
    
    <cc>Qi.Chen</cc>
    
    <cc>sen.zhang</cc>
    
    <cc>sgw</cc>
    
    <cc>yi.zhao</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>---</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>33310</commentid>
    <comment_count>0</comment_count>
    <who name="Hongxu Jia">hongxu.jia</who>
    <bug_when>2013-05-27 11:28:37 +0000</bug_when>
    <thetext>*env
Build Configuration:
BB_VERSION        = &quot;1.19.0&quot;
BUILD_SYS         = &quot;x86_64-linux&quot;
NATIVELSBSTRING   = &quot;Fedora-17&quot;
TARGET_SYS        = &quot;i586-poky-linux&quot;
MACHINE           = &quot;emenlow&quot;
DISTRO            = &quot;poky&quot;
DISTRO_VERSION    = &quot;1.4+snapshot-20130527&quot;
TUNE_FEATURES     = &quot;m32 core2&quot;
TARGET_FPU        = &quot;&quot;
meta              
meta-yocto        
meta-yocto-bsp    = &quot;hongxu-0524:e8197722de1f6006ceae0d4266de91c1db7278e3&quot;
meta-intel        
meta-emenlow      = &quot;master:2c9fb03aad0108f3ff2713de568632a117227c10&quot;

*problem
1, The destro didn&apos;t install scons: 
$ which scons
/usr/bin/which: no scons in (/buildarea2/hongxujia/poky/scripts:/buildarea2/hongxujia/poky/bitbake/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin)

2, build python-scons-native
$bitbake python-scons-native

3, start a devshell
$bitbake gzip-native -cdevshell

4, invoke scons in the previous shell, import module `SCons.Script&apos; failed:
$bash-4.2$ scons -h
Traceback (most recent call last):
  File &quot;/buildarea2/hongxujia/build-20130520-udev-emenlow/tmp/sysroots/x86_64-linux/usr/bin/scons&quot;, line 188, in &lt;module&gt;
    import SCons.Script
ImportError: No module named SCons.Script

*analysis:
1, While building scons as default, scons&apos;s lib will be install in the dir of `scons&apos; or `scons-2.3.0&apos; if the option `--install-lib&apos; is not set explicitly.
See tmp/work/x86_64-linux/python-scons-native/2.3.0-r0/scons-2.3.0/setup.py, line 241:
241         if not set_explicitly(&quot;lib&quot;, args):
242             # They didn&apos;t explicitly specify the installation
243             # directory for libraries...
244             is_win32 = sys.platform == &quot;win32&quot; or args[0] == &apos;bdist_wininst&apos;                               
245             prefix = get_scons_prefix(self.install_dir, is_win32)                                          
246             if Options.standalone_lib:
247                 # ...but they asked for a standalone directory.                                            
248                 self.install_dir = os.path.join(prefix, &quot;scons&quot;)                                           
249             elif Options.version_lib or not Options.standard_lib:                                          
250                 # ...they asked for a version-specific directory,                                          
251                 # or they get it by default.                                                               
252                 self.install_dir = os.path.join(prefix, &quot;scons-%s&quot; % Version) 

2, While build python-scons-native, `--install-lib&apos; is explicitly set, and scons&apos;s lib was not installed in the dir of `scons&apos; or `scons-2.3.0&apos;.
See meta/classes/distutils.bbclass, line 41:
 35 distutils_do_install() {
 ...
 41         ${STAGING_BINDIR_NATIVE}/python-native/python setup.py install --install-lib=${D}/${PYTHON_SITEPACKAGES_DIR} 

3, While invoke scons-native, the scons searches the lib in ${STAGING_DIR_HOST}/${PYTHON_SITEPACKAGES_DIR}/scons, ${STAGING_DIR_HOST}/${PYTHON_SITEPACKAGES_DIR}/scons-2.3.0 rather than ${STAGING_DIR_HOST}/${PYTHON_SITEPACKAGES_DIR}.
See tmp/sysroots/x86_64-linux/usr/bin/scons, line 175:
175 # Look first for &apos;scons-__version__&apos; in all of our preference libs,                                        
176 # then for &apos;scons&apos;.                                                                                        
177 libs.extend([os.path.join(x, scons_version) for x in prefs])                                               
178 libs.extend([os.path.join(x, &apos;scons&apos;) for x in prefs])                                                     
179                                                                                                            
180 sys.path = libs + sys.path 

*solution
Uses create_wrapper to relocate scons-native to add `${STAGING_DIR_HOST}/${PYTHON_SITEPACKAGES_DIR}&apos; to PYTHONPATH, so scons-native could find out the lib.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>33484</commentid>
    <comment_count>1</comment_count>
    <who name="Hongxu Jia">hongxu.jia</who>
    <bug_when>2013-06-03 01:20:47 +0000</bug_when>
    <thetext>Merged into master:
http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=f5d0f6becc6d1eb3a525a9e66ffd8bba52e2ae4e</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>