Skip to content
Merged
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
23 changes: 1 addition & 22 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,7 @@ jobs:

strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- run: pip install -U pip tox
- run: tox -e py
- uses: codecov/codecov-action@v3
with:
files: .tox/test-reports/coverage.xml

test-eol:
# EOL-ed versions of python are exercised on older linux distros for a while longer
# Testing against these versions will eventually be retired
runs-on: ubuntu-20.04

strategy:
matrix:
python-version: ["3.6", "3.7"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]

steps:
- uses: actions/checkout@v4
Expand Down
27 changes: 27 additions & 0 deletions portable-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,30 @@ folders:
cpython-additional-packages:
# - Pillow==10.0.0
# - flake8==6.0.0

# Uncomment to download, compile and statically link Python module dependencies
# cpython-modules: libffi zlib xz bzip2 openssl uuid sqlite

# Uncomment to override a dependency version
# libffi-version: 3.3

# Uncomment to override cpython or a dependency source URL
# Note: string "$version" will be replaced with version string (e.g. 1.2.3)
# cpython-url: https://my-cpython-mirror/cpython-$version.tar.gz
# zlib-url: https://my-zlib-mirror/zlib-$version.tar.gz

# Uncomment to override the ./configure arguments for a dependency
# Note: this will replace the default arguments, not extend them
# Note: the string "$deps_lib" will be replaced with the output libs directory for the module
# openssl-configure: -v --openssldir=/etc/ssl no-shared no-idea no-tests no-dso

# Note: It's also possible to set configure args per platform/arch
# linux:
# openssl-configure: --with-terminfo-dirs=/etc/terminfo:/lib/terminfo:/usr/share/terminfo
# macos:
# openssl-configure: --with-terminfo-dirs=/usr/share/terminfo

# Note: you can also use one argument per line syntax
# openssl-configure:
# - -v
# - --openssldir=/etc/ssl
5 changes: 2 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
author="Zoran Simic zoran@simicweb.com",
keywords="python, portable, binary",
url="https://github.com/codrsquad/portable-python",
python_requires=">=3.6",
python_requires=">=3.8",
entry_points={
"console_scripts": [
"portable-python = portable_python.__main__:main",
Expand All @@ -22,13 +22,12 @@
"Operating System :: Unix",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: Implementation :: CPython",
"Topic :: Software Development :: Build Tools",
"Topic :: System :: Installation/Setup",
Expand Down
11 changes: 11 additions & 0 deletions src/portable_python/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import os
import pathlib
import re
from string import Template
from typing import ClassVar, List

import runez
Expand Down Expand Up @@ -491,6 +492,16 @@ def is_usable_module(self, name):
def cfg_version(self, default):
return PPG.config.get_value("%s-version" % self.m_name) or default

def cfg_url(self, version):
if config_url := PPG.config.get_value("%s-url" % self.m_name):
url_template = Template(config_url)
return url_template.substitute(version=version)

def cfg_configure(self, deps_lib):
if configure := PPG.config.get_value("%s-configure" % self.m_name):
configure_template = Template(configure)
return configure_template.substitute(deps_lib=deps_lib)

@property
def url(self):
"""Url of source tarball, if any"""
Expand Down
3 changes: 3 additions & 0 deletions src/portable_python/cpython.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ def url(self):
if PPG.config.get_value("cpython-use-github"):
return f"https://github.com/python/cpython/archive/refs/tags/v{self.version}.tar.gz"

if cfg_url := self.cfg_url(self.version):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need py3.8+ for :=, we need to adapt python_requires to reflect this in setup.py, and remove the legacy tests, ie the test-eol: section from .github/workflows/tests.yml

return cfg_url

return f"https://www.python.org/ftp/python/{self.version.main}/Python-{self.version}.tar.xz"

def xenv_LDFLAGS_NODIST(self):
Expand Down
Loading