Revision 5c285c17 snf-common/synnefo/util/entry_points.py
b/snf-common/synnefo/util/entry_points.py | ||
---|---|---|
35 | 35 |
import pkg_resources |
36 | 36 |
import inspect |
37 | 37 |
import types |
38 |
import os |
|
38 | 39 |
|
39 | 40 |
from collections import defaultdict |
40 | 41 |
import inspect |
41 | 42 |
|
43 |
# List of python distribution names which entry points will get excluded |
|
44 |
# from snf-common settings extension mechanism |
|
45 |
EXCLUDED_PACKAGES = os.environ.get('SYNNEFO_EXCLUDE_PACKAGES', '').split(":") |
|
46 |
|
|
42 | 47 |
def get_entry_points(ns, name): |
43 | 48 |
for entry_point in pkg_resources.iter_entry_points(group=ns): |
44 |
if entry_point.name == name: |
|
49 |
if entry_point.name == name and \ |
|
50 |
not entry_point.dist.project_name in EXCLUDED_PACKAGES: |
|
45 | 51 |
yield entry_point |
46 | 52 |
|
47 | 53 |
|
... | ... | |
93 | 99 |
for e in get_entry_points(ns, entry_point_name): |
94 | 100 |
obj = entry_point_to_object(e) |
95 | 101 |
for row in obj: |
102 |
# skip duplicate entries |
|
103 |
if row in settings_object: |
|
104 |
continue |
|
105 |
|
|
96 | 106 |
if type(row) == dict and (row.get('before', False) or \ |
97 | 107 |
row.get('after', False)): |
98 | 108 |
if row.get('before', False): |
Also available in: Unified diff