From: Torsten Werner Date: Wed, 24 Aug 2011 18:04:17 +0000 (+0200) Subject: Convert octal literals to Python 2.6 syntax. X-Git-Url: https://git.decadent.org.uk/gitweb/?p=dak.git;a=commitdiff_plain;h=f8783d3e7d165814889a64278dc31388b99c0b89 Convert octal literals to Python 2.6 syntax. Signed-off-by: Torsten Werner --- diff --git a/dak/clean_queues.py b/dak/clean_queues.py index 6ade86c6..4147ab05 100755 --- a/dak/clean_queues.py +++ b/dak/clean_queues.py @@ -86,7 +86,7 @@ def init (cnf): # Ensure a directory exists to remove files to if not Options["No-Action"]: if not os.path.exists(del_dir): - os.makedirs(del_dir, 02775) + os.makedirs(del_dir, 0o2775) if not os.path.isdir(del_dir): utils.fubar("%s must be a directory." % (del_dir)) @@ -118,7 +118,7 @@ def remove (from_dir, f): if os.path.exists(dest_filename): dest_filename = utils.find_next_free(dest_filename, 10) Logger.log(["change destination file name", os.path.basename(dest_filename)]) - utils.move(f, dest_filename, 0660) + utils.move(f, dest_filename, 0o660) else: Logger.log(["skipping file because of permission problem", fname]) utils.warn("skipping '%s', permission denied." % fname) diff --git a/dak/generate_index_diffs.py b/dak/generate_index_diffs.py index 83d51824..75142ca7 100755 --- a/dak/generate_index_diffs.py +++ b/dak/generate_index_diffs.py @@ -280,7 +280,7 @@ def genchanges(Options, outdir, oldfile, origfile, maxdiffs = 14): def main(): global Cnf, Options, Logger - os.umask(0002) + os.umask(0o002) Cnf = utils.get_conf() Arguments = [ ('h', "help", "Generate-Index-Diffs::Options::Help"), diff --git a/dak/init_dirs.py b/dak/init_dirs.py index a4703bb8..fc5efd32 100755 --- a/dak/init_dirs.py +++ b/dak/init_dirs.py @@ -90,15 +90,15 @@ def process_keyring(fullpath, secret=False): os.makedirs(keydir) if secret: # Make sure secret keyring directories are 0700 - os.chmod(keydir, 0700) + os.chmod(keydir, 0o700) # Touch the file print "Creating %s ..." % (fullpath) file(fullpath, 'w') if secret: - os.chmod(fullpath, 0600) + os.chmod(fullpath, 0o600) else: - os.chmod(fullpath, 0644) + os.chmod(fullpath, 0o644) ###################################################################### diff --git a/dak/show_deferred.py b/dak/show_deferred.py index 2b6cd71e..7352f71e 100755 --- a/dak/show_deferred.py +++ b/dak/show_deferred.py @@ -214,7 +214,7 @@ def get_upload_data(changesfn): os.unlink(lfn) if os.path.exists(qfn): os.symlink(qfn,lfn) - os.chmod(qfn, 0644) + os.chmod(qfn, 0o644) return (max(delaydays-1,0)*24*60*60+remainingtime, changesname, delay, uploader, achanges.get('closes','').split(),achanges, delaydays) def list_uploads(filelist, rrd_dir): diff --git a/dak/transitions.py b/dak/transitions.py index 9d21a562..a5b8fa35 100755 --- a/dak/transitions.py +++ b/dak/transitions.py @@ -319,7 +319,7 @@ def temp_transitions_file(transitions): """ (fd, path) = tempfile.mkstemp("", "transitions", Cnf["Dir::TempPath"]) - os.chmod(path, 0644) + os.chmod(path, 0o644) f = open(path, "w") yaml.dump(transitions, f, default_flow_style=False) return path diff --git a/daklib/daklog.py b/daklib/daklog.py index 7ececa56..05ca9b1a 100644 --- a/daklib/daklog.py +++ b/daklib/daklog.py @@ -55,7 +55,7 @@ class Logger(object): logdir = Config()["Dir::Log"] if not os.path.exists(logdir): umask = os.umask(00000) - os.makedirs(logdir, 02775) + os.makedirs(logdir, 0o2775) os.umask(umask) # Open the logfile @@ -65,7 +65,7 @@ class Logger(object): if debug: logfile = sys.stderr else: - umask = os.umask(00002) + umask = os.umask(0o0002) logfile = utils.open_file(logfilename, 'a') os.umask(umask) diff --git a/daklib/filewriter.py b/daklib/filewriter.py index b44fc2a5..274ef5c1 100755 --- a/daklib/filewriter.py +++ b/daklib/filewriter.py @@ -65,7 +65,7 @@ class BaseFileWriter(object): # internal helper function def rename(self, filename): tempfilename = filename + '.new' - os.chmod(tempfilename, 0664) + os.chmod(tempfilename, 0o664) os.rename(tempfilename, filename) def close(self): diff --git a/daklib/holding.py b/daklib/holding.py index 221a2577..6c9ce570 100644 --- a/daklib/holding.py +++ b/daklib/holding.py @@ -58,7 +58,7 @@ class Holding(object): dest = os.path.join(self.holding_dir, base_filename) try: - fd = os.open(dest, os.O_RDWR | os.O_CREAT | os.O_EXCL, 0640) + fd = os.open(dest, os.O_RDWR | os.O_CREAT | os.O_EXCL, 0o640) os.close(fd) except OSError as e: # Shouldn't happen, but will if, for example, someone lists a diff --git a/daklib/queue.py b/daklib/queue.py index 12e02719..fa4a95f4 100755 --- a/daklib/queue.py +++ b/daklib/queue.py @@ -2225,7 +2225,7 @@ distribution.""" filename = "%s/%s" % (cnf["Dir::BTSVersionTrack"], self.pkg.changes_file[:-8]+".versions") os.rename(temp_filename, filename) - os.chmod(filename, 0644) + os.chmod(filename, 0o644) # Write out the binary -> source mapping. (fd, temp_filename) = utils.temp_filename(cnf["Dir::BTSVersionTrack"], prefix=".") @@ -2240,7 +2240,7 @@ distribution.""" filename = "%s/%s" % (cnf["Dir::BTSVersionTrack"], self.pkg.changes_file[:-8]+".debinfo") os.rename(temp_filename, filename) - os.chmod(filename, 0644) + os.chmod(filename, 0o644) session.commit() @@ -2342,7 +2342,7 @@ distribution.""" dest_file = os.path.join(cnf["Dir::Reject"], file_entry) try: - dest_fd = os.open(dest_file, os.O_RDWR | os.O_CREAT | os.O_EXCL, 0644) + dest_fd = os.open(dest_file, os.O_RDWR | os.O_CREAT | os.O_EXCL, 0o644) except OSError as e: # File exists? Let's find a new name by adding a number if e.errno == errno.EEXIST: @@ -2356,7 +2356,7 @@ distribution.""" # Make sure we really got it try: - dest_fd = os.open(dest_file, os.O_RDWR|os.O_CREAT|os.O_EXCL, 0644) + dest_fd = os.open(dest_file, os.O_RDWR|os.O_CREAT|os.O_EXCL, 0o644) except OSError as e: # Likewise utils.warn("**WARNING** failed to claim %s in the reject directory." % (file_entry)) @@ -2365,7 +2365,7 @@ distribution.""" raise # If we got here, we own the destination file, so we can # safely overwrite it. - utils.move(file_entry, dest_file, 1, perms=0660) + utils.move(file_entry, dest_file, 1, perms=0o660) os.close(dest_fd) ########################################################################### @@ -2431,7 +2431,7 @@ distribution.""" # so let's just raise an exception ... if os.path.exists(reason_filename): os.unlink(reason_filename) - reason_fd = os.open(reason_filename, os.O_RDWR|os.O_CREAT|os.O_EXCL, 0644) + reason_fd = os.open(reason_filename, os.O_RDWR|os.O_CREAT|os.O_EXCL, 0o644) rej_template = os.path.join(cnf["Dir::Templates"], "queue.rejected") diff --git a/daklib/utils.py b/daklib/utils.py index 46387ff2..6f352cd0 100755 --- a/daklib/utils.py +++ b/daklib/utils.py @@ -687,7 +687,7 @@ def send_mail (message, filename=""): os.unlink (filename); return; - fd = os.open(filename, os.O_RDWR|os.O_EXCL, 0700); + fd = os.open(filename, os.O_RDWR|os.O_EXCL, 0o700); os.write (fd, message_raw.as_string(True)); os.close (fd); @@ -712,14 +712,14 @@ def poolify (source, component): ################################################################################ -def move (src, dest, overwrite = 0, perms = 0664): +def move (src, dest, overwrite = 0, perms = 0o664): if os.path.exists(dest) and os.path.isdir(dest): dest_dir = dest else: dest_dir = os.path.dirname(dest) if not os.path.exists(dest_dir): umask = os.umask(00000) - os.makedirs(dest_dir, 02775) + os.makedirs(dest_dir, 0o2775) os.umask(umask) #print "Moving %s to %s..." % (src, dest) if os.path.exists(dest) and os.path.isdir(dest): @@ -735,14 +735,14 @@ def move (src, dest, overwrite = 0, perms = 0664): os.chmod(dest, perms) os.unlink(src) -def copy (src, dest, overwrite = 0, perms = 0664): +def copy (src, dest, overwrite = 0, perms = 0o664): if os.path.exists(dest) and os.path.isdir(dest): dest_dir = dest else: dest_dir = os.path.dirname(dest) if not os.path.exists(dest_dir): umask = os.umask(00000) - os.makedirs(dest_dir, 02775) + os.makedirs(dest_dir, 0o2775) os.umask(umask) #print "Copying %s to %s..." % (src, dest) if os.path.exists(dest) and os.path.isdir(dest):