diff mbox

[3/6] python-rtslib-fb: new package

Message ID 20140917151302.08303544@grp-cvubrugier
State Superseded
Headers show

Commit Message

Christophe Vu-Brugier Sept. 17, 2014, 1:13 p.m. UTC
Hi Thomas,

Thank you for the prompt review.

On Wed, 17 Sep 2014 14:00:59 +0200, Thomas Petazzoni wrote :
> On Wed, 17 Sep 2014 13:39:56 +0200, Christophe Vu-Brugier wrote:
> 
> > diff --git a/package/python-rtslib-fb/Config.in b/package/python-rtslib-fb/Config.in
> > new file mode 100644
> > index 0000000..b2aebcf
> > --- /dev/null
> > +++ b/package/python-rtslib-fb/Config.in
> > @@ -0,0 +1,9 @@
> > +config BR2_PACKAGE_PYTHON_RTSLIB_FB
> > +	bool "python-rtslib-fb"
> > +	depends on BR2_PACKAGE_PYTHON
> 
> Is it for this package that you had the Python 3 issue? Could you
> explain a bit more the 2to3 problems you have seen?

It is for this package (and for configshell-fb and targetcli-fb) that I
thought I had an issue with `2to3`.
But I was wrong because it seems that `2to3` is correctly invoked by
setup.py when it is run under Python 3.
The installed python files are different from the source python files
and are modified by `2to3`:

> > diff --git a/package/python-rtslib-fb/python-rtslib.mk b/package/python-rtslib-fb/python-rtslib.mk
> > new file mode 100644
> > index 0000000..70b0257
> > --- /dev/null
> > +++ b/package/python-rtslib-fb/python-rtslib.mk
> > @@ -0,0 +1,13 @@
> > +################################################################################
> > +#
> > +# python-rtslib-fb
> > +#
> > +################################################################################
> > +
> > +PYTHON_RTSLIB_FB_VERSION = v2.1.fb49
> > +PYTHON_RTSLIB_FB_SITE = $(call github,agrover,rtslib-fb,$(PYTHON_RTSLIB_FB_VERSION))
> > +PYTHON_RTSLIB_FB_LICENSE = Apache-2.0
> > +PYTHON_RTSLIB_FB_LICENSE_FILES = COPYING
> > +PYTHON_RTSLIB_FB_SETUP_TYPE = setuptools
> > +
> > +$(eval $(python-package))
> 
> Other than that, the patch looks good to me, and the Python 3 support
> can always be added later:
> 
> Reviewed-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> 
> Thomas

Comments

Thomas Petazzoni Sept. 17, 2014, 1:15 p.m. UTC | #1
Dear Christophe Vu-Brugier,

On Wed, 17 Sep 2014 15:13:02 +0200, Christophe Vu-Brugier wrote:

> Thank you for the prompt review.

You're welcome. Thanks for submitting those packages in the first place!


> > Is it for this package that you had the Python 3 issue? Could you
> > explain a bit more the 2to3 problems you have seen?
> 
> It is for this package (and for configshell-fb and targetcli-fb) that I
> thought I had an issue with `2to3`.
> But I was wrong because it seems that `2to3` is correctly invoked by
> setup.py when it is run under Python 3.
> The installed python files are different from the source python files
> and are modified by `2to3`:
> 
> --- build/python-rtslib-fb-v2.1.fb49/rtslib/utils.py
> +++ target/usr/lib/python3.4/site-packages/rtslib/utils.py
> @@ -435,14 +435,14 @@
>              raise
>  
>  def set_attributes(obj, attr_dict, err_func):
> -    for name, value in attr_dict.iteritems():
> +    for name, value in attr_dict.items():
> 
> So if there is an issue, it is not caused by a broken `2to3`.

Indeed, this modification looks like a Python 2 vs. Python 3
conversion, even though I'm not familiar enough with the Python
language changes to be sure.

What was the issue you had with Python 3 ?

Thomas
Christophe Vu-Brugier Sept. 17, 2014, 3:21 p.m. UTC | #2
Hi Thomas,

On Wed, 17 Sep 2014 15:15:52 +0200, Thomas Petazzoni wrote :
> What was the issue you had with Python 3 ?

The only "issue" I face at the moment is with pyparsing. I get an
ImportError when I try to import this module from Python 3. I think the
module is correctly installed: I compared the installation in Buildroot
and in a virtualenv and the only difference I see is that a
"pyparsing.py" file is installed in "site-packages/" in my virtualenv.

It is expected since BR2_PACKAGE_PYTHON3_PYC_ONLY is selected. If I
select BR2_PACKAGE_PYTHON3_PY_PYC instead, then importing the pyparsing
module works.

I don't know how to properly fix this. What would you suggest?

Best regards,

--
Christophe Vu-Brugier
Thomas Petazzoni Sept. 17, 2014, 3:29 p.m. UTC | #3
Dear Christophe Vu-Brugier,

On Wed, 17 Sep 2014 17:21:11 +0200, Christophe Vu-Brugier wrote:

> The only "issue" I face at the moment is with pyparsing. I get an
> ImportError when I try to import this module from Python 3. I think the
> module is correctly installed: I compared the installation in Buildroot
> and in a virtualenv and the only difference I see is that a
> "pyparsing.py" file is installed in "site-packages/" in my virtualenv.
> 
> It is expected since BR2_PACKAGE_PYTHON3_PYC_ONLY is selected. If I
> select BR2_PACKAGE_PYTHON3_PY_PYC instead, then importing the pyparsing
> module works.
> 
> I don't know how to properly fix this. What would you suggest?

Aah, yes, sorry, not your fault. There is an issue with Python 3 and
external modules in the BR2_PACKAGE_PYTHON3_PYC_ONLY case, caused by
PEP 3147. There is a patch pending at
http://patchwork.ozlabs.org/patch/373082/ to solve this, but I'm not
really happy with the proposed solution, and I wanted to investigate
this a bit more. Which I've started to do, but of course didn't had
enough time to come to a conclusion.

For the time being, either apply the patch mentioned above, or use
BR2_PACKAGE_PYTHON3_PY_PYC.

Sorry again :/

Thomas
diff mbox

Patch

--- build/python-rtslib-fb-v2.1.fb49/rtslib/utils.py
+++ target/usr/lib/python3.4/site-packages/rtslib/utils.py
@@ -435,14 +435,14 @@ 
             raise
 
 def set_attributes(obj, attr_dict, err_func):
-    for name, value in attr_dict.iteritems():
+    for name, value in attr_dict.items():

So if there is an issue, it is not caused by a broken `2to3`.


> > +	help
> > +	  rtslib-fb is an object-based Python library for configuring
> > +	  the LIO generic SCSI target, present in 3.x Linux kernel
> > +	  versions.
> > +
> > +	  https://github.com/agrover/rtslib-fb