Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
import imp
try:
from imp import load_source
except ImportError:
import importlib.util
import importlib.machinery

def load_source(modname, filename):
loader = importlib.machinery.SourceFileLoader(modname, filename)
spec = importlib.util.spec_from_file_location(modname, filename, loader=loader)
module = importlib.util.module_from_spec(spec)
# The module is always executed and not cached in sys.modules.
# Uncomment the following line to cache the module.
# sys.modules[module.__name__] = module
loader.exec_module(module)
return module


import os

try:
Expand All @@ -16,8 +32,8 @@
README = ''
CHANGES = ''

# Use imp to avoid sift/__init__.py
version_mod = imp.load_source('__tmp', os.path.join(here, 'sift/version.py'))
# Use imp/importlib to avoid sift/__init__.py
version_mod = load_source('__tmp', os.path.join(here, 'sift/version.py'))

setup(
name='Sift',
Expand Down