@@ -15,19 +15,19 @@ class Tool:
1515def __init__ (self , name , attrs = None ):
1616"""Initializes the tool.
1717
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+ """
2222self ._attrs = attrs or {}
2323self ._attrs ["Name" ] = name
2424
2525def _GetSpecification (self ):
2626"""Creates an element for the tool.
2727
28- Returns:
29- A new xml.dom.Element for the tool.
30- """
28+ Returns:
29+ A new xml.dom.Element for the tool.
30+ """
3131return ["Tool" , self ._attrs ]
3232
3333
@@ -37,10 +37,10 @@ class Filter:
3737def __init__ (self , name , contents = None ):
3838"""Initializes the folder.
3939
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+ """
4444self .name = name
4545self .contents = list (contents or [])
4646
@@ -54,13 +54,13 @@ class Writer:
5454def __init__ (self , project_path , version , name , guid = None , platforms = None ):
5555"""Initializes the project.
5656
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+ """
6464self .project_path = project_path
6565self .version = version
6666self .name = name
@@ -84,21 +84,21 @@ def __init__(self, project_path, version, name, guid=None, platforms=None):
8484def AddToolFile (self , path ):
8585"""Adds a tool file to the project.
8686
87- Args:
88- path: Relative path from project to tool file.
89- """
87+ Args:
88+ path: Relative path from project to tool file.
89+ """
9090self .tool_files_section .append (["ToolFile" ,{"RelativePath" : path }])
9191
9292def _GetSpecForConfiguration (self , config_type , config_name , attrs , tools ):
9393"""Returns the specification for a configuration.
9494
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+ """
102102# Handle defaults
103103if not attrs :
104104attrs = {}
@@ -122,23 +122,23 @@ def _GetSpecForConfiguration(self, config_type, config_name, attrs, tools):
122122def AddConfig (self , name , attrs = None , tools = None ):
123123"""Adds a configuration to the project.
124124
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+ """
130130spec = self ._GetSpecForConfiguration ("Configuration" , name , attrs , tools )
131131self .configurations_section .append (spec )
132132
133133def _AddFilesToNode (self , parent , files ):
134134"""Adds files and/or filters to the parent node.
135135
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.
139139
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+ """
142142for f in files :
143143if isinstance (f , Filter ):
144144node = ["Filter" ,{"Name" : f .name }]
@@ -151,29 +151,29 @@ def _AddFilesToNode(self, parent, files):
151151def AddFiles (self , files ):
152152"""Adds files to the project.
153153
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.
156156
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+ """
161161self ._AddFilesToNode (self .files_section , files )
162162# TODO(rspangler) This also doesn't handle adding files to an existing
163163# filter. That is, it doesn't merge the trees.
164164
165165def AddFileConfig (self , path , config , attrs = None , tools = None ):
166166"""Adds a configuration to a file.
167167
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.
173173
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+ """
177177# Find the file node with the right relative path
178178parent = self .files_dict .get (path )
179179if not parent :
0 commit comments