From 3fef697b653f6e3db684d940ac7c07e1f688c008 Mon Sep 17 00:00:00 2001 From: decalage2 Date: Wed, 30 Jan 2019 21:23:32 +0100 Subject: [PATCH] record_base: fixed import to avoid mixing installed oletools and dev version --- oletools/record_base.py | 26 ++++++++++++++------------ oletools/xls_parser.py | 4 ++-- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/oletools/record_base.py b/oletools/record_base.py index 49b3cb5..f30ef7f 100644 --- a/oletools/record_base.py +++ b/oletools/record_base.py @@ -8,7 +8,10 @@ This is the case for xls and ppt, so classes are bases for xls_parser.py and ppt_record_parser.py . """ -# === LICENSE ================================================================= +# === LICENSE ================================================================== + +# record_base is copyright (c) 2014-2019 Philippe Lagadec (http://www.decalage.info) +# All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: @@ -37,8 +40,10 @@ from __future__ import print_function # CHANGELOG: # 2017-11-30 v0.01 CH: - first version based on xls_parser # 2018-09-11 v0.54 PL: - olefile is now a dependency +# 2019-01-30 PL: - fixed import to avoid mixing installed oletools +# and dev version -__version__ = '0.54dev1' +__version__ = '0.54dev9' # ----------------------------------------------------------------------------- # TODO: @@ -63,16 +68,13 @@ import logging import olefile -try: - from oletools.common.errors import FileIsEncryptedError -except ImportError: - # little hack to allow absolute imports even if oletools is not installed. - PARENT_DIR = os.path.normpath(os.path.dirname(os.path.dirname( - os.path.abspath(__file__)))) - if PARENT_DIR not in sys.path: - sys.path.insert(0, PARENT_DIR) - del PARENT_DIR - from oletools.common.errors import FileIsEncryptedError +# little hack to allow absolute imports even if oletools is not installed. +PARENT_DIR = os.path.normpath(os.path.dirname(os.path.dirname( + os.path.abspath(__file__)))) +if PARENT_DIR not in sys.path: + sys.path.insert(0, PARENT_DIR) +del PARENT_DIR +from oletools.common.errors import FileIsEncryptedError from oletools import oleid diff --git a/oletools/xls_parser.py b/oletools/xls_parser.py index 0e7fd20..e29aadd 100644 --- a/oletools/xls_parser.py +++ b/oletools/xls_parser.py @@ -33,8 +33,8 @@ Read storages, (sub-)streams, records from xls file # 2017-11-02 v0.1 CH: - first version # 2017-11-02 v0.2 CH: - move some code to record_base.py # (to avoid copy-and-paste in ppt_parser.py) -# 2019-01-30 v0.54dev9 PL: - fixed import to avoid mixing installed oletools -# and dev version +# 2019-01-30 v0.54 PL: - fixed import to avoid mixing installed oletools +# and dev version __version__ = '0.54dev9' -- libgit2 0.21.4