Skip to content

Commit

Permalink
Merge pull request #4 from duartexyz/master
Browse files Browse the repository at this point in the history
Make updates.py compatible with Python 3
  • Loading branch information
fedosov committed Jan 31, 2014
2 parents f1910f1 + 8e4bffe commit 89b9fd6
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions updates.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = "Mikhail Fedosov ([email protected])"
__version__ = "0.1.4"
Expand All @@ -9,12 +9,20 @@
import pip
import sys
import socket
import xmlrpclib
from multiprocessing import Pool

reload(sys)
sys.setdefaultencoding("utf-8")

if sys.version < '3':
from xmlrpclib import ServerProxy
else:
from xmlrpc.client import ServerProxy

if sys.version < '3':
reload(sys)
sys.setdefaultencoding("utf-8")
else:
# http://stackoverflow.com/questions/3828723/why-we-need-sys-setdefaultencodingutf-8-in-a-py-script
pass


class colors:
""" Colored terminal text
"""
Expand Down Expand Up @@ -58,7 +66,6 @@ def simplify(cls):

def check_package(dist):
pypi = xmlrpclib.ServerProxy("http://pypi.python.org/pypi")

try:
available = pypi.package_releases(dist.project_name)
if not available:
Expand Down

0 comments on commit 89b9fd6

Please sign in to comment.