diff options
author | Arfrever Frehtes Taifersar Arahesis <Arfrever@Gentoo.Org> | 2010-12-06 13:50:52 +0100 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2010-12-07 21:49:38 -0800 |
commit | 26ff164f0f96f2c1c5a39d3787f6abd7d1309371 (patch) | |
tree | 443e7c630b60bc429ae739c3a897c0782db37247 /pym | |
parent | dc374a216146ea3f376591553bd84c055754f708 (diff) | |
download | portage-26ff164f0f96f2c1c5a39d3787f6abd7d1309371.tar.gz portage-26ff164f0f96f2c1c5a39d3787f6abd7d1309371.tar.bz2 portage-26ff164f0f96f2c1c5a39d3787f6abd7d1309371.zip |
Use bytes literals.
Diffstat (limited to 'pym')
-rw-r--r-- | pym/portage/dbapi/bintree.py | 22 | ||||
-rw-r--r-- | pym/portage/tests/__init__.py | 9 | ||||
-rw-r--r-- | pym/repoman/utilities.py | 8 |
3 files changed, 13 insertions, 26 deletions
diff --git a/pym/portage/dbapi/bintree.py b/pym/portage/dbapi/bintree.py index 9b9d5c8d3..46f6509a7 100644 --- a/pym/portage/dbapi/bintree.py +++ b/pym/portage/dbapi/bintree.py @@ -333,12 +333,10 @@ class binarytree(object): mydata = mytbz2.get_data() updated_items = update_dbentries([mylist], mydata) mydata.update(updated_items) - mydata[_unicode_encode('PF', - encoding=_encodings['repo.content'])] = \ + mydata[b'PF'] = \ _unicode_encode(mynewpkg + "\n", encoding=_encodings['repo.content']) - mydata[_unicode_encode('CATEGORY', - encoding=_encodings['repo.content'])] = \ + mydata[b'CATEGORY'] = \ _unicode_encode(mynewcat + "\n", encoding=_encodings['repo.content']) if mynewpkg != myoldpkg: @@ -439,9 +437,7 @@ class binarytree(object): if st is not None: # For invalid packages, other_cat could be None. - other_cat = portage.xpak.tbz2(dest_path).getfile( - _unicode_encode("CATEGORY", - encoding=_encodings['repo.content'])) + other_cat = portage.xpak.tbz2(dest_path).getfile(b"CATEGORY") if other_cat: other_cat = _unicode_decode(other_cat, encoding=_encodings['repo.content'], errors='replace') @@ -621,17 +617,11 @@ class binarytree(object): self.invalids.append(myfile[:-5]) continue metadata_bytes = portage.xpak.tbz2(full_path).get_data() - mycat = _unicode_decode(metadata_bytes.get( - _unicode_encode("CATEGORY", - encoding=_encodings['repo.content']), ""), + mycat = _unicode_decode(metadata_bytes.get(b"CATEGORY", ""), encoding=_encodings['repo.content'], errors='replace') - mypf = _unicode_decode(metadata_bytes.get( - _unicode_encode("PF", - encoding=_encodings['repo.content']), ""), + mypf = _unicode_decode(metadata_bytes.get(b"PF", ""), encoding=_encodings['repo.content'], errors='replace') - slot = _unicode_decode(metadata_bytes.get( - _unicode_encode("SLOT", - encoding=_encodings['repo.content']), ""), + slot = _unicode_decode(metadata_bytes.get(b"SLOT", ""), encoding=_encodings['repo.content'], errors='replace') mypkg = myfile[:-5] if not mycat or not mypf or not slot: diff --git a/pym/portage/tests/__init__.py b/pym/portage/tests/__init__.py index 3c3305252..a647aa298 100644 --- a/pym/portage/tests/__init__.py +++ b/pym/portage/tests/__init__.py @@ -1,5 +1,5 @@ # tests/__init__.py -- Portage Unit Test functionality -# Copyright 2006 Gentoo Foundation +# Copyright 2006-2010 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 import sys @@ -13,15 +13,12 @@ except ImportError: from portage import os from portage import _encodings -from portage import _unicode_encode from portage import _unicode_decode def main(): - TEST_FILE = _unicode_encode('__test__', - encoding=_encodings['fs'], errors='strict') - svn_dirname = _unicode_encode('.svn', - encoding=_encodings['fs'], errors='strict') + TEST_FILE = b'__test__' + svn_dirname = b'.svn' suite = unittest.TestSuite() basedir = os.path.dirname(os.path.realpath(__file__)) testDirs = [] diff --git a/pym/repoman/utilities.py b/pym/repoman/utilities.py index 953c3cd2b..9d4898e8a 100644 --- a/pym/repoman/utilities.py +++ b/pym/repoman/utilities.py @@ -30,6 +30,7 @@ from portage import _encodings from portage import _unicode_decode from portage import _unicode_encode from portage import output +from portage.localization import _ from portage.output import red, green from portage.process import find_binary from portage import exception @@ -310,14 +311,13 @@ def get_commit_message_with_editor(editor, message=None): from tempfile import mkstemp fd, filename = mkstemp() try: - os.write(fd, _unicode_encode( + os.write(fd, _unicode_encode(_( "\n# Please enter the commit message " + \ "for your changes.\n# (Comment lines starting " + \ - "with '#' will not be included)\n", + "with '#' will not be included)\n"), encoding=_encodings['content'], errors='backslashreplace')) if message: - os.write(fd, _unicode_encode("#\n", - encoding=_encodings['content'], errors='backslashreplace')) + os.write(fd, b"#\n") for line in message: os.write(fd, _unicode_encode("#" + line, encoding=_encodings['content'], errors='backslashreplace')) |