mirror of
ssh://git.janware.com/janware/proj/jw-pkg
synced 2026-04-28 11:25:23 +02:00
App.distro_xxx: Move properties to Distro.xxx
Commit a19679fec reverted the first attempt to make AsyncSSH reuse
one connection during an instance lifetime. That failed because a lot
of distribution-specific properties were filled in a new event loop
thread started by AsyncRunner, and AsyncSSH didn't like that.
This commit is the first part of the solution: Move those properties
from the App class to the Distro class, and load the Distro class
in an async loader. As soon as it's instantiated, it can provide all
its properties without cluttering the code with async keywords.
Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
003d53b310
commit
aa7275f426
7 changed files with 241 additions and 231 deletions
|
|
@ -15,8 +15,8 @@ class CmdInstall(Cmd): # export
|
|||
parser.add_argument("names", nargs="*", help="Packages to be installed")
|
||||
parser.add_argument('--only-update', default=False, action='store_true', help='Only update the listed packages, don\'t install them')
|
||||
parser.add_argument('-F', '--fixed-strings', action='store_true',
|
||||
help='Don\'t expand platform info macros in <names>')
|
||||
help='Don\'t expand platform.expand_macros macros in <names>')
|
||||
|
||||
async def _run(self, args: Namespace) -> None:
|
||||
names = names if args.fixed_strings else self.app.distro_info(args.names)
|
||||
names = names if args.fixed_strings else self.app.distro.expand_macros(args.names)
|
||||
return await self.distro.install(names, only_update=args.only_update)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue