未验证 提交 f792d5f7 编写于 作者: Z zhangchunle 提交者: GitHub

modify sampcd_processor.py (#23695)

上级 c9b3bdbf
...@@ -457,7 +457,9 @@ def get_filenames(): ...@@ -457,7 +457,9 @@ def get_filenames():
''' '''
filenames = [] filenames = []
global methods global methods
global whl_error
methods = [] methods = []
whl_error = []
get_incrementapi() get_incrementapi()
API_spec = 'dev_pr_diff_api.spec' API_spec = 'dev_pr_diff_api.spec'
with open(API_spec) as f: with open(API_spec) as f:
...@@ -466,6 +468,7 @@ def get_filenames(): ...@@ -466,6 +468,7 @@ def get_filenames():
try: try:
module = eval(api).__module__ module = eval(api).__module__
except AttributeError: except AttributeError:
whl_error.append(api)
continue continue
if len(module.split('.')) > 2: if len(module.split('.')) > 2:
filename = '../python/' filename = '../python/'
...@@ -474,8 +477,9 @@ def get_filenames(): ...@@ -474,8 +477,9 @@ def get_filenames():
filename = filename + '%s/' % module.split('.')[i] filename = filename + '%s/' % module.split('.')[i]
filename = filename + module_py filename = filename + module_py
else: else:
filename = ''
print("\n----Exception in get api filename----\n") print("\n----Exception in get api filename----\n")
print("\n" + api + 'module is ' + module + "\n") print("\n" + api + ' module is ' + module + "\n")
if filename not in filenames: if filename not in filenames:
filenames.append(filename) filenames.append(filename)
# get all methods # get all methods
...@@ -577,7 +581,7 @@ else: ...@@ -577,7 +581,7 @@ else:
os.mkdir("./samplecode_temp") os.mkdir("./samplecode_temp")
cpus = multiprocessing.cpu_count() cpus = multiprocessing.cpu_count()
filenames = get_filenames() filenames = get_filenames()
if len(filenames) == 0: if len(filenames) == 0 and len(whl_error) == 0:
print("-----API_PR.spec is the same as API_DEV.spec-----") print("-----API_PR.spec is the same as API_DEV.spec-----")
exit(0) exit(0)
elif '../python/paddle/fluid/core_avx.py' in filenames: elif '../python/paddle/fluid/core_avx.py' in filenames:
...@@ -605,8 +609,27 @@ else: ...@@ -605,8 +609,27 @@ else:
os.rmdir("./samplecode_temp") os.rmdir("./samplecode_temp")
print("----------------End of the Check--------------------") print("----------------End of the Check--------------------")
if len(whl_error) != 0:
print("%s is not in whl." % whl_error)
print("")
print("Please check the whl package and API_PR.spec!")
print("You can follow these steps in order to generate API.spec:")
print("1. cd ${paddle_path}, compile paddle;")
print("2. pip install build/python/dist/(build whl package);")
print(
"3. run 'python tools/print_signatures.py paddle > paddle/fluid/API.spec'."
)
for temp in result:
if not temp:
print("")
print("In addition, mistakes found in sample codes.")
print("Please check sample codes.")
print("----------------------------------------------------")
exit(1)
else:
for temp in result: for temp in result:
if not temp: if not temp:
print("Mistakes found in sample codes") print("Mistakes found in sample codes.")
print("Please check sample codes.")
exit(1) exit(1)
print("Sample code check is successful!") print("Sample code check is successful!")
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册