diff options
Diffstat (limited to 'main.py')
| -rwxr-xr-x | main.py | 15 |
1 files changed, 7 insertions, 8 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,10 +49,10 @@ from pager import RunPager | |||
| 50 | 49 | ||
| 51 | from subcmds import all_commands | 50 | from subcmds import all_commands |
| 52 | 51 | ||
| 53 | try: | 52 | if not is_python3(): |
| 53 | # pylint:disable=W0622 | ||
| 54 | input = raw_input | 54 | input = raw_input |
| 55 | except NameError: | 55 | # pylint:enable=W0622 |
| 56 | pass | ||
| 57 | 56 | ||
| 58 | global_options = optparse.OptionParser( | 57 | global_options = optparse.OptionParser( |
| 59 | usage="repo [-p|--paginate|--no-pager] COMMAND [ARGS]" | 58 | usage="repo [-p|--paginate|--no-pager] COMMAND [ARGS]" |
