| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 | 2 |
| 3 # Copyright (c) 2012 Google Inc. All rights reserved. | 3 # Copyright (c) 2012 Google Inc. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 """Prints the information in a sln file in a diffable way. | 7 """Prints the information in a sln file in a diffable way. |
| 8 | 8 |
| 9 It first outputs each projects in alphabetical order with their | 9 It first outputs each projects in alphabetical order with their |
| 10 dependencies. | 10 dependencies. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 def ParseSolution(solution_file): | 32 def ParseSolution(solution_file): |
| 33 # All projects, their clsid and paths. | 33 # All projects, their clsid and paths. |
| 34 projects = dict() | 34 projects = dict() |
| 35 | 35 |
| 36 # A list of dependencies associated with a project. | 36 # A list of dependencies associated with a project. |
| 37 dependencies = dict() | 37 dependencies = dict() |
| 38 | 38 |
| 39 # Regular expressions that matches the SLN format. | 39 # Regular expressions that matches the SLN format. |
| 40 # The first line of a project definition. | 40 # The first line of a project definition. |
| 41 begin_project = re.compile(('^Project\("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942' | 41 begin_project = re.compile(r'^Project\("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942' |
| 42 '}"\) = "(.*)", "(.*)", "(.*)"$')) | 42 r'}"\) = "(.*)", "(.*)", "(.*)"$') |
| 43 # The last line of a project definition. | 43 # The last line of a project definition. |
| 44 end_project = re.compile('^EndProject$') | 44 end_project = re.compile('^EndProject$') |
| 45 # The first line of a dependency list. | 45 # The first line of a dependency list. |
| 46 begin_dep = re.compile('ProjectSection\(ProjectDependencies\) = postProject$') | 46 begin_dep = re.compile( |
| 47 r'ProjectSection\(ProjectDependencies\) = postProject$') |
| 47 # The last line of a dependency list. | 48 # The last line of a dependency list. |
| 48 end_dep = re.compile('EndProjectSection$') | 49 end_dep = re.compile('EndProjectSection$') |
| 49 # A line describing a dependency. | 50 # A line describing a dependency. |
| 50 dep_line = re.compile(' *({.*}) = ({.*})$') | 51 dep_line = re.compile(' *({.*}) = ({.*})$') |
| 51 | 52 |
| 52 in_deps = False | 53 in_deps = False |
| 53 solution = open(solution_file) | 54 solution = open(solution_file) |
| 54 for line in solution: | 55 for line in solution: |
| 55 results = begin_project.search(line) | 56 results = begin_project.search(line) |
| 56 if results: | 57 if results: |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 PrintDependencies(projects, deps) | 160 PrintDependencies(projects, deps) |
| 160 PrintBuildOrder(projects, deps) | 161 PrintBuildOrder(projects, deps) |
| 161 | 162 |
| 162 if '--recursive' in sys.argv: | 163 if '--recursive' in sys.argv: |
| 163 PrintVCProj(projects) | 164 PrintVCProj(projects) |
| 164 return 0 | 165 return 0 |
| 165 | 166 |
| 166 | 167 |
| 167 if __name__ == '__main__': | 168 if __name__ == '__main__': |
| 168 sys.exit(main()) | 169 sys.exit(main()) |
| OLD | NEW |