From 6d45f371cb8f778434f3831dc1fe7a4ef0fd3aa7 Mon Sep 17 00:00:00 2001 From: Mengyang Li Date: Mon, 28 Jan 2019 16:19:56 -0800 Subject: [PATCH] drop usage of pip internal functions pip>=10 moved those internal functions to _internal. for python2.7 we can install futures from extras_require to avoid accessing those internal functions. --- cachier/core.py | 13 +------------ setup.py | 5 +++-- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/cachier/core.py b/cachier/core.py index fe3c3fb..01aa029 100644 --- a/cachier/core.py +++ b/cachier/core.py @@ -16,18 +16,7 @@ import os from functools import wraps import datetime -try: # for asynchronous file uploads - from concurrent.futures import ThreadPoolExecutor -except ImportError: # we're in python 2.x - import pip - PACKAGES = [ - package.project_name - for package - in pip.get_installed_distributions() - ] - if 'futures' not in PACKAGES: - pip.main(['install', 'futures']) - from concurrent.futures import ThreadPoolExecutor +from concurrent.futures import ThreadPoolExecutor from .pickle_core import _PickleCore from .mongo_core import _MongoCore, RecalculationNeeded diff --git a/setup.py b/setup.py index ccefa05..cac0abe 100644 --- a/setup.py +++ b/setup.py @@ -38,10 +38,11 @@ setup( cachier=cachier.scripts.cli:cli ''', install_requires=[ - 'watchdog', 'portalocker' + 'watchdog', 'portalocker', ], extras_require={ - 'test': TEST_REQUIRES + 'test': TEST_REQUIRES, + ':python_version == "2.7"': ['futures'], }, platforms=['linux', 'osx', 'windows'], keywords=['cache', 'persistence', 'mongo', 'memoization', 'decorator'],