@@ -40,26 +40,27 @@ RUN apt-get update && \
4040 && apt-get clean && \
4141 rm -rf /var/lib/apt/lists/*
4242
43- ENV PYTHON_VERSION=3.14
44-
45- # The full Python version, including the minor version, is needed for download/install
46- ENV PYTHON_VERSION_WITH_MINOR=3.14.0
47-
4843# `make altinstall` is used to prevent replacing the system's default python binary.
49- RUN wget https://www.python.org/ftp/python/${PYTHON_VERSION_WITH_MINOR}/Python-${PYTHON_VERSION_WITH_MINOR}.tgz && \
44+ # The full Python version, including the minor version, is needed for download/install
45+ # TODO(https://github.com/googleapis/librarian/issues/2945): Remove `3.13` when the linked issue is resolved.
46+ RUN for PYTHON_VERSION_WITH_MINOR in 3.13.9 3.14.0; do \
47+ wget https://www.python.org/ftp/python/${PYTHON_VERSION_WITH_MINOR}/Python-${PYTHON_VERSION_WITH_MINOR}.tgz && \
5048 tar -xvf Python-${PYTHON_VERSION_WITH_MINOR}.tgz && \
5149 cd Python-${PYTHON_VERSION_WITH_MINOR} && \
5250 ./configure --enable-optimizations --prefix=/usr/local && \
5351 make -j$(nproc) && \
5452 make altinstall && \
5553 cd / && \
56- rm -rf Python-${PYTHON_VERSION_WITH_MINOR}*
54+ rm -rf Python-${PYTHON_VERSION_WITH_MINOR}* \
55+ ; done
5756
5857# Install pip for each python version
59- # TODO(http://github.com/googleapis/gapic-generator-python/issues/2435): Remove `3.10` when the linked issue is resolved.
60- RUN wget --no-check-certificate -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' && \
58+ # TODO(https://github.com/googleapis/librarian/issues/2945): Remove `3.13` when the linked issue is resolved.
59+ RUN for PYTHON_VERSION in 3.13 3.14; do \
60+ wget --no-check-certificate -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' && \
6161 python${PYTHON_VERSION} /tmp/get-pip.py && \
62- rm /tmp/get-pip.py
62+ rm /tmp/get-pip.py \
63+ ; done
6364
6465# Download/extract protoc
6566RUN wget https://github.com/protocolbuffers/protobuf/releases/download/v25.3/protoc-25.3-linux-x86_64.zip
@@ -87,7 +88,7 @@ FROM marketplace.gcr.io/google/ubuntu2404
8788# the live repo.
8889ENV SYNTHTOOL_TEMPLATES="/synthtool/synthtool/gcp/templates"
8990
90- ENV PYTHON_VERSION =3.14
91+ ENV PYTHON_VERSION_DEFAULT =3.14
9192
9293# Install only the essential runtime libraries for Python.
9394# These are the non "-dev" versions of the libraries used in the builder.
@@ -108,8 +109,12 @@ COPY --from=builder protoc/include /usr/local/include
108109COPY --from=builder pandoc-binary/bin /usr/local/bin
109110COPY --from=builder synthtool /synthtool
110111
111- COPY --from=builder /usr/local/bin/python${PYTHON_VERSION} /usr/local/bin/
112- COPY --from=builder /usr/local/lib/python${PYTHON_VERSION} /usr/local/lib/python${PYTHON_VERSION}
112+ COPY --from=builder /usr/local/bin/python${PYTHON_VERSION_DEFAULT} /usr/local/bin/
113+ COPY --from=builder /usr/local/lib/python${PYTHON_VERSION_DEFAULT} /usr/local/lib/python${PYTHON_VERSION_DEFAULT}
114+
115+ # TODO(https://github.com/googleapis/librarian/issues/2945): Remove `3.13` when the linked issue is resolved.
116+ COPY --from=builder /usr/local/bin/python3.13 /usr/local/bin
117+ COPY --from=builder /usr/local/lib/python3.13 /usr/local/lib/python3.13
113118
114119# Set the working directory in the container.
115120WORKDIR /app
@@ -119,12 +124,12 @@ WORKDIR /app
119124# Install nox which is used for running client library tests.
120125# Install starlark-pyo3 which is used to parse BUILD.bazel files.
121126COPY .generator/requirements.in .
122- RUN python${PYTHON_VERSION } -m pip install -r requirements.in
123- RUN python${PYTHON_VERSION } -m pip install /synthtool
127+ RUN python${PYTHON_VERSION_DEFAULT } -m pip install -r requirements.in
128+ RUN python${PYTHON_VERSION_DEFAULT } -m pip install /synthtool
124129
125130# Install build which is used to get the metadata of package config files.
126131COPY .generator/requirements.in .
127- RUN python${PYTHON_VERSION } -m pip install -r requirements.in
132+ RUN python${PYTHON_VERSION_DEFAULT } -m pip install -r requirements.in
128133
129134# Copy the CLI script into the container.
130135COPY .generator/cli.py .
0 commit comments