(paths, local_path, include_non_existing)
| 264 | return sorted(glob.glob(fileglob)) |
| 265 | |
| 266 | def _fix_paths(paths, local_path, include_non_existing): |
| 267 | assert is_sequence(paths), repr(type(paths)) |
| 268 | new_paths = [] |
| 269 | assert not is_string(paths), repr(paths) |
| 270 | for n in paths: |
| 271 | if is_string(n): |
| 272 | if '*' in n or '?' in n: |
| 273 | p = sorted_glob(n) |
| 274 | p2 = sorted_glob(njoin(local_path, n)) |
| 275 | if p2: |
| 276 | new_paths.extend(p2) |
| 277 | elif p: |
| 278 | new_paths.extend(p) |
| 279 | else: |
| 280 | if include_non_existing: |
| 281 | new_paths.append(n) |
| 282 | print('could not resolve pattern in %r: %r' % |
| 283 | (local_path, n)) |
| 284 | else: |
| 285 | n2 = njoin(local_path, n) |
| 286 | if os.path.exists(n2): |
| 287 | new_paths.append(n2) |
| 288 | else: |
| 289 | if os.path.exists(n): |
| 290 | new_paths.append(n) |
| 291 | elif include_non_existing: |
| 292 | new_paths.append(n) |
| 293 | if not os.path.exists(n): |
| 294 | print('non-existing path in %r: %r' % |
| 295 | (local_path, n)) |
| 296 | |
| 297 | elif is_sequence(n): |
| 298 | new_paths.extend(_fix_paths(n, local_path, include_non_existing)) |
| 299 | else: |
| 300 | new_paths.append(n) |
| 301 | return [minrelpath(p) for p in new_paths] |
| 302 | |
| 303 | def gpaths(paths, local_path='', include_non_existing=True): |
| 304 | """Apply glob to paths and prepend local_path if needed. |
no test coverage detected