New file utility for shutil - linktree.py

David MacQuigg macquigg at cadence.com
Thu Jan 2 21:14:21 CET 2003


Bjorn,

Thanks for your thoughtful comments on this proposal.

> Since Win* doesn't have symlinks it wouldn't do much for me 
> <wink>.

Ouch! It's been so long since I've done anything in the M$ world, this didn't even occur to me.  It does lower the value of having a 'linktree' function when links don't exist :>)  Perhaps this new function doesn't deserve a place in the general for-all-users library.  On the other hand, links are such a useful tool, maybe we should pop a message "Sorry, links are not supported on your platform. Try Linux :>)  I think eventually M$ will support Linux, or at least add all of its useful functionality. :>)

Good suggestions on import * and printing messages.  In the next rev, I'll follow the style of distutils, and raise exceptions instead of print messages.

- Dave

> -----Original Message-----
> From: Bjorn Pettersen [mailto:BPettersen at narex.com]
> Sent: Monday, December 30, 2002 1:34 PM
> To: David MacQuigg; python-list at python.org
> Subject: RE: New file utility for shutil - linktree.py
> 
> 
> > From: David MacQuigg [mailto:macquigg at cadence.com] 
> > 
> > I need a 'linktree' utility to create a "mock hierarchy" for 
> > testing patches to our mongo software distributions (~2GB, 
> 
> [...]
> > I decided to extend the 'os.path.exists' function, adding an 
> > optional argument to specify *exactly* what you want tested.  
> 
> I like the idea, but not the implementation. If you need that
> functionality _I_ would definitely prefer to have a separate and
> appropriately named function in os.path. This issue is 
> orthogonal to the
> rest of your proposal, so I would suggest submitting a patch for this
> first (judging from history, I'd suggest you accompany it with a
> thorough explanation of why you can't do it with the existing 
> machinery
> <wink>).
> 
> [...]
> > My questions for this group are:
> > 1) Is 'linktree' or something like it generally useful, or 
> > too specialized for inclusion in the Python distribution?
> 
> Since Win* doesn't have symlinks it wouldn't do much for me 
> <wink>. I'll
> let others decide if it's generally useful on *nix... If you can't get
> it in shutil, you might be able to get it in tools/scripts (don't know
> what the entry criteria are there, but they seem relatively 
> liberal ;-)
> 
> > 3) Can you think of any improvements?  Other applications I 
> > should consider?
> 
> The only code-nit you're going to run into is that "from 
> os.path import
> *" is a definite no-no (fully qualify your names). Oh, and I wouldn't
> expect a library call to print anything since I might not have a
> console...
> 
> Good luck.
> 
> -- bjorn
> 





More information about the Python-list mailing list