Skip to content

Commit 90a6993

Browse files
committed
merge
2 parents 9f3d14a + 1549a2f commit 90a6993

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

setup.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@
1313
sys.path.insert(0, os.path.join(cur_dir, 'src'))
1414
from github.version import get_version
1515

16+
pkg_requires = ['setuptools', ]
17+
# simplejson is included in since Python 2.6 as json.
18+
if sys.version_info[0] < 3 and sys.version_info[1] < 6:
19+
pkg_requires.append('simplejson')
20+
1621
setup(
1722
name = "github-cli",
1823
version = get_version('short'),
@@ -24,7 +29,7 @@
2429
author_email = '[email protected]',
2530
packages = find_packages('src'),
2631
package_dir = {'': 'src'},
27-
install_requires = ['setuptools', 'simplejson'],
32+
install_requires = pkg_requires,
2833
entry_points="""
2934
[console_scripts]
3035
ghi = github.issues:main

src/github/issues.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,13 @@
55
from optparse import OptionParser
66

77
try:
8-
import simplejson
8+
import json
99
except ImportError:
10-
print "error: simplejson required"
11-
sys.exit(1)
10+
try:
11+
import simplejson as json
12+
except ImportError:
13+
print "error: simplejson required"
14+
sys.exit(1)
1215

1316
from github.utils import urlopen2, get_remote_info, edit_text, \
1417
get_remote_info_from_option, get_prog, Pager, wrap_text, get_underline
@@ -310,7 +313,7 @@ def __submit(self, action, *args, **kwargs):
310313
args_list.insert(0, base_url)
311314
url = "/".join(args_list)
312315
page = urlopen2(url, **kwargs)
313-
result = simplejson.load(page)
316+
result = json.load(page)
314317
page.close()
315318
if result.get('error'):
316319
handle_error(result)

0 commit comments

Comments
 (0)