def _processPackageDir(p,dn,P,allowCompiled=True): if _ofile: print('searching package', p, 'dn=',dn, file=_ofile) from reportlab.lib.utils import rl_glob, rl_isfile, rl_isdir, isCompactDistro if isCompactDistro(): ext = '.pyc' init = '__init__'+ext FN = [normpath(x) for x in rl_glob(path_join(dn,'*'))] D = [] dn = normpath(dn) for x in FN: x = path_dirname(x) if x not in D and rl_isdir(x) and path_dirname(x)==dn and rl_isfile(path_join(x,init)): D.append(x) F = [x for x in FN if x.endswith(ext) and path_dirname(x)==dn and not path_basename(x).startswith('__init__.')] else: ext = '.py' init = '__init__'+ext FN = [path_join(dn,x) for x in os.listdir(dn)] D = [x for x in FN if path_isdir(x) and isPyFile(path_join(x,init))] F = [x for x in FN if (x.endswith(ext) or (allowCompiled and (x.endswith(ext+'c') or x.endswith(ext+'o')))) and not path_basename(x).startswith('__init__.')] for f in F: mn = path_splitext(path_basename(f))[0] if p: mn = p+'.'+mn if mn not in P: if _ofile: print('appending 1',mn, file=_ofile) P.append(mn) for f in D: mn = p+('.'+path_basename(f)) if mn not in P: if _ofile: print('appending 2',mn, file=_ofile) P.append(mn)
def bruteForceSearchForAFM(faceName): """Looks in all AFM files on path for face with given name. Returns AFM file name or None. Ouch!""" from reportlab.rl_config import T1SearchPath for dirname in T1SearchPath: if not rl_isdir(dirname): continue possibles = rl_glob(dirname + os.sep + '*.[aA][fF][mM]') for possible in possibles: (topDict, glyphDict) = parseAFMFile(possible) if topDict['FontName'] == faceName: return possible return None
def bruteForceSearchForAFM(faceName): """Looks in all AFM files on path for face with given name. Returns AFM file name or None. Ouch!""" from reportlab.rl_config import T1SearchPath for dirname in T1SearchPath: if not rl_isdir(dirname): continue possibles = rl_glob(dirname + os.sep + '*.[aA][fF][mM]') for possible in possibles: try: topDict, glyphDict = parseAFMFile(possible) if topDict['FontName'] == faceName: return possible except: t,v,b=sys.exc_info() v.args = (' '.join(map(str,v.args))+', while looking for faceName=%r' % faceName,) raise
def _processPackageDir(p, dn, P, allowCompiled=True): if _ofile: print('searching package', p, 'dn=', dn, file=_ofile) from reportlab.lib.utils import rl_glob, rl_isfile, rl_isdir, isCompactDistro if isCompactDistro(): ext = '.pyc' init = '__init__' + ext FN = [normpath(x) for x in rl_glob(path_join(dn, '*'))] D = [] dn = normpath(dn) for x in FN: x = path_dirname(x) if x not in D and rl_isdir(x) and path_dirname( x) == dn and rl_isfile(path_join(x, init)): D.append(x) F = [ x for x in FN if x.endswith(ext) and path_dirname(x) == dn and not path_basename(x).startswith('__init__.') ] else: ext = '.py' init = '__init__' + ext FN = [path_join(dn, x) for x in os.listdir(dn)] D = [x for x in FN if path_isdir(x) and isPyFile(path_join(x, init))] F = [ x for x in FN if (x.endswith(ext) or (allowCompiled and ( x.endswith(ext + 'c') or x.endswith(ext + 'o')))) and not path_basename(x).startswith('__init__.') ] for f in F: mn = path_splitext(path_basename(f))[0] if p: mn = p + '.' + mn if mn not in P: if _ofile: print('appending 1', mn, file=_ofile) P.append(mn) for f in D: mn = p + ('.' + path_basename(f)) if mn not in P: if _ofile: print('appending 2', mn, file=_ofile) P.append(mn)