durusmail: quixote-users: Re: c_htmltext.obj and cl.exe
c_htmltext.obj and cl.exe
2003-07-17
2003-07-17
Re: c_htmltext.obj and cl.exe
2003-07-18
Re: c_htmltext.obj and cl.exe
2003-07-18
Re: c_htmltext.obj and cl.exe
Graham Fawcett
2003-07-18
Jason Sibre wrote:
>>On Thu, Jul 17, 2003 at 06:08:14PM -0400, Mark Bucciarelli wrote:
>>
>>>When I run setup.py install on Windows, I get an error that cl.exe
>>>cannot be found.  (cl.exe is the name of the windows C compiler.)
>>
>>You need to comment out the line:
>>
>>    kw['ext_modules'].append(htmltext)
>>
>>in setup.py.  Perhaps we should change it so the default it to not
>>compile _c_htmltext on Windows.
>
>
> I really don't know much about distutils (yet), so I don't know if this is a
> worthwhile suggestion, but is this something that could simply be handled by
> a try/except, perhaps printing a warning if the python version (vs. the C
> version) was being used?  That would simplify things for windows users
> without a [working] C compiler, especially those trying Quixote out for the
> first time.

I suggested such a patch to setup.py some time ago that fails over to the
Python implementation of htmltext. Below is a copy of the message.

On a side note, I'd like to point out that on Win32, distutils works just fine
with the Free-Software MinGW compiler, as well as MSVC. You can always specify
to use MinGW via `setup.py build --compiler=mingw32` if distutils gets
confused, or add it as an option to your setup.cfg file.

-- Graham



Long ago, Jim Dukarm wrote:

 > Now setup.py runs to completion. I have not figured out specifically
 > what was wrong, but possibly the setup is trying to copy a dll to a
 > nonexistent location, or something like that.



It was trying to *build* a DLL (or rather a .pyd file, really the same thing).
My guess is you don't have a C compiler on the workstation... definitely a
common state of affairs on Windows machines. (Or, a configuration problem is
preventing Python's distutils from running your compiler.)

Folks, since you're mandating the use of _c_htmltext now, it would be very
helpful if the setup script could recover gracefully from the build_ext
failure, thus allowing the installation of Quixote with the Python htmltext
implementation. This would be a definite benefit for Quixote on Win32.

Here's a suggestion... when distutils fails, it throws a SystemExit; how about
catching it and trying again without ext_modules?

try:
     core.setup(**kw)

except SystemExit, errmsg:
     if not kw.has_key('ext_modules'):
         raise
     else:
         print '\a'
         print 'Could not build C implementation of htmltext! Reason:'
         print errmsg
         print 'Failing over to Python implementation.'
         del kw['ext_modules']
         core.setup(**kw)


Very nice setup script, by the way. The built-up dict is a great approach.

-- Graham



reply