Do glob expansion for each element in `args` and return a flattened list. Unmatched glob pattern will remain as-is in the returned list.
(args)
| 267 | |
| 268 | |
| 269 | def shellglob(args): |
| 270 | """ |
| 271 | Do glob expansion for each element in `args` and return a flattened list. |
| 272 | |
| 273 | Unmatched glob pattern will remain as-is in the returned list. |
| 274 | |
| 275 | """ |
| 276 | expanded = [] |
| 277 | # Do not unescape backslash in Windows as it is interpreted as |
| 278 | # path separator: |
| 279 | unescape = unescape_glob if sys.platform != 'win32' else lambda x: x |
| 280 | for a in args: |
| 281 | expanded.extend(glob.glob(a) or [unescape(a)]) |
| 282 | return expanded |
| 283 | |
| 284 | ENOLINK = 1998 |
| 285 |