| Index: tools/deep_memory_profiler/lib/policy.py
|
| diff --git a/tools/deep_memory_profiler/lib/policy.py b/tools/deep_memory_profiler/lib/policy.py
|
| index 2a41bb25106740ffa1ca695a5b50ff81bea5163b..1de24d91a9f5e0dbd451b90cb194aff09c5a2090 100644
|
| --- a/tools/deep_memory_profiler/lib/policy.py
|
| +++ b/tools/deep_memory_profiler/lib/policy.py
|
| @@ -253,7 +253,7 @@ class Policy(object):
|
| assert False
|
|
|
| @staticmethod
|
| - def load(filename, filetype):
|
| + def load(path, filename, filetype):
|
| """Loads a policy file of |filename| in a |format|.
|
|
|
| Args:
|
| @@ -264,7 +264,11 @@ class Policy(object):
|
| Returns:
|
| A loaded Policy object.
|
| """
|
| - with open(os.path.join(BASE_PATH, filename)) as policy_f:
|
| + if not path:
|
| + path = BASE_PATH
|
| + elif path[0] == '.':
|
| + path = os.path.join(BASE_PATH, path)
|
| + with open(os.path.join(path, filename)) as policy_f:
|
| return Policy.parse(policy_f, filetype)
|
|
|
| @staticmethod
|
| @@ -402,7 +406,10 @@ class PolicySet(object):
|
| policies = {}
|
| for label in directory:
|
| LOGGER.info(' %s: %s' % (label, directory[label]['file']))
|
| - loaded = Policy.load(directory[label]['file'], directory[label]['format'])
|
| + path = None
|
| + if 'path' in directory[label]:
|
| + path = directory[label]['path']
|
| + loaded = Policy.load(path, directory[label]['file'], directory[label]['format'])
|
| if loaded:
|
| policies[label] = loaded
|
| return PolicySet(policies)
|
|
|