Checks a set of doxygen xml file against a set of pxd header files For each C++ class found in the doxygen XML files, it tries to identify the corresponding pxd file. If a pxd file exists, it checks whether i) all public functions, enums and attributes are wrapped in Python ii)
(src_path, bin_path, ignorefilename, pxds_out, print_pxd, output_format, generate_pxd, verbose)
| 1036 | |
| 1037 | |
| 1038 | def checkPythonPxdHeader(src_path, bin_path, ignorefilename, pxds_out, print_pxd, output_format, generate_pxd, verbose): |
| 1039 | """ Checks a set of doxygen xml file against a set of pxd header files |
| 1040 | |
| 1041 | For each C++ class found in the doxygen XML files, it tries to identify the |
| 1042 | corresponding pxd file. If a pxd file exists, it checks whether |
| 1043 | |
| 1044 | i) all public functions, enums and attributes are wrapped in Python |
| 1045 | ii) all void return types are correct in Python (these are not checked at |
| 1046 | compile time) |
| 1047 | iii) all fields of an enum are accessible from Python |
| 1048 | |
| 1049 | If it finds a method missing, the script suggests an addition and if a |
| 1050 | whole class is missing, the script writes suggestion .pxd file to a |
| 1051 | specified location (pxds_out). |
| 1052 | |
| 1053 | The output format can either be in text form (human readable) or in xml |
| 1054 | form which will try to overwrite the cdash Test.xml file to proivide an |
| 1055 | output to cdash. Please only specify xml output if in your binary |
| 1056 | you have executed "ctest -D Nightly" or similar. |
| 1057 | |
| 1058 | TODO also look at ./doc/doxygen/doxygen-error.log ? |
| 1059 | |
| 1060 | Make sure to build the doxygen xmls first with |
| 1061 | $ make doc_xml |
| 1062 | |
| 1063 | """ |
| 1064 | |
| 1065 | xml_output_path = os.path.join(bin_path, "doc", "xml_output") |
| 1066 | xml_files = glob.glob(xml_output_path + "/*.xml") |
| 1067 | print ("Found %s doxygen xml files" % (len(xml_files))) |
| 1068 | if len(xml_files) == 0: |
| 1069 | raise Exception("No doxygen files found in directory:\n%s,\n" % xml_output_path + \ |
| 1070 | "Please make sure you build the doxygen xmls (make doc_xml)\n" +\ |
| 1071 | "and that you specified the correct directory." ) |
| 1072 | |
| 1073 | print ("Creating pxd file map") |
| 1074 | pxd_file_matching = create_pxd_file_map(src_path) |
| 1075 | print ("Found %s matching pxd files" % len(pxd_file_matching)) |
| 1076 | cnt = Counter() |
| 1077 | cnt.total = len(xml_files) |
| 1078 | ignorefile = IgnoreFile() |
| 1079 | if len(ignorefilename) > 0: |
| 1080 | ignorefile.load(ignorefilename) |
| 1081 | |
| 1082 | if len(generate_pxd) > 0: |
| 1083 | print ("Will only consider class", generate_pxd) |
| 1084 | |
| 1085 | def pxd_text_printout(pxd_text, pxds_out, comp_name, print_pxd): |
| 1086 | if print_pxd: |
| 1087 | print ("") |
| 1088 | print (pxd_text) |
| 1089 | if len(pxds_out) > 0 and pxd_text is not None: |
| 1090 | fname = os.path.join(pxds_out, "%s.pxd" % comp_name.split("::")[-1] ) |
| 1091 | with open(fname, "w" ) as f: |
| 1092 | f.write(pxd_text) |
| 1093 | |
| 1094 | testresults = TestResultHandler() |
| 1095 |
no test coverage detected