Commit b6595ee9 authored by Hilko Bengen's avatar Hilko Bengen

Merge tag 'upstream/20190116' into debian/master

Upstream version 20190116
parents 4905078b f90d07a7
......@@ -26,7 +26,7 @@ jobs=1
# List of plugins (as comma separated values of python modules names) to load,
# usually to register additional checkers.
load-plugins=
load-plugins=pylint.extensions.docparams
# Pickle collected data for later comparisons.
persistent=yes
......@@ -67,6 +67,7 @@ disable=
useless-suppression,
deprecated-pragma,
no-absolute-import,
missing-param-doc,
metaclass-assignment,
eq-without-hash,
fixme,
......
language: python
virtualenv:
system_site_packages: true
matrix:
include:
- env: TARGET="pylint"
......@@ -8,35 +5,95 @@ matrix:
dist: trusty
sudo: required
group: edge
language: python
python: 2.7
virtualenv:
system_site_packages: true
- env: TARGET="linux-python27"
os: linux
dist: trusty
dist: xenial
sudo: required
group: edge
language: python
python: 2.7
- env: TARGET="linux-python34"
virtualenv:
system_site_packages: true
- env: TARGET="linux-python35"
os: linux
dist: trusty
dist: xenial
sudo: required
group: edge
python: 3.4
language: python
python: 3.5
virtualenv:
system_site_packages: true
- env: [TARGET="linux-python27-tox", TOXENV="py27"]
os: linux
dist: trusty
dist: xenial
sudo: required
group: edge
language: python
python: 2.7
virtualenv:
system_site_packages: false
- env: [TARGET="linux-python34-tox", TOXENV="py34"]
os: linux
dist: trusty
dist: xenial
sudo: required
group: edge
language: python
python: 3.4
virtualenv:
system_site_packages: false
- env: [TARGET="linux-python35-tox", TOXENV="py35"]
os: linux
dist: xenial
sudo: required
group: edge
language: python
python: 3.5
virtualenv:
system_site_packages: false
- env: [TARGET="linux-python36-tox", TOXENV="py36"]
os: linux
dist: xenial
sudo: required
group: edge
language: python
python: 3.6
virtualenv:
system_site_packages: false
- env: [TARGET="linux-python37-tox", TOXENV="py37"]
os: linux
dist: xenial
sudo: required
group: edge
language: python
python: 3.7
virtualenv:
system_site_packages: false
- env: [TARGET="macos-python27", PYTHONPATH="/Library/Python/2.7/site-packages/"]
os: osx
osx_image: xcode9.2
language: generic
- env: TARGET="trusty-python27"
os: linux
dist: trusty
sudo: required
group: edge
language: python
python: 2.7
virtualenv:
system_site_packages: true
- env: TARGET="trusty-python34"
os: linux
dist: trusty
sudo: required
group: edge
language: python
python: 3.4
virtualenv:
system_site_packages: true
install:
- ./config/travis/install.sh
script:
......
environment:
matrix:
- TARGET: python27
- TARGET: windows_python27
MACHINE_TYPE: "x86"
PYTHON: "C:\\Python27"
- TARGET: python27
- TARGET: windows_python27
MACHINE_TYPE: "amd64"
PYTHON: "C:\\Python27-x64"
- TARGET: python36
- TARGET: windows_python36
MACHINE_TYPE: "x86"
PYTHON: "C:\\Python36"
- TARGET: python36
- TARGET: windows_python36
MACHINE_TYPE: "amd64"
PYTHON: "C:\\Python36-x64"
......@@ -19,16 +19,16 @@ install:
- cmd: "%PYTHON%\\python.exe -m pip install pywin32 WMI"
- cmd: "%PYTHON%\\python.exe %PYTHON%\\Scripts\\pywin32_postinstall.py -install"
- cmd: git clone https://github.com/log2timeline/l2tdevtools.git ..\l2tdevtools
- cmd: if [%TARGET%]==[python27] (
- cmd: if [%TARGET%]==[windows_python27] (
mkdir dependencies &&
set PYTHONPATH=..\l2tdevtools &&
"%PYTHON%\\python.exe" ..\l2tdevtools\tools\update.py --download-directory dependencies --machine-type %MACHINE_TYPE% --msi-targetdir "%PYTHON%" --track dev funcsigs mock pbr six )
- cmd: if [%TARGET%]==[python36] (
- cmd: if [%TARGET%]==[windows_python36] (
mkdir dependencies &&
set PYTHONPATH=..\l2tdevtools &&
"%PYTHON%\\python.exe" ..\l2tdevtools\tools\update.py --download-directory dependencies --machine-type %MACHINE_TYPE% --msi-targetdir "%PYTHON%" --track dev funcsigs mock pbr six )
"%PYTHON%\\python.exe" ..\l2tdevtools\tools\update.py --download-directory dependencies --machine-type %MACHINE_TYPE% --msi-targetdir "%PYTHON%" --track dev mock pbr six )
build: off
test_script:
- "%PYTHON%\\python.exe run_tests.py"
- cmd: "%PYTHON%\\python.exe run_tests.py"
dfdatetime (20181025-1) unstable; urgency=low
dfdatetime (20190116-1) unstable; urgency=low
* Auto-generated
-- Log2Timeline maintainers <log2timeline-maintainers@googlegroups.com> Thu, 25 Oct 2018 12:44:52 -0700
\ No newline at end of file
-- Log2Timeline maintainers <log2timeline-maintainers@googlegroups.com> Wed, 16 Jan 2019 20:40:11 +0100
\ No newline at end of file
argparse
args
bool
config
deciseconds
dev
dfdatetime
dfvfs
divmod
dpkg
filenames
floatingtime
hfs
hfsx
hh
hhmm
hhmmss
macos
msi
nano
plaso
pre
precisions
py
rc
readfp
sdist
ss
stdin
str
struct
sys
timegm
timestamp
tuple
utc
util
......@@ -11,11 +11,11 @@ L2TBINARIES_TEST_DEPENDENCIES="funcsigs mock pbr six";
PYTHON2_DEPENDENCIES="";
PYTHON2_TEST_DEPENDENCIES="python-coverage python-mock python-tox";
PYTHON2_TEST_DEPENDENCIES="python-coverage python-funcsigs python-mock python-pbr python-six python-tox";
PYTHON3_DEPENDENCIES="";
PYTHON3_TEST_DEPENDENCIES="python3-mock python3-setuptools python3-tox";
PYTHON3_TEST_DEPENDENCIES="python3-mock python3-pbr python3-setuptools python3-six python3-tox";
# Exit on error.
set -e;
......@@ -46,6 +46,14 @@ elif test ${TRAVIS_OS_NAME} = "linux" && test ${TARGET} != "jenkins";
then
sudo rm -f /etc/apt/sources.list.d/travis_ci_zeromq3-source.list;
if test ${TARGET} = "pylint";
then
if test ${TRAVIS_PYTHON_VERSION} = "2.7";
then
sudo add-apt-repository ppa:gift/pylint2 -y;
fi
fi
sudo add-apt-repository ppa:gift/dev -y;
sudo apt-get update -q;
......
......@@ -40,33 +40,41 @@ then
elif test "${TRAVIS_OS_NAME}" = "linux";
then
COVERAGE="/usr/bin/coverage";
if ! test -x "${COVERAGE}";
then
# Ubuntu has renamed coverage.
COVERAGE="/usr/bin/python-coverage";
fi
if test -n "${TOXENV}";
then
tox --sitepackages ${TOXENV};
elif test "${TRAVIS_PYTHON_VERSION}" = "2.7";
then
coverage erase
coverage run --source=dfdatetime --omit="*_test*,*__init__*,*test_lib*" ./run_tests.py
${COVERAGE} erase
${COVERAGE} run --source=dfdatetime --omit="*_test*,*__init__*,*test_lib*" ./run_tests.py
else
python ./run_tests.py
fi
python ./setup.py build
python ./setup.py build
python ./setup.py sdist
python ./setup.py sdist
python ./setup.py bdist
python ./setup.py bdist
TMPDIR="${PWD}/tmp";
TMPSITEPACKAGES="${TMPDIR}/lib/python${TRAVIS_PYTHON_VERSION}/site-packages";
TMPDIR="${PWD}/tmp";
TMPSITEPACKAGES="${TMPDIR}/lib/python${TRAVIS_PYTHON_VERSION}/site-packages";
mkdir -p ${TMPSITEPACKAGES};
mkdir -p ${TMPSITEPACKAGES};
PYTHONPATH=${TMPSITEPACKAGES} python ./setup.py install --prefix=${TMPDIR};
PYTHONPATH=${TMPSITEPACKAGES} python ./setup.py install --prefix=${TMPDIR};
if test -f tests/end-to-end.py;
then
PYTHONPATH=. python ./tests/end-to-end.py --debug -c config/end-to-end.ini;
if test -f tests/end-to-end.py;
then
PYTHONPATH=. python ./tests/end-to-end.py --debug -c config/end-to-end.ini;
fi
fi
fi
......@@ -5,4 +5,4 @@ dfDateTime, or Digital Forensics date and time, provides date and time
objects to preserve accuracy and precision.
"""
__version__ = '20181025'
__version__ = '20190116'
......@@ -48,6 +48,9 @@ class APFSTime(posix_time.PosixTimeInNanoseconds):
fraction can be either 3 or 6 digits. The time of day, seconds
fraction and time zone offset are optional. The default time zone
is UTC.
Raises:
ValueError: if the date and time value is not supported.
"""
super(APFSTime, self)._CopyFromDateTimeString(time_string)
......
......@@ -50,6 +50,8 @@ class DateTimeValues(object):
is_local_time (bool): True if the date and time value is in local time.
"""
# pylint: disable=redundant-returns-doc
_DAYS_PER_MONTH = (31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)
_EPOCH_NORMALIZED_TIME = NormalizedTimeEpoch()
......@@ -124,7 +126,7 @@ class DateTimeValues(object):
if normalized_timestamp is None:
return other_normalized_timestamp is None
elif other_normalized_timestamp is None:
if other_normalized_timestamp is None:
return True
return normalized_timestamp >= other_normalized_timestamp
......@@ -150,7 +152,7 @@ class DateTimeValues(object):
if normalized_timestamp is None:
return False
elif other_normalized_timestamp is None:
if other_normalized_timestamp is None:
return True
return normalized_timestamp > other_normalized_timestamp
......@@ -176,7 +178,7 @@ class DateTimeValues(object):
if normalized_timestamp is None:
return True
elif other_normalized_timestamp is None:
if other_normalized_timestamp is None:
return False
return normalized_timestamp <= other_normalized_timestamp
......@@ -202,7 +204,7 @@ class DateTimeValues(object):
if normalized_timestamp is None:
return other_normalized_timestamp is not None
elif other_normalized_timestamp is None:
if other_normalized_timestamp is None:
return False
return normalized_timestamp < other_normalized_timestamp
......@@ -618,6 +620,11 @@ class DateTimeValues(object):
days_per_month = self._GetDaysPerMonth(year, month)
number_of_days = days_per_month - number_of_days
elif number_of_days == 0:
number_of_days = 31
month = 12
year -= 1
return year, month, number_of_days
def _GetDateValuesWithEpoch(self, number_of_days, date_time_epoch):
......
......@@ -17,6 +17,8 @@ class DateTimePrecisionHelper(object):
values between different precisions.
"""
# pylint: disable=missing-raises-doc,redundant-returns-doc
@classmethod
def CopyMicrosecondsToFractionOfSecond(cls, microseconds):
"""Copies the number of microseconds to a fraction of second value.
......
......@@ -43,6 +43,8 @@ class RFC2579DateTime(interface.DateTimeValues):
# TODO: make attributes read-only.
# pylint: disable=missing-type-doc
def __init__(self, rfc2579_date_time_tuple=None):
"""Initializes a RFC2579 date-time.
......
......@@ -16,6 +16,8 @@ class SemanticTime(interface.DateTimeValues):
is_local_time (bool): True if the date and time value is in local time.
"""
# pylint: disable=redundant-returns-doc
_SORT_ORDER = 50
def __init__(self, string=None):
......
[metadata]
license_file = LICENSE
[bdist_rpm]
release = 1
packager = Log2Timeline maintainers <log2timeline-maintainers@googlegroups.com>
......@@ -6,3 +9,7 @@ doc_files = ACKNOWLEDGEMENTS
LICENSE
README
build_requires = python-setuptools
[bdist_wheel]
universal = 1
......@@ -124,20 +124,20 @@ else:
if python_package == 'python3':
lines.extend([
'%{python3_sitelib}/**/*.py',
'%{python3_sitelib}/dfdatetime/*.py',
'%{python3_sitelib}/dfdatetime*.egg-info/*',
'',
'%exclude %{_prefix}/share/doc/*',
'%exclude %{python3_sitelib}/**/__pycache__/*'])
'%exclude %{python3_sitelib}/dfdatetime/__pycache__/*'])
else:
lines.extend([
'%{python2_sitelib}/**/*.py',
'%{python2_sitelib}/dfdatetime/*.py',
'%{python2_sitelib}/dfdatetime*.egg-info/*',
'',
'%exclude %{_prefix}/share/doc/*',
'%exclude %{python2_sitelib}/**/*.pyc',
'%exclude %{python2_sitelib}/**/*.pyo'])
'%exclude %{python2_sitelib}/dfdatetime/*.pyc',
'%exclude %{python2_sitelib}/dfdatetime/*.pyo'])
python_spec_file.extend(lines)
break
......
[funcsigs]
dpkg_name: python-funcsigs
minimum_version: 1.0.2
python2_only: true
rpm_name: python2-funcsigs
version_property: __version__
[mock]
dpkg_name: python-mock
minimum_version: 2.0.0
rpm_name: python2-mock
version_property: __version__
[pbr]
dpkg_name: python-pbr
minimum_version: 4.2.0
rpm_name: python2-pbr
[six]
dpkg_name: python-six
minimum_version: 1.1.0
rpm_name: python2-six
version_property: __version__
......@@ -22,7 +22,7 @@ class DelphiDateTimeEpochTest(unittest.TestCase):
class DelphiDateTimeInvalidYear(delphi_date_time.DelphiDateTime):
"""Delphi TDateTime timestamp for testing invalid year."""
def _CopyDateTimeFromString(self, unused_time_string):
def _CopyDateTimeFromString(self, time_string):
"""Copies a date and time from a string.
Args:
......
......@@ -12,7 +12,7 @@ from dfdatetime import interface
class EmptyDateTimeValues(interface.DateTimeValues):
"""Empty date time values for testing."""
# pylint: disable=abstract-method
# pylint: disable=abstract-method,redundant-returns-doc
def _GetNormalizedTimestamp(self):
"""Retrieves the normalized timestamp.
......@@ -20,7 +20,7 @@ class EmptyDateTimeValues(interface.DateTimeValues):
Returns:
float: normalized timestamp, which is None for testing purposes.
"""
return
return None
class TestDateTimeValues(interface.DateTimeValues):
......@@ -433,6 +433,27 @@ class DateTimeValuesTest(unittest.TestCase):
self.assertEqual(month, 12)
self.assertEqual(day_of_month, 28)
year, month, day_of_month = date_time_values._GetDateValues(0, 1970, 1, 1)
self.assertEqual(year, 1970)
self.assertEqual(month, 1)
self.assertEqual(day_of_month, 1)
year, month, day_of_month = date_time_values._GetDateValues(-1, 1970, 1, 1)
self.assertEqual(year, 1969)
self.assertEqual(month, 12)
self.assertEqual(day_of_month, 31)
year, month, day_of_month = date_time_values._GetDateValues(364, 1970, 1, 1)
self.assertEqual(year, 1970)
self.assertEqual(month, 12)
self.assertEqual(day_of_month, 31)
year, month, day_of_month = date_time_values._GetDateValues(
1460, 1970, 1, 1)
self.assertEqual(year, 1973)
self.assertEqual(month, 12)
self.assertEqual(day_of_month, 31)
def testGetDateValuesWithEpoch(self):
"""Tests the _GetDateValuesWithEpoch function."""
date_time_epoch = interface.DateTimeEpoch(2000, 1, 1)
......
......@@ -13,7 +13,7 @@ from dfdatetime import rfc2579_date_time
class RFC2579DateTimeInvalidYear(rfc2579_date_time.RFC2579DateTime):
"""RFC2579 date-time for testing invalid year."""
def _CopyDateTimeFromString(self, unused_time_string):
def _CopyDateTimeFromString(self, time_string):
"""Copies a date and time from a string.
Args:
......
......@@ -14,7 +14,7 @@ from tests import interface
class SemanticTimeTest(unittest.TestCase):
"""Tests for semantic time."""
# pylint: disable=protected-access
# pylint: disable=assignment-from-none,protected-access
def testComparison(self):
"""Tests the comparison functions."""
......
......@@ -6,7 +6,10 @@ pip_pre = True
setenv =
PYTHONPATH = {toxinidir}
deps =
funcsigs ; python_version < '3.0'
mock
pbr
six
pytest
-rrequirements.txt
commands =
......@@ -18,7 +21,10 @@ setenv =
PYTHONPATH = {toxinidir}
deps =
coverage
funcsigs ; python_version < '3.0'
mock
pbr
six
pytest
-rrequirements.txt
commands =
......
......@@ -13,4 +13,5 @@ import utils.dependencies # pylint: disable=wrong-import-position
if __name__ == '__main__':
dependency_helper = utils.dependencies.DependencyHelper()
dependency_helper.CheckDependencies()
if not dependency_helper.CheckDependencies():
sys.exit(1)
......@@ -312,6 +312,7 @@ class DependencyHelper(object):
result (bool): True if the Python module is available and conforms to
the minimum required version, False otherwise.
status_message (str): status message.
verbose_output (Optional[bool]): True if output should be verbose.
"""
if not result or dependency.is_optional:
if dependency.is_optional:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment