1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-11-10 06:46:15 +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:
Marcus Huewe 2020-12-01 13:20:12 +01:00
commit 5428c09cd7
2 changed files with 3 additions and 3 deletions

View File

@ -72,7 +72,7 @@ class ArFile(BytesIO):
and permissions.
"""
if not dir:
dir = os.getcwd()
dir = os.getcwdb()
fn = os.path.join(dir, self.name)
with open(fn, 'wb') as f:
f.write(self.getvalue())

View File

@ -182,7 +182,7 @@ class CpioRead:
hdr = self._get_hdr(filename)
if not hdr:
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
self._copyin_file(hdr, dest, fn)
@ -191,7 +191,7 @@ class CpioRead:
extracts the cpio archive to dest.
If dest is None $PWD will be used.
"""
dest = dest or os.getcwd().encode()
dest = dest or os.getcwdb()
for h in self.hdrs:
self._copyin_file(h, dest, h.filename)