├── .github └── workflows │ ├── publish.yaml │ └── release.yaml ├── .gitignore ├── CONTRIBUTING.md ├── Dockerfile ├── LICENSE ├── Makefile ├── README.rst └── exclude.list /.github/workflows/publish.yaml: -------------------------------------------------------------------------------- 1 | name: Publish support package 2 | 3 | on: 4 | release: 5 | types: published 6 | 7 | jobs: 8 | publish: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: actions/checkout@v2 12 | - name: Set up Python environment 13 | uses: actions/setup-python@v1 14 | with: 15 | python-version: "3.X" 16 | - name: Set build variables 17 | env: 18 | TAG_NAME: ${{ github.ref }} 19 | run: | 20 | export TAG=$(basename $TAG_NAME) 21 | echo "TAG=${TAG}" 22 | export TAG_VERSION="${TAG%-*}" 23 | export TAG_BUILD="${TAG#*-}" 24 | echo "PY_VERSION=${TAG_VERSION}" 25 | echo "BUILD_NUMBER=${TAG_BUILD}" 26 | echo "TAG=${TAG}" >> $GITHUB_ENV 27 | echo "PY_VERSION=${TAG_VERSION}" >> $GITHUB_ENV 28 | echo "BUILD_NUMBER=${TAG_BUILD}" >> $GITHUB_ENV 29 | - name: Update Release Asset to S3 30 | env: 31 | AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} 32 | AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} 33 | run: | 34 | python -m pip install -U pip 35 | python -m pip install -U setuptools 36 | python -m pip install awscli 37 | curl -o artefact.tar.gz -L https://github.com/beeware/Python-Linux-support/releases/download/${{ env.TAG }}/Python-${{ env.PY_VERSION }}-linux-x86_64-support.${{ env.BUILD_NUMBER }}.tar.gz 38 | aws s3 cp artefact.tar.gz s3://briefcase-support/python/${{ env.PY_VERSION }}/linux/x86_64/Python-${{ env.PY_VERSION }}-linux-x86_64-support.${{ env.BUILD_NUMBER }}.tar.gz 39 | -------------------------------------------------------------------------------- /.github/workflows/release.yaml: -------------------------------------------------------------------------------- 1 | # This is the DEV workflow. 2 | # Run this Action on creating a new tag matching "-b" 3 | # e.g., 3.7-b1 4 | name: Build support package 5 | on: 6 | push: 7 | tags: 8 | - '*-b*' 9 | 10 | jobs: 11 | build: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - uses: actions/checkout@v2 15 | - name: Set build variables 16 | env: 17 | TAG_NAME: ${{ github.ref }} 18 | run: | 19 | export TAG=$(basename $TAG_NAME) 20 | echo "TAG=${TAG}" 21 | export TAG_VERSION="${TAG%-*}" 22 | export TAG_BUILD="${TAG#*-}" 23 | echo "PY_VERSION=${TAG_VERSION}" 24 | echo "BUILD_NUMBER=${TAG_BUILD}" 25 | echo "TAG=${TAG}" >> $GITHUB_ENV 26 | echo "PY_VERSION=${TAG_VERSION}" >> $GITHUB_ENV 27 | echo "BUILD_NUMBER=${TAG_BUILD}" >> $GITHUB_ENV 28 | - name: Build project 29 | env: 30 | BUILD_NUMBER: ${{ env.BUILD_NUMBER }} 31 | run: make -e 32 | - name: Create Release 33 | id: create_release 34 | uses: actions/create-release@v1 35 | env: 36 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 37 | with: 38 | tag_name: ${{ github.ref }} 39 | release_name: ${{ github.ref }} 40 | draft: true 41 | prerelease: false 42 | body: | 43 | Build ${{ env.BUILD_NUMBER }} of the BeeWare support package for Python ${{ env.PY_VERSION }}. 44 | 45 | Includes: 46 | * Python ${{ env.PY_VERSION }}.? 47 | - name: Upload Release Asset to Github 48 | uses: actions/upload-release-asset@v1 49 | env: 50 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 51 | with: 52 | upload_url: ${{ steps.create_release.outputs.upload_url }} 53 | asset_path: ./dist/Python-${{ env.PY_VERSION }}-linux-x86_64-support.${{ env.BUILD_NUMBER }}.tar.gz 54 | asset_name: Python-${{ env.PY_VERSION }}-linux-x86_64-support.${{ env.BUILD_NUMBER }}.tar.gz 55 | asset_content_type: application/gzip 56 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.swo 2 | *.swp 3 | src/* 4 | archive/* 5 | build/* 6 | downloads/* 7 | diff/* 8 | dist/* 9 | .env 10 | .vscode -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | BeeWare <3's contributions! 4 | 5 | Please be aware, BeeWare operates under a Code of Conduct. 6 | 7 | See [CONTRIBUTING to BeeWare](https://beeware.org/contributing) for details. 8 | 9 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # Use Ubuntu 18.04 (bionic) as a base image. This ensures that we're using an 2 | # old version of libc, maximizing the compatibility of the image when it is 3 | # included in an AppImage. 4 | FROM ubuntu:18.04 5 | 6 | # Install the build requirements for Python. 7 | RUN apt-get update -y && \ 8 | apt-get install -y \ 9 | gcc make patchelf curl \ 10 | libbz2-dev \ 11 | libffi-dev \ 12 | libgdbm-compat-dev \ 13 | libgdbm-dev \ 14 | liblzma-dev \ 15 | libncurses5-dev \ 16 | libsqlite3-dev \ 17 | libssl-dev \ 18 | uuid-dev \ 19 | zlib1g-dev 20 | 21 | # Install the Makefile and exclude list, and build Python. 22 | # This Makefile will assume there are two external mountpoints: 23 | # /local/downloads (to ensure that we don't repeatedly download source code) 24 | # /local/dist (to provide an external location for build products) 25 | # You can mount these directories using the -v option to docker: 26 | # docker run -it -v `pwd`/downloads:/local/downloads -v `pwd`/dist:/local/dist ... 27 | COPY Makefile local/Makefile 28 | COPY exclude.list local/exclude.list 29 | WORKDIR /local 30 | CMD ["make", "-e", "Python"] 31 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014 Russell Keith-Magee. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # Current director 2 | PROJECT_DIR=$(shell pwd) 3 | 4 | BUILD_NUMBER=custom 5 | 6 | # Version of packages that will be compiled by this meta-package 7 | # PYTHON_VERSION is the full version number (e.g., 3.10.0b3) 8 | # PYTHON_MICRO_VERSION is the full version number, without any alpha/beta/rc suffix. (e.g., 3.10.0) 9 | # PYTHON_VER is the major/minor version (e.g., 3.10) 10 | PYTHON_VERSION=3.11.0 11 | PYTHON_MICRO_VERSION=$(shell echo $(PYTHON_VERSION) | grep -Po "\d+\.\d+\.\d+") 12 | PYTHON_VER=$(basename $(PYTHON_VERSION)) 13 | 14 | ARCH=$(shell uname -m) 15 | 16 | all: 17 | @echo "***** Building $(PYTHON_VERSION) $(ARCH) build $(BUILD_NUMBER) *****" 18 | rm -rf build 19 | docker build -t beeware/python-linux-$(ARCH)-support . 20 | docker run -e \ 21 | BUILD_NUMBER=$(BUILD_NUMBER) \ 22 | -v $(PROJECT_DIR)/downloads:/local/downloads \ 23 | -v $(PROJECT_DIR)/dist:/local/dist \ 24 | -v $(PROJECT_DIR)/build:/local/build \ 25 | beeware/python-linux-$(ARCH)-support 26 | 27 | # Clean all builds 28 | clean: 29 | rm -rf build dist 30 | 31 | # Full clean - includes all downloaded products 32 | distclean: clean 33 | rm -rf downloads 34 | 35 | dependencies: 36 | dpkg -l > downloads/system.versions 37 | 38 | downloads: downloads/Python-$(PYTHON_VERSION).tgz dependencies 39 | 40 | ########################################################################### 41 | # Python 42 | ########################################################################### 43 | 44 | # Download original Python source code archive. 45 | downloads/Python-$(PYTHON_VERSION).tgz: 46 | mkdir -p downloads 47 | if [ ! -e downloads/Python-$(PYTHON_VERSION).tgz ]; then \ 48 | curl --fail -L https://www.python.org/ftp/python/$(PYTHON_MICRO_VERSION)/Python-$(PYTHON_VERSION).tgz \ 49 | -o downloads/Python-$(PYTHON_VERSION).tgz; \ 50 | fi 51 | 52 | build: 53 | mkdir build 54 | 55 | dist: 56 | mkdir dist 57 | 58 | build/Python-$(PYTHON_VERSION)/Makefile: build downloads 59 | @echo "***** Building $(PYTHON_VERSION) $(ARCH) build $(BUILD_NUMBER) *****" 60 | # Unpack target Python 61 | cd build && tar zxf ../downloads/Python-$(PYTHON_VERSION).tgz 62 | 63 | # Configure target Python 64 | cd build/Python-$(PYTHON_VERSION) && ./configure \ 65 | --prefix=$(PROJECT_DIR)/build/python \ 66 | --enable-ipv6 \ 67 | --enable-shared \ 68 | --without-ensurepip \ 69 | 2>&1 | tee -a ../python-$(PYTHON_VERSION).config.log 70 | 71 | build/Python-$(PYTHON_VERSION)/python.exe: build/Python-$(PYTHON_VERSION)/Makefile 72 | cd build/Python-$(PYTHON_VERSION) && \ 73 | make \ 74 | 2>&1 | tee -a ../python-$(PYTHON_VERSION).build.log 75 | 76 | build/python/bin/python$(PYTHON_VER): build/Python-$(PYTHON_VERSION)/python.exe 77 | cd build/Python-$(PYTHON_VERSION) && \ 78 | make install \ 79 | 2>&1 | tee -a ../python-$(PYTHON_VERSION).install.log 80 | # Make the binary and libpython3.so relocatable 81 | patchelf --set-rpath "\$$ORIGIN/../lib" build/python/bin/python$(PYTHON_VER) 82 | patchelf --set-rpath "\$$ORIGIN" build/python/lib/libpython3.so 83 | 84 | build/python/VERSIONS: dependencies 85 | echo "Python version: $(PYTHON_VERSION) " > build/python/VERSIONS 86 | echo "Build: $(BUILD_NUMBER)" >> build/python/VERSIONS 87 | echo "---------------------" >> build/python/VERSIONS 88 | echo "BZip2: $$(awk '$$2=="bzip2" { print $$3 }' downloads/system.versions)" >> build/python/VERSIONS 89 | echo "OpenSSL: $$(awk '$$2=="openssl" { print $$3 }' downloads/system.versions)" >> build/python/VERSIONS 90 | echo "XZ: $$(awk '$$2=="liblzma5:amd64" { print $$3 }' downloads/system.versions)" >> build/python/VERSIONS 91 | 92 | dist/Python-$(PYTHON_VER)-linux-$(ARCH)-support.$(BUILD_NUMBER).tar.gz: dist build/python/bin/python$(PYTHON_VER) build/python/VERSIONS 93 | tar zcvf $@ -X exclude.list -C build/python `ls -A build/python` 94 | 95 | Python: dist/Python-$(PYTHON_VER)-linux-$(ARCH)-support.$(BUILD_NUMBER).tar.gz 96 | -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | **NOTE: This project has been deprecated** Briefcase now uses `indygreg's Standalone Python `__ 2 | 3 | Python Linux Support 4 | ==================== 5 | 6 | This is a meta-package for building a version of Python that can be embedded 7 | into a Linux AppImage. 8 | 9 | **This branch builds a packaged version of Python 3.11.0**. 10 | Other Python versions are available by cloning other branches of the main 11 | repository: 12 | 13 | * `Python 3.8 `__ 14 | * `Python 3.9 `__ 15 | * `Python 3.10 `__ 16 | * `Python 3.11 `__ 17 | 18 | It works by downloading and building the standard Python sources, after 19 | ensuring that key system libraries are installed. It installs the compiled 20 | Python into a temporary prefix location, strips out parts that aren't needed, 21 | and packages the result. The output of this project is an analog of the 22 | "embedded" Windows distribution that is officially provided by the Python 23 | project. 24 | 25 | Quickstart 26 | ---------- 27 | 28 | A version of this package, compiled on Ubuntu 18.04, is available for `x86_64`_. 29 | 30 | If you want to build your own version, you will need to have Docker installed. 31 | After installing docker, run:: 32 | 33 | $ make 34 | 35 | This will: 36 | 37 | 1. Ensure that the system dependencies required to build Python are up to date. 38 | 2. Download the original Python source package 39 | 3. Configure and build the Python sources 40 | 4. Install the sources 41 | 5. Strip out parts that add significant bulk, but limited utility for embedded 42 | applications: 43 | 44 | * ``2to3``, ``pip``, ``pydoc``, and ``python-configure`` binaries 45 | * man pages 46 | * Testing code 47 | * ``idle`` 48 | * ``tkinter`` 49 | * ``turtle`` 50 | 51 | 6. Build a tarball of the installed output. 52 | 53 | The build products will be in the `build` directory; the distributable tarball 54 | will be in the `dist` directory. 55 | 56 | .. _x86_64: https://briefcase-support.s3.amazonaws.com/python/3.11/linux/x86_64/Python-3.11-macOS-support.b1.tar.gz 57 | -------------------------------------------------------------------------------- /exclude.list: -------------------------------------------------------------------------------- 1 | # This is a list of Python standard library path patterns 2 | # we exclude from the Python-Linux-support tarball. It is 3 | # used by `tar -X exclude.list` during the Makefile build. 4 | # 5 | # Remove binaries that aren't needed to support apps 6 | bin/2to3* 7 | bin/idle3* 8 | bin/pydoc3* 9 | bin/python3*-config 10 | bin/pyvenv* 11 | # Remove standard library test suites. 12 | lib/python*/ctypes/test 13 | lib/python*/distutils/tests 14 | lib/python*/lib2to3/tests 15 | lib/python*/sqlite3/test 16 | lib/python*/test 17 | # Remove compiled test and example modules. 18 | lib/python*/lib-dynload/_test*.so 19 | lib/python*/lib-dynload/_ctypes_test*.so 20 | lib/python*/lib-dynload/xxlimited*.so 21 | lib/python*/lib-dynload/_xxtestfuzz.so 22 | # Remove config-* directory, which is used for compiling C extension modules. 23 | lib/python*/config-* 24 | # Remove ensurepip. If user code needs pip, it can add it to 25 | lib/python*/ensurepip 26 | # Remove Tcl/Tk GUI code. We don't build against Tcl/Tk at the moment, so this 27 | # will not work. 28 | lib/python*/idlelib 29 | lib/python*/tkinter 30 | lib/python*/turtle.py 31 | lib/python*/turtledemo 32 | # Remove lib/pkgconfig files. These are used for compiling C extension modules. 33 | lib/pkgconfig 34 | # Remove site-packages directory. The Linux template unpacks user code and 35 | # dependencies to a different path. 36 | lib/python*/site-packages 37 | # Remove share/ directory, which contains user documentation (man pages). 38 | share 39 | # Remove pyc files. These take up space, but since most stdlib modules are 40 | # never imported by user code, they mostly have no value. 41 | */__pycache__ --------------------------------------------------------------------------------