Commit e78f3c22 authored by Hilko Bengen's avatar Hilko Bengen

New upstream version 20180501

parent 677fb8ad
language: python
virtualenv:
system_site_packages: true
matrix:
include:
- env: TARGET="pylint"
......@@ -35,11 +37,9 @@ matrix:
os: osx
osx_image: xcode9.2
language: generic
allow_failures:
- env: TARGET="linux-python34"
install:
- ./config/travis/install.sh
script:
- ./config/travis/runtests.sh
- ./config/travis/run_with_timeout.sh 30 ./config/travis/runtests.sh
after_success:
- if test ${TARGET} = "linux-python27"; then curl -o codecov.sh -s https://codecov.io/bash && /bin/bash ./codecov.sh; fi
......@@ -11,7 +11,14 @@ install:
- cmd: "%PYTHON%\\Scripts\\pip.exe install pywin32 WMI"
- cmd: "%PYTHON%\\python.exe %PYTHON%\\Scripts\\pywin32_postinstall.py -install"
- cmd: git clone https://github.com/log2timeline/l2tdevtools.git ..\l2tdevtools
- cmd: mkdir dependencies && set PYTHONPATH=..\l2tdevtools && "%PYTHON%\\python.exe" ..\l2tdevtools\tools\update.py --download-directory dependencies --machine-type x86 --msi-targetdir "%PYTHON%" --track dev funcsigs mock pbr six
- cmd: if [%TARGET%]==[python27] (
mkdir dependencies &&
set PYTHONPATH=..\l2tdevtools &&
"%PYTHON%\\python.exe" ..\l2tdevtools\tools\update.py --download-directory dependencies --machine-type x86 --msi-targetdir "%PYTHON%" --track dev funcsigs mock pbr six )
- cmd: if [%TARGET%]==[python36] (
mkdir dependencies &&
set PYTHONPATH=..\l2tdevtools &&
"%PYTHON%\\python.exe" ..\l2tdevtools\tools\update.py --download-directory dependencies --machine-type x86 --msi-targetdir "%PYTHON%" --track dev funcsigs mock pbr six )
build: off
......
dfdatetime (20180324-1) unstable; urgency=low
dfdatetime (20180501-1) unstable; urgency=low
* Auto-generated
-- Log2Timeline <log2timeline-dev@googlegroups.com> Sat, 24 Mar 2018 14:06:11 +0100
\ No newline at end of file
-- Log2Timeline <log2timeline-dev@googlegroups.com> Tue, 01 May 2018 17:49:01 +0200
\ No newline at end of file
#!/bin/bash
#
# Script to run commands on a Travis-CI test VM that otherwise would time out
# after 10 minutes. This replaces travis_wait and outputs stdout of the command
# running.
#
# This file is generated by l2tdevtools update-dependencies.py, any dependency
# related changes should be made in dependencies.ini.
# Exit on error.
set -e
# Usage: ./run_with_timeout.sh [TIMEOUT] [COMMAND] [OPTION] [...]
TIMEOUT=$1;
shift
# Launch a command in the background.
$* &
PID_COMMAND=$!;
# Probe the command every minute.
MINUTES=0;
while kill -0 ${PID_COMMAND} >/dev/null 2>&1;
do
# Print to stdout, seeing this prints a space and a backspace
# there is no visible trace.
echo -n -e " \b";
if test ${MINUTES} -ge ${TIMEOUT};
then
kill -9 ${PID_COMMAND} >/dev/null 2>&1;
echo -e "\033[0;31m[ERROR] command: $* timed out after: ${MINUTES} minute(s).\033[0m";
exit 1;
fi
MINUTES=$(( ${MINUTES} + 1 ));
sleep 60;
done
......@@ -12,7 +12,7 @@ if test "${TARGET}" = "pylint";
then
pylint --version
for FILE in `find setup.py dfdatetime tests -name \*.py`;
for FILE in `find setup.py config dfdatetime tests -name \*.py`;
do
echo "Checking: ${FILE}";
......
......@@ -5,4 +5,4 @@ dfDateTime, or Digital Forensics date and time, provides date and time
objects to preserve accuracy and precision.
"""
__version__ = '20180324'
__version__ = '20180501'
......@@ -107,11 +107,10 @@ class CocoaTime(interface.DateTimeValues):
"""Copies the Cocoa timestamp to a date and time string.
Returns:
str: date and time value formatted as:
YYYY-MM-DD hh:mm:ss.######
str: date and time value formatted as: YYYY-MM-DD hh:mm:ss.######
"""
if self._timestamp is None:
return
return None
number_of_days, hours, minutes, seconds = self._GetTimeValues(
int(self._timestamp))
......
......@@ -114,11 +114,11 @@ class DelphiDateTime(interface.DateTimeValues):
"""Copies the Delphi TDateTime timestamp to a date and time string.
Returns:
str: date and time value formatted as:
YYYY-MM-DD hh:mm:ss.######
str: date and time value formatted as: "YYYY-MM-DD hh:mm:ss.######" or
None if the timestamp is missing.
"""
if self._timestamp is None:
return
return None
number_of_seconds = self._timestamp * definitions.SECONDS_PER_DAY
......
......@@ -84,12 +84,12 @@ class FakeTime(interface.DateTimeValues):
"""Copies the fake timestamp to a date and time string.
Returns:
str: date and time value formatted as one of the following:
YYYY-MM-DD hh:mm:ss
YYYY-MM-DD hh:mm:ss.######
str: date and time value formatted as: "YYYY-MM-DD hh:mm:ss" or
"YYYY-MM-DD hh:mm:ss.######" or None if the number of seconds
is missing.
"""
if self._number_of_seconds is None:
return
return None
number_of_days, hours, minutes, seconds = self._GetTimeValues(
self._number_of_seconds)
......
......@@ -158,11 +158,11 @@ class FATDateTime(interface.DateTimeValues):
"""Copies the FAT date time to a date and time string.
Returns:
str: date and time value formatted as:
YYYY-MM-DD hh:mm:ss
str: date and time value formatted as: "YYYY-MM-DD hh:mm:ss" or None
if number of seconds is missing.
"""
if self._number_of_seconds is None:
return
return None
number_of_days, hours, minutes, seconds = self._GetTimeValues(
self._number_of_seconds)
......
......@@ -110,12 +110,12 @@ class Filetime(interface.DateTimeValues):
"""Copies the FILETIME timestamp to a date and time string.
Returns:
str: date and time value formatted as:
YYYY-MM-DD hh:mm:ss.#######
str: date and time value formatted as: "YYYY-MM-DD hh:mm:ss.#######" or
None if the timestamp is missing or invalid.
"""
if (self._timestamp is None or self._timestamp < 0 or
self._timestamp > self._UINT64_MAX):
return
return None
timestamp, remainder = divmod(self._timestamp, self._100NS_PER_SECOND)
number_of_days, hours, minutes, seconds = self._GetTimeValues(timestamp)
......
......@@ -102,12 +102,12 @@ class HFSTime(interface.DateTimeValues):
"""Copies the HFS timestamp to a date and time string.
Returns:
str: date and time value formatted as:
YYYY-MM-DD hh:mm:ss
str: date and time value formatted as: "YYYY-MM-DD hh:mm:ss" or None
if the timestamp is missing or invalid.
"""
if (self._timestamp is None or self._timestamp < 0 or
self._timestamp > self._UINT32_MAX):
return
return None
number_of_days, hours, minutes, seconds = self._GetTimeValues(
self._timestamp)
......
......@@ -77,12 +77,9 @@ class DateTimeValues(object):
Returns:
bool: True if the date time values are equal to other.
Raises:
ValueError: if other is not an instance of DateTimeValues.
"""
if not isinstance(other, DateTimeValues):
raise ValueError('Other not an instance of DateTimeValues')
return False
normalized_timestamp = self._GetNormalizedTimestamp()
other_normalized_timestamp = other._GetNormalizedTimestamp() # pylint: disable=protected-access
......@@ -207,12 +204,9 @@ class DateTimeValues(object):
Returns:
bool: True if the date time values are not equal to other.
Raises:
ValueError: if other is not an instance of DateTimeValues.
"""
if not isinstance(other, DateTimeValues):
raise ValueError('Other not an instance of DateTimeValues')
return True
normalized_timestamp = self._GetNormalizedTimestamp()
other_normalized_timestamp = other._GetNormalizedTimestamp() # pylint: disable=protected-access
......@@ -862,8 +856,7 @@ class DateTimeValues(object):
"""Copies the date time value to a date and time string.
Returns:
str: date and time value formatted as:
YYYY-MM-DD hh:mm:ss.######
str: date and time value formatted as: "YYYY-MM-DD hh:mm:ss.######"
"""
@abc.abstractmethod
......
......@@ -98,12 +98,12 @@ class JavaTime(interface.DateTimeValues):
"""Copies the Java timestamp to a date and time string.
Returns:
str: date and time value formatted as:
YYYY-MM-DD hh:mm:ss.###
str: date and time value formatted as: "YYYY-MM-DD hh:mm:ss.###" or
None if the timestamp is missing or invalid.
"""
if (self._timestamp is None or self._timestamp < self._INT64_MIN or
self._timestamp > self._INT64_MAX):
return
return None
timestamp, milliseconds = divmod(
self._timestamp, definitions.MILLISECONDS_PER_SECOND)
......
......@@ -112,11 +112,11 @@ class OLEAutomationDate(interface.DateTimeValues):
"""Copies the OLE Automation date to a date and time string.
Returns:
str: date and time value formatted as:
YYYY-MM-DD hh:mm:ss.######
str: date and time value formatted as: "YYYY-MM-DD hh:mm:ss.######" or
None if the timestamp is missing.
"""
if self._timestamp is None:
return
return None
timestamp = self._timestamp * definitions.SECONDS_PER_DAY
......
......@@ -193,11 +193,11 @@ class RFC2579DateTime(interface.DateTimeValues):
"""Copies the RFC2579 date-time to a date and time string.
Returns:
str: date and time value formatted as:
YYYY-MM-DD hh:mm:ss.#
str: date and time value formatted as: "YYYY-MM-DD hh:mm:ss.#" or
None if the number of seconds is missing.
"""
if self._number_of_seconds is None:
return
return None
return '{0:04d}-{1:02d}-{2:02d} {3:02d}:{4:02d}:{5:02d}.{6:01d}'.format(
self.year, self.month, self.day_of_month, self.hours, self.minutes,
......
......@@ -41,13 +41,7 @@ class SemanticTime(interface.DateTimeValues):
Returns:
bool: True if the date time values are equal to other.
Raises:
ValueError: if other is not an instance of DateTimeValues.
"""
if not isinstance(other, interface.DateTimeValues):
raise ValueError('Other not an instance of DateTimeValues')
if not isinstance(other, SemanticTime):
return False
......@@ -141,13 +135,7 @@ class SemanticTime(interface.DateTimeValues):
Returns:
bool: True if the date time values are not equal to other.
Raises:
ValueError: if other is not an instance of DateTimeValues.
"""
if not isinstance(other, interface.DateTimeValues):
raise ValueError('Other not an instance of DateTimeValues')
if not isinstance(other, SemanticTime):
return True
......@@ -238,13 +226,7 @@ class Never(SemanticTime):
Returns:
bool: True if the date time values are equal to other.
Raises:
ValueError: if other is not an instance of DateTimeValues.
"""
if not isinstance(other, interface.DateTimeValues):
raise ValueError('Other not an instance of DateTimeValues')
return isinstance(other, Never)
def __ge__(self, other):
......@@ -323,13 +305,7 @@ class Never(SemanticTime):
Returns:
bool: True if the date time values are not equal to other.
Raises:
ValueError: if other is not an instance of DateTimeValues.
"""
if not isinstance(other, interface.DateTimeValues):
raise ValueError('Other not an instance of DateTimeValues')
return not isinstance(other, Never)
......
......@@ -175,11 +175,11 @@ class Systemtime(interface.DateTimeValues):
"""Copies the SYSTEMTIME structure to a date and time string.
Returns:
str: date and time value formatted as:
YYYY-MM-DD hh:mm:ss.###
str: date and time value formatted as: "YYYY-MM-DD hh:mm:ss.###" or
None if the number of seconds is missing.
"""
if self._number_of_seconds is None:
return
return None
return '{0:04d}-{1:02d}-{2:02d} {3:02d}:{4:02d}:{5:02d}.{6:03d}'.format(
self.year, self.month, self.day_of_month, self.hours, self.minutes,
......
......@@ -115,12 +115,12 @@ class UUIDTime(interface.DateTimeValues):
"""Copies the UUID timestamp to a date and time string.
Returns:
str: date and time value formatted as:
YYYY-MM-DD hh:mm:ss.#######
str: date and time value formatted as: "YYYY-MM-DD hh:mm:ss.#######" or
None if the timestamp is missing or invalid.
"""
if (self._timestamp is None or self._timestamp < 0 or
self._timestamp > self._UINT60_MAX):
return
return None
timestamp, remainder = divmod(self._timestamp, self._100NS_PER_SECOND)
number_of_days, hours, minutes, seconds = self._GetTimeValues(timestamp)
......
......@@ -103,12 +103,12 @@ class WebKitTime(interface.DateTimeValues):
"""Copies the WebKit timestamp to a date and time string.
Returns:
str: date and time value formatted as:
YYYY-MM-DD hh:mm:ss.######
str: date and time value formatted as: "YYYY-MM-DD hh:mm:ss.######" or
None if the timestamp is missing or invalid.
"""
if (self._timestamp is None or self._timestamp < self._INT64_MIN or
self._timestamp > self._INT64_MAX):
return
return None
timestamp, microseconds = divmod(
self._timestamp, definitions.MICROSECONDS_PER_SECOND)
......
......@@ -94,14 +94,13 @@ else:
'%files -n {0:s}-%{{name}}'.format(python_package),
'%defattr(644,root,root,755)',
'%doc ACKNOWLEDGEMENTS AUTHORS LICENSE README',
'%{_prefix}/lib/python*/site-packages/dfdatetime/*.py',
'%{_prefix}/lib/python*/site-packages/**/*.py',
'%{_prefix}/lib/python*/site-packages/dfdatetime*.egg-info/*',
'',
'%exclude %{_prefix}/share/doc/*',
'%exclude %{_prefix}/lib/python*/site-packages/dfdatetime/*.pyc',
'%exclude %{_prefix}/lib/python*/site-packages/dfdatetime/*.pyo',
('%exclude %{_prefix}/lib/python*/site-packages/dfdatetime/'
'__pycache__/*')]
'%exclude %{_prefix}/lib/python*/site-packages/**/*.pyc',
'%exclude %{_prefix}/lib/python*/site-packages/**/*.pyo',
'%exclude %{_prefix}/lib/python*/site-packages/**/__pycache__/*']
python_spec_file.extend(lines)
break
......@@ -130,7 +129,7 @@ else:
dfdatetime_description = (
'Digital Forensics Date and Time (dfDateTime).')
'Digital Forensics date and time (dfDateTime).')
dfdatetime_long_description = (
'dfDateTime, or Digital Forensics date and time, provides date and time '
......
......@@ -97,8 +97,7 @@ class DateTimeValuesTest(unittest.TestCase):
self.assertFalse(date_time_values1 < date_time_values2)
self.assertFalse(date_time_values1 != date_time_values2)
with self.assertRaises(ValueError):
date_time_values1 == 0.0 # pylint: disable=pointless-statement
self.assertFalse(date_time_values1 == 0.0)
with self.assertRaises(ValueError):
date_time_values1 >= 0.0 # pylint: disable=pointless-statement
......@@ -112,8 +111,7 @@ class DateTimeValuesTest(unittest.TestCase):
with self.assertRaises(ValueError):
date_time_values1 < 0.0 # pylint: disable=pointless-statement
with self.assertRaises(ValueError):
date_time_values1 != 0.0 # pylint: disable=pointless-statement
self.assertTrue(date_time_values1 != 0.0)
# TODO: add tests for _AdjustForTimeZoneOffset.
......
......@@ -50,8 +50,7 @@ class SemanticTimeTest(unittest.TestCase):
self.assertTrue(semantic_time_object1 < date_time_values1)
self.assertTrue(semantic_time_object1 != date_time_values1)
with self.assertRaises(ValueError):
semantic_time_object1 == 0.0 # pylint: disable=pointless-statement
self.assertFalse(semantic_time_object1 == 0.0)
with self.assertRaises(ValueError):
semantic_time_object1 >= 0.0 # pylint: disable=pointless-statement
......@@ -65,8 +64,7 @@ class SemanticTimeTest(unittest.TestCase):
with self.assertRaises(ValueError):
semantic_time_object1 < 0.0 # pylint: disable=pointless-statement
with self.assertRaises(ValueError):
semantic_time_object1 != 0.0 # pylint: disable=pointless-statement
self.assertTrue(semantic_time_object1 != 0.0)
def testCopyFromDateTimeString(self):
"""Tests the CopyFromDateTimeString function."""
......@@ -155,8 +153,7 @@ class NeverTest(unittest.TestCase):
self.assertFalse(never_time_object1 < date_time_values1)
self.assertTrue(never_time_object1 != date_time_values1)
with self.assertRaises(ValueError):
never_time_object1 == 0.0 # pylint: disable=pointless-statement
self.assertFalse(never_time_object1 == 0.0)
with self.assertRaises(ValueError):
never_time_object1 >= 0.0 # pylint: disable=pointless-statement
......@@ -170,8 +167,7 @@ class NeverTest(unittest.TestCase):
with self.assertRaises(ValueError):
never_time_object1 < 0.0 # pylint: disable=pointless-statement
with self.assertRaises(ValueError):
never_time_object1 != 0.0 # pylint: disable=pointless-statement
self.assertTrue(never_time_object1 != 0.0)
class NotSetTest(unittest.TestCase):
......
......@@ -76,7 +76,7 @@ class DependencyDefinitionReader(object):
try:
return config_parser.get(section_name, value_name)
except configparser.NoOptionError:
return
return None
def Read(self, file_object):
"""Reads dependency definitions.
......@@ -287,7 +287,7 @@ class DependencyHelper(object):
try:
module_object = list(map(__import__, [module_name]))[0]
except ImportError:
return
return None
# If the module name contains dots get the upper most module object.
if '.' in module_name:
......
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