[Python-bugs-list] [ python-Bugs-574235 ] convert_path fails with empty pathname

noreply@sourceforge.net noreply@sourceforge.net
Tue, 13 Aug 2002 10:50:08 -0700


Bugs item #574235, was opened at 2002-06-26 15:48
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=574235&group_id=5470

Category: Distutils
Group: Python 2.1.2
>Status: Closed
Resolution: Accepted
Priority: 5
Submitted By: Aneesh Dalvi (adalvi)
Assigned to: Neal Norwitz (nnorwitz)
Summary: convert_path fails with empty pathname

Initial Comment:
In distutils/util.py, in the function convert_path, I find I 
have to add the following two lines:

def convert_path (pathname):
    ...
    if os.sep == '/':
        return pathname
>>    if pathname=='':
>>        return pathname

This is required when installing piddle-1.0.15 on a Win32 
platform.  It is required under Python 2.1.2 as well as 
2.2.1.

I don't know if it is something specific to piddle, Win32, 
or something else.


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

>Comment By: Neal Norwitz (nnorwitz)
Date: 2002-08-13 13:50

Message:
Logged In: YES 
user_id=33168

Checked in as distutils/util.py 1.70 and 1.65.6.1.
Thanks!

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

Comment By: Martin v. Löwis (loewis)
Date: 2002-08-11 17:07

Message:
Logged In: YES 
user_id=21627

I've checked piddle, and the traceback is

Traceback (most recent call last):
  File "setup.py", line 28, in ?
    packages = ['piddle', 'piddle.piddleGTK',
'piddle.piddleSVG', 'piddle.piddleTK2'] )
  File "/usr/local/lib/python2.3/distutils/core.py", line
140, in setup
    dist.run_commands()
  File "/usr/local/lib/python2.3/distutils/dist.py", line
886, in run_commands
    self.run_command(cmd)
  File "/usr/local/lib/python2.3/distutils/dist.py", line
906, in run_command
    cmd_obj.run()
  File
"/usr/local/lib/python2.3/distutils/command/install.py",
line 504, in run
    self.run_command(cmd_name)
  File "/usr/local/lib/python2.3/distutils/cmd.py", line
334, in run_command
    self.distribution.run_command(command)
  File "/usr/local/lib/python2.3/distutils/dist.py", line
906, in run_command
    cmd_obj.run()
  File
"/usr/local/lib/python2.3/distutils/command/install_data.py",
line 61, in run
    dir = convert_path(f[0])
  File "/usr/local/lib/python2.3/distutils/util.py", line
85, in convert_path
    assert pathname
AssertionError

(the assertion is a local change). This in turn results from

      data_files = [ ('piddle/pilfonts', pilfontsList),
                     ('piddle', ['src/piddle/python.gif']),
                     ('', ['src/piddle.pth']) ],

i.e. it tries to install piddle.pth into install_dir.

So the change is ok, although I'm not sure whether
install_data's usage of convert_path is correct. E.g. it
tries to support absolute paths, which are rejected in
convert_path.


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

Comment By: Neal Norwitz (nnorwitz)
Date: 2002-08-11 11:33

Message:
Logged In: YES 
user_id=33168

Martin, could you please review this patch?  Should this be
implemented?

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

Comment By: Neal Norwitz (nnorwitz)
Date: 2002-06-26 22:02

Message:
Logged In: YES 
user_id=33168

This approach seems reasonable.
I've attached a patch.
I'm not sure why an empty path would
be passed, but I suppose it can't hurt to check.

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

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