From ba300638d774ce18ff8238507293e81876714ce9 Mon Sep 17 00:00:00 2001 From: Joachim Metz Date: Sun, 14 Nov 2021 09:36:13 +0100 Subject: [PATCH] Deprecated GetStat file entry method #52 --- appveyor.yml | 14 +++++++------- config/appveyor/runtests.sh | 6 +++--- config/dpkg/changelog | 4 ++-- config/dpkg/control | 2 +- dependencies.ini | 2 +- dfvfs/__init__.py | 2 +- dfvfs/vfs/file_entry.py | 4 ++++ docs/sources/Code-snippets.md | 9 +++++---- requirements.txt | 2 +- setup.cfg | 2 +- tests/vfs/ntfs_file_entry.py | 13 ++++++------- 11 files changed, 32 insertions(+), 28 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 01fa1e78..80b01063 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,18 +1,18 @@ environment: matrix: - - DESCRIPTION: "Windows with 32-bit Python 3.9" + - DESCRIPTION: "Windows with 32-bit Python 3.10" MACHINE_TYPE: "x86" APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 - PYTHON: "C:\\Python39" - PYTHON_VERSION: "3.9" + PYTHON: "C:\\Python310" + PYTHON_VERSION: "3.10" L2TBINARIES_TRACK: "dev" - - DESCRIPTION: "Windows with 64-bit Python 3.9" + - DESCRIPTION: "Windows with 64-bit Python 3.10" MACHINE_TYPE: "amd64" APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 - PYTHON: "C:\\Python39-x64" - PYTHON_VERSION: "3.9" + PYTHON: "C:\\Python310-x64" + PYTHON_VERSION: "3.10" L2TBINARIES_TRACK: "dev" - - DESCRIPTION: "Mac OS with Python 3.9" + - DESCRIPTION: "Mac OS with Python 3.10" APPVEYOR_BUILD_WORKER_IMAGE: macos HOMEBREW_NO_INSTALL_CLEANUP: 1 diff --git a/config/appveyor/runtests.sh b/config/appveyor/runtests.sh index 068691ee..066925a1 100755 --- a/config/appveyor/runtests.sh +++ b/config/appveyor/runtests.sh @@ -6,7 +6,7 @@ export CFLAGS="-I/usr/local/include -I/usr/local/opt/openssl@1.1/include ${CFLAG export LDFLAGS="-L/usr/local/lib -L/usr/local/opt/openssl@1.1/lib ${LDFLAGS}"; export TOX_TESTENV_PASSENV="CFLAGS LDFLAGS"; -# Set the following environment variables to ensure tox can find Python 3.9. -export PATH="/usr/local/opt/python@3.9/bin:${PATH}"; +# Set the following environment variables to ensure tox can find Python 3.10. +export PATH="/usr/local/opt/python@3.10/bin:${PATH}"; -tox -e py39 +tox -e py310 diff --git a/config/dpkg/changelog b/config/dpkg/changelog index 9dfd0435..7604d805 100644 --- a/config/dpkg/changelog +++ b/config/dpkg/changelog @@ -1,5 +1,5 @@ -dfvfs (20211107-1) unstable; urgency=low +dfvfs (20211114-1) unstable; urgency=low * Auto-generated - -- Log2Timeline maintainers Sun, 07 Nov 2021 14:27:00 +0100 + -- Log2Timeline maintainers Sun, 14 Nov 2021 13:35:30 +0100 diff --git a/config/dpkg/control b/config/dpkg/control index 09014bf9..79b750e9 100644 --- a/config/dpkg/control +++ b/config/dpkg/control @@ -9,7 +9,7 @@ Homepage: https://github.com/log2timeline/dfvfs Package: python3-dfvfs Architecture: all -Depends: libbde-python3 (>= 20140531), libewf-python3 (>= 20131210), libfsapfs-python3 (>= 20201107), libfsext-python3 (>= 20210721), libfshfs-python3 (>= 20210722), libfsntfs-python3 (>= 20200921), libfsxfs-python3 (>= 20210726), libfvde-python3 (>= 20160719), libfwnt-python3 (>= 20210717), libluksde-python3 (>= 20200101), libmodi-python3 (>= 20210405), libqcow-python3 (>= 20201213), libsigscan-python3 (>= 20191221), libsmdev-python3 (>= 20140529), libsmraw-python3 (>= 20140612), libvhdi-python3 (>= 20201014), libvmdk-python3 (>= 20140421), libvsgpt-python3 (>= 20210207), libvshadow-python3 (>= 20160109), libvslvm-python3 (>= 20160109), python3-cffi-backend (>= 1.9.1), python3-cryptography (>= 2.0.2), python3-dfdatetime (>= 20210509), python3-dtfabric (>= 20170524), python3-idna (>= 2.5), python3-pytsk3 (>= 20210419), python3-pyxattr (>= 0.7.2), python3-yaml (>= 3.10), ${python3:Depends}, ${misc:Depends} +Depends: libbde-python3 (>= 20140531), libewf-python3 (>= 20131210), libfsapfs-python3 (>= 20201107), libfsext-python3 (>= 20210721), libfshfs-python3 (>= 20210722), libfsntfs-python3 (>= 20200921), libfsxfs-python3 (>= 20210726), libfvde-python3 (>= 20160719), libfwnt-python3 (>= 20210717), libluksde-python3 (>= 20200101), libmodi-python3 (>= 20210405), libqcow-python3 (>= 20201213), libsigscan-python3 (>= 20191221), libsmdev-python3 (>= 20140529), libsmraw-python3 (>= 20140612), libvhdi-python3 (>= 20201014), libvmdk-python3 (>= 20140421), libvsgpt-python3 (>= 20210207), libvshadow-python3 (>= 20160109), libvslvm-python3 (>= 20160109), python3-cffi-backend (>= 1.9.1), python3-cryptography (>= 2.0.2), python3-dfdatetime (>= 20211113), python3-dtfabric (>= 20170524), python3-idna (>= 2.5), python3-pytsk3 (>= 20210419), python3-pyxattr (>= 0.7.2), python3-yaml (>= 3.10), ${python3:Depends}, ${misc:Depends} Description: Python 3 module of dfVFS dfVFS, or Digital Forensics Virtual File System, provides read-only access to file-system objects from various storage media types and file formats. The goal diff --git a/dependencies.ini b/dependencies.ini index 676c7448..ead3d05f 100644 --- a/dependencies.ini +++ b/dependencies.ini @@ -13,7 +13,7 @@ version_property: __version__ [dfdatetime] dpkg_name: python3-dfdatetime -minimum_version: 20210509 +minimum_version: 20211113 rpm_name: python3-dfdatetime version_property: __version__ diff --git a/dfvfs/__init__.py b/dfvfs/__init__.py index b88dcb8b..0dbea0ec 100644 --- a/dfvfs/__init__.py +++ b/dfvfs/__init__.py @@ -6,4 +6,4 @@ storage media types and file formats. """ -__version__ = '20211107' +__version__ = '20211114' diff --git a/dfvfs/vfs/file_entry.py b/dfvfs/vfs/file_entry.py index 4154c4a8..57f6dacb 100644 --- a/dfvfs/vfs/file_entry.py +++ b/dfvfs/vfs/file_entry.py @@ -7,6 +7,7 @@ import abc +from dfvfs.lib import decorators from dfvfs.lib import definitions from dfvfs.resolver import resolver from dfvfs.vfs import vfs_stat @@ -417,9 +418,12 @@ def GetSubFileEntryByName(self, name, case_sensitive=True): return matching_sub_file_entry + @decorators.deprecated def GetStat(self): """Retrieves information about the file entry. + This method is deprecated use StatAttribute instead. + Returns: VFSStat: a stat object or None if not available. """ diff --git a/docs/sources/Code-snippets.md b/docs/sources/Code-snippets.md index b2403bc9..ee8526dc 100644 --- a/docs/sources/Code-snippets.md +++ b/docs/sources/Code-snippets.md @@ -71,12 +71,13 @@ for sub_file_entry in file_entry.sub_file_entries: print(sub_file_entry.name) ``` -### Retrieving an inode value +### Retrieving an inode number ```python from dfvfs.lib import definitions from dfvfs.path import factory from dfvfs.resolver import resolver +from dfvfs.vfs import attribute image_location = 'image.E01' file_location = '/Users/MyUser/AppData/Local/Microsoft/Office/15.0/OfficeFileCache/MyFile.txt' @@ -87,7 +88,7 @@ tsk_path_spec = factory.Factory.NewPathSpec(definitions.TYPE_INDICATOR_TSK, loca file_entry = resolver.Resolver.OpenFileEntry(tsk_path_spec) -stat_object = file_entry.GetStat() - -print('Inode: {0:d}'.format(stat_object.ino)) +for file_entry_attribute in file_entry.attributes: + if isinstance(file_entry_attribute, attribute.StatAttribute): + print('Inode number: {0:d}'.format(file_entry_attribute.inode_number)) ``` diff --git a/requirements.txt b/requirements.txt index 732d1fb6..d1e94b8e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,7 +2,7 @@ pip >= 7.0.0 PyYAML >= 3.10 cffi >= 1.9.1 cryptography >= 2.0.2 -dfdatetime >= 20210509 +dfdatetime >= 20211113 dtfabric >= 20170524 libbde-python >= 20140531 libewf-python >= 20131210 diff --git a/setup.cfg b/setup.cfg index 033d88b8..ba282d71 100644 --- a/setup.cfg +++ b/setup.cfg @@ -39,7 +39,7 @@ requires = libbde-python3 >= 20140531 libvslvm-python3 >= 20160109 python3-cffi >= 1.9.1 python3-cryptography >= 2.0.2 - python3-dfdatetime >= 20210509 + python3-dfdatetime >= 20211113 python3-dtfabric >= 20170524 python3-idna >= 2.5 python3-pytsk3 >= 20210419 diff --git a/tests/vfs/ntfs_file_entry.py b/tests/vfs/ntfs_file_entry.py index 05f8b490..0dcaff9c 100644 --- a/tests/vfs/ntfs_file_entry.py +++ b/tests/vfs/ntfs_file_entry.py @@ -569,10 +569,9 @@ def testAttributes(self): self.assertIsNotNone(attribute.modification_time) self.assertIsNotNone(attribute.entry_modification_time) - stat_time, stat_time_nano = ( - attribute.modification_time.CopyToStatTimeTuple()) - self.assertEqual(stat_time, 1567246979) - self.assertEqual(stat_time_nano, 9581788) + date_time_string = ( + attribute.modification_time.CopyToDateTimeStringISO8601()) + self.assertEqual(date_time_string, '2019-08-31T10:22:59.9581788+00:00') attribute = attributes[1] @@ -584,9 +583,9 @@ def testAttributes(self): self.assertIsNotNone(attribute.modification_time) self.assertIsNotNone(attribute.entry_modification_time) - stat_time, stat_time_nano = attribute.access_time.CopyToStatTimeTuple() - self.assertEqual(stat_time, 1567246979) - self.assertEqual(stat_time_nano, 9567496) + date_time_string = ( + attribute.access_time.CopyToDateTimeStringISO8601()) + self.assertEqual(date_time_string, '2019-08-31T10:22:59.9567496+00:00') attribute = attributes[2]