X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=utils.py;h=409113ef93da6dad8084e3245d088fe995c6e0d4;hb=51cf796601da7d2fc65c8f9ad8d0fe0fa580dba2;hp=40e36cd9c6a1c79111550a616a72ccb095e6320c;hpb=69546c1e264e3333b49830c8f80dc8ab025929f0;p=dak.git diff --git a/utils.py b/utils.py index 40e36cd9..409113ef 100644 --- a/utils.py +++ b/utils.py @@ -1,6 +1,6 @@ # Utility functions # Copyright (C) 2000 James Troup -# $Id: utils.py,v 1.4 2000-11-27 03:15:26 troup Exp $ +# $Id: utils.py,v 1.6 2000-12-01 17:33:29 troup Exp $ # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -206,6 +206,8 @@ def move (src, dest): os.umask(umask); #print "Moving %s to %s..." % (src, dest); shutil.copy2(src, dest); + if os.path.exists(dest) and stat.S_ISDIR(os.stat(dest)[stat.ST_MODE]): + dest = dest + '/' + os.path.basename(src); os.chmod(dest, 0664); os.unlink(src); @@ -220,6 +222,8 @@ def copy (src, dest): os.umask(umask); #print "Copying %s to %s..." % (src, dest); shutil.copy2(src, dest); + if os.path.exists(dest) and stat.S_ISDIR(os.stat(dest)[stat.ST_MODE]): + dest = dest + '/' + os.path.basename(src); os.chmod(dest, 0664); ###################################################################################### @@ -252,3 +256,12 @@ def which_conf_file (): ###################################################################################### +# Escape characters which have meaning to SQL's regex comparison operator ('~') +# (woefully incomplete) + +def regex_safe (s): + s = string.replace(s, '+', '\\\\+'); + return s + +###################################################################################### +