Changeset View
Changeset View
Standalone View
Standalone View
src/kapidox/preprocessing.py
Show First 20 Lines • Show All 157 Lines • ▼ Show 20 Line(s) | 157 | Returns: | |||
---|---|---|---|---|---|
158 | A list of metainfo dictionary (see create_metainfo()). | 158 | A list of metainfo dictionary (see create_metainfo()). | ||
159 | 159 | | |||
160 | """ | 160 | """ | ||
161 | metalist = [] | 161 | metalist = [] | ||
162 | for path, dirs, _ in os.walk(rootdir): | 162 | for path, dirs, _ in os.walk(rootdir): | ||
163 | # We don't want to do the recursion in the dotdirs | 163 | # We don't want to do the recursion in the dotdirs | ||
164 | dirs[:] = [d for d in dirs if not d[0] == '.'] | 164 | dirs[:] = [d for d in dirs if not d[0] == '.'] | ||
165 | if sys.version_info.major < 3: | 165 | if sys.version_info.major < 3: | ||
166 | path = path.decode(sys.getfilesystemencoding()) | 166 | # hardcoding UTF-8 here as sys.getfilesystemencoding() seems not reliable | ||
167 | # e.g. with api.kde.org's server this is 'ANSI_X3.4-1968', despite all locale vars having *.UTF-8 | ||||
168 | # And chance is low someone using kapixdox is using another filesystem encoding, | ||||
169 | # they should just use Python3 anyway now so no run into this code branch :) | ||||
170 | path = path.decode('utf-8') | ||||
167 | metainfo = create_metainfo(path) | 171 | metainfo = create_metainfo(path) | ||
168 | if metainfo is not None: | 172 | if metainfo is not None: | ||
169 | if metainfo['public_lib'] or 'group_info' in metainfo: | 173 | if metainfo['public_lib'] or 'group_info' in metainfo: | ||
170 | metalist.append(metainfo) | 174 | metalist.append(metainfo) | ||
171 | else: | 175 | else: | ||
172 | logging.warning("{} has no public libraries" | 176 | logging.warning("{} has no public libraries" | ||
173 | .format(metainfo['name'])) | 177 | .format(metainfo['name'])) | ||
174 | 178 | | |||
▲ Show 20 Lines • Show All 81 Lines • Show Last 20 Lines |