Commit ac3ba239 authored by Vinay Sajip's avatar Vinay Sajip

Post-merge fixes for Python 3.

--HG--
branch : distribute
extra : source : 6b9041dea7b9197f6ea1fb993d7a05dd4f7c580d
parent fb8c7cf0
......@@ -2518,7 +2518,7 @@ class DistInfoDistribution(Distribution):
# Including any condition expressions
for req in self._parsed_pkg_info.get_all('Requires-Dist') or []:
distvers, mark = self._preparse_requirement(req)
parsed = parse_requirements(distvers).next()
parsed = next(parse_requirements(distvers))
parsed.marker_fn = compile_marker(mark)
reqs.append(parsed)
......
......@@ -34,7 +34,8 @@ from setuptools.archive_util import unpack_archive
from setuptools.package_index import PackageIndex
from setuptools.package_index import URL_SCHEME
from setuptools.command import bdist_egg, egg_info
from setuptools.compat import iteritems, maxsize, xrange, basestring, unicode
from setuptools.compat import (iteritems, maxsize, xrange, basestring, unicode,
reraise)
from pkg_resources import yield_lines, normalize_path, resource_string, \
ensure_directory, get_distribution, find_distributions, \
Environment, Requirement, Distribution, \
......@@ -1133,7 +1134,7 @@ See the setuptools documentation for the "develop" command for more info.
'site_dirs', 'allow_hosts',
)
fetch_options = {}
for key, val in ei_opts.iteritems():
for key, val in ei_opts.items():
if key not in fetch_directives: continue
fetch_options[key.replace('_', '-')] = val[1]
# create a settings dictionary suitable for `edit_config`
......@@ -1686,8 +1687,8 @@ def auto_chmod(func, arg, exc):
if func is os.remove and os.name=='nt':
chmod(arg, stat.S_IWRITE)
return func(arg)
exc = sys.exc_info()
raise exc[0](exc[1][0], exc[1][1] + (" %s %s" % (func,arg)))
et, ev, _ = sys.exc_info()
reraise(et, (ev[0], ev[1] + (" %s %s" % (func,arg))))
def uncache_zipdir(path):
"""Ensure that the importer caches dont have stale info for `path`"""
......@@ -1888,7 +1889,7 @@ def rmtree(path, ignore_errors=False, onerror=auto_chmod):
onerror(os.rmdir, path, sys.exc_info())
def current_umask():
tmp = os.umask(022)
tmp = os.umask(0x12) # 022
os.umask(tmp)
return tmp
......
......@@ -41,6 +41,8 @@ if sys.version_info[0] < 3:
locs = globs
exec("""exec code in globs, locs""")
exec_("""def reraise(tp, value, tb=None):
raise tp, value, tb""")
else:
PY3 = True
......@@ -76,3 +78,8 @@ else:
locs = globs
exec_(compile(open(fn).read(), fn, 'exec'), globs, locs)
def reraise(tp, value, tb=None):
if value.__traceback__ is not tb:
raise value.with_traceback(tb)
raise value
......@@ -4,9 +4,9 @@ import sys
import os, re, shutil, tempfile, unittest
import tempfile
import site
from StringIO import StringIO
from distutils.errors import DistutilsError
from setuptools.compat import StringIO
from setuptools.command.bdist_egg import bdist_egg
from setuptools.command import easy_install as easy_install_pkg
from setuptools.dist import Distribution
......
......@@ -3,7 +3,7 @@
import sys
import unittest
import pkg_resources
from setuptools.compat import urllib2, httplib, HTTPError
from setuptools.compat import urllib2, httplib, HTTPError, unicode
import distutils.errors
import setuptools.package_index
from setuptools.tests.server import IndexServer
......
......@@ -7,9 +7,8 @@ import shutil
import sys
import tempfile
import unittest
from StringIO import StringIO
from setuptools.compat import StringIO
from setuptools.command.sdist import sdist
from setuptools.dist import Distribution
......
......@@ -6,9 +6,9 @@ import sys
import os, shutil, tempfile, unittest
import tempfile
import site
from StringIO import StringIO
from distutils.errors import DistutilsError
from setuptools.compat import StringIO
from setuptools.command.test import test
from setuptools.command import easy_install as easy_install_pkg
from setuptools.dist import Distribution
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment