Multiline Run scripts, and going pretty far for python 3.8
This commit is contained in:
parent
c88aea9ba9
commit
895f0e164b
11
pod.py
11
pod.py
@ -8,9 +8,16 @@ from podctl import *
|
||||
|
||||
podctl = Container(
|
||||
Base('quay.io/podman/stable'),
|
||||
Packages('python3', 'buildah', mgr='dnf'),
|
||||
Packages('python38', 'buildah', 'unzip', mgr='dnf'),
|
||||
Run('''
|
||||
curl -o setuptools.zip https://files.pythonhosted.org/packages/42/3e/2464120172859e5d103e5500315fb5555b1e908c0dacc73d80d35a9480ca/setuptools-45.1.0.zip
|
||||
unzip setuptools.zip
|
||||
mkdir -p /usr/local/lib/python3.8/site-packages/
|
||||
sh -c "cd setuptools-* && python3.8 setup.py install"
|
||||
easy_install-3.8 pip
|
||||
'''),
|
||||
Copy(['setup.py', 'podctl'], '/app'),
|
||||
Pip('/app'),
|
||||
Pip('/app', pip='pip3.8'),
|
||||
Config(cmd='podctl', author='jpic'),
|
||||
Commit('docker.io/yourlabs/podctl'),
|
||||
)
|
||||
|
||||
@ -1,8 +1,12 @@
|
||||
class Pip:
|
||||
def __init__(self, *pip_packages):
|
||||
def __init__(self, *pip_packages, pip=None):
|
||||
self.pip_packages = pip_packages
|
||||
self.pip = pip
|
||||
|
||||
def build(self, script):
|
||||
if self.pip:
|
||||
script.append('_pip=' + self.pip)
|
||||
else:
|
||||
script.append(f'''
|
||||
if {script._run("bash -c 'type pip3'")}; then
|
||||
_pip=pip3
|
||||
|
||||
@ -4,4 +4,6 @@ class Run:
|
||||
|
||||
def build(self, script):
|
||||
for command in self.commands:
|
||||
script.run(command)
|
||||
for line in command.split('\n'):
|
||||
if line.strip():
|
||||
script.run(line.strip())
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user