Skip to content
This repository has been archived by the owner on Jul 13, 2021. It is now read-only.

Commit

Permalink
Allow Unicode characters in raw_input
Browse files Browse the repository at this point in the history
- Fix traceback caused by Unicode characters that appear in
  raw_input prompt message during the import of GPG keys.
  Related: rhbz#1150029
  • Loading branch information
bocekm committed Oct 6, 2016
1 parent e544042 commit 9d19f5c
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 9 deletions.
38 changes: 31 additions & 7 deletions redhat-upgrade-tool.spec
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
Name: redhat-upgrade-tool
Version: 0.7.44
Version: 0.7.47
Release: 1%{?dist}
Summary: The Red Hat Enterprise Linux Upgrade tool
Epoch: 1

License: GPLv2+
URL: https://github.com/dashea/redhat-upgrade-tool
Source0: %{name}-%{version}.tar.xz
URL: https://github.com/upgrades-migrations/redhat-upgrade-tool
Source0: %{url}/archive/%{name}-%{version}.tar.gz

Requires: grubby
Requires: python-rhsm

# Require for preupgr --riskcheck
Requires: preupgrade-assistant >= 1.0.2-4
Requires: preupgrade-assistant >= 2.1.8-1

# https://bugzilla.redhat.com/show_bug.cgi?id=1038299
Requires: yum >= 3.2.29-43
Expand All @@ -28,7 +28,7 @@ redhat-upgrade-tool is the Red Hat Enterprise Linux Upgrade tool.


%prep
%setup -q
%setup -q -n %{name}-%{version}

%build
make PYTHON=%{__python}
Expand Down Expand Up @@ -75,8 +75,32 @@ mkdir -p $RPM_BUILD_ROOT/etc/redhat-upgrade-tool/update.img.d
#{_datadir}/redhat-upgrade-tool/ui

%changelog
* Thu Oct 6 2016 Michal Bocek <[email protected]> - 1:0.7.47-1
- Fix traceback caused by Unicode characters that appear in raw_input
prompt message during the import of GPG keys.
Related: rhbz#1150029

* Wed Sep 7 2016 Michal Bocek <[email protected]> - 1:0.7.46-1
- Reverted changes from 0.7.45 regarding "New return codes from
preupgrade-assistant."
Related: rhbz#1371553

* Tue Aug 30 2016 Michal Bocek <[email protected]> - 1:0.7.45-1
- New return codes from preupgrade-assistant.
Resolves: rhbz#1371553
- Support include in .repo files.
Resolves: rhbz#1270223
- Prompt user to accept GPG key import.
Resolves: rhbz#1150029
- Fix PYCURL ERROR 22 - remove tool cache at the start of the tool.
Resolves: rhbz#1303982

* Tue Jul 26 2016 Petr Hracek <[email protected]> - 1:0.7.44-2
- Correct dependency on preupgrade-assistant
Related: rhbz#1356806

* Mon Jul 25 2016 Michal Bocek <[email protected]> 0.7.44-1
- Fixed tool failure with AttributeError due to check_inplace_risk().
- Fix tool failure due to AttributeError (check_inplace_risk).
Resolves: rhbz#1356806

* Wed Oct 14 2015 David Shea <[email protected]> 0.7.43-1
Expand Down Expand Up @@ -155,7 +179,7 @@ mkdir -p $RPM_BUILD_ROOT/etc/redhat-upgrade-tool/update.img.d
- Disable yum repos with no enabled= line
Resolves: rhbz#1130686

* Tue Sep 8 2014 David Shea <[email protected]> 0.7.28-1
* Mon Sep 8 2014 David Shea <[email protected]> 0.7.28-1
- Execute preupgrade-scripts after storing RHEL-7 repos (phracek)
Related: rhbz#1138615

Expand Down
18 changes: 17 additions & 1 deletion redhat_upgrade_tool/textoutput.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,23 @@ def verify(self, amount, total, filename, data):
self.bar.finish()

def userconfirm(self):
return YumOutput().userconfirm()
def _raw_input_accepting_unicode(prompt):
# When the terminal is set to a non-ASCII English language, the
# translated prompt may contain Unicode chars - that results in
# a python traceback within the raw_input python built-in function.
# This wrapper fixes that.
from yum.i18n import to_utf8
return raw_input_saved(to_utf8(prompt))

import __builtin__
raw_input_saved = __builtin__.raw_input
__builtin__.raw_input = _raw_input_accepting_unicode

response = YumOutput().userconfirm()

__builtin__.raw_input = raw_input_saved

return response


class TransactionCallback(RPMTsCallback):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def run(self):
os.rename(outfile, newfile)

setup(name="redhat-upgrade-tool",
version="0.7.46",
version="0.7.47",
description="Red Hat Upgrade",
long_description="",
author="Will Woods",
Expand Down

0 comments on commit 9d19f5c

Please sign in to comment.