PatLas
PatLas

Reputation: 189

BitBake recipe for custom setup.py

In my recipe I have to download git repository and run CMake. After CMake finish its work additional directory OUT is created which contain setup.py file that I like to run in do_install? I have tried:

DEPENDS = "setuptools python" 
do_install () {
python OUT/setup.py install 
}

But it raise no setup.py found error. Can anyone deal with such issue?

Upvotes: 2

Views: 5218

Answers (3)

Patrick.C Jeon
Patrick.C Jeon

Reputation: 11

Try add below command in your recipe file

distutils_do_compile() {                                                                                                                                       
    :                                                                                                                                                          
}                                                                                                                                                              
distutils_stage_headers() {                                                                                                                                    
    :                                                                                                                                                          
}                                                                                                                                                              
distutils_stage_all() {                                                                                                                                        
    :                                                                                                                                                          
}                                                                                                                                                              
distutils_do_install() {                                                                                                                                       
    :                                                                                                                                                          
} 

and see more detail information below... ./poky/meta/classes/distutils-tools.bbclass

Upvotes: 0

PatLas
PatLas

Reputation: 189

At the moment I have reorganized my recipe which looks like below:

LICENSE = "CLOSED"
BB_STRICT_CHECKSUM = "0"

inherit cmake setuptools pythonnative

DEPENDS = "boost udev python swig-native python-native python-setuptools-native cmake-native"

SRC_URI = " \
    git://github.com/my_repo.git;name=my_name \
    file://0001-system-install.patch \
"
SRCREV_my_name = "404ff3eeff0d79c15cbfdbc126c4bff2996baea6"

S = "${WORKDIR}/git"

PARALLEL_MAKEINST = ""

Project downloaded from git base on CMake which has install like that:

install(CODE "execute_process(COMMAND python \"${PROJECT_SOURCE_DIR}/python/setup.py\" \"install\")")

But when I call recipe to build (bitbake my_recipe) or build image which contains that recipe (bitbake my_image) i received such error:

ERROR: pc-ble-driver-git-r0 do_compile: python setup.py build execution failed.
ERROR: pc-ble-driver-git-r0 do_compile: Function failed: do_compile (log file is located at /build/yocto-fsl/build/tmp/work/cortexa7hf-neon-poky-linux-gnueabi/pc-ble-driver/git-r0/temp/log.do_compile.16502)
ERROR: Logfile of failure stored in: /build/yocto-fsl/build/tmp/work/cortexa7hf-neon-poky-linux-gnueabi/pc-ble-driver/git-r0/temp/log.do_compile.16502
Log data follows:
| DEBUG: Executing shell function do_compile
| ERROR: python setup.py build execution failed.
| /build/yocto-fsl/build/tmp/work/cortexa7hf-neon-poky-linux-gnueabi/pc-ble-driver/git-r0/recipe-sysroot-native/usr/bin/python-native/python: can't open file 'setup.py': [Errno 2] No such file or directory
| WARNING: exit code 1 from a shell command.
| ERROR: Function failed: do_compile (log file is located at /build/yocto-fsl/build/tmp/work/cortexa7hf-neon-poky-linux-gnueabi/pc-ble-driver/git-r0/temp/log.do_compile.16502)
ERROR: Task (/build/yocto-fsl/sources/meta-slabs/recipes-external/pc-ble-driver/pc-ble-driver_git.bb:do_compile) failed with exit code '1'
NOTE: Tasks Summary: Attempted 2195 tasks of which 2194 didn't need to be rerun and 1 failed.

P.S. On my PC when I build CMake project and call make install everything go as I assumed.

Any other suggestion how to deal with that?

Upvotes: 1

lukaszgard
lukaszgard

Reputation: 1011

That's happen because bitbake doesn't know where setup.py is stored - You need to use ${S} variable generated by bitbake to provide full path to this script.

Please read about how do_install() task work - link

Upvotes: 2

Related Questions