mirror of
https://gitlab.com/libvirt/libvirt-python.git
synced 2025-07-05 08:59:36 +03:00
setup: make 'clean' command compatible again with distutils
After the switch of 'my_clean' to a simple Command, the 'clean' command
has no more bits for options, resulting in distutils (either external
or embedded in setuptools) complaining about it:
distutils.errors.DistutilsClassError: command class <class '__main__.my_clean'> must provide 'user_options' attribute (a list of tuples)
To overcome that, provide all the standard bits from options, i.e. the
'user_options' list, and the 'initialize_options' & 'finalize_options'
methods. In addition, add a dummy 'all' option, as distutils wants it:
error: error in [...]/.pydistutils.cfg: command 'my_clean' has no such option 'all'
Fixes commit a965c91c6f
Signed-off-by: Pino Toscano <ptoscano@redhat.com>
This commit is contained in:
10
setup.py
10
setup.py
@ -313,6 +313,16 @@ class my_test(Command):
|
||||
subprocess.check_call([pytest])
|
||||
|
||||
class my_clean(Command):
|
||||
user_options = [
|
||||
('all', None, 'unused, compatibility with distutils')
|
||||
]
|
||||
|
||||
def initialize_options(self):
|
||||
self.all = False
|
||||
|
||||
def finalize_options(self):
|
||||
pass
|
||||
|
||||
def run(self):
|
||||
if os.path.exists("build"):
|
||||
shutil.rmtree("build", ignore_errors=True)
|
||||
|
Reference in New Issue
Block a user