Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(341)

Side by Side Diff: pylib/gyp/generator/msvs.py

Issue 106233005: Add backported OrderedDict (Closed) Base URL: http://gyp.googlecode.com/svn/trunk
Patch Set: comments Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | pylib/gyp/ordered_dict.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2012 Google Inc. All rights reserved. 1 # Copyright (c) 2012 Google Inc. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import collections 5 import collections
6 import copy 6 import copy
7 import ntpath 7 import ntpath
8 import os 8 import os
9 import posixpath 9 import posixpath
10 import re 10 import re
11 import subprocess 11 import subprocess
12 import sys 12 import sys
13 13
14 import gyp.common 14 import gyp.common
15 import gyp.easy_xml as easy_xml 15 import gyp.easy_xml as easy_xml
16 import gyp.MSVSNew as MSVSNew 16 import gyp.MSVSNew as MSVSNew
17 import gyp.MSVSProject as MSVSProject 17 import gyp.MSVSProject as MSVSProject
18 import gyp.MSVSSettings as MSVSSettings 18 import gyp.MSVSSettings as MSVSSettings
19 import gyp.MSVSToolFile as MSVSToolFile 19 import gyp.MSVSToolFile as MSVSToolFile
20 import gyp.MSVSUserFile as MSVSUserFile 20 import gyp.MSVSUserFile as MSVSUserFile
21 import gyp.MSVSUtil as MSVSUtil 21 import gyp.MSVSUtil as MSVSUtil
22 import gyp.MSVSVersion as MSVSVersion 22 import gyp.MSVSVersion as MSVSVersion
23 from gyp.common import GypError 23 from gyp.common import GypError
24 24
25 # TODO: Remove once bots are on 2.7, http://crbug.com/241769
26 def _import_OrderedDict():
27 import collections
28 try:
29 return collections.OrderedDict
30 except AttributeError:
31 import ordered_dict
32 return ordered_dict.OrderedDict
33 OrderedDict = _import_OrderedDict()
34
25 35
26 # Regular expression for validating Visual Studio GUIDs. If the GUID 36 # Regular expression for validating Visual Studio GUIDs. If the GUID
27 # contains lowercase hex letters, MSVS will be fine. However, 37 # contains lowercase hex letters, MSVS will be fine. However,
28 # IncrediBuild BuildConsole will parse the solution file, but then 38 # IncrediBuild BuildConsole will parse the solution file, but then
29 # silently skip building the target causing hard to track down errors. 39 # silently skip building the target causing hard to track down errors.
30 # Note that this only happens with the BuildConsole, and does not occur 40 # Note that this only happens with the BuildConsole, and does not occur
31 # if IncrediBuild is executed from inside Visual Studio. This regex 41 # if IncrediBuild is executed from inside Visual Studio. This regex
32 # validates that the string looks like a GUID with all uppercase hex 42 # validates that the string looks like a GUID with all uppercase hex
33 # letters. 43 # letters.
34 VALID_MSVS_GUID_CHARS = re.compile('^[A-F0-9\-]+$') 44 VALID_MSVS_GUID_CHARS = re.compile('^[A-F0-9\-]+$')
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 For example: 223 For example:
214 _ConvertSourcesToFilterHierarchy([['a', 'bob1.c'], ['b', 'bob2.c']], 224 _ConvertSourcesToFilterHierarchy([['a', 'bob1.c'], ['b', 'bob2.c']],
215 prefix=['joe']) 225 prefix=['joe'])
216 --> 226 -->
217 [MSVSProject.Filter('a', contents=['joe\\a\\bob1.c']), 227 [MSVSProject.Filter('a', contents=['joe\\a\\bob1.c']),
218 MSVSProject.Filter('b', contents=['joe\\b\\bob2.c'])] 228 MSVSProject.Filter('b', contents=['joe\\b\\bob2.c'])]
219 """ 229 """
220 if not prefix: prefix = [] 230 if not prefix: prefix = []
221 result = [] 231 result = []
222 excluded_result = [] 232 excluded_result = []
223 folders = collections.OrderedDict() 233 folders = OrderedDict()
224 # Gather files into the final result, excluded, or folders. 234 # Gather files into the final result, excluded, or folders.
225 for s in sources: 235 for s in sources:
226 if len(s) == 1: 236 if len(s) == 1:
227 filename = _NormalizedSource('\\'.join(prefix + s)) 237 filename = _NormalizedSource('\\'.join(prefix + s))
228 if filename in excluded: 238 if filename in excluded:
229 excluded_result.append(filename) 239 excluded_result.append(filename)
230 else: 240 else:
231 result.append(filename) 241 result.append(filename)
232 else: 242 else:
233 if not folders.get(s[0]): 243 if not folders.get(s[0]):
(...skipping 3062 matching lines...) Expand 10 before | Expand all | Expand 10 after
3296 action_spec.extend( 3306 action_spec.extend(
3297 # TODO(jeanluc) 'Document' for all or just if as_sources? 3307 # TODO(jeanluc) 'Document' for all or just if as_sources?
3298 [['FileType', 'Document'], 3308 [['FileType', 'Document'],
3299 ['Command', command], 3309 ['Command', command],
3300 ['Message', description], 3310 ['Message', description],
3301 ['Outputs', outputs] 3311 ['Outputs', outputs]
3302 ]) 3312 ])
3303 if additional_inputs: 3313 if additional_inputs:
3304 action_spec.append(['AdditionalInputs', additional_inputs]) 3314 action_spec.append(['AdditionalInputs', additional_inputs])
3305 actions_spec.append(action_spec) 3315 actions_spec.append(action_spec)
OLDNEW
« no previous file with comments | « no previous file | pylib/gyp/ordered_dict.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698