CMake Python support

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

CMake Python support

Marcel Loose
Hi all,

Would it be worthwhile to add Python as a valid language to the
project() method? Or is it better to use the currently available
FindPython-like scripts.

My reason for asking is that oftentimes you'd like to byte-compile
Python source and install these byte-compiled files along with the
Python sources. If Python were a fully supported programming language,
then you could write the CMakeLists.txt files more or less the same way
as for other languages (e.g., like Java).

It's just a thought, and maybe I'm overlooking all kinds of potential
pitfalls.

Best regards,
Marcel Loose.


_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: CMake Python support

Hendrik Sattler
Zitat von Marcel Loose <[hidden email]>:

> Would it be worthwhile to add Python as a valid language to the
> project() method? Or is it better to use the currently available
> FindPython-like scripts.
>
> My reason for asking is that oftentimes you'd like to byte-compile
> Python source and install these byte-compiled files along with the
> Python sources. If Python were a fully supported programming language,
> then you could write the CMakeLists.txt files more or less the same way
> as for other languages (e.g., like Java).
>
> It's just a thought, and maybe I'm overlooking all kinds of potential
> pitfalls.

Citing from http://effbot.org/zone/python-compile.htm:
Python?s byte code is portable between platforms, but not necessarily  
between Python releases.

Unless your python module is for only one specific version or you know  
the python interpreter version on all installation targets, you better  
leave it up to the installer to compile the module (the page shows  
trivial code in python to do this).

Something different would be to get complete application binaries.  
However, that somehow defeats one purpose of using Python.

HS


_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: CMake Python support

Marcel Loose
In reply to this post by Marcel Loose
Ah thanks,

I didn't know that byte code is incompatible between Python releases.
That's definitely a pitfall ;-). I agree that, in that case, it's better
to let the installer handle byte compilation. So, in short, I can do
with the existing FindPython* scripts, I guess?

Thanks for your prompt reply.

Best regards,
Marcel Loose.

On Wed, 2009-08-19 at 10:02 +0200, Hendrik Sattler wrote:

> Zitat von Marcel Loose <[hidden email]>:
> > Would it be worthwhile to add Python as a valid language to the
> > project() method? Or is it better to use the currently available
> > FindPython-like scripts.
> >
> > My reason for asking is that oftentimes you'd like to byte-compile
> > Python source and install these byte-compiled files along with the
> > Python sources. If Python were a fully supported programming language,
> > then you could write the CMakeLists.txt files more or less the same way
> > as for other languages (e.g., like Java).
> >
> > It's just a thought, and maybe I'm overlooking all kinds of potential
> > pitfalls.
>
> Citing from http://effbot.org/zone/python-compile.htm:
> Python?s byte code is portable between platforms, but not necessarily  
> between Python releases.
>
> Unless your python module is for only one specific version or you know  
> the python interpreter version on all installation targets, you better  
> leave it up to the installer to compile the module (the page shows  
> trivial code in python to do this).
>
> Something different would be to get complete application binaries.  
> However, that somehow defeats one purpose of using Python.
>
> HS
>
>

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: CMake Python support

Philip Lowman
Speaking of the existing FindPython* scripts they do not support v3.0 yet.  Is there a need to maintain support for picking 2.x if two versions of python are installed?

On Wed, Aug 19, 2009 at 4:15 AM, Marcel Loose <[hidden email]> wrote:
Ah thanks,

I didn't know that byte code is incompatible between Python releases.
That's definitely a pitfall ;-). I agree that, in that case, it's better
to let the installer handle byte compilation. So, in short, I can do
with the existing FindPython* scripts, I guess?

Thanks for your prompt reply.

Best regards,
Marcel Loose.

On Wed, 2009-08-19 at 10:02 +0200, Hendrik Sattler wrote:
> Zitat von Marcel Loose <[hidden email]>:
> > Would it be worthwhile to add Python as a valid language to the
> > project() method? Or is it better to use the currently available
> > FindPython-like scripts.
> >
> > My reason for asking is that oftentimes you'd like to byte-compile
> > Python source and install these byte-compiled files along with the
> > Python sources. If Python were a fully supported programming language,
> > then you could write the CMakeLists.txt files more or less the same way
> > as for other languages (e.g., like Java).
> >
> > It's just a thought, and maybe I'm overlooking all kinds of potential
> > pitfalls.
>
> Citing from http://effbot.org/zone/python-compile.htm:
> Python?s byte code is portable between platforms, but not necessarily
> between Python releases.
>
> Unless your python module is for only one specific version or you know
> the python interpreter version on all installation targets, you better
> leave it up to the installer to compile the module (the page shows
> trivial code in python to do this).
>
> Something different would be to get complete application binaries.
> However, that somehow defeats one purpose of using Python.
>
> HS
>
>

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake



--
Philip Lowman

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: CMake Python support

Andreas Pakulat-2
On 19.08.09 08:34:26, Philip Lowman wrote:
> Speaking of the existing FindPython* scripts they do not support v3.0 yet.
> Is there a need to maintain support for picking 2.x if two versions of
> python are installed?

As Py2 and Py3 are basically incompatible IMHO A separate FindPython3 would
be better than letting the module try to "guess" py2 vs. py3 if both are
installed. The project using Python should have decide on wether it works
with Py3 or not.

Andreas

--
Expect the worst, it's the least you can do.
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: CMake Python support

Marcel Loose
In reply to this post by Marcel Loose
Hi Philip,

I guess Python 2.x will be around for some time, before Python 3 really
becomes mainstream. So I think it should be possible to select a 2.x
version, even if 3.x is available.

Best regards,
Marcel Loose.

On Wed, 2009-08-19 at 08:34 -0400, Philip Lowman wrote:

> Speaking of the existing FindPython* scripts they do not support v3.0
> yet.  Is there a need to maintain support for picking 2.x if two
> versions of python are installed?
>
> On Wed, Aug 19, 2009 at 4:15 AM, Marcel Loose <[hidden email]> wrote:
>         Ah thanks,
>        
>         I didn't know that byte code is incompatible between Python
>         releases.
>         That's definitely a pitfall ;-). I agree that, in that case,
>         it's better
>         to let the installer handle byte compilation. So, in short, I
>         can do
>         with the existing FindPython* scripts, I guess?
>        
>         Thanks for your prompt reply.
>        
>         Best regards,
>         Marcel Loose.
>        
>        
>         On Wed, 2009-08-19 at 10:02 +0200, Hendrik Sattler wrote:
>         > Zitat von Marcel Loose <[hidden email]>:
>         > > Would it be worthwhile to add Python as a valid language
>         to the
>         > > project() method? Or is it better to use the currently
>         available
>         > > FindPython-like scripts.
>         > >
>         > > My reason for asking is that oftentimes you'd like to
>         byte-compile
>         > > Python source and install these byte-compiled files along
>         with the
>         > > Python sources. If Python were a fully supported
>         programming language,
>         > > then you could write the CMakeLists.txt files more or less
>         the same way
>         > > as for other languages (e.g., like Java).
>         > >
>         > > It's just a thought, and maybe I'm overlooking all kinds
>         of potential
>         > > pitfalls.
>         >
>         > Citing from http://effbot.org/zone/python-compile.htm:
>         > Python?s byte code is portable between platforms, but not
>         necessarily
>         > between Python releases.
>         >
>         > Unless your python module is for only one specific version
>         or you know
>         > the python interpreter version on all installation targets,
>         you better
>         > leave it up to the installer to compile the module (the page
>         shows
>         > trivial code in python to do this).
>         >
>         > Something different would be to get complete application
>         binaries.
>         > However, that somehow defeats one purpose of using Python.
>         >
>         > HS
>         >
>         >
>        
>         _______________________________________________
>         Powered by www.kitware.com
>        
>         Visit other Kitware open-source projects at
>         http://www.kitware.com/opensource/opensource.html
>        
>         Please keep messages on-topic and check the CMake FAQ at:
>         http://www.cmake.org/Wiki/CMake_FAQ
>        
>         Follow this link to subscribe/unsubscribe:
>         http://www.cmake.org/mailman/listinfo/cmake
>        
>
>
>
> --
> Philip Lowman

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: CMake Python support

Matt McCormick
In reply to this post by Andreas Pakulat-2
Andreas Pakulat <apaku@...> writes:

>
> On 19.08.09 08:34:26, Philip Lowman wrote:
> > Speaking of the existing FindPython* scripts they do not support v3.0 yet.
> > Is there a need to maintain support for picking 2.x if two versions of
> > python are installed?
>
> As Py2 and Py3 are basically incompatible IMHO A separate FindPython3 would
> be better than letting the module try to "guess" py2 vs. py3 if both are
> installed. The project using Python should have decide on wether it works
> with Py3 or not.
>
> Andreas
>


Python 2.X are also incompatible with each other sometimes, and a user can have
multiple 2.X and 3.X installed.  IMHO, having different modules for every
version is not the write way to go.  Just make it a configuration variable in
FindPythonLibs.cmake

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: CMake Python support

Philip Lowman
On Wed, Aug 26, 2009 at 5:32 PM, Matt McCormick <[hidden email]> wrote:
Andreas Pakulat <apaku@...> writes:
> On 19.08.09 08:34:26, Philip Lowman wrote:
> > Speaking of the existing FindPython* scripts they do not support v3.0 yet.
> > Is there a need to maintain support for picking 2.x if two versions of
> > python are installed?
>
> As Py2 and Py3 are basically incompatible IMHO A separate FindPython3 would
> be better than letting the module try to "guess" py2 vs. py3 if both are
> installed. The project using Python should have decide on wether it works
> with Py3 or not.
>

Python 2.X are also incompatible with each other sometimes, and a user can have
multiple 2.X and 3.X installed.  IMHO, having different modules for every
version is not the write way to go.  Just make it a configuration variable in
FindPythonLibs.cmake

I agree with either approach, but don't have the time to work on the modules. :(

--
Philip Lowman

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: CMake Python support

Alexander Neundorf-3
In reply to this post by Matt McCormick
On Wednesday 26 August 2009, Matt McCormick wrote:

> Andreas Pakulat <apaku@...> writes:
> > On 19.08.09 08:34:26, Philip Lowman wrote:
> > > Speaking of the existing FindPython* scripts they do not support v3.0
> > > yet. Is there a need to maintain support for picking 2.x if two
> > > versions of python are installed?
> >
> > As Py2 and Py3 are basically incompatible IMHO A separate FindPython3
> > would be better than letting the module try to "guess" py2 vs. py3 if
> > both are installed. The project using Python should have decide on wether
> > it works with Py3 or not.
> >
> > Andreas
>
> Python 2.X are also incompatible with each other sometimes, and a user can
> have multiple 2.X and 3.X installed.  IMHO, having different modules for
> every version is not the write way to go.  Just make it a configuration
> variable in FindPythonLibs.cmake

This may become messy. I agree with Andreas that having a separate module for
Python3 would be better. Since they are not compatible, I don't see a reason
why one module should search for both.


Alex
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake