[Numpy-discussion] numpy distutils patch

David M. Cooke cookedm@physics.mcmaster...
Mon Nov 19 20:09:06 CST 2007


On Nov 18, 2007, at 23:30 , Jarrod Millman wrote:

> Hello,
>
> I never got any reply about the 'fix' for distutils.util.split_quoted
> in numpy/distutils/ccompiler.py.  Can anyone confirm whether this fix
> is correct or necessary?  If so, I would like to submit a patch
> upstream for this.

My opinion is that it's not necessary, or correct. The fix leaves  
quotes in if there is no whitespace, so '"Hi"' is converted to  
['"Hi"'], while '"Hi there"' becomes ['Hi there']. I can't see when  
you'd want that behaviour.

Also, it's only used by ccompiler (numpy.distutils.ccompiler replaces  
the version in distutils.ccompiler). numpy.distutils.fcompiler  
*doesn't* use this version, it uses distutils.utils.split_quoted.  
Since we run into more variety in terms of command lines with the  
Fortran compilers than the C compilers I think, and haven't been  
bitten by supposedly-bad quoting problems, I'll say we don't need our  
version.

> On Oct 29, 2007 2:17 AM, Jarrod Millman <millman@berkeley.edu> wrote:
>> Hey,
>>
>> I was looking at numpy/distutils/ccompiler.py and noticed that it has
>> a fix for distutils.util.split_quoted.
>>
>> Here is the relevant code from split_quoted in  
>> numpy.distutils.ccompiler:
>> -----------------------------------
>> def split_quoted(s):
>>
>> <snip>
>>
>>           if _has_white_re.search(s[beg+1:end-1]):
>>                s = s[:beg] + s[beg+1:end-1] + s[end:]
>>                pos = m.end() - 2
>>            else:
>>                # Keeping quotes when a quoted word does not contain
>>                # white-space. XXX: send a patch to distutils
>>                pos = m.end()
>>
>> <snip>
>> -----------------------------------
>>
>> Here is the relevant code from split_quoted in distutils.util:
>> -----------------------------------
>> def split_quoted(s):
>>
>> <snip>
>>
>>            s = s[:beg] + s[beg+1:end-1] + s[end:]
>>            pos = m.end() - 2
>>
>> <snip>
>> -----------------------------------
>>
>> Does anyone know if a patch was ever submitted upstream?  If not, is
>> there any reason that a patch shouldn't be submitted?
>>
>> Thanks,
>>
>> --
>> Jarrod Millman
>> Computational Infrastructure for Research Labs
>> 10 Giannini Hall, UC Berkeley
>> phone: 510.643.4014
>> http://cirl.berkeley.edu/
>>
>
>
>
> -- 
> Jarrod Millman
> Computational Infrastructure for Research Labs
> 10 Giannini Hall, UC Berkeley
> phone: 510.643.4014
> http://cirl.berkeley.edu/
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion@scipy.org
> http://projects.scipy.org/mailman/listinfo/numpy-discussion
>

-- 
|>|\/|<
/------------------------------------------------------------------\
|David M. Cooke              http://arbutus.physics.mcmaster.ca/dmc/
|cookedm@physics.mcmaster.ca



More information about the Numpy-discussion mailing list