本文说明如何处理升级west后出现requires_workspace的问题。
最近将west升级到最新版本0.72后无论执行west的什么命令都会出现下面的问题1
2
3
4
5
6
7
8
9
10File "/home/frank/.local/bin/west", line 11, in <module>
sys.exit(main())
File "/home/frank/.local/lib/python3.6/site-packages/west/app/main.py", line 767, in main
app = WestApp()
File "/home/frank/.local/lib/python3.6/site-packages/west/app/main.py", line 64, in __init__
lst = [cls() for cls in classes]
File "/home/frank/.local/lib/python3.6/site-packages/west/app/main.py", line 64, in <listcomp>
lst = [cls() for cls in classes]
File "/home/frank/.local/lib/python3.6/site-packages/west/app/project.py", line 153, in __init__
requires_workspace=False)
原始解法
最开始以为是安装错误,卸载了又重新装还是一样,后来以为是设置问题,又去mail list里面翻了一遍没找到。还是见招拆招吧,修改了下面几个文件1
2
3.local/lib/python3.6/site-packages/west/app/project.py
.local/lib/python3.6/site-packages/west/app/main.py
.local/lib/python3.6/site-packages/west/app/config.py
将这几个文件中init 方法的 requires_workspace=False 直接删除掉就可以了
真实原因
虽然改了后west能工作了,但总觉得还是不稳妥,于是上mail list提问,见链接https://lists.zephyrproject.org/g/devel/topic/west_0_7_2_can_t_work/71967531?p=,,,20,0,0,0::recentpostdate%2Fsticky,,,20,2,0,71967531
很快有了答复,因为新老版本不兼容,需要先删除老版本的west再装新的版本1
2
3
4$ pip3 show west | grep Location: | cut -f 2 -d ' '
/home/foo/.local/lib/python3.6/site-packages
$ rm -r /home/foo/.local/lib/python3.6/site-packages/west
$ pip3 install --user west==0.7.0
详细见https://lists.zephyrproject.org/g/announce/message/86
后记
最开始在mail list是以requires_workspace为关键字搜索该问题,没有搜到。其实git issue里面已经有人报了,详见https://github.com/zephyrproject-rtos/west/issues/373,如果在issue里面以requires_workspace为关键字搜索是可以找到答案的,所以有问题除了mail list外,issue内也找一下比稳妥,避免浪费答题者的时间。