Skip to content

Commit 5d2e55e

Browse files
author
Release Manager
committed
gh-38521: Fix `sage_bootstrap.flock` for Python 3.13 (fedora-41) <!-- ^ Please provide a concise and informative title. --> <!-- ^ Don't put issue numbers in the title, do this in the PR description below. --> <!-- ^ For example, instead of "Fixes #12345" use "Introduce new method to calculate 1 + 2". --> <!-- v Describe your changes below in detail. --> <!-- v Why is this change required? What problem does it solve? --> <!-- v If this PR resolves an open issue, please link to it here. For example, "Fixes #12345". --> Seen on Fedora 41, which already ships Python 3.13: https://github.com/mkoeppe/sage/actions/runs/10426436105/job/28893965205 #step:11:10930 ``` #28 943.2 [pip-24.0] [spkg-pipinst] File "/sage/build/bin/../sage_bootstrap/flock.py", line 15, in <module> #28 943.2 [pip-24.0] [spkg-pipinst] import pipes #28 943.2 [pip-24.0] [spkg-pipinst] ModuleNotFoundError: No module named 'pipes' ``` ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [ ] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - #12345: short description why this is a dependency --> <!-- - #34567: ... --> URL: #38521 Reported by: Matthias Köppe Reviewer(s): François Bissey, Kwankyu Lee, Matthias Köppe
2 parents ebf8b8e + a7ed572 commit 5d2e55e

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

build/sage_bootstrap/compat/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,11 @@
2828
from StringIO import StringIO
2929
except ImportError:
3030
from io import StringIO
31+
32+
33+
try:
34+
# Use this for Python 3. This function is available for Python >= 3.3
35+
from shlex import quote
36+
except ImportError:
37+
# Use this for Python 2. This function is available for Python < 3.13
38+
from pipes import quote

build/sage_bootstrap/flock.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@
1212

1313
import fcntl
1414
import os
15-
import pipes
1615
import sys
1716
import argparse
1817

18+
from sage_bootstrap.compat import quote
19+
1920

2021
class FileType(argparse.FileType):
2122
"""
@@ -105,7 +106,7 @@ def run(argv=None):
105106
kind = "exclusive"
106107

107108
sys.stderr.write("Waiting for {0} lock to run {1} ... ".format(
108-
kind, ' '.join(pipes.quote(arg) for arg in command)))
109+
kind, ' '.join(quote(arg) for arg in command)))
109110
fcntl.flock(lock, locktype)
110111
sys.stderr.write("ok\n")
111112

0 commit comments

Comments
 (0)