mirror of
https://github.com/openSUSE/osc.git
synced 2025-01-23 05:26:16 +01:00
python3 compatibility: new syntax for literals
The octal literals got a new syntax 0755 -> 0o755
This commit is contained in:
parent
87d354e1a0
commit
0dcbddbafe
@ -6068,7 +6068,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
target_dir = os.path.normpath(opts.destdir)
|
target_dir = os.path.normpath(opts.destdir)
|
||||||
if not os.path.isdir(target_dir):
|
if not os.path.isdir(target_dir):
|
||||||
print 'Creating %s' % target_dir
|
print 'Creating %s' % target_dir
|
||||||
os.makedirs(target_dir, 0755)
|
os.makedirs(target_dir, 0o755)
|
||||||
|
|
||||||
for arch in arches:
|
for arch in arches:
|
||||||
for pac in package:
|
for pac in package:
|
||||||
|
@ -565,7 +565,7 @@ def init_basicauth(config):
|
|||||||
except IOError:
|
except IOError:
|
||||||
try:
|
try:
|
||||||
open(cookie_file, 'w').close()
|
open(cookie_file, 'w').close()
|
||||||
os.chmod(cookie_file, 0600)
|
os.chmod(cookie_file, 0o600)
|
||||||
except:
|
except:
|
||||||
#print 'Unable to create cookiejar file: \'%s\'. Using RAM-based cookies.' % cookie_file
|
#print 'Unable to create cookiejar file: \'%s\'. Using RAM-based cookies.' % cookie_file
|
||||||
cookiejar = CookieJar()
|
cookiejar = CookieJar()
|
||||||
@ -597,7 +597,7 @@ def write_config(fname, cp):
|
|||||||
cp.write(f, comments=True)
|
cp.write(f, comments=True)
|
||||||
try:
|
try:
|
||||||
os.rename(fname + '.new', fname)
|
os.rename(fname + '.new', fname)
|
||||||
os.chmod(fname, 0600)
|
os.chmod(fname, 0o600)
|
||||||
except:
|
except:
|
||||||
if os.path.exists(fname + '.new'):
|
if os.path.exists(fname + '.new'):
|
||||||
os.unlink(fname + '.new')
|
os.unlink(fname + '.new')
|
||||||
@ -758,7 +758,7 @@ def get_config(override_conffile=None,
|
|||||||
# okay, we made sure that .oscrc exists
|
# okay, we made sure that .oscrc exists
|
||||||
|
|
||||||
# make sure it is not world readable, it may contain a password.
|
# make sure it is not world readable, it may contain a password.
|
||||||
os.chmod(conffile, 0600)
|
os.chmod(conffile, 0o600)
|
||||||
|
|
||||||
cp = get_configParser(conffile)
|
cp = get_configParser(conffile)
|
||||||
|
|
||||||
|
@ -3930,7 +3930,7 @@ def download(url, filename, progress_obj = None, mtime = None):
|
|||||||
prefix = os.path.basename(filename)
|
prefix = os.path.basename(filename)
|
||||||
path = os.path.dirname(filename)
|
path = os.path.dirname(filename)
|
||||||
(fd, tmpfile) = tempfile.mkstemp(dir=path, prefix = prefix, suffix = '.osctmp')
|
(fd, tmpfile) = tempfile.mkstemp(dir=path, prefix = prefix, suffix = '.osctmp')
|
||||||
os.chmod(tmpfile, 0644)
|
os.chmod(tmpfile, 0o644)
|
||||||
try:
|
try:
|
||||||
o = os.fdopen(fd, 'wb')
|
o = os.fdopen(fd, 'wb')
|
||||||
for buf in streamfile(url, http_GET, BUFSIZE, progress_obj=progress_obj):
|
for buf in streamfile(url, http_GET, BUFSIZE, progress_obj=progress_obj):
|
||||||
|
@ -198,13 +198,13 @@ class Fetcher:
|
|||||||
pac_obj.filename = canonname
|
pac_obj.filename = canonname
|
||||||
pac_obj.fullfilename = fullfilename
|
pac_obj.fullfilename = fullfilename
|
||||||
shutil.move(tmpfile, fullfilename)
|
shutil.move(tmpfile, fullfilename)
|
||||||
os.chmod(fullfilename, 0644)
|
os.chmod(fullfilename, 0o644)
|
||||||
|
|
||||||
def dirSetup(self, pac):
|
def dirSetup(self, pac):
|
||||||
dir = os.path.join(self.cachedir, pac.localdir)
|
dir = os.path.join(self.cachedir, pac.localdir)
|
||||||
if not os.path.exists(dir):
|
if not os.path.exists(dir):
|
||||||
try:
|
try:
|
||||||
os.makedirs(dir, mode=0755)
|
os.makedirs(dir, mode=0o755)
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
print >>sys.stderr, 'packagecachedir is not writable for you?'
|
print >>sys.stderr, 'packagecachedir is not writable for you?'
|
||||||
print >>sys.stderr, e
|
print >>sys.stderr, e
|
||||||
@ -250,7 +250,7 @@ class Fetcher:
|
|||||||
for i in prjs:
|
for i in prjs:
|
||||||
dest = "%s/%s" % (self.cachedir, i)
|
dest = "%s/%s" % (self.cachedir, i)
|
||||||
if not os.path.exists(dest):
|
if not os.path.exists(dest):
|
||||||
os.makedirs(dest, mode=0755)
|
os.makedirs(dest, mode=0o755)
|
||||||
dest += '/_pubkey'
|
dest += '/_pubkey'
|
||||||
|
|
||||||
url = makeurl(buildinfo.apiurl, ['source', i, '_pubkey'])
|
url = makeurl(buildinfo.apiurl, ['source', i, '_pubkey'])
|
||||||
|
Loading…
Reference in New Issue
Block a user