OMG such pretty output, such async copy by default
This commit is contained in:
parent
a3a81eaca5
commit
f2bad27eb7
@ -3,4 +3,4 @@ from .base import Action
|
||||
|
||||
class Run(Action):
|
||||
async def call(self, *args, **kwargs):
|
||||
return (await self.exec(*self.args, **self.kwargs))
|
||||
return await self.exec(*self.args, **self.kwargs)
|
||||
|
||||
@ -21,7 +21,6 @@ class Actions(list):
|
||||
|
||||
|
||||
class Script(Action):
|
||||
root = '/'
|
||||
contextualize = ['shargs', 'exec', 'rexec', 'env', 'which', 'copy']
|
||||
|
||||
def __init__(self, *actions, **kwargs):
|
||||
|
||||
@ -61,10 +61,18 @@ class Buildah(Localhost):
|
||||
dst = args[-1]
|
||||
await self.mkdir(dst)
|
||||
|
||||
args = ['buildah', 'copy', self.ctr] + list(
|
||||
[str(a) for a in src]
|
||||
) + [str(dst)]
|
||||
return await self.exec(*args, buildah=False)
|
||||
procs = []
|
||||
for s in src:
|
||||
if Path(s).is_dir():
|
||||
target = self.mnt / s
|
||||
if not target.exists():
|
||||
await self.mkdir(target)
|
||||
args = ['buildah', 'copy', self.ctr, s, Path(dst) / s]
|
||||
else:
|
||||
args = ['buildah', 'copy', self.ctr, s, dst]
|
||||
procs.append(self.exec(*args, buildah=False))
|
||||
|
||||
return await asyncio.gather(*procs)
|
||||
|
||||
async def mount(self, src, dst):
|
||||
"""Mount a host directory into the container."""
|
||||
@ -87,7 +95,7 @@ class Buildah(Localhost):
|
||||
return p[len(str(self.mnt)):]
|
||||
|
||||
def is_wrapper(self):
|
||||
return (
|
||||
return not (
|
||||
Proc.test
|
||||
or os.getuid() == 0
|
||||
or getattr(self.parent, 'parent', None)
|
||||
|
||||
@ -30,6 +30,7 @@ class Localhost(Script):
|
||||
|
||||
async def exec(self, *args, **kwargs):
|
||||
kwargs.setdefault('debug', self.call_kwargs.get('debug', False))
|
||||
kwargs.setdefault('output', self.output)
|
||||
args, kwargs = self.shargs(*args, **kwargs)
|
||||
proc = await Proc(*args, **kwargs)()
|
||||
if kwargs.get('wait', True):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user