pyblish / pyblish-base

Pyblish base library - see https://github.com/pyblish/pyblish for details.
Other
127 stars 59 forks source link

Fix Module mixup with same named files (#306) #318

Closed mottosso closed 7 years ago

mottosso commented 7 years ago

This alters the name of plug-ins used in-memory to one that is almost guaranteed to be unique.

Edge cases include directories with similar characters in similar places.

c:\my\plögins\collect.py
c:\my\plågins\collect.py

Though different, would both result in..

c__my_pl_gins_collect_py
c__my_pl_gins_collect_py

Where the latter one overwrites the former.

tokejepsen commented 7 years ago

This seems to fix an issue I'm having currently in Nuke.

Should we give this a merge?

mottosso commented 7 years ago

I've been experimenting with a different approach lately, give this a try and let me know if that works for you.

tokejepsen commented 7 years ago

Unfortunately this does not fix the issue I had in Nuke now :(

mottosso commented 7 years ago

Ok, let me back it up.

mottosso commented 7 years ago

Ok, should be back to normal, with the exception that it merges with master and the target feature.

tokejepsen commented 7 years ago

Yup, we are back, and the issue in Nuke is fixed :)

mottosso commented 7 years ago

Before merging this, would you mind having a look at the failing test? Otherwise I'll try and have a look at it when I can.

tokejepsen commented 7 years ago

The problem with the test is that its trying to get the module of the plugin through the module name in sys.modules but since we have changed that to the absolute path, it can't find the module anymore.

Also I noticed that you are not replace \\ with _, which you outlined in the PR. Not a problem for me or Nuke :)

tokejepsen commented 7 years ago

Question is how to access the absolute path to the module from the class?

tokejepsen commented 7 years ago

Latest commit seems to fix the issue :)

mottosso commented 7 years ago

Yeah, that should work fine. Thanks, let's give this a try. :)