Skip to content

Commit de63aaa

Browse files
committed
beets: update to 2.3.1.
1 parent 6987807 commit de63aaa

File tree

2 files changed

+67
-1
lines changed

2 files changed

+67
-1
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
From 3eb68ef830447d91b10a928823edb3c50cf73f48 Mon Sep 17 00:00:00 2001
2+
From: =?UTF-8?q?=C5=A0ar=C5=ABnas=20Nejus?= <[email protected]>
3+
Date: Sun, 26 Oct 2025 20:37:08 +0000
4+
Subject: [PATCH] Use cross-platform shutil.get_terminal_size to get term_width
5+
6+
This fixes Python 3.14 incompatibility.
7+
---
8+
beets/ui/__init__.py | 26 +++++---------------------
9+
3 files changed, 7 insertions(+), 22 deletions(-)
10+
11+
diff --git a/beets/ui/__init__.py b/beets/ui/__init__.py
12+
index 60e2014485..fe980bb5cf 100644
13+
--- a/beets/ui/__init__.py
14+
+++ b/beets/ui/__init__.py
15+
@@ -23,8 +23,8 @@
16+
import optparse
17+
import os.path
18+
import re
19+
+import shutil
20+
import sqlite3
21+
-import struct
22+
import sys
23+
import textwrap
24+
import traceback
25+
@@ -699,27 +699,11 @@ def get_replacements():
26+
return replacements
27+
28+
29+
-def term_width():
30+
+@cache
31+
+def term_width() -> int:
32+
"""Get the width (columns) of the terminal."""
33+
- fallback = config["ui"]["terminal_width"].get(int)
34+
-
35+
- # The fcntl and termios modules are not available on non-Unix
36+
- # platforms, so we fall back to a constant.
37+
- try:
38+
- import fcntl
39+
- import termios
40+
- except ImportError:
41+
- return fallback
42+
-
43+
- try:
44+
- buf = fcntl.ioctl(0, termios.TIOCGWINSZ, " " * 4)
45+
- except OSError:
46+
- return fallback
47+
- try:
48+
- height, width = struct.unpack("hh", buf)
49+
- except struct.error:
50+
- return fallback
51+
- return width
52+
+ columns, _ = shutil.get_terminal_size(fallback=(0, 0))
53+
+ return columns if columns else config["ui"]["terminal_width"].get(int)
54+
55+
56+
def split_into_lines(string, width_tuple):
57+
--- a/beets/ui/__init__.py
58+
+++ b/beets/ui/__init__.py
59+
@@ -27,6 +27,7 @@
60+
import textwrap
61+
import traceback
62+
from difflib import SequenceMatcher
63+
+from functools import cache
64+
from typing import Any, Callable
65+
66+
import confuse

srcpkgs/beets/template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Template file for 'beets'
22
pkgname=beets
33
version=2.3.1
4-
revision=2
4+
revision=1
55
build_style=python3-pep517
66
# tests requires unpackaged librosa, pytest-flask
77
make_check_args="--ignore=test/plugins/test_autobpm.py

0 commit comments

Comments
 (0)