From 6d45f371cb8f778434f3831dc1fe7a4ef0fd3aa7 Mon Sep 17 00:00:00 2001 From: Mengyang Li Date: Mon, 28 Jan 2019 16:19:56 -0800 Subject: [PATCH 1/3] 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'], From 9482e23878ff84bd554341de9b88d6451eaf80d7 Mon Sep 17 00:00:00 2001 From: Mengyang Li Date: Mon, 28 Jan 2019 16:38:09 -0800 Subject: [PATCH 2/3] upgrade pip to latest in .travis.yml --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 2867bd1..3d0d04c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,6 +10,7 @@ matrix: sudo: true before_install: # coverage submission packages + - pip install -U pip - pip install codecov - pip install pymongo install: From 069fb6ae682226c578154fe021ade4f2582fea58 Mon Sep 17 00:00:00 2001 From: Mengyang Li Date: Mon, 28 Jan 2019 16:48:35 -0800 Subject: [PATCH 3/3] update pytest to latest as well --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 3d0d04c..c7dd66d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,10 +11,11 @@ matrix: before_install: # coverage submission packages - pip install -U pip + - pip install -U pytest - pip install codecov - pip install pymongo install: - - if [ "$TRAVIS_PYTHON_VERSION" == "2.7" ]; then pip install pytest coverage pytest-cov .; else pip install ".[test]"; fi + - if [ "$TRAVIS_PYTHON_VERSION" == "2.7" ]; then pip install coverage pytest-cov .; else pip install ".[test]"; fi script: python -m pytest --cov=cachier # submit coverage after_success: