PythonVirtualenvHelper
public class PythonVirtualenvHelper
extends Object
java.lang.객체 | |
↳ | com.android.tradefed.util.PythonVirtualenvHelper |
Python 3 가상 환경을 활성화하기 위한 도우미 클래스입니다.
요약
필드 | |
---|---|
public static final String | VIRTUAL_ENV
|
공개 생성자 | |
---|---|
PythonVirtualenvHelper () |
공개 방법 | |
---|---|
static void | activate ( IRunUtil runUtil, File virtualenvDir) RunUtil에 대해 virtualenv를 활성화합니다. |
static String | getPackageInstallLocation ( IRunUtil runUtil, String virtualenvPath) Python 패키지 설치 위치를 가져옵니다. |
static String | getPythonBinDir (String virtualenvPath) python bin 디렉토리 경로를 가져옵니다. |
필드
VIRTUAL_ENV
public static final String VIRTUAL_ENV
공개 생성자
PythonVirtualenvHelper
public PythonVirtualenvHelper ()
공개 방법
활성화하다
public static void activate (IRunUtil runUtil, File virtualenvDir)
RunUtil에 대해 virtualenv를 활성화합니다.
매개변수 | |
---|---|
runUtil | IRunUtil : virtualenv 활성화 명령을 실행하기 위한 유틸리티 개체입니다. |
virtualenvDir | File : 생성된 virtualenv 디렉토리를 나타내는 File 객체. |
getPackageInstallLocation
public static String getPackageInstallLocation (IRunUtil runUtil, String virtualenvPath)
Python 패키지 설치 위치를 가져옵니다.
이 메서드는 /path/to/venv/bin/pip3 show pip를 호출하고 stdout 출력에서 패키지 위치를 구문 분석합니다.
매개변수 | |
---|---|
runUtil | IRunUtil : 명령을 실행하기 위한 유틸리티 개체입니다. |
virtualenvPath | String : 생성된 virtualenv 디렉토리의 경로. |
보고 | |
---|---|
String | Python 패키지가 설치된 위치의 절대 경로를 나타내는 문자열입니다. |
getPythonBinDir
public static String getPythonBinDir (String virtualenvPath)
python bin 디렉토리 경로를 가져옵니다.
이 메소드는 디렉토리 존재를 확인합니다.
매개변수 | |
---|---|
virtualenvPath | String |
보고 | |
---|---|
String | str, venv의 python bin 디렉토리 경로. |
던지기 | |
---|---|
NullPointerException | arg virtualenvPath가 null인 경우. |
RuntimeException | /path/to/venv/bin이 존재하지 않는 경우. |