Skip to content

Commit

Permalink
Deprecated GetStat file entry method log2timeline#52
Browse files Browse the repository at this point in the history
  • Loading branch information
joachimmetz committed Nov 14, 2021
1 parent 76c6602 commit ba30063
Show file tree
Hide file tree
Showing 11 changed files with 32 additions and 28 deletions.
14 changes: 7 additions & 7 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -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

Expand Down
6 changes: 3 additions & 3 deletions config/appveyor/runtests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions config/dpkg/changelog
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
dfvfs (20211107-1) unstable; urgency=low
dfvfs (20211114-1) unstable; urgency=low

* Auto-generated

-- Log2Timeline maintainers <log2timeline-maintainers@googlegroups.com> Sun, 07 Nov 2021 14:27:00 +0100
-- Log2Timeline maintainers <log2timeline-maintainers@googlegroups.com> Sun, 14 Nov 2021 13:35:30 +0100
2 changes: 1 addition & 1 deletion config/dpkg/control
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion dependencies.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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__

Expand Down
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__ = '20211107'
__version__ = '20211114'
4 changes: 4 additions & 0 deletions dfvfs/vfs/file_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
"""
Expand Down
9 changes: 5 additions & 4 deletions docs/sources/Code-snippets.md
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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))
```
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 6 additions & 7 deletions tests/vfs/ntfs_file_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand All @@ -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]

Expand Down

0 comments on commit ba30063

Please sign in to comment.