Anonymous avatar Anonymous committed 569336a

Adding custom source folders in project

Comments (0)

Files changed (6)


-- A simple UI for performing restructurings : May 14, 2007
+- Adding custom source folders in ```` : May 15, 2007
+- A simple UI for performing restructurings : May 15, 2007
 - Restructurings : May 14, 2007


   needs lots of time.
-Custom Source Folders
-We can add two separate project configs.  The `source_folders` config
-holds the list of project source folders.  These folders should have
-priority over the folders detected by rope.  The `python_path` config
-is for extending `sys.path`.
 Finding Similar Pieces
 This is no longer the future.  It can be done right now using
-`rope.refactor.restructure` module.  But there is no UI dialog for it
+`rope.refactor.restructure` module.  But the current UI restructuring
+dialog does not support checking names.


 * Renaming and moving normal files/folders
+* Enhanced restructuring dialog
 * Finding similar statements when extracting variable/method
 > Public Release 0.6m1 : May 20, 2007
-* Adding custom source folders in ````


-Performing Restructurings
+Small Stories
 * Should we call `pycore.resource_to_pyobject()` for all modules
 * The ability to limit the files to restructure
-* One failure on windows!
 * Caching `CodeTemplate.substitute()`?
 * CheckingFinder and ``{'?a': '?b'}`` checks?
 * Only scanning selected region for matches


     # VCSs.  Also they are not shown in "Find File" dialog.
     prefs['ignored_resources'] = ['*.pyc', '.svn', '*~', '.ropeproject']
+    # Custom source folders:  By default rope searches the project
+    # for finding source folders (folders that should be searched
+    # for finding modules).  You can add paths to that lists.  Note
+    # that rope guesses project source folders correctly most of the
+    # time; use this if you have any problems.
+    # The folders should be relative to project root and use '/' for
+    # separating folders regardless of the platform rope is running on.
+    # 'src/my_source_folder' for instance.
+    #prefs.add('source_folders', 'src')
+    # You can extend python path:
+    #prefs.add('python_path', '~/python/')
     # This option tells rope how to hold and save object information.
     # Possible values are:


         self.object_info = rope.base.oi.objectinfo.ObjectInfoManager(project)
         self.object_infer = rope.base.oi.objectinfer.ObjectInfer(self)
+        self._init_source_folders()
     def _init_resource_observer(self):
         callback = self._invalidate_resource_cache = rope.base.project.FilteredResourceObserver(observer)
+    def _init_source_folders(self):
+        self._custom_source_folders = []
+        for path in self.project.prefs.get('source_folders', []):
+            self._custom_source_folders.append(path)
+        for path in self.project.prefs.get('python_path', []):
+            sys.path.append(path)
     def _init_automatic_soi(self):
         if not self.project.get_prefs().get('automatic_soi', False):
         """Returns project source folders"""
         if self.project.root is None:
             return []
-        return self._find_source_folders(self.project.root)
+        result = list(self._custom_source_folders)
+        result.extend(self._find_source_folders(self.project.root))
+        return result
     def resource_to_pyobject(self, resource):
         if resource in self.module_map:
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.