Skip to content
This repository was archived by the owner on Oct 3, 2023. It is now read-only.

Python #6927

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Python #6927

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/test-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ jobs:
if ${IS_PR}; then
echo "### This is PR ${PR}"
TOOLS="$(
curl https://api.github.com/repos/${GITHUB_REPOSITORY}/pulls/${PR}/files \
curl --url https://api.github.com/repos/${GITHUB_REPOSITORY}/pulls/${PR}/files \
--silent \
--fail \
--header "Accept: application/vnd.github.v3+json" \
--header 'Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
| jq --raw-output '.[].filename' \
| jq --raw-output '.[] | select(.status != "removed") | .filename' \
| grep -E '^tools/[^/]+/' \
| cut -d/ -f2 \
| uniq \
Expand Down
18 changes: 0 additions & 18 deletions tools/python-build-standalone/Dockerfile.template

This file was deleted.

32 changes: 32 additions & 0 deletions tools/python-static/Dockerfile.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#syntax=docker/dockerfile:1.6.0

ARG ref=main

FROM ghcr.io/nicholasdille/docker-setup/base:${ref} AS prepare
ARG name
ARG version
ARG PYTHON_VERSION=3.11.3
RUN <<EOF
echo "### Setting architecture string for ${TARGETPLATFORM}"
case "${arch}" in
x86_64)
export arch_suffix="${arch}-unknown-linux-musl"
;;
aarch64)
export arch_suffix="${arch}-unknown-linux-gnu"
;;
*)
echo "ERROR: Unsupported architecture ${arch}."
exit 1
;;
esac
echo " Using ${arch_suffix}"

check-github-release-asset \
"indygreg/python-build-standalone" \
"${version}" \
"cpython-${PYTHON_VERSION}+${version}-${arch_suffix}-install_only.tar.gz"

curl --silent --location --fail "https://github.com/indygreg/python-build-standalone/releases/download/${version}/cpython-${PYTHON_VERSION}+${version}-${arch_suffix}-install_only.tar.gz" \
| tar --extract --gzip --directory="${prefix}${target}/" --strip-components=1 --no-same-owner
EOF
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
name: python-build-standalone
name: python-static
version: "20230507"
check: ""
platforms:
- linux/amd64
- linux/arm64
tags:
- category/development
- lang/python
- type/cli
- category/development
- lang/python
- type/cli
homepage: https://github.com/indygreg/python-build-standalone
description: Redistributable builds of Python
renovate:
Expand Down
56 changes: 47 additions & 9 deletions tools/python/Dockerfile.template
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,54 @@
ARG ref=main

FROM ghcr.io/nicholasdille/docker-setup/base:${ref} AS prepare
WORKDIR /tmp/python
ARG DEBIAN_FRONTEND=noninteractive
ARG name
ARG version
ARG PYTHON_VERSION=3.11.3
RUN <<EOF
check-github-release-asset \
"indygreg/python-build-standalone" \
"${version}" \
"cpython-${PYTHON_VERSION}+${version}-${arch}-unknown-linux-musl-install_only.tar.gz"
EOF
RUN <<EOF
curl --silent --location --fail "https://github.com/indygreg/python-build-standalone/releases/download/${version}/cpython-${PYTHON_VERSION}+${version}-${arch}-unknown-linux-musl-install_only.tar.gz" \
| tar --extract --gzip --directory="${prefix}${target}/" --strip-components=1 --no-same-owner
apt-get update
apt-get -y install --no-install-recommends \
curl \
ca-certificates \
xz-utils \
make \
build-essential \
gdb \
lcov \
pkg-config \
libbz2-dev \
libffi-dev \
libgdbm-dev \
libgdbm-compat-dev \
liblzma-dev \
libncurses5-dev \
libreadline6-dev \
libsqlite3-dev \
libssl-dev \
lzma \
lzma-dev \
tk-dev \
uuid-dev \
zlib1g-dev \
llvm \
libcrypt-dev

curl --silent --location "https://www.python.org/ftp/python/${version}/Python-${version}.tar.xz" \
| tar --extract --xz --strip-components=1

./configure --prefix="${prefix}${target}"
make -j4
make install -j4
ln --symbolic --relative --force "${prefix}${target}/bin/python3" "${prefix}${target}/bin/python"
ln --symbolic --relative --force "${prefix}${target}/bin/pip3" "${prefix}${target}/bin/pip"

"${prefix}${target}/bin/pip" completion --bash >"${prefix}${target}/share/bash-completion/completions/pip"
"${prefix}${target}/bin/pip" completion --fish >"${prefix}${target}/share/fish/vendor_completions.d/pip.fish"
"${prefix}${target}/bin/pip" completion --zsh >"${prefix}${target}/share/zsh/vendor-completions/_pip"

"${prefix}${target}/bin/pip" install \
pipx
"${prefix}${target}/bin/register-python-argcomplete" pipx >"${prefix}${target}/share/bash-completion/completions/pipx"
"${prefix}${target}/bin/register-python-argcomplete" --shell fish pipx >"${prefix}${target}/share/fish/vendor_completions.d/pipx.fish"
find "${prefix}${target}/bin/" -type f -executable -exec sed -i "s|#\!${prefix}/|#\!/|" {} \;
EOF
26 changes: 15 additions & 11 deletions tools/python/manifest.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
name: python-build-standalone
version: "20230507"
check: ""
name: python
version: "3.11.4"
check: ${binary} --version | cut -d' ' -f2
platforms:
- linux/amd64
- linux/arm64
tags:
- category/development
- lang/python
- type/cli
homepage: https://github.com/indygreg/python-build-standalone
description: Redistributable builds of Python
- type/cli
- category/development
- lang/javascript
homepage: https://github.com/python/cpython
description: Python programming language
renovate:
datasource: github-releases
package: indygreg/python-build-standalone
priority: low
datasource: github-tags
package: python/cpython
extractVersion: ^v(?<version>.+?)$
priority: medium
4 changes: 0 additions & 4 deletions tools/python/post_install.sh

This file was deleted.