make setup.py run on python3

This commit is contained in:
Thomas S Hatch 2014-11-07 09:50:11 -07:00
parent 0687e4461d
commit b731ffd0ca

View file

@ -4,6 +4,8 @@
The setup script for salt The setup script for salt
''' '''
from __future__ import absolute_import
# pylint: disable=C0111,E1101,E1103,F0401,W0611,W0201,W0232,R0201,R0902,R0903 # pylint: disable=C0111,E1101,E1103,F0401,W0611,W0201,W0232,R0201,R0902,R0903
# For Python 2.5. A no-op on 2.6 and above. # For Python 2.5. A no-op on 2.6 and above.
@ -12,7 +14,10 @@ from __future__ import print_function, with_statement
import os import os
import sys import sys
import glob import glob
import urllib2 try:
from urllib2 import urlopen
except ImportError:
from urllib.request import urlopen
from datetime import datetime from datetime import datetime
# pylint: disable=E0611 # pylint: disable=E0611
import distutils.dist import distutils.dist
@ -270,7 +275,7 @@ class CloudSdist(Sdist):
) )
) )
except ImportError: except ImportError:
req = urllib2.urlopen(url) req = urlopen(url)
if req.getcode() == 200: if req.getcode() == 200:
script_contents = req.read() script_contents = req.read()
@ -489,7 +494,7 @@ class InstallLib(install_lib):
chmod.append(idx) chmod.append(idx)
for idx in chmod: for idx in chmod:
filename = out[idx] filename = out[idx]
os.chmod(filename, 0755) os.chmod(filename, 0o755)
# <---- Custom Distutils/Setuptools Commands ------------------------------------------------------------------------- # <---- Custom Distutils/Setuptools Commands -------------------------------------------------------------------------