Skip to content

Commit

Permalink
py26 and py3 compatibility updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
ssbarnea committed Jan 20, 2015
1 parent cef0824 commit 7d360fb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
10 changes: 5 additions & 5 deletions jira/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@
# if encoding != 'UTF8':
# warnings.warn("Python default encoding is '%s' instead of 'UTF8' which means that there is a big change of having problems. Possible workaround http://stackoverflow.com/a/17628350/99834" % encoding)

# we do want to log warrning from our code
logging.captureWarnings(True)


def translate_resource_args(func):
"""
Expand Down Expand Up @@ -217,8 +214,11 @@ def __init__(self, server=None, options=None, basic_auth=None, oauth=None, valid
def _check_update_(self):
# check if the current version of the library is outdated
import json
import urllib2
response = urllib2.urlopen(
try:
from urllib.request import urlopen
except ImportError:
from urllib2 import urlopen
response = urlopen(
"http://pypi.python.org/pypi/jira/json")
data = json.load(response)
released_version = data['info']['version']
Expand Down
9 changes: 6 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
base_path = os.path.dirname(__file__)
fp = open(os.path.join(base_path, NAME, 'version.py'))
__version__ = re.compile(r".*__version__ = '(.*?)'",
re.S).match(fp.read()).group(1)
re.S).match(fp.read()).group(1)
fp.close()


Expand Down Expand Up @@ -91,8 +91,11 @@ def finalize_options(self):

def run(self):
import json
import urllib2
response = urllib2.urlopen(
try:
from urllib.request import urlopen
except ImportError:
from urllib2 import urlopen
response = urlopen(
"http://pypi.python.org/pypi/%s/json" % NAME)
data = json.load(response)
released_version = data['info']['version']
Expand Down

0 comments on commit 7d360fb

Please sign in to comment.