Add error message in case setuptools is not installed.

This commit is contained in:
Valentin Lorentz 2021-08-12 21:28:50 +02:00
parent 37ba0ef7be
commit cbd2b31d8f

View File

@ -34,10 +34,28 @@
import os import os
import sys import sys
import time import time
import textwrap
import warnings import warnings
import subprocess import subprocess
from setuptools import setup def normalizeWhitespace(s):
return ' '.join(s.split())
try:
from setuptools import setup
except ImportError:
s = normalizeWhitespace("""Limnoria requires the setuptools package to
install. This package is pretty standard, and often installed alongside
Python, but it is missing on your system.
Try installing it with your package manager, it is usually called
'python3-setuptools'. If that does not work, try installing python3-pip
instead, either with your package manager or by following these
instructions: https://pip.pypa.io/en/stable/installation/ (replace
'python' with 'python3' in all the commands)""")
sys.stderr.write(os.linesep*2)
sys.stderr.write(textwrap.fill(s))
sys.stderr.write(os.linesep*2)
sys.exit(-1)
warnings.filterwarnings('always', category=DeprecationWarning) warnings.filterwarnings('always', category=DeprecationWarning)
@ -100,9 +118,6 @@ if sys.version_info < (3, 6, 0) \
plugins = [s for s in os.listdir('plugins') if plugins = [s for s in os.listdir('plugins') if
os.path.exists(os.path.join('plugins', s, 'plugin.py'))] os.path.exists(os.path.join('plugins', s, 'plugin.py'))]
def normalizeWhitespace(s):
return ' '.join(s.split())
packages = ['supybot', packages = ['supybot',
'supybot.locales', 'supybot.locales',
'supybot.utils', 'supybot.utils',