[lxml-dev] Building with distutils only

Though it is possible to build lxml 1.2 with distutils only, no need to install anything extra, the try/except that used to be in 1.1 for this no longer exists. This is very frustrating since I don't want to use ezsetup or whatever it's called when building lxml; especially when at one point it tried to download egg from non-existent URL. At work we have the following patch; it could be easily replaced with a try/except that imports from distutils when setuptools is not installed: --- lxml-1.2.1/setup.py 2007-02-20 08:43:16.000000000 -0500 +++ lxml-1.2.1.new/setup.py 2007-04-06 15:02:13.000000000 -0400 @@ -1,7 +1,4 @@ -from ez_setup import use_setuptools -use_setuptools(version="0.5") - -from setuptools import setup +from distutils.core import setup import sys, os # need to insert this to python path so we're sure we can import --- lxml-1.2.1/setupinfo.py 2007-02-27 03:23:38.000000000 -0500 +++ lxml-1.2.1.new/setupinfo.py 2007-04-06 15:01:04.000000000 -0400 @@ -1,5 +1,5 @@ import sys, os -from setuptools.extension import Extension +from distutils.extension import Extension try: from Pyrex.Distutils import build_ext as build_pyx

Itamar Shtull-Trauring wrote:
Hmm, not that easily, though, as the first two lines trigger the installation of setuptools if they are not yet installed. That's actually intended. Do the additional keyword arguments in setup() - like zip_safe - actually pass silently in Python 2.3 or do they produce errors? Otherwise, we'd have to go back to adapting to both distutils and setuptools, which adds quite some overhead. Stefan

On Thu, 2007-06-28 at 08:44 +0200, Stefan Behnel wrote:
Hmm, not that easily, though, as the first two lines trigger the installation of setuptools if they are not yet installed. That's actually intended.
I don't want setuptools installed though; it doesn't give me anything and I don't want my setup.py to be downloading stuff off the Internet.
That's all the patch does. So apparently distutils is just fine with extra keywords. try: from setuptools.extension import Extension except ImportError: from distutils.extension import Extension and everything seems to work (assuming the person running setup.py has previously installed dependencies, which I do.) That's not a lot of overhead.

Itamar Shtull-Trauring wrote:
Actually, I don't even think we need setuptools for anything currently. We used it at the time to make it work on systems where Pyrex wasn't already installed, but then we started working around that by including the .c files in the distribution and finally ended up shipping with our own Pyrex version in the source tree. So I admit that removing the hard dependency on setuptools should now be the right thing to do. (thanks for insisting :) BTW, you can switch setuptools to offline mode, I think I read that in a recent thread on c.l.py ("eggs considered harmful").
Then that's ok. I just want to be sure it keeps working for Python 2.3/4/5. Stefan

Itamar Shtull-Trauring wrote:
Hmm, not that easily, though, as the first two lines trigger the installation of setuptools if they are not yet installed. That's actually intended. Do the additional keyword arguments in setup() - like zip_safe - actually pass silently in Python 2.3 or do they produce errors? Otherwise, we'd have to go back to adapting to both distutils and setuptools, which adds quite some overhead. Stefan

On Thu, 2007-06-28 at 08:44 +0200, Stefan Behnel wrote:
Hmm, not that easily, though, as the first two lines trigger the installation of setuptools if they are not yet installed. That's actually intended.
I don't want setuptools installed though; it doesn't give me anything and I don't want my setup.py to be downloading stuff off the Internet.
That's all the patch does. So apparently distutils is just fine with extra keywords. try: from setuptools.extension import Extension except ImportError: from distutils.extension import Extension and everything seems to work (assuming the person running setup.py has previously installed dependencies, which I do.) That's not a lot of overhead.

Itamar Shtull-Trauring wrote:
Actually, I don't even think we need setuptools for anything currently. We used it at the time to make it work on systems where Pyrex wasn't already installed, but then we started working around that by including the .c files in the distribution and finally ended up shipping with our own Pyrex version in the source tree. So I admit that removing the hard dependency on setuptools should now be the right thing to do. (thanks for insisting :) BTW, you can switch setuptools to offline mode, I think I read that in a recent thread on c.l.py ("eggs considered harmful").
Then that's ok. I just want to be sure it keeps working for Python 2.3/4/5. Stefan
participants (2)
-
Itamar Shtull-Trauring
-
Stefan Behnel