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

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

Issue 739303003: Cleanup pylint errors (Closed) Base URL: http://gyp.googlecode.com/svn/trunk
Patch Set: Fix mac Created 6 years, 1 month 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 | « pylib/gyp/generator/make.py ('k') | pylib/gyp/generator/ninja.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 copy 5 import copy
6 import ntpath 6 import ntpath
7 import os 7 import os
8 import posixpath 8 import posixpath
9 import re 9 import re
10 import subprocess 10 import subprocess
(...skipping 24 matching lines...) Expand all
35 35
36 36
37 # Regular expression for validating Visual Studio GUIDs. If the GUID 37 # Regular expression for validating Visual Studio GUIDs. If the GUID
38 # contains lowercase hex letters, MSVS will be fine. However, 38 # contains lowercase hex letters, MSVS will be fine. However,
39 # IncrediBuild BuildConsole will parse the solution file, but then 39 # IncrediBuild BuildConsole will parse the solution file, but then
40 # silently skip building the target causing hard to track down errors. 40 # silently skip building the target causing hard to track down errors.
41 # Note that this only happens with the BuildConsole, and does not occur 41 # Note that this only happens with the BuildConsole, and does not occur
42 # if IncrediBuild is executed from inside Visual Studio. This regex 42 # if IncrediBuild is executed from inside Visual Studio. This regex
43 # validates that the string looks like a GUID with all uppercase hex 43 # validates that the string looks like a GUID with all uppercase hex
44 # letters. 44 # letters.
45 VALID_MSVS_GUID_CHARS = re.compile('^[A-F0-9\-]+$') 45 VALID_MSVS_GUID_CHARS = re.compile(r'^[A-F0-9\-]+$')
46 46
47 47
48 generator_default_variables = { 48 generator_default_variables = {
49 'EXECUTABLE_PREFIX': '', 49 'EXECUTABLE_PREFIX': '',
50 'EXECUTABLE_SUFFIX': '.exe', 50 'EXECUTABLE_SUFFIX': '.exe',
51 'STATIC_LIB_PREFIX': '', 51 'STATIC_LIB_PREFIX': '',
52 'SHARED_LIB_PREFIX': '', 52 'SHARED_LIB_PREFIX': '',
53 'STATIC_LIB_SUFFIX': '.lib', 53 'STATIC_LIB_SUFFIX': '.lib',
54 'SHARED_LIB_SUFFIX': '.dll', 54 'SHARED_LIB_SUFFIX': '.dll',
55 'INTERMEDIATE_DIR': '$(IntDir)', 55 'INTERMEDIATE_DIR': '$(IntDir)',
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 return ('DOMAIN', 'USERNAME') 111 return ('DOMAIN', 'USERNAME')
112 global cached_username 112 global cached_username
113 global cached_domain 113 global cached_domain
114 if not cached_domain or not cached_username: 114 if not cached_domain or not cached_username:
115 domain = os.environ.get('USERDOMAIN') 115 domain = os.environ.get('USERDOMAIN')
116 username = os.environ.get('USERNAME') 116 username = os.environ.get('USERNAME')
117 if not domain or not username: 117 if not domain or not username:
118 call = subprocess.Popen(['net', 'config', 'Workstation'], 118 call = subprocess.Popen(['net', 'config', 'Workstation'],
119 stdout=subprocess.PIPE) 119 stdout=subprocess.PIPE)
120 config = call.communicate()[0] 120 config = call.communicate()[0]
121 username_re = re.compile('^User name\s+(\S+)', re.MULTILINE) 121 username_re = re.compile(r'^User name\s+(\S+)', re.MULTILINE)
122 username_match = username_re.search(config) 122 username_match = username_re.search(config)
123 if username_match: 123 if username_match:
124 username = username_match.group(1) 124 username = username_match.group(1)
125 domain_re = re.compile('^Logon domain\s+(\S+)', re.MULTILINE) 125 domain_re = re.compile(r'^Logon domain\s+(\S+)', re.MULTILINE)
126 domain_match = domain_re.search(config) 126 domain_match = domain_re.search(config)
127 if domain_match: 127 if domain_match:
128 domain = domain_match.group(1) 128 domain = domain_match.group(1)
129 cached_domain = domain 129 cached_domain = domain
130 cached_username = username 130 cached_username = username
131 return (cached_domain, cached_username) 131 return (cached_domain, cached_username)
132 132
133 fixpath_prefix = None 133 fixpath_prefix = None
134 134
135 135
(...skipping 1093 matching lines...) Expand 10 before | Expand all | Expand 10 after
1229 The list of directory paths. 1229 The list of directory paths.
1230 """ 1230 """
1231 libraries = spec.get('libraries', []) 1231 libraries = spec.get('libraries', [])
1232 # Strip out -l, as it is not used on windows (but is needed so we can pass 1232 # Strip out -l, as it is not used on windows (but is needed so we can pass
1233 # in libraries that are assumed to be in the default library path). 1233 # in libraries that are assumed to be in the default library path).
1234 # Also remove duplicate entries, leaving only the last duplicate, while 1234 # Also remove duplicate entries, leaving only the last duplicate, while
1235 # preserving order. 1235 # preserving order.
1236 found = OrderedSet() 1236 found = OrderedSet()
1237 unique_libraries_list = [] 1237 unique_libraries_list = []
1238 for entry in reversed(libraries): 1238 for entry in reversed(libraries):
1239 library = re.sub('^\-l', '', entry) 1239 library = re.sub(r'^\-l', '', entry)
1240 if not os.path.splitext(library)[1]: 1240 if not os.path.splitext(library)[1]:
1241 library += '.lib' 1241 library += '.lib'
1242 if library not in found: 1242 if library not in found:
1243 found.add(library) 1243 found.add(library)
1244 unique_libraries_list.append(library) 1244 unique_libraries_list.append(library)
1245 unique_libraries_list.reverse() 1245 unique_libraries_list.reverse()
1246 return unique_libraries_list 1246 return unique_libraries_list
1247 1247
1248 1248
1249 def _GetOutputFilePathAndTool(spec, msbuild): 1249 def _GetOutputFilePathAndTool(spec, msbuild):
(...skipping 1602 matching lines...) Expand 10 before | Expand all | Expand 10 after
2852 if name not in properties: 2852 if name not in properties:
2853 properties[name] = {} 2853 properties[name] = {}
2854 values = properties[name] 2854 values = properties[name]
2855 if value not in values: 2855 if value not in values:
2856 values[value] = [] 2856 values[value] = []
2857 conditions = values[value] 2857 conditions = values[value]
2858 conditions.append(condition) 2858 conditions.append(condition)
2859 2859
2860 2860
2861 # Regex for msvs variable references ( i.e. $(FOO) ). 2861 # Regex for msvs variable references ( i.e. $(FOO) ).
2862 MSVS_VARIABLE_REFERENCE = re.compile('\$\(([a-zA-Z_][a-zA-Z0-9_]*)\)') 2862 MSVS_VARIABLE_REFERENCE = re.compile(r'\$\(([a-zA-Z_][a-zA-Z0-9_]*)\)')
2863 2863
2864 2864
2865 def _GetMSBuildPropertyGroup(spec, label, properties): 2865 def _GetMSBuildPropertyGroup(spec, label, properties):
2866 """Returns a PropertyGroup definition for the specified properties. 2866 """Returns a PropertyGroup definition for the specified properties.
2867 2867
2868 Arguments: 2868 Arguments:
2869 spec: The target project dict. 2869 spec: The target project dict.
2870 label: An optional label for the PropertyGroup. 2870 label: An optional label for the PropertyGroup.
2871 properties: The dictionary to be converted. The key is the name of the 2871 properties: The dictionary to be converted. The key is the name of the
2872 property. The value is itself a dictionary; its key is the value and 2872 property. The value is itself a dictionary; its key is the value and
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after
3405 action_spec.extend( 3405 action_spec.extend(
3406 # TODO(jeanluc) 'Document' for all or just if as_sources? 3406 # TODO(jeanluc) 'Document' for all or just if as_sources?
3407 [['FileType', 'Document'], 3407 [['FileType', 'Document'],
3408 ['Command', command], 3408 ['Command', command],
3409 ['Message', description], 3409 ['Message', description],
3410 ['Outputs', outputs] 3410 ['Outputs', outputs]
3411 ]) 3411 ])
3412 if additional_inputs: 3412 if additional_inputs:
3413 action_spec.append(['AdditionalInputs', additional_inputs]) 3413 action_spec.append(['AdditionalInputs', additional_inputs])
3414 actions_spec.append(action_spec) 3414 actions_spec.append(action_spec)
OLDNEW
« no previous file with comments | « pylib/gyp/generator/make.py ('k') | pylib/gyp/generator/ninja.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698