Show More
@@ -10,10 +10,11 import error, util | |||
|
10 | 10 | import os, errno |
|
11 | 11 | |
|
12 | 12 | class config(object): |
|
13 | def __init__(self, data=None): | |
|
13 | def __init__(self, data=None, includepaths=[]): | |
|
14 | 14 | self._data = {} |
|
15 | 15 | self._source = {} |
|
16 | 16 | self._unset = [] |
|
17 | self._includepaths = includepaths | |
|
17 | 18 | if data: |
|
18 | 19 | for k in data._data: |
|
19 | 20 | self._data[k] = data[k].copy() |
@@ -110,13 +111,17 class config(object): | |||
|
110 | 111 | item = None |
|
111 | 112 | cont = False |
|
112 | 113 | m = includere.match(l) |
|
113 | if m: | |
|
114 | inc = util.expandpath(m.group(1)) | |
|
115 |
|
|
|
116 | inc = os.path.normpath(os.path.join(base, inc)) | |
|
117 | if include: | |
|
114 | ||
|
115 | if m and include: | |
|
116 | expanded = util.expandpath(m.group(1)) | |
|
117 | includepaths = [os.path.dirname(src)] + self._includepaths | |
|
118 | ||
|
119 | for base in includepaths: | |
|
120 | inc = os.path.normpath(os.path.join(base, expanded)) | |
|
121 | ||
|
118 | 122 | try: |
|
119 | 123 | include(inc, remap=remap, sections=sections) |
|
124 | break | |
|
120 | 125 | except IOError, inst: |
|
121 | 126 | if inst.errno != errno.ENOENT: |
|
122 | 127 | raise error.ParseError(_("cannot include %s (%s)") |
General Comments 0
You need to be logged in to leave comments.
Login now