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(
|
podctl = Container(
|
||||||
Base('quay.io/podman/stable'),
|
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'),
|
Copy(['setup.py', 'podctl'], '/app'),
|
||||||
Pip('/app'),
|
Pip('/app', pip='pip3.8'),
|
||||||
Config(cmd='podctl', author='jpic'),
|
Config(cmd='podctl', author='jpic'),
|
||||||
Commit('docker.io/yourlabs/podctl'),
|
Commit('docker.io/yourlabs/podctl'),
|
||||||
)
|
)
|
||||||
|
|||||||
@ -1,17 +1,21 @@
|
|||||||
class Pip:
|
class Pip:
|
||||||
def __init__(self, *pip_packages):
|
def __init__(self, *pip_packages, pip=None):
|
||||||
self.pip_packages = pip_packages
|
self.pip_packages = pip_packages
|
||||||
|
self.pip = pip
|
||||||
|
|
||||||
def build(self, script):
|
def build(self, script):
|
||||||
script.append(f'''
|
if self.pip:
|
||||||
if {script._run("bash -c 'type pip3'")}; then
|
script.append('_pip=' + self.pip)
|
||||||
_pip=pip3
|
else:
|
||||||
elif {script._run("bash -c 'type pip'")}; then
|
script.append(f'''
|
||||||
_pip=pip
|
if {script._run("bash -c 'type pip3'")}; then
|
||||||
elif {script._run("bash -c 'type pip2'")}; then
|
_pip=pip3
|
||||||
_pip=pip2
|
elif {script._run("bash -c 'type pip'")}; then
|
||||||
fi
|
_pip=pip
|
||||||
''')
|
elif {script._run("bash -c 'type pip2'")}; then
|
||||||
|
_pip=pip2
|
||||||
|
fi
|
||||||
|
''')
|
||||||
script.mount('.cache/pip', '/root/.cache/pip')
|
script.mount('.cache/pip', '/root/.cache/pip')
|
||||||
script.run('sudo $_pip install --upgrade pip')
|
script.run('sudo $_pip install --upgrade pip')
|
||||||
source = [p for p in self.pip_packages if p.startswith('/')]
|
source = [p for p in self.pip_packages if p.startswith('/')]
|
||||||
|
|||||||
@ -4,4 +4,6 @@ class Run:
|
|||||||
|
|
||||||
def build(self, script):
|
def build(self, script):
|
||||||
for command in self.commands:
|
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