Skip to content

Commit 37ba0ef

Browse files
ianwprogval
authored andcommitted
setup.py: switch import to setuptools
Switch to standard setuptools import, add suggested entries to pyproject.toml. Remove the --clean argument. As the comment suggests I'm sure there is history here, but having setup.py remove parts of the package does not seem like something required at this point. Also clean up the imports to remove unused and group them together at the top.
1 parent 49b9a9a commit 37ba0ef

File tree

2 files changed

+6
-45
lines changed

2 files changed

+6
-45
lines changed

pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
[build-system]
2+
requires = ["setuptools", "wheel"]
3+
build-backend = "setuptools.build_meta"
4+
15
[tool.black]
26
line-length = 79
37

setup.py

Lines changed: 2 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@
3535
import sys
3636
import time
3737
import warnings
38-
import datetime
39-
import tempfile
4038
import subprocess
4139

40+
from setuptools import setup
41+
4242
warnings.filterwarnings('always', category=DeprecationWarning)
4343

4444
debug = '--debug' in sys.argv
@@ -97,55 +97,12 @@
9797
sys.stderr.write('====================================================\n')
9898
time.sleep(60)
9999

100-
import textwrap
101-
102-
clean = False
103-
while '--clean' in sys.argv:
104-
clean = True
105-
sys.argv.remove('--clean')
106-
107-
import glob
108-
import shutil
109-
import os
110-
111-
112100
plugins = [s for s in os.listdir('plugins') if
113101
os.path.exists(os.path.join('plugins', s, 'plugin.py'))]
114102

115103
def normalizeWhitespace(s):
116104
return ' '.join(s.split())
117105

118-
try:
119-
from distutils.core import setup
120-
from distutils.sysconfig import get_python_lib
121-
except ImportError as e:
122-
s = normalizeWhitespace("""Supybot requires the distutils package to
123-
install. This package is normally included with Python, but for some
124-
unfathomable reason, many distributions to take it out of standard Python
125-
and put it in another package, usually caled 'python-dev' or python-devel'
126-
or something similar. This is one of the dumbest things a distribution can
127-
do, because it means that developers cannot rely on *STANDARD* Python
128-
modules to be present on systems of that distribution. Complain to your
129-
distribution, and loudly. If you how much of our time we've wasted telling
130-
people to install what should be included by default with Python you'd
131-
understand why we're unhappy about this. Anyway, to reiterate, install the
132-
development package for Python that your distribution supplies.""")
133-
sys.stderr.write(os.linesep*2)
134-
sys.stderr.write(textwrap.fill(s))
135-
sys.stderr.write(os.linesep*2)
136-
sys.exit(-1)
137-
138-
139-
if clean:
140-
previousInstall = os.path.join(get_python_lib(), 'supybot')
141-
if os.path.exists(previousInstall):
142-
try:
143-
print('Removing current installation.')
144-
shutil.rmtree(previousInstall)
145-
except Exception as e:
146-
print('Couldn\'t remove former installation: %s' % e)
147-
sys.exit(-1)
148-
149106
packages = ['supybot',
150107
'supybot.locales',
151108
'supybot.utils',

0 commit comments

Comments
 (0)