Exception when comparing tasks

Bug #770150 reported by Javier Collado
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
doit
Fix Released
Undecided
schettino72

Bug Description

Using the latest code (rev. 387), the following exception is raised when tasks are compared:

Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/doit/doit_cmd.py", line 478, in cmd_main
    return sub_cmd['run'](cmd_args, sub=sub_cmd)
  File "/usr/lib/python2.7/dist-packages/doit/cmdparse.py", line 229, in __call__
    return self.do_cmd(params, args)
  File "/usr/lib/python2.7/dist-packages/doit/doit_cmd.py", line 185, in cmd_run
    params['num_process'])
  File "/usr/lib/python2.7/dist-packages/doit/cmds.py", line 26, in doit_run
    task_control = TaskControl(task_list)
  File "/usr/lib/python2.7/dist-packages/doit/control.py", line 115, in __init__
    self.targets[dep] not in task.task_dep):
  File "/usr/lib/python2.7/dist-packages/doit/task.py", line 361, in __eq__
    return self.name == other.name
AttributeError: 'str' object has no attribute 'name'

Apparently, task dependencies are strings, but the Task.__eq__ comparison method expects them to be only Task objects.

Revision history for this message
Javier Collado (javier.collado) wrote :

The attached patch fixes the issue and doesn't break any test.

However, I'm not sure if comparing a Task against a string is fine with doit design.

Revision history for this message
Javier Collado (javier.collado) wrote :

Attaching the same patch with the color escape sequences removed

Revision history for this message
schettino72 (schettino72) wrote :

it should no go to task.__eq__ ... just get the name of the task.

can you try this:

=== modified file 'doit/control.py'
--- doit/control.py 2011-04-16 17:26:58 +0000
+++ doit/control.py 2011-04-25 08:32:55 +0000
@@ -112,7 +112,7 @@
         for task in self.tasks.itervalues():
             for dep in task.file_dep:
                 if (dep in self.targets and
- self.targets[dep] not in task.task_dep):
+ self.targets[dep].name not in task.task_dep):
                     task.task_dep.append(self.targets[dep].name)

Changed in doit:
milestone: none → 0.12.0
assignee: nobody → schettino72 (schettino72)
status: New → Fix Committed
Changed in doit:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.