File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- import imp
1+ try :
2+ from imp import load_source
3+ except ImportError :
4+ import importlib .util
5+ import importlib .machinery
6+
7+ def load_source (modname , filename ):
8+ loader = importlib .machinery .SourceFileLoader (modname , filename )
9+ spec = importlib .util .spec_from_file_location (modname , filename , loader = loader )
10+ module = importlib .util .module_from_spec (spec )
11+ # The module is always executed and not cached in sys.modules.
12+ # Uncomment the following line to cache the module.
13+ # sys.modules[module.__name__] = module
14+ loader .exec_module (module )
15+ return module
16+
17+
218import os
319
420try :
1632 README = ''
1733 CHANGES = ''
1834
19- # Use imp to avoid sift/__init__.py
20- version_mod = imp . load_source ('__tmp' , os .path .join (here , 'sift/version.py' ))
35+ # Use imp/importlib to avoid sift/__init__.py
36+ version_mod = load_source ('__tmp' , os .path .join (here , 'sift/version.py' ))
2137
2238setup (
2339 name = 'Sift' ,
You can’t perform that action at this time.
0 commit comments