summaryrefslogtreecommitdiff
path: root/test/pacman/pmpkg.py
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2018-08-19 21:12:33 -0400
committerAndrew Gregory <andrew.gregory.8@gmail.com>2018-10-18 18:05:19 -0700
commitafb9c0140fd6949ede64cc1a304e9349772fca04 (patch)
tree6995c7eb8f090f5af64ae6219f872b42db2eb9d3 /test/pacman/pmpkg.py
parentffde85aadfe0e08fb710102d0a547335e9d1a200 (diff)
downloadpacman-afb9c0140fd6949ede64cc1a304e9349772fca04.tar.xz
Port pactest to python3
Use BytesIO instead of StringIO, and ensure that we unicode-encode data where needed.
Diffstat (limited to 'test/pacman/pmpkg.py')
-rw-r--r--test/pacman/pmpkg.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/test/pacman/pmpkg.py b/test/pacman/pmpkg.py
index 5a32ccd6..4667ebc1 100644
--- a/test/pacman/pmpkg.py
+++ b/test/pacman/pmpkg.py
@@ -14,8 +14,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+from io import BytesIO
import os
-from StringIO import StringIO
import tarfile
import util
@@ -146,7 +146,7 @@ class pmpkg(object):
for name, data in archive_files:
info = tarfile.TarInfo(name)
info.size = len(data)
- tar.addfile(info, StringIO(data))
+ tar.addfile(info, BytesIO(data.encode('utf8')))
# Generate package file system
for name in self.files:
@@ -167,7 +167,7 @@ class pmpkg(object):
# TODO wow what a hack, adding a newline to match mkfile?
filedata = name + "\n"
info.size = len(filedata)
- tar.addfile(info, StringIO(filedata))
+ tar.addfile(info, BytesIO(filedata.encode('utf8')))
tar.close()