MCPcopy Create free account
hub / github.com/Tencent/phxsql / GetSourceTagFromDeps

Function GetSourceTagFromDeps

tools/create_makefile.py:32–80  ·  view source on GitHub ↗
(path, lib_name, tag_name)

Source from the content-addressed store, hash-verified

30makefile_name = "Makefile"
31
32def GetSourceTagFromDeps(path, lib_name, tag_name):
33 define_name = GetLableName(lib_name, tag_name)
34
35 lib_define_name = GetLableName(lib_name, "LIB")
36 res = []
37
38 if(path.find("third_party") >=0):
39 return res
40
41 if((path,lib_name,tag_name) in res_list):
42 return res_list[ (path,lib_name,tag_name) ]
43
44 if( tag_name == "FULL_LIB_DEPS_PATH" ):
45 res.append( "$(SRC_BASE_PATH)/%s" % path )
46
47 lib_path = base_path + "/" + path + "/" + include_makefile_name
48 makefile_file = open(lib_path, "r")
49 try:
50 lines = makefile_file.readlines()
51 for line in lines:
52 values=line.split('=')
53 if(values[0] == define_name):
54 value = values[1].replace('\n', '').split(' ')
55 for obj in value:
56 if(len(obj) > 0):
57 if(tag_name == "OBJ"):
58 res.append("%s/%s" % (path, obj))
59 elif(tag_name == "LIB"):
60 if(len(obj.split(':')) == 1):
61 res.append(obj)
62 else:
63 res.append(obj)
64
65 if(values[0] == lib_define_name):
66 res_inc = values[1].replace('\n','')
67 dep_lib_list = res_inc.split(' ')
68 for dep_lib in dep_lib_list:
69 if(len(dep_lib.split(':')) > 1):
70 deps_path = dep_lib.split(':')[0]
71 deps_lib_name = dep_lib.split(':')[1]
72 if(deps_path == ""):
73 deps_path = path
74 res+=GetSourceTagFromDeps(deps_path, deps_lib_name, tag_name)
75
76 finally:
77 makefile_file.close()
78 res=Uniq(res)
79 res_list[ (path,lib_name,tag_name) ] = res
80 return res
81
82
83def PrintComm(path, target_name, lib_name):

Callers 3

PrintCommFunction · 0.85
PrintLibFunction · 0.85
PrintBinFunction · 0.85

Calls 4

GetLableNameFunction · 0.85
UniqFunction · 0.85
appendMethod · 0.80
closeMethod · 0.80

Tested by

no test coverage detected