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

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: . 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') | pylib/gyp/ordered_dict.py » ('J')
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 def _import_OrderedDict():
26 import collections
27 try:
28 return collections.OrderedDict
29 except AttributeError:
30 import ordered_dict
31 return ordered_dict.OrderedDict
32 OrderedDict = _import_OrderedDict()
Nico 2013/12/13 17:54:18 # TODO: Remove once bots are on 2.7, http://crbug.
scottmg 2013/12/13 17:56:29 Done.
33
25 34
26 # Regular expression for validating Visual Studio GUIDs. If the GUID 35 # Regular expression for validating Visual Studio GUIDs. If the GUID
27 # contains lowercase hex letters, MSVS will be fine. However, 36 # contains lowercase hex letters, MSVS will be fine. However,
28 # IncrediBuild BuildConsole will parse the solution file, but then 37 # IncrediBuild BuildConsole will parse the solution file, but then
29 # silently skip building the target causing hard to track down errors. 38 # silently skip building the target causing hard to track down errors.
30 # Note that this only happens with the BuildConsole, and does not occur 39 # Note that this only happens with the BuildConsole, and does not occur
31 # if IncrediBuild is executed from inside Visual Studio. This regex 40 # if IncrediBuild is executed from inside Visual Studio. This regex
32 # validates that the string looks like a GUID with all uppercase hex 41 # validates that the string looks like a GUID with all uppercase hex
33 # letters. 42 # letters.
34 VALID_MSVS_GUID_CHARS = re.compile('^[A-F0-9\-]+$') 43 VALID_MSVS_GUID_CHARS = re.compile('^[A-F0-9\-]+$')
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 For example: 222 For example:
214 _ConvertSourcesToFilterHierarchy([['a', 'bob1.c'], ['b', 'bob2.c']], 223 _ConvertSourcesToFilterHierarchy([['a', 'bob1.c'], ['b', 'bob2.c']],
215 prefix=['joe']) 224 prefix=['joe'])
216 --> 225 -->
217 [MSVSProject.Filter('a', contents=['joe\\a\\bob1.c']), 226 [MSVSProject.Filter('a', contents=['joe\\a\\bob1.c']),
218 MSVSProject.Filter('b', contents=['joe\\b\\bob2.c'])] 227 MSVSProject.Filter('b', contents=['joe\\b\\bob2.c'])]
219 """ 228 """
220 if not prefix: prefix = [] 229 if not prefix: prefix = []
221 result = [] 230 result = []
222 excluded_result = [] 231 excluded_result = []
223 folders = collections.OrderedDict() 232 folders = OrderedDict()
224 # Gather files into the final result, excluded, or folders. 233 # Gather files into the final result, excluded, or folders.
225 for s in sources: 234 for s in sources:
226 if len(s) == 1: 235 if len(s) == 1:
227 filename = _NormalizedSource('\\'.join(prefix + s)) 236 filename = _NormalizedSource('\\'.join(prefix + s))
228 if filename in excluded: 237 if filename in excluded:
229 excluded_result.append(filename) 238 excluded_result.append(filename)
230 else: 239 else:
231 result.append(filename) 240 result.append(filename)
232 else: 241 else:
233 if not folders.get(s[0]): 242 if not folders.get(s[0]):
(...skipping 3062 matching lines...) Expand 10 before | Expand all | Expand 10 after
3296 action_spec.extend( 3305 action_spec.extend(
3297 # TODO(jeanluc) 'Document' for all or just if as_sources? 3306 # TODO(jeanluc) 'Document' for all or just if as_sources?
3298 [['FileType', 'Document'], 3307 [['FileType', 'Document'],
3299 ['Command', command], 3308 ['Command', command],
3300 ['Message', description], 3309 ['Message', description],
3301 ['Outputs', outputs] 3310 ['Outputs', outputs]
3302 ]) 3311 ])
3303 if additional_inputs: 3312 if additional_inputs:
3304 action_spec.append(['AdditionalInputs', additional_inputs]) 3313 action_spec.append(['AdditionalInputs', additional_inputs])
3305 actions_spec.append(action_spec) 3314 actions_spec.append(action_spec)
OLDNEW
« no previous file with comments | « no previous file | pylib/gyp/ordered_dict.py » ('j') | pylib/gyp/ordered_dict.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698