# HG changeset patch # User Franz Glasner # Date 1758026315 -7200 # Node ID 00d59dc616bad56744b34aca9ec4008e3ae1047a # Parent d80ac90277ac16a55320c0bf82f4a7a0d88e136a FIX: Use "LC_PAPER" only on GNU Linux. It is a GNU extension to locale. diff -r d80ac90277ac -r 00d59dc616ba pdfautonup/options.py --- a/pdfautonup/options.py Tue Sep 16 13:56:37 2025 +0200 +++ b/pdfautonup/options.py Tue Sep 16 14:38:35 2025 +0200 @@ -134,7 +134,7 @@ Paper size is read from the following sources (in that order): - Argument of "--size" option; - - LC_PAPER environment variable (read as mm); + - LC_PAPER environment variable (GNU Linux only, read as mm); - PAPERSIZE environment variable; - content of file specified by the PAPERCONF environment variable; - content of file /etc/papersize; diff -r d80ac90277ac -r 00d59dc616ba pdfautonup/paper.py --- a/pdfautonup/paper.py Tue Sep 16 13:56:37 2025 +0200 +++ b/pdfautonup/paper.py Tue Sep 16 14:38:35 2025 +0200 @@ -16,6 +16,7 @@ """Paper-size related functions""" import os +import platform import subprocess import typing from decimal import Decimal @@ -55,13 +56,17 @@ return papersize.parse_papersize(target_size) return target_size - # LC_PAPER environment variable (can be read from "locale -k LC_PAPER" - try: - return parse_lc_paper( - subprocess.check_output(["locale", "-k", "LC_PAPER"], text=True) - ) - except (FileNotFoundError, subprocess.CalledProcessError, errors.CouldNotParse): - pass + if platform.system() in ("Linux", ): + # + # LC_PAPER environment variable (can be read from "locale -k LC_PAPER)" + # -- but only on GNU systems (it is a GNU extension). + # + try: + return parse_lc_paper( + subprocess.check_output(["locale", "-k", "LC_PAPER"], text=True) + ) + except (FileNotFoundError, subprocess.CalledProcessError, errors.CouldNotParse): + pass # PAPERSIZE environment variable try: