Determine whether a target is out of date. target_outdated(target,deps) -> 1/0 deps: list of filenames which MUST exist. target: single filename which may or may not exist. If target doesn't exist or is older than any file listed in deps, return true, otherwise return false.
(target, deps)
| 114 | # to import IPython during setup, which fails on Python 3. |
| 115 | |
| 116 | def target_outdated(target, deps): |
| 117 | """Determine whether a target is out of date. |
| 118 | |
| 119 | target_outdated(target,deps) -> 1/0 |
| 120 | |
| 121 | deps: list of filenames which MUST exist. |
| 122 | target: single filename which may or may not exist. |
| 123 | |
| 124 | If target doesn't exist or is older than any file listed in deps, return |
| 125 | true, otherwise return false. |
| 126 | """ |
| 127 | try: |
| 128 | target_time = Path(target).stat().st_mtime |
| 129 | except FileNotFoundError: |
| 130 | return 1 |
| 131 | for dep in deps: |
| 132 | dep_time = Path(dep).stat().st_mtime |
| 133 | if dep_time > target_time: |
| 134 | # print("For target",target,"Dep failed:",dep) # dbg |
| 135 | # print("times (dep,tar):",dep_time,target_time) # dbg |
| 136 | return 1 |
| 137 | return 0 |
| 138 | |
| 139 | |
| 140 | def target_update(target, deps, cmd): |
no outgoing calls
no test coverage detected
searching dependent graphs…