Skip to content

Commit

Permalink
Make SetupRuntimeCommand version aware
Browse files Browse the repository at this point in the history
  • Loading branch information
azubieta committed Jun 22, 2022
1 parent 95b3e10 commit 58cd38d
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions appimagebuilder/commands/setup_runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from appimagebuilder.context import Context
from appimagebuilder.modules.setup.apprun_2.apprun2 import AppRunV2Setup
from appimagebuilder.commands.command import Command
from packaging import version


class SetupRuntimeCommand(Command):
Expand All @@ -24,5 +25,14 @@ def id(self):
return "runtime-setup"

def __call__(self, *args, **kwargs):
runtime = AppRunV2Setup(self.context, self._finder)
runtime.setup()
apprun_version = self.context.recipe.AppDir.runtime.version() or "v2.0.0"
apprun_version = version.parse(apprun_version)
runtime_setup = None
if (version.parse("v2.0.0") <= apprun_version < version.parse("v3.0.0")) \
or apprun_version == version.parse("continuous"):
runtime_setup = AppRunV2Setup(self.context, self._finder)

if not runtime_setup:
raise RuntimeError("Unsupported runtime version: %s" % apprun_version)

runtime_setup.setup()

0 comments on commit 58cd38d

Please sign in to comment.