Re: Python 3 compatibility update to Python guidelines

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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::
  print(get_python_lib())

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.
> 
+1

-Toshio

Attachment: pgpYcIoApyMh5.pgp
Description: PGP signature

--
Fedora-packaging mailing list
Fedora-packaging@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/fedora-packaging

[Index of Archives]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite Forum]     [KDE Users]

  Powered by Linux