Skip to content

Commit

Permalink
Update bundled python to 3.12.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffreyc-splunk committed Oct 4, 2023
1 parent c38e23d commit 2313629
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 23 deletions.
31 changes: 15 additions & 16 deletions internal/signalfx-agent/bundle/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
ARG ARCH=amd64
ARG JDK_VERSION=11.0.20.1_1
ARG MAVEN_VERSION=3.6.0
ARG PYTHON_VERSION=3.11.6
ARG PIP_VERSION=21.0.1
ARG PYTHON_VERSION=3.12.0
ARG PIP_VERSION=23.2.1
ARG COLLECTD_VERSION=5.8.0-sfx0
ARG COLLECTD_COMMIT=4d3327b14cf4359029613baf4f90c4952702105e
ARG DOCKER_REPO=docker.io
Expand Down Expand Up @@ -258,9 +258,9 @@ RUN DISABLE_XENCPU=""; if [ "$ARCH" = "ppc64le" ]; then DISABLE_XENCPU="--disabl
--disable-silent-rules \
--disable-static \
--with-java=${JAVA_HOME} \
LIBPYTHON_LDFLAGS="$(python3.11-config --ldflags) -lpython3.11" \
LIBPYTHON_CPPFLAGS="$(python3.11-config --includes)/cpython" \
LIBPYTHON_LIBS="$(python3.11-config --libs) -lpython3.11"
LIBPYTHON_LDFLAGS="$(python3.12-config --ldflags) -lpython3.12" \
LIBPYTHON_CPPFLAGS="$(python3.12-config --includes)/cpython" \
LIBPYTHON_LIBS="$(python3.12-config --libs) -lpython3.12"

# Compile all of collectd first, including plugins
RUN make -j`nproc` &&\
Expand All @@ -286,12 +286,11 @@ COPY scripts/get-collectd-plugins.py /opt/scripts/
COPY scripts/requirements.txt /opt/
COPY collectd-plugins.yaml /opt/

RUN /usr/local/bin/python3 -m pip install -r /opt/requirements.txt

# workaround for https://github.com/yaml/pyyaml/issues/724
RUN /usr/local/bin/python3 -m pip install 'wheel==0.40.0'
RUN /usr/local/bin/python3 -m pip install 'Cython<3.0' 'PyYaml~=5.0' --no-build-isolation

RUN /usr/local/bin/python3 -m pip install -r /opt/requirements.txt

RUN mkdir -p /opt/collectd-python &&\
/usr/local/bin/python3 -u /opt/scripts/get-collectd-plugins.py /opt/collectd-python

Expand All @@ -310,15 +309,15 @@ RUN /usr/local/bin/python3 -m pip list
# Remove pip to avoid usage in python monitor and in exec'd container
RUN /usr/local/bin/python3 -m pip uninstall pip -y
# Delete all bundled wheels
RUN find /usr/local/lib/python3.11 -name "*.whl" -delete
RUN find /usr/local/lib/python3.12 -name "*.whl" -delete

# Delete all compiled python to save space
RUN find /usr/local/lib/python3.11 -name "*.pyc" -o -name "*.pyo" | xargs rm
RUN find /usr/local/lib/python3.12 -name "*.pyc" -o -name "*.pyo" | xargs rm
# We don't support compiling extension modules so don't need this directory
RUN rm -rf /usr/local/lib/python3.11/config-*-linux-gnu
RUN rm -rf /usr/local/lib/python3.12/config-*-linux-gnu

RUN find /usr/local/lib/python3.11 -type d -name __pycache__ | xargs rm -rf {} \;
RUN find /usr/local/lib/python3.11 -wholename "*test*.key" -delete -or -wholename "*test*.pem" -delete
RUN find /usr/local/lib/python3.12 -type d -name __pycache__ | xargs rm -rf {} \;
RUN find /usr/local/lib/python3.12 -wholename "*test*.key" -delete -or -wholename "*test*.pem" -delete


######## Extra packages that don't make sense to pull down in any other stage ########
Expand Down Expand Up @@ -370,9 +369,9 @@ RUN mkdir -p /opt/root/bin &&\
COPY --from=collectd /usr/local/bin/patchelf /usr/bin/

# Gather Python dependencies
COPY --from=python-plugins /usr/local/lib/python3.11 /opt/root/lib/python3.11
COPY --from=python-plugins /usr/local/lib/libpython3.11.so.1.0 /opt/root/lib
COPY --from=python-plugins /usr/local/bin/python3.11 /opt/root/bin/python
COPY --from=python-plugins /usr/local/lib/python3.12 /opt/root/lib/python3.12
COPY --from=python-plugins /usr/local/lib/libpython3.12.so.1.0 /opt/root/lib
COPY --from=python-plugins /usr/local/bin/python3.12 /opt/root/bin/python

# Gather compiled collectd plugin libraries
COPY --from=collectd /usr/sbin/collectd /opt/root/bin/collectd
Expand Down
2 changes: 1 addition & 1 deletion internal/signalfx-agent/bundle/scripts/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PyYAML~=5.0
WMI==1.5.1; sys_platform == "win32"
dbus-python==1.3.2; sys_platform == "linux"
setuptools==68.2.2
wheel==0.41.2
11 changes: 5 additions & 6 deletions internal/signalfx-agent/bundle/scripts/windows/bundle.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ $repoDir = "$scriptDir\..\..\..\..\.."
. $scriptDir\common.ps1

$BUILD_DIR="$repoDir\build"
$PYTHON_VERSION="3.11.6"
$PIP_VERSION="21.0.1"
$PYTHON_VERSION="3.12.0"
$PIP_VERSION="23.2.1"
$NUGET_URL="https://aka.ms/nugetclidl"
$NUGET_EXE="nuget.exe"

Expand All @@ -37,13 +37,12 @@ function get_collectd_plugins ([string]$buildDir=$BUILD_DIR) {
$script = Resolve-Path "$scriptDir\..\get-collectd-plugins.py"
$python = Resolve-Path "$buildDir\python\python.exe"

# workaround for https://github.com/yaml/pyyaml/issues/724
& $python -m pip install 'wheel==0.40.0'
& $python -m pip install 'Cython<3.0' 'PyYaml~=5.0' --no-build-isolation

& $python -m pip install -qq -r $requirements
if ($lastexitcode -ne 0){ throw }

# workaround for https://github.com/yaml/pyyaml/issues/724
& $python -m pip install 'Cython<3.0' 'PyYaml~=5.0' --no-build-isolation

& $python $script $collectdPlugins
if ($lastexitcode -ne 0){ throw }

Expand Down

0 comments on commit 2313629

Please sign in to comment.