Skip to content
This repository has been archived by the owner on May 13, 2019. It is now read-only.

Commit

Permalink
WATCHDOG-5: Fix the use of the deprecated imp module
Browse files Browse the repository at this point in the history
  • Loading branch information
Mickaël Schoentgen authored and BoboTiG committed Jun 22, 2018
1 parent 4a017b1 commit 18ebfd3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
7 changes: 5 additions & 2 deletions setup.py
Expand Up @@ -18,7 +18,7 @@
# limitations under the License.

import sys
import imp
import importlib.util
import os.path
from setuptools import setup, find_packages
from setuptools.extension import Extension
Expand All @@ -29,7 +29,10 @@
SRC_DIR = 'src'
WATCHDOG_PKG_DIR = os.path.join(SRC_DIR, 'watchdog')

version = imp.load_source('version', os.path.join(WATCHDOG_PKG_DIR, 'version.py'))
spec = importlib.util.spec_from_file_location(
'version', os.path.join(WATCHDOG_PKG_DIR, 'version.py'))
version = importlib.util.module_from_spec(spec)
spec.loader.exec_module(version)

ext_modules = []
if get_platform().startswith('macosx'):
Expand Down
5 changes: 2 additions & 3 deletions tools/bootstrap.py
Expand Up @@ -67,7 +67,6 @@ def quote(c):
# out any namespace packages from site-packages that might have been
# loaded by .pth files.
clean_path = sys.path[:]
import site
sys.path[:] = clean_path
for k, v in list(sys.modules.items()):
if k in ('setuptools', 'pkg_resources') or (
Expand Down Expand Up @@ -190,8 +189,8 @@ def normalize_to_url(option, opt_str, value, parser):
ez['use_setuptools'](**setup_args)
if 'pkg_resources' in sys.modules:
if sys.version_info[0] >= 3:
import imp
reload_ = imp.reload
import importlib
reload_ = importlib.reload
else:
reload_ = reload

Expand Down

0 comments on commit 18ebfd3

Please sign in to comment.