{"action":"opened","issue":{"url":"https://api.github.com/repos/pydoit/doit/issues/138","repository_url":"https://api.github.com/repos/pydoit/doit","labels_url":"https://api.github.com/repos/pydoit/doit/issues/138/labels{/name}","comments_url":"https://api.github.com/repos/pydoit/doit/issues/138/comments","events_url":"https://api.github.com/repos/pydoit/doit/issues/138/events","html_url":"https://github.com/pydoit/doit/issues/138","id":156385040,"number":138,"title":"Problem with using absolute paths for targets and dependencies","user":{"login":"DGrady","id":392172,"avatar_url":"https://avatars.githubusercontent.com/u/392172?v=3","gravatar_id":"","url":"https://api.github.com/users/DGrady","html_url":"https://github.com/DGrady","followers_url":"https://api.github.com/users/DGrady/followers","following_url":"https://api.github.com/users/DGrady/following{/other_user}","gists_url":"https://api.github.com/users/DGrady/gists{/gist_id}","starred_url":"https://api.github.com/users/DGrady/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DGrady/subscriptions","organizations_url":"https://api.github.com/users/DGrady/orgs","repos_url":"https://api.github.com/users/DGrady/repos","events_url":"https://api.github.com/users/DGrady/events{/privacy}","received_events_url":"https://api.github.com/users/DGrady/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-05-23T22:58:04Z","updated_at":"2016-05-23T22:58:04Z","closed_at":null,"body":"It looks like there's some kind of problem with doit's file name tracking when using absolute paths. If a task defines targets and dependencies using absolute paths, doit tries to get information about these files even if they don't yet exist.\r\n\r\nFor example, this `dodo.py` file\r\n\r\n```\r\nfrom pathlib import Path\r\n\r\ndef task_first():\r\n\r\n    target = str(Path('dummy.txt').resolve())\r\n\r\n    return {\r\n        'actions': [lambda: print(\"This is the first task.\")],\r\n        'targets': [target],\r\n    }\r\n\r\n\r\ndef task_second():\r\n\r\n    dep = str(Path('dummy.txt').resolve())\r\n    target = str(Path('dummy2.txt').resolve())\r\n\r\n    return {\r\n        'actions': [lambda: print(\"This is the second task.\")],\r\n        'file_dep': [dep],\r\n        'targets': [target],\r\n    }\r\n```\r\n\r\nfails with the following stack trace when running `doit list`.\r\n\r\n```\r\nTraceback (most recent call last):\r\n  File \"/Users/dgrady/anaconda/envs/python3/lib/python3.5/site-packages/doit/doit_cmd.py\", line 168, in run\r\n    return command.parse_execute(args)\r\n  File \"/Users/dgrady/anaconda/envs/python3/lib/python3.5/site-packages/doit/cmd_base.py\", line 122, in parse_execute\r\n    return self.execute(params, args)\r\n  File \"/Users/dgrady/anaconda/envs/python3/lib/python3.5/site-packages/doit/cmd_base.py\", line 380, in execute\r\n    self, params, args)\r\n  File \"/Users/dgrady/anaconda/envs/python3/lib/python3.5/site-packages/doit/cmd_base.py\", line 273, in load_tasks\r\n    return self._load_from(cmd, dodo_module, self.cmd_names)\r\n  File \"/Users/dgrady/anaconda/envs/python3/lib/python3.5/site-packages/doit/cmd_base.py\", line 247, in _load_from\r\n    task_list = loader.load_tasks(members, cmd_list, cmd.execute_tasks)\r\n  File \"/Users/dgrady/anaconda/envs/python3/lib/python3.5/site-packages/doit/loader.py\", line 148, in load_tasks\r\n    _process_gen()\r\n  File \"/Users/dgrady/anaconda/envs/python3/lib/python3.5/site-packages/doit/loader.py\", line 140, in _process_gen\r\n    task_list.extend(generate_tasks(name, ref(), ref.__doc__))\r\n  File \"/Users/dgrady/Documents/doitest/dodo.py\", line 5, in task_first\r\n    target = str(Path('dummy.txt').resolve())\r\n  File \"/Users/dgrady/anaconda/envs/python3/lib/python3.5/pathlib.py\", line 1094, in resolve\r\n    s = self._flavour.resolve(self)\r\n  File \"/Users/dgrady/anaconda/envs/python3/lib/python3.5/pathlib.py\", line 330, in resolve\r\n    return _resolve(base, str(path)) or sep\r\n  File \"/Users/dgrady/anaconda/envs/python3/lib/python3.5/pathlib.py\", line 315, in _resolve\r\n    target = accessor.readlink(newpath)\r\n  File \"/Users/dgrady/anaconda/envs/python3/lib/python3.5/pathlib.py\", line 422, in readlink\r\n    return os.readlink(path)\r\nFileNotFoundError: [Errno 2] No such file or directory: '/Users/dgrady/Documents/doitest/dummy.txt'\r\n```\r\n\r\n\r\n```\r\n$ python --version\r\nPython 3.5.1 :: Anaconda 2.5.0 (x86_64)\r\n$ doit --version\r\n0.29.0\r\nlib @ /Users/dgrady/anaconda/envs/python3/lib/python3.5/site-packages/doit\r\n```"}}
{"actor":{"display_login":"DGrady"}}