Skip to content

Commit

Permalink
Revert Python version check
Browse files Browse the repository at this point in the history
  • Loading branch information
andrey18106 committed Feb 14, 2022
1 parent c093b3c commit a7f1cc2
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions lib/Service/UtilsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,15 +162,29 @@ public function getPythonVersion(): array {
/**
* Check if installed Python version compatible with MediaDC application
*
* @return bool $isCompatible
* @return array $result
*/
public function isPythonCompatible() {
public function isPythonCompatible(): array {
$pythonVersion = $this->getPythonVersion();
if (!$pythonVersion['success']) {
$this->logger->error('[' . self::class . '] getPythonVersion: ' . json_encode($pythonVersion));
return ['success' => false, 'result_code' => $pythonVersion['result_code']];
}
return ['success' => intval(join("", explode(".", $pythonVersion['matches']))) >= 3680];
$pythonVersionDigits = explode(".", $pythonVersion['matches']);
if ((int)$pythonVersionDigits[0] >= 3) {
if ((int)$pythonVersionDigits[1] < 6) {
return ['success' => false, 'result_code' => $pythonVersion['result_code']];
}
if ((int)$pythonVersionDigits[1] > 6) {
return ['success' => true, 'result_code' => $pythonVersion['result_code']];
} else if ((int)$pythonVersionDigits[1] === 6 && (int)$pythonVersionDigits[2] >= 8) {
return ['success' => true, 'result_code' => $pythonVersion['result_code']];
}
if ((int)$pythonVersionDigits[2] >= 0) {
return ['success' => true, 'result_code' => $pythonVersion['result_code']];
}
}
return ['success' => false, 'result_code' => $pythonVersion['result_code']];
}

public function getCustomAppsDirectory() {
Expand Down

0 comments on commit a7f1cc2

Please sign in to comment.