building an extension module with autotools?

2008-12-03 Thread Michael George

Hello,

(Please CC me in replies, as I am off-list)

I'm building an application (a game) in python, with a single C module 
containing some performance-critical code.  I'm trying to figure out the 
best way to set it up to build.  Distutils seems to be designed only for 
building and distributing code that lives in site-packages.  I'd prefer 
not to install it in the global site-packages, but rather group all of 
the files together.


I've tried using automake, however I'm worried about libtool not getting 
the options right while building my module.  It seems to me like the 
ideal frankenstein monster would be for automake to invoke distutils to 
do the actual building.  However I'm relatively new to both autotools 
and distutils, so getting this rigged up has been a bit of a challenge.  
Can anybody point me to a good example of something like this or give me 
any pointers?


Thanks!

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


Re: building an extension module with autotools?

2008-12-03 Thread Michael George

Gerhard Häring wrote:

Michael George wrote:
I've tried using automake, 


In my opinion, this is serious overkill. automake is good for making 
stuff work on a herd of different Unixen with various combinations of 
libc functions available etc. But for developing a Python extension, 
it doesn't help much at all. All you need to know about Python is 
available via macros if you import Python.h.


I'll definitely consider going the simpler route, although the other 
thing that autotools provides is a standard interface for end-users.  
For example I'm picky and don't let anything into /usr that isn't under 
the purview of the package manager.  autotools makes life easy because I 
can just do ./configure --prefix=/opt/pkgname and I know I'm good.  
Custom build setups force me to figure them out before I can install 
(and sometimes even use) the program.


Since I'll be eventually trying to attract users, I'd like to avoid 
scaring them away with custom build scripts :)

HTH

-- Gerhard


Thanks for the advice.

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


Re: building an extension module with autotools?

2008-12-03 Thread Michael George

Martin v. Löwis wrote:

I've tried using automake, however I'm worried about libtool not getting
the options right while building my module. 



You should use python-config(1) to obtain the command line options
necessary to build and link extension modules.

HTH,
Martin
  


Sweet, I think that's exactly what I wanted.  Thanks!

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


using distutils to cross-compile extensions?

2008-12-04 Thread Michael George

Hi,

Please CC me in replying as I am off list.

I have an extension module that I've built using distutils.  I wonder if 
it's possible to use distutils to cross-compile it for windows on my 
linux box, and whether the pain involved is great.  Can anyone point me 
in the right direction?


Thanks,

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


Re: Best editor?

2005-04-05 Thread Michael George Lerner
Aahz <[EMAIL PROTECTED]> wrote:

> Use vim.  80% of the power of emacs at 20% of the learning curve.

A system administrator said this to me about unix a long time ago,
but it applies equally well to emacs:

Emacs is a great place to live, but I'd hate to visit.

-michael, an (x)emacs user

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


Re: Best editor?

2005-04-07 Thread Michael George Lerner
Nicolay A. Vasiliev <[EMAIL PROTECTED]> wrote:
> Hello!

> What do you think all about ActiveState Komodo?


Is this specifically to me?  I haven't tried it, but I'm tempted.
I've recently begun teaching my wife some Python in order to help
her write a useful GUI app, and that makes it look particularly
tempting.  I'm using BoaConstructor for the GUI stuff at the moment.
It has a bit of a learning curve, but it looks nice so far.

-michael

> Michael George Lerner wrote:

> >Aahz <[EMAIL PROTECTED]> wrote:
> >
> >  
> >
> >>Use vim.  80% of the power of emacs at 20% of the learning curve.
> >>
> >>
> >
> >A system administrator said this to me about unix a long time ago,
> >but it applies equally well to emacs:
> >
> >Emacs is a great place to live, but I'd hate to visit.
> >
> >-michael, an (x)emacs user
> >
> >  
> >


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


Trouble with subprocess.call(...) and zsh script (OSError: [Errno 8] Exec format error)

2007-11-11 Thread Michael George Lerner
Hi,

(Python 2.5, OS X 10.4.10)
I have a program called pdb2pqr on my system. It is installed so that
"pdb2pqr" is in my path and looks like:

#\!/bin/zsh -f
/sw/share/pdb2pqr/pdb2pqr.py "$@"

When I call it via this script:

#!/usr/bin/env python
import subprocess
import tempfile
args = ('/sw/bin/pdb2pqr','--help')
output_file = tempfile.TemporaryFile(mode="w+")
print "Running",args
retcode =
subprocess.call(args,stdout=output_file.fileno(),stderr=subprocess.STDOUT)
output_file.close()

I get this error:

localhost~/tmp$ ./x.py
Running ('/sw/bin/pdb2pqr', '--help')
Traceback (most recent call last):
  File "./x.py", line 9, in 
retcode =
subprocess.call(args,stdout=output_file.fileno(),stderr=subprocess.STDOUT)
  File "/sw/lib/python2.5/subprocess.py", line 443, in call
return Popen(*popenargs, **kwargs).wait()
  File "/sw/lib/python2.5/subprocess.py", line 593, in __init__
errread, errwrite)
  File "/sw/lib/python2.5/subprocess.py", line 1051, in _execute_child
raise child_exception
OSError: [Errno 8] Exec format error

But when I change it to directly call the script that the zsh script
calls like this:

args = ('/sw/share/pdb2pqr/pdb2pqr.py','--help')

everything works:

localhost~/tmp$ ./x.py
Running ('/sw/share/pdb2pqr/pdb2pqr.py', '--help')

This is with 2.5 on OS X 10.4.10. I'm happy to provide whatever
additional information might be useful.

Thanks,

-michael

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


Re: Trouble with subprocess.call(...) and zsh script (OSError: [Errno 8] Exec format error)

2007-11-13 Thread Michael George Lerner
On Nov 11, 3:25 pm, Rob Wolfe <[EMAIL PROTECTED]> wrote:
Hi Rob,

> Michael  GeorgeLerner<[EMAIL PROTECTED]> writes:
>
> > Hi,
>
> > (Python 2.5, OS X 10.4.10)
> > I have a program called pdb2pqr on my system. It is installed so that
> > "pdb2pqr" is in my path and looks like:
>
> > #\!/bin/zsh -f
>
> Are you sure that this shebang is correct?

Well, it's correct in the sense that I have faithfully reproduced the
contents of the file. I didn't write it, though.

I don't know what the extra backslash is for. I suppose I'll contact
the authors and find out.

Any ideas how to make it work with the strange shebang syntax?

Thanks,

-michael

>
> I've tested that on bash and have similar error:
>
> # t1.sh
>
> #\!/bin/sh
> echo "t1"
>
> >>> from subprocess import call
> >>> call(['./t1.sh'])
>
> Traceback (most recent call last):
>   File "", line 1, in ?
>   File "/usr/lib/python2.4/subprocess.py", line 413, in call
> return Popen(*args, **kwargs).wait()
>   File "/usr/lib/python2.4/subprocess.py", line 543, in __init__
> errread, errwrite)
>   File "/usr/lib/python2.4/subprocess.py", line 975, in _execute_child
> raise child_exception
> OSError: [Errno 8] Exec format error
>
> But running that directly through the shell works:
>
> >>> call(['./t1.sh'], shell=True)
>
> t1
> 0
>
> However this script works fine also without `shell=True` option:
>
> # t2.sh
>
> #!/bin/sh
> echo "t2"
>
> >>> call(['./t2.sh'])
>
> t2
> 0
>
> HTH,
> Rob


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


Can I make these getters/setters?

2009-09-29 Thread Michael George Lerner
Hi,

As part of my GUI, I have lots of fields that people can fill in,
defined like this:

self.selection =  Pmw.EntryField(group.interior(),
labelpos='w',
label_text='Selection to use:
',
value='(polymer)',
)

I then use self.selection.get_value() and self.selection.set_value(),
and those two functions are the only ways in which I care about
self.selection. I've never really used properties, getters or setters
before. I tried this, but it didn't work:

def __init__(self):
self._selection =  Pmw.EntryField(group.interior(),
labelpos='w',
label_text='Selection to use:
',
value='(polymer)',
)
self.selection = property(self._selection.get_value
(),self._selection.set_value())

Of course, I really have ~40 things that I'd like to do this for, not
just one, so I'd like to find a fairly concise syntax.

In case it helps, here's a complete example of me failing. I'd like it
to print out "2" instead of ""

class Foo(object):
def __init__(self,val):
self._val = val
def get(self):
return self._val
def set(self,val):
self._val = val
class Bar(object):
def __init__(self):
self._v = Foo(2)
self.v = property(self._v.get,self._v.set)
b = Bar()
print b.v


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