Skip to content

Commit d0e5baa

Browse files
fortaaCeleritasCelery
authored andcommitted
python: remove implicit pip dependency
Rely on the standard libraries instead in order to install dependencies. Bug: #421
1 parent 6473b8a commit d0e5baa

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

anaconda-mode.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,19 @@ def install_deps_setuptools():
7070
instrument_installation()
7171

7272
def install_deps_pip():
73+
import pathlib
74+
import shutil
7375
import subprocess
74-
cmd = [sys.executable, '-m', 'pip', 'install', '--target', server_directory]
76+
import tempfile
77+
import venv
78+
temp_dir = pathlib.Path(tempfile.mkdtemp())
79+
venv.create(temp_dir, with_pip=True)
80+
cmd = [temp_dir / 'bin' / 'pip', 'install', '--target', server_directory]
7581
cmd.extend(missing_dependencies)
76-
subprocess.check_call(cmd)
82+
try:
83+
subprocess.check_call(cmd)
84+
finally:
85+
shutil.rmtree(temp_dir)
7786
instrument_installation()
7887

7988
if missing_dependencies:

0 commit comments

Comments
 (0)