Skip to content

Commit

Permalink
Change setup.py to use subprocess
Browse files Browse the repository at this point in the history
  • Loading branch information
George-lewis committed Nov 19, 2019
1 parent b28b748 commit 22302e1
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions setup.py
Original file line number Diff line number Diff line change
@@ -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):

Expand All @@ -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)

0 comments on commit 22302e1

Please sign in to comment.