File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -120,7 +120,6 @@ for p in vim.eval("&runtimepath").split(','):
120120from orgmode._vim import ORGMODE, insert_at_cursor, get_user_input, date_to_str
121121ORGMODE.start ()
122122
123- from Date import Date
124123import datetime
125124EOF
126125
Original file line number Diff line number Diff line change 77 TODO
88"""
99
10- import imp
10+ try :
11+ import importlib
12+ USE_DEPRECATED_IMP = False
13+ except :
14+ import imp
15+ USE_DEPRECATED_IMP = True
16+
1117import re
1218import sys
1319
@@ -327,21 +333,26 @@ def register_plugin(self, plugin):
327333 # actual plugin class
328334 _class = None
329335
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
338345
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
342349
343350 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+
345356 if not hasattr (module , plugin ):
346357 echoe (u'Unable to find plugin: %s' % plugin )
347358 if self .debug :
You can’t perform that action at this time.
0 commit comments