OLD | NEW |
1 # -*- coding: utf-8 -*- | 1 # -*- coding: utf-8 -*- |
2 """The processing engine.""" | 2 """The processing engine.""" |
3 | 3 |
4 import logging | 4 import logging |
5 | 5 |
6 from dfvfs.helpers import file_system_searcher | 6 from dfvfs.helpers import file_system_searcher |
7 from dfvfs.lib import errors as dfvfs_errors | 7 from dfvfs.lib import errors as dfvfs_errors |
8 from dfvfs.path import factory as path_spec_factory | 8 from dfvfs.path import factory as path_spec_factory |
9 from dfvfs.resolver import resolver as path_spec_resolver | 9 from dfvfs.resolver import resolver as path_spec_resolver |
10 | 10 |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 source_path_spec, resolver_context=resolver_context) | 140 source_path_spec, resolver_context=resolver_context) |
141 | 141 |
142 type_indicator = source_path_spec.type_indicator | 142 type_indicator = source_path_spec.type_indicator |
143 if path_spec_factory.Factory.IsSystemLevelTypeIndicator(type_indicator): | 143 if path_spec_factory.Factory.IsSystemLevelTypeIndicator(type_indicator): |
144 mount_point = source_path_spec | 144 mount_point = source_path_spec |
145 else: | 145 else: |
146 mount_point = source_path_spec.parent | 146 mount_point = source_path_spec.parent |
147 | 147 |
148 return file_system, mount_point | 148 return file_system, mount_point |
149 | 149 |
150 def PreprocessSources(self, source_path_specs, resolver_context=None): | 150 def PreprocessSources( |
| 151 self, artifacts_registry, source_path_specs, resolver_context=None): |
151 """Preprocesses the sources. | 152 """Preprocesses the sources. |
152 | 153 |
153 Args: | 154 Args: |
| 155 artifacts_registry (artifacts.ArtifactDefinitionsRegistry]): artifact |
| 156 definitions registry. |
154 source_path_specs (list[dfvfs.PathSpec]): path specifications of | 157 source_path_specs (list[dfvfs.PathSpec]): path specifications of |
155 the sources to process. | 158 the sources to process. |
156 resolver_context (Optional[dfvfs.Context]): resolver context. | 159 resolver_context (Optional[dfvfs.Context]): resolver context. |
157 """ | 160 """ |
158 platforms = [] | 161 platforms = [] |
159 for source_path_spec in source_path_specs: | 162 for source_path_spec in source_path_specs: |
160 try: | 163 try: |
161 file_system, mount_point = self.GetSourceFileSystem( | 164 file_system, mount_point = self.GetSourceFileSystem( |
162 source_path_spec, resolver_context=resolver_context) | 165 source_path_spec, resolver_context=resolver_context) |
163 except (RuntimeError, dfvfs_errors.BackEndError) as exception: | 166 except (RuntimeError, dfvfs_errors.BackEndError) as exception: |
164 logging.error(exception) | 167 logging.error(exception) |
165 continue | 168 continue |
166 | 169 |
167 try: | 170 try: |
168 searcher = file_system_searcher.FileSystemSearcher( | 171 searcher = file_system_searcher.FileSystemSearcher( |
169 file_system, mount_point) | 172 file_system, mount_point) |
170 | 173 |
171 platform = self._GuessOS(searcher) | 174 platform = self._GuessOS(searcher) |
172 if platform != definitions.OPERATING_SYSTEM_UNKNOWN: | 175 if platform != definitions.OPERATING_SYSTEM_UNKNOWN: |
173 preprocess_manager.PreprocessPluginsManager.RunPlugins( | 176 preprocess_manager.PreprocessPluginsManager.RunPlugins( |
174 file_system, mount_point, self.knowledge_base) | 177 artifacts_registry, file_system, mount_point, self.knowledge_base) |
175 | 178 |
176 platforms.append(platform) | 179 platforms.append(platform) |
177 | 180 |
178 finally: | 181 finally: |
179 file_system.Close() | 182 file_system.Close() |
180 | 183 |
181 if platforms: | 184 if platforms: |
182 logging.info(u'Preprocessing detected platforms: {0:s}'.format( | 185 logging.info(u'Preprocessing detected platforms: {0:s}'.format( |
183 u', '.join(platforms))) | 186 u', '.join(platforms))) |
184 self.knowledge_base.platform = platforms[0] | 187 self.knowledge_base.platform = platforms[0] |
185 | 188 |
186 @classmethod | 189 @classmethod |
187 def SupportsGuppyMemoryProfiling(cls): | 190 def SupportsGuppyMemoryProfiling(cls): |
188 """Determines if memory profiling with guppy is supported. | 191 """Determines if memory profiling with guppy is supported. |
189 | 192 |
190 Returns: | 193 Returns: |
191 bool: True if memory profiling with guppy is supported. | 194 bool: True if memory profiling with guppy is supported. |
192 """ | 195 """ |
193 return profiler.GuppyMemoryProfiler.IsSupported() | 196 return profiler.GuppyMemoryProfiler.IsSupported() |
OLD | NEW |