Skip to content

Commit

Permalink
python: remove implicit pip dependency
Browse files Browse the repository at this point in the history
Rely on the standard libraries instead in order to install
dependencies.

Bug: #421
  • Loading branch information
fortaa committed Mar 1, 2025
1 parent b177c17 commit 0a253f9
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions anaconda-mode.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

from __future__ import print_function
import sys
import os
Expand Down Expand Up @@ -71,10 +70,19 @@ def install_deps_setuptools():
instrument_installation()

def install_deps_pip():
import pathlib
import shutil
import subprocess
cmd = [sys.executable, '-m', 'pip', 'install', '--target', server_directory]
import tempfile
import venv
temp_dir = pathlib.Path(tempfile.mkdtemp())
venv.create(temp_dir, with_pip=True)
cmd = [temp_dir / 'bin' / 'pip', 'install', '--target', server_directory]
cmd.extend(missing_dependencies)
subprocess.check_call(cmd)
try:
subprocess.check_call(cmd)
finally:
shutil.rmtree(temp_dir)
instrument_installation()

if missing_dependencies:
Expand Down

0 comments on commit 0a253f9

Please sign in to comment.