File tree 2 files changed +24
-14
lines changed
2 files changed +24
-14
lines changed Original file line number Diff line number Diff line change @@ -120,7 +120,6 @@ for p in vim.eval("&runtimepath").split(','):
120
120
from orgmode._vim import ORGMODE, insert_at_cursor, get_user_input, date_to_str
121
121
ORGMODE.start ()
122
122
123
- from Date import Date
124
123
import datetime
125
124
EOF
126
125
Original file line number Diff line number Diff line change 7
7
TODO
8
8
"""
9
9
10
- import imp
10
+ try :
11
+ import importlib
12
+ USE_DEPRECATED_IMP = False
13
+ except :
14
+ import imp
15
+ USE_DEPRECATED_IMP = True
16
+
11
17
import re
12
18
import sys
13
19
@@ -327,21 +333,26 @@ def register_plugin(self, plugin):
327
333
# actual plugin class
328
334
_class = None
329
335
330
- # locate module and initialize plugin class
331
- try :
332
- module = imp .find_module (plugin , orgmode .plugins .__path__ )
333
- except ImportError as e :
334
- echom (u'Plugin not found: %s' % plugin )
335
- if self .debug :
336
- raise e
337
- return
336
+ if USE_DEPRECATED_IMP :
337
+ # locate module and initialize plugin class
338
+ try :
339
+ module = imp .find_module (plugin , orgmode .plugins .__path__ )
340
+ except ImportError as e :
341
+ echom (u'Plugin not found: %s' % plugin )
342
+ if self .debug :
343
+ raise e
344
+ return
338
345
339
- if not module :
340
- echom (u'Plugin not found: %s' % plugin )
341
- return
346
+ if not module :
347
+ echom (u'Plugin not found: %s' % plugin )
348
+ return
342
349
343
350
try :
344
- module = imp .load_module (plugin , * module )
351
+ if USE_DEPRECATED_IMP :
352
+ module = imp .load_module (plugin , * module )
353
+ else :
354
+ module = importlib .import_module (".plugins." + plugin , "orgmode" )
355
+
345
356
if not hasattr (module , plugin ):
346
357
echoe (u'Unable to find plugin: %s' % plugin )
347
358
if self .debug :
You can’t perform that action at this time.
0 commit comments