wsba-hockey 1.0.3__py3-none-any.whl → 1.0.5__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. wsba_hockey/__init__.py +1 -1
  2. wsba_hockey/data_pipelines.py +183 -0
  3. wsba_hockey/evidence/weakside-breakout/node_modules/duckdb/vendor.py +146 -0
  4. wsba_hockey/evidence/weakside-breakout/node_modules/flatted/python/flatted.py +149 -0
  5. wsba_hockey/evidence/weakside-breakout/node_modules/flatted/python/test.py +63 -0
  6. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/gyp_main.py +45 -0
  7. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/MSVSNew.py +367 -0
  8. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/MSVSProject.py +206 -0
  9. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings.py +1270 -0
  10. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings_test.py +1547 -0
  11. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/MSVSToolFile.py +59 -0
  12. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/MSVSUserFile.py +153 -0
  13. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/MSVSUtil.py +271 -0
  14. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/MSVSVersion.py +574 -0
  15. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/__init__.py +690 -0
  16. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/common.py +661 -0
  17. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/common_test.py +78 -0
  18. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/easy_xml.py +165 -0
  19. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/easy_xml_test.py +109 -0
  20. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/flock_tool.py +55 -0
  21. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/__init__.py +0 -0
  22. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/analyzer.py +808 -0
  23. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/android.py +1173 -0
  24. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/cmake.py +1321 -0
  25. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/compile_commands_json.py +120 -0
  26. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/dump_dependency_json.py +103 -0
  27. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/eclipse.py +464 -0
  28. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/gypd.py +89 -0
  29. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/gypsh.py +58 -0
  30. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py +2714 -0
  31. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py +3981 -0
  32. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs_test.py +44 -0
  33. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja.py +2936 -0
  34. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja_test.py +55 -0
  35. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode.py +1394 -0
  36. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode_test.py +25 -0
  37. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/input.py +3130 -0
  38. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/input_test.py +98 -0
  39. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/mac_tool.py +771 -0
  40. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/msvs_emulation.py +1271 -0
  41. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/ninja_syntax.py +174 -0
  42. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/simple_copy.py +61 -0
  43. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/win_tool.py +374 -0
  44. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py +1939 -0
  45. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/xcode_ninja.py +302 -0
  46. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/xcodeproj_file.py +3197 -0
  47. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/xml_fix.py +65 -0
  48. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/test_gyp.py +261 -0
  49. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/tools/graphviz.py +102 -0
  50. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/tools/pretty_gyp.py +156 -0
  51. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/tools/pretty_sln.py +181 -0
  52. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/tools/pretty_vcproj.py +339 -0
  53. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/test/fixtures/test-charmap.py +31 -0
  54. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/update-gyp.py +64 -0
  55. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/gyp_main.py +45 -0
  56. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/MSVSNew.py +367 -0
  57. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/MSVSProject.py +206 -0
  58. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings.py +1270 -0
  59. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings_test.py +1547 -0
  60. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/MSVSToolFile.py +59 -0
  61. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/MSVSUserFile.py +153 -0
  62. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/MSVSUtil.py +271 -0
  63. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/MSVSVersion.py +574 -0
  64. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/__init__.py +666 -0
  65. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/common.py +654 -0
  66. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/common_test.py +78 -0
  67. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/easy_xml.py +165 -0
  68. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/easy_xml_test.py +109 -0
  69. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/flock_tool.py +55 -0
  70. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/__init__.py +0 -0
  71. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/analyzer.py +808 -0
  72. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/android.py +1173 -0
  73. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/cmake.py +1321 -0
  74. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/compile_commands_json.py +120 -0
  75. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/dump_dependency_json.py +103 -0
  76. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/eclipse.py +464 -0
  77. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/gypd.py +89 -0
  78. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/gypsh.py +58 -0
  79. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py +2518 -0
  80. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py +3978 -0
  81. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs_test.py +44 -0
  82. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja.py +2936 -0
  83. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja_test.py +55 -0
  84. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode.py +1394 -0
  85. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode_test.py +25 -0
  86. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/input.py +3137 -0
  87. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/input_test.py +98 -0
  88. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/mac_tool.py +771 -0
  89. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/msvs_emulation.py +1271 -0
  90. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/ninja_syntax.py +174 -0
  91. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/simple_copy.py +61 -0
  92. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/win_tool.py +374 -0
  93. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py +1939 -0
  94. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/xcode_ninja.py +302 -0
  95. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/xcodeproj_file.py +3197 -0
  96. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/xml_fix.py +65 -0
  97. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/setup.py +42 -0
  98. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/test_gyp.py +260 -0
  99. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/tools/graphviz.py +102 -0
  100. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/tools/pretty_gyp.py +156 -0
  101. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/tools/pretty_sln.py +181 -0
  102. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/tools/pretty_vcproj.py +339 -0
  103. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/test/fixtures/test-charmap.py +31 -0
  104. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/update-gyp.py +46 -0
  105. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/game_stats/app.py +400 -0
  106. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/game_stats/name_fix.py +47 -0
  107. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/heatmaps/app.py +108 -0
  108. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/heatmaps/plot.py +93 -0
  109. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/heatmaps/rink_plot.py +245 -0
  110. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/matchups/app.py +145 -0
  111. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/matchups/plot.py +77 -0
  112. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/matchups/rink_plot.py +245 -0
  113. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/pbp/app.py +389 -0
  114. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/pbp/plot.py +70 -0
  115. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/pbp/rink_plot.py +245 -0
  116. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/skater/app.py +110 -0
  117. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/skater/plot.py +58 -0
  118. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/skater/rink_plot.py +245 -0
  119. wsba_hockey/tools/agg.py +243 -54
  120. wsba_hockey/tools/plotting.py +25 -25
  121. wsba_hockey/tools/scraping.py +154 -263
  122. wsba_hockey/tools/xg_model.py +369 -315
  123. wsba_hockey/workspace.py +22 -117
  124. wsba_hockey/wsba_main.py +499 -167
  125. {wsba_hockey-1.0.3.dist-info → wsba_hockey-1.0.5.dist-info}/METADATA +1 -1
  126. wsba_hockey-1.0.5.dist-info/RECORD +135 -0
  127. {wsba_hockey-1.0.3.dist-info → wsba_hockey-1.0.5.dist-info}/WHEEL +1 -1
  128. wsba_hockey/stats/calculate_viz/shot_impact.py +0 -2
  129. wsba_hockey-1.0.3.dist-info/RECORD +0 -19
  130. {wsba_hockey-1.0.3.dist-info → wsba_hockey-1.0.5.dist-info}/licenses/LICENSE +0 -0
  131. {wsba_hockey-1.0.3.dist-info → wsba_hockey-1.0.5.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,181 @@
1
+ #!/usr/bin/env python3
2
+
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
5
+ # found in the LICENSE file.
6
+
7
+ """Prints the information in a sln file in a diffable way.
8
+
9
+ It first outputs each projects in alphabetical order with their
10
+ dependencies.
11
+
12
+ Then it outputs a possible build order.
13
+ """
14
+
15
+
16
+ import os
17
+ import re
18
+ import sys
19
+ import pretty_vcproj
20
+
21
+ __author__ = "nsylvain (Nicolas Sylvain)"
22
+
23
+
24
+ def BuildProject(project, built, projects, deps):
25
+ # if all dependencies are done, we can build it, otherwise we try to build the
26
+ # dependency.
27
+ # This is not infinite-recursion proof.
28
+ for dep in deps[project]:
29
+ if dep not in built:
30
+ BuildProject(dep, built, projects, deps)
31
+ print(project)
32
+ built.append(project)
33
+
34
+
35
+ def ParseSolution(solution_file):
36
+ # All projects, their clsid and paths.
37
+ projects = dict()
38
+
39
+ # A list of dependencies associated with a project.
40
+ dependencies = dict()
41
+
42
+ # Regular expressions that matches the SLN format.
43
+ # The first line of a project definition.
44
+ begin_project = re.compile(
45
+ r'^Project\("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942'
46
+ r'}"\) = "(.*)", "(.*)", "(.*)"$'
47
+ )
48
+ # The last line of a project definition.
49
+ end_project = re.compile("^EndProject$")
50
+ # The first line of a dependency list.
51
+ begin_dep = re.compile(r"ProjectSection\(ProjectDependencies\) = postProject$")
52
+ # The last line of a dependency list.
53
+ end_dep = re.compile("EndProjectSection$")
54
+ # A line describing a dependency.
55
+ dep_line = re.compile(" *({.*}) = ({.*})$")
56
+
57
+ in_deps = False
58
+ solution = open(solution_file)
59
+ for line in solution:
60
+ results = begin_project.search(line)
61
+ if results:
62
+ # Hack to remove icu because the diff is too different.
63
+ if results.group(1).find("icu") != -1:
64
+ continue
65
+ # We remove "_gyp" from the names because it helps to diff them.
66
+ current_project = results.group(1).replace("_gyp", "")
67
+ projects[current_project] = [
68
+ results.group(2).replace("_gyp", ""),
69
+ results.group(3),
70
+ results.group(2),
71
+ ]
72
+ dependencies[current_project] = []
73
+ continue
74
+
75
+ results = end_project.search(line)
76
+ if results:
77
+ current_project = None
78
+ continue
79
+
80
+ results = begin_dep.search(line)
81
+ if results:
82
+ in_deps = True
83
+ continue
84
+
85
+ results = end_dep.search(line)
86
+ if results:
87
+ in_deps = False
88
+ continue
89
+
90
+ results = dep_line.search(line)
91
+ if results and in_deps and current_project:
92
+ dependencies[current_project].append(results.group(1))
93
+ continue
94
+
95
+ # Change all dependencies clsid to name instead.
96
+ for project in dependencies:
97
+ # For each dependencies in this project
98
+ new_dep_array = []
99
+ for dep in dependencies[project]:
100
+ # Look for the project name matching this cldis
101
+ for project_info in projects:
102
+ if projects[project_info][1] == dep:
103
+ new_dep_array.append(project_info)
104
+ dependencies[project] = sorted(new_dep_array)
105
+
106
+ return (projects, dependencies)
107
+
108
+
109
+ def PrintDependencies(projects, deps):
110
+ print("---------------------------------------")
111
+ print("Dependencies for all projects")
112
+ print("---------------------------------------")
113
+ print("-- --")
114
+
115
+ for (project, dep_list) in sorted(deps.items()):
116
+ print("Project : %s" % project)
117
+ print("Path : %s" % projects[project][0])
118
+ if dep_list:
119
+ for dep in dep_list:
120
+ print(" - %s" % dep)
121
+ print("")
122
+
123
+ print("-- --")
124
+
125
+
126
+ def PrintBuildOrder(projects, deps):
127
+ print("---------------------------------------")
128
+ print("Build order ")
129
+ print("---------------------------------------")
130
+ print("-- --")
131
+
132
+ built = []
133
+ for (project, _) in sorted(deps.items()):
134
+ if project not in built:
135
+ BuildProject(project, built, projects, deps)
136
+
137
+ print("-- --")
138
+
139
+
140
+ def PrintVCProj(projects):
141
+
142
+ for project in projects:
143
+ print("-------------------------------------")
144
+ print("-------------------------------------")
145
+ print(project)
146
+ print(project)
147
+ print(project)
148
+ print("-------------------------------------")
149
+ print("-------------------------------------")
150
+
151
+ project_path = os.path.abspath(
152
+ os.path.join(os.path.dirname(sys.argv[1]), projects[project][2])
153
+ )
154
+
155
+ pretty = pretty_vcproj
156
+ argv = [
157
+ "",
158
+ project_path,
159
+ "$(SolutionDir)=%s\\" % os.path.dirname(sys.argv[1]),
160
+ ]
161
+ argv.extend(sys.argv[3:])
162
+ pretty.main(argv)
163
+
164
+
165
+ def main():
166
+ # check if we have exactly 1 parameter.
167
+ if len(sys.argv) < 2:
168
+ print('Usage: %s "c:\\path\\to\\project.sln"' % sys.argv[0])
169
+ return 1
170
+
171
+ (projects, deps) = ParseSolution(sys.argv[1])
172
+ PrintDependencies(projects, deps)
173
+ PrintBuildOrder(projects, deps)
174
+
175
+ if "--recursive" in sys.argv:
176
+ PrintVCProj(projects)
177
+ return 0
178
+
179
+
180
+ if __name__ == "__main__":
181
+ sys.exit(main())
@@ -0,0 +1,339 @@
1
+ #!/usr/bin/env python3
2
+
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
5
+ # found in the LICENSE file.
6
+
7
+ """Make the format of a vcproj really pretty.
8
+
9
+ This script normalize and sort an xml. It also fetches all the properties
10
+ inside linked vsprops and include them explicitly in the vcproj.
11
+
12
+ It outputs the resulting xml to stdout.
13
+ """
14
+
15
+
16
+ import os
17
+ import sys
18
+
19
+ from xml.dom.minidom import parse
20
+ from xml.dom.minidom import Node
21
+
22
+ __author__ = "nsylvain (Nicolas Sylvain)"
23
+ ARGUMENTS = None
24
+ REPLACEMENTS = dict()
25
+
26
+
27
+ def cmp(x, y):
28
+ return (x > y) - (x < y)
29
+
30
+
31
+ class CmpTuple:
32
+ """Compare function between 2 tuple."""
33
+
34
+ def __call__(self, x, y):
35
+ return cmp(x[0], y[0])
36
+
37
+
38
+ class CmpNode:
39
+ """Compare function between 2 xml nodes."""
40
+
41
+ def __call__(self, x, y):
42
+ def get_string(node):
43
+ node_string = "node"
44
+ node_string += node.nodeName
45
+ if node.nodeValue:
46
+ node_string += node.nodeValue
47
+
48
+ if node.attributes:
49
+ # We first sort by name, if present.
50
+ node_string += node.getAttribute("Name")
51
+
52
+ all_nodes = []
53
+ for (name, value) in node.attributes.items():
54
+ all_nodes.append((name, value))
55
+
56
+ all_nodes.sort(CmpTuple())
57
+ for (name, value) in all_nodes:
58
+ node_string += name
59
+ node_string += value
60
+
61
+ return node_string
62
+
63
+ return cmp(get_string(x), get_string(y))
64
+
65
+
66
+ def PrettyPrintNode(node, indent=0):
67
+ if node.nodeType == Node.TEXT_NODE:
68
+ if node.data.strip():
69
+ print("{}{}".format(" " * indent, node.data.strip()))
70
+ return
71
+
72
+ if node.childNodes:
73
+ node.normalize()
74
+ # Get the number of attributes
75
+ attr_count = 0
76
+ if node.attributes:
77
+ attr_count = node.attributes.length
78
+
79
+ # Print the main tag
80
+ if attr_count == 0:
81
+ print("{}<{}>".format(" " * indent, node.nodeName))
82
+ else:
83
+ print("{}<{}".format(" " * indent, node.nodeName))
84
+
85
+ all_attributes = []
86
+ for (name, value) in node.attributes.items():
87
+ all_attributes.append((name, value))
88
+ all_attributes.sort(CmpTuple())
89
+ for (name, value) in all_attributes:
90
+ print('{} {}="{}"'.format(" " * indent, name, value))
91
+ print("%s>" % (" " * indent))
92
+ if node.nodeValue:
93
+ print("{} {}".format(" " * indent, node.nodeValue))
94
+
95
+ for sub_node in node.childNodes:
96
+ PrettyPrintNode(sub_node, indent=indent + 2)
97
+ print("{}</{}>".format(" " * indent, node.nodeName))
98
+
99
+
100
+ def FlattenFilter(node):
101
+ """Returns a list of all the node and sub nodes."""
102
+ node_list = []
103
+
104
+ if node.attributes and node.getAttribute("Name") == "_excluded_files":
105
+ # We don't add the "_excluded_files" filter.
106
+ return []
107
+
108
+ for current in node.childNodes:
109
+ if current.nodeName == "Filter":
110
+ node_list.extend(FlattenFilter(current))
111
+ else:
112
+ node_list.append(current)
113
+
114
+ return node_list
115
+
116
+
117
+ def FixFilenames(filenames, current_directory):
118
+ new_list = []
119
+ for filename in filenames:
120
+ if filename:
121
+ for key in REPLACEMENTS:
122
+ filename = filename.replace(key, REPLACEMENTS[key])
123
+ os.chdir(current_directory)
124
+ filename = filename.strip("\"' ")
125
+ if filename.startswith("$"):
126
+ new_list.append(filename)
127
+ else:
128
+ new_list.append(os.path.abspath(filename))
129
+ return new_list
130
+
131
+
132
+ def AbsoluteNode(node):
133
+ """Makes all the properties we know about in this node absolute."""
134
+ if node.attributes:
135
+ for (name, value) in node.attributes.items():
136
+ if name in [
137
+ "InheritedPropertySheets",
138
+ "RelativePath",
139
+ "AdditionalIncludeDirectories",
140
+ "IntermediateDirectory",
141
+ "OutputDirectory",
142
+ "AdditionalLibraryDirectories",
143
+ ]:
144
+ # We want to fix up these paths
145
+ path_list = value.split(";")
146
+ new_list = FixFilenames(path_list, os.path.dirname(ARGUMENTS[1]))
147
+ node.setAttribute(name, ";".join(new_list))
148
+ if not value:
149
+ node.removeAttribute(name)
150
+
151
+
152
+ def CleanupVcproj(node):
153
+ """For each sub node, we call recursively this function."""
154
+ for sub_node in node.childNodes:
155
+ AbsoluteNode(sub_node)
156
+ CleanupVcproj(sub_node)
157
+
158
+ # Normalize the node, and remove all extraneous whitespaces.
159
+ for sub_node in node.childNodes:
160
+ if sub_node.nodeType == Node.TEXT_NODE:
161
+ sub_node.data = sub_node.data.replace("\r", "")
162
+ sub_node.data = sub_node.data.replace("\n", "")
163
+ sub_node.data = sub_node.data.rstrip()
164
+
165
+ # Fix all the semicolon separated attributes to be sorted, and we also
166
+ # remove the dups.
167
+ if node.attributes:
168
+ for (name, value) in node.attributes.items():
169
+ sorted_list = sorted(value.split(";"))
170
+ unique_list = []
171
+ for i in sorted_list:
172
+ if not unique_list.count(i):
173
+ unique_list.append(i)
174
+ node.setAttribute(name, ";".join(unique_list))
175
+ if not value:
176
+ node.removeAttribute(name)
177
+
178
+ if node.childNodes:
179
+ node.normalize()
180
+
181
+ # For each node, take a copy, and remove it from the list.
182
+ node_array = []
183
+ while node.childNodes and node.childNodes[0]:
184
+ # Take a copy of the node and remove it from the list.
185
+ current = node.childNodes[0]
186
+ node.removeChild(current)
187
+
188
+ # If the child is a filter, we want to append all its children
189
+ # to this same list.
190
+ if current.nodeName == "Filter":
191
+ node_array.extend(FlattenFilter(current))
192
+ else:
193
+ node_array.append(current)
194
+
195
+ # Sort the list.
196
+ node_array.sort(CmpNode())
197
+
198
+ # Insert the nodes in the correct order.
199
+ for new_node in node_array:
200
+ # But don't append empty tool node.
201
+ if new_node.nodeName == "Tool":
202
+ if new_node.attributes and new_node.attributes.length == 1:
203
+ # This one was empty.
204
+ continue
205
+ if new_node.nodeName == "UserMacro":
206
+ continue
207
+ node.appendChild(new_node)
208
+
209
+
210
+ def GetConfiguationNodes(vcproj):
211
+ # TODO(nsylvain): Find a better way to navigate the xml.
212
+ nodes = []
213
+ for node in vcproj.childNodes:
214
+ if node.nodeName == "Configurations":
215
+ for sub_node in node.childNodes:
216
+ if sub_node.nodeName == "Configuration":
217
+ nodes.append(sub_node)
218
+
219
+ return nodes
220
+
221
+
222
+ def GetChildrenVsprops(filename):
223
+ dom = parse(filename)
224
+ if dom.documentElement.attributes:
225
+ vsprops = dom.documentElement.getAttribute("InheritedPropertySheets")
226
+ return FixFilenames(vsprops.split(";"), os.path.dirname(filename))
227
+ return []
228
+
229
+
230
+ def SeekToNode(node1, child2):
231
+ # A text node does not have properties.
232
+ if child2.nodeType == Node.TEXT_NODE:
233
+ return None
234
+
235
+ # Get the name of the current node.
236
+ current_name = child2.getAttribute("Name")
237
+ if not current_name:
238
+ # There is no name. We don't know how to merge.
239
+ return None
240
+
241
+ # Look through all the nodes to find a match.
242
+ for sub_node in node1.childNodes:
243
+ if sub_node.nodeName == child2.nodeName:
244
+ name = sub_node.getAttribute("Name")
245
+ if name == current_name:
246
+ return sub_node
247
+
248
+ # No match. We give up.
249
+ return None
250
+
251
+
252
+ def MergeAttributes(node1, node2):
253
+ # No attributes to merge?
254
+ if not node2.attributes:
255
+ return
256
+
257
+ for (name, value2) in node2.attributes.items():
258
+ # Don't merge the 'Name' attribute.
259
+ if name == "Name":
260
+ continue
261
+ value1 = node1.getAttribute(name)
262
+ if value1:
263
+ # The attribute exist in the main node. If it's equal, we leave it
264
+ # untouched, otherwise we concatenate it.
265
+ if value1 != value2:
266
+ node1.setAttribute(name, ";".join([value1, value2]))
267
+ else:
268
+ # The attribute does not exist in the main node. We append this one.
269
+ node1.setAttribute(name, value2)
270
+
271
+ # If the attribute was a property sheet attributes, we remove it, since
272
+ # they are useless.
273
+ if name == "InheritedPropertySheets":
274
+ node1.removeAttribute(name)
275
+
276
+
277
+ def MergeProperties(node1, node2):
278
+ MergeAttributes(node1, node2)
279
+ for child2 in node2.childNodes:
280
+ child1 = SeekToNode(node1, child2)
281
+ if child1:
282
+ MergeProperties(child1, child2)
283
+ else:
284
+ node1.appendChild(child2.cloneNode(True))
285
+
286
+
287
+ def main(argv):
288
+ """Main function of this vcproj prettifier."""
289
+ global ARGUMENTS
290
+ ARGUMENTS = argv
291
+
292
+ # check if we have exactly 1 parameter.
293
+ if len(argv) < 2:
294
+ print(
295
+ 'Usage: %s "c:\\path\\to\\vcproj.vcproj" [key1=value1] '
296
+ "[key2=value2]" % argv[0]
297
+ )
298
+ return 1
299
+
300
+ # Parse the keys
301
+ for i in range(2, len(argv)):
302
+ (key, value) = argv[i].split("=")
303
+ REPLACEMENTS[key] = value
304
+
305
+ # Open the vcproj and parse the xml.
306
+ dom = parse(argv[1])
307
+
308
+ # First thing we need to do is find the Configuration Node and merge them
309
+ # with the vsprops they include.
310
+ for configuration_node in GetConfiguationNodes(dom.documentElement):
311
+ # Get the property sheets associated with this configuration.
312
+ vsprops = configuration_node.getAttribute("InheritedPropertySheets")
313
+
314
+ # Fix the filenames to be absolute.
315
+ vsprops_list = FixFilenames(
316
+ vsprops.strip().split(";"), os.path.dirname(argv[1])
317
+ )
318
+
319
+ # Extend the list of vsprops with all vsprops contained in the current
320
+ # vsprops.
321
+ for current_vsprops in vsprops_list:
322
+ vsprops_list.extend(GetChildrenVsprops(current_vsprops))
323
+
324
+ # Now that we have all the vsprops, we need to merge them.
325
+ for current_vsprops in vsprops_list:
326
+ MergeProperties(configuration_node, parse(current_vsprops).documentElement)
327
+
328
+ # Now that everything is merged, we need to cleanup the xml.
329
+ CleanupVcproj(dom.documentElement)
330
+
331
+ # Finally, we use the prett xml function to print the vcproj back to the
332
+ # user.
333
+ # print dom.toprettyxml(newl="\n")
334
+ PrettyPrintNode(dom.documentElement)
335
+ return 0
336
+
337
+
338
+ if __name__ == "__main__":
339
+ sys.exit(main(sys.argv))
@@ -0,0 +1,31 @@
1
+ import sys
2
+ import locale
3
+
4
+ try:
5
+ reload(sys)
6
+ except NameError: # Python 3
7
+ pass
8
+
9
+
10
+ def main():
11
+ encoding = locale.getdefaultlocale()[1]
12
+ if not encoding:
13
+ return False
14
+
15
+ try:
16
+ sys.setdefaultencoding(encoding)
17
+ except AttributeError: # Python 3
18
+ pass
19
+
20
+ textmap = {
21
+ "cp936": "\u4e2d\u6587",
22
+ "cp1252": "Lat\u012Bna",
23
+ "cp932": "\u306b\u307b\u3093\u3054",
24
+ }
25
+ if encoding in textmap:
26
+ print(textmap[encoding])
27
+ return True
28
+
29
+
30
+ if __name__ == "__main__":
31
+ print(main())
@@ -0,0 +1,46 @@
1
+ #!/usr/bin/env python3
2
+
3
+ import argparse
4
+ import os
5
+ import shutil
6
+ import subprocess
7
+ import tarfile
8
+ import tempfile
9
+ import urllib.request
10
+
11
+ BASE_URL = "https://github.com/nodejs/gyp-next/archive/"
12
+ CHECKOUT_PATH = os.path.dirname(os.path.realpath(__file__))
13
+ CHECKOUT_GYP_PATH = os.path.join(CHECKOUT_PATH, "gyp")
14
+
15
+ parser = argparse.ArgumentParser()
16
+ parser.add_argument("tag", help="gyp tag to update to")
17
+ args = parser.parse_args()
18
+
19
+ tar_url = BASE_URL + args.tag + ".tar.gz"
20
+
21
+ changed_files = subprocess.check_output(["git", "diff", "--name-only"]).strip()
22
+ if changed_files:
23
+ raise Exception("Can't update gyp while you have uncommitted changes in node-gyp")
24
+
25
+ with tempfile.TemporaryDirectory() as tmp_dir:
26
+ tar_file = os.path.join(tmp_dir, "gyp.tar.gz")
27
+ unzip_target = os.path.join(tmp_dir, "gyp")
28
+ with open(tar_file, "wb") as f:
29
+ print("Downloading gyp-next@" + args.tag + " into temporary directory...")
30
+ print("From: " + tar_url)
31
+ with urllib.request.urlopen(tar_url) as in_file:
32
+ f.write(in_file.read())
33
+
34
+ print("Unzipping...")
35
+ with tarfile.open(tar_file, "r:gz") as tar_ref:
36
+ tar_ref.extractall(unzip_target)
37
+
38
+ print("Moving to current checkout (" + CHECKOUT_PATH + ")...")
39
+ if os.path.exists(CHECKOUT_GYP_PATH):
40
+ shutil.rmtree(CHECKOUT_GYP_PATH)
41
+ shutil.move(
42
+ os.path.join(unzip_target, os.listdir(unzip_target)[0]), CHECKOUT_GYP_PATH
43
+ )
44
+
45
+ subprocess.check_output(["git", "add", "gyp"], cwd=CHECKOUT_PATH)
46
+ subprocess.check_output(["git", "commit", "-m", "feat(gyp): update gyp to " + args.tag])