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
1 change: 1 addition & 0 deletions docs/concepts/telltale-detection.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Each [`ModuleBuilder`](/architecture/module-builder.md) subclass declares `m_tel
class Openssl(ModuleBuilder):
m_telltale = "{include}/openssl/ssl.h"


class Sqlite(ModuleBuilder):
m_telltale = ["{include}/sqlite3.h"]
```
Expand Down
4 changes: 2 additions & 2 deletions docs/guides/add-an-external-module.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ To statically link a new C library into CPython, add a [`ModuleBuilder`](/archit
class Mylib(ModuleBuilder):
"""See https://docs.python.org/3/library/mymodule.html"""

m_telltale = "{include}/mylib.h" # marker if system already has it
m_debian = "+libmylib-dev" # Linux build constraint (see telltale detection)
m_telltale = "{include}/mylib.h" # marker if system already has it
m_debian = "+libmylib-dev" # Linux build constraint (see telltale detection)

@property
def url(self):
Expand Down
5 changes: 1 addition & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,8 @@ line-length = 140
src = ["src", "tests"]

[tool.ruff.lint]
extend-select = [
select = [
"A", # flake8-builtins
# "ARG", # flake8-unused-arguments
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"C90", # mccabe
Expand All @@ -108,13 +107,11 @@ extend-select = [
"RET", # flake8-return
"RUF", # ruff-specific
"S", # flake8-bandit
# "SIM", # flake8-simplify
"SLF", # flake8-self
"SLOT", # flake8-slots
"T10", # flake8-debugger
"TID", # flake8-tidy-imports
"TCH", # flake8-type-checking
# "TD", # flake8-todos
"TRY", # tryceratops
"W", # pycodestyle warnings
]
Expand Down
2 changes: 1 addition & 1 deletion scripts/check_okf.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

# Matches markdown links ending in .md, with an optional #anchor (external http(s)/mailto links are skipped below)
LINK_RE = re.compile(r"\]\((?P<target>[^)\s#]+\.md)(?:#[^)]*)?\)")
TYPE_RE = re.compile(r"^type:\s*(?P<type>\S.*)$", re.M)
TYPE_RE = re.compile(r"^type:\s*(?P<type>\S.*)$", re.MULTILINE)


def frontmatter(text):
Expand Down
6 changes: 3 additions & 3 deletions src/portable_python/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import pathlib
import re
from string import Template
from typing import ClassVar, List
from typing import ClassVar

import runez
from runez.http import RestClient
Expand Down Expand Up @@ -301,9 +301,9 @@ def compile(self):
class ModuleCollection:
"""Models a collection of sub-modules, with auto-detection and reporting as to what is active and why"""

candidates: List["ModuleBuilder"] = None
candidates: list["ModuleBuilder"] = None
desired: str = None
selected: List["ModuleBuilder"] = None
selected: list["ModuleBuilder"] = None

def __init__(self, parent_module: "ModuleBuilder", desired=None):
self.selected = []
Expand Down
15 changes: 15 additions & 0 deletions src/portable_python/cpython.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,21 @@ def xenv_LIBMPDEC_LIBS(self):
if self.version >= "3.14" and PPG.target.is_macos:
yield f"{self.deps_lib_dir}/libmpdec.a"

def xenv_LIBREADLINE_LIBS(self):
if self.version >= "3.12" and self.active_module(Readline):
# Since 3.12 (gh-90005), ./configure asks pkg-config how to link the readline module,
# and no longer probes for the termcap library that readline needs. It states:
# "We now assume that libreadline or readline.pc provide correct linker information".
# Our readline is static, and its readline.pc mentions ncurses in 'Requires.private',
# which `pkg-config --libs` does not report (only `--libs --static` does). readline
# then gets linked without ncurses: it compiles, but fails to import at the end of
# the build with "undefined symbol: UP". So state the full static link line ourselves
# (same as `pkg-config --static --libs readline`), ./configure honors <LIB>_LIBS for
# exactly this purpose (gh-94801).
yield f"-L{self.deps_lib_dir}"
yield "-lreadline"
yield "-lncursesw"

@runez.cached_property
def prefix_lib_folder(self):
"""Path to <prefix>/lib/pythonM.m folder"""
Expand Down
3 changes: 1 addition & 2 deletions src/portable_python/inspector.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,7 @@ def short_name(self):

short_name = self.basename
if not short_name.startswith("libpython"):
if short_name.startswith("lib"):
short_name = short_name[3:]
short_name = short_name.removeprefix("lib")

short_name = short_name.partition(".")[0]

Expand Down
Loading