@@ -15,19 +15,19 @@ class Tool:
15
15
def __init__ (self , name , attrs = None ):
16
16
"""Initializes the tool.
17
17
18
- Args:
19
- name: Tool name.
20
- attrs: Dict of tool attributes; may be None.
21
- """
18
+ Args:
19
+ name: Tool name.
20
+ attrs: Dict of tool attributes; may be None.
21
+ """
22
22
self ._attrs = attrs or {}
23
23
self ._attrs ["Name" ] = name
24
24
25
25
def _GetSpecification (self ):
26
26
"""Creates an element for the tool.
27
27
28
- Returns:
29
- A new xml.dom.Element for the tool.
30
- """
28
+ Returns:
29
+ A new xml.dom.Element for the tool.
30
+ """
31
31
return ["Tool" , self ._attrs ]
32
32
33
33
@@ -37,10 +37,10 @@ class Filter:
37
37
def __init__ (self , name , contents = None ):
38
38
"""Initializes the folder.
39
39
40
- Args:
41
- name: Filter (folder) name.
42
- contents: List of filenames and/or Filter objects contained.
43
- """
40
+ Args:
41
+ name: Filter (folder) name.
42
+ contents: List of filenames and/or Filter objects contained.
43
+ """
44
44
self .name = name
45
45
self .contents = list (contents or [])
46
46
@@ -54,13 +54,13 @@ class Writer:
54
54
def __init__ (self , project_path , version , name , guid = None , platforms = None ):
55
55
"""Initializes the project.
56
56
57
- Args:
58
- project_path: Path to the project file.
59
- version: Format version to emit.
60
- name: Name of the project.
61
- guid: GUID to use for project, if not None.
62
- platforms: Array of string, the supported platforms. If null, ['Win32']
63
- """
57
+ Args:
58
+ project_path: Path to the project file.
59
+ version: Format version to emit.
60
+ name: Name of the project.
61
+ guid: GUID to use for project, if not None.
62
+ platforms: Array of string, the supported platforms. If null, ['Win32']
63
+ """
64
64
self .project_path = project_path
65
65
self .version = version
66
66
self .name = name
@@ -84,21 +84,21 @@ def __init__(self, project_path, version, name, guid=None, platforms=None):
84
84
def AddToolFile (self , path ):
85
85
"""Adds a tool file to the project.
86
86
87
- Args:
88
- path: Relative path from project to tool file.
89
- """
87
+ Args:
88
+ path: Relative path from project to tool file.
89
+ """
90
90
self .tool_files_section .append (["ToolFile" , {"RelativePath" : path }])
91
91
92
92
def _GetSpecForConfiguration (self , config_type , config_name , attrs , tools ):
93
93
"""Returns the specification for a configuration.
94
94
95
- Args:
96
- config_type: Type of configuration node.
97
- config_name: Configuration name.
98
- attrs: Dict of configuration attributes; may be None.
99
- tools: List of tools (strings or Tool objects); may be None.
100
- Returns:
101
- """
95
+ Args:
96
+ config_type: Type of configuration node.
97
+ config_name: Configuration name.
98
+ attrs: Dict of configuration attributes; may be None.
99
+ tools: List of tools (strings or Tool objects); may be None.
100
+ Returns:
101
+ """
102
102
# Handle defaults
103
103
if not attrs :
104
104
attrs = {}
@@ -122,23 +122,23 @@ def _GetSpecForConfiguration(self, config_type, config_name, attrs, tools):
122
122
def AddConfig (self , name , attrs = None , tools = None ):
123
123
"""Adds a configuration to the project.
124
124
125
- Args:
126
- name: Configuration name.
127
- attrs: Dict of configuration attributes; may be None.
128
- tools: List of tools (strings or Tool objects); may be None.
129
- """
125
+ Args:
126
+ name: Configuration name.
127
+ attrs: Dict of configuration attributes; may be None.
128
+ tools: List of tools (strings or Tool objects); may be None.
129
+ """
130
130
spec = self ._GetSpecForConfiguration ("Configuration" , name , attrs , tools )
131
131
self .configurations_section .append (spec )
132
132
133
133
def _AddFilesToNode (self , parent , files ):
134
134
"""Adds files and/or filters to the parent node.
135
135
136
- Args:
137
- parent: Destination node
138
- files: A list of Filter objects and/or relative paths to files.
136
+ Args:
137
+ parent: Destination node
138
+ files: A list of Filter objects and/or relative paths to files.
139
139
140
- Will call itself recursively, if the files list contains Filter objects.
141
- """
140
+ Will call itself recursively, if the files list contains Filter objects.
141
+ """
142
142
for f in files :
143
143
if isinstance (f , Filter ):
144
144
node = ["Filter" , {"Name" : f .name }]
@@ -151,29 +151,29 @@ def _AddFilesToNode(self, parent, files):
151
151
def AddFiles (self , files ):
152
152
"""Adds files to the project.
153
153
154
- Args:
155
- files: A list of Filter objects and/or relative paths to files.
154
+ Args:
155
+ files: A list of Filter objects and/or relative paths to files.
156
156
157
- This makes a copy of the file/filter tree at the time of this call. If you
158
- later add files to a Filter object which was passed into a previous call
159
- to AddFiles(), it will not be reflected in this project.
160
- """
157
+ This makes a copy of the file/filter tree at the time of this call. If you
158
+ later add files to a Filter object which was passed into a previous call
159
+ to AddFiles(), it will not be reflected in this project.
160
+ """
161
161
self ._AddFilesToNode (self .files_section , files )
162
162
# TODO(rspangler) This also doesn't handle adding files to an existing
163
163
# filter. That is, it doesn't merge the trees.
164
164
165
165
def AddFileConfig (self , path , config , attrs = None , tools = None ):
166
166
"""Adds a configuration to a file.
167
167
168
- Args:
169
- path: Relative path to the file.
170
- config: Name of configuration to add.
171
- attrs: Dict of configuration attributes; may be None.
172
- tools: List of tools (strings or Tool objects); may be None.
168
+ Args:
169
+ path: Relative path to the file.
170
+ config: Name of configuration to add.
171
+ attrs: Dict of configuration attributes; may be None.
172
+ tools: List of tools (strings or Tool objects); may be None.
173
173
174
- Raises:
175
- ValueError: Relative path does not match any file added via AddFiles().
176
- """
174
+ Raises:
175
+ ValueError: Relative path does not match any file added via AddFiles().
176
+ """
177
177
# Find the file node with the right relative path
178
178
parent = self .files_dict .get (path )
179
179
if not parent :
0 commit comments