Skip to content

Commit b6a19bc

Browse files
committed
Allow building with nogil
Requires new runez (version tbd)
1 parent 3236d6e commit b6a19bc

5 files changed

Lines changed: 12 additions & 9 deletions

File tree

portable-python.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
include: +pp-dev.yml
66

77
folders:
8-
build: "build/{family}-{version}" # Allows keeping builds per versions, and inspect them in parallel
8+
build: "build/{family}-{version}{abi_suffix}" # Allows keeping builds per versions, and inspect them in parallel
99

1010
# For quick iteration locally, you can add this to your pp-dev.yml:
1111
#folders:

src/portable_python/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ def __init__(self, python_spec=None, modules=None, prefix=None):
222222
runez.abort("Please provide full desired version: %s is not good enough" % runez.red(python_spec))
223223

224224
self.python_spec = python_spec
225-
self.folders = PPG.get_folders(base=os.getcwd(), family=python_spec.family, version=python_spec.version)
225+
self.folders = PPG.get_folders(base=os.getcwd(), family=python_spec.family, version=python_spec.version, abi_suffix=python_spec.abi_suffix)
226226
self.desired_modules = modules
227227
prefix = self.folders.formatted(prefix)
228228
self.prefix = prefix
@@ -237,7 +237,7 @@ def __init__(self, python_spec=None, modules=None, prefix=None):
237237
self.tarball_name = PPG.target.composed_basename(dest, extension=ext)
238238

239239
else:
240-
self.tarball_name = PPG.target.composed_basename(python_spec.family, python_spec.version, extension=ext)
240+
self.tarball_name = PPG.target.composed_basename(python_spec.family, python_spec.version, abi_suffix=python_spec.abi_suffix, extension=ext)
241241

242242
builder = PPG.family(python_spec.family).get_builder()
243243
self.python_builder = builder(self) # type: PythonBuilder

src/portable_python/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
destdir: "{build}"
1818
dist: dist
1919
logs: "{build}/logs"
20-
ppp-marker: /ppp-marker/{version}
20+
ppp-marker: /ppp-marker/{version}{abi_suffix}
2121
sources: build/sources
2222
2323
manifest:

src/portable_python/cpython.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,9 @@ def c_configure_args(self):
172172
yield f"-ltcl{version.mm}"
173173
yield f"-ltk{version.mm}"
174174

175+
if self.setup.python_spec.freethreading:
176+
yield "--disable-gil"
177+
175178
def xenv_LIBZSTD_CFLAGS(self):
176179
if self.version >= "3.14" and PPG.target.is_macos:
177180
# Normally ./configure will autodetect using pkg-config, but
@@ -199,7 +202,7 @@ def xenv_LIBMPDEC_LIBS(self):
199202
@runez.cached_property
200203
def prefix_lib_folder(self):
201204
"""Path to <prefix>/lib/pythonM.m folder"""
202-
return self.install_folder / f"lib/python{self.version.mm}"
205+
return self.install_folder / f"lib/python{self.version.mm}{self.setup.python_spec.abi_suffix}"
203206

204207
@runez.cached_property
205208
def prefix_config_folder(self):

src/portable_python/versions.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,13 +117,13 @@ def get_builder(self):
117117

118118

119119
class Folders:
120-
def __init__(self, config: Config, base=None, family=None, version=None):
120+
def __init__(self, config: Config, base=None, family=None, version=None, abi_suffix=None):
121121
self.config = config
122122
self.base_folder = runez.resolved_path(base)
123123
self.family = family
124124
self.version = Version.from_object(version)
125125
self.mm = self.version and self.version.mm
126-
self.completions = config.completions(family=family, version=version, mm=self.mm)
126+
self.completions = config.completions(family=family, version=version, mm=self.mm, abi_suffix=abi_suffix)
127127
self.build_folder = self._get_path("build")
128128
self.completions["build"] = self.build_folder
129129
self.components = self.build_folder / "components"
@@ -197,9 +197,9 @@ def grab_config(cls, paths=None, target=None):
197197
cls.target = cls.config.target
198198

199199
@classmethod
200-
def get_folders(cls, base=None, family="cpython", version=None):
200+
def get_folders(cls, base=None, family="cpython", version=None, abi_suffix=None):
201201
config = cls.config or Config()
202-
return Folders(config, base=base, family=family, version=version)
202+
return Folders(config, base=base, family=family, version=version, abi_suffix=abi_suffix)
203203

204204
@classmethod
205205
def family(cls, family_name, fatal=True) -> VersionFamily:

0 commit comments

Comments
 (0)