From 22302e1e24f30a10fe2cd1bb1e8e517618673d5f Mon Sep 17 00:00:00 2001 From: George Lewis Date: Mon, 18 Nov 2019 19:30:00 -0500 Subject: [PATCH] Change setup.py to use subprocess --- setup.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/setup.py b/setup.py index be080c3..79de24e 100644 --- a/setup.py +++ b/setup.py @@ -1,8 +1,5 @@ import sys -from pip._internal import main as pipmain - -def install(package): - pipmain(['install', package]) +from subprocess import Popen, PIPE if not (sys.version_info.major >= 3 and sys.version_info.minor >= 4): @@ -14,12 +11,11 @@ def install(package): #old = sys.stdout -sys.stdout = None -sys.stderr = None - with open('requirements.txt') as f: - for line in f: - if line: - install(line) + + lines = [x for x in f.readlines() if x] + +process = Popen([sys.executable, '-m', 'pip', 'install', *lines], stdout=PIPE, stderr=PIPE) +stdout, stderr = process.communicate() sys.exit(0) \ No newline at end of file