> On Wed, 11 Sep 2013 16:53:25 +0900
> YAMAMOTO Takashi <[email protected]> wrote:
> 
>> Signed-off-by: YAMAMOTO Takashi <[email protected]>
>> ---
>>  ryu/utils.py | 10 ++++++++--
>>  1 file changed, 8 insertions(+), 2 deletions(-)
>> 
>> diff --git a/ryu/utils.py b/ryu/utils.py
>> index e8fc7a2..1e1aa49 100644
>> --- a/ryu/utils.py
>> +++ b/ryu/utils.py
>> @@ -47,8 +47,12 @@ def chop_py_suffix(p):
>>  
>>  
>>  def _likely_same(a, b):
>> -    if os.path.samefile(a, b):
>> -        return True
>> +    try:
>> +        if os.path.samefile(a, b):
>> +            return True
>> +    except OSError:
>> +        # m.__file__ is not always accessible.  eg. egg
>> +        return False
>>      if chop_py_suffix(a) == chop_py_suffix(b):
>>          return True
>>      return False
>> @@ -57,6 +61,8 @@ def _likely_same(a, b):
>>  def _find_loaded_module(modpath):
>>      # copy() to avoid RuntimeError: dictionary changed size during iteration
>>      for k, m in sys.modules.copy().iteritems():
>> +        if k == '__main__':
>> +            continue
>>          if not hasattr(m, '__file__'):
>>              continue
>>          if _likely_same(m.__file__, modpath):
> 
> I can say that the code is complicated enough now. I prefer simply
> catching the oslo.config exception. As I said before, what we need to
> solve is oslo.config double import. Except for that, double import is
> not a problem. We should not worry about it.

i'd say it's necessary complexity.

it's better not to leave unusual pitfalls for ryu-app developers
like double import.

besides that, we need the similar complexity for other issues anyway.
the previous code doesn't work well for modules with same basename
like topology.dumper and vrrp.dumper.  an alternative would be to declare
that modules should have unique basenames, but i'm not sure if it's
a good idea.

YAMAMOTO Takashi

> 
> ------------------------------------------------------------------------------
> LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
> 1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
> 2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
> Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/22/13. 
> http://pubads.g.doubleclick.net/gampad/clk?id=64545871&iu=/4140/ostg.clktrk
> _______________________________________________
> Ryu-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/ryu-devel

------------------------------------------------------------------------------
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. 
http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to