콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
3 답글
12059 화면

Hi,

I needed to get the modules dependecies showing all levels

I wrote the following code that shows only the first level, assuming that I have the list of modules in the list 'modules'

I tried to show all dependencies using a recursive function with no success, could anyone help me accomplishing this

Here is my code

def get_dep(m):
    fl = main_path+m+'\\__openerp__.py'
    ret = []
    with open(fl,'r') as f:
        ret = eval(f.read())['depends']
    return ret

main_path = 'D:\\openerp-7.0-latest\\openerp-7.0-20140804-231303\\openerp\\addons\\'
modules = [
    'account_budget',
    'base',
    'purchase',   
]


for m in modules:
    print m
    for f in get_dep(m):
        print '         '+f

 

아바타
취소

The above code works fine it shows all the depends modules.

작성자

It gave me the result : account_budget account base purchase stock process procurement but the 'stock' module depends on 'product', I need a help in tweaking the code so it prints all levels

베스트 답변

Try the below code:-

ret = []

def get_dep(m):
global ret
fl = main_path+m+'\\__openerp__.py'
with open(fl,'r') as f:
ret = eval(f.read())['depends']
return ret

main_path = 'D:\\openerp-7.0-latest\\openerp-7.0-20140804-231303\\openerp\\addons\\'

modules = [
'account_budget',
'base',
'purchase',
]

def display(module):
for m in module:
print m
for f in get_dep(m):
print ' '+f
display(modules)



vals = [display(ret) for _ in range(3)] # It prints 3 level based on your need increase the value

아바타
취소
관련 게시물 답글 화면 활동
3
7월 25
2375
3
5월 25
4117
2
6월 25
4606
0
6월 21
2699
1
8월 24
3897