GP-4816: Not trying to create python virtual environment during prepdev

is python is not installed
This commit is contained in:
Ryan Kurtz 2024-09-11 08:41:54 -04:00
parent b58a0c90b2
commit c378cc40a2
3 changed files with 11 additions and 5 deletions

View File

@ -65,7 +65,10 @@ task installEditablePyGhidra(type: Exec) {
commandLine "$PYTHON3_VENV", "-m", "pip", "install", "-e", "src/main/py"
}
if (findPython3(false)) {
rootProject.prepDev.dependsOn installEditablePyGhidra
}
// Add pyghidra_launcher.py to the release
rootProject.assembleDistribution {

View File

@ -50,7 +50,7 @@ if ("32".equals(System.getProperty("sun.arch.data.model"))) {
* Identify supported Python command
***************************************************************************************/
project.ext.SUPPORTED_PY_VERSIONS = ['3.12', '3.11', '3.10', '3.9']
project.ext.PYTHON3 = findPython3()
project.ext.PYTHON3 = findPython3(true)
project.ext.PYTHON_DEPS = new HashSet<String>()
/*********************************************************************************
@ -198,7 +198,7 @@ def checkPip(String pyCmd) {
}
}
def findPython3() {
def findPython3(boolean useDefault) {
for (pyCmd in ['py', 'python3', 'python']) {
def pyVer = checkPythonVersion(pyCmd)
if (pyVer in SUPPORTED_PY_VERSIONS) {
@ -219,7 +219,8 @@ def findPython3() {
// Force use of non-existent python3.9 instead of unsupported python version
// which should fail if a python build is performed.
println("Warning: Python3 command not found (required for build)")
return 'python3.9'
return useDefault ? 'python3.9' : null
}
/******************************************************************************************

View File

@ -28,4 +28,6 @@ task createPythonVirtualEnvironment(type: Exec) {
commandLine rootProject.PYTHON3, "-m", "venv", venvDir, "--copies"
}
if (findPython3(false)) {
rootProject.prepDev.dependsOn createPythonVirtualEnvironment
}