Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix sage_bootstrap.flock for Python 3.13 (fedora-41) #38521

Merged
merged 3 commits into from
Sep 3, 2024
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
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
kwankyu marked this conversation as resolved.
Show resolved Hide resolved
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
Loading