[Fedora-packaging] Python 3 compatibility update to Python guidelines

Toshio Kuratomi a.badger at gmail.com
Tue Nov 3 18:22:40 UTC 2009

On Tue, Nov 03, 2009 at 08:55:24AM +0200, Ville Skyttä wrote:
> On Saturday 31 October 2009, Toshio Kuratomi wrote:
> > Any reason not to do it this way?
> > 
> > %{!?python_sitelib: %global python_sitelib %(%{__python} -c "from.
> > distutils.sysconfig import *; print (get_python_lib())")}
> > 
> > %{!?python_sitearch: %global python_sitearch %(%{__python} -c "from.
> > distutils.sysconfig import *; print(get_python_lib(1))")}
> Assuming the "." after "from" is unintentional in both
Yeah, copy and paste from an editor that displays trailing spaces  Sorry.

> and that there should 
> be a space after "print" and before "(" in the latter, that seems to work too.  
> It does look a bit hackish to me though.
So.. this seems to be a matter of viewpoint.  From a python3 standpoint,
print is now a function so doing::

Seems perfectly normal whereas import sys; sys.stdout.write() looks hackish.

From a python2 standpoint where print is a keyword the extra space makes
more sense::
  print (get_python_lib())

but does indeed look a little hackish. (Since you're either using
parenthesis in a throwaway manner here, or worse, with multiple values
making a tuple [which won't print correctly -- although py2.6+ has from
__future__ import print_function which makes that work.]).

Since this is purely stylistic (for python_sitelib definition, any of these
ways work) we're just deciding whether we want to write these as python3
that's backwards compatible or python2 that's forward compatible.  If we get
these into the python/python3 packages, I don't care at all.  If they stay
in the Guidelienes alone, I'd go with the python3 viewpoint since we're
starting the migration towards that.

> > Also, dmalcolm, could we get these macros into the python and python3 (when
> > revewied) package so we don't have to add them as boilerplate to every
> > package?
> That would be good, but until they're in at least the latest EL as well, I 
> intend to keep them also in the rpmdevtools spec template.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/fedora-packaging/attachments/20091103/17d8611c/attachment.sig>

More information about the Fedora-packaging mailing list