PCART  v1.4
Automated Repair of Python API Parameter Compatibility Issues
extractLibAPI.py
Go to the documentation of this file.
1 
9 
10 
11 
12 import json
13 import sys
14 from Extract.getDef import getDefFunction
15 from Tool.tool import getSourceCodePath
16 
17 
18 
19 
25 def getLibAPI(version, libName, sourceCodePath):
26  getDefFunction((libName, version, sourceCodePath))
27 
28 
29 
30 
32 def main():
33  if len(sys.argv) < 3:
34  print("Usage: python extractLibAPI.py -cfg config.json")
35  sys.exit(1)
36 
37  config=sys.argv[2]
38 
39  #加载配置
40  with open(f"Configure/{config}",'r',encoding='UTF-8') as fr:
41  libName=json.load(fr)['libName']
42  currentVersion, targetVersion, currentSourceCodePath, targetSourceCodePath = getSourceCodePath(config)
43 
44  #抽取起始版本API定义
45  print(currentVersion, currentSourceCodePath)
46  getLibAPI(currentVersion, libName, currentSourceCodePath)
47 
48  #抽取目标版本API定义
49  print(targetVersion, targetSourceCodePath)
50  getLibAPI(targetVersion, libName, targetSourceCodePath)
51 
52 if __name__=='__main__':
53  main()
def main()
Main function of extracting lib API definitions 抽取库API定义主函数
def getLibAPI(version, libName, sourceCodePath)
Extract API definitions for a given library version 抽取给定库版本的API定义
def getDefFunction(args)
Extract all lib API definitions from a specified version 抽取给定版本的库API定义
Definition: getDef.py:319
Definition: main.py:1
def getSourceCodePath(configPath)
Get source code path of the lib 获取库源码路径
Definition: tool.py:886