Skip to content

Commit

Permalink
Added _ScanSourcePathSpec to VolumeScanner helper (#692)
Browse files Browse the repository at this point in the history
  • Loading branch information
joachimmetz authored Sep 18, 2022
1 parent 244e72c commit a5b4bab
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 5 deletions.
4 changes: 2 additions & 2 deletions config/dpkg/changelog
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
dfvfs (20220831-1) unstable; urgency=low
dfvfs (20220917-1) unstable; urgency=low

* Auto-generated

-- Log2Timeline maintainers <log2timeline-maintainers@googlegroups.com> Wed, 31 Aug 2022 21:13:48 +0200
-- Log2Timeline maintainers <log2timeline-maintainers@googlegroups.com> Sat, 17 Sep 2022 18:46:00 +0200
2 changes: 1 addition & 1 deletion dfvfs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
storage media types and file formats.
"""

__version__ = '20220831'
__version__ = '20220917'
21 changes: 20 additions & 1 deletion dfvfs/helpers/volume_scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -540,8 +540,27 @@ def _ScanSource(self, source_path):
raise errors.ScannerError(
'No such device, file or directory: {0:s}.'.format(source_path))

source_path_spec = path_spec_factory.Factory.NewPathSpec(
definitions.TYPE_INDICATOR_OS, location=source_path)

return self._ScanSourcePathSpec(source_path_spec)

def _ScanSourcePathSpec(self, source_path_spec):
"""Scans the source path specification for supported formats.
Args:
source_path_spec (dfvfs.PathSpec): source path specification.
Returns:
SourceScannerContext: source scanner context.
Raises:
ScannerError: if the source path does not exists, or if the source path
is not a file or directory, or if the format of or within the source
file is not supported.
"""
scan_context = source_scanner.SourceScannerContext()
scan_context.OpenSourcePath(source_path)
scan_context.AddScanNode(source_path_spec, None)

try:
self._source_scanner.Scan(scan_context)
Expand Down
5 changes: 4 additions & 1 deletion dfvfs/resolver_helpers/resolver_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,7 @@ def NewFileSystem(self, resolver_context, path_spec):
Raises:
NotSupported: if there is no implementation to create a file system.
"""
raise errors.NotSupported('Missing implementation to create file system.')
# pylint: disable=no-member
raise errors.NotSupported(
'Missing implementation to create file system: {0:s}.'.format(
self.TYPE_INDICATOR))

0 comments on commit a5b4bab

Please sign in to comment.