OLD | NEW |
---|---|
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 """New implementation of Visual Studio project generation.""" | 5 """New implementation of Visual Studio project generation.""" |
6 | 6 |
7 import os | 7 import os |
8 import random | 8 import random |
9 | 9 |
10 import gyp.common | 10 import gyp.common |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
53 d = _new_md5(str(seed) + str(name)).hexdigest().upper() | 53 d = _new_md5(str(seed) + str(name)).hexdigest().upper() |
54 # Convert most of the signature to GUID form (discard the rest) | 54 # Convert most of the signature to GUID form (discard the rest) |
55 guid = ('{' + d[:8] + '-' + d[8:12] + '-' + d[12:16] + '-' + d[16:20] | 55 guid = ('{' + d[:8] + '-' + d[8:12] + '-' + d[12:16] + '-' + d[16:20] |
56 + '-' + d[20:32] + '}') | 56 + '-' + d[20:32] + '}') |
57 return guid | 57 return guid |
58 | 58 |
59 #------------------------------------------------------------------------------ | 59 #------------------------------------------------------------------------------ |
60 | 60 |
61 | 61 |
62 class MSVSSolutionEntry(object): | 62 class MSVSSolutionEntry(object): |
63 def __cmp__(self, other): | 63 # Sort by name then guid (so things are in order on vs2008). |
64 # Sort by name then guid (so things are in order on vs2008). | 64 def __lt__(self, other): |
Nico
2016/07/29 22:22:05
This looks like an unfortunate change :-/
AWhetter
2016/11/05 23:59:49
It is really. I could make it slighty easier on th
| |
65 return cmp((self.name, self.get_guid()), (other.name, other.get_guid())) | 65 return (self.name, self.get_guid()) < (other.name, other.get_guid()) |
66 | |
67 def __gt__(self, other): | |
68 return (self.name, self.get_guid()) > (other.name, other.get_guid()) | |
69 | |
70 def __eq__(self, other): | |
71 return (self.name, self.get_guid()) == (other.name, other.get_guid()) | |
72 | |
73 def __le__(self, other): | |
74 return (self.name, self.get_guid()) <= (other.name, other.get_guid()) | |
75 | |
76 def __ge__(self, other): | |
77 return (self.name, self.get_guid()) >= (other.name, other.get_guid()) | |
78 | |
79 def __ne__(self, other): | |
80 return (self.name, self.get_guid()) != (other.name, other.get_guid()) | |
66 | 81 |
67 | 82 |
68 class MSVSFolder(MSVSSolutionEntry): | 83 class MSVSFolder(MSVSSolutionEntry): |
69 """Folder in a Visual Studio project or solution.""" | 84 """Folder in a Visual Studio project or solution.""" |
70 | 85 |
71 def __init__(self, path, name = None, entries = None, | 86 def __init__(self, path, name = None, entries = None, |
72 guid = None, items = None): | 87 guid = None, items = None): |
73 """Initializes the folder. | 88 """Initializes the folder. |
74 | 89 |
75 Args: | 90 Args: |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
331 for e in all_entries: | 346 for e in all_entries: |
332 if not isinstance(e, MSVSFolder): | 347 if not isinstance(e, MSVSFolder): |
333 continue # Does not apply to projects, only folders | 348 continue # Does not apply to projects, only folders |
334 for subentry in e.entries: | 349 for subentry in e.entries: |
335 f.write('\t\t%s = %s\r\n' % (subentry.get_guid(), e.get_guid())) | 350 f.write('\t\t%s = %s\r\n' % (subentry.get_guid(), e.get_guid())) |
336 f.write('\tEndGlobalSection\r\n') | 351 f.write('\tEndGlobalSection\r\n') |
337 | 352 |
338 f.write('EndGlobal\r\n') | 353 f.write('EndGlobal\r\n') |
339 | 354 |
340 f.close() | 355 f.close() |
OLD | NEW |