From f57776d6a860ef22eb04a7618babda9a22435180 Mon Sep 17 00:00:00 2001
From: Michael H <michael@michaelhall.tech>
Date: Sun, 19 Jan 2025 23:48:39 -0500
Subject: [PATCH] Early error with message on python < 3.13 (#28)

---
 .github/workflows/build-ci.yaml |  5 ++++-
 setup.py                        | 18 ++++++++++++++++++
 2 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/.github/workflows/build-ci.yaml b/.github/workflows/build-ci.yaml
index 08d8482..a97c85a 100644
--- a/.github/workflows/build-ci.yaml
+++ b/.github/workflows/build-ci.yaml
@@ -72,8 +72,11 @@ jobs:
     runs-on: ubuntu-latest
     steps:
     - uses: actions/checkout@v4
+    - uses: actions/setup-python@v5
+      with:
+        python-version: '3.13'
 
-    - run: pipx run build --sdist
+    - run: pipx run --python 3.13 build --sdist
 
     - uses: actions/upload-artifact@v4
       with:
diff --git a/setup.py b/setup.py
index 6ac2c79..ed3ac29 100644
--- a/setup.py
+++ b/setup.py
@@ -2,6 +2,24 @@
 
 from setuptools import Extension, setup
 
+import sys
+
+if sys.version_info[:2] < (3, 13):
+    raise RuntimeError(
+        """
+        audioop-lts is only for python3.13+.
+
+        audioop is part of the standard library still prior to then.
+
+        If you are installing this from a system package manager
+        (eg. pacman, apt, dnf, zypper) please report this
+        to the redistribution provided by your distribution,
+        as they should not be redistributing it for your python version.
+
+        If you are getting this from pip installing another dependency
+        you should inform that dependency.
+        """
+    )
 
 Py_GIL_DISABLED = sysconfig.get_config_var("Py_GIL_DISABLED")
 macros = []