mirror of
https://github.com/certbot/certbot.git
synced 2026-06-04 22:33:00 -04:00
simplify pip_install.py
This commit is contained in:
parent
3d89671dd4
commit
82589cbaf1
1 changed files with 1 additions and 15 deletions
|
|
@ -6,10 +6,7 @@
|
|||
from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
|
||||
import contextlib
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
|
|
@ -17,17 +14,6 @@ import tempfile
|
|||
import readlink
|
||||
|
||||
|
||||
# Once this code doesn't need to support Python 2, we can simply use
|
||||
# tempfile.TemporaryDirectory.
|
||||
@contextlib.contextmanager
|
||||
def temporary_directory():
|
||||
dirpath = tempfile.mkdtemp()
|
||||
try:
|
||||
yield dirpath
|
||||
finally:
|
||||
shutil.rmtree(dirpath)
|
||||
|
||||
|
||||
def find_tools_path():
|
||||
return os.path.dirname(readlink.main(__file__))
|
||||
|
||||
|
|
@ -49,7 +35,7 @@ def pip_install_with_print(args_str, env=None):
|
|||
def main(args):
|
||||
tools_path = find_tools_path()
|
||||
|
||||
with temporary_directory() as working_dir:
|
||||
with tempfile.TemporaryDirectory as working_dir:
|
||||
if os.environ.get('CERTBOT_NO_PIN') == '1':
|
||||
# With unpinned dependencies, there is no constraint
|
||||
pip_install_with_print(' '.join(args))
|
||||
|
|
|
|||
Loading…
Reference in a new issue