handle missing trailing newline in uninstall_pth

This commit is contained in:
Min RK 2015-07-03 15:52:02 -07:00
parent b9feb191a9
commit b1f949a816
1 changed files with 3 additions and 0 deletions

View File

@ -430,6 +430,9 @@ class UninstallPthEntries(object):
endline = '\r\n'
else:
endline = '\n'
# handle missing trailing newline
if lines and not lines[-1].endswith(endline.encode("utf-8")):
lines[-1] = lines[-1] + endline.encode("utf-8")
for entry in self.entries:
try:
logger.debug('Removing entry: %s', entry)