add python 3.9.5

This commit is contained in:
dave 2021-06-10 19:06:17 -07:00
parent 43dc2d76ae
commit c184fb490b
12 changed files with 128 additions and 20 deletions

View File

@ -1,4 +1,6 @@
cpython
.git
temp
/src/out
/src/out
/builds/
/ssl/

4
.gitignore vendored
View File

@ -1,2 +1,2 @@
/temp
/src/out/
/src/out/
/builds/

View File

@ -1,28 +1,50 @@
extpython
=========
Isolated python installations for Ubuntu
Isolated python .deb builder
Extpython is a collection of tools for building installable packages containing various versions of Python. The
installations are isolated from the operating system's python such that modules may be added, removed, or upgraded
without risk of breaking. The builds are executed in Docker.
Example invocation:
*Example invocation:*
```
./images.sh
./build.sh trusty-3.7.3.sh
./images.sh # pulls / creates base images with dependencies
./build.sh trusty-3.9.5.sh # build using the recipe in the named script file
```
The vars file - `trusty-3.7.3.sh` above - contains information about what python version will be built. See
`src/bionic-3.7.3.sh` for an annotated example.
The vars file - `trusty-3.9.5.sh` above - contains information about what python version will be built. See
`src/bionic-3.9.5.sh` for an annotated example.
Tips:
Version support matrix
----------------------
- Python >=3.8 won't build on trusty because Openssl is too old
| Ubuntu | P 2.7 | Python 3.6 | P 3.7 | Python 3.8 | P 3.9 |
|--------|--------|------------------|-------|----------------------|--------|
| 14.04 | | 3.6.7<br />3.6.8 | | | 3.9.5* |
| 16.04 | | 3.6.7 | 3.7.3 | | 3.9.5 |
| 18.04 | 2.7.16 | 3.6.7 | 3.7.3 | 3.8.0a4<br />3.8.0b1 | 3.9.5 |
| 19.04 | | | 3.7.3 | | |
| 20.04 | | | | | 3.9.5 |
\* with extra extpython-openssl-1-1 package - see below
TODO:
Openssl
-------
- Parameter for pre-loaded pip modules
Python 3.8 and 3.9 require a version of openssl that is newer than what ships on Ubuntu 14.04. This will likely happen
with other os/version combinations in the future, but this is the only known case now.
To satisfy this requirement for Python 3.9, extpython also builds an Openssl package that installs in a similar
isolated manner.
See `./ssl/` for details.
TODO
----
* Parameter for pre-loaded pip modules

View File

@ -5,6 +5,12 @@ ln -s /src/$VARSFILE /tmp/vars.sh
. /tmp/vars.sh
. /etc/lsb-release #for DISTRIB_CODENAME
if [ -v INSIDE_SCRIPT ] ; then
echo "$INSIDE_SCRIPT" > /tmp/inside.sh
cat /tmp/inside.sh
bash -x /tmp/inside.sh
fi
# run the build
sudo -Hu builder /build.sh

View File

@ -21,10 +21,15 @@ export BUILD_DATE=$(date -R)
template /src/debian/changelog | tee debian/changelog
template /src/debian/control | tee debian/control
cp /src/debian/compat debian/
cp /src/debian/rules debian/
cp /src/Makefile ./
sed -i -E "s/_OPT_DIR_/${PYTHON_MAJOR}/" Makefile
if [ -v RULESFILE ]; then
cp /src/debian/$RULESFILE debian/rules
else
cp /src/debian/rules debian/
fi
# build the deb
time dpkg-buildpackage -us -uc -b

View File

@ -1,7 +1,7 @@
#!/usr/bin/make -f
PY3_SRC=./cpython/
PY3_CONFFLAGS=--prefix=$(DESTDIR)/opt/extpython/_OPT_DIR_ --with-ensurepip=install
PY3_CONFFLAGS=--prefix=$(DESTDIR)/opt/extpython/_OPT_DIR_ --with-ensurepip=install ${EXTRA_PY_CONFIGURE_FLAGS}
# --enable-optimizations
all:
@ -11,7 +11,7 @@ all:
install:
cd $(PY3_SRC) && \
make install
make install -j8
# $(DESTDIR)/opt/extpython/3.7.0/bin/python3 $(DESTDIR)/opt/extpython/3.7/bin/pip3 install -r requirements.txt
clean:

10
src/bionic-3.9.5.sh Normal file
View File

@ -0,0 +1,10 @@
#!/bin/bash -eux
export EXTPYTHON_DIST=bionic
export PYTHON_RELEASE=3.9.5
export PYTHON_MAJOR=3.9
export PYTHON_TARBALL="http://artifact.scc.net.davepedu.com/repo/tar/cpython/cpython/cpython-${PYTHON_RELEASE}.tar.gz"
export CPYTHON_DEPS="libssl-dev zlib1g-dev libncurses5-dev libncursesw5-dev \
libreadline-dev libsqlite3-dev libgdbm-dev libdb5.3-dev libbz2-dev libexpat1-dev liblzma-dev tk-dev libffi-dev uuid-dev"
export EXTRA_PY_CONFIGURE_FLAGS=--enable-optimizations

View File

@ -0,0 +1,13 @@
#!/usr/bin/make -f
# -*- makefile -*-
export DH_VERBOSE=1
override_dh_usrlocal:
override_dh_strip:
override_dh_shlibdeps:
dh_shlibdeps -l /opt/extpython/ssl/1.1.1k/lib
%:
dh $@

10
src/focal-3.9.5.sh Normal file
View File

@ -0,0 +1,10 @@
#!/bin/bash -eux
export EXTPYTHON_DIST=focal
export PYTHON_RELEASE=3.9.5
export PYTHON_MAJOR=3.9
export PYTHON_TARBALL="http://artifact.scc.net.davepedu.com/repo/tar/cpython/cpython/cpython-${PYTHON_RELEASE}.tar.gz"
export CPYTHON_DEPS="libssl-dev zlib1g-dev libncurses5-dev libncursesw5-dev \
libreadline-dev libsqlite3-dev libgdbm-dev libdb5.3-dev libbz2-dev libexpat1-dev liblzma-dev tk-dev libffi-dev uuid-dev"
export EXTRA_PY_CONFIGURE_FLAGS=--enable-optimizations

View File

@ -1,12 +1,8 @@
#!/bin/bash -eux
export EXTPYTHON_DIST=trusty
# Release is used to select which tarball to download
export PYTHON_RELEASE=3.6.8
# Major version no is used in paths and labels (extpython-python${}, /opt/extpython/${}/...)
export PYTHON_MAJOR=3.6
# Tarball download URL
export PYTHON_TARBALL="http://artifact.scc.net.davepedu.com/repo/tar/cpython/cpython/cpython-${PYTHON_RELEASE}.tar.gz"
# Deps needed to build this package
export CPYTHON_DEPS="libssl-dev zlib1g-dev libncurses5-dev libncursesw5-dev \
libreadline-dev libsqlite3-dev libgdbm-dev libdb5.3-dev libbz2-dev libexpat1-dev liblzma-dev tk-dev libffi-dev"

34
src/trusty-3.9.5.sh Normal file
View File

@ -0,0 +1,34 @@
#!/bin/bash -eux
# Dist chooses which ubuntu base image we build in
export EXTPYTHON_DIST=trusty
# Release is used to select which tarball to download
export PYTHON_RELEASE=3.9.5
# Major version no is used in paths and labels (extpython-python${}, /opt/extpython/${}/...)
export PYTHON_MAJOR=3.9
# Tarball download URL
export PYTHON_TARBALL="http://artifact.scc.net.davepedu.com/repo/tar/cpython/cpython/cpython-${PYTHON_RELEASE}.tar.gz"
# Dependencies needed to build cpython
export CPYTHON_DEPS="libssl-dev zlib1g-dev libncurses5-dev libncursesw5-dev \
libreadline-dev libsqlite3-dev libgdbm-dev libdb5.3-dev libbz2-dev libexpat1-dev liblzma-dev tk-dev libffi-dev uuid-dev"
# Optional script to run in the build container early in the build process
export INSIDE_SCRIPT='#!/bin/bash -eux
wget -q -O- http://artifact.scc.net.davepedu.com/repo/apt/extpython/dists/trusty/install | bash -x /dev/stdin
apt-get update -qq
apt-get install -y extpython-openssl-1-1
'
# Extra args for python's configure script
export EXTRA_PY_CONFIGURE_FLAGS=--with-openssl=/opt/extpython/ssl/1.1.1k
# Name of the rules makefile used to build the deb package
export RULESFILE=rules.trusty-3.9.5
# Other arbitrary environment variables
# trusty's native openssl is too old, so we ship a newer version. Embed the library path
export LDFLAGS=-Wl,-rpath=/opt/extpython/ssl/1.1.1k/lib

10
src/xenial-3.9.5.sh Normal file
View File

@ -0,0 +1,10 @@
#!/bin/bash -eux
export EXTPYTHON_DIST=xenial
export PYTHON_RELEASE=3.9.5
export PYTHON_MAJOR=3.9
export PYTHON_TARBALL="http://artifact.scc.net.davepedu.com/repo/tar/cpython/cpython/cpython-${PYTHON_RELEASE}.tar.gz"
export CPYTHON_DEPS="libssl-dev zlib1g-dev libncurses5-dev libncursesw5-dev \
libreadline-dev libsqlite3-dev libgdbm-dev libdb5.3-dev libbz2-dev libexpat1-dev liblzma-dev tk-dev libffi-dev uuid-dev"
export EXTRA_PY_CONFIGURE_FLAGS=--enable-optimizations