Hi Iwase-san,

On Wed, 8 Jun 2016 10:44:30 +0900
Iwase Yusuke <[email protected]> wrote:

> Hi Kakuma-San,
> 
> On 2016年06月08日 10:15, fumihiko kakuma wrote:
> > Hi Iwase-san,
> >
> > On Tue, 7 Jun 2016 16:33:46 +0900
> > Iwase Yusuke <[email protected]> wrote:
> >
> >>>>
> >>>> Yes, I think it's better.
> >>>> But this statement takes effect only the module which is defined,
> >>>> so, in the other module without this statement, it has no effect.
> >>>>
> >>>> Does anyone know how to globally enforce the explicit relative imports?
> >>>>
> >>>
> >>> Unfortunately it seems that there is not such a way to me.
> >>> But the following tool may be usuful.
> >>>
> >>> $ sudo pip install future
> >>> $ futurize -f libfuturize.fixes.fix_absolute_import ryu/
> >>>
> >>> This will add "absolute_import" statement to all files under the 
> >>> specified directory
> >>
> >> Thanks a lot! I'll try it!
> >>
> >
> > I forgot to add '-w' option. It writes back modified files.
> 
> Thanks.
> 
> I checked Ryu source codes with this tool, the remainings ware only 
> ryu/contrib/*.
> So, I could confirm "absolute_import" statement are added correctly with this 
> patch.
> 
> FYI, test_parser.py was checked out too, but this is miss-check, I think.

Thank you for your work and infomation. Hmm, the tool seems to be incomplete.

> 
> >
> >>>
> >>>
> >>>>>
> >>>>>> diff --git a/ryu/services/protocols/bgp/utils/circlist.py 
> >>>>>> b/ryu/services/protocols/bgp/utils/circlist.py
> >>>>>> index d22ec21..4a04f4f 100644
> >>>>>> --- a/ryu/services/protocols/bgp/utils/circlist.py
> >>>>>> +++ b/ryu/services/protocols/bgp/utils/circlist.py
> >>>>>> @@ -13,7 +13,9 @@
> >>>>>>     # See the License for the specific language governing permissions 
> >>>>>> and
> >>>>>>     # limitations under the License.
> >>>>>>
> >>>>>> -from six.moves import intern
> >>>>>> +import six
> >>>>>> +if six.PY3:
> >>>>>> +    from sys import intern
> >>>>>
> >>>>> Is this intended to work with six>=1.4.0 ?
> >>>>
> >>>> Sorry, I mistook.
> >>>> The existing code works correctly.
> >>>>
> >>>> (py35) $ pip show six
> >>>> ---
> >>>> Metadata-Version: 2.0
> >>>> Name: six
> >>>> Version: 1.10.0
> >>>> Summary: Python 2 and 3 compatibility utilities
> >>>> Home-page: http://pypi.python.org/pypi/six/
> >>>> ...
> >>>> (py35) $
> >>>> (py35) $ python
> >>>> Python 3.5.1+ (default, Mar 30 2016, 22:46:26)
> >>>> [GCC 5.3.1 20160330] on linux
> >>>> Type "help", "copyright", "credits" or "license" for more information.
> >>>>>>> from six.moves import intern
> >>>>
> >>>
> >>> six.moves for intern seems to be supported by 1.8.0 and later version
> >>> of six from the following.
> >>> (sorry, I don't check about a minor version.)
> >>>
> >>> $ pip freeze | grep six
> >>> six==1.7.0
> >>> $ python
> >>> Python 2.7.6 (default, Mar 22 2014, 22:59:56)
> >>> [GCC 4.8.2] on linux2
> >>> Type "help", "copyright", "credits" or "license" for more information.
> >>>>>> from six.moves import intern
> >>> Traceback (most recent call last):
> >>>     File "<stdin>", line 1, in <module>
> >>> ImportError: cannot import name intern
> >>>>>>
> >>>
> >>>
> >>> $ pip freeze | grep six
> >>> six==1.8.0
> >>> $ python
> >>> Python 2.7.6 (default, Mar 22 2014, 22:59:56)
> >>> [GCC 4.8.2] on linux2
> >>> Type "help", "copyright", "credits" or "license" for more information.
> >>>>>> from six.moves import intern
> >>>>>>
> >>>
> >>>
> >>> And ryu has the following requirement for six.
> >>>
> >>> $ grep six tools/pip-requires
> >>> six>=1.4.0
> >>> $
> >>>
> >>> On the other hand, a six package version in ubuntu 14.04 lts is 1.5.2-1.
> >>>
> >>> $ lsb_release -a
> >>> No LSB modules are available.
> >>> Distributor ID: Ubuntu
> >>> Description:    Ubuntu 14.04.2 LTS
> >>> Release:        14.04
> >>> Codename:       trusty
> >>> $ dpkg -l python-six
> >>> Desired=Unknown/Install/Remove/Purge/Hold
> >>> | 
> >>> Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
> >>> |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
> >>> ||/ Name              Version       Architecture  Description
> >>> +++-=================-=============-=============-========================================
> >>> ii  python-six        1.5.2-1       all           Python 2 and 3 
> >>> compatibility library (Py
> >>> $
> >>>
> >>> If we use 1.8.0 and later version of six installed from pip, it will be 
> >>> ok.
> >>> And tools/pip-requires should be updated.
> >>
> >> On Ubuntu 16.04 LTS, the python-six version is upgraded to "1.10.0-3".
> >>
> >> $ lsb_release -a
> >> No LSB modules are available.
> >> Distributor ID:    Ubuntu
> >> Description:       Ubuntu 16.04 LTS
> >> Release:   16.04
> >> Codename:  xenial
> >>
> >> $ dpkg -l python-six
> >> Desired=Unknown/Install/Remove/Purge/Hold
> >> | 
> >> Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
> >> |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
> >> ||/ Name            Version      Architecture Description
> >> +++-===============-============-============-====================================
> >> ii  python-six      1.10.0-3     all          Python 2 and 3 compatibility 
> >> library
> >>
> >> Hence, the previous Ubuntu LTS users are required to install six through 
> >> pip though,
> >> the latest Ubuntu LTS users are not.
> >>
> >> Do you think we can update the six version in "tools/pip-requires" to 
> >> "six>=1.8.0" now?
> >> Is it not suitable?
> >
> > I think that it is OK.
> > Currently ryu requires some pip installed packages.
> > We also may need to use new version of six for an another compatibility.
> >
> >> (I think it depends on the Ubuntu version which we should support, though)
> >>
> >
> > I agree with your thought.
> > I think that there are many users using ubuntu 14 lts.
> 
> Well, if many users are still using Ubuntu 14.04 LST,
> It is safer to keep the following changes for the compatibility, right?
> 
> > diff --git a/ryu/services/protocols/bgp/utils/circlist.py 
> > b/ryu/services/protocols/bgp/utils/circlist.py
> > index d22ec21..4a04f4f 100644
> > --- a/ryu/services/protocols/bgp/utils/circlist.py
> > +++ b/ryu/services/protocols/bgp/utils/circlist.py
> > @@ -13,7 +13,9 @@
> >    # See the License for the specific language governing permissions and
> >    # limitations under the License.
> >
> > -from six.moves import intern
> > +import six
> > +if six.PY3:
> > +    from sys import intern
> 
> Okay, I'll update may v3 patch to v4!
> (Because v3 patch does not include the above...)
> 

Okay.

> Thanks,
> Iwase
> 
> >
> > Thanks,
> > kakuma
> >
> >> Thanks,
> >> Iwase
> >>
> >>>
> >>>
> >>>> I fixed this because PyCharm code inspection said:
> >>>>      Cannot find reference 'moves' in 'six.py' (at line 16)
> >>>> but this was due to the dynamic dispatch of 'six.moves'.
> >>>>
> >>>>
> >>>> I'll update my patches!
> >>>>
> >>>> Thanks,
> >>>> Iwase
> >>>
> >

-- 
fumihiko kakuma <[email protected]>



------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity 
planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to