Suggest design to accomodate non-unix platforms ?

Chris Angelico rosuav at gmail.com
Thu Apr 19 20:14:35 EDT 2012


On Fri, Apr 20, 2012 at 8:35 AM, Dan Stromberg <drsalists at gmail.com> wrote:
> It's not nearly as adaptive as scaning $PATH for ssh, falling back on putty
> if necessary - this is analogous to GNU autoconf.  You'd probably have a
> small class you genericize this with - with one instance for each such
> executable that might be different from one OS to another.  You could
> probably just pass __init__ a list of possible commands to try, and then
> have a __call__ method.

The question then is whether to choose or auto-detect. Attempting to
auto-detect could be quite inefficient; imagine if you have to call on
ssh every couple of seconds, and something in $PATH is on a slow
network share (or on a floppy drive, if you still have one of those).
Yes, it's a poor choice of executable path, but it's perfectly legal,
and the detection could get pathologically expensive. At very least,
consider caching the result.

> That way when Haiku takes the world by storm, your porting effort should be
> smaller.  ^_^  (Or something.  I really, really hope that Windows, OS/X and
> Linux won't be the only major OS's for all time)

Heh. Point. But the detection technique does depend on 'ssh' being the
secure shell client and accepting parameters exactly like you're
looking for - imagine if the Haiku (or whatever) ssh client takes
slightly different params. How do you handle that with autodetection?

ChrisA



More information about the Python-list mailing list