conduit r1446 - in trunk: . conduit conduit/dataproviders conduit/modules conduit/modules/FileModule conduit/modules/N800Module conduit/modules/PhoneModule test/python-tests
- From: jstowers svn gnome org
- To: svn-commits-list gnome org
- Subject: conduit r1446 - in trunk: . conduit conduit/dataproviders conduit/modules conduit/modules/FileModule conduit/modules/N800Module conduit/modules/PhoneModule test/python-tests
- Date: Mon, 5 May 2008 13:04:21 +0100 (BST)
Author: jstowers
Date: Mon May 5 12:04:21 2008
New Revision: 1446
URL: http://svn.gnome.org/viewvc/conduit?rev=1446&view=rev
Log:
2008-05-06 John Stowers <john stowers gmail com>
* conduit/Vfs.py:
* conduit/dataproviders/File.py:
* conduit/modules/FileModule/FileConfiguration.py:
* conduit/modules/FileModule/FileModule.py:
* conduit/modules/FileModule/config.glade:
* conduit/modules/N800Module/N800Module.py:
* conduit/modules/PhoneModule/PhoneModule.py:
* conduit/modules/TestModule.py:
* test/python-tests/TestCoreVfs.py:
* test/python-tests/TestDataProviderFolder.py:
* test/python-tests/TestSyncFolderFolder.py: Configuration option in all
file/folder dataproviders allowing them to follow symlinks.
Fixes #530929 (P. Henrique Silva)
Modified:
trunk/ChangeLog
trunk/conduit/Vfs.py
trunk/conduit/dataproviders/File.py
trunk/conduit/modules/FileModule/FileConfiguration.py
trunk/conduit/modules/FileModule/FileModule.py
trunk/conduit/modules/FileModule/config.glade
trunk/conduit/modules/N800Module/N800Module.py
trunk/conduit/modules/PhoneModule/PhoneModule.py
trunk/conduit/modules/TestModule.py
trunk/test/python-tests/TestCoreVfs.py
trunk/test/python-tests/TestDataProviderFolder.py
trunk/test/python-tests/TestSyncFolderFolder.py
Modified: trunk/conduit/Vfs.py
==============================================================================
--- trunk/conduit/Vfs.py (original)
+++ trunk/conduit/Vfs.py Mon May 5 12:04:21 2008
@@ -273,7 +273,7 @@
self.scanThreads = {}
self.pendingScanThreadsURIs = []
- def make_thread(self, folderURI, includeHidden, progressCb, completedCb, *args):
+ def make_thread(self, folderURI, includeHidden, followSymlinks, progressCb, completedCb, *args):
"""
Makes a thread for scanning folderURI. The thread callsback the model
at regular intervals with the supplied args
@@ -281,7 +281,7 @@
running = len(self.scanThreads) - len(self.pendingScanThreadsURIs)
if folderURI not in self.scanThreads:
- thread = FolderScanner(folderURI, includeHidden)
+ thread = FolderScanner(folderURI, includeHidden, followSymlinks)
thread.connect("scan-progress",progressCb, *args)
thread.connect("scan-completed",completedCb, *args)
thread.connect("scan-completed", self._register_thread_completed, folderURI)
@@ -362,11 +362,12 @@
"scan-completed": (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, [])
}
- def __init__(self, baseURI, includeHidden):
+ def __init__(self, baseURI, includeHidden, followSymlinks):
threading.Thread.__init__(self)
gobject.GObject.__init__(self)
self.baseURI = str(baseURI)
self.includeHidden = includeHidden
+ self.followSymlinks = followSymlinks
self.dirs = [self.baseURI]
self.cancelled = False
@@ -389,7 +390,7 @@
if self.cancelled:
return
dir = self.dirs.pop(0)
- try:hdir = gnomevfs.DirectoryHandle(dir)
+ try: hdir = gnomevfs.DirectoryHandle(dir)
except:
log.warn("Folder %s Not found" % dir)
continue
@@ -405,7 +406,8 @@
if filename[0] != "." or self.includeHidden:
self.dirs.append(dir+"/"+filename)
t += 1
- elif fileinfo.type == gnomevfs.FILE_TYPE_REGULAR:
+ elif fileinfo.type == gnomevfs.FILE_TYPE_REGULAR or \
+ (fileinfo.type == gnomevfs.FILE_TYPE_SYMBOLIC_LINK and self.followSymlinks):
try:
uri = uri_make_canonical(dir+"/"+filename)
#Include hidden files
Modified: trunk/conduit/dataproviders/File.py
==============================================================================
--- trunk/conduit/dataproviders/File.py (original)
+++ trunk/conduit/dataproviders/File.py Mon May 5 12:04:21 2008
@@ -220,12 +220,13 @@
_out_type_ = "file"
_icon_ = "folder"
- def __init__(self, folder, folderGroupName, includeHidden, compareIgnoreMtime):
+ def __init__(self, folder, folderGroupName, includeHidden, compareIgnoreMtime, followSymlinks):
DataProvider.TwoWay.__init__(self)
self.folder = folder
self.folderGroupName = folderGroupName
self.includeHidden = includeHidden
self.compareIgnoreMtime = compareIgnoreMtime
+ self.followSymlinks = followSymlinks
self.fstype = None
self.files = []
@@ -248,7 +249,7 @@
self.fstype = Vfs.uri_get_filesystem_type(self.folder)
#scan the folder
- scanThread = Vfs.FolderScanner(self.folder, self.includeHidden)
+ scanThread = Vfs.FolderScanner(self.folder, self.includeHidden, self.followSymlinks)
scanThread.start()
scanThread.join()
self.files = scanThread.get_uris()
Modified: trunk/conduit/modules/FileModule/FileConfiguration.py
==============================================================================
--- trunk/conduit/modules/FileModule/FileConfiguration.py (original)
+++ trunk/conduit/modules/FileModule/FileConfiguration.py Mon May 5 12:04:21 2008
@@ -300,12 +300,13 @@
dialog.emit_stop_by_name("response")
class _FolderTwoWayConfigurator:
- def __init__(self, mainWindow, folder, folderGroupName, includeHidden, compareIgnoreMtime):
+ def __init__(self, mainWindow, folder, folderGroupName, includeHidden, compareIgnoreMtime, followSymlinks):
log.debug("Starting new folder chooser at %s" % folder)
self.folder = folder
self.includeHidden = includeHidden
self.folderGroupName = folderGroupName
self.compareIgnoreMtime = compareIgnoreMtime
+ self.followSymlinks = followSymlinks
tree = Utils.dataprovider_glade_get_widget(
__file__,
@@ -320,6 +321,8 @@
self.hiddenCb.set_active(includeHidden)
self.mtimeCb = tree.get_widget("ignoreMtime")
self.mtimeCb.set_active(self.compareIgnoreMtime)
+ self.followSymlinksCb = tree.get_widget("followSymlinks")
+ self.followSymlinksCb.set_active(self.followSymlinks)
self.dlg = tree.get_widget("FolderTwoWayConfigDialog")
self.dlg.connect("response",self.on_response)
@@ -354,9 +357,10 @@
log.debug("Folderconfig returned %s (non-canonical: %s)" % (self.folder,selected))
self.includeHidden = self.hiddenCb.get_active()
self.compareIgnoreMtime = self.mtimeCb.get_active()
+ self.followSymlinks = self.followSymlinksCb.get_active()
def show_dialog(self):
self.dlg.show_all()
self.dlg.run()
self.dlg.destroy()
- return self.folder, self.folderGroupName, self.includeHidden, self.compareIgnoreMtime
+ return self.folder, self.folderGroupName, self.includeHidden, self.compareIgnoreMtime, self.followSymlinks
Modified: trunk/conduit/modules/FileModule/FileModule.py
==============================================================================
--- trunk/conduit/modules/FileModule/FileModule.py (original)
+++ trunk/conduit/modules/FileModule/FileModule.py Mon May 5 12:04:21 2008
@@ -66,13 +66,15 @@
DEFAULT_GROUP = "Home"
DEFAULT_HIDDEN = False
DEFAULT_COMPARE_IGNORE_MTIME = False
+ DEFAULT_FOLLOW_SYMLINKS = False
def __init__(self, *args):
FileDataProvider.FolderTwoWay.__init__(self,
self.DEFAULT_FOLDER,
self.DEFAULT_GROUP,
self.DEFAULT_HIDDEN,
- self.DEFAULT_COMPARE_IGNORE_MTIME
+ self.DEFAULT_COMPARE_IGNORE_MTIME,
+ self.DEFAULT_FOLLOW_SYMLINKS
)
AutoSync.AutoSync.__init__(self)
self._monitor_folder_id = None
@@ -85,8 +87,9 @@
def configure(self, window):
Utils.dataprovider_add_dir_to_path(__file__, "")
import FileConfiguration
- f = FileConfiguration._FolderTwoWayConfigurator(window, self.folder, self.folderGroupName, self.includeHidden, self.compareIgnoreMtime)
- self.folder, self.folderGroupName, self.includeHidden, self.compareIgnoreMtime = f.show_dialog()
+ f = FileConfiguration._FolderTwoWayConfigurator(window, self.folder, self.folderGroupName,
+ self.includeHidden, self.compareIgnoreMtime, self.followSymlinks)
+ self.folder, self.folderGroupName, self.includeHidden, self.compareIgnoreMtime, self.followSymlinks = f.show_dialog()
self._monitor_folder()
def set_configuration(self, config):
@@ -94,6 +97,7 @@
self.folderGroupName = config.get("folderGroupName", self.DEFAULT_GROUP)
self.includeHidden = config.get("includeHidden", self.DEFAULT_HIDDEN)
self.compareIgnoreMtime = config.get("compareIgnoreMtime", self.DEFAULT_COMPARE_IGNORE_MTIME)
+ self.followSymlinks = config.get("followSymlinks", self.DEFAULT_FOLLOW_SYMLINKS)
self._monitor_folder()
def get_configuration(self):
@@ -102,7 +106,8 @@
"folder" : self.folder,
"folderGroupName" : self.folderGroupName,
"includeHidden" : self.includeHidden,
- "compareIgnoreMtime" : self.compareIgnoreMtime
+ "compareIgnoreMtime" : self.compareIgnoreMtime,
+ "followSymlinks" : self.followSymlinks
}
def get_UID(self):
Modified: trunk/conduit/modules/FileModule/config.glade
==============================================================================
--- trunk/conduit/modules/FileModule/config.glade (original)
+++ trunk/conduit/modules/FileModule/config.glade Mon May 5 12:04:21 2008
@@ -255,13 +255,10 @@
</packing>
</child>
<child>
- <widget class="GtkCheckButton" id="hidden">
+ <widget class="GtkLabel" id="label83">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Include Hidden Files</property>
- <property name="use_underline">True</property>
- <property name="response_id">0</property>
- <property name="draw_indicator">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Folder Location:</property>
</widget>
<packing>
<property name="expand">False</property>
@@ -270,25 +267,78 @@
</packing>
</child>
<child>
- <widget class="GtkCheckButton" id="ignoreMtime">
+ <widget class="GtkFileChooserButton" id="filechooserbutton1">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Ignore File Modification Times</property>
- <property name="use_underline">True</property>
- <property name="response_id">0</property>
- <property name="draw_indicator">True</property>
+ <property name="local_only">False</property>
+ <property name="action">GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER</property>
+ <property name="title" translatable="yes">Select A Folder</property>
</widget>
<packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
<property name="position">3</property>
</packing>
</child>
<child>
- <widget class="GtkLabel" id="label83">
+ <widget class="GtkExpander" id="expander1">
<property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Folder Location:</property>
+ <property name="can_focus">True</property>
+ <child>
+ <widget class="GtkVBox" id="vbox38">
+ <property name="visible">True</property>
+ <child>
+ <widget class="GtkCheckButton" id="hidden">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Include Hidden Files</property>
+ <property name="use_underline">True</property>
+ <property name="response_id">0</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkCheckButton" id="ignoreMtime">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Ignore File Modification Times</property>
+ <property name="use_underline">True</property>
+ <property name="response_id">0</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkCheckButton" id="followSymlinks">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Follow Symbolic Links</property>
+ <property name="use_underline">True</property>
+ <property name="response_id">0</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label85">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Advanced</property>
+ </widget>
+ <packing>
+ <property name="type">label_item</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="expand">False</property>
@@ -296,18 +346,6 @@
<property name="position">4</property>
</packing>
</child>
- <child>
- <widget class="GtkFileChooserButton" id="filechooserbutton1">
- <property name="visible">True</property>
- <property name="local_only">False</property>
- <property name="action">GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER</property>
- <property name="title" translatable="yes">Select A Folder</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="position">5</property>
- </packing>
- </child>
</widget>
<packing>
<property name="expand">False</property>
Modified: trunk/conduit/modules/N800Module/N800Module.py
==============================================================================
--- trunk/conduit/modules/N800Module/N800Module.py (original)
+++ trunk/conduit/modules/N800Module/N800Module.py Mon May 5 12:04:21 2008
@@ -64,6 +64,7 @@
"file://"+folder,
"N800",
False,
+ False,
False
)
self.mount = mount
Modified: trunk/conduit/modules/PhoneModule/PhoneModule.py
==============================================================================
--- trunk/conduit/modules/PhoneModule/PhoneModule.py (original)
+++ trunk/conduit/modules/PhoneModule/PhoneModule.py Mon May 5 12:04:21 2008
@@ -109,7 +109,8 @@
folder= "obex://[%s]" % address,
folderGroupName="Test",
includeHidden=False,
- compareIgnoreMtime=False
+ compareIgnoreMtime=False,
+ followSymlinks=False
)
self.address = address
#FIXME: In the land of GIO, I think I need to gio-mount this
Modified: trunk/conduit/modules/TestModule.py
==============================================================================
--- trunk/conduit/modules/TestModule.py (original)
+++ trunk/conduit/modules/TestModule.py Mon May 5 12:04:21 2008
@@ -436,7 +436,8 @@
folder= "file://"+Utils.new_tempdir(),
folderGroupName="Test",
includeHidden=False,
- compareIgnoreMtime=False
+ compareIgnoreMtime=False,
+ followSymlinks=False
)
def get_UID(self):
Modified: trunk/test/python-tests/TestCoreVfs.py
==============================================================================
--- trunk/test/python-tests/TestCoreVfs.py (original)
+++ trunk/test/python-tests/TestCoreVfs.py Mon May 5 12:04:21 2008
@@ -30,8 +30,8 @@
def prog(*args): pass
def done(*args): pass
-t1 = stm.make_thread("file:///tmp", False, prog, done)
-t2 = stm.make_thread("file://"+tmpdiruri, False, prog, done)
+t1 = stm.make_thread("file:///tmp", False, False, prog, done)
+t2 = stm.make_thread("file://"+tmpdiruri, False, False, prog, done)
stm.join_all_threads()
ok("Scanned /tmp ok - found %s" % fileuri, "file://"+fileuri in t1.get_uris())
Modified: trunk/test/python-tests/TestDataProviderFolder.py
==============================================================================
--- trunk/test/python-tests/TestDataProviderFolder.py (original)
+++ trunk/test/python-tests/TestDataProviderFolder.py Mon May 5 12:04:21 2008
@@ -41,7 +41,8 @@
folder=dpdir,
folderGroupName=GROUP_NAME,
includeHidden=False,
- compareIgnoreMtime=False)
+ compareIgnoreMtime=False,
+ followSymlinks=False)
# Scenario 1)
# File came from a foreign DP like tomboy. No concept of relative path
Modified: trunk/test/python-tests/TestSyncFolderFolder.py
==============================================================================
--- trunk/test/python-tests/TestSyncFolderFolder.py (original)
+++ trunk/test/python-tests/TestSyncFolderFolder.py Mon May 5 12:04:21 2008
@@ -53,6 +53,7 @@
config["folderGroupName"] = "TestGroup"
config["folder"] = "file://"+sourceDir
config["includeHidden"] = False
+config["followSymlinks"] = False
test.configure(source=config)
config["folder"] = "file://"+sinkDir
@@ -185,4 +186,5 @@
mapSink2Source = conduit.GLOBALS.mappingDB.get_mappings_for_dataproviders(sinkW.get_UID(), sourceW.get_UID())
ok("Hidden: 15 Mappings in total", len(mapSource2Sink + mapSink2Source) == 15)
+
finished()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]