@@ -149,6 +149,50 @@ auditwheel ``>=1.0.0`` ``>=2.0.0`` ``>=3.0.0`` ``>=3.3.0`` [#
149
149
.. [# ] Only support for ``manylinux_2_24 `` has been added in auditwheel 3.3.0
150
150
151
151
152
+ ``musllinux ``
153
+ -------------
154
+
155
+ The ``musllinux `` family of tags is similar to ``manylinux ``, but for Linux
156
+ platforms that use the musl _ libc rather than glibc (a prime example being Alpine
157
+ Linux). The schema is ``musllinux_x_y_arch ``, supporting musl ``x.y `` and higher
158
+ on the architecture ``arch ``.
159
+
160
+ The musl version values can be obtained by executing the musl libc shared
161
+ library the Python interpreter is currently running on, and parsing the output:
162
+
163
+ .. code-block :: python
164
+
165
+ import re
166
+ import subprocess
167
+
168
+ def get_musl_major_minor (so : str ) -> tuple[int , int ] | None :
169
+ """ Detect musl runtime version.
170
+
171
+ Returns a two-tuple ``(major, minor)`` that indicates musl
172
+ library's version, or ``None`` if the given libc .so does not
173
+ output expected information.
174
+
175
+ The libc library should output something like this to stderr::
176
+
177
+ musl libc (x86_64)
178
+ Version 1.2.2
179
+ Dynamic Program Loader
180
+ """
181
+ proc = subprocess.run([so], stderr = subprocess.PIPE , text = True )
182
+ lines = (line.strip() for line in proc.stderr.splitlines())
183
+ lines = [line for line in lines if line]
184
+ if len (lines) < 2 or lines[0 ][:4 ] != " musl" :
185
+ return None
186
+ match = re.match(r " Version ( \d + ) \. ( \d + ) " , lines[1 ])
187
+ if match:
188
+ return (int (match.group(1 )), int (match.group(2 )))
189
+ return None
190
+
191
+ There are currently two possible ways to find the musl library’s location that a
192
+ Python interpreter is running on, either with the system ldd _ command, or by
193
+ parsing the ``PT_INTERP `` section’s value from the executable’s ELF _ header.
194
+
195
+
152
196
Use
153
197
===
154
198
@@ -297,3 +341,10 @@ The following PEPs contributed to this spec:
297
341
- :pep: `571 `: defined ``manylinux2010 ``
298
342
- :pep: `599 `: defined ``manylinux2014 ``
299
343
- :pep: `600 `: defined the ``manylinux_x_y `` scheme
344
+ - :pep: `656 `: defined ``musllinux_x_y ``
345
+
346
+
347
+
348
+ .. _musl : https://musl.libc.org
349
+ .. _ldd : https://www.unix.com/man-page/posix/1/ldd/
350
+ .. _elf : https://refspecs.linuxfoundation.org/elf/elf.pdf
0 commit comments