scripts/pipcl.py: avoid problems with python-3.12 and setuptools.
authorJulian Smith <[email protected]>
Wed, 3 Jan 2024 16:43:32 +0000 (16:43 +0000)
committerSebastian Rasmussen <[email protected]>
Fri, 5 Jan 2024 23:05:34 +0000 (00:05 +0100)
Python-3.12 doesn't seem to support setuptools by default, so we need to import
it lazily. This allows handling of `scripts/pymupdfwrap.py --venv` to install
setuptools into a venv, which will work.

scripts/pipcl.py

index c8cf4ee10f9a4a34583712352e83f3c7aa82f71a..33677f8c7475e545d4beaf663d509611bcf61622 100644 (file)
@@ -23,7 +23,6 @@ import platform
 import re
 import shutil
 import site
-import setuptools
 import subprocess
 import sys
 import sysconfig
@@ -559,6 +558,7 @@ class Package:
             # PEP-425. On Linux gives `linux_x86_64` which is rejected by
             # pypi.org.
             #
+            import setuptools
             tag_platform = setuptools.distutils.util.get_platform().replace('-', '_').replace('.', '_')
 
             # We need to patch things on MacOS.