[PATCH 3 of 8] extensions: split retrieval of the extensions file paths

Martin Geisler mg at lazybytes.net
Mon Jul 6 17:54:13 CDT 2009


Cédric Duval <cedricduval at free.fr> writes:

> +def extfiles(path):
> +    '''return a dict of {name: filename} for all extensions in the given path'''
> +    try: # might not be a filesystem path
> +        list = os.listdir(path)
> +    except OSError:
> +        return {}
> +   
> +    exts = {}
> +    abspath = os.path.abspath(path)
> +    for e in list:
> +        if e.endswith('.py') and e != '__init__.py':
> +            exts[e.rsplit('.', 1)[0]] = os.path.join(abspath, e)

Since e endswith '.py', I would say that

  e.rsplit('.', 1)[0] == e[:-3]

-- 
Martin Geisler

VIFF (Virtual Ideal Functionality Framework) brings easy and efficient
SMPC (Secure Multiparty Computation) to Python. See: http://viff.dk/.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://selenic.com/pipermail/mercurial-devel/attachments/20090707/57bac0a7/attachment.pgp 


More information about the Mercurial-devel mailing list