convert fail silently if cvsps is not installed

Steve Borho steve at borho.org
Sun Oct 28 11:17:50 CDT 2007


On Sun, 2007-10-28 at 16:23 +0100, marco gaddoni wrote:
> hello,
> 
> convert fail silently if cvsps is not installed.
> 
> i have made a small patch. is it acceptable?

It looks like there's a bug in your find_program().  I'm pretty sure you
intended to append .exe to program, not p.  Since you're half-way there,
why not use PATHEXT and look for all Windows executable file extensions
(*.exe, *.com, *.bat, *.cmd, etc). Something like this:

    for p in os.environ.get('PATH', os.defpath).split(os.pathsep):
        if os.name == "nt":
            for ext in os.environ.get('PATHEXT').split(os.pathsep):
                exepath = os.path.join(p, name + ext)
                if os.access(exepath, os.X_OK):
                    return exepath
        else:
            exepath = os.path.join(p, name)
            if os.access(exepath, os.X_OK):
                return exepath
    return None

Cheers,

-- 
Steve Borho (steve at borho.org)
http://www.borho.org/~steve/steve.asc
Key fingerprint = 2D08 E7CF B624 624C DE1F  E2E4 B0C2 5292 F2C6 2C8C



More information about the Mercurial-devel mailing list