Skip to content

Commit

Permalink
Make updates.py compatible with Python 3
Browse files Browse the repository at this point in the history
  • Loading branch information
demotu committed Jan 30, 2014
1 parent f1910f1 commit 8e4bffe
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 8e4bffe

Please sign in to comment.