Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 587198 - sys-apps/portage: chpathtool.py does not work with python3
Summary: sys-apps/portage: chpathtool.py does not work with python3
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core (show other bugs)
Hardware: All All
: Normal normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks: 604854
  Show dependency tree
 
Reported: 2016-06-26 23:18 UTC by Zac Medico
Modified: 2017-02-10 18:48 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Zac Medico gentoo-dev 2016-06-26 23:18:29 UTC
Currently, chpathtool.py does not work with python3 because it tries to compare a byte string with and integer, which always returns files. The following change fixes the problem, and works with both python2 and python3:

diff --git a/bin/chpathtool.py b/bin/chpathtool.py
index 73c7a5f..fbd18b9 100755
--- a/bin/chpathtool.py
+++ b/bin/chpathtool.py
@@ -89,7 +89,7 @@ def chpath_inplace(filename, is_text_file, old, new):
 		if not in_byte:
 			break
 
-		if in_byte == old[matched_byte_count]:
+		if in_byte == old[matched_byte_count:matched_byte_count+1]:
 			matched_byte_count += 1
 			if matched_byte_count == len_old:
 				modified = True
Comment 1 Zac Medico gentoo-dev 2016-06-26 23:42:07 UTC
This is fixed in the master branch:

https://gitweb.gentoo.org/proj/portage.git/commit/?id=8781a2a86b05cf2bc522fca9a22883844a64fdf6
Comment 2 Zac Medico gentoo-dev 2017-02-10 18:48:56 UTC
Fixed in portage-2.3.3.