outline tool does not work if relative path to source module is not valid

Bug #503915 reported by kevingill
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
PIDA
New
Undecided
Unassigned

Bug Description

PIDA 0.6beta3
--
            # In my project folder I have eggs which contain source. The path to the source
            # is not a valid python import path. I use this logic to create an import path.
            # For example if I have an egg zope.app.security in my project folder, I include
            # it in my PYTHON_PATH and then import files using zope.app.security.xxxx, rather
            # than zope.app.security.zope.app.security.xxx

Patch to ropebrowser.py, line 311

            if len(parts) > 0 and not self.modname.startswith('/'):
                import os.path
                base_path = project.source_directory + '/'
                all_paths = []
                for p in range(1, len(parts)):
                    all_paths.insert(0, '/'.join(parts[:p]))
                longest_path = None
                for path in all_paths:
                    init_path = base_path + path + '/__init__.py'
                    if not (os.path.exists(init_path) or
                            os.path.exists(init_path + 'c') or
                            os.path.exists(init_path + 'o')):
                        longest_path = '/'.join(parts[:-1])[len(path)+1:]
                        break
                if longest_path:
                    self.modname = (longest_path + '/' + parts[-1][:-3]).replace('/', '.')

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.