8000 - Enable override of download URLs and ./configure flags · codrsquad/portable-python@dd3694a · GitHub
[go: up one dir, main page]

Skip to content

Commit dd3694a

Browse files
author
jwiltse
committed
- Enable override of download URLs and ./configure flags
- Normalize c_configure_args functions - Add more extensive comments to root yml file for posterity
1 parent 89a6201 commit dd3694a

File tree

4 files changed

+175
-88
lines changed

4 files changed

+175
-88
lines changed

portable-python.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,30 @@ folders:
1919
cpython-additional-packages:
2020
# - Pillow==10.0.0
2121
# - flake8==6.0.0
22+
23+
# Uncomment to download, compile and statically link Python module dependencies
24+
# cpython-modules: libffi zlib xz bzip2 openssl uuid sqlite
25+
26+
# Uncomment to override a dependency version
27+
# libffi-version: 3.3
28+
29+
# Uncomment to override cpython or a dependency source URL
30+
# Note: string "$version" will be replaced with version string (e.g. 1.2.3)
31+
# cpython-url: https://my-cpython-mirror/cpython-$version.tar.gz
32+
# zlib-url: https://my-zlib-mirror/zlib-$version.tar.gz
33+
34+
# Uncomment to override the ./configure arguments for a dependency
35+
# Note: this will replace the default arguments, not extend them
36+
# Note: the string "$deps_lib" will be replaced with the output libs directory for the module
37+
# openssl-configure: -v --openssldir=/etc/ssl no-shared no-idea no-tests no-dso
38+
39+
# Note: It's also possible to set configure args per platform/arch
40+
# linux:
41+
# openssl-configure: --with-terminfo-dirs=/etc/terminfo:/lib/terminfo:/usr/share/terminfo
42+
# macos:
43+
# openssl-configure: --with-terminfo-dirs=/usr/share/terminfo
44+
45+
# Note: you can also use one argument per line syntax
46+
# openssl-configure:
47+
# - -v
48+
# - --openssldir=/etc/ssl

src/portable_python/__init__.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import pathlib
1717
import re
1818
from typing import ClassVar, List
19+
from string import Template
1920

2021
import runez
2122
from runez.http import RestClient
@@ -491,6 +492,16 @@ def is_usable_module(self, name):
491492
def cfg_version(self, default):
492493
return PPG.config.get_value("%s-version" % self.m_name) or default
493494

495+
def cfg_url(self, version):
496+
if config_url := PPG.config.get_value("%s-url" % self.m_name):
497+
url_template = Template(config_url)
498+
return url_template.substitute(version=version)
499+
8000 500+
def cfg_configure(self, deps_lib):
501+
if configure := PPG.config.get_value("%s-configure" % self.m_name):
502+
configure_template = Template(configure)
503+
return configure_template.substitute(deps_lib=deps_lib)
504+
494505
@property
495506
def url(self):
496507
"""Url of source tarball, if any"""

src/portable_python/cpython.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ def url(self):
104104
if PPG.config.get_value("cpython-use-github"):
105105
return f"https://github.com/python/cpython/archive/refs/tags/v{self.version}.tar.gz"
106106

107+
if cfg_url := self.cfg_url(self.version):
108+
return cfg_url
109+
107110
return f"https://www.python.org/ftp/python/{self.version.main}/Python-{self.version}.tar.xz"
108111

109112
def xenv_LDFLAGS_NODIST(self):

0 commit comments

Comments
 (0)
0