Re: [Python-Dev] compiling python2.5 on linux under wine

2009-01-09 Thread Luke Kenneth Casson Leighton
On Thu, Jan 8, 2009 at 9:07 PM, Martin v. Löwis mar...@v.loewis.de wrote:
  i'd just ... much rather be completely independent of proprietary
 software when it comes to building free software.

 I guess my question is then: why do you want to use Windows in the
 first place?

 ha ha :)  the same question was asked when i started the nt domains
reverse-engineering for samba, in 1996.  the answer is: i don't.  but
there are a lot of users and developers who feel that they don't have
a choice.  or haven't been given one.

 so if it's possible for me, as one of the under 1% of computer users
i.e. linux to compile stuff that will work on the over 95% of
computers used by everyone else i.e. windows _and_ i get to stick to
free software principles, that's gotta be good.

 take pywebkit-gtk as an example.

 the first-level (and some of the second-level) dependencies for
pywebkit-gtk are roughly as follows:

 * libstdc++
 * cairo, pango, gdk, fontconfig, gtk
 * libxml2 (which is dodgy)
 * libxslt1 (which is so dodgy and dependent on incompatible versions
of libxml2 it can't be compiled on win32)
 * libicu38
 * libcurl
 * libssl
 * webkit
 * python2.5
 * python-gobect
 * python-gtk

 that's a *big* ing list that comes in at a whopping 40mb of
_binaries_.  webkit itself comes in at 10mb alone.

 libicu38 fails _miserably_ to cross-compile with mingw32.  i was damn
lucky to have beaten it into submission: it took two days and i
couldn't run any of the tests, but actually managed to get at least
some .libs, .dlls and .a's out of the mess.

  libxslt1 and libxml2 have compile errors in mutually incompatible
versions on win32, plus, unfortunately, the versions that _do_ compile
correctly (really old versions like libxslt-1.12 + libxml2-18 or
something) are not the ones that can be used on webkit!

 i had to get the source code for gcc (4.4) because when linking
webkit against the MSVC-compiled libicu38 gcc actually segfaulted (!).
 and that was tracked down to exception handling across process /
thread boundaries in libstdc++-6 which had only literally been
fixed/patched a few days before i started the monster-compile-process.

 i tried hunting down python-gobject and python-gtk for win32, but
there is a dependency needed before you get to that: python25.lib.
as i mentioned previously i tried hunting down a .lib for python25 but
of course that would be useless unless i also have a libtool-compiled
.a so there wasn't any point.

 so, all the hard work that i did cross-compiling up webkit for win32
was completely wasted because python itself could not be compiled on
linux for a win32 platform.

hence my interest in making sure that it can be.

_then_ i can go back and revisit the monster compile process and
finally come up with the goods, on win32, on the gobject-based
DOM-model manipulation stuff i've added to pywebkit-gtk.  i've got
linux covered, i've got macosx covered.  win32 is the last one.

l.
--
http://mail.python.org/mailman/listinfo/python-list


Re: [Python-Dev] compiling python2.5 on linux under wine

2009-01-08 Thread Simon Cross
On Sat, Jan 3, 2009 at 11:22 PM, Luke Kenneth Casson Leighton
l...@lkcl.net wrote:
 secondly, i want a python25.lib which i can use to cross-compile
 modules for poor windows users _despite_ sticking to my principles and
 keeping my integrity as a free software developer.

If this eventually leads to being able to compile Python software for
Windows under Wine (using for example, py2exe) it would make my life a
lot easier.

Schiavo
Simon
--
http://mail.python.org/mailman/listinfo/python-list


Re: [Python-Dev] compiling python2.5 on linux under wine

2009-01-08 Thread David Cournapeau
On Thu, Jan 8, 2009 at 9:42 PM, Simon Cross
hodgestar+python...@gmail.com wrote:
 On Sat, Jan 3, 2009 at 11:22 PM, Luke Kenneth Casson Leighton
 l...@lkcl.net wrote:
 secondly, i want a python25.lib which i can use to cross-compile
 modules for poor windows users _despite_ sticking to my principles and
 keeping my integrity as a free software developer.

 If this eventually leads to being able to compile Python software for
 Windows under Wine (using for example, py2exe) it would make my life a
 lot easier.

You can already do that: just install windows python under wine. It
works quite well, actually. You need mingw, though, of course - Visual
Studio is far from being usable on wine.

cheers,

David
--
http://mail.python.org/mailman/listinfo/python-list


Re: [Python-Dev] compiling python2.5 on linux under wine

2009-01-08 Thread Luke Kenneth Casson Leighton
On Thu, Jan 8, 2009 at 12:42 PM, Simon Cross
hodgestar+python...@gmail.com wrote:
 On Sat, Jan 3, 2009 at 11:22 PM, Luke Kenneth Casson Leighton
 l...@lkcl.net wrote:
 secondly, i want a python25.lib which i can use to cross-compile
 modules for poor windows users _despite_ sticking to my principles and
 keeping my integrity as a free software developer.

 If this eventually leads to being able to compile Python software for
 Windows under Wine (using for example, py2exe) it would make my life a
 lot easier.

 that looks like being an accidental side-effect, yes.

 where i'm up to so far:

 * i'm using -I $(src_dir)/PC at the beginning of the includes, so
that PC/pyconfig.h gets pulled in as a priority over-and-above the
auto-generated pyconfig.h (yukkk - i know); this makes the job of
building almost-exactly-like-the-visual-studio-build much easier.

 * i'm manually compiling-linking the Modules/*.c and PC/*modules.c as
i also pulled in PC/config.c and left out Modules/config.c - that got
me even further

 * as a result i've actually got a python.exe.so that damnit, it
works!  the winreg test actually passes for example!

the fly in the ointment i'm presently trying to track down: len([1,2])
returns 1L which of course screws up sre_parse.py at line 515 with
TypeError: __nonzero__ should return an int because duh if
subpattern is returning a Long not an Int.

tracking this down further, it would appear that there's some lovely
logic in PyInt_FromSsize_t() which i believe is what's getting called
from PyInt_AsSsize_t() which is what's getting called from
slot_sq_length() (i think) - and, although in this case this build is
_definitely_ returning a Long type when it shouldn't, if the value is
ever over LONG_MAX then the result will be if subpattern will
definitely fail.

but... i mean... if ever anyone passes in over 2^^31 items into
sre_parse then they _deserve_ to have their code fail, but that's not
the point.

anyway, i'm floundering around a bit and making a bit of a mess of the
code, looking for where LONG_MAX is messing up.

l.

which of course means that there's a bug in
--
http://mail.python.org/mailman/listinfo/python-list


Re: [Python-Dev] compiling python2.5 on linux under wine

2009-01-08 Thread Luke Kenneth Casson Leighton
On Thu, Jan 8, 2009 at 1:11 PM, David Cournapeau courn...@gmail.com wrote:
 On Thu, Jan 8, 2009 at 9:42 PM, Simon Cross
 hodgestar+python...@gmail.com wrote:
 On Sat, Jan 3, 2009 at 11:22 PM, Luke Kenneth Casson Leighton
 l...@lkcl.net wrote:
 secondly, i want a python25.lib which i can use to cross-compile
 modules for poor windows users _despite_ sticking to my principles and
 keeping my integrity as a free software developer.

 If this eventually leads to being able to compile Python software for
 Windows under Wine (using for example, py2exe) it would make my life a
 lot easier.

 You can already do that: just install windows python under wine.

 i tried that a few months ago - the builder requires the MS
installer, which segfaulted on my installation of wine (i installed it
using winetricks) which left me flummoxed because other people report
successful use of MSI.

 i also don't want just the python.exe, i want the libpython25.a, i
want the libpython25.lib, so as to be able to build libraries such as
pywekbit-gtk for win32 (cross-compiled using winegcc of course)

 unpacking the python installer .exe (which was, again, created with a
proprietary program) i found that all of the contents were
name-mangled and so were useless: i wasn't about to work my way
through nearly a hundred files, manually, when i can just as well get
python compiling under wine once and then stand a good chance of being
able to repeat the exercise in the future, also for python 2.6.

 so, basically, i really don't want to use visual studio, i really
don't want to install a proprietary MSI installer, i really don't want
a proprietarily-built python25.exe, and i really don't want a
proprietarily-packed installation.

 i'd just ... much rather be completely independent of proprietary
software when it comes to building free software.

  onwards :)
--
http://mail.python.org/mailman/listinfo/python-list


Re: [Python-Dev] compiling python2.5 on linux under wine

2009-01-08 Thread David Cournapeau
On Thu, Jan 8, 2009 at 11:02 PM, Luke Kenneth Casson Leighton
l...@lkcl.net wrote:
 On Thu, Jan 8, 2009 at 1:11 PM, David Cournapeau courn...@gmail.com wrote:
 On Thu, Jan 8, 2009 at 9:42 PM, Simon Cross
 hodgestar+python...@gmail.com wrote:
 On Sat, Jan 3, 2009 at 11:22 PM, Luke Kenneth Casson Leighton
 l...@lkcl.net wrote:
 secondly, i want a python25.lib which i can use to cross-compile
 modules for poor windows users _despite_ sticking to my principles and
 keeping my integrity as a free software developer.

 If this eventually leads to being able to compile Python software for
 Windows under Wine (using for example, py2exe) it would make my life a
 lot easier.

 You can already do that: just install windows python under wine.

  i tried that a few months ago - the builder requires the MS
 installer, which segfaulted on my installation of wine (i installed it
 using winetricks) which left me flummoxed because other people report
 successful use of MSI.


Hm, I could definitely install python - I have python in wine ATM.

wine python -c 'import sys; print sys.version' - 2.5.2 (r252:60911,
Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)]

IIRC, I could build numpy on it, which is far from a trivial package
from a build POV :) I think it crashes on wine, though - which I why I
did not pursued it so far. But I believe python itself at least is
usable in wine, depending on what you are trying to do.

David
--
http://mail.python.org/mailman/listinfo/python-list


Re: [Python-Dev] compiling python2.5 on linux under wine

2009-01-08 Thread Luke Kenneth Casson Leighton
 anyway, i'm floundering around a bit and making a bit of a mess of the
 code, looking for where LONG_MAX is messing up.

 fixed with this:

PyObject *
PyInt_FromSsize_t(Py_ssize_t ival)
{
if ((long)ival = (long)LONG_MIN  (long)ival = (long)LONG_MAX)
{
return PyInt_FromLong((long)ival);
}
return _PyLong_FromSsize_t(ival);
}

raised as http://bugs.python.org/issue4880


next bug: distutils.sysconfig.get_config_var('srcdir') is returning None (!!)
--
http://mail.python.org/mailman/listinfo/python-list


Re: [Python-Dev] compiling python2.5 on linux under wine

2009-01-08 Thread Luke Kenneth Casson Leighton
 next bug: distutils.sysconfig.get_config_var('srcdir') is returning None (!!)

 ok ... actually, that's correct.  oops.

 sysconfig.get_config_vars() only returns these, on win32:

{'EXE': '.exe', 'exec_prefix': 'Z:\\mnt\\src\\python2.5-2.5.2',
'LIBDEST': 'Z:\\mnt\\src\\python2.5-2.5.2\\Lib', 'prefix':
'Z:\\mnt\\src\\python2.5-2.5.2', 'SO': '.pyd', 'BINLIBDEST':
'Z:\\mnt\\src\\python2.5-2.5.2\\Lib', 'INCLUDEPY':
'Z:\\mnt\\src\\python2.5-2.5.2\\include'}

 ... nd, that means disabling setup.py or hacking it significantly
to support a win32 build, e.g. to build pyexpat, detect which modules
are left, etc. by examining the remaining vcproj files in PCbuild.

  ok - i'm done for now.

 the project's not complete, but can be regarded as successful so far.
 i think the best thing is being able to do import _winreg on a
linux system.  that absolutely tickles me silly :)

been running a few tests  - test_mmap.py is a hoot, esp. the Try
opening a bad file descriptor... that causes a wine segfault.

if anyone wants to play with this further, source is here:

   http://github.com/lkcl/pythonwine/tree/python_2.5.2_wine

at some point - if i feel like taking this further, and if people
offer some advice and hints on where to go (with e.g. setup.py) i'll
continue.

 then once that's done i'll do python 2.6 as well.

 l.
--
http://mail.python.org/mailman/listinfo/python-list


Re: [Python-Dev] compiling python2.5 on linux under wine

2009-01-08 Thread Martin v. Löwis
  i'd just ... much rather be completely independent of proprietary
 software when it comes to building free software.

I guess my question is then: why do you want to use Windows in the
first place?

Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list