2023-04-21 20:17:59 +00:00
|
|
|
/* ###
|
|
|
|
* IP: GHIDRA
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
2024-07-30 20:09:30 +00:00
|
|
|
*
|
2024-08-05 17:44:07 +00:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2024-07-30 20:09:30 +00:00
|
|
|
*
|
2023-04-21 20:17:59 +00:00
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
2024-05-01 13:56:08 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* NOTE: Supported Python3 command is established by root project build.gradle
|
|
|
|
*/
|
2024-02-28 19:15:33 +00:00
|
|
|
|
2024-07-05 14:37:56 +00:00
|
|
|
// Enable the Python Nature in the Eclipse project
|
|
|
|
eclipse.project {
|
|
|
|
natures 'org.python.pydev.pythonNature'
|
|
|
|
}
|
|
|
|
|
2024-04-27 03:34:30 +00:00
|
|
|
ext.findPyDep = { name ->
|
|
|
|
File inDeps = file("${DEPS_DIR}/${project.name}/${name}")
|
2024-08-05 17:44:07 +00:00
|
|
|
File inRepo = file("${BIN_REPO}/ExternalPyWheels/${name}")
|
2024-04-27 03:34:30 +00:00
|
|
|
if (inDeps.exists()) {
|
|
|
|
return inDeps
|
|
|
|
}
|
|
|
|
if (inRepo.exists()) {
|
|
|
|
return inRepo
|
|
|
|
}
|
|
|
|
println("Warning: Could not find '${name}' for ${project.name}")
|
|
|
|
return inDeps
|
|
|
|
}
|
|
|
|
|
2023-04-21 20:17:59 +00:00
|
|
|
task assemblePyPackage(type: Copy) {
|
|
|
|
from "src/main/py"
|
|
|
|
into "build/pypkg/"
|
|
|
|
}
|
|
|
|
|
2024-04-27 03:34:30 +00:00
|
|
|
task buildPyPackage {
|
2024-07-30 20:09:30 +00:00
|
|
|
dependsOn assemblePyPackage
|
2023-04-21 20:17:59 +00:00
|
|
|
ext.dist = { file("build/pypkg/dist") }
|
|
|
|
inputs.files(assemblePyPackage)
|
|
|
|
outputs.dir(dist)
|
|
|
|
|
2024-04-27 03:34:30 +00:00
|
|
|
doLast {
|
2024-10-11 18:13:24 +00:00
|
|
|
if (rootProject.PYTHON3 == null) {
|
|
|
|
throw new GradleException("A supported version of Python ${SUPPORTED_PY_VERSIONS} was not found!")
|
|
|
|
}
|
|
|
|
|
2024-04-27 03:34:30 +00:00
|
|
|
File setuptools = project(":Debugger-rmi-trace").findPyDep(".")
|
|
|
|
exec {
|
|
|
|
workingDir { "build/pypkg" }
|
2024-10-08 13:49:08 +00:00
|
|
|
commandLine rootProject.PYTHON3
|
|
|
|
args "-m", "pip", "wheel", "-w", "dist/", "--no-index", "--no-deps", "-f", setuptools, "."
|
2024-04-27 03:34:30 +00:00
|
|
|
}
|
|
|
|
}
|
2024-01-04 16:01:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// At the moment, any module with a python package also distributes it.
|
|
|
|
// We can separate this into `distributePythonPackage` later, if necessary.
|
|
|
|
|
|
|
|
rootProject.assembleDistribution {
|
2024-04-27 03:34:30 +00:00
|
|
|
dependsOn(buildPyPackage)
|
2024-01-04 16:01:07 +00:00
|
|
|
def p = this.project
|
|
|
|
def zipPath = getZipPath(p)
|
|
|
|
from (p.assemblePyPackage) {
|
|
|
|
exclude '**/*.pyc'
|
|
|
|
exclude '**/*.pyo'
|
|
|
|
exclude '**/__pycache__/**'
|
2024-09-09 13:56:46 +00:00
|
|
|
exclude '**/.pytest_cache'
|
|
|
|
exclude '**/*.egg-info'
|
|
|
|
exclude 'build'
|
2024-01-04 16:01:07 +00:00
|
|
|
into { zipPath + "/pypkg" }
|
|
|
|
}
|
2023-04-21 20:17:59 +00:00
|
|
|
}
|
2024-04-27 03:34:30 +00:00
|
|
|
|
|
|
|
ext.distributePyDep = { name ->
|
|
|
|
File dep = findPyDep(name)
|
2024-08-12 12:26:41 +00:00
|
|
|
PYTHON_DEPS.add(dep)
|
2024-04-27 03:34:30 +00:00
|
|
|
def zipPath = getZipPath(project)
|
|
|
|
rootProject.assembleDistribution {
|
|
|
|
into ("${zipPath}/pypkg/dist") {
|
|
|
|
from dep
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|