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): ...@@ -2518,7 +2518,7 @@ class DistInfoDistribution(Distribution):
# Including any condition expressions # Including any condition expressions
for req in self._parsed_pkg_info.get_all('Requires-Dist') or []: for req in self._parsed_pkg_info.get_all('Requires-Dist') or []:
distvers, mark = self._preparse_requirement(req) distvers, mark = self._preparse_requirement(req)
parsed = parse_requirements(distvers).next() parsed = next(parse_requirements(distvers))
parsed.marker_fn = compile_marker(mark) parsed.marker_fn = compile_marker(mark)
reqs.append(parsed) reqs.append(parsed)
......
...@@ -34,7 +34,8 @@ from setuptools.archive_util import unpack_archive ...@@ -34,7 +34,8 @@ from setuptools.archive_util import unpack_archive
from setuptools.package_index import PackageIndex from setuptools.package_index import PackageIndex
from setuptools.package_index import URL_SCHEME from setuptools.package_index import URL_SCHEME
from setuptools.command import bdist_egg, egg_info 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, \ from pkg_resources import yield_lines, normalize_path, resource_string, \
ensure_directory, get_distribution, find_distributions, \ ensure_directory, get_distribution, find_distributions, \
Environment, Requirement, Distribution, \ Environment, Requirement, Distribution, \
...@@ -1133,7 +1134,7 @@ See the setuptools documentation for the "develop" command for more info. ...@@ -1133,7 +1134,7 @@ See the setuptools documentation for the "develop" command for more info.
'site_dirs', 'allow_hosts', 'site_dirs', 'allow_hosts',
) )
fetch_options = {} fetch_options = {}
for key, val in ei_opts.iteritems(): for key, val in ei_opts.items():
if key not in fetch_directives: continue if key not in fetch_directives: continue
fetch_options[key.replace('_', '-')] = val[1] fetch_options[key.replace('_', '-')] = val[1]
# create a settings dictionary suitable for `edit_config` # create a settings dictionary suitable for `edit_config`
...@@ -1686,8 +1687,8 @@ def auto_chmod(func, arg, exc): ...@@ -1686,8 +1687,8 @@ def auto_chmod(func, arg, exc):
if func is os.remove and os.name=='nt': if func is os.remove and os.name=='nt':
chmod(arg, stat.S_IWRITE) chmod(arg, stat.S_IWRITE)
return func(arg) return func(arg)
exc = sys.exc_info() et, ev, _ = sys.exc_info()
raise exc[0](exc[1][0], exc[1][1] + (" %s %s" % (func,arg))) reraise(et, (ev[0], ev[1] + (" %s %s" % (func,arg))))
def uncache_zipdir(path): def uncache_zipdir(path):
"""Ensure that the importer caches dont have stale info for `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): ...@@ -1888,7 +1889,7 @@ def rmtree(path, ignore_errors=False, onerror=auto_chmod):
onerror(os.rmdir, path, sys.exc_info()) onerror(os.rmdir, path, sys.exc_info())
def current_umask(): def current_umask():
tmp = os.umask(022) tmp = os.umask(0x12) # 022
os.umask(tmp) os.umask(tmp)
return tmp return tmp
......
...@@ -41,6 +41,8 @@ if sys.version_info[0] < 3: ...@@ -41,6 +41,8 @@ if sys.version_info[0] < 3:
locs = globs locs = globs
exec("""exec code in globs, locs""") exec("""exec code in globs, locs""")
exec_("""def reraise(tp, value, tb=None):
raise tp, value, tb""")
else: else:
PY3 = True PY3 = True
...@@ -76,3 +78,8 @@ else: ...@@ -76,3 +78,8 @@ else:
locs = globs locs = globs
exec_(compile(open(fn).read(), fn, 'exec'), globs, locs) 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 ...@@ -4,9 +4,9 @@ import sys
import os, re, shutil, tempfile, unittest import os, re, shutil, tempfile, unittest
import tempfile import tempfile
import site import site
from StringIO import StringIO
from distutils.errors import DistutilsError from distutils.errors import DistutilsError
from setuptools.compat import StringIO
from setuptools.command.bdist_egg import bdist_egg from setuptools.command.bdist_egg import bdist_egg
from setuptools.command import easy_install as easy_install_pkg from setuptools.command import easy_install as easy_install_pkg
from setuptools.dist import Distribution from setuptools.dist import Distribution
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
import sys import sys
import unittest import unittest
import pkg_resources import pkg_resources
from setuptools.compat import urllib2, httplib, HTTPError from setuptools.compat import urllib2, httplib, HTTPError, unicode
import distutils.errors import distutils.errors
import setuptools.package_index import setuptools.package_index
from setuptools.tests.server import IndexServer from setuptools.tests.server import IndexServer
......
...@@ -7,9 +7,8 @@ import shutil ...@@ -7,9 +7,8 @@ import shutil
import sys import sys
import tempfile import tempfile
import unittest import unittest
from StringIO import StringIO
from setuptools.compat import StringIO
from setuptools.command.sdist import sdist from setuptools.command.sdist import sdist
from setuptools.dist import Distribution from setuptools.dist import Distribution
......
...@@ -6,9 +6,9 @@ import sys ...@@ -6,9 +6,9 @@ import sys
import os, shutil, tempfile, unittest import os, shutil, tempfile, unittest
import tempfile import tempfile
import site import site
from StringIO import StringIO
from distutils.errors import DistutilsError from distutils.errors import DistutilsError
from setuptools.compat import StringIO
from setuptools.command.test import test from setuptools.command.test import test
from setuptools.command import easy_install as easy_install_pkg from setuptools.command import easy_install as easy_install_pkg
from setuptools.dist import Distribution from setuptools.dist import Distribution
...@@ -121,4 +121,4 @@ class TestTestTest(unittest.TestCase): ...@@ -121,4 +121,4 @@ class TestTestTest(unittest.TestCase):
pass pass
finally: finally:
sys.stdout = old_stdout sys.stdout = old_stdout
\ No newline at end of file
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