forked from facebookarchive/android-jsc
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBUILD_DEFS
More file actions
30 lines (23 loc) · 697 Bytes
/
Copy pathBUILD_DEFS
File metadata and controls
30 lines (23 loc) · 697 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# -*- mode: python -*-
import os
original_glob = glob
def glob(*args, **kwargs):
result = original_glob(*args, **kwargs)
result.sort()
return result
def subdir_glob(glob_specs):
"""
Given a list of tuples, the form of (relative-sub-directory, glob-pattern),
return a dict of sub-directory relative paths to full paths. Useful for
defining header maps for C/C++ libraries which should be relative the given
sub-directory.
"""
results = {}
for dirpath, glob_pattern in glob_specs:
files = glob([os.path.join(dirpath, glob_pattern)])
for f in files:
if dirpath:
results[f[len(dirpath) + 1:]] = f
else:
results[f] = f
return results