Yocto recipe python whl package

前端 未结 1 1197
无人及你
无人及你 2021-01-25 03:26

I am writing a custom yocto recipe that should install a python package from a .whl file.

I tried it using a recipe that contains:

<         


        
相关标签:
1条回答
  • 2021-01-25 03:46

    .whl package is just a .zip file with python sources, and precompiled binaries for certain platform.

    So, you can do something like this:

    COMPATIBLE_HOST = "i686.*-mingw.*"                                                                  
    
    SRC_URI = "https://files.pythonhosted.org/packages/d8/9d/7a8cad803ef73f47134ae5c3804e20b54149ce62a7d1337204f3cf2d1fa1/MarkupSafe-1.1.1-cp35-cp35m-win32.whl;downloadfilename=MarkupSafe-1.1.1-cp35-cp35m-win32.zip;subdir=${BP}"
    
    SRC_URI[md5sum] = "a948c70a1241389d7120db90d69079ca"                                                
    SRC_URI[sha256sum] = "6dd73240d2af64df90aa7c4e7481e23825ea70af4b4922f8ede5b9e35f78a3b1"             
    
    inherit nativesdk python3-dir                                                                       
    
    LICENSE = "BSD-3-Clause"                                                                            
    
    PV = "1.1.1"                                                                                        
    PN = "nativesdk-python3-markupsafe"                                                                 
    
    LIC_FILES_CHKSUM = "file:///${S}/MarkupSafe-1.1.1.dist-info/LICENSE.rst;md5=ffeffa59c90c9c4a033c7574f8f3fb75"
    
    do_unpack[depends] += "unzip-native:do_populate_sysroot"                                            
    
    PROVIDES += "nativesdk-python3-markupsafe"                                                          
    DEPENDS += "nativesdk-python3"                                                                      
    
    FILES_${PN} += "\                                                                                   
        ${libdir}/${PYTHON_DIR}/site-packages/* \                                                       
    "                                                                                                   
    
    do_install() {                                                                                      
        install -d ${D}${libdir}/${PYTHON_DIR}/site-packages/MarkupSafe-1.1.1.dist-info                 
        install -d ${D}${libdir}/${PYTHON_DIR}/site-packages/markupsafe                                 
    
        install -m 644 ${S}/markupsafe/* ${D}${libdir}/${PYTHON_DIR}/site-packages/markupsafe/          
        install -m 644 ${S}/MarkupSafe-1.1.1.dist-info/* ${D}${libdir}/${PYTHON_DIR}/site-packages/MarkupSafe-1.1.1.dist-info/
    }
    

    I haven't tested it, yet, but it already forms proper nativesdk package. Note downloadfilename= parameter to the SRC_URI - without it, .whl file would not be extracted.

    0 讨论(0)
提交回复
热议问题