Skip to content

Commit

Permalink
Drop Python2.7 from the docker builds, and default to gtk3 only
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinD42 committed Jul 31, 2020
1 parent 28b710f commit 07a1e9e
Show file tree
Hide file tree
Showing 13 changed files with 60 additions and 38 deletions.
4 changes: 3 additions & 1 deletion docker/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ this writing you can pull images with these names and tags:
wxpython4/build:debian-10
wxpython4/build:fedora-29
wxpython4/build:fedora-30
wxpython4/build:fedora-31
wxpython4/build:ubuntu-14.04
wxpython4/build:ubuntu-16.04
wxpython4/build:ubuntu-18.04
wxpython4/build:ubuntu-20.04


Building Images
Expand All @@ -36,7 +38,7 @@ Since images are available on DockerHub there shouldn't be much need for
building them yourself, but just in case, here is how to do it. All images
can be built with a simple command like this::

inv build-images
inv build-images

And one or more specific images can be built like this::

Expand Down
6 changes: 3 additions & 3 deletions docker/build/centos-7/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ ENV GTK2_OK=yes

# Update and install basic OS packages
RUN \
yum -y install https://centos7.iuscommunity.org/ius-release.rpm; \
yum -y install https://repo.ius.io/ius-release-el7.rpm \
https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm; \
yum -y update; \
yum -y group install development; \
yum -y install sudo nano which; \
Expand Down Expand Up @@ -41,7 +42,7 @@ RUN \
# Install all available Python packages and their dev packages
yum -y install python python-tools python-devel python-virtualenv; \
yum -y install python36u python36u-tools python36u-devel; \
# CLean up the yum caches
# Clean up the yum caches
yum clean all;

# Set the user and group to use for the rest of the commands
Expand All @@ -54,7 +55,6 @@ WORKDIR ${HOME}
RUN \
cd ${HOME}; \
mkdir -p ${HOME}/venvs; \
python2.7 -m virtualenv --python=python2.7 venvs/Py27; \
python3.6 -m venv venvs/Py36;

# Add files from host into the container
Expand Down
6 changes: 4 additions & 2 deletions docker/build/centos-8/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ RUN \
webkit2gtk3-devel; \
# Install all available Python packages and their dev packages
yum -y install python3 python3-tools python3-devel; \
# CLean up the yum caches
yum -y install python38 python38-devel; \
# Clean up the yum caches
yum clean all;

# Set the user and group to use for the rest of the commands
Expand All @@ -54,7 +55,8 @@ WORKDIR ${HOME}
RUN \
cd ${HOME}; \
mkdir -p ${HOME}/venvs; \
python3.6 -m venv venvs/Py36;
python3.6 -m venv venvs/Py36; \
python3.8 -m venv venvs/Py38;

# Add files from host into the container
COPY scripts ${HOME}/bin
Expand Down
6 changes: 2 additions & 4 deletions docker/build/debian-10/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,10 @@ RUN \
libtiff-dev \
libwebkit2gtk-4.0-dev \
libxtst-dev; \
apt-get clean;
apt-get clean;

# Install all available Python packages and their dev packages
RUN \
apt-get install -y python2.7 python2.7-dev libpython2.7-dev python-virtualenv; \
apt-get install -y python3.7 python3.7-dev libpython3.7-dev python3.7-venv; \
apt-get clean;

Expand All @@ -56,8 +55,7 @@ WORKDIR ${HOME}
RUN \
cd ${HOME}; \
mkdir -p ${HOME}/venvs; \
virtualenv --python=python2.7 venvs/Py27; \
python3.7 -m venv venvs/Py37;
python3.7 -m venv venvs/Py37;

# Add files from host into the container
COPY scripts ${HOME}/bin
Expand Down
6 changes: 2 additions & 4 deletions docker/build/debian-9/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,10 @@ RUN \
libwebkit2gtk-4.0-dev \
libwebkitgtk-dev \
libxtst-dev; \
apt-get clean;
apt-get clean;

# Install all available Python packages and their dev packages
RUN \
apt-get install -y python2.7 python2.7-dev libpython2.7-dev python-virtualenv; \
apt-get install -y python3.5 python3.5-dev libpython3.5-dev python3.5-venv; \
apt-get clean;

Expand All @@ -58,8 +57,7 @@ WORKDIR ${HOME}
RUN \
cd ${HOME}; \
mkdir -p ${HOME}/venvs; \
virtualenv --python=python2.7 venvs/Py27; \
python3.5 -m venv venvs/Py35;
python3.5 -m venv venvs/Py35;

# Add files from host into the container
COPY scripts ${HOME}/bin
Expand Down
9 changes: 4 additions & 5 deletions docker/build/fedora-29/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ RUN \
gstreamer1-devel \
gstreamer1-plugins-base-devel \
gtk3-devel \
libjpeg-turbo-devel \
libnotify-devel \
libjpeg-turbo-devel \
libnotify-devel \
libpng-devel \
libSM-devel \
libtiff-devel \
Expand All @@ -36,7 +36,7 @@ RUN \
dnf -y install python2 python2-tools python2-devel python2-virtualenv; \
dnf -y install python3 python3-tools python3-devel; \
dnf -y install python36; \
# CLean up dnf caches
# Clean up dnf caches
dnf clean all;


Expand All @@ -50,9 +50,8 @@ WORKDIR ${HOME}
RUN \
cd ${HOME}; \
mkdir -p ${HOME}/venvs; \
python2.7 -m virtualenv --python=python2.7 venvs/Py27; \
python3.6 -m venv venvs/Py36; \
python3.7 -m venv venvs/Py37;
python3.7 -m venv venvs/Py37;

# Add files from host into the container
COPY scripts ${HOME}/bin
Expand Down
6 changes: 2 additions & 4 deletions docker/build/fedora-30/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,9 @@ RUN \
SDL-devel \
webkit2gtk3-devel; \
# Install all available Python packages and their dev packages
dnf -y install python2 python2-tools python2-devel python2-virtualenv; \
dnf -y install python3 python3-tools python3-devel; \
dnf -y install python36; \
# CLean up dnf caches
# Clean up dnf caches
dnf clean all;


Expand All @@ -50,9 +49,8 @@ WORKDIR ${HOME}
RUN \
cd ${HOME}; \
mkdir -p ${HOME}/venvs; \
python2.7 -m virtualenv --python=python2.7 venvs/Py27; \
python3.6 -m venv venvs/Py36; \
python3.7 -m venv venvs/Py37;
python3.7 -m venv venvs/Py37;

# Add files from host into the container
COPY scripts ${HOME}/bin
Expand Down
2 changes: 1 addition & 1 deletion docker/build/fedora-31/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ RUN \
# Install all available Python packages and their dev packages
dnf -y install python3 python3-tools python3-devel; \
dnf -y install python38; \
# CLean up dnf caches
# Clean up dnf caches
dnf clean all;


Expand Down
6 changes: 2 additions & 4 deletions docker/build/ubuntu-14.04/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,12 @@ RUN \
libwebkitgtk-3.0-dev \
libwebkitgtk-dev \
libxtst-dev; \
apt-get clean;
apt-get clean;


# Install all available Python packages and their dev packages
RUN \
if [ ${USE_DEADSNAKES} = yes ]; then add-apt-repository ppa:deadsnakes/ppa; apt-get update; fi; \
apt-get install -y python2.7 python2.7-dev libpython2.7-dev python-virtualenv; \
apt-get install -y python3.5 python3.5-dev libpython3.5-dev python3.5-venv; \
apt-get install -y python3.6 python3.6-dev libpython3.6-dev python3.6-venv; \
apt-get clean;
Expand All @@ -62,9 +61,8 @@ WORKDIR ${HOME}
RUN \
cd ${HOME}; \
mkdir -p ${HOME}/venvs; \
virtualenv --python=python2.7 venvs/Py27; \
python3.5 -m venv venvs/Py35; \
python3.6 -m venv venvs/Py36;
python3.6 -m venv venvs/Py36;

# Add files from host into the container
COPY scripts ${HOME}/bin
Expand Down
4 changes: 1 addition & 3 deletions docker/build/ubuntu-16.04/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,12 @@ RUN \
libwebkitgtk-3.0-dev \
libwebkitgtk-dev \
libxtst-dev; \
apt-get clean;
apt-get clean;


# Install all available Python packages and their dev packages
RUN \
if [ ${USE_DEADSNAKES} = yes ]; then add-apt-repository ppa:deadsnakes/ppa; apt-get update; fi; \
apt-get install -y python2.7 python2.7-dev libpython2.7-dev python-virtualenv; \
apt-get install -y python3.6 python3.6-dev libpython3.6-dev python3.6-venv; \
apt-get install -y python3.8 python3.8-dev libpython3.8-dev python3.8-venv; \
apt-get clean;
Expand All @@ -60,7 +59,6 @@ WORKDIR ${HOME}
RUN \
cd ${HOME}; \
mkdir -p ${HOME}/venvs; \
virtualenv --python=python2.7 venvs/Py27; \
python3.6 -m venv venvs/Py36; \
python3.7 -m venv venvs/Py37; \
python3.8 -m venv venvs/Py38;
Expand Down
4 changes: 1 addition & 3 deletions docker/build/ubuntu-18.04/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,11 @@ RUN \
libwebkit2gtk-4.0-dev \
libwebkitgtk-dev \
libxtst-dev; \
apt-get clean;
apt-get clean;

# Install all available Python packages and their dev packages
RUN \
if [ ${USE_DEADSNAKES} = yes ]; then add-apt-repository ppa:deadsnakes/ppa; apt-get update; fi; \
apt-get install -y python2.7 python2.7-dev libpython2.7-dev python-virtualenv; \
apt-get install -y python3.6 python3.6-dev libpython3.6-dev python3.6-venv; \
apt-get install -y python3.7 python3.7-dev libpython3.7-dev python3.7-venv; \
apt-get install -y python3.8 python3.8-dev libpython3.8-dev python3.8-venv; \
Expand All @@ -69,7 +68,6 @@ WORKDIR ${HOME}
RUN \
cd ${HOME}; \
mkdir -p ${HOME}/venvs; \
virtualenv --python=python2.7 venvs/Py27; \
python3.6 -m venv venvs/Py36; \
python3.7 -m venv venvs/Py37; \
python3.8 -m venv venvs/Py38;
Expand Down
1 change: 1 addition & 0 deletions docker/scripts/hello.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ echo " User: " $(whoami)
echo " ~/bin: " $(ls ~/bin)
echo " ~/venvs:" $(ls ~/venvs)
echo " /dist: " $(ls /dist)
echo " GTK2_OK: " $GTK2_OK
echo ""

if [ -x /usr/bin/lsb_release ]; then
Expand Down
38 changes: 34 additions & 4 deletions docker/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,29 @@ def build_images(ctx, image, gui=False):
'-t wxpython4/{type}:{name} .'.format(name=img_name, type=img_type),
pty=True, echo=True)
# test it
test_images(ctx, [img_name], gui)


@task(
aliases=['test_image', 'ti'],
help={
'image': 'Name of a docker image to test. May be specified more than once. Defaults to all.',
'gui': 'Test the gui version of an image instead of just the build image.',
},
iterable=['image'],
)
def test_images(ctx, image, gui=False):
"""
Build docker image(s).
"""
if image == []:
image = _get_all_distros(gui)

os.chdir(HERE)
dist=os.path.abspath('../dist')
img_type = 'gui' if gui else 'build'
for img_name in image:
# test it
ctx.run('docker run -it --rm -v {}:/dist '
'wxpython4/{}:{} hello.sh'.format(dist, img_type, img_name),
pty=True, echo=True)
Expand Down Expand Up @@ -72,17 +95,16 @@ def push(ctx, image, gui=False):
pty=True, echo=True)



@task(
aliases=['build_wxp', 'bwxp'],
help={
'image':'Name of a docker image to use for building. May be specified more than once. Defaults to all.',
'port': 'One of gtk2, gtk3 or all. Defaults to all.',
'port': 'One of "gtk2", "gtk3" or "all". Defaults to "gtk3".',
'venv': 'The name of a Python virtual environment to use for the build, like Py27, Py36, etc. Defaults to all.'
},
iterable=['image'],
)
def build_wxpython(ctx, image, venv='all', port='all'):
def build_wxpython(ctx, image, venv='all', port='gtk3'):
"""
Use docker images to build wxPython.
Expand All @@ -100,6 +122,7 @@ def build_wxpython(ctx, image, venv='all', port='all'):
'wxpython4/build:{} do-build.sh {} {}'.format(dist, img_name, venv, port),
pty=True, echo=True)


@task(
help={
'image_tag':"The tag of the image to be run",
Expand Down Expand Up @@ -128,5 +151,12 @@ def run(ctx, image_tag, cmd=None, gui=False, port=5901, keep=False):
def _get_all_distros(gui=False):
os.chdir(HERE)
wildcard = os.path.join('gui' if gui else 'build', '*-*')
all_matching = glob.glob(wildcard)
all_matching = sorted(glob.glob(wildcard))
return [os.path.basename(item) for item in all_matching]


@task()
def showall(ctx, gui=False):
images = _get_all_distros(gui)
for img in images:
print(img)

0 comments on commit 07a1e9e

Please sign in to comment.