Commit 06872bb0 authored by Jason R. Coombs's avatar Jason R. Coombs

Update vendoring technique to match that used for packaging. Ref #229.

--HG--
branch : feature/issue-229
parent 29fa0162
...@@ -3,5 +3,9 @@ empty: ...@@ -3,5 +3,9 @@ empty:
update-vendored: update-vendored:
rm -rf pkg_resources/_vendor/packaging rm -rf pkg_resources/_vendor/packaging
pip install -r pkg_resources/_vendor/vendored.txt -t pkg_resources/_vendor/ python3.5 -m pip install -r pkg_resources/_vendor/vendored.txt -t pkg_resources/_vendor/
rm -rf pkg_resources/_vendor/*.{egg,dist}-info rm -rf pkg_resources/_vendor/*.{egg,dist}-info
rm -rf setuptools/_vendor/six
python3.5 -m pip install -r setuptools/_vendor/vendored.txt -t setuptools/_vendor/
rm -rf setuptools/_vendor/*.{egg,dist}-info
...@@ -14,8 +14,6 @@ from pkg_resources import (parse_requirements, VersionConflict, parse_version, ...@@ -14,8 +14,6 @@ from pkg_resources import (parse_requirements, VersionConflict, parse_version,
packaging = pkg_resources.packaging packaging = pkg_resources.packaging
import six
def safe_repr(obj, short=False): def safe_repr(obj, short=False):
""" copied from Python2.7""" """ copied from Python2.7"""
try: try:
...@@ -315,7 +313,7 @@ class TestEntryPoints: ...@@ -315,7 +313,7 @@ class TestEntryPoints:
def checkSubMap(self, m): def checkSubMap(self, m):
assert len(m) == len(self.submap_expect) assert len(m) == len(self.submap_expect)
for key, ep in six.iteritems(self.submap_expect): for key, ep in self.submap_expect.items():
assert repr(m.get(key)) == repr(ep) assert repr(m.get(key)) == repr(ep)
submap_expect = dict( submap_expect = dict(
......
...@@ -148,9 +148,6 @@ setup_params = dict( ...@@ -148,9 +148,6 @@ setup_params = dict(
Topic :: System :: Systems Administration Topic :: System :: Systems Administration
Topic :: Utilities Topic :: Utilities
""").strip().splitlines(), """).strip().splitlines(),
install_requires=[
'six>=1.5',
],
extras_require={ extras_require={
"ssl:sys_platform=='win32'": "wincertstore==0.2", "ssl:sys_platform=='win32'": "wincertstore==0.2",
"certs": "certifi==2015.11.20", "certs": "certifi==2015.11.20",
......
"""Extensions to the 'distutils' for large or complex distributions""" """Extensions to the 'distutils' for large or complex distributions"""
__import__('setuptools.bootstrap').bootstrap.ensure_deps()
import os import os
import functools import functools
import distutils.core import distutils.core
...@@ -10,7 +8,12 @@ from distutils.core import Command as _Command ...@@ -10,7 +8,12 @@ from distutils.core import Command as _Command
from distutils.util import convert_path from distutils.util import convert_path
from fnmatch import fnmatchcase from fnmatch import fnmatchcase
from six.moves import filterfalse try:
from setuptools._vendor.six.moves import filterfalse
except ImportError:
# fallback to naturally-installed version; allows system packagers to
# omit vendored packages.
from six.moves import filterfalse
import setuptools.version import setuptools.version
from setuptools.extension import Extension from setuptools.extension import Extension
......
This diff is collapsed.
"""
When setuptools is installed in a clean environment, it doesn't have its
dependencies, so it can't run to install its dependencies. This module
checks those dependencies and if one or more are missing, it uses vendored
versions.
"""
import os
import sys
import glob
def ensure_deps():
"""
Detect if dependencies are installed and if not, use vendored versions.
"""
try:
__import__('six')
except ImportError:
use_vendor_deps()
def use_vendor_deps():
"""
Use vendored versions
"""
here = os.path.dirname(__file__)
eggs = glob.glob(here + '/_vendor/*.egg')
sys.path.extend(eggs)
...@@ -11,7 +11,12 @@ import os ...@@ -11,7 +11,12 @@ import os
import marshal import marshal
import textwrap import textwrap
import six try:
from setuptools._vendor import six
except ImportError:
# fallback to naturally-installed version; allows system packagers to
# omit vendored packages.
import six
from pkg_resources import get_build_platform, Distribution, ensure_directory from pkg_resources import get_build_platform, Distribution, ensure_directory
from pkg_resources import EntryPoint from pkg_resources import EntryPoint
......
...@@ -5,7 +5,12 @@ import os ...@@ -5,7 +5,12 @@ import os
import glob import glob
import io import io
import six try:
from setuptools._vendor import six
except ImportError:
# fallback to naturally-installed version; allows system packagers to
# omit vendored packages.
import six
from pkg_resources import Distribution, PathMetadata, normalize_path from pkg_resources import Distribution, PathMetadata, normalize_path
from setuptools.command.easy_install import easy_install from setuptools.command.easy_install import easy_install
......
...@@ -40,8 +40,14 @@ import subprocess ...@@ -40,8 +40,14 @@ import subprocess
import shlex import shlex
import io import io
import six try:
from six.moves import configparser from setuptools._vendor import six
from setuptools._vendor.six.moves import configparser
except ImportError:
# fallback to naturally-installed version; allows system packagers to
# omit vendored packages.
import six
from six.moves import configparser
from setuptools import Command from setuptools import Command
from setuptools.sandbox import run_setup from setuptools.sandbox import run_setup
......
...@@ -14,7 +14,12 @@ import io ...@@ -14,7 +14,12 @@ import io
import warnings import warnings
import time import time
import six try:
from setuptools._vendor import six
except ImportError:
# fallback to naturally-installed version; allows system packagers to
# omit vendored packages.
import six
from setuptools import Command from setuptools import Command
from setuptools.command.sdist import sdist from setuptools.command.sdist import sdist
......
...@@ -3,7 +3,12 @@ from distutils import log ...@@ -3,7 +3,12 @@ from distutils import log
from distutils.errors import DistutilsOptionError from distutils.errors import DistutilsOptionError
import os import os
import six try:
from setuptools._vendor import six
except ImportError:
# fallback to naturally-installed version; allows system packagers to
# omit vendored packages.
import six
from setuptools import Command from setuptools import Command
......
...@@ -5,7 +5,12 @@ import os ...@@ -5,7 +5,12 @@ import os
import sys import sys
import io import io
import six try:
from setuptools._vendor import six
except ImportError:
# fallback to naturally-installed version; allows system packagers to
# omit vendored packages.
import six
from setuptools.utils import cs_path_exists from setuptools.utils import cs_path_exists
......
...@@ -4,7 +4,12 @@ from distutils.errors import DistutilsOptionError ...@@ -4,7 +4,12 @@ from distutils.errors import DistutilsOptionError
import distutils import distutils
import os import os
from six.moves import configparser try:
from setuptools._vendor.six.moves import configparser
except ImportError:
# fallback to naturally-installed version; allows system packagers to
# omit vendored packages.
from six.moves import configparser
from setuptools import Command from setuptools import Command
......
...@@ -2,7 +2,12 @@ from distutils.errors import DistutilsOptionError ...@@ -2,7 +2,12 @@ from distutils.errors import DistutilsOptionError
from unittest import TestLoader from unittest import TestLoader
import sys import sys
import six try:
from setuptools._vendor import six
except ImportError:
# fallback to naturally-installed version; allows system packagers to
# omit vendored packages.
import six
from pkg_resources import (resource_listdir, resource_exists, normalize_path, from pkg_resources import (resource_listdir, resource_exists, normalize_path,
working_set, _namespace_packages, working_set, _namespace_packages,
......
...@@ -16,8 +16,14 @@ import tempfile ...@@ -16,8 +16,14 @@ import tempfile
import sys import sys
import shutil import shutil
from six.moves import http_client, urllib try:
import six from setuptools._vendor import six
from setuptools._vendor.six.moves import http_client, urllib
except ImportError:
# fallback to naturally-installed version; allows system packagers to
# omit vendored packages.
import six
from six.moves import http_client, urllib
from pkg_resources import iter_entry_points from pkg_resources import iter_entry_points
......
...@@ -4,7 +4,12 @@ import marshal ...@@ -4,7 +4,12 @@ import marshal
from imp import PKG_DIRECTORY, PY_COMPILED, PY_SOURCE, PY_FROZEN from imp import PKG_DIRECTORY, PY_COMPILED, PY_SOURCE, PY_FROZEN
from distutils.version import StrictVersion from distutils.version import StrictVersion
import six try:
from setuptools._vendor import six
except ImportError:
# fallback to naturally-installed version; allows system packagers to
# omit vendored packages.
import six
__all__ = [ __all__ = [
'Require', 'find_module', 'get_module_constant', 'extract_constant' 'Require', 'find_module', 'get_module_constant', 'extract_constant'
......
...@@ -13,7 +13,12 @@ from distutils.core import Distribution as _Distribution ...@@ -13,7 +13,12 @@ from distutils.core import Distribution as _Distribution
from distutils.errors import (DistutilsOptionError, DistutilsPlatformError, from distutils.errors import (DistutilsOptionError, DistutilsPlatformError,
DistutilsSetupError) DistutilsSetupError)
import six try:
from setuptools._vendor import six
except ImportError:
# fallback to naturally-installed version; allows system packagers to
# omit vendored packages.
import six
from setuptools.depends import Require from setuptools.depends import Require
from setuptools import windows_support from setuptools import windows_support
......
...@@ -14,8 +14,14 @@ try: ...@@ -14,8 +14,14 @@ try:
except ImportError: except ImportError:
from urllib2 import splituser from urllib2 import splituser
import six try:
from six.moves import urllib, http_client, configparser from setuptools._vendor import six
from setuptools._vendor.six.moves import urllib, http_client, configparser
except ImportError:
# fallback to naturally-installed version; allows system packagers to
# omit vendored packages.
import six
from six.moves import urllib, http_client, configparser
from pkg_resources import ( from pkg_resources import (
CHECKOUT_DIST, Distribution, BINARY_DIST, normalize_path, SOURCE_DIST, CHECKOUT_DIST, Distribution, BINARY_DIST, normalize_path, SOURCE_DIST,
......
...@@ -8,8 +8,14 @@ import re ...@@ -8,8 +8,14 @@ import re
import contextlib import contextlib
import pickle import pickle
import six try:
from six.moves import builtins from setuptools._vendor import six
from setuptools._vendor.six.moves import builtins
except ImportError:
# fallback to naturally-installed version; allows system packagers to
# omit vendored packages.
import six
from six.moves import builtins
import pkg_resources import pkg_resources
......
...@@ -3,7 +3,12 @@ import socket ...@@ -3,7 +3,12 @@ import socket
import atexit import atexit
import re import re
from six.moves import urllib, http_client try:
from setuptools._vendor.six.moves import urllib, http_client
except ImportError:
# fallback to naturally-installed version; allows system packagers to
# omit vendored packages.
from six.moves import urllib, http_client
import pkg_resources import pkg_resources
from pkg_resources import ResolutionError, ExtractionError from pkg_resources import ResolutionError, ExtractionError
......
...@@ -8,7 +8,12 @@ from distutils.errors import DistutilsSetupError ...@@ -8,7 +8,12 @@ from distutils.errors import DistutilsSetupError
from distutils.core import Extension from distutils.core import Extension
from distutils.version import LooseVersion from distutils.version import LooseVersion
import six try:
from setuptools._vendor import six
except ImportError:
# fallback to naturally-installed version; allows system packagers to
# omit vendored packages.
import six
import pytest import pytest
import setuptools.dist import setuptools.dist
......
...@@ -5,7 +5,12 @@ import sys ...@@ -5,7 +5,12 @@ import sys
import contextlib import contextlib
import site import site
import six try:
from setuptools._vendor import six
except ImportError:
# fallback to naturally-installed version; allows system packagers to
# omit vendored packages.
import six
@contextlib.contextmanager @contextlib.contextmanager
......
...@@ -4,7 +4,13 @@ ...@@ -4,7 +4,13 @@
import time import time
import threading import threading
from six.moves import BaseHTTPServer, SimpleHTTPServer try:
from setuptools._vendor.six.moves import BaseHTTPServer, SimpleHTTPServer
except ImportError:
# fallback to naturally-installed version; allows system packagers to
# omit vendored packages.
from six.moves import BaseHTTPServer, SimpleHTTPServer
class IndexServer(BaseHTTPServer.HTTPServer): class IndexServer(BaseHTTPServer.HTTPServer):
"""Basic single-threaded http server simulating a package index """Basic single-threaded http server simulating a package index
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
import os import os
import re import re
import six
import pytest import pytest
from setuptools.dist import Distribution from setuptools.dist import Distribution
......
...@@ -5,7 +5,12 @@ import site ...@@ -5,7 +5,12 @@ import site
import sys import sys
import io import io
import six try:
from setuptools._vendor import six
except ImportError:
# fallback to naturally-installed version; allows system packagers to
# omit vendored packages.
import six
import pytest import pytest
......
...@@ -16,8 +16,15 @@ import itertools ...@@ -16,8 +16,15 @@ import itertools
import distutils.errors import distutils.errors
import io import io
import six try:
from six.moves import urllib from setuptools._vendor import six
from setuptools._vendor.six.moves import urllib
except ImportError:
# fallback to naturally-installed version; allows system packagers to
# omit vendored packages.
import six
from six.moves import urllib
import pytest import pytest
try: try:
from unittest import mock from unittest import mock
......
...@@ -7,7 +7,13 @@ import glob ...@@ -7,7 +7,13 @@ import glob
import os import os
import sys import sys
from six.moves import urllib try:
from setuptools._vendor.six.moves import urllib
except ImportError:
# fallback to naturally-installed version; allows system packagers to
# omit vendored packages.
from six.moves import urllib
import pytest import pytest
......
...@@ -4,8 +4,14 @@ import sys ...@@ -4,8 +4,14 @@ import sys
import os import os
import distutils.errors import distutils.errors
import six try:
from six.moves import urllib, http_client from setuptools._vendor import six
from setuptools._vendor.six.moves import urllib, http_client
except ImportError:
# fallback to naturally-installed version; allows system packagers to
# omit vendored packages.
import six
from six.moves import urllib, http_client
from .textwrap import DALS from .textwrap import DALS
import pkg_resources import pkg_resources
......
...@@ -9,7 +9,13 @@ import unicodedata ...@@ -9,7 +9,13 @@ import unicodedata
import contextlib import contextlib
import io import io
import six try:
from setuptools._vendor import six
except ImportError:
# fallback to naturally-installed version; allows system packagers to
# omit vendored packages.
import six
import pytest import pytest
import pkg_resources import pkg_resources
......
...@@ -6,7 +6,6 @@ import os ...@@ -6,7 +6,6 @@ import os
import site import site
from distutils.errors import DistutilsError from distutils.errors import DistutilsError
import six
import pytest import pytest
from setuptools.command.test import test from setuptools.command.test import test
......
import unicodedata import unicodedata
import sys import sys
import six
try:
from setuptools._vendor import six
except ImportError:
# fallback to naturally-installed version; allows system packagers to
# omit vendored packages.
import six
# HFS Plus uses decomposed UTF-8 # HFS Plus uses decomposed UTF-8
def decompose(path): def decompose(path):
......
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