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)
| 183 | # to import IPython during setup, which fails on Python 3. |
| 184 | |
| 185 | def target_outdated(target,deps): |
| 186 | """Determine whether a target is out of date. |
| 187 | |
| 188 | target_outdated(target,deps) -> 1/0 |
| 189 | |
| 190 | deps: list of filenames which MUST exist. |
| 191 | target: single filename which may or may not exist. |
| 192 | |
| 193 | If target doesn't exist or is older than any file listed in deps, return |
| 194 | true, otherwise return false. |
| 195 | """ |
| 196 | try: |
| 197 | target_time = os.path.getmtime(target) |
| 198 | except os.error: |
| 199 | return 1 |
| 200 | for dep in deps: |
| 201 | dep_time = os.path.getmtime(dep) |
| 202 | if dep_time > target_time: |
| 203 | #print "For target",target,"Dep failed:",dep # dbg |
| 204 | #print "times (dep,tar):",dep_time,target_time # dbg |
| 205 | return 1 |
| 206 | return 0 |
| 207 | |
| 208 | |
| 209 | def target_update(target,deps,cmd): |