Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 24 additions & 78 deletions modules/platforms/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ plugins {
id 'signing'
alias(libs.plugins.checksum)
alias(libs.plugins.cmake)
alias(libs.plugins.dockerRemoteApi)
}

import dev.welbyseely.CMakeBuildTask
Expand All @@ -28,11 +27,6 @@ import groovy.json.JsonOutput
import groovy.json.JsonSlurper
import org.apache.tools.ant.taskdefs.condition.Os
import org.gradle.crypto.checksum.Checksum
import com.bmuschko.gradle.docker.tasks.container.DockerStartContainer
import com.bmuschko.gradle.docker.tasks.container.DockerStopContainer
import com.bmuschko.gradle.docker.tasks.container.DockerCreateContainer
import com.bmuschko.gradle.docker.tasks.container.DockerExecContainer
import com.bmuschko.gradle.docker.tasks.image.DockerBuildImage

configurations {
cppClient
Expand All @@ -42,9 +36,6 @@ configurations {
platformsHeaders
}

def manylinuxWheelsContainerName = "ignite_manylinux_wheels"
def manylinuxWheelsImageName = "ignite_manylinux_python_wheels_build"

dependencies {
platformsHeaders project(path: ':ignite-api', configuration: 'platformsHeaders')
}
Expand Down Expand Up @@ -267,6 +258,29 @@ private String simpleProjectVersion(String version) {
return version
}

/**
* Converts the version to the python version format.
* See https://packaging.python.org/en/latest/discussions/versioning/
*/
private String pythonProjectVersion(String version) {
def (simple, addition) = version.tokenize('-')
Comment thread
isapego marked this conversation as resolved.
if (addition == null) {
return simple
}

def pythonAddition = addition
.toLowerCase()
.replace("alpha", "a")
.replace("beta", "b")
.replace("patch", "post")
.replace("snapshot", "dev")

if (pythonAddition.matches("(a|b|rc)\\d+")) {
return simple + pythonAddition
}
return simple + '.' + pythonAddition
}

private void updateDotnetVersion(String version) {
def versionFile = file("$projectDir/dotnet/version.json")
def json = new JsonSlurper().parseText(versionFile.text)
Expand All @@ -277,73 +291,5 @@ private void updateDotnetVersion(String version) {

private void updatePythonVersion(String version) {
def versionFile = file("$projectDir/python/pyignite_dbapi/_version.txt")
versionFile.text = simpleProjectVersion(version)
}

def buildWindowsDbApiWheels = tasks.register('buildWindowsDbApiWheels', Exec) {
workingDir "$projectDir/python"

commandLine "cmd", "/c", "Powershell -File .\\scripts\\BuildWheels.ps1 -PyVers \"$dbapiPythonVersions\""
}

private void handleError(Throwable exc) {
if (exc == null)
return;
String strErr = exc.toString()
project.logger.info(">>>>>>>>> Error: " + strErr)
if (!strErr.contains('NotModifiedException') &&
!strErr.contains('No such container')) {
project.logger.info(">>>>>>>>> Re-throwing error")
throw new RuntimeException(exc)
}
versionFile.text = pythonProjectVersion(version)
}

def buildManyLinuxWheelsDockerImage = tasks.register('buildManyLinuxWheelsDockerImage', DockerBuildImage) {
inputDir = file("$projectDir/python/scripts")
images = ["$manylinuxWheelsImageName"]
}

def createManyLinuxWheelsContainer = tasks.register('createManyLinuxWheelsContainer', DockerCreateContainer) {
dependsOn buildManyLinuxWheelsDockerImage
targetImageId "$manylinuxWheelsImageName"
containerName = "$manylinuxWheelsContainerName"
withEnvVar("PLAT", "manylinux2014_x86_64")
hostConfig.autoRemove = true
hostConfig.binds = [
"$projectDir/python":"/pyignite_dbapi",
"$projectDir/cpp":"/cpp",
"$projectDir/python/distr":"/dist"
]
tty = true
}

def startManyLinuxWheelsContainer = tasks.register('startManyLinuxWheelsContainer', DockerStartContainer) {
dependsOn createManyLinuxWheelsContainer
targetContainerId("$manylinuxWheelsContainerName")
onError { exception -> handleError(exception) }
}

def stopManyLinuxWheelsContainer = tasks.register('stopManyLinuxWheelsContainer', DockerStopContainer) {
targetContainerId("$manylinuxWheelsContainerName")
onError { exception -> handleError(exception) }
}

def buildLinuxDbApiWheels = tasks.register('buildLinuxDbApiWheels', DockerExecContainer) {
dependsOn startManyLinuxWheelsContainer
targetContainerId("$manylinuxWheelsContainerName")
commands.add(["/pyignite_dbapi/scripts/build_wheels.sh", "$dbapiPythonVersions"] as String[])
onError { exception -> handleError(exception) }
}

def buildDbApiSourceDist = tasks.register('buildDbApiSourceDist', DockerExecContainer) {
dependsOn startManyLinuxWheelsContainer
targetContainerId("$manylinuxWheelsContainerName")
commands.add(["/pyignite_dbapi/scripts/create_sdist.sh", "$dbapiPythonVersions"] as String[])
onError { exception -> handleError(exception) }
}

def buildLinuxDbApi = tasks.register('buildLinuxDbApi', Task) {
dependsOn buildDbApiSourceDist, buildLinuxDbApiWheels
finalizedBy stopManyLinuxWheelsContainer
}

2 changes: 1 addition & 1 deletion modules/platforms/python/pyignite_dbapi/_version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.2.0
3.2.0.dev
9 changes: 5 additions & 4 deletions modules/platforms/python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
# limitations under the License.
import os
import platform
import re
import subprocess
import setuptools
import sys
Expand Down Expand Up @@ -52,11 +53,11 @@ def is_a_requirement(req_line):

def cmake_project_version(version):
"""
Strips the pre-release portion of the project version string to satisfy CMake requirements
Strips the extra portion of the project version string to satisfy CMake requirements
"""
dash_index = version.find("-")
if dash_index != -1:
return version[:dash_index]
end_index = re.search(r"\d+\.\d+\.\d+", version).end()
if end_index != -1:
return version[:end_index]
return version

def _get_env_variable(name, default='OFF'):
Expand Down