Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleaning all doesn't seem to work #444

Closed
tehe opened this issue Dec 14, 2022 · 2 comments
Closed

Cleaning all doesn't seem to work #444

tehe opened this issue Dec 14, 2022 · 2 comments
Milestone

Comments

@tehe
Copy link

tehe commented Dec 14, 2022

Bug description

When there's the default_tasks specified in the dodo.py file, the doit clean --clean-all doesn't clean all targets.

from typing import Dict

DOIT_CONFIG = {'default_tasks': ['echo']}

def task_echo() -> Dict:
    return {
        'actions': ['echo xxx']
    }

def task_dir() -> Dict:
    return {
        'actions': ["mkdir xxx"],
        'clean': ["rm -rfv xxx"]
    }

The only way to have the dir task be cleaned is to explicitly specify its name on the command-line, i.e. doit clean dir.

Environment

  1. OS: Linux Debian Bullseye 11.5
  2. python version: 3.9.2
  3. doit version: 0.36.0

Proposed fix

The following change seems to fix the issue for me

diff --git a/doit/cmd_clean.py b/doit/cmd_clean.py
index 7cdc90a..899b88d 100644
--- a/doit/cmd_clean.py
+++ b/doit/cmd_clean.py
@@ -99,7 +99,7 @@ class Clean(DoitCmdBase):
         else:
             # if not cleaning specific task enable clean_dep automatically
             cleandep = True
-            if self.sel_tasks is not None:
+            if self.sel_tasks is not None and not cleanall:
                 clean_list = self._expand(self.sel_tasks)  # default tasks from config
             else:
                 clean_list = [t.name for t in self.task_list]
@schettino72 schettino72 added this to the 0.37 milestone Jan 15, 2023
@schettino72
Copy link
Member

thanks

@tehe
Copy link
Author

tehe commented Jan 16, 2023

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants