Skip to content

Commit d39de1e

Browse files
mgornyionelmc
authored andcommitted
Fix custom commands with newer setuptools
Fix custom commands to handle additional arguments to the run() method. This is needed with newer versions of setuptools since they've started passing 'show_deprecation' kwarg in easy_install command, and this resulted in the following error: ``` Traceback (most recent call last): File "/tmp/pytest-cov/./setup.py", line 86, in <module> setup( File "/usr/lib/python3.9/site-packages/setuptools/__init__.py", line 153, in setup return distutils.core.setup(**attrs) File "/usr/lib/python3.9/distutils/core.py", line 148, in setup dist.run_commands() File "/usr/lib/python3.9/distutils/dist.py", line 966, in run_commands self.run_command(cmd) File "/usr/lib/python3.9/distutils/dist.py", line 985, in run_command cmd_obj.run() File "/usr/lib/python3.9/site-packages/setuptools/command/install.py", line 67, in run self.do_egg_install() File "/usr/lib/python3.9/site-packages/setuptools/command/install.py", line 117, in do_egg_install cmd.run(show_deprecation=False) TypeError: run() got an unexpected keyword argument 'show_deprecation' ``` While at it, future-proof all overriden commands to accept pass any arguments through.
1 parent b45388d commit d39de1e

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

setup.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,24 +30,24 @@ def read(*names, **kwargs):
3030

3131

3232
class BuildWithPTH(build):
33-
def run(self):
34-
build.run(self)
33+
def run(self, *args, **kwargs):
34+
build.run(self, *args, **kwargs)
3535
path = join(dirname(__file__), 'src', 'pytest-cov.pth')
3636
dest = join(self.build_lib, basename(path))
3737
self.copy_file(path, dest)
3838

3939

4040
class EasyInstallWithPTH(easy_install):
41-
def run(self):
42-
easy_install.run(self)
41+
def run(self, *args, **kwargs):
42+
easy_install.run(self, *args, **kwargs)
4343
path = join(dirname(__file__), 'src', 'pytest-cov.pth')
4444
dest = join(self.install_dir, basename(path))
4545
self.copy_file(path, dest)
4646

4747

4848
class InstallLibWithPTH(install_lib):
49-
def run(self):
50-
install_lib.run(self)
49+
def run(self, *args, **kwargs):
50+
install_lib.run(self, *args, **kwargs)
5151
path = join(dirname(__file__), 'src', 'pytest-cov.pth')
5252
dest = join(self.install_dir, basename(path))
5353
self.copy_file(path, dest)
@@ -58,8 +58,8 @@ def get_outputs(self):
5858

5959

6060
class DevelopWithPTH(develop):
61-
def run(self):
62-
develop.run(self)
61+
def run(self, *args, **kwargs):
62+
develop.run(self, *args, **kwargs)
6363
path = join(dirname(__file__), 'src', 'pytest-cov.pth')
6464
dest = join(self.install_dir, basename(path))
6565
self.copy_file(path, dest)

0 commit comments

Comments
 (0)