Commit 3fef697b653f6e3db684d940ac7c07e1f688c008

Authored by decalage2
1 parent 32510e06

record_base: fixed import to avoid mixing installed oletools and dev version

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
8 8 ppt_record_parser.py .
9 9 """
10 10  
11   -# === LICENSE =================================================================
  11 +# === LICENSE ==================================================================
  12 +
  13 +# record_base is copyright (c) 2014-2019 Philippe Lagadec (http://www.decalage.info)
  14 +# All rights reserved.
12 15 #
13 16 # Redistribution and use in source and binary forms, with or without
14 17 # modification, are permitted provided that the following conditions are met:
... ... @@ -37,8 +40,10 @@ from __future__ import print_function
37 40 # CHANGELOG:
38 41 # 2017-11-30 v0.01 CH: - first version based on xls_parser
39 42 # 2018-09-11 v0.54 PL: - olefile is now a dependency
  43 +# 2019-01-30 PL: - fixed import to avoid mixing installed oletools
  44 +# and dev version
40 45  
41   -__version__ = '0.54dev1'
  46 +__version__ = '0.54dev9'
42 47  
43 48 # -----------------------------------------------------------------------------
44 49 # TODO:
... ... @@ -63,16 +68,13 @@ import logging
63 68  
64 69 import olefile
65 70  
66   -try:
67   - from oletools.common.errors import FileIsEncryptedError
68   -except ImportError:
69   - # little hack to allow absolute imports even if oletools is not installed.
70   - PARENT_DIR = os.path.normpath(os.path.dirname(os.path.dirname(
71   - os.path.abspath(__file__))))
72   - if PARENT_DIR not in sys.path:
73   - sys.path.insert(0, PARENT_DIR)
74   - del PARENT_DIR
75   - from oletools.common.errors import FileIsEncryptedError
  71 +# little hack to allow absolute imports even if oletools is not installed.
  72 +PARENT_DIR = os.path.normpath(os.path.dirname(os.path.dirname(
  73 + os.path.abspath(__file__))))
  74 +if PARENT_DIR not in sys.path:
  75 + sys.path.insert(0, PARENT_DIR)
  76 +del PARENT_DIR
  77 +from oletools.common.errors import FileIsEncryptedError
76 78 from oletools import oleid
77 79  
78 80  
... ...
oletools/xls_parser.py
... ... @@ -33,8 +33,8 @@ Read storages, (sub-)streams, records from xls file
33 33 # 2017-11-02 v0.1 CH: - first version
34 34 # 2017-11-02 v0.2 CH: - move some code to record_base.py
35 35 # (to avoid copy-and-paste in ppt_parser.py)
36   -# 2019-01-30 v0.54dev9 PL: - fixed import to avoid mixing installed oletools
37   -# and dev version
  36 +# 2019-01-30 v0.54 PL: - fixed import to avoid mixing installed oletools
  37 +# and dev version
38 38  
39 39 __version__ = '0.54dev9'
40 40  
... ...