Skip to content
This repository was archived by the owner on Jun 30, 2024. It is now read-only.

Commit c4e5bde

Browse files
authored
Merge pull request #1976 from bjones1/collect-versions
Clean: Collect version numbers in one place in docker-tools script.
2 parents 444c4a5 + aab5efc commit c4e5bde

File tree

1 file changed

+22
-14
lines changed

1 file changed

+22
-14
lines changed

docker/docker_tools.py

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,17 @@ def pip_user() -> str:
180180
print("Note: this must be an initial install; additional commands missing.")
181181

182182

183+
# Global variables
184+
# ================
185+
# Update the following versions regularly.
186+
CHROMEDRIVER_VERSION = "103.0.5060.53"
187+
WEB2PY_VERSION = "2.21.1"
188+
XC16_VERSION = "xc16-v1.70-full-install-linux64-installer.run"
189+
MPLABX_VERSION = "MPLABX-v6.00-linux-installer.tar"
190+
# These are sometimes not the same base name (depends on the MPLABX release).
191+
MPLABX_SH_NAME = "MPLABX-v6.00-linux-installer.sh"
192+
193+
183194
# CLI
184195
# ===
185196
# Create a series of subcommands for this CLI.
@@ -707,7 +718,7 @@ def _build_phase_1(
707718
# Tests use `html5validator <https://github.com/svenkreiss/html5validator>`_, which requires the JDK.
708719
f"{apt_install} openjdk-11-jre-headless git xvfb x11-utils {browser} lsof emacs-nox",
709720
# Install Chromedriver. Based on https://tecadmin.net/setup-selenium-with-chromedriver-on-debian/.
710-
"wget --no-verbose https://chromedriver.storage.googleapis.com/103.0.5060.53/chromedriver_linux64.zip",
721+
f"wget --no-verbose https://chromedriver.storage.googleapis.com/{CHROMEDRIVER_VERSION}/chromedriver_linux64.zip",
711722
"unzip chromedriver_linux64.zip",
712723
"rm chromedriver_linux64.zip",
713724
"mv chromedriver /usr/bin/chromedriver",
@@ -726,29 +737,26 @@ def _build_phase_1(
726737

727738
if pic24:
728739
# When changing the xc16 version, update the string below **and** the path added at the end of this block.
729-
xc16_ver = "xc16-v1.70-full-install-linux64-installer.run"
730-
mplabx_ver = "MPLABX-v6.00-linux-installer.tar"
731-
mplabx_sh = "MPLABX-v6.00-linux-installer.sh"
732740
xqt(
733741
# Install the xc16 compiler.
734-
f"eatmydata wget --no-verbose https://ww1.microchip.com/downloads/en/DeviceDoc/{xc16_ver}",
735-
f"chmod a+x {xc16_ver}",
742+
f"eatmydata wget --no-verbose https://ww1.microchip.com/downloads/en/DeviceDoc/{XC16_VERSION}",
743+
f"chmod a+x {XC16_VERSION}",
736744
# The installer complains if the netserver name isn't specified. This option isn't documented in the ``--help``. So, supply junk, and it seems to work.
737-
f"eatmydata ./{xc16_ver} --mode unattended --netservername foo",
738-
f"rm {xc16_ver}",
745+
f"eatmydata ./{XC16_VERSION} --mode unattended --netservername foo",
746+
f"rm {XC16_VERSION}",
739747
# MPLAB X install
740748
#
741749
# Needed to run sim30: per https://unix.stackexchange.com/questions/486806/steam-missing-32-bit-libraries-libx11-6, enable 32-bit libs.
742750
"eatmydata dpkg --add-architecture i386",
743751
"eatmydata apt-get update",
744752
"eatmydata apt-get install -y lib32stdc++6 libc6:i386",
745753
# Then download and install MPLAB X.
746-
f'eatmydata wget --no-verbose "https://ww1.microchip.com/downloads/en/DeviceDoc/{mplabx_ver}"',
747-
f'eatmydata tar -xf "{mplabx_ver}"',
748-
f'rm "{mplabx_ver}"',
754+
f'eatmydata wget --no-verbose "https://ww1.microchip.com/downloads/en/DeviceDoc/{MPLABX_VERSION}"',
755+
f'eatmydata tar -xf "{MPLABX_VERSION}"',
756+
f'rm "{MPLABX_VERSION}"',
749757
# Install just the IDE and the 16-bit tools. This program checks to see if this is being run by root by looking at the ``USER`` env var, which Docker doesn't set. Fake it out.
750-
f'USER=root eatmydata "./{mplabx_sh}" -- --mode unattended --ipe 0 --8bitmcu 0 --32bitmcu 0 --othermcu 0',
751-
f'rm "{mplabx_sh}"',
758+
f'USER=root eatmydata "./{MPLABX_SH_NAME}" -- --mode unattended --ipe 0 --8bitmcu 0 --32bitmcu 0 --othermcu 0',
759+
f'rm "{MPLABX_SH_NAME}"',
752760
)
753761
# Add the path to the xc16 tools. Note that ``/root/.bashrc`` doesn't get sourced when Docker starts up; therefore, the `../Dockerfile` invokes bash when running the startup script.
754762
with open("/root/.bashrc", "a", encoding="utf-8") as f:
@@ -781,7 +789,7 @@ def _build_phase_1(
781789
)
782790
w2p_parent = Path(env.WEB2PY_PATH).parent
783791
xqt(
784-
"eatmydata wget --no-verbose https://mdipierro.pythonanywhere.com/examples/static/2.21.1/web2py_src.zip",
792+
f"eatmydata wget --no-verbose https://mdipierro.pythonanywhere.com/examples/static/{WEB2PY_VERSION}/web2py_src.zip",
785793
"eatmydata unzip -q web2py_src.zip",
786794
"rm -f web2py_src.zip",
787795
cwd=w2p_parent,

0 commit comments

Comments
 (0)