Install multiple pythons on CircleCI
This commit is contained in:
parent
8182fcecd2
commit
dc6e276e39
@ -1,7 +1,7 @@
|
|||||||
FROM ubuntu:latest
|
FROM ubuntu:latest
|
||||||
|
|
||||||
# System setup
|
# System setup
|
||||||
RUN apt-get update && apt-get install -y python3-flake8 python3-pip python3-pil clang git openssh-client make-guile
|
RUN apt-get update && apt-get install -y python3-flake8 python3-pip python3-pil clang git openssh-client build-essential libreadline-dev zlib1g-dev libssl-dev libbz2-dev libsqlite3-dev libffi-dev
|
||||||
|
|
||||||
# kitty deps
|
# kitty deps
|
||||||
RUN apt-get install -y libgl1-mesa-dev libxi-dev libxrandr-dev libxinerama-dev libxcursor-dev libxcb-xkb-dev libdbus-1-dev libxkbcommon-dev libharfbuzz-dev libpng-dev libfontconfig-dev libpython3-dev libxkbcommon-x11-dev python3-pygments
|
RUN apt-get install -y libgl1-mesa-dev libxi-dev libxrandr-dev libxinerama-dev libxcursor-dev libxcb-xkb-dev libdbus-1-dev libxkbcommon-dev libharfbuzz-dev libpng-dev libfontconfig-dev libpython3-dev libxkbcommon-x11-dev python3-pygments
|
||||||
@ -9,5 +9,10 @@ RUN apt-get install -y libgl1-mesa-dev libxi-dev libxrandr-dev libxinerama-dev l
|
|||||||
# Needed to build kitty docs
|
# Needed to build kitty docs
|
||||||
RUN pip3 install sphinx
|
RUN pip3 install sphinx
|
||||||
|
|
||||||
|
# Install multiple pythons
|
||||||
|
ADD install-python.py /tmp/install-python.py
|
||||||
|
RUN python3 /tmp/install-python.py py3.5 https://www.python.org/ftp/python/3.5.6/Python-3.5.6.tar.xz
|
||||||
|
RUN python3 /tmp/install-python.py py3.7 https://www.python.org/ftp/python/3.7.2/Python-3.7.2.tar.xz
|
||||||
|
|
||||||
LABEL com.circleci.preserve-entrypoint=true
|
LABEL com.circleci.preserve-entrypoint=true
|
||||||
ENTRYPOINT sleep 2h
|
ENTRYPOINT sleep 2h
|
||||||
|
|||||||
41
.circleci/images/install-python.py
Normal file
41
.circleci/images/install-python.py
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# vim:fileencoding=utf-8
|
||||||
|
# License: GPLv3 Copyright: 2019, Kovid Goyal <kovid at kovidgoyal.net>
|
||||||
|
|
||||||
|
import io
|
||||||
|
import os
|
||||||
|
import shlex
|
||||||
|
import shutil
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
import tarfile
|
||||||
|
from urllib.request import urlopen
|
||||||
|
|
||||||
|
PY, URL = sys.argv[1], sys.argv[2]
|
||||||
|
SRC = f'/usr/src/{PY}'
|
||||||
|
|
||||||
|
os.chdir('/usr/src')
|
||||||
|
before = frozenset(os.listdir('.'))
|
||||||
|
|
||||||
|
|
||||||
|
def run(cmd):
|
||||||
|
cmd = shlex.split(cmd)
|
||||||
|
p = subprocess.Popen(cmd)
|
||||||
|
if p.wait() != 0:
|
||||||
|
raise SystemExit(p.returncode)
|
||||||
|
|
||||||
|
|
||||||
|
with urlopen(URL) as f:
|
||||||
|
data = f.read()
|
||||||
|
|
||||||
|
with tarfile.open(fileobj=io.BytesIO(data), mode='r:xz') as tf:
|
||||||
|
tf.extractall()
|
||||||
|
after = frozenset(os.listdir('.'))
|
||||||
|
src_dir = tuple(after - before)[0]
|
||||||
|
os.rename(src_dir, SRC)
|
||||||
|
os.chdir(SRC)
|
||||||
|
run(f'./configure --prefix=/opt/{PY} --enable-shared --with-system-expat --with-system-ffi --without-ensurepip')
|
||||||
|
run(f'make -j {os.cpu_count()}')
|
||||||
|
run('make install')
|
||||||
|
os.chdir('/')
|
||||||
|
shutil.rmtree(SRC)
|
||||||
Loading…
x
Reference in New Issue
Block a user