| OLD | NEW |
| 1 #!/usr/bin/python2.5 | 1 #!/usr/bin/python2.5 |
| 2 # Copyright 2009 Google Inc. | 2 |
| 3 # All Rights Reserved. | 3 # Copyright (c) 2009 Google Inc. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. |
| 4 | 6 |
| 5 """Prints the information in a sln file in a diffable way. | 7 """Prints the information in a sln file in a diffable way. |
| 6 | 8 |
| 7 It first outputs each projects in alphabetical order with their | 9 It first outputs each projects in alphabetical order with their |
| 8 dependencies. | 10 dependencies. |
| 9 | 11 |
| 10 Then it outputs a possible build order. | 12 Then it outputs a possible build order. |
| 11 """ | 13 """ |
| 12 | 14 |
| 13 __author__ = 'nsylvain (Nicolas Sylvain)' | 15 __author__ = 'nsylvain (Nicolas Sylvain)' |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 | 114 |
| 113 print "-- --" | 115 print "-- --" |
| 114 | 116 |
| 115 def PrintBuildOrder(projects, deps): | 117 def PrintBuildOrder(projects, deps): |
| 116 print "---------------------------------------" | 118 print "---------------------------------------" |
| 117 print "Build order " | 119 print "Build order " |
| 118 print "---------------------------------------" | 120 print "---------------------------------------" |
| 119 print "-- --" | 121 print "-- --" |
| 120 | 122 |
| 121 built = [] | 123 built = [] |
| 122 for (project, dep_list) in sorted(deps.items()): | 124 for (project, dep_list) in sorted(deps.items()): |
| 123 if project not in built: | 125 if project not in built: |
| 124 BuildProject(project, built, projects, deps) | 126 BuildProject(project, built, projects, deps) |
| 125 | 127 |
| 126 print "-- --" | 128 print "-- --" |
| 127 | 129 |
| 128 def PrintVCProj(projects): | 130 def PrintVCProj(projects): |
| 129 | 131 |
| 130 for project in projects: | 132 for project in projects: |
| 131 print "-------------------------------------" | 133 print "-------------------------------------" |
| 132 print "-------------------------------------" | 134 print "-------------------------------------" |
| 133 print project | 135 print project |
| 134 print project | 136 print project |
| 135 print project | 137 print project |
| 136 print "-------------------------------------" | 138 print "-------------------------------------" |
| 137 print "-------------------------------------" | 139 print "-------------------------------------" |
| 138 | 140 |
| 139 project_path = os.path.abspath(os.path.join(os.path.dirname(sys.argv[1]), | 141 project_path = os.path.abspath(os.path.join(os.path.dirname(sys.argv[1]), |
| 140 projects[project][2])) | 142 projects[project][2])) |
| 141 | 143 |
| 142 pretty = pretty_vcproj | 144 pretty = pretty_vcproj |
| 143 argv = [ '', | 145 argv = [ '', |
| 144 project_path, | 146 project_path, |
| 145 '$(SolutionDir)=%s\\' % os.path.dirname(sys.argv[1]), | 147 '$(SolutionDir)=%s\\' % os.path.dirname(sys.argv[1]), |
| 146 ] | 148 ] |
| 147 argv.extend(sys.argv[3:]) | 149 argv.extend(sys.argv[3:]) |
| 148 pretty.main(argv) | 150 pretty.main(argv) |
| 149 | 151 |
| 150 def main(): | 152 def main(): |
| 151 # check if we have exactly 1 parameter. | 153 # check if we have exactly 1 parameter. |
| 152 if len(sys.argv) < 2: | 154 if len(sys.argv) < 2: |
| 153 print 'Usage: %s "c:\\path\\to\\project.sln"' % sys.argv[0] | 155 print 'Usage: %s "c:\\path\\to\\project.sln"' % sys.argv[0] |
| 154 return | 156 return |
| 155 | 157 |
| 156 (projects, deps) = ParseSolution(sys.argv[1]) | 158 (projects, deps) = ParseSolution(sys.argv[1]) |
| 157 PrintDependencies(projects, deps) | 159 PrintDependencies(projects, deps) |
| 158 PrintBuildOrder(projects, deps) | 160 PrintBuildOrder(projects, deps) |
| 159 | 161 |
| 160 if '--recursive' in sys.argv: | 162 if '--recursive' in sys.argv: |
| 161 PrintVCProj(projects) | 163 PrintVCProj(projects) |
| 162 | 164 |
| 163 if __name__ == '__main__': | 165 if __name__ == '__main__': |
| 164 main() | 166 main() |
| 165 | 167 |
| OLD | NEW |