[ python-Bugs-1668596 ] distutils chops the first character of filenames

SourceForge.net noreply at sourceforge.net
Fri Jun 1 09:32:13 CEST 2007


Bugs item #1668596, was opened at 2007-02-25 14:15
Message generated for change (Comment added) made by nnorwitz
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1668596&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Distutils
Group: None
>Status: Closed
>Resolution: Fixed
Priority: 5
Private: No
Submitted By: Sam Pointon (freecondiments)
>Assigned to: Neal Norwitz (nnorwitz)
Summary: distutils chops the first character of filenames

Initial Comment:
Python 2.5c1, Windows XP SP2.

distutils chops the first character from some filenames if the package_data key is ''.

Minimal example:
The setup.py attached, and a directory named 'doc' in the same directory as setup.py with files in it. Running "python setup.py bdist" triggers the error.

On my box, this fails with:
running bdist
running bdist_dumb
running build
running build_py
error: can't copy 'oc\architecture.rst': doesn't exist or not a regular file

http://mail.python.org/pipermail/distutils-sig/2005-April/004453.html 
describes the same problem, and http://mail.python.org/pipermail/distutils-sig/2005-April/004458.html has a commentary on the code in distutils/commands/build_py.py which causes the error.

On lines 117-122, it tries to chop the directory path from the files it has found, using len() and slicing. This job is better done by os.path.split (and is probably more portable, too).

----------------------------------------------------------------------

>Comment By: Neal Norwitz (nnorwitz)
Date: 2007-06-01 00:32

Message:
Logged In: YES 
user_id=33168
Originator: NO

Committed revision 55731. (2.6)
Still needs to be backported.


----------------------------------------------------------------------

Comment By: Raghuram Devarakonda (draghuram)
Date: 2007-05-17 11:21

Message:
Logged In: YES 
user_id=984087
Originator: NO


It appears that I misunderstood the problem. Also, the attached setup.py
has a typo. Instead of

package_data = {'': ['doc/*']}

it should read

package_data = {'foobar': ['doc/*']}

Any way, I reproduced the problem and created a patch (1720897).

----------------------------------------------------------------------

Comment By: Raghuram Devarakonda (draghuram)
Date: 2007-05-16 08:47

Message:
Logged In: YES 
user_id=984087
Originator: NO


After reading the distutils example section today, I did find one example
using null string as package_dir value. So there may be something to this
bug after all.

----------------------------------------------------------------------

Comment By: Raghuram Devarakonda (draghuram)
Date: 2007-03-27 09:19

Message:
Logged In: YES 
user_id=984087
Originator: NO


Hi,

I reproduced the problem with the latest build on linux. The "fix" may be
trivial but I am not entirely sure if there is a problem in the first
place. The distutils document does not mention about having null value for
package_dir as is the case in your setup.py. I may be missing something
here but can you please explain the conclusion that "" is a perfectly valid
value for package_dir (as mentioned in one of the threads in mailing list)?
I am assuming that you mean "distribution root" directory by "". If this is
found to be valid usage, the  document should be updated along with the
code fix. Otherwise, a check can be put in to disallow null values. 

Raghu.




----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1668596&group_id=5470


More information about the Python-bugs-list mailing list