Permalink
Browse files

support both Python 2 and 3

  • Loading branch information...
1 parent 3ae609b commit baeb1ad3bc2b63d39b66665260d5421a86590cd2 @sublee committed Apr 1, 2013
Showing with 8 additions and 3 deletions.
  1. +3 −1 rainbow
  2. +5 −2 setup.py
View
4 rainbow
@@ -442,9 +442,11 @@ def main():
else:
logger.info("No arguments given, using STDIN as input.")
+ # Support both Python 2 and 3.
+ input_ = raw_input if sys.version_info[0] < 3 else input
try:
while True:
- print(apply_filters(raw_input()))
+ print(apply_filters(input_()))
except (EOFError, KeyboardInterrupt):
return 0
finally:
View
7 setup.py
@@ -1,6 +1,7 @@
#!/usr/bin/env python
-import os, glob
from distutils.core import setup
+import glob
+import os
setup(
name = "rainbow",
@@ -24,12 +25,14 @@
"Intended Audience :: System Administrators",
"Natural Language :: English",
"Programming Language :: Python",
+ "Programming Language :: Python :: 2",
+ "Programming Language :: Python :: 3",
"License :: OSI Approved :: GNU General Public License (GPL)",
],
scripts=['rainbow'],
data_files=[
('/usr/share/rainbow/configs', glob.glob('configs/*')),
('/etc/bash_completion.d', ['completion/bash/rainbow']),
('/usr/share/zsh/site-functions', ['completion/zsh/_rainbow'])
- ]
+ ],
)

0 comments on commit baeb1ad

Please sign in to comment.