classification
Title: distutils: path '[...]' cannot end with '/' -- need better error message
Type: enhancement Stage: resolved
Components: Distutils, Distutils2, Windows Versions: Python 3.2, Python 3.3, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: eric.araujo Nosy List: alexis, eric.araujo, python-dev, srid, tarek
Priority: normal Keywords: patch

Created on 2010-04-02 04:02 by srid, last changed 2011-09-05 15:52 by python-dev. This issue is now closed.

Files
File name Uploaded Description Edit
sdist-no-traceback-3.2.diff eric.araujo, 2011-08-18 17:12 review
Messages (9)
msg102142 - (view) Author: Sridhar Ratnakumar (srid) Date: 2010-04-02 04:02
I noticed this exception in http://pypm-free.activestate.com/2.6/win32-x86/pool/d/dj/django-navbar-0.2.0_win32-x86_2.6_1.pypm.d/log


[...]

reading manifest file 'django_navbar.egg-info\SOURCES.txt'

reading manifest template 'MANIFEST.in'

Traceback (most recent call last):

  File "setup.py", line 25, in <module>

    zip_safe=False,

  File "C:\ActivePython32Python26\lib\distutils\core.py", line 152, in setup

    dist.run_commands()

  File "C:\ActivePython32Python26\lib\distutils\dist.py", line 975, in run_commands

    self.run_command(cmd)

  File "C:\ActivePython32Python26\lib\distutils\dist.py", line 995, in run_command

    cmd_obj.run()

  File "C:\ActivePython32Python26\lib\site-packages\distribute-0.6.10-py2.6.egg\setuptools\command\install.py", line 53, in run

    return _install.run(self)

  File "C:\ActivePython32Python26\lib\distutils\command\install.py", line 577, in run

    self.run_command('build')

  File "C:\ActivePython32Python26\lib\distutils\cmd.py", line 333, in run_command

    self.distribution.run_command(command)

  File "C:\ActivePython32Python26\lib\distutils\dist.py", line 995, in run_command

    cmd_obj.run()

  File "C:\ActivePython32Python26\lib\distutils\command\build.py", line 134, in run

    self.run_command(cmd_name)

  File "C:\ActivePython32Python26\lib\distutils\cmd.py", line 333, in run_command

    self.distribution.run_command(command)

  File "C:\ActivePython32Python26\lib\distutils\dist.py", line 995, in run_command

    cmd_obj.run()

  File "C:\ActivePython32Python26\lib\site-packages\distribute-0.6.10-py2.6.egg\setuptools\command\build_py.py", line 78, in run

    self.build_package_data()

  File "C:\ActivePython32Python26\lib\site-packages\distribute-0.6.10-py2.6.egg\setuptools\command\build_py.py", line 133, in build_package_data

    for package, src_dir, build_dir, filenames in self.data_files:

  File "C:\ActivePython32Python26\lib\site-packages\distribute-0.6.10-py2.6.egg\setuptools\command\build_py.py", line 90, in __getattr__

    self.data_files = files = self._get_data_files(); return files

  File "C:\ActivePython32Python26\lib\site-packages\distribute-0.6.10-py2.6.egg\setuptools\command\build_py.py", line 101, in _get_data_files

    self.analyze_manifest()

  File "C:\ActivePython32Python26\lib\site-packages\distribute-0.6.10-py2.6.egg\setuptools\command\build_py.py", line 153, in analyze_manifest

    self.run_command('egg_info')

  File "C:\ActivePython32Python26\lib\distutils\cmd.py", line 333, in run_command

    self.distribution.run_command(command)

  File "C:\ActivePython32Python26\lib\distutils\dist.py", line 995, in run_command

    cmd_obj.run()

  File "C:\ActivePython32Python26\lib\site-packages\distribute-0.6.10-py2.6.egg\setuptools\command\egg_info.py", line 179, in run

    self.find_sources()

  File "C:\ActivePython32Python26\lib\site-packages\distribute-0.6.10-py2.6.egg\setuptools\command\egg_info.py", line 254, in find_sources

    mm.run()

  File "C:\ActivePython32Python26\lib\site-packages\distribute-0.6.10-py2.6.egg\setuptools\command\egg_info.py", line 310, in run

    self.read_template()

  File "C:\ActivePython32Python26\lib\site-packages\distribute-0.6.10-py2.6.egg\setuptools\command\sdist.py", line 204, in read_template

    _sdist.read_template(self)

  File "C:\ActivePython32Python26\lib\distutils\command\sdist.py", line 336, in read_template

    self.filelist.process_template_line(line)

  File "C:\ActivePython32Python26\lib\distutils\filelist.py", line 129, in process_template_line

    (action, patterns, dir, dir_pattern) = self._parse_template_line(line)

  File "C:\ActivePython32Python26\lib\distutils\filelist.py", line 104, in _parse_template_line

    dir = convert_path(words[1])

  File "C:\ActivePython32Python26\lib\distutils\util.py", line 191, in convert_path

    raise ValueError, "path '%s' cannot end with '/'" % pathname

ValueError: path 'examples/templates/' cannot end with '/'
msg111047 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010-07-21 13:09
Could you describe the steps leading to this message, preferably in the form of a unit test?

It looks like a bug in your MANIFEST.in to me, but we need a test to be sure. At worst it’s a bug in distutils, at best it needs a better error message.
msg111081 - (view) Author: Sridhar Ratnakumar (srid) Date: 2010-07-21 16:05
Repro steps on a Windows machine:

1. pip install --no-install django-navbar==0.2

Yes, it seems like a bug in the MANIFEST file of the django-navbar project (which is not mine) that seems to have been fixed in the subsequent 0.3 release.

> at best it needs a better error message.

+1
msg137649 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-06-04 15:39
There is a simple way to fix this: change one line in sdist to catch ValueErrors in addition to DistutilsTemplateError.  Users will get a on-line warning message with the ill-formed manifest line number instead of a wall of traceback.

This is clearly a bug fix IMO: it is documented that distutils code can raise standard exceptions in addition to Distutils* errors, so here it’s not a new feature but a fix for sdist.

(Another way to fix this, would be to catch ValueError raised by convert_path in filelist and wrap it in a DistutilsTemplateError, but I’m not sure it really buys us anything.  Maybe it would be the better fix for Packaging, where the Manifest class is intended for public use.)
msg137650 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-06-04 15:39
a one-line*

I’ll have a patch up for review shortly.
msg142374 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-08-18 17:12
Can you test with this patch?
msg143530 - (view) Author: Roundup Robot (python-dev) Date: 2011-09-05 15:46
New changeset 6cd8c1582dff by Éric Araujo in branch '3.2':
Warn instead of crashing because of invalid path in MANIFEST.in (#8286).
http://hg.python.org/cpython/rev/6cd8c1582dff

New changeset b42661daa5cc by Éric Araujo in branch 'default':
Merge fix for #8286 from 3.2
http://hg.python.org/cpython/rev/b42661daa5cc
msg143531 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-09-05 15:47
This should now be fixed.
msg143535 - (view) Author: Roundup Robot (python-dev) Date: 2011-09-05 15:52
New changeset 9cdc845d5f2e by Éric Araujo in branch '2.7':
Warn instead of crashing because of invalid path in MANIFEST.in (#8286).
http://hg.python.org/cpython/rev/9cdc845d5f2e
History
Date User Action Args
2011-09-05 15:52:33python-devsetmessages: + msg143535
2011-09-05 15:47:19eric.araujosetstatus: open -> closed
resolution: fixed
messages: + msg143531

stage: test needed -> resolved
2011-09-05 15:46:07python-devsetnosy: + python-dev
messages: + msg143530
2011-08-18 17:12:57eric.araujosetfiles: + sdist-no-traceback-3.2.diff
keywords: + patch
messages: + msg142374

versions: - Python 3.1
2011-06-04 15:39:41eric.araujosetmessages: + msg137650
2011-06-04 15:39:03eric.araujosetversions: + Python 3.1, Python 2.7
nosy: + alexis

messages: + msg137649

assignee: tarek -> eric.araujo
components: + Distutils2
2010-07-21 16:05:26sridsettype: behavior -> enhancement
title: distutils: path '[...]' cannot end with '/' -> distutils: path '[...]' cannot end with '/' -- need better error message
messages: + msg111081
versions: + Python 3.2, Python 3.3, - Python 2.6
2010-07-21 13:09:39eric.araujosetnosy: + eric.araujo

messages: + msg111047
stage: test needed
2010-04-02 04:03:07sridsetcomponents: + Windows
2010-04-02 04:02:58sridcreate