| OLD | NEW |
| 1 #! /usr/bin/python | 1 #! /usr/bin/python |
| 2 # -*- coding: utf-8 -*- | 2 # -*- coding: utf-8 -*- |
| 3 # | 3 # |
| 4 # Copyright (C) 2011, International Business Machines | 4 # Copyright (C) 2011-2014, International Business Machines |
| 5 # Corporation and others. All Rights Reserved. | 5 # Corporation and others. All Rights Reserved. |
| 6 # | 6 # |
| 7 # file name: depstest.py | 7 # file name: depstest.py |
| 8 # | 8 # |
| 9 # created on: 2011may24 | 9 # created on: 2011may24 |
| 10 | 10 |
| 11 """ICU dependency tester. | 11 """ICU dependency tester. |
| 12 | 12 |
| 13 This probably works only on Linux. | 13 This probably works only on Linux. |
| 14 | 14 |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 # We always include the dependency's exports, even if we do not need them | 120 # We always include the dependency's exports, even if we do not need them |
| 121 # to satisfy local imports. | 121 # to satisfy local imports. |
| 122 exports |= dep_exports | 122 exports |= dep_exports |
| 123 system_symbols |= dep_system_symbols | 123 system_symbols |= dep_system_symbols |
| 124 item["exports"] = exports | 124 item["exports"] = exports |
| 125 item["system_symbols"] = system_symbols | 125 item["system_symbols"] = system_symbols |
| 126 imports -= exports | system_symbols | 126 imports -= exports | system_symbols |
| 127 for symbol in imports: | 127 for symbol in imports: |
| 128 for file_name in files: | 128 for file_name in files: |
| 129 if symbol in _obj_files[file_name]["imports"]: | 129 if symbol in _obj_files[file_name]["imports"]: |
| 130 sys.stderr.write("Error: %s %s file %s imports %s but %s does no
t depend on %s\n" % | 130 neededFile = _symbols_to_files.get(symbol) |
| 131 (item_type, name, file_name, symbol, name, _symbols_to_
files.get(symbol))) | 131 if neededFile in dependencies.file_to_item: |
| 132 neededItem = "but %s does not depend on %s (for %s)" % (name, dependen
cies.file_to_item[neededFile], neededFile) |
| 133 else: |
| 134 neededItem = "- is this a new system symbol?" |
| 135 sys.stderr.write("Error: in %s %s: %s imports %s %s\n" % |
| 136 (item_type, name, file_name, symbol, neededItem)) |
| 132 _return_value = 1 | 137 _return_value = 1 |
| 133 del parents[-1] | 138 del parents[-1] |
| 134 return item | 139 return item |
| 135 | 140 |
| 136 def Process(root_path): | 141 def Process(root_path): |
| 137 """Loads dependencies.txt, reads the libraries' .o files, and processes them. | 142 """Loads dependencies.txt, reads the libraries' .o files, and processes them. |
| 138 | 143 |
| 139 Modifies dependencies.items: Recursively builds each item's system_symbols and
exports. | 144 Modifies dependencies.items: Recursively builds each item's system_symbols and
exports. |
| 140 """ | 145 """ |
| 141 global _ignored_symbols, _obj_files, _return_value | 146 global _ignored_symbols, _obj_files, _return_value |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 def main(): | 181 def main(): |
| 177 global _return_value | 182 global _return_value |
| 178 if len(sys.argv) <= 1: | 183 if len(sys.argv) <= 1: |
| 179 sys.exit(("Command line error: " + | 184 sys.exit(("Command line error: " + |
| 180 "need one argument with the root path to the built ICU libraries/*.
o files.")) | 185 "need one argument with the root path to the built ICU libraries/*.
o files.")) |
| 181 Process(sys.argv[1]) | 186 Process(sys.argv[1]) |
| 182 if _ignored_symbols: | 187 if _ignored_symbols: |
| 183 print "Info: ignored symbols:\n%s" % sorted(_ignored_symbols) | 188 print "Info: ignored symbols:\n%s" % sorted(_ignored_symbols) |
| 184 if not _return_value: | 189 if not _return_value: |
| 185 print "OK: Specified and actual dependencies match." | 190 print "OK: Specified and actual dependencies match." |
| 191 else: |
| 192 print "Error: There were errors, please fix them and re-run. Processing may
have terminated abnormally." |
| 186 return _return_value | 193 return _return_value |
| 187 | 194 |
| 188 if __name__ == "__main__": | 195 if __name__ == "__main__": |
| 189 sys.exit(main()) | 196 sys.exit(main()) |
| OLD | NEW |