PythonVirtualenvHelper
public
class
PythonVirtualenvHelper
extends Object
java.lang.Object | |
↳ | 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 ()
공개 메서드
activate
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이(가) 존재하지 않는 경우 |