Find a bug of setuptools: case problem of ‘egg-path’ option of ‘develop’ command on Windows

How do I find this bug?

Background:

Actually I do not know all the usage of the ‘develop’ command, partly because it maybe never necessary for me to use some options, or partly because I always use it just on my single working machine , e.g. Windows, orther than several OSs. I’m reading the source code of setuptools, esp. the ‘develop’ command part these days, even a tiny stuff will make me confused if I don’t know what’s the usage of it or how it work, i.e. a function, a command, e.t.c.

Although I have spent a lot of time on reading the documents of setuptools, esp. the ‘develop’ part, but firstly I just have to admit here, that now I am still a bit confused about the explanation of ‘egg-path’ on the document page by saying ‘Force the generated .egg-link file to use a specified relative path to the source directory…’, because I can not construct such a proper ‘relative path’ on my pc to show how it work. There is not a good example to show what kind of such a relative path looks like, thus the console always tells me ‘ –egg-path must be a relative path from the install directory to *** ‘ because of not correct path. However, nothing is impossible and I accidently inputted a correct path to make it work, then interesting thing happened.

Redo:

There is an ‘egg-demo’ directory on D partition of my Windows, which I will use ‘develop’ command to deploy for development purpose. The file structure is:
D:/egg-demo/setup.py
D:/egg-demo/demo/__init__.py

I used the following command string to deploy it:
python setup.py develop –egg-path=d:\egg-demo

No problem occured. Then I tried to uninstall it:
python setup.py develop –uninstall

(Note, I did not offer the –egg-path option value here, because I may forget that I set an ‘egg-path’ before when delopying it)
Then, error message was shown on the console:
“running develop
Removing d:\python27\lib\site-packages\demo.egg-link (link to .)
Link points to [‘d:\\egg-demo’, ‘.’]: uninstall aborted”

In my opinion at that time, because I set the ‘egg-path’ with the install-dir path value, the ‘python setup.py develop –uninstall’ should work even without concatenating an ‘egg-path’ value, but it did not. Then what’s the matter?

Analysis:

In fact, on case-sensitive filesystems, the current handling is ok and the above error is a good notice telling users the ‘egg-path’ option should be supplied. But on case-insensitive filesystems, e.g. Windows’s filesystems, ‘D:\egg-demo’ is the same as ‘d:\egg-demo’ and both of them point to the same directory. Similarly, if we set the ‘egg-path’ with ‘d:\Egg-demo’, ‘d:\egg-DEmo’ or the like, the same problem will also occur.

So, there should be a different handling method towards this problem for different filesystems.

Solution:

I think it needs nothing more except for doing some hacking work in ‘uninstall_link’ function of develop.py.

BTW, it’s just a 3rd-part component bug, so I may report it to http://bugs.python.org/setuptools/ instead of http://bugs.python.org/.

Advertisements
This entry was posted in Distutils2, Python. Bookmark the permalink.

2 Responses to Find a bug of setuptools: case problem of ‘egg-path’ option of ‘develop’ command on Windows

  1. Éric Araujo says:

    Yes, you should report the bug to the setuptools and distribute (on bitbucket) bug trackers.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s