diff options
Diffstat (limited to 'main.py')
-rwxr-xr-x | main.py | 16 |
1 files changed, 10 insertions, 6 deletions
@@ -22,13 +22,12 @@ import optparse | |||
22 | import os | 22 | import os |
23 | import sys | 23 | import sys |
24 | import time | 24 | import time |
25 | try: | 25 | |
26 | import urllib2 | 26 | from pyversion import is_python3 |
27 | except ImportError: | 27 | if is_python3(): |
28 | # For python3 | ||
29 | import urllib.request | 28 | import urllib.request |
30 | else: | 29 | else: |
31 | # For python2 | 30 | import urllib2 |
32 | urllib = imp.new_module('urllib') | 31 | urllib = imp.new_module('urllib') |
33 | urllib.request = urllib2 | 32 | urllib.request = urllib2 |
34 | 33 | ||
@@ -50,6 +49,11 @@ from pager import RunPager | |||
50 | 49 | ||
51 | from subcmds import all_commands | 50 | from subcmds import all_commands |
52 | 51 | ||
52 | if not is_python3(): | ||
53 | # pylint:disable=W0622 | ||
54 | input = raw_input | ||
55 | # pylint:enable=W0622 | ||
56 | |||
53 | global_options = optparse.OptionParser( | 57 | global_options = optparse.OptionParser( |
54 | usage="repo [-p|--paginate|--no-pager] COMMAND [ARGS]" | 58 | usage="repo [-p|--paginate|--no-pager] COMMAND [ARGS]" |
55 | ) | 59 | ) |
@@ -286,7 +290,7 @@ def _AddPasswordFromUserInput(handler, msg, req): | |||
286 | if user is None: | 290 | if user is None: |
287 | print(msg) | 291 | print(msg) |
288 | try: | 292 | try: |
289 | user = raw_input('User: ') | 293 | user = input('User: ') |
290 | password = getpass.getpass() | 294 | password = getpass.getpass() |
291 | except KeyboardInterrupt: | 295 | except KeyboardInterrupt: |
292 | return | 296 | return |