Re: [Python-Dev] A smarter shutil.copytree ?

2008-05-21 Thread Tarek Ziadé
On Tue, Apr 22, 2008 at 7:04 PM, Steven Bethard [EMAIL PROTECTED] wrote: The callable takes the src directory + its content as a list, and returns filter eligible for exclusion FWIW, that looks better to me. That makes me wonder, like Alexander said on the bug tracker: In the

Re: [Python-Dev] A smarter shutil.copytree ?

2008-04-22 Thread Tarek Ziadé
On Mon, Apr 21, 2008 at 2:25 AM, Steven Bethard [EMAIL PROTECTED] wrote: On Sun, Apr 20, 2008 at 4:15 PM, Tarek Ziadé [EMAIL PROTECTED] wrote: I have submitted a patch for review here: http://bugs.python.org/issue2663 glob-style patterns or a callable (for complex cases) can be

Re: [Python-Dev] A smarter shutil.copytree ?

2008-04-22 Thread Steven Bethard
On Tue, Apr 22, 2008 at 1:56 AM, Tarek Ziadé [EMAIL PROTECTED] wrote: On Mon, Apr 21, 2008 at 2:25 AM, Steven Bethard [EMAIL PROTECTED] wrote: On Sun, Apr 20, 2008 at 4:15 PM, Tarek Ziadé [EMAIL PROTECTED] wrote: I have submitted a patch for review here: http://bugs.python.org/issue2663

Re: [Python-Dev] A smarter shutil.copytree ?

2008-04-21 Thread Tarek Ziadé
The pattern matching uses the src_dir to call glob.glob(), which returns the list of files to be excluded. That's why I added within the copytree() function. To make an excluding_patterns work, it could be coded like this:: def excluding_patterns(*patterns): def

Re: [Python-Dev] A smarter shutil.copytree ?

2008-04-21 Thread Greg Ewing
Steven Bethard wrote: I'm not a big fan of the sequence-or-callable argument. Why not just make it a callable argument, and supply a utility function Or have two different keyword arguments, one for a sequence and one for a callable. -- Greg ___

Re: [Python-Dev] A smarter shutil.copytree ?

2008-04-20 Thread Isaac Morland
On Sun, 20 Apr 2008, Steven Bethard wrote: On Sun, Apr 20, 2008 at 4:15 PM, Tarek Ziadé [EMAIL PROTECTED] wrote: I have submitted a patch for review here: http://bugs.python.org/issue2663 glob-style patterns or a callable (for complex cases) can be provided to filter out files or

Re: [Python-Dev] A smarter shutil.copytree ?

2008-04-17 Thread Tarek Ziadé
- copying a source to a target, but the pyc/pyo file def filtering(source, target): return os.path.splitext(filename) not in ('.pyc', '.pyo') shutil.copytree(source, target, filter_=filtering) - oups, made a mistake in my example: def

Re: [Python-Dev] A smarter shutil.copytree ?

2008-04-17 Thread Tarek Ziadé
On Thu, Apr 17, 2008 at 7:06 PM, Guido van Rossum [EMAIL PROTECTED] wrote: Sounds like a neat little feature. Looking forward to it. Maybe the most useful use case would be to provide glob-style patterns for skipping files or directories (and their contents). Alright I will work on it that