commit/galaxy-central: 2 new changesets
2 new commits in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/b69934e3fa69/ changeset: b69934e3fa69 user: dan date: 2013-01-30 19:40:22 summary: Add a util.force_symlink() helper method. affected #: 1 file diff -r ea27314cf43c60a2a3f20220b9642cc254f6baa1 -r b69934e3fa691cd24785b3c4a02bb81a154a4856 lib/galaxy/util/__init__.py --- a/lib/galaxy/util/__init__.py +++ b/lib/galaxy/util/__init__.py @@ -727,6 +727,16 @@ s.sendmail( frm, to, msg.as_string() ) s.quit() +def force_symlink( source, link_name ): + try: + os.symlink( source, link_name ) + except OSError, e: + if e.errno == errno.EEXIST: + os.remove( link_name ) + os.symlink( source, link_name ) + else: + raise e + galaxy_root_path = os.path.join(__path__[0], "..","..","..") # The dbnames list is used in edit attributes and the upload tool https://bitbucket.org/galaxy/galaxy-central/commits/a9cbfdfeff11/ changeset: a9cbfdfeff11 user: dan date: 2013-01-30 19:40:23 summary: Allow DiskObjectStore.update_from_file() to optionally preserve symlinks. affected #: 1 file diff -r b69934e3fa691cd24785b3c4a02bb81a154a4856 -r a9cbfdfeff11e2e2595b37825584216441a7a6d1 lib/galaxy/objectstore/__init__.py --- a/lib/galaxy/objectstore/__init__.py +++ b/lib/galaxy/objectstore/__init__.py @@ -342,11 +342,17 @@ def update_from_file(self, obj, file_name=None, create=False, **kwargs): """ `create` parameter is not used in this implementation """ + preserve_symlinks = kwargs.pop( 'preserve_symlinks', False ) + #FIXME: symlinks and the object store model may not play well together + #these should be handled better, e.g. registering the symlink'd file as an object if create: self.create(obj, **kwargs) if file_name and self.exists(obj, **kwargs): try: - shutil.copy(file_name, self.get_filename(obj, **kwargs)) + if preserve_symlinks and os.path.islink( file_name ): + util.force_symlink( os.readlink( file_name ), self.get_filename( obj, **kwargs ) ) + else: + shutil.copy( file_name, self.get_filename( obj, **kwargs ) ) except IOError, ex: log.critical('Error copying %s to %s: %s' % (file_name, self._get_filename(obj, **kwargs), ex)) Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
Bitbucket