1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/43fa4cb72e0f/ changeset: 43fa4cb72e0f user: dan date: 2013-01-30 19:49:43 summary: Add a util.move_merge() function that makes moving directories more consistent. affected #: 1 file diff -r a9cbfdfeff11e2e2595b37825584216441a7a6d1 -r 43fa4cb72e0fdc207a07fc4c6402273ca4bd4fc6 lib/galaxy/util/__init__.py --- a/lib/galaxy/util/__init__.py +++ b/lib/galaxy/util/__init__.py @@ -2,7 +2,7 @@ Utility functions used systemwide. """ -import logging, threading, random, string, re, binascii, pickle, time, datetime, math, re, os, sys, tempfile, stat, grp, smtplib, errno +import logging, threading, random, string, re, binascii, pickle, time, datetime, math, re, os, sys, tempfile, stat, grp, smtplib, errno, shutil from email.MIMEText import MIMEText # Older py compatibility @@ -737,6 +737,18 @@ else: raise e +def move_merge( source, target ): + #when using shutil and moving a directory, if the target exists, + #then the directory is placed inside of it + #if the target doesn't exist, then the target is made into the directory + #this makes it so that the target is always the target, and if it exists, + #the source contents are moved into the target + if os.path.isdir( source ) and os.path.exists( target ) and os.path.isdir( target ): + for name in os.listdir( source ): + move_merge( os.path.join( source, name ), os.path.join( target, name ) ) + else: + return shutil.move( source, target ) + galaxy_root_path = os.path.join(__path__[0], "..","..","..") # The dbnames list is used in edit attributes and the upload tool 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.