From 0813eafae11218ee5b4c6a75bb9b39eb62bf6cfd Mon Sep 17 00:00:00 2001 From: bw2 Date: Mon, 2 Apr 2018 15:07:18 -0400 Subject: [PATCH] switch from pip.main to os.system('pip install ..') since pip.main is getting deprecated in pip v10 --- create_snapshot.py | 7 ++----- entire_vds_pipeline.py | 8 +++++--- list_repositories.py | 5 ++--- print_elasticsearch_stats.py | 6 +++--- print_snapshot_status.py | 5 ++--- register_snapshot_repository.py | 5 ++--- restore_snapshot.py | 5 ++--- utils/elasticsearch_client.py | 9 ++++----- utils/elasticsearch_utils.py | 9 ++++----- 9 files changed, 26 insertions(+), 33 deletions(-) diff --git a/create_snapshot.py b/create_snapshot.py index cace091f2..5c4466ddd 100755 --- a/create_snapshot.py +++ b/create_snapshot.py @@ -1,13 +1,10 @@ -import pip +import os +os.system("pip install elasticsearch") # this used to be `import pip; pip.main(['install', 'elasticsearch']);`, but pip.main is deprecated as of pip v10 from utils.elasticsearch_client import ElasticsearchClient - -pip.main(['install', 'elasticsearch']) - import argparse import elasticsearch import logging -import os from pprint import pprint import time diff --git a/entire_vds_pipeline.py b/entire_vds_pipeline.py index 61ad5ba1e..894c6923e 100644 --- a/entire_vds_pipeline.py +++ b/entire_vds_pipeline.py @@ -1,8 +1,10 @@ #!/usr/bin/env python -import pip -for dependency in ['six==1.10.0', 'elasticsearch==5.4.0', 'requests==2.13.0']: - pip.main(['install', dependency]) +#for dependency in ['six==1.10.0', 'elasticsearch', 'requests']: +# pip.main(['install', dependency]) +# make sure elasticsearch is installed +#import os +#os.system("pip install elasticsearch") # this used to be `import pip; pip.main(['install', 'elasticsearch']);`, but pip.main is deprecated as of pip v10 import argparse import json diff --git a/list_repositories.py b/list_repositories.py index 50a218b38..6f6afb868 100644 --- a/list_repositories.py +++ b/list_repositories.py @@ -1,6 +1,5 @@ -import pip - -pip.main(['install', 'elasticsearch']) +import os +os.system("pip install elasticsearch") # this used to be `import pip; pip.main(['install', 'elasticsearch']);`, but pip.main is deprecated as of pip v10 import argparse import elasticsearch diff --git a/print_elasticsearch_stats.py b/print_elasticsearch_stats.py index 5dab4bbe8..1d62cdc54 100644 --- a/print_elasticsearch_stats.py +++ b/print_elasticsearch_stats.py @@ -1,7 +1,7 @@ -import argparse -import pip -pip.main(['install', 'elasticsearch']) +import os +os.system("pip install elasticsearch") # this used to be `import pip; pip.main(['install', 'elasticsearch']);`, but pip.main is deprecated as of pip v10 +import argparse from utils.elasticsearch_client import ElasticsearchClient p = argparse.ArgumentParser() diff --git a/print_snapshot_status.py b/print_snapshot_status.py index 9ff1ac1f0..fd941ab95 100644 --- a/print_snapshot_status.py +++ b/print_snapshot_status.py @@ -1,6 +1,5 @@ -import pip - -pip.main(['install', 'elasticsearch']) +import os +os.system("pip install elasticsearch") # this used to be `import pip; pip.main(['install', 'elasticsearch']);`, but pip.main is deprecated as of pip v10 import argparse import elasticsearch diff --git a/register_snapshot_repository.py b/register_snapshot_repository.py index 19d2d2533..05f6a9f64 100644 --- a/register_snapshot_repository.py +++ b/register_snapshot_repository.py @@ -1,6 +1,5 @@ -import pip - -pip.main(['install', 'elasticsearch']) +import os +os.system("pip install elasticsearch") # this used to be `import pip; pip.main(['install', 'elasticsearch']);`, but pip.main is deprecated as of pip v10 import argparse import elasticsearch diff --git a/restore_snapshot.py b/restore_snapshot.py index 91483d850..88d9ddf7f 100644 --- a/restore_snapshot.py +++ b/restore_snapshot.py @@ -1,6 +1,5 @@ -import pip - -pip.main(['install', 'elasticsearch']) +import os +os.system("pip install elasticsearch") # this used to be `import pip; pip.main(['install', 'elasticsearch']);`, but pip.main is deprecated as of pip v10 import argparse import elasticsearch diff --git a/utils/elasticsearch_client.py b/utils/elasticsearch_client.py index 7a0b1dd22..98a56e2a6 100644 --- a/utils/elasticsearch_client.py +++ b/utils/elasticsearch_client.py @@ -1,3 +1,7 @@ +# make sure elasticsearch is installed +import os +os.system("pip install elasticsearch") # this used to be `import pip; pip.main(['install', 'elasticsearch']);`, but pip.main is deprecated as of pip v10 + import logging from utils.elasticsearch_utils import DEFAULT_GENOTYPE_FIELDS_TO_EXPORT, \ @@ -6,11 +10,6 @@ ELASTICSEARCH_CREATE, ELASTICSEARCH_UPDATE, ELASTICSEARCH_UPSERT handlers = set(logging.root.handlers) - -# make sure elasticsearch is installed -import pip -pip.main(['install', 'elasticsearch']) - logging.root.handlers = list(handlers) import elasticsearch diff --git a/utils/elasticsearch_utils.py b/utils/elasticsearch_utils.py index 26b7717c2..8ff4b38b6 100644 --- a/utils/elasticsearch_utils.py +++ b/utils/elasticsearch_utils.py @@ -1,11 +1,10 @@ +# make sure elasticsearch is installed +import os +os.system("pip install elasticsearch") # this used to be `import pip; pip.main(['install', 'elasticsearch']);`, but pip.main is deprecated as of pip v10 + import logging handlers = set(logging.root.handlers) - -# make sure elasticsearch is installed -import pip -pip.main(['install', 'elasticsearch']) - logging.root.handlers = list(handlers) import collections