Returns the list of files matching the given pattern in the specified directory. Both directories and patterns are supplied as portable paths. Each pattern should be non-absolute path, and can't contain "." or ".." elements. Each slash separated element of pattern can contain the
(dirs, patterns)
| 229 | |
| 230 | |
| 231 | def glob (dirs, patterns): |
| 232 | """ Returns the list of files matching the given pattern in the |
| 233 | specified directory. Both directories and patterns are |
| 234 | supplied as portable paths. Each pattern should be non-absolute |
| 235 | path, and can't contain "." or ".." elements. Each slash separated |
| 236 | element of pattern can contain the following special characters: |
| 237 | - '?', which match any character |
| 238 | - '*', which matches arbitrary number of characters. |
| 239 | A file $(d)/e1/e2/e3 (where 'd' is in $(dirs)) matches pattern p1/p2/p3 |
| 240 | if and only if e1 matches p1, e2 matches p2 and so on. |
| 241 | |
| 242 | For example: |
| 243 | [ glob . : *.cpp ] |
| 244 | [ glob . : */build/Jamfile ] |
| 245 | """ |
| 246 | # { |
| 247 | # local result ; |
| 248 | # if $(patterns:D) |
| 249 | # { |
| 250 | # # When a pattern has a directory element, we first glob for |
| 251 | # # directory, and then glob for file name is the found directories. |
| 252 | # for local p in $(patterns) |
| 253 | # { |
| 254 | # # First glob for directory part. |
| 255 | # local globbed-dirs = [ glob $(dirs) : $(p:D) ] ; |
| 256 | # result += [ glob $(globbed-dirs) : $(p:D="") ] ; |
| 257 | # } |
| 258 | # } |
| 259 | # else |
| 260 | # { |
| 261 | # # When a pattern has not directory, we glob directly. |
| 262 | # # Take care of special ".." value. The "GLOB" rule simply ignores |
| 263 | # # the ".." element (and ".") element in directory listings. This is |
| 264 | # # needed so that |
| 265 | # # |
| 266 | # # [ glob libs/*/Jamfile ] |
| 267 | # # |
| 268 | # # don't return |
| 269 | # # |
| 270 | # # libs/../Jamfile (which is the same as ./Jamfile) |
| 271 | # # |
| 272 | # # On the other hand, when ".." is explicitly present in the pattern |
| 273 | # # we need to return it. |
| 274 | # # |
| 275 | # for local dir in $(dirs) |
| 276 | # { |
| 277 | # for local p in $(patterns) |
| 278 | # { |
| 279 | # if $(p) != ".." |
| 280 | # { |
| 281 | # result += [ sequence.transform make |
| 282 | # : [ GLOB [ native $(dir) ] : $(p) ] ] ; |
| 283 | # } |
| 284 | # else |
| 285 | # { |
| 286 | # result += [ path.join $(dir) .. ] ; |
| 287 | # } |
| 288 | # } |
nothing calls this directly
no test coverage detected