Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
sagemathgh-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 sagemath#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 sagemath#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,
-->
<!-- - sagemath#12345: short description why this is a dependency -->
<!-- - sagemath#34567: ... -->
    
URL: sagemath#38521
Reported by: Matthias Köppe
Reviewer(s): François Bissey, Kwankyu Lee, Matthias Köppe
  • Loading branch information
Release Manager committed Aug 27, 2024
2 parents ebf8b8e + a7ed572 commit 5d2e55e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
8 changes: 8 additions & 0 deletions build/sage_bootstrap/compat/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,11 @@
from StringIO import StringIO
except ImportError:
from io import StringIO


try:
# Use this for Python 3. This function is available for Python >= 3.3
from shlex import quote
except ImportError:
# Use this for Python 2. This function is available for Python < 3.13
from pipes import quote
5 changes: 3 additions & 2 deletions build/sage_bootstrap/flock.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@

import fcntl
import os
import pipes
import sys
import argparse

from sage_bootstrap.compat import quote


class FileType(argparse.FileType):
"""
Expand Down Expand Up @@ -105,7 +106,7 @@ def run(argv=None):
kind = "exclusive"

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

Expand Down

0 comments on commit 5d2e55e

Please sign in to comment.