From 0dcbddbafed3833fccef87f5704f7afad333f403 Mon Sep 17 00:00:00 2001 From: Michal Vyskocil Date: Tue, 9 Apr 2013 12:45:16 +0200 Subject: [PATCH] python3 compatibility: new syntax for literals The octal literals got a new syntax 0755 -> 0o755 --- osc/commandline.py | 2 +- osc/conf.py | 6 +++--- osc/core.py | 2 +- osc/fetch.py | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/osc/commandline.py b/osc/commandline.py index d0f6bcff..725c2959 100644 --- a/osc/commandline.py +++ b/osc/commandline.py @@ -6068,7 +6068,7 @@ Please submit there instead, or use --nodevelproject to force direct submission. target_dir = os.path.normpath(opts.destdir) if not os.path.isdir(target_dir): print 'Creating %s' % target_dir - os.makedirs(target_dir, 0755) + os.makedirs(target_dir, 0o755) for arch in arches: for pac in package: diff --git a/osc/conf.py b/osc/conf.py index a8183238..92076bed 100644 --- a/osc/conf.py +++ b/osc/conf.py @@ -565,7 +565,7 @@ def init_basicauth(config): except IOError: try: open(cookie_file, 'w').close() - os.chmod(cookie_file, 0600) + os.chmod(cookie_file, 0o600) except: #print 'Unable to create cookiejar file: \'%s\'. Using RAM-based cookies.' % cookie_file cookiejar = CookieJar() @@ -597,7 +597,7 @@ def write_config(fname, cp): cp.write(f, comments=True) try: os.rename(fname + '.new', fname) - os.chmod(fname, 0600) + os.chmod(fname, 0o600) except: if os.path.exists(fname + '.new'): os.unlink(fname + '.new') @@ -758,7 +758,7 @@ def get_config(override_conffile=None, # okay, we made sure that .oscrc exists # make sure it is not world readable, it may contain a password. - os.chmod(conffile, 0600) + os.chmod(conffile, 0o600) cp = get_configParser(conffile) diff --git a/osc/core.py b/osc/core.py index f9fce61f..b284e921 100644 --- a/osc/core.py +++ b/osc/core.py @@ -3930,7 +3930,7 @@ def download(url, filename, progress_obj = None, mtime = None): prefix = os.path.basename(filename) path = os.path.dirname(filename) (fd, tmpfile) = tempfile.mkstemp(dir=path, prefix = prefix, suffix = '.osctmp') - os.chmod(tmpfile, 0644) + os.chmod(tmpfile, 0o644) try: o = os.fdopen(fd, 'wb') for buf in streamfile(url, http_GET, BUFSIZE, progress_obj=progress_obj): diff --git a/osc/fetch.py b/osc/fetch.py index dc4826cc..b0b01c35 100644 --- a/osc/fetch.py +++ b/osc/fetch.py @@ -198,13 +198,13 @@ class Fetcher: pac_obj.filename = canonname pac_obj.fullfilename = fullfilename shutil.move(tmpfile, fullfilename) - os.chmod(fullfilename, 0644) + os.chmod(fullfilename, 0o644) def dirSetup(self, pac): dir = os.path.join(self.cachedir, pac.localdir) if not os.path.exists(dir): try: - os.makedirs(dir, mode=0755) + os.makedirs(dir, mode=0o755) except OSError as e: print >>sys.stderr, 'packagecachedir is not writable for you?' print >>sys.stderr, e @@ -250,7 +250,7 @@ class Fetcher: for i in prjs: dest = "%s/%s" % (self.cachedir, i) if not os.path.exists(dest): - os.makedirs(dest, mode=0755) + os.makedirs(dest, mode=0o755) dest += '/_pubkey' url = makeurl(buildinfo.apiurl, ['source', i, '_pubkey'])