Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bugfix] Removed python check. #925

Merged
merged 2 commits into from
Jan 27, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 0 additions & 21 deletions electron/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ import { GlobalConfig } from './config'
import { LegendaryLibrary } from './legendary/library'
import { LegendaryUser } from './legendary/user'
import {
checkCommandVersion,
checkForUpdates,
clearCache,
errorHandler,
Expand Down Expand Up @@ -357,26 +356,6 @@ if (!gotTheLock) {
}, 500)
})

if (process.platform === 'linux') {
const found = await checkCommandVersion(
['python', 'python3'],
'3.8.0',
false
)

if (!found) {
dialog.showErrorBox(
i18next.t('box.error.python.title', 'Python Error!'),
i18next.t(
'box.error.python.message',
'Heroic requires Python 3.8 or newer.'
)
)
logError('Heroic requires Python 3.8 or newer.', LogPrefix.Backend)
return app.quit()
}
}

return
})
}
Expand Down
50 changes: 0 additions & 50 deletions electron/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,55 +253,6 @@ async function openUrlOrFile(url: string): Promise<string | void> {
return shell.openPath(url)
}

/**
* Checks given commands if they fullfil the given minimum version requirement.
* @param commands string list of commands to check.
* @param version minimum version to check against
* @param all_fullfil Can be set to false if only one command should fullfil
* version requirement. (default: true)
* @returns true if verrsion fullfil, else false
*/
async function checkCommandVersion(
commands: string[],
version: string,
all_fullfil = true
): Promise<boolean> {
let found = false
for (const command of commands) {
try {
const { stdout } = await execAsync(command + ' --version')
const commandVersion = stdout
? stdout.match(/(\d+\.)(\d+\.)(\d+)/g)[0]
: null

if (semverGt(commandVersion, version) || commandVersion === version) {
logInfo(
`Command '${command}' found. Version: '${commandVersion}'`,
LogPrefix.Backend
)
if (!all_fullfil) {
return true
}
found = true
} else {
logWarning(
`Command ${command} version '${commandVersion}' not supported.`,
LogPrefix.Backend
)
if (all_fullfil) {
return false
}
}
} catch {
logWarning(`${command} command not found`, LogPrefix.Backend)
if (all_fullfil) {
return false
}
}
}
return found
}

function clearCache() {
const installCache = new Store({
cwd: 'lib-cache',
Expand Down Expand Up @@ -329,7 +280,6 @@ function resetHeroic() {
}

export {
checkCommandVersion,
checkForUpdates,
errorHandler,
execAsync,
Expand Down