mirror of
https://github.com/openSUSE/osc.git
synced 2025-02-27 12:42:12 +01:00
Merge branch 'use_getcwdb' of https://github.com/marcus-h/osc
os.getcwd() fixes: - Fix a potential TypeERror in util.ArFile.saveTo. - Avoid error prone use of os.getcwd().encode() in util.cpio.CpioRead.
This commit is contained in:
commit
5428c09cd7
@ -72,7 +72,7 @@ class ArFile(BytesIO):
|
|||||||
and permissions.
|
and permissions.
|
||||||
"""
|
"""
|
||||||
if not dir:
|
if not dir:
|
||||||
dir = os.getcwd()
|
dir = os.getcwdb()
|
||||||
fn = os.path.join(dir, self.name)
|
fn = os.path.join(dir, self.name)
|
||||||
with open(fn, 'wb') as f:
|
with open(fn, 'wb') as f:
|
||||||
f.write(self.getvalue())
|
f.write(self.getvalue())
|
||||||
|
@ -182,7 +182,7 @@ class CpioRead:
|
|||||||
hdr = self._get_hdr(filename)
|
hdr = self._get_hdr(filename)
|
||||||
if not hdr:
|
if not hdr:
|
||||||
raise CpioError(filename, '\'%s\' does not exist in archive' % filename)
|
raise CpioError(filename, '\'%s\' does not exist in archive' % filename)
|
||||||
dest = dest or os.getcwd().encode()
|
dest = dest or os.getcwdb()
|
||||||
fn = new_fn or filename
|
fn = new_fn or filename
|
||||||
self._copyin_file(hdr, dest, fn)
|
self._copyin_file(hdr, dest, fn)
|
||||||
|
|
||||||
@ -191,7 +191,7 @@ class CpioRead:
|
|||||||
extracts the cpio archive to dest.
|
extracts the cpio archive to dest.
|
||||||
If dest is None $PWD will be used.
|
If dest is None $PWD will be used.
|
||||||
"""
|
"""
|
||||||
dest = dest or os.getcwd().encode()
|
dest = dest or os.getcwdb()
|
||||||
for h in self.hdrs:
|
for h in self.hdrs:
|
||||||
self._copyin_file(h, dest, h.filename)
|
self._copyin_file(h, dest, h.filename)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user