(footnote order [^mono] [^wine_true] [^wine_maybe] [^wine_false])
# SPDX-FileCopyrightText: 2024 geisserml <[email protected]> | |
# SPDX-License-Identifier: Apache-2.0 OR BSD-3-Clause OR MPL-2.0 | |
import sys | |
import importlib.util | |
def v1_deferred_import(modpath): | |
# FIXME If modpath points to a submodule (e.g. PIL.Image), the parent module will be loaded immediately when this function is called. What's more, non-deferred imports of the submodule will break. This seems to be a nasty limitation of the importlib APIs used here. | |
# SPDX-FileCopyrightText: 2024 geisserml <[email protected]> | |
# SPDX-License-Identifier: MPL-2.0 | |
from string import ascii_uppercase as ALPHABET | |
N_CHARS, ORD_A = len(ALPHABET), ord("A") # 26, 65 | |
def idx_to_label(i): | |
count, remainder = divmod(i, N_CHARS) | |
char = ALPHABET[remainder] # chr(remainder + ORD_A) |
# see also https://wiki.ubuntuusers.de/DVDs_manuell_rippen/#Komplette-Spur-rippen | |
lsdvd /dev/sr0 # to show available tracks and their length | |
mplayer dvd://n -dvd-device /dev/sr0 # to preview a track -- where n is the track number (1-based) | |
mplayer dvd://n -dvd-device /dev/sr0 -v -dumpstream -dumpfile filename.vob # to rip track |
UNIX famously uses fork+exec to create processes, a simple API that is nevertheless quite tricky to use correctly and that comes with a bunch of problems. The alternative, spawn, as used by VMS, Windows NT and recently POSIX, fixes many of these issues but it overly complex and makes it hard to add new features.
prepare() is a proposed API to simplify process creation. When calling prepare(), the current thread enters “preparation state.” That means, a nascent process is created and the current thread is moved to the context of this process, but without changing memory maps (this is similar to how vfork() works). Inside the nascent process, you can configure the environment as desired and then call prep_execve() to execute a new program. On success, prep_execve() leaves preparation state, moving the current thread back to the parent's process context and returns (!) the pid of the now grownup child. You can also use prep_exit() to abort the child without executing a new process, it similarly returns the pid
# Four lines intentionally left blank | |
# SPDX-FileCopyrightText: 2025 geisserml <[email protected]> | |
# SPDX-License-Identifier: MPL-2.0 OR GPL-3.0-or-later | |
# Note that Ghostscript is AGPL-licensed, so this code is altogether affected by copyleft | |
# Written with Ghostscript 9.56.1 on Fedora. |
#! /usr/bin/env python3 | |
# SPDX-FileCopyrightText: 2025 mara004 <[email protected]> | |
# SPDX-License-Identifier: BSD-2-Clause | |
import sys | |
import shlex | |
from pathlib import Path | |
from importlib import import_module | |
from importlib.metadata import entry_points |