Below is the code in shell script
source /proj/common/tools/repo/etc/profile.d/repo.sh
repo project init $branch
repo project sync
source poky/fnc-init-build
The problem is, that you run subprocess.call(something, shell=True)
several times and assume that the variables set in the first call are present in the later calls, which use shells independend from the earlier calls.
I would put the commands in a shell script and then run it with a single subprocess.call
command. There seems to be no real point in converting it line by line into python by just running shell commands with the subprocess
module.
When repo
and bitbake
are python programs there could be a point to import the relevant modules from them and run the corresponding python functions instead of the shell commands provided by their main method.