Skip to content
Snippets Groups Projects

NXCALS-1468 move python extraction to python3 and setup.py

1 file
+ 12
5
Compare changes
  • Side-by-side
  • Inline
apply plugin: 'org.sonarqube'
def pathToPythonInterpreter = '/user/bdisoft/operational/bin/Python/anaconda_py35/bin/python'
def defaultPythonInterpreter = '/user/bdisoft/operational/bin/Python/anaconda_py35/bin/python'
def pathToPythonInterpreter = null
def pythonProjectName = name.replace('-', '_')
def pythonProjectVersion = version.replace('-', '_')
@@ -17,22 +19,27 @@ def finaArtifactPathZip = distDirectoryPath + finaArtifactNameZip
def pythonPathVariableName = 'pythonPath'
//Beside appropriate version following packages have to be present in python env:
//"setuptools" and "wheel"
task testPythonVersion() {
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'python', '--version'
errorOutput = stdout
}
if (project.hasProperty(pythonPathVariableName)) {
pathToPythonInterpreter = pythonPath
} else if (file(defaultPythonInterpreter).exists()) {
pathToPythonInterpreter = defaultPythonInterpreter
} else if (stdout.toString().startsWith('Python 3')) {
pathToPythonInterpreter = 'python'
} else if (exec { commandLine 'which', 'python3'; ignoreExitValue = true }.getExitValue() == 0) {
pathToPythonInterpreter = 'python3'
} else {
if (!file(pathToPythonInterpreter).exists()) {
throw new GradleException("To proceed python3 interpreter has to be provided, either as default intepreter (ran by \"python\" or \"python3\" command) or by specifying -P$pythonPathVariableName=/path/to/python3 gradle option")
}
throw new GradleException('To proceed python3 interpreter has to be provided, either as default intepreter (ran by \"python\" or \"python3\" command) ' +
'or by specifying -P$pythonPathVariableName=/path/to/python3 gradle option.' +
'Also following packages have to be present in python env: setooptools and wheel')
}
}
@@ -41,7 +48,7 @@ task cleanWheel(type: Delete) {
exec {
commandLine pathToPythonInterpreter, 'setup.py', 'clean', '--all', "--nxcals-version=$currentVersion"
}
delete distDirectoryPath, pythonProjectName + '.egg-info', fileTree('.') { include '**/*.pyc'}
delete distDirectoryPath, pythonProjectName + '.egg-info', fileTree('.') { include '**/*.pyc' }
}
Loading