From 95bcf8c5f6394298035a7332c441868f3b0169f4 Mon Sep 17 00:00:00 2001 From: Donald Stufft Date: Thu, 31 Aug 2017 11:48:18 -0400 Subject: [PATCH 1/2] Move all internal APIs to pip._internal --- .landscape.yml | 2 +- .travis/run.sh | 4 +- MANIFEST.in | 8 +-- docs/pipext.py | 6 +- news/4696.removal | 2 + news/4700.removal | 2 + pip/models/__init__.py | 4 -- setup.cfg | 2 +- setup.py | 14 ++-- src/pip/__init__.py | 1 + {pip => src/pip}/__main__.py | 4 +- {pip => src/pip/_internal}/__init__.py | 30 ++++---- {pip => src/pip/_internal}/basecommand.py | 39 ++++++----- {pip => src/pip/_internal}/baseparser.py | 4 +- {pip => src/pip/_internal}/cache.py | 12 ++-- {pip => src/pip/_internal}/cmdoptions.py | 10 +-- .../pip/_internal}/commands/__init__.py | 26 +++---- {pip => src/pip/_internal}/commands/check.py | 6 +- .../pip/_internal}/commands/completion.py | 2 +- .../pip/_internal}/commands/configuration.py | 12 ++-- .../pip/_internal}/commands/download.py | 20 +++--- {pip => src/pip/_internal}/commands/freeze.py | 12 ++-- {pip => src/pip/_internal}/commands/hash.py | 8 +-- {pip => src/pip/_internal}/commands/help.py | 6 +- .../pip/_internal}/commands/install.py | 26 +++---- {pip => src/pip/_internal}/commands/list.py | 16 +++-- {pip => src/pip/_internal}/commands/search.py | 14 ++-- {pip => src/pip/_internal}/commands/show.py | 4 +- .../pip/_internal}/commands/uninstall.py | 6 +- {pip => src/pip/_internal}/commands/wheel.py | 20 +++--- {pip => src/pip/_internal}/compat.py | 0 {pip => src/pip/_internal}/configuration.py | 6 +- {pip => src/pip/_internal}/download.py | 24 +++---- {pip => src/pip/_internal}/exceptions.py | 3 +- {pip => src/pip/_internal}/index.py | 24 +++---- {pip => src/pip/_internal}/locations.py | 4 +- src/pip/_internal/models/__init__.py | 4 ++ {pip => src/pip/_internal}/models/index.py | 0 .../pip/_internal/operations}/__init__.py | 0 .../pip/_internal}/operations/check.py | 0 .../pip/_internal}/operations/freeze.py | 14 ++-- .../pip/_internal}/operations/prepare.py | 14 ++-- {pip => src/pip/_internal}/pep425tags.py | 7 +- {pip => src/pip/_internal}/req/__init__.py | 0 {pip => src/pip/_internal}/req/req_file.py | 8 +-- {pip => src/pip/_internal}/req/req_install.py | 46 +++++++------ {pip => src/pip/_internal}/req/req_set.py | 6 +- .../pip/_internal}/req/req_uninstall.py | 12 ++-- {pip => src/pip/_internal}/resolve.py | 14 ++-- {pip => src/pip/_internal}/status_codes.py | 0 .../pip/_internal/utils}/__init__.py | 0 {pip => src/pip/_internal}/utils/appdirs.py | 2 +- .../pip/_internal}/utils/deprecation.py | 2 +- {pip => src/pip/_internal}/utils/encoding.py | 0 .../pip/_internal}/utils/filesystem.py | 2 +- {pip => src/pip/_internal}/utils/glibc.py | 0 {pip => src/pip/_internal}/utils/hashes.py | 6 +- {pip => src/pip/_internal}/utils/logging.py | 4 +- .../pip/_internal/utils/misc.py | 23 ++++--- {pip => src/pip/_internal}/utils/outdated.py | 10 +-- {pip => src/pip/_internal}/utils/packaging.py | 2 +- .../pip/_internal}/utils/setuptools_build.py | 0 {pip => src/pip/_internal}/utils/temp_dir.py | 2 +- {pip => src/pip/_internal}/utils/ui.py | 6 +- {pip => src/pip/_internal}/vcs/__init__.py | 7 +- {pip => src/pip/_internal}/vcs/bazaar.py | 8 +-- {pip => src/pip/_internal}/vcs/git.py | 10 +-- {pip => src/pip/_internal}/vcs/mercurial.py | 8 +-- {pip => src/pip/_internal}/vcs/subversion.py | 10 +-- {pip => src/pip/_internal}/wheel.py | 40 ++++++----- {pip => src/pip}/_vendor/Makefile | 0 {pip => src/pip}/_vendor/README.rst | 0 {pip => src/pip}/_vendor/__init__.py | 0 {pip => src/pip}/_vendor/appdirs.py | 0 .../pip}/_vendor/cachecontrol/__init__.py | 0 {pip => src/pip}/_vendor/cachecontrol/_cmd.py | 0 .../pip}/_vendor/cachecontrol/adapter.py | 0 .../pip}/_vendor/cachecontrol/cache.py | 0 .../_vendor/cachecontrol/caches/__init__.py | 0 .../_vendor/cachecontrol/caches/file_cache.py | 0 .../cachecontrol/caches/redis_cache.py | 0 .../pip}/_vendor/cachecontrol/compat.py | 0 .../pip}/_vendor/cachecontrol/controller.py | 0 .../pip}/_vendor/cachecontrol/filewrapper.py | 0 .../pip}/_vendor/cachecontrol/heuristics.py | 0 .../pip}/_vendor/cachecontrol/serialize.py | 0 .../pip}/_vendor/cachecontrol/wrapper.py | 0 {pip => src/pip}/_vendor/colorama/__init__.py | 0 {pip => src/pip}/_vendor/colorama/ansi.py | 0 .../pip}/_vendor/colorama/ansitowin32.py | 0 .../pip}/_vendor/colorama/initialise.py | 0 {pip => src/pip}/_vendor/colorama/win32.py | 0 {pip => src/pip}/_vendor/colorama/winterm.py | 0 {pip => src/pip}/_vendor/distlib/__init__.py | 0 .../_vendor/distlib/_backport/__init__.py | 0 .../pip}/_vendor/distlib/_backport/misc.py | 0 .../pip}/_vendor/distlib/_backport/shutil.py | 0 .../_vendor/distlib/_backport/sysconfig.cfg | 0 .../_vendor/distlib/_backport/sysconfig.py | 0 .../pip}/_vendor/distlib/_backport/tarfile.py | 0 {pip => src/pip}/_vendor/distlib/compat.py | 0 {pip => src/pip}/_vendor/distlib/database.py | 0 {pip => src/pip}/_vendor/distlib/index.py | 0 {pip => src/pip}/_vendor/distlib/locators.py | 0 {pip => src/pip}/_vendor/distlib/manifest.py | 0 {pip => src/pip}/_vendor/distlib/markers.py | 0 {pip => src/pip}/_vendor/distlib/metadata.py | 0 {pip => src/pip}/_vendor/distlib/resources.py | 0 {pip => src/pip}/_vendor/distlib/scripts.py | 0 {pip => src/pip}/_vendor/distlib/t32.exe | Bin {pip => src/pip}/_vendor/distlib/t64.exe | Bin {pip => src/pip}/_vendor/distlib/util.py | 0 {pip => src/pip}/_vendor/distlib/version.py | 0 {pip => src/pip}/_vendor/distlib/w32.exe | Bin {pip => src/pip}/_vendor/distlib/w64.exe | Bin {pip => src/pip}/_vendor/distlib/wheel.py | 0 {pip => src/pip}/_vendor/distro.py | 0 {pip => src/pip}/_vendor/html5lib/__init__.py | 0 .../pip}/_vendor/html5lib/_ihatexml.py | 0 .../pip}/_vendor/html5lib/_inputstream.py | 0 .../pip}/_vendor/html5lib/_tokenizer.py | 0 .../pip}/_vendor/html5lib/_trie/__init__.py | 0 .../pip}/_vendor/html5lib/_trie/_base.py | 0 .../pip}/_vendor/html5lib/_trie/datrie.py | 0 {pip => src/pip}/_vendor/html5lib/_trie/py.py | 0 {pip => src/pip}/_vendor/html5lib/_utils.py | 0 .../pip}/_vendor/html5lib/constants.py | 0 .../pip/_vendor/html5lib/filters}/__init__.py | 0 .../filters/alphabeticalattributes.py | 0 .../pip}/_vendor/html5lib/filters/base.py | 0 .../html5lib/filters/inject_meta_charset.py | 0 .../pip}/_vendor/html5lib/filters/lint.py | 0 .../_vendor/html5lib/filters/optionaltags.py | 0 .../_vendor/html5lib/filters/sanitizer.py | 0 .../_vendor/html5lib/filters/whitespace.py | 0 .../pip}/_vendor/html5lib/html5parser.py | 0 .../pip}/_vendor/html5lib/serializer.py | 0 .../_vendor/html5lib/treeadapters/__init__.py | 0 .../_vendor/html5lib/treeadapters/genshi.py | 0 .../pip}/_vendor/html5lib/treeadapters/sax.py | 0 .../_vendor/html5lib/treebuilders/__init__.py | 0 .../_vendor/html5lib/treebuilders/base.py | 0 .../pip}/_vendor/html5lib/treebuilders/dom.py | 0 .../_vendor/html5lib/treebuilders/etree.py | 0 .../html5lib/treebuilders/etree_lxml.py | 0 .../_vendor/html5lib/treewalkers/__init__.py | 0 .../pip}/_vendor/html5lib/treewalkers/base.py | 0 .../pip}/_vendor/html5lib/treewalkers/dom.py | 0 .../_vendor/html5lib/treewalkers/etree.py | 0 .../html5lib/treewalkers/etree_lxml.py | 0 .../_vendor/html5lib/treewalkers/genshi.py | 0 {pip => src/pip}/_vendor/ipaddress.py | 0 {pip => src/pip}/_vendor/lockfile/__init__.py | 0 .../pip}/_vendor/lockfile/linklockfile.py | 0 .../pip}/_vendor/lockfile/mkdirlockfile.py | 0 .../pip}/_vendor/lockfile/pidlockfile.py | 0 .../pip}/_vendor/lockfile/sqlitelockfile.py | 0 .../pip}/_vendor/lockfile/symlinklockfile.py | 0 {pip => src/pip}/_vendor/msgpack/__init__.py | 0 {pip => src/pip}/_vendor/msgpack/_version.py | 0 .../pip}/_vendor/msgpack/exceptions.py | 0 {pip => src/pip}/_vendor/msgpack/fallback.py | 0 .../pip}/_vendor/packaging/__about__.py | 0 .../pip}/_vendor/packaging/__init__.py | 0 {pip => src/pip}/_vendor/packaging/_compat.py | 0 .../pip}/_vendor/packaging/_structures.py | 0 {pip => src/pip}/_vendor/packaging/markers.py | 0 .../pip}/_vendor/packaging/requirements.py | 0 .../pip}/_vendor/packaging/specifiers.py | 0 {pip => src/pip}/_vendor/packaging/utils.py | 0 {pip => src/pip}/_vendor/packaging/version.py | 0 .../pip}/_vendor/pkg_resources/__init__.py | 0 .../pip}/_vendor/pkg_resources/py31compat.py | 0 {pip => src/pip}/_vendor/progress/__init__.py | 0 {pip => src/pip}/_vendor/progress/bar.py | 0 {pip => src/pip}/_vendor/progress/counter.py | 0 {pip => src/pip}/_vendor/progress/helpers.py | 0 {pip => src/pip}/_vendor/progress/spinner.py | 0 {pip => src/pip}/_vendor/pyparsing.py | 0 {pip => src/pip}/_vendor/pytoml/__init__.py | 0 {pip => src/pip}/_vendor/pytoml/core.py | 0 {pip => src/pip}/_vendor/pytoml/parser.py | 0 {pip => src/pip}/_vendor/pytoml/writer.py | 0 {pip => src/pip}/_vendor/requests/__init__.py | 0 .../pip}/_vendor/requests/_internal_utils.py | 0 {pip => src/pip}/_vendor/requests/adapters.py | 0 {pip => src/pip}/_vendor/requests/api.py | 0 {pip => src/pip}/_vendor/requests/auth.py | 0 {pip => src/pip}/_vendor/requests/cacert.pem | 0 {pip => src/pip}/_vendor/requests/certs.py | 0 {pip => src/pip}/_vendor/requests/compat.py | 0 {pip => src/pip}/_vendor/requests/cookies.py | 0 .../pip}/_vendor/requests/exceptions.py | 0 {pip => src/pip}/_vendor/requests/hooks.py | 0 {pip => src/pip}/_vendor/requests/models.py | 0 .../_vendor/requests/packages/__init__.py | 0 .../requests/packages/chardet/__init__.py | 0 .../requests/packages/chardet/big5freq.py | 0 .../requests/packages/chardet/big5prober.py | 0 .../requests/packages/chardet/chardetect.py | 0 .../packages/chardet/chardistribution.py | 0 .../packages/chardet/charsetgroupprober.py | 0 .../packages/chardet/charsetprober.py | 0 .../requests/packages/chardet/cli/__init__.py | 0 .../packages/chardet/cli/chardetect.py | 0 .../packages/chardet/codingstatemachine.py | 0 .../requests/packages/chardet/compat.py | 0 .../requests/packages/chardet/constants.py | 0 .../requests/packages/chardet/cp949prober.py | 0 .../requests/packages/chardet/enums.py | 0 .../requests/packages/chardet/escprober.py | 0 .../requests/packages/chardet/escsm.py | 0 .../requests/packages/chardet/eucjpprober.py | 0 .../requests/packages/chardet/euckrfreq.py | 0 .../requests/packages/chardet/euckrprober.py | 0 .../requests/packages/chardet/euctwfreq.py | 0 .../requests/packages/chardet/euctwprober.py | 0 .../requests/packages/chardet/gb2312freq.py | 0 .../requests/packages/chardet/gb2312prober.py | 0 .../requests/packages/chardet/hebrewprober.py | 0 .../requests/packages/chardet/jisfreq.py | 0 .../requests/packages/chardet/jpcntx.py | 0 .../packages/chardet/langbulgarianmodel.py | 0 .../packages/chardet/langcyrillicmodel.py | 0 .../packages/chardet/langgreekmodel.py | 0 .../packages/chardet/langhebrewmodel.py | 0 .../packages/chardet/langhungarianmodel.py | 0 .../packages/chardet/langthaimodel.py | 0 .../packages/chardet/langturkishmodel.py | 0 .../requests/packages/chardet/latin1prober.py | 0 .../packages/chardet/mbcharsetprober.py | 0 .../packages/chardet/mbcsgroupprober.py | 0 .../requests/packages/chardet/mbcssm.py | 0 .../packages/chardet/sbcharsetprober.py | 0 .../packages/chardet/sbcsgroupprober.py | 0 .../requests/packages/chardet/sjisprober.py | 0 .../packages/chardet/universaldetector.py | 0 .../requests/packages/chardet/utf8prober.py | 0 .../requests/packages/chardet/version.py | 0 .../requests/packages/idna/__init__.py | 0 .../_vendor/requests/packages/idna/codec.py | 0 .../_vendor/requests/packages/idna/compat.py | 0 .../_vendor/requests/packages/idna/core.py | 0 .../requests/packages/idna/idnadata.py | 0 .../requests/packages/idna/intranges.py | 0 .../requests/packages/idna/uts46data.py | 0 .../requests/packages/urllib3/__init__.py | 0 .../requests/packages/urllib3/_collections.py | 0 .../requests/packages/urllib3/connection.py | 0 .../packages/urllib3/connectionpool.py | 0 .../packages/urllib3/contrib}/__init__.py | 0 .../contrib/_securetransport}/__init__.py | 0 .../contrib/_securetransport/bindings.py | 0 .../contrib/_securetransport/low_level.py | 0 .../packages/urllib3/contrib/appengine.py | 0 .../packages/urllib3/contrib/ntlmpool.py | 0 .../packages/urllib3/contrib/pyopenssl.py | 0 .../urllib3/contrib/securetransport.py | 0 .../packages/urllib3/contrib/socks.py | 0 .../requests/packages/urllib3/exceptions.py | 0 .../requests/packages/urllib3/fields.py | 0 .../requests/packages/urllib3/filepost.py | 0 .../packages/urllib3/packages/__init__.py | 0 .../urllib3/packages/backports/__init__.py | 0 .../urllib3/packages/backports/makefile.py | 0 .../packages/urllib3/packages/ordered_dict.py | 0 .../requests/packages/urllib3/packages/six.py | 0 .../packages/ssl_match_hostname/__init__.py | 0 .../ssl_match_hostname/_implementation.py | 0 .../requests/packages/urllib3/poolmanager.py | 0 .../requests/packages/urllib3/request.py | 0 .../requests/packages/urllib3/response.py | 0 .../packages/urllib3/util/__init__.py | 0 .../packages/urllib3/util/connection.py | 0 .../requests/packages/urllib3/util/request.py | 0 .../packages/urllib3/util/response.py | 0 .../requests/packages/urllib3/util/retry.py | 0 .../packages/urllib3/util/selectors.py | 0 .../requests/packages/urllib3/util/ssl_.py | 0 .../requests/packages/urllib3/util/timeout.py | 0 .../requests/packages/urllib3/util/url.py | 0 .../requests/packages/urllib3/util/wait.py | 0 {pip => src/pip}/_vendor/requests/sessions.py | 0 .../pip}/_vendor/requests/status_codes.py | 0 .../pip}/_vendor/requests/structures.py | 0 {pip => src/pip}/_vendor/requests/utils.py | 0 {pip => src/pip}/_vendor/retrying.py | 0 {pip => src/pip}/_vendor/six.py | 0 {pip => src/pip}/_vendor/vendor.txt | 0 .../pip}/_vendor/webencodings/__init__.py | 0 .../pip}/_vendor/webencodings/labels.py | 0 .../pip}/_vendor/webencodings/mklabels.py | 0 .../pip}/_vendor/webencodings/tests.py | 0 .../_vendor/webencodings/x_user_defined.py | 0 tasks/vendoring/__init__.py | 2 +- tasks/vendoring/patches/cachecontrol.patch | 6 +- tasks/vendoring/patches/distro.patch | 6 +- tasks/vendoring/patches/requests.patch | 12 ++-- tests/conftest.py | 6 +- tests/functional/test_completion.py | 2 +- tests/functional/test_configuration.py | 2 +- tests/functional/test_download.py | 2 +- tests/functional/test_help.py | 8 +-- tests/functional/test_install.py | 11 +-- tests/functional/test_install_cleanup.py | 4 +- tests/functional/test_install_config.py | 2 +- tests/functional/test_install_user.py | 4 +- tests/functional/test_install_vcs_git.py | 8 +-- tests/functional/test_install_vcs_svn.py | 6 +- tests/functional/test_search.py | 4 +- tests/functional/test_show.py | 2 +- tests/functional/test_uninstall.py | 6 +- tests/functional/test_warning.py | 5 +- tests/functional/test_wheel.py | 4 +- tests/lib/__init__.py | 2 +- tests/lib/configuration_helpers.py | 10 +-- tests/lib/local_repos.py | 2 +- tests/lib/options_helpers.py | 6 +- tests/lib/test_lib.py | 7 +- tests/scripts/test_all_pip.py | 2 +- tests/unit/test_appdirs.py | 4 +- tests/unit/test_basecommand.py | 2 +- tests/unit/test_cache.py | 4 +- tests/unit/test_cmdoptions.py | 15 ++-- tests/unit/test_compat.py | 8 ++- tests/unit/test_configuration.py | 6 +- tests/unit/test_download.py | 14 ++-- tests/unit/test_finder.py | 32 +++++---- tests/unit/test_index.py | 4 +- tests/unit/test_locations.py | 2 +- tests/unit/test_options.py | 10 +-- tests/unit/test_pep425tags.py | 65 ++++++++++-------- tests/unit/test_proxy.py | 15 ---- tests/unit/test_req.py | 34 ++++----- tests/unit/test_req_file.py | 39 ++++++----- tests/unit/test_req_install.py | 2 +- tests/unit/test_req_uninstall.py | 16 +++-- tests/unit/test_unit_outdated.py | 4 +- tests/unit/test_utils.py | 32 ++++----- tests/unit/test_vcs.py | 8 +-- tests/unit/test_wheel.py | 46 +++++++------ tox.ini | 2 +- 342 files changed, 595 insertions(+), 550 deletions(-) create mode 100644 news/4696.removal create mode 100644 news/4700.removal delete mode 100644 pip/models/__init__.py create mode 100644 src/pip/__init__.py rename {pip => src/pip}/__main__.py (88%) rename {pip => src/pip/_internal}/__init__.py (92%) rename {pip => src/pip/_internal}/basecommand.py (91%) rename {pip => src/pip/_internal}/baseparser.py (98%) rename {pip => src/pip/_internal}/cache.py (94%) rename {pip => src/pip/_internal}/cmdoptions.py (98%) rename {pip => src/pip/_internal}/commands/__init__.py (63%) rename {pip => src/pip/_internal}/commands/check.py (87%) rename {pip => src/pip/_internal}/commands/completion.py (98%) rename {pip => src/pip/_internal}/commands/configuration.py (95%) rename {pip => src/pip/_internal}/commands/download.py (93%) rename {pip => src/pip/_internal}/commands/freeze.py (91%) rename {pip => src/pip/_internal}/commands/hash.py (87%) rename {pip => src/pip/_internal}/commands/help.py (82%) rename {pip => src/pip/_internal}/commands/install.py (95%) rename {pip => src/pip/_internal}/commands/list.py (96%) rename {pip => src/pip/_internal}/commands/search.py (92%) rename {pip => src/pip/_internal}/commands/show.py (98%) rename {pip => src/pip/_internal}/commands/uninstall.py (93%) rename {pip => src/pip/_internal}/commands/wheel.py (92%) rename {pip => src/pip/_internal}/compat.py (100%) rename {pip => src/pip/_internal}/configuration.py (98%) rename {pip => src/pip/_internal}/download.py (98%) rename {pip => src/pip/_internal}/exceptions.py (98%) rename {pip => src/pip/_internal}/index.py (98%) rename {pip => src/pip/_internal}/locations.py (98%) create mode 100644 src/pip/_internal/models/__init__.py rename {pip => src/pip/_internal}/models/index.py (100%) rename {pip/_vendor/html5lib/filters => src/pip/_internal/operations}/__init__.py (100%) rename {pip => src/pip/_internal}/operations/check.py (100%) rename {pip => src/pip/_internal}/operations/freeze.py (95%) rename {pip => src/pip/_internal}/operations/prepare.py (97%) rename {pip => src/pip/_internal}/pep425tags.py (98%) rename {pip => src/pip/_internal}/req/__init__.py (100%) rename {pip => src/pip/_internal}/req/req_file.py (97%) rename {pip => src/pip/_internal}/req/req_install.py (97%) rename {pip => src/pip/_internal}/req/req_set.py (98%) rename {pip => src/pip/_internal}/req/req_uninstall.py (97%) rename {pip => src/pip/_internal}/resolve.py (96%) rename {pip => src/pip/_internal}/status_codes.py (100%) rename {pip/_vendor/requests/packages/urllib3/contrib => src/pip/_internal/utils}/__init__.py (100%) rename {pip => src/pip/_internal}/utils/appdirs.py (99%) rename {pip => src/pip/_internal}/utils/deprecation.py (96%) rename {pip => src/pip/_internal}/utils/encoding.py (100%) rename {pip => src/pip/_internal}/utils/filesystem.py (94%) rename {pip => src/pip/_internal}/utils/glibc.py (100%) rename {pip => src/pip/_internal}/utils/hashes.py (95%) rename {pip => src/pip/_internal}/utils/logging.py (97%) rename pip/utils/__init__.py => src/pip/_internal/utils/misc.py (98%) rename {pip => src/pip/_internal}/utils/outdated.py (94%) rename {pip => src/pip/_internal}/utils/packaging.py (98%) rename {pip => src/pip/_internal}/utils/setuptools_build.py (100%) rename {pip => src/pip/_internal}/utils/temp_dir.py (98%) rename {pip => src/pip/_internal}/utils/ui.py (98%) rename {pip => src/pip/_internal}/vcs/__init__.py (98%) rename {pip => src/pip/_internal}/vcs/bazaar.py (94%) rename {pip => src/pip/_internal}/vcs/git.py (97%) rename {pip => src/pip/_internal}/vcs/mercurial.py (94%) rename {pip => src/pip/_internal}/vcs/subversion.py (97%) rename {pip => src/pip/_internal}/wheel.py (96%) rename {pip => src/pip}/_vendor/Makefile (100%) rename {pip => src/pip}/_vendor/README.rst (100%) rename {pip => src/pip}/_vendor/__init__.py (100%) rename {pip => src/pip}/_vendor/appdirs.py (100%) rename {pip => src/pip}/_vendor/cachecontrol/__init__.py (100%) rename {pip => src/pip}/_vendor/cachecontrol/_cmd.py (100%) rename {pip => src/pip}/_vendor/cachecontrol/adapter.py (100%) rename {pip => src/pip}/_vendor/cachecontrol/cache.py (100%) rename {pip => src/pip}/_vendor/cachecontrol/caches/__init__.py (100%) rename {pip => src/pip}/_vendor/cachecontrol/caches/file_cache.py (100%) rename {pip => src/pip}/_vendor/cachecontrol/caches/redis_cache.py (100%) rename {pip => src/pip}/_vendor/cachecontrol/compat.py (100%) rename {pip => src/pip}/_vendor/cachecontrol/controller.py (100%) rename {pip => src/pip}/_vendor/cachecontrol/filewrapper.py (100%) rename {pip => src/pip}/_vendor/cachecontrol/heuristics.py (100%) rename {pip => src/pip}/_vendor/cachecontrol/serialize.py (100%) rename {pip => src/pip}/_vendor/cachecontrol/wrapper.py (100%) rename {pip => src/pip}/_vendor/colorama/__init__.py (100%) rename {pip => src/pip}/_vendor/colorama/ansi.py (100%) rename {pip => src/pip}/_vendor/colorama/ansitowin32.py (100%) rename {pip => src/pip}/_vendor/colorama/initialise.py (100%) rename {pip => src/pip}/_vendor/colorama/win32.py (100%) rename {pip => src/pip}/_vendor/colorama/winterm.py (100%) rename {pip => src/pip}/_vendor/distlib/__init__.py (100%) rename {pip => src/pip}/_vendor/distlib/_backport/__init__.py (100%) rename {pip => src/pip}/_vendor/distlib/_backport/misc.py (100%) rename {pip => src/pip}/_vendor/distlib/_backport/shutil.py (100%) rename {pip => src/pip}/_vendor/distlib/_backport/sysconfig.cfg (100%) rename {pip => src/pip}/_vendor/distlib/_backport/sysconfig.py (100%) rename {pip => src/pip}/_vendor/distlib/_backport/tarfile.py (100%) rename {pip => src/pip}/_vendor/distlib/compat.py (100%) rename {pip => src/pip}/_vendor/distlib/database.py (100%) rename {pip => src/pip}/_vendor/distlib/index.py (100%) rename {pip => src/pip}/_vendor/distlib/locators.py (100%) rename {pip => src/pip}/_vendor/distlib/manifest.py (100%) rename {pip => src/pip}/_vendor/distlib/markers.py (100%) rename {pip => src/pip}/_vendor/distlib/metadata.py (100%) rename {pip => src/pip}/_vendor/distlib/resources.py (100%) rename {pip => src/pip}/_vendor/distlib/scripts.py (100%) rename {pip => src/pip}/_vendor/distlib/t32.exe (100%) rename {pip => src/pip}/_vendor/distlib/t64.exe (100%) rename {pip => src/pip}/_vendor/distlib/util.py (100%) rename {pip => src/pip}/_vendor/distlib/version.py (100%) rename {pip => src/pip}/_vendor/distlib/w32.exe (100%) rename {pip => src/pip}/_vendor/distlib/w64.exe (100%) rename {pip => src/pip}/_vendor/distlib/wheel.py (100%) rename {pip => src/pip}/_vendor/distro.py (100%) rename {pip => src/pip}/_vendor/html5lib/__init__.py (100%) rename {pip => src/pip}/_vendor/html5lib/_ihatexml.py (100%) rename {pip => src/pip}/_vendor/html5lib/_inputstream.py (100%) rename {pip => src/pip}/_vendor/html5lib/_tokenizer.py (100%) rename {pip => src/pip}/_vendor/html5lib/_trie/__init__.py (100%) rename {pip => src/pip}/_vendor/html5lib/_trie/_base.py (100%) rename {pip => src/pip}/_vendor/html5lib/_trie/datrie.py (100%) rename {pip => src/pip}/_vendor/html5lib/_trie/py.py (100%) rename {pip => src/pip}/_vendor/html5lib/_utils.py (100%) rename {pip => src/pip}/_vendor/html5lib/constants.py (100%) rename {pip/_vendor/requests/packages/urllib3/contrib/_securetransport => src/pip/_vendor/html5lib/filters}/__init__.py (100%) rename {pip => src/pip}/_vendor/html5lib/filters/alphabeticalattributes.py (100%) rename {pip => src/pip}/_vendor/html5lib/filters/base.py (100%) rename {pip => src/pip}/_vendor/html5lib/filters/inject_meta_charset.py (100%) rename {pip => src/pip}/_vendor/html5lib/filters/lint.py (100%) rename {pip => src/pip}/_vendor/html5lib/filters/optionaltags.py (100%) rename {pip => src/pip}/_vendor/html5lib/filters/sanitizer.py (100%) rename {pip => src/pip}/_vendor/html5lib/filters/whitespace.py (100%) rename {pip => src/pip}/_vendor/html5lib/html5parser.py (100%) rename {pip => src/pip}/_vendor/html5lib/serializer.py (100%) rename {pip => src/pip}/_vendor/html5lib/treeadapters/__init__.py (100%) rename {pip => src/pip}/_vendor/html5lib/treeadapters/genshi.py (100%) rename {pip => src/pip}/_vendor/html5lib/treeadapters/sax.py (100%) rename {pip => src/pip}/_vendor/html5lib/treebuilders/__init__.py (100%) rename {pip => src/pip}/_vendor/html5lib/treebuilders/base.py (100%) rename {pip => src/pip}/_vendor/html5lib/treebuilders/dom.py (100%) rename {pip => src/pip}/_vendor/html5lib/treebuilders/etree.py (100%) rename {pip => src/pip}/_vendor/html5lib/treebuilders/etree_lxml.py (100%) rename {pip => src/pip}/_vendor/html5lib/treewalkers/__init__.py (100%) rename {pip => src/pip}/_vendor/html5lib/treewalkers/base.py (100%) rename {pip => src/pip}/_vendor/html5lib/treewalkers/dom.py (100%) rename {pip => src/pip}/_vendor/html5lib/treewalkers/etree.py (100%) rename {pip => src/pip}/_vendor/html5lib/treewalkers/etree_lxml.py (100%) rename {pip => src/pip}/_vendor/html5lib/treewalkers/genshi.py (100%) rename {pip => src/pip}/_vendor/ipaddress.py (100%) rename {pip => src/pip}/_vendor/lockfile/__init__.py (100%) rename {pip => src/pip}/_vendor/lockfile/linklockfile.py (100%) rename {pip => src/pip}/_vendor/lockfile/mkdirlockfile.py (100%) rename {pip => src/pip}/_vendor/lockfile/pidlockfile.py (100%) rename {pip => src/pip}/_vendor/lockfile/sqlitelockfile.py (100%) rename {pip => src/pip}/_vendor/lockfile/symlinklockfile.py (100%) rename {pip => src/pip}/_vendor/msgpack/__init__.py (100%) rename {pip => src/pip}/_vendor/msgpack/_version.py (100%) rename {pip => src/pip}/_vendor/msgpack/exceptions.py (100%) rename {pip => src/pip}/_vendor/msgpack/fallback.py (100%) rename {pip => src/pip}/_vendor/packaging/__about__.py (100%) rename {pip => src/pip}/_vendor/packaging/__init__.py (100%) rename {pip => src/pip}/_vendor/packaging/_compat.py (100%) rename {pip => src/pip}/_vendor/packaging/_structures.py (100%) rename {pip => src/pip}/_vendor/packaging/markers.py (100%) rename {pip => src/pip}/_vendor/packaging/requirements.py (100%) rename {pip => src/pip}/_vendor/packaging/specifiers.py (100%) rename {pip => src/pip}/_vendor/packaging/utils.py (100%) rename {pip => src/pip}/_vendor/packaging/version.py (100%) rename {pip => src/pip}/_vendor/pkg_resources/__init__.py (100%) rename {pip => src/pip}/_vendor/pkg_resources/py31compat.py (100%) rename {pip => src/pip}/_vendor/progress/__init__.py (100%) rename {pip => src/pip}/_vendor/progress/bar.py (100%) rename {pip => src/pip}/_vendor/progress/counter.py (100%) rename {pip => src/pip}/_vendor/progress/helpers.py (100%) rename {pip => src/pip}/_vendor/progress/spinner.py (100%) rename {pip => src/pip}/_vendor/pyparsing.py (100%) rename {pip => src/pip}/_vendor/pytoml/__init__.py (100%) rename {pip => src/pip}/_vendor/pytoml/core.py (100%) rename {pip => src/pip}/_vendor/pytoml/parser.py (100%) rename {pip => src/pip}/_vendor/pytoml/writer.py (100%) rename {pip => src/pip}/_vendor/requests/__init__.py (100%) rename {pip => src/pip}/_vendor/requests/_internal_utils.py (100%) rename {pip => src/pip}/_vendor/requests/adapters.py (100%) rename {pip => src/pip}/_vendor/requests/api.py (100%) rename {pip => src/pip}/_vendor/requests/auth.py (100%) rename {pip => src/pip}/_vendor/requests/cacert.pem (100%) rename {pip => src/pip}/_vendor/requests/certs.py (100%) rename {pip => src/pip}/_vendor/requests/compat.py (100%) rename {pip => src/pip}/_vendor/requests/cookies.py (100%) rename {pip => src/pip}/_vendor/requests/exceptions.py (100%) rename {pip => src/pip}/_vendor/requests/hooks.py (100%) rename {pip => src/pip}/_vendor/requests/models.py (100%) rename {pip => src/pip}/_vendor/requests/packages/__init__.py (100%) rename {pip => src/pip}/_vendor/requests/packages/chardet/__init__.py (100%) rename {pip => src/pip}/_vendor/requests/packages/chardet/big5freq.py (100%) rename {pip => src/pip}/_vendor/requests/packages/chardet/big5prober.py (100%) rename {pip => src/pip}/_vendor/requests/packages/chardet/chardetect.py (100%) rename {pip => src/pip}/_vendor/requests/packages/chardet/chardistribution.py (100%) rename {pip => src/pip}/_vendor/requests/packages/chardet/charsetgroupprober.py (100%) rename {pip => src/pip}/_vendor/requests/packages/chardet/charsetprober.py (100%) rename {pip => src/pip}/_vendor/requests/packages/chardet/cli/__init__.py (100%) rename {pip => src/pip}/_vendor/requests/packages/chardet/cli/chardetect.py (100%) rename {pip => src/pip}/_vendor/requests/packages/chardet/codingstatemachine.py (100%) rename {pip => src/pip}/_vendor/requests/packages/chardet/compat.py (100%) rename {pip => src/pip}/_vendor/requests/packages/chardet/constants.py (100%) rename {pip => src/pip}/_vendor/requests/packages/chardet/cp949prober.py (100%) rename {pip => src/pip}/_vendor/requests/packages/chardet/enums.py (100%) rename {pip => src/pip}/_vendor/requests/packages/chardet/escprober.py (100%) rename {pip => src/pip}/_vendor/requests/packages/chardet/escsm.py (100%) rename {pip => src/pip}/_vendor/requests/packages/chardet/eucjpprober.py (100%) rename {pip => src/pip}/_vendor/requests/packages/chardet/euckrfreq.py (100%) rename {pip => src/pip}/_vendor/requests/packages/chardet/euckrprober.py (100%) rename {pip => src/pip}/_vendor/requests/packages/chardet/euctwfreq.py (100%) rename {pip => src/pip}/_vendor/requests/packages/chardet/euctwprober.py (100%) rename {pip => src/pip}/_vendor/requests/packages/chardet/gb2312freq.py (100%) rename {pip => src/pip}/_vendor/requests/packages/chardet/gb2312prober.py (100%) rename {pip => src/pip}/_vendor/requests/packages/chardet/hebrewprober.py (100%) rename {pip => src/pip}/_vendor/requests/packages/chardet/jisfreq.py (100%) rename {pip => src/pip}/_vendor/requests/packages/chardet/jpcntx.py (100%) rename {pip => src/pip}/_vendor/requests/packages/chardet/langbulgarianmodel.py (100%) rename {pip => src/pip}/_vendor/requests/packages/chardet/langcyrillicmodel.py (100%) rename {pip => src/pip}/_vendor/requests/packages/chardet/langgreekmodel.py (100%) rename {pip => src/pip}/_vendor/requests/packages/chardet/langhebrewmodel.py (100%) rename {pip => src/pip}/_vendor/requests/packages/chardet/langhungarianmodel.py (100%) rename {pip => src/pip}/_vendor/requests/packages/chardet/langthaimodel.py (100%) rename {pip => src/pip}/_vendor/requests/packages/chardet/langturkishmodel.py (100%) rename {pip => src/pip}/_vendor/requests/packages/chardet/latin1prober.py (100%) rename {pip => src/pip}/_vendor/requests/packages/chardet/mbcharsetprober.py (100%) rename {pip => src/pip}/_vendor/requests/packages/chardet/mbcsgroupprober.py (100%) rename {pip => src/pip}/_vendor/requests/packages/chardet/mbcssm.py (100%) rename {pip => src/pip}/_vendor/requests/packages/chardet/sbcharsetprober.py (100%) rename {pip => src/pip}/_vendor/requests/packages/chardet/sbcsgroupprober.py (100%) rename {pip => src/pip}/_vendor/requests/packages/chardet/sjisprober.py (100%) rename {pip => src/pip}/_vendor/requests/packages/chardet/universaldetector.py (100%) rename {pip => src/pip}/_vendor/requests/packages/chardet/utf8prober.py (100%) rename {pip => src/pip}/_vendor/requests/packages/chardet/version.py (100%) rename {pip => src/pip}/_vendor/requests/packages/idna/__init__.py (100%) rename {pip => src/pip}/_vendor/requests/packages/idna/codec.py (100%) rename {pip => src/pip}/_vendor/requests/packages/idna/compat.py (100%) rename {pip => src/pip}/_vendor/requests/packages/idna/core.py (100%) rename {pip => src/pip}/_vendor/requests/packages/idna/idnadata.py (100%) rename {pip => src/pip}/_vendor/requests/packages/idna/intranges.py (100%) rename {pip => src/pip}/_vendor/requests/packages/idna/uts46data.py (100%) rename {pip => src/pip}/_vendor/requests/packages/urllib3/__init__.py (100%) rename {pip => src/pip}/_vendor/requests/packages/urllib3/_collections.py (100%) rename {pip => src/pip}/_vendor/requests/packages/urllib3/connection.py (100%) rename {pip => src/pip}/_vendor/requests/packages/urllib3/connectionpool.py (100%) rename {pip/_vendor/requests/packages/urllib3/packages/backports => src/pip/_vendor/requests/packages/urllib3/contrib}/__init__.py (100%) rename {pip/operations => src/pip/_vendor/requests/packages/urllib3/contrib/_securetransport}/__init__.py (100%) rename {pip => src/pip}/_vendor/requests/packages/urllib3/contrib/_securetransport/bindings.py (100%) rename {pip => src/pip}/_vendor/requests/packages/urllib3/contrib/_securetransport/low_level.py (100%) rename {pip => src/pip}/_vendor/requests/packages/urllib3/contrib/appengine.py (100%) rename {pip => src/pip}/_vendor/requests/packages/urllib3/contrib/ntlmpool.py (100%) rename {pip => src/pip}/_vendor/requests/packages/urllib3/contrib/pyopenssl.py (100%) rename {pip => src/pip}/_vendor/requests/packages/urllib3/contrib/securetransport.py (100%) rename {pip => src/pip}/_vendor/requests/packages/urllib3/contrib/socks.py (100%) rename {pip => src/pip}/_vendor/requests/packages/urllib3/exceptions.py (100%) rename {pip => src/pip}/_vendor/requests/packages/urllib3/fields.py (100%) rename {pip => src/pip}/_vendor/requests/packages/urllib3/filepost.py (100%) rename {pip => src/pip}/_vendor/requests/packages/urllib3/packages/__init__.py (100%) create mode 100644 src/pip/_vendor/requests/packages/urllib3/packages/backports/__init__.py rename {pip => src/pip}/_vendor/requests/packages/urllib3/packages/backports/makefile.py (100%) rename {pip => src/pip}/_vendor/requests/packages/urllib3/packages/ordered_dict.py (100%) rename {pip => src/pip}/_vendor/requests/packages/urllib3/packages/six.py (100%) rename {pip => src/pip}/_vendor/requests/packages/urllib3/packages/ssl_match_hostname/__init__.py (100%) rename {pip => src/pip}/_vendor/requests/packages/urllib3/packages/ssl_match_hostname/_implementation.py (100%) rename {pip => src/pip}/_vendor/requests/packages/urllib3/poolmanager.py (100%) rename {pip => src/pip}/_vendor/requests/packages/urllib3/request.py (100%) rename {pip => src/pip}/_vendor/requests/packages/urllib3/response.py (100%) rename {pip => src/pip}/_vendor/requests/packages/urllib3/util/__init__.py (100%) rename {pip => src/pip}/_vendor/requests/packages/urllib3/util/connection.py (100%) rename {pip => src/pip}/_vendor/requests/packages/urllib3/util/request.py (100%) rename {pip => src/pip}/_vendor/requests/packages/urllib3/util/response.py (100%) rename {pip => src/pip}/_vendor/requests/packages/urllib3/util/retry.py (100%) rename {pip => src/pip}/_vendor/requests/packages/urllib3/util/selectors.py (100%) rename {pip => src/pip}/_vendor/requests/packages/urllib3/util/ssl_.py (100%) rename {pip => src/pip}/_vendor/requests/packages/urllib3/util/timeout.py (100%) rename {pip => src/pip}/_vendor/requests/packages/urllib3/util/url.py (100%) rename {pip => src/pip}/_vendor/requests/packages/urllib3/util/wait.py (100%) rename {pip => src/pip}/_vendor/requests/sessions.py (100%) rename {pip => src/pip}/_vendor/requests/status_codes.py (100%) rename {pip => src/pip}/_vendor/requests/structures.py (100%) rename {pip => src/pip}/_vendor/requests/utils.py (100%) rename {pip => src/pip}/_vendor/retrying.py (100%) rename {pip => src/pip}/_vendor/six.py (100%) rename {pip => src/pip}/_vendor/vendor.txt (100%) rename {pip => src/pip}/_vendor/webencodings/__init__.py (100%) rename {pip => src/pip}/_vendor/webencodings/labels.py (100%) rename {pip => src/pip}/_vendor/webencodings/mklabels.py (100%) rename {pip => src/pip}/_vendor/webencodings/tests.py (100%) rename {pip => src/pip}/_vendor/webencodings/x_user_defined.py (100%) delete mode 100644 tests/unit/test_proxy.py diff --git a/.landscape.yml b/.landscape.yml index 6da153837..5747f412c 100644 --- a/.landscape.yml +++ b/.landscape.yml @@ -1,2 +1,2 @@ ignore-paths: - - pip/_vendor/ + - src/pip/_vendor/ diff --git a/.travis/run.sh b/.travis/run.sh index 9ebbcb9a1..94d97eb87 100755 --- a/.travis/run.sh +++ b/.travis/run.sh @@ -11,13 +11,13 @@ tox --notest if [[ $VENDOR = "no" ]]; then # Install our dependencies if we're not installing from wheels if [[ $WHEELS != "yes" ]]; then - .tox/$TOXENV/bin/pip install -r pip/_vendor/vendor.txt --no-deps + .tox/$TOXENV/bin/pip install -r src/pip/_vendor/vendor.txt --no-deps fi # Install our dependencies if we're installing from wheels if [[ $WHEELS = "yes" ]]; then mkdir -p /tmp/wheels - pip wheel --wheel-dir /tmp/wheels --no-deps -r pip/_vendor/vendor.txt + pip wheel --wheel-dir /tmp/wheels --no-deps -r src/pip/_vendor/vendor.txt cp /tmp/wheels/* `echo .tox/$TOXENV/lib/python*/site-packages/pip/_vendor/` fi diff --git a/MANIFEST.in b/MANIFEST.in index 04d74e293..f3a381978 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -3,19 +3,19 @@ include LICENSE.txt include NEWS.rst include README.rst include pyproject.toml -include pip/_vendor/README.rst -include pip/_vendor/vendor.txt +include src/pip/_vendor/README.rst +include src/pip/_vendor/vendor.txt exclude .coveragerc exclude .mailmap exclude .travis.yml exclude .landscape.yml -exclude pip/_vendor/Makefile +exclude src/pip/_vendor/Makefile exclude tox.ini exclude dev-requirements.txt exclude appveyor.yml -recursive-include pip/_vendor *.pem +recursive-include src/pip/_vendor *.pem recursive-include docs Makefile *.rst *.py *.bat prune .github diff --git a/docs/pipext.py b/docs/pipext.py index 2bcd244e0..91c96f7fc 100644 --- a/docs/pipext.py +++ b/docs/pipext.py @@ -6,9 +6,9 @@ from docutils import nodes from docutils.parsers import rst from docutils.statemachine import ViewList from textwrap import dedent -from pip.commands import commands_dict as commands -from pip import cmdoptions -from pip.utils import get_prog +from pip._internal import cmdoptions +from pip._internal.commands import commands_dict as commands +from pip._internal.utils.misc import get_prog class PipCommandUsage(rst.Directive): diff --git a/news/4696.removal b/news/4696.removal new file mode 100644 index 000000000..1c68f443a --- /dev/null +++ b/news/4696.removal @@ -0,0 +1,2 @@ +Move all of pip's APIs into the pip._internal package, properly reflecting the +fact that pip does not currently have any public APIs. diff --git a/news/4700.removal b/news/4700.removal new file mode 100644 index 000000000..1c68f443a --- /dev/null +++ b/news/4700.removal @@ -0,0 +1,2 @@ +Move all of pip's APIs into the pip._internal package, properly reflecting the +fact that pip does not currently have any public APIs. diff --git a/pip/models/__init__.py b/pip/models/__init__.py deleted file mode 100644 index 1d727d7ee..000000000 --- a/pip/models/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -from pip.models.index import Index, PyPI - - -__all__ = ["Index", "PyPI"] diff --git a/setup.cfg b/setup.cfg index 3689f7f63..b2db7a9ac 100644 --- a/setup.cfg +++ b/setup.cfg @@ -15,7 +15,7 @@ exclude = .tox,.idea,*.egg,build,_vendor,data select = E,W,F [tool:pytest] -addopts = --ignore pip/_vendor --ignore tests/tests_cache +addopts = --ignore src/pip/_vendor --ignore tests/tests_cache [bdist_wheel] universal=1 diff --git a/setup.py b/setup.py index 10ecc6f66..9111b67b2 100644 --- a/setup.py +++ b/setup.py @@ -38,7 +38,7 @@ tests_require = [ setup( name="pip", - version=find_version("pip", "__init__.py"), + version=find_version("src", "pip", "__init__.py"), description="The PyPA recommended tool for installing Python packages.", long_description=long_description, classifiers=[ @@ -60,7 +60,11 @@ setup( author_email='python-virtualenv@groups.google.com', url='https://pip.pypa.io/', license='MIT', - packages=find_packages(exclude=["contrib", "docs", "tests*", "tasks"]), + package_dir={"": "src"}, + packages=find_packages( + where="src", + exclude=["contrib", "docs", "tests*", "tasks"], + ), package_data={ "pip._vendor.certifi": ["*.pem"], "pip._vendor.requests": ["*.pem"], @@ -69,9 +73,9 @@ setup( }, entry_points={ "console_scripts": [ - "pip=pip:main", - "pip%s=pip:main" % sys.version[:1], - "pip%s=pip:main" % sys.version[:3], + "pip=pip._internal:main", + "pip%s=pip._internal:main" % sys.version[:1], + "pip%s=pip._internal:main" % sys.version[:3], ], }, tests_require=tests_require, diff --git a/src/pip/__init__.py b/src/pip/__init__.py new file mode 100644 index 000000000..9a9fd0a05 --- /dev/null +++ b/src/pip/__init__.py @@ -0,0 +1 @@ +__version__ = "10.0.0.dev0" diff --git a/pip/__main__.py b/src/pip/__main__.py similarity index 88% rename from pip/__main__.py rename to src/pip/__main__.py index 5556539cb..4609582c3 100644 --- a/pip/__main__.py +++ b/src/pip/__main__.py @@ -13,7 +13,7 @@ if __package__ == '': path = os.path.dirname(os.path.dirname(__file__)) sys.path.insert(0, path) -import pip # noqa +from pip._internal import main as _main # noqa if __name__ == '__main__': - sys.exit(pip.main()) + sys.exit(_main()) diff --git a/pip/__init__.py b/src/pip/_internal/__init__.py similarity index 92% rename from pip/__init__.py rename to src/pip/_internal/__init__.py index 804dfa1c4..84e94f679 100755 --- a/pip/__init__.py +++ b/src/pip/_internal/__init__.py @@ -40,13 +40,17 @@ else: else: securetransport.inject_into_urllib3() -from pip.exceptions import CommandError, PipError -from pip.utils import get_installed_distributions, get_prog -from pip.utils import deprecation -from pip.vcs import git, mercurial, subversion, bazaar # noqa -from pip.baseparser import ConfigOptionParser, UpdatingDefaultsHelpFormatter -from pip.commands import get_summaries, get_similar_commands -from pip.commands import commands_dict +from pip import __version__ +from pip._internal import cmdoptions +from pip._internal.exceptions import CommandError, PipError +from pip._internal.utils.misc import get_installed_distributions, get_prog +from pip._internal.utils import deprecation +from pip._internal.vcs import git, mercurial, subversion, bazaar # noqa +from pip._internal.baseparser import ( + ConfigOptionParser, UpdatingDefaultsHelpFormatter, +) +from pip._internal.commands import get_summaries, get_similar_commands +from pip._internal.commands import commands_dict from pip._vendor.requests.packages.urllib3.exceptions import ( InsecureRequestWarning, ) @@ -57,12 +61,8 @@ from pip._vendor.requests.packages.urllib3.exceptions import ( # This fixes a peculiarity when importing via __import__ - as we are # initialising the pip module, "from pip import cmdoptions" is recursive # and appears not to work properly in that situation. -import pip.cmdoptions -cmdoptions = pip.cmdoptions - -# The version as used in the setup.py and the docs conf.py -__version__ = "10.0.0.dev0" - +# import pip._internal.cmdoptions +# cmdoptions = pip._internal.cmdoptions logger = logging.getLogger(__name__) @@ -249,7 +249,3 @@ def main(args=None): logger.debug("Ignoring error %s when setting locale", e) command = commands_dict[cmd_name](isolated=check_isolated(cmd_args)) return command.main(cmd_args) - - -if __name__ == '__main__': - sys.exit(main()) diff --git a/pip/basecommand.py b/src/pip/_internal/basecommand.py similarity index 91% rename from pip/basecommand.py rename to src/pip/_internal/basecommand.py index c2e3c34ca..f5f92ec1d 100644 --- a/pip/basecommand.py +++ b/src/pip/_internal/basecommand.py @@ -8,24 +8,27 @@ import os import sys import warnings -from pip import cmdoptions -from pip.baseparser import ConfigOptionParser, UpdatingDefaultsHelpFormatter -from pip.compat import WINDOWS -from pip.download import PipSession -from pip.exceptions import ( +from pip._internal import cmdoptions +from pip._internal.baseparser import ( + ConfigOptionParser, UpdatingDefaultsHelpFormatter +) +from pip._internal.compat import WINDOWS +from pip._internal.download import PipSession +from pip._internal.exceptions import ( BadCommand, CommandError, InstallationError, PreviousBuildDirError, UninstallationError ) -from pip.index import PackageFinder -from pip.locations import running_under_virtualenv -from pip.req import InstallRequirement, parse_requirements -from pip.status_codes import ( +from pip._internal.index import PackageFinder +from pip._internal.locations import running_under_virtualenv +from pip._internal.req import InstallRequirement, parse_requirements +from pip._internal.status_codes import ( ERROR, PREVIOUS_BUILD_DIR_ERROR, SUCCESS, UNKNOWN_ERROR, VIRTUALENV_NOT_FOUND ) -from pip.utils import deprecation, get_prog, normalize_path -from pip.utils.logging import IndentingFormatter -from pip.utils.outdated import pip_version_check +from pip._internal.utils import deprecation +from pip._internal.utils.logging import IndentingFormatter +from pip._internal.utils.misc import get_prog, normalize_path +from pip._internal.utils.outdated import pip_version_check __all__ = ['Command'] @@ -130,7 +133,7 @@ class Command(object): "disable_existing_loggers": False, "filters": { "exclude_warnings": { - "()": "pip.utils.logging.MaxLevelFilter", + "()": "pip._internal.utils.logging.MaxLevelFilter", "level": logging.WARNING, }, }, @@ -143,20 +146,24 @@ class Command(object): "handlers": { "console": { "level": level, - "class": "pip.utils.logging.ColorizedStreamHandler", + "class": + "pip._internal.utils.logging.ColorizedStreamHandler", "stream": self.log_streams[0], "filters": ["exclude_warnings"], "formatter": "indent", }, "console_errors": { "level": "WARNING", - "class": "pip.utils.logging.ColorizedStreamHandler", + "class": + "pip._internal.utils.logging.ColorizedStreamHandler", "stream": self.log_streams[1], "formatter": "indent", }, "user_log": { "level": "DEBUG", - "class": "pip.utils.logging.BetterRotatingFileHandler", + "class": + ("pip._internal.utils.logging" + ".BetterRotatingFileHandler"), "filename": options.log or "/dev/null", "delay": True, "formatter": "indent", diff --git a/pip/baseparser.py b/src/pip/_internal/baseparser.py similarity index 98% rename from pip/baseparser.py rename to src/pip/_internal/baseparser.py index ea76a21af..fce8c0622 100644 --- a/pip/baseparser.py +++ b/src/pip/_internal/baseparser.py @@ -9,8 +9,8 @@ from distutils.util import strtobool from pip._vendor.six import string_types -from pip.configuration import Configuration -from pip.utils import get_terminal_size +from pip._internal.configuration import Configuration +from pip._internal.utils.misc import get_terminal_size logger = logging.getLogger(__name__) diff --git a/pip/cache.py b/src/pip/_internal/cache.py similarity index 94% rename from pip/cache.py rename to src/pip/_internal/cache.py index 271c7c1df..bd4324b02 100644 --- a/pip/cache.py +++ b/src/pip/_internal/cache.py @@ -8,10 +8,10 @@ import os from pip._vendor.packaging.utils import canonicalize_name -import pip.index -from pip.compat import expanduser -from pip.download import path_to_url -from pip.wheel import InvalidWheelFilename, Wheel +from pip._internal import index +from pip._internal.compat import expanduser +from pip._internal.download import path_to_url +from pip._internal.wheel import InvalidWheelFilename, Wheel logger = logging.getLogger(__name__) @@ -71,7 +71,7 @@ class Cache(object): return [] canonical_name = canonicalize_name(package_name) - formats = pip.index.fmt_ctl_formats( + formats = index.fmt_ctl_formats( self.format_control, canonical_name ) if not self.allowed_formats.intersection(formats): @@ -100,7 +100,7 @@ class Cache(object): root = self.get_path_for_link(link) path = os.path.join(root, candidate) - return pip.index.Link(path_to_url(path)) + return index.Link(path_to_url(path)) class WheelCache(Cache): diff --git a/pip/cmdoptions.py b/src/pip/_internal/cmdoptions.py similarity index 98% rename from pip/cmdoptions.py rename to src/pip/_internal/cmdoptions.py index 3f9db5ba5..77c21d45c 100644 --- a/pip/cmdoptions.py +++ b/src/pip/_internal/cmdoptions.py @@ -13,13 +13,13 @@ import warnings from functools import partial from optparse import SUPPRESS_HELP, Option, OptionGroup -from pip.index import ( +from pip._internal.index import ( FormatControl, fmt_ctl_handle_mutual_exclude, fmt_ctl_no_binary ) -from pip.locations import USER_CACHE_DIR, src_prefix -from pip.models import PyPI -from pip.utils.hashes import STRONG_HASHES -from pip.utils.ui import BAR_TYPES +from pip._internal.locations import USER_CACHE_DIR, src_prefix +from pip._internal.models import PyPI +from pip._internal.utils.hashes import STRONG_HASHES +from pip._internal.utils.ui import BAR_TYPES def make_option_group(group, parser): diff --git a/pip/commands/__init__.py b/src/pip/_internal/commands/__init__.py similarity index 63% rename from pip/commands/__init__.py rename to src/pip/_internal/commands/__init__.py index 780ae2934..bcecc6523 100644 --- a/pip/commands/__init__.py +++ b/src/pip/_internal/commands/__init__.py @@ -3,19 +3,19 @@ Package containing all pip commands """ from __future__ import absolute_import -from pip.commands.completion import CompletionCommand -from pip.commands.configuration import ConfigurationCommand -from pip.commands.download import DownloadCommand -from pip.commands.freeze import FreezeCommand -from pip.commands.hash import HashCommand -from pip.commands.help import HelpCommand -from pip.commands.list import ListCommand -from pip.commands.check import CheckCommand -from pip.commands.search import SearchCommand -from pip.commands.show import ShowCommand -from pip.commands.install import InstallCommand -from pip.commands.uninstall import UninstallCommand -from pip.commands.wheel import WheelCommand +from pip._internal.commands.completion import CompletionCommand +from pip._internal.commands.configuration import ConfigurationCommand +from pip._internal.commands.download import DownloadCommand +from pip._internal.commands.freeze import FreezeCommand +from pip._internal.commands.hash import HashCommand +from pip._internal.commands.help import HelpCommand +from pip._internal.commands.list import ListCommand +from pip._internal.commands.check import CheckCommand +from pip._internal.commands.search import SearchCommand +from pip._internal.commands.show import ShowCommand +from pip._internal.commands.install import InstallCommand +from pip._internal.commands.uninstall import UninstallCommand +from pip._internal.commands.wheel import WheelCommand commands_order = [ InstallCommand, diff --git a/pip/commands/check.py b/src/pip/_internal/commands/check.py similarity index 87% rename from pip/commands/check.py rename to src/pip/_internal/commands/check.py index d951f8e87..ea7dc9094 100644 --- a/pip/commands/check.py +++ b/src/pip/_internal/commands/check.py @@ -1,8 +1,8 @@ import logging -from pip.basecommand import Command -from pip.operations.check import check_requirements -from pip.utils import get_installed_distributions +from pip._internal.basecommand import Command +from pip._internal.operations.check import check_requirements +from pip._internal.utils.misc import get_installed_distributions logger = logging.getLogger(__name__) diff --git a/pip/commands/completion.py b/src/pip/_internal/commands/completion.py similarity index 98% rename from pip/commands/completion.py rename to src/pip/_internal/commands/completion.py index 1c0744d23..40cd32e1d 100644 --- a/pip/commands/completion.py +++ b/src/pip/_internal/commands/completion.py @@ -3,7 +3,7 @@ from __future__ import absolute_import import sys import textwrap -from pip.basecommand import Command +from pip._internal.basecommand import Command BASE_COMPLETION = """ # pip %(shell)s completion start%(script)s# pip %(shell)s completion end diff --git a/pip/commands/configuration.py b/src/pip/_internal/commands/configuration.py similarity index 95% rename from pip/commands/configuration.py rename to src/pip/_internal/commands/configuration.py index 071f08b9c..24a45e847 100644 --- a/pip/commands/configuration.py +++ b/src/pip/_internal/commands/configuration.py @@ -2,12 +2,12 @@ import logging import os import subprocess -from pip.basecommand import Command -from pip.configuration import Configuration, kinds -from pip.exceptions import PipError -from pip.locations import venv_config_file -from pip.status_codes import ERROR, SUCCESS -from pip.utils import get_prog +from pip._internal.basecommand import Command +from pip._internal.configuration import Configuration, kinds +from pip._internal.exceptions import PipError +from pip._internal.locations import venv_config_file +from pip._internal.status_codes import ERROR, SUCCESS +from pip._internal.utils.misc import get_prog logger = logging.getLogger(__name__) diff --git a/pip/commands/download.py b/src/pip/_internal/commands/download.py similarity index 93% rename from pip/commands/download.py rename to src/pip/_internal/commands/download.py index a33c6097a..1ccfd4493 100644 --- a/pip/commands/download.py +++ b/src/pip/_internal/commands/download.py @@ -3,16 +3,16 @@ from __future__ import absolute_import import logging import os -from pip import cmdoptions -from pip.basecommand import RequirementCommand -from pip.exceptions import CommandError -from pip.index import FormatControl -from pip.operations.prepare import RequirementPreparer -from pip.req import RequirementSet -from pip.resolve import Resolver -from pip.utils import ensure_dir, normalize_path -from pip.utils.filesystem import check_path_owner -from pip.utils.temp_dir import TempDirectory +from pip._internal import cmdoptions +from pip._internal.basecommand import RequirementCommand +from pip._internal.exceptions import CommandError +from pip._internal.index import FormatControl +from pip._internal.operations.prepare import RequirementPreparer +from pip._internal.req import RequirementSet +from pip._internal.resolve import Resolver +from pip._internal.utils.filesystem import check_path_owner +from pip._internal.utils.misc import ensure_dir, normalize_path +from pip._internal.utils.temp_dir import TempDirectory logger = logging.getLogger(__name__) diff --git a/pip/commands/freeze.py b/src/pip/_internal/commands/freeze.py similarity index 91% rename from pip/commands/freeze.py rename to src/pip/_internal/commands/freeze.py index e02fdcf87..2ac0bf9ca 100644 --- a/pip/commands/freeze.py +++ b/src/pip/_internal/commands/freeze.py @@ -2,11 +2,11 @@ from __future__ import absolute_import import sys -import pip -from pip.basecommand import Command -from pip.cache import WheelCache -from pip.compat import stdlib_pkgs -from pip.operations.freeze import freeze +from pip._internal import index +from pip._internal.basecommand import Command +from pip._internal.cache import WheelCache +from pip._internal.compat import stdlib_pkgs +from pip._internal.operations.freeze import freeze DEV_PKGS = {'pip', 'setuptools', 'distribute', 'wheel'} @@ -71,7 +71,7 @@ class FreezeCommand(Command): self.parser.insert_option_group(0, self.cmd_opts) def run(self, options, args): - format_control = pip.index.FormatControl(set(), set()) + format_control = index.FormatControl(set(), set()) wheel_cache = WheelCache(options.cache_dir, format_control) skip = set(stdlib_pkgs) if not options.freeze_all: diff --git a/pip/commands/hash.py b/src/pip/_internal/commands/hash.py similarity index 87% rename from pip/commands/hash.py rename to src/pip/_internal/commands/hash.py index 6228fb7fd..95353b040 100644 --- a/pip/commands/hash.py +++ b/src/pip/_internal/commands/hash.py @@ -4,10 +4,10 @@ import hashlib import logging import sys -from pip.basecommand import Command -from pip.status_codes import ERROR -from pip.utils import read_chunks -from pip.utils.hashes import FAVORITE_HASH, STRONG_HASHES +from pip._internal.basecommand import Command +from pip._internal.status_codes import ERROR +from pip._internal.utils.hashes import FAVORITE_HASH, STRONG_HASHES +from pip._internal.utils.misc import read_chunks logger = logging.getLogger(__name__) diff --git a/pip/commands/help.py b/src/pip/_internal/commands/help.py similarity index 82% rename from pip/commands/help.py rename to src/pip/_internal/commands/help.py index e897427d8..06ca2c171 100644 --- a/pip/commands/help.py +++ b/src/pip/_internal/commands/help.py @@ -1,7 +1,7 @@ from __future__ import absolute_import -from pip.basecommand import SUCCESS, Command -from pip.exceptions import CommandError +from pip._internal.basecommand import SUCCESS, Command +from pip._internal.exceptions import CommandError class HelpCommand(Command): @@ -13,7 +13,7 @@ class HelpCommand(Command): ignore_require_venv = True def run(self, options, args): - from pip.commands import commands_dict, get_similar_commands + from pip._internal.commands import commands_dict, get_similar_commands try: # 'pip help' with no args is handled by pip.__init__.parseopt() diff --git a/pip/commands/install.py b/src/pip/_internal/commands/install.py similarity index 95% rename from pip/commands/install.py rename to src/pip/_internal/commands/install.py index 6c7dab73e..b7575e526 100644 --- a/pip/commands/install.py +++ b/src/pip/_internal/commands/install.py @@ -6,21 +6,21 @@ import operator import os import shutil -from pip import cmdoptions -from pip.basecommand import RequirementCommand -from pip.cache import WheelCache -from pip.exceptions import ( +from pip._internal import cmdoptions +from pip._internal.basecommand import RequirementCommand +from pip._internal.cache import WheelCache +from pip._internal.exceptions import ( CommandError, InstallationError, PreviousBuildDirError ) -from pip.locations import distutils_scheme, virtualenv_no_global -from pip.operations.prepare import RequirementPreparer -from pip.req import RequirementSet -from pip.resolve import Resolver -from pip.status_codes import ERROR -from pip.utils import ensure_dir, get_installed_version -from pip.utils.filesystem import check_path_owner -from pip.utils.temp_dir import TempDirectory -from pip.wheel import WheelBuilder +from pip._internal.locations import distutils_scheme, virtualenv_no_global +from pip._internal.operations.prepare import RequirementPreparer +from pip._internal.req import RequirementSet +from pip._internal.resolve import Resolver +from pip._internal.status_codes import ERROR +from pip._internal.utils.filesystem import check_path_owner +from pip._internal.utils.misc import ensure_dir, get_installed_version +from pip._internal.utils.temp_dir import TempDirectory +from pip._internal.wheel import WheelBuilder try: import wheel diff --git a/pip/commands/list.py b/src/pip/_internal/commands/list.py similarity index 96% rename from pip/commands/list.py rename to src/pip/_internal/commands/list.py index 2891362f5..0b133a9ce 100644 --- a/pip/commands/list.py +++ b/src/pip/_internal/commands/list.py @@ -6,13 +6,15 @@ import warnings from pip._vendor import six -from pip.basecommand import Command -from pip.cmdoptions import index_group, make_option_group -from pip.exceptions import CommandError -from pip.index import PackageFinder -from pip.utils import dist_is_editable, get_installed_distributions -from pip.utils.deprecation import RemovedInPip11Warning -from pip.utils.packaging import get_installer +from pip._internal.basecommand import Command +from pip._internal.cmdoptions import index_group, make_option_group +from pip._internal.exceptions import CommandError +from pip._internal.index import PackageFinder +from pip._internal.utils.deprecation import RemovedInPip11Warning +from pip._internal.utils.misc import ( + dist_is_editable, get_installed_distributions +) +from pip._internal.utils.packaging import get_installer try: from itertools import zip_longest diff --git a/pip/commands/search.py b/src/pip/_internal/commands/search.py similarity index 92% rename from pip/commands/search.py rename to src/pip/_internal/commands/search.py index 96e3cca41..6ccadfadf 100644 --- a/pip/commands/search.py +++ b/src/pip/_internal/commands/search.py @@ -9,13 +9,13 @@ from pip._vendor import pkg_resources from pip._vendor.packaging.version import parse as parse_version from pip._vendor.six.moves import xmlrpc_client -from pip.basecommand import SUCCESS, Command -from pip.download import PipXmlrpcTransport -from pip.exceptions import CommandError -from pip.models import PyPI -from pip.status_codes import NO_MATCHES_FOUND -from pip.utils import get_terminal_size -from pip.utils.logging import indent_log +from pip._internal.basecommand import SUCCESS, Command +from pip._internal.download import PipXmlrpcTransport +from pip._internal.exceptions import CommandError +from pip._internal.models import PyPI +from pip._internal.status_codes import NO_MATCHES_FOUND +from pip._internal.utils.logging import indent_log +from pip._internal.utils.misc import get_terminal_size logger = logging.getLogger(__name__) diff --git a/pip/commands/show.py b/src/pip/_internal/commands/show.py similarity index 98% rename from pip/commands/show.py rename to src/pip/_internal/commands/show.py index 92c6c78cd..f5ddd50e7 100644 --- a/pip/commands/show.py +++ b/src/pip/_internal/commands/show.py @@ -7,8 +7,8 @@ from email.parser import FeedParser from pip._vendor import pkg_resources from pip._vendor.packaging.utils import canonicalize_name -from pip.basecommand import Command -from pip.status_codes import ERROR, SUCCESS +from pip._internal.basecommand import Command +from pip._internal.status_codes import ERROR, SUCCESS logger = logging.getLogger(__name__) diff --git a/pip/commands/uninstall.py b/src/pip/_internal/commands/uninstall.py similarity index 93% rename from pip/commands/uninstall.py rename to src/pip/_internal/commands/uninstall.py index 8608f37ca..6b94d6bfd 100644 --- a/pip/commands/uninstall.py +++ b/src/pip/_internal/commands/uninstall.py @@ -2,9 +2,9 @@ from __future__ import absolute_import from pip._vendor.packaging.utils import canonicalize_name -from pip.basecommand import Command -from pip.exceptions import InstallationError -from pip.req import InstallRequirement, parse_requirements +from pip._internal.basecommand import Command +from pip._internal.exceptions import InstallationError +from pip._internal.req import InstallRequirement, parse_requirements class UninstallCommand(Command): diff --git a/pip/commands/wheel.py b/src/pip/_internal/commands/wheel.py similarity index 92% rename from pip/commands/wheel.py rename to src/pip/_internal/commands/wheel.py index cc6476c27..e03983cd1 100644 --- a/pip/commands/wheel.py +++ b/src/pip/_internal/commands/wheel.py @@ -4,16 +4,16 @@ from __future__ import absolute_import import logging import os -from pip import cmdoptions -from pip.basecommand import RequirementCommand -from pip.cache import WheelCache -from pip.exceptions import CommandError, PreviousBuildDirError -from pip.operations.prepare import RequirementPreparer -from pip.req import RequirementSet -from pip.resolve import Resolver -from pip.utils import import_or_raise -from pip.utils.temp_dir import TempDirectory -from pip.wheel import WheelBuilder +from pip._internal import cmdoptions +from pip._internal.basecommand import RequirementCommand +from pip._internal.cache import WheelCache +from pip._internal.exceptions import CommandError, PreviousBuildDirError +from pip._internal.operations.prepare import RequirementPreparer +from pip._internal.req import RequirementSet +from pip._internal.resolve import Resolver +from pip._internal.utils.misc import import_or_raise +from pip._internal.utils.temp_dir import TempDirectory +from pip._internal.wheel import WheelBuilder logger = logging.getLogger(__name__) diff --git a/pip/compat.py b/src/pip/_internal/compat.py similarity index 100% rename from pip/compat.py rename to src/pip/_internal/compat.py diff --git a/pip/configuration.py b/src/pip/_internal/configuration.py similarity index 98% rename from pip/configuration.py rename to src/pip/_internal/configuration.py index 400d2a644..2b3374ae6 100644 --- a/pip/configuration.py +++ b/src/pip/_internal/configuration.py @@ -17,12 +17,12 @@ import os from pip._vendor.six import next from pip._vendor.six.moves import configparser -from pip.exceptions import ConfigurationError -from pip.locations import ( +from pip._internal.exceptions import ConfigurationError +from pip._internal.locations import ( legacy_config_file, new_config_file, running_under_virtualenv, site_config_files, venv_config_file ) -from pip.utils import ensure_dir, enum +from pip._internal.utils.misc import ensure_dir, enum logger = logging.getLogger(__name__) diff --git a/pip/download.py b/src/pip/_internal/download.py similarity index 98% rename from pip/download.py rename to src/pip/_internal/download.py index 424a8a4bf..06cfe2871 100644 --- a/pip/download.py +++ b/src/pip/_internal/download.py @@ -28,22 +28,22 @@ from pip._vendor.six.moves.urllib import request as urllib_request from pip._vendor.six.moves.urllib.parse import unquote as urllib_unquote import pip -from pip.exceptions import HashMismatch, InstallationError -from pip.locations import write_delete_marker_file -from pip.models import PyPI -from pip.utils import ( +from pip._internal.exceptions import HashMismatch, InstallationError +from pip._internal.locations import write_delete_marker_file +from pip._internal.models import PyPI +from pip._internal.utils.encoding import auto_decode +from pip._internal.utils.filesystem import check_path_owner +from pip._internal.utils.glibc import libc_ver +from pip._internal.utils.logging import indent_log +from pip._internal.utils.misc import ( ARCHIVE_EXTENSIONS, ask_path_exists, backup_dir, call_subprocess, consume, display_path, format_size, get_installed_version, rmtree, splitext, unpack_file ) -from pip.utils.encoding import auto_decode -from pip.utils.filesystem import check_path_owner -from pip.utils.glibc import libc_ver -from pip.utils.logging import indent_log -from pip.utils.setuptools_build import SETUPTOOLS_SHIM -from pip.utils.temp_dir import TempDirectory -from pip.utils.ui import DownloadProgressProvider -from pip.vcs import vcs +from pip._internal.utils.setuptools_build import SETUPTOOLS_SHIM +from pip._internal.utils.temp_dir import TempDirectory +from pip._internal.utils.ui import DownloadProgressProvider +from pip._internal.vcs import vcs try: import ssl # noqa diff --git a/pip/exceptions.py b/src/pip/_internal/exceptions.py similarity index 98% rename from pip/exceptions.py rename to src/pip/_internal/exceptions.py index 0353329f4..ad6f41253 100644 --- a/pip/exceptions.py +++ b/src/pip/_internal/exceptions.py @@ -162,7 +162,8 @@ class HashMissing(HashError): self.gotten_hash = gotten_hash def body(self): - from pip.utils.hashes import FAVORITE_HASH # Dodge circular import. + # Dodge circular import. + from pip._internal.utils.hashes import FAVORITE_HASH package = None if self.req: diff --git a/pip/index.py b/src/pip/_internal/index.py similarity index 98% rename from pip/index.py rename to src/pip/_internal/index.py index 46f97e8e3..d59c12466 100644 --- a/pip/index.py +++ b/src/pip/_internal/index.py @@ -21,22 +21,22 @@ from pip._vendor.requests.exceptions import SSLError from pip._vendor.six.moves.urllib import parse as urllib_parse from pip._vendor.six.moves.urllib import request as urllib_request -from pip.compat import ipaddress -from pip.download import HAS_TLS, is_url, path_to_url, url_to_path -from pip.exceptions import ( +from pip._internal.compat import ipaddress +from pip._internal.download import HAS_TLS, is_url, path_to_url, url_to_path +from pip._internal.exceptions import ( BestVersionAlreadyInstalled, DistributionNotFound, InvalidWheelFilename, UnsupportedWheel ) -from pip.models import PyPI -from pip.pep425tags import get_supported -from pip.utils import ( +from pip._internal.models import PyPI +from pip._internal.pep425tags import get_supported +from pip._internal.utils.deprecation import RemovedInPip11Warning +from pip._internal.utils.logging import indent_log +from pip._internal.utils.misc import ( ARCHIVE_EXTENSIONS, SUPPORTED_EXTENSIONS, cached_property, normalize_path, splitext ) -from pip.utils.deprecation import RemovedInPip11Warning -from pip.utils.logging import indent_log -from pip.utils.packaging import check_requires_python -from pip.wheel import Wheel, wheel_ext +from pip._internal.utils.packaging import check_requires_python +from pip._internal.wheel import Wheel, wheel_ext __all__ = ['FormatControl', 'fmt_ctl_handle_mutual_exclude', 'PackageFinder'] @@ -764,7 +764,7 @@ class HTMLPage(object): url = url.split('#', 1)[0] # Check for VCS schemes that do not support lookup as web pages. - from pip.vcs import VcsSupport + from pip._internal.vcs import VcsSupport for scheme in VcsSupport.schemes: if url.lower().startswith(scheme) and url[len(scheme)] in '+:': logger.debug('Cannot look at %s URL %s', scheme, link) @@ -1046,7 +1046,7 @@ class Link(object): Determines if this points to an actual artifact (e.g. a tarball) or if it points to an "abstract" thing like a path or a VCS location. """ - from pip.vcs import vcs + from pip._internal.vcs import vcs if self.scheme in vcs.all_schemes: return False diff --git a/pip/locations.py b/src/pip/_internal/locations.py similarity index 98% rename from pip/locations.py rename to src/pip/_internal/locations.py index 3b35fbf6a..26d6683b6 100644 --- a/pip/locations.py +++ b/src/pip/_internal/locations.py @@ -10,8 +10,8 @@ import sysconfig from distutils import sysconfig as distutils_sysconfig from distutils.command.install import SCHEME_KEYS, install # noqa -from pip.compat import WINDOWS, expanduser -from pip.utils import appdirs +from pip._internal.compat import WINDOWS, expanduser +from pip._internal.utils import appdirs # Application Directories USER_CACHE_DIR = appdirs.user_cache_dir("pip") diff --git a/src/pip/_internal/models/__init__.py b/src/pip/_internal/models/__init__.py new file mode 100644 index 000000000..505d92c1b --- /dev/null +++ b/src/pip/_internal/models/__init__.py @@ -0,0 +1,4 @@ +from pip._internal.models.index import Index, PyPI + + +__all__ = ["Index", "PyPI"] diff --git a/pip/models/index.py b/src/pip/_internal/models/index.py similarity index 100% rename from pip/models/index.py rename to src/pip/_internal/models/index.py diff --git a/pip/_vendor/html5lib/filters/__init__.py b/src/pip/_internal/operations/__init__.py similarity index 100% rename from pip/_vendor/html5lib/filters/__init__.py rename to src/pip/_internal/operations/__init__.py diff --git a/pip/operations/check.py b/src/pip/_internal/operations/check.py similarity index 100% rename from pip/operations/check.py rename to src/pip/_internal/operations/check.py diff --git a/pip/operations/freeze.py b/src/pip/_internal/operations/freeze.py similarity index 95% rename from pip/operations/freeze.py rename to src/pip/_internal/operations/freeze.py index 6772022fd..09b03f0bd 100644 --- a/pip/operations/freeze.py +++ b/src/pip/_internal/operations/freeze.py @@ -9,11 +9,13 @@ from pip._vendor import pkg_resources from pip._vendor.packaging.utils import canonicalize_name from pip._vendor.pkg_resources import RequirementParseError -from pip.exceptions import InstallationError -from pip.req import InstallRequirement -from pip.req.req_file import COMMENT_RE -from pip.utils import dist_is_editable, get_installed_distributions -from pip.utils.deprecation import RemovedInPip11Warning +from pip._internal.exceptions import InstallationError +from pip._internal.req import InstallRequirement +from pip._internal.req.req_file import COMMENT_RE +from pip._internal.utils.deprecation import RemovedInPip11Warning +from pip._internal.utils.misc import ( + dist_is_editable, get_installed_distributions +) logger = logging.getLogger(__name__) @@ -150,7 +152,7 @@ class FrozenRequirement(object): def from_dist(cls, dist, dependency_links): location = os.path.normcase(os.path.abspath(dist.location)) comments = [] - from pip.vcs import vcs, get_src_requirement + from pip._internal.vcs import vcs, get_src_requirement if dist_is_editable(dist) and vcs.get_backend_name(location): editable = True try: diff --git a/pip/operations/prepare.py b/src/pip/_internal/operations/prepare.py similarity index 97% rename from pip/operations/prepare.py rename to src/pip/_internal/operations/prepare.py index 8212b191b..05e9eae46 100644 --- a/pip/operations/prepare.py +++ b/src/pip/_internal/operations/prepare.py @@ -6,18 +6,18 @@ import os from pip._vendor import pkg_resources, requests -from pip.compat import expanduser -from pip.download import ( +from pip._internal.compat import expanduser +from pip._internal.download import ( is_dir_url, is_file_url, is_vcs_url, unpack_url, url_to_path ) -from pip.exceptions import ( +from pip._internal.exceptions import ( DirectoryUrlHashUnsupported, HashUnpinned, InstallationError, PreviousBuildDirError, VcsHashUnsupported ) -from pip.utils import display_path, normalize_path -from pip.utils.hashes import MissingHashes -from pip.utils.logging import indent_log -from pip.vcs import vcs +from pip._internal.utils.hashes import MissingHashes +from pip._internal.utils.logging import indent_log +from pip._internal.utils.misc import display_path, normalize_path +from pip._internal.vcs import vcs logger = logging.getLogger(__name__) diff --git a/pip/pep425tags.py b/src/pip/_internal/pep425tags.py similarity index 98% rename from pip/pep425tags.py rename to src/pip/_internal/pep425tags.py index e33b6ce0e..0b5c7832d 100644 --- a/pip/pep425tags.py +++ b/src/pip/_internal/pep425tags.py @@ -10,7 +10,7 @@ import sysconfig import warnings from collections import OrderedDict -import pip.utils.glibc +import pip._internal.utils.glibc logger = logging.getLogger(__name__) @@ -154,7 +154,7 @@ def is_manylinux1_compatible(): pass # Check glibc version. CentOS 5 uses glibc 2.5. - return pip.utils.glibc.have_compatible_glibc(2, 5) + return pip._internal.utils.glibc.have_compatible_glibc(2, 5) def get_darwin_arches(major, minor, machine): @@ -314,7 +314,4 @@ def get_supported(versions=None, noarch=False, platform=None, return supported -supported_tags = get_supported() -supported_tags_noarch = get_supported(noarch=True) - implementation_tag = get_impl_tag() diff --git a/pip/req/__init__.py b/src/pip/_internal/req/__init__.py similarity index 100% rename from pip/req/__init__.py rename to src/pip/_internal/req/__init__.py diff --git a/pip/req/req_file.py b/src/pip/_internal/req/req_file.py similarity index 97% rename from pip/req/req_file.py rename to src/pip/_internal/req/req_file.py index cf8f62d9b..44cccf0cc 100644 --- a/pip/req/req_file.py +++ b/src/pip/_internal/req/req_file.py @@ -13,10 +13,10 @@ import sys from pip._vendor.six.moves import filterfalse from pip._vendor.six.moves.urllib import parse as urllib_parse -from pip import cmdoptions -from pip.download import get_file_content -from pip.exceptions import RequirementsFileParseError -from pip.req.req_install import InstallRequirement +from pip._internal import cmdoptions +from pip._internal.download import get_file_content +from pip._internal.exceptions import RequirementsFileParseError +from pip._internal.req.req_install import InstallRequirement __all__ = ['parse_requirements'] diff --git a/pip/req/req_install.py b/src/pip/_internal/req/req_install.py similarity index 97% rename from pip/req/req_install.py rename to src/pip/_internal/req/req_install.py index 4aacb34b4..c53c8255c 100644 --- a/pip/req/req_install.py +++ b/src/pip/_internal/req/req_install.py @@ -21,25 +21,29 @@ from pip._vendor.packaging.version import parse as parse_version from pip._vendor.packaging.version import Version from pip._vendor.pkg_resources import RequirementParseError, parse_requirements -import pip.wheel -from pip.compat import native_str -from pip.download import is_archive_file, is_url, path_to_url, url_to_path -from pip.exceptions import InstallationError, UninstallationError -from pip.locations import PIP_DELETE_MARKER_FILENAME, running_under_virtualenv -from pip.req.req_uninstall import UninstallPathSet -from pip.utils import ( +from pip._internal import wheel +from pip._internal.compat import native_str +from pip._internal.download import ( + is_archive_file, is_url, path_to_url, url_to_path +) +from pip._internal.exceptions import InstallationError, UninstallationError +from pip._internal.locations import ( + PIP_DELETE_MARKER_FILENAME, running_under_virtualenv +) +from pip._internal.req.req_uninstall import UninstallPathSet +from pip._internal.utils.deprecation import RemovedInPip11Warning +from pip._internal.utils.hashes import Hashes +from pip._internal.utils.logging import indent_log +from pip._internal.utils.misc import ( _make_build_dir, ask_path_exists, backup_dir, call_subprocess, display_path, dist_in_site_packages, dist_in_usersite, ensure_dir, get_installed_version, is_installable_dir, read_text_file, rmtree ) -from pip.utils.deprecation import RemovedInPip11Warning -from pip.utils.hashes import Hashes -from pip.utils.logging import indent_log -from pip.utils.setuptools_build import SETUPTOOLS_SHIM -from pip.utils.temp_dir import TempDirectory -from pip.utils.ui import open_spinner -from pip.vcs import vcs -from pip.wheel import Wheel, move_wheel_files +from pip._internal.utils.setuptools_build import SETUPTOOLS_SHIM +from pip._internal.utils.temp_dir import TempDirectory +from pip._internal.utils.ui import open_spinner +from pip._internal.vcs import vcs +from pip._internal.wheel import Wheel, move_wheel_files logger = logging.getLogger(__name__) @@ -78,7 +82,7 @@ class InstallRequirement(object): if link is not None: self.link = self.original_link = link else: - from pip.index import Link + from pip._internal.index import Link self.link = self.original_link = req and req.url and Link(req.url) if extras: @@ -123,7 +127,7 @@ class InstallRequirement(object): @classmethod def from_editable(cls, editable_req, comes_from=None, isolated=False, options=None, wheel_cache=None, constraint=False): - from pip.index import Link + from pip._internal.index import Link name, url, extras_override = parse_editable(editable_req) if url.startswith('file:'): @@ -169,7 +173,7 @@ class InstallRequirement(object): """Creates an InstallRequirement from a name, which might be a requirement, directory containing 'setup.py', filename, or URL. """ - from pip.index import Link + from pip._internal.index import Link if is_url(name): marker_sep = '; ' @@ -728,8 +732,8 @@ class InstallRequirement(object): install_options, global_options, prefix=prefix) return if self.is_wheel: - version = pip.wheel.wheel_version(self.source_dir) - pip.wheel.check_compatibility(version, self.name) + version = wheel.wheel_version(self.source_dir) + wheel.check_compatibility(version, self.name) self.move_wheel_files(self.source_dir, root=root, prefix=prefix) self.install_succeeded = True @@ -1004,7 +1008,7 @@ def parse_editable(editable_req): .[some_extra] """ - from pip.index import Link + from pip._internal.index import Link url = editable_req diff --git a/pip/req/req_set.py b/src/pip/_internal/req/req_set.py similarity index 98% rename from pip/req/req_set.py rename to src/pip/_internal/req/req_set.py index 55d56eef5..3c8e23510 100644 --- a/pip/req/req_set.py +++ b/src/pip/_internal/req/req_set.py @@ -3,9 +3,9 @@ from __future__ import absolute_import import logging from collections import OrderedDict, defaultdict -from pip.exceptions import InstallationError -from pip.utils.logging import indent_log -from pip.wheel import Wheel +from pip._internal.exceptions import InstallationError +from pip._internal.utils.logging import indent_log +from pip._internal.wheel import Wheel logger = logging.getLogger(__name__) diff --git a/pip/req/req_uninstall.py b/src/pip/_internal/req/req_uninstall.py similarity index 97% rename from pip/req/req_uninstall.py rename to src/pip/_internal/req/req_uninstall.py index ca161e716..e594ec0e0 100644 --- a/pip/req/req_uninstall.py +++ b/src/pip/_internal/req/req_uninstall.py @@ -9,15 +9,15 @@ import sysconfig from pip._vendor import pkg_resources -from pip.compat import WINDOWS, cache_from_source, uses_pycache -from pip.exceptions import UninstallationError -from pip.locations import bin_py, bin_user -from pip.utils import ( +from pip._internal.compat import WINDOWS, cache_from_source, uses_pycache +from pip._internal.exceptions import UninstallationError +from pip._internal.locations import bin_py, bin_user +from pip._internal.utils.logging import indent_log +from pip._internal.utils.misc import ( FakeFile, ask, dist_in_usersite, dist_is_local, egg_link_path, is_local, normalize_path, renames ) -from pip.utils.logging import indent_log -from pip.utils.temp_dir import TempDirectory +from pip._internal.utils.temp_dir import TempDirectory logger = logging.getLogger(__name__) diff --git a/pip/resolve.py b/src/pip/_internal/resolve.py similarity index 96% rename from pip/resolve.py rename to src/pip/_internal/resolve.py index f794a8511..a463d5e03 100644 --- a/pip/resolve.py +++ b/src/pip/_internal/resolve.py @@ -13,14 +13,14 @@ for sub-dependencies import logging from itertools import chain -from pip.exceptions import ( - BestVersionAlreadyInstalled, - DistributionNotFound, HashError, HashErrors, UnsupportedPythonVersion +from pip._internal.exceptions import ( + BestVersionAlreadyInstalled, DistributionNotFound, HashError, HashErrors, + UnsupportedPythonVersion ) -from pip.req.req_install import InstallRequirement -from pip.utils import dist_in_usersite, ensure_dir -from pip.utils.logging import indent_log -from pip.utils.packaging import check_dist_requires_python +from pip._internal.req.req_install import InstallRequirement +from pip._internal.utils.logging import indent_log +from pip._internal.utils.misc import dist_in_usersite, ensure_dir +from pip._internal.utils.packaging import check_dist_requires_python logger = logging.getLogger(__name__) diff --git a/pip/status_codes.py b/src/pip/_internal/status_codes.py similarity index 100% rename from pip/status_codes.py rename to src/pip/_internal/status_codes.py diff --git a/pip/_vendor/requests/packages/urllib3/contrib/__init__.py b/src/pip/_internal/utils/__init__.py similarity index 100% rename from pip/_vendor/requests/packages/urllib3/contrib/__init__.py rename to src/pip/_internal/utils/__init__.py diff --git a/pip/utils/appdirs.py b/src/pip/_internal/utils/appdirs.py similarity index 99% rename from pip/utils/appdirs.py rename to src/pip/_internal/utils/appdirs.py index 4be2d5574..28c5d4b3c 100644 --- a/pip/utils/appdirs.py +++ b/src/pip/_internal/utils/appdirs.py @@ -9,7 +9,7 @@ import sys from pip._vendor.six import PY2, text_type -from pip.compat import WINDOWS, expanduser +from pip._internal.compat import WINDOWS, expanduser def user_cache_dir(appname): diff --git a/pip/utils/deprecation.py b/src/pip/_internal/utils/deprecation.py similarity index 96% rename from pip/utils/deprecation.py rename to src/pip/_internal/utils/deprecation.py index f50419ae8..0f17b942f 100644 --- a/pip/utils/deprecation.py +++ b/src/pip/_internal/utils/deprecation.py @@ -39,7 +39,7 @@ def _showwarning(message, category, filename, lineno, file=None, line=None): if issubclass(category, PipDeprecationWarning): # We use a specially named logger which will handle all of the # deprecation messages for pip. - logger = logging.getLogger("pip.deprecations") + logger = logging.getLogger("pip._internal.deprecations") # This is purposely using the % formatter here instead of letting # the logging module handle the interpolation. This is because we diff --git a/pip/utils/encoding.py b/src/pip/_internal/utils/encoding.py similarity index 100% rename from pip/utils/encoding.py rename to src/pip/_internal/utils/encoding.py diff --git a/pip/utils/filesystem.py b/src/pip/_internal/utils/filesystem.py similarity index 94% rename from pip/utils/filesystem.py rename to src/pip/_internal/utils/filesystem.py index 25ad51660..ee455012e 100644 --- a/pip/utils/filesystem.py +++ b/src/pip/_internal/utils/filesystem.py @@ -1,7 +1,7 @@ import os import os.path -from pip.compat import get_path_uid +from pip._internal.compat import get_path_uid def check_path_owner(path): diff --git a/pip/utils/glibc.py b/src/pip/_internal/utils/glibc.py similarity index 100% rename from pip/utils/glibc.py rename to src/pip/_internal/utils/glibc.py diff --git a/pip/utils/hashes.py b/src/pip/_internal/utils/hashes.py similarity index 95% rename from pip/utils/hashes.py rename to src/pip/_internal/utils/hashes.py index 9a3e37b36..3a4cd3e62 100644 --- a/pip/utils/hashes.py +++ b/src/pip/_internal/utils/hashes.py @@ -4,8 +4,10 @@ import hashlib from pip._vendor.six import iteritems, iterkeys, itervalues -from pip.exceptions import HashMismatch, HashMissing, InstallationError -from pip.utils import read_chunks +from pip._internal.exceptions import ( + HashMismatch, HashMissing, InstallationError +) +from pip._internal.utils.misc import read_chunks # The recommended hash algo of the moment. Change this whenever the state of # the art changes; it won't hurt backward compatibility. diff --git a/pip/utils/logging.py b/src/pip/_internal/utils/logging.py similarity index 97% rename from pip/utils/logging.py rename to src/pip/_internal/utils/logging.py index b2bc022ba..9a3ed7115 100644 --- a/pip/utils/logging.py +++ b/src/pip/_internal/utils/logging.py @@ -5,8 +5,8 @@ import logging import logging.handlers import os -from pip.compat import WINDOWS -from pip.utils import ensure_dir +from pip._internal.compat import WINDOWS +from pip._internal.utils.misc import ensure_dir try: import threading diff --git a/pip/utils/__init__.py b/src/pip/_internal/utils/misc.py similarity index 98% rename from pip/utils/__init__.py rename to src/pip/_internal/utils/misc.py index e0091ebec..073d38790 100644 --- a/pip/utils/__init__.py +++ b/src/pip/_internal/utils/misc.py @@ -1,6 +1,5 @@ from __future__ import absolute_import -from collections import deque import contextlib import errno import io @@ -8,26 +7,28 @@ import locale # we have a submodule named 'logging' which would shadow this if we used the # regular name: import logging as std_logging -import re import os import posixpath +import re import shutil import stat import subprocess import sys import tarfile import zipfile +from collections import deque -from pip.exceptions import InstallationError -from pip.compat import console_to_str, expanduser, stdlib_pkgs -from pip.locations import ( - site_packages, user_site, running_under_virtualenv, virtualenv_no_global, - write_delete_marker_file, -) from pip._vendor import pkg_resources -from pip._vendor.six.moves import input -from pip._vendor.six import PY2 from pip._vendor.retrying import retry +from pip._vendor.six import PY2 +from pip._vendor.six.moves import input + +from pip._internal.compat import console_to_str, expanduser, stdlib_pkgs +from pip._internal.exceptions import InstallationError +from pip._internal.locations import ( + running_under_virtualenv, site_packages, user_site, virtualenv_no_global, + write_delete_marker_file +) if PY2: from io import BytesIO as StringIO @@ -606,7 +607,7 @@ def unpack_file(filename, location, content_type, link): elif (content_type and content_type.startswith('text/html') and is_svn_page(file_contents(filename))): # We don't really care about this - from pip.vcs.subversion import Subversion + from pip._internal.vcs.subversion import Subversion Subversion('svn+' + link.url).unpack(location) else: # FIXME: handle? diff --git a/pip/utils/outdated.py b/src/pip/_internal/utils/outdated.py similarity index 94% rename from pip/utils/outdated.py rename to src/pip/_internal/utils/outdated.py index 517d3bc9a..f8f64669d 100644 --- a/pip/utils/outdated.py +++ b/src/pip/_internal/utils/outdated.py @@ -9,11 +9,11 @@ import sys from pip._vendor import lockfile from pip._vendor.packaging import version as packaging_version -from pip.compat import WINDOWS -from pip.index import PackageFinder -from pip.locations import USER_CACHE_DIR, running_under_virtualenv -from pip.utils import ensure_dir, get_installed_version -from pip.utils.filesystem import check_path_owner +from pip._internal.compat import WINDOWS +from pip._internal.index import PackageFinder +from pip._internal.locations import USER_CACHE_DIR, running_under_virtualenv +from pip._internal.utils.filesystem import check_path_owner +from pip._internal.utils.misc import ensure_dir, get_installed_version SELFCHECK_DATE_FMT = "%Y-%m-%dT%H:%M:%SZ" diff --git a/pip/utils/packaging.py b/src/pip/_internal/utils/packaging.py similarity index 98% rename from pip/utils/packaging.py rename to src/pip/_internal/utils/packaging.py index e789d45e6..1df474a80 100644 --- a/pip/utils/packaging.py +++ b/src/pip/_internal/utils/packaging.py @@ -7,7 +7,7 @@ from email.parser import FeedParser from pip._vendor import pkg_resources from pip._vendor.packaging import specifiers, version -from pip import exceptions +from pip._internal import exceptions logger = logging.getLogger(__name__) diff --git a/pip/utils/setuptools_build.py b/src/pip/_internal/utils/setuptools_build.py similarity index 100% rename from pip/utils/setuptools_build.py rename to src/pip/_internal/utils/setuptools_build.py diff --git a/pip/utils/temp_dir.py b/src/pip/_internal/utils/temp_dir.py similarity index 98% rename from pip/utils/temp_dir.py rename to src/pip/_internal/utils/temp_dir.py index d3307d516..edc506bfc 100644 --- a/pip/utils/temp_dir.py +++ b/src/pip/_internal/utils/temp_dir.py @@ -4,7 +4,7 @@ import logging import os.path import tempfile -from pip.utils import rmtree +from pip._internal.utils.misc import rmtree logger = logging.getLogger(__name__) diff --git a/pip/utils/ui.py b/src/pip/_internal/utils/ui.py similarity index 98% rename from pip/utils/ui.py rename to src/pip/_internal/utils/ui.py index 10f57f0e2..edc3bf9e8 100644 --- a/pip/utils/ui.py +++ b/src/pip/_internal/utils/ui.py @@ -15,9 +15,9 @@ from pip._vendor.progress.bar import ( from pip._vendor.progress.helpers import HIDE_CURSOR, SHOW_CURSOR, WritelnMixin from pip._vendor.progress.spinner import Spinner -from pip.compat import WINDOWS -from pip.utils import format_size -from pip.utils.logging import get_indentation +from pip._internal.compat import WINDOWS +from pip._internal.utils.logging import get_indentation +from pip._internal.utils.misc import format_size try: from pip._vendor import colorama diff --git a/pip/vcs/__init__.py b/src/pip/_internal/vcs/__init__.py similarity index 98% rename from pip/vcs/__init__.py rename to src/pip/_internal/vcs/__init__.py index 204155a85..23950ed2e 100644 --- a/pip/vcs/__init__.py +++ b/src/pip/_internal/vcs/__init__.py @@ -9,9 +9,10 @@ import sys from pip._vendor.six.moves.urllib import parse as urllib_parse -from pip.exceptions import BadCommand -from pip.utils import (display_path, backup_dir, call_subprocess, - rmtree, ask_path_exists) +from pip._internal.exceptions import BadCommand +from pip._internal.utils.misc import ( + display_path, backup_dir, call_subprocess, rmtree, ask_path_exists, +) __all__ = ['vcs', 'get_src_requirement'] diff --git a/pip/vcs/bazaar.py b/src/pip/_internal/vcs/bazaar.py similarity index 94% rename from pip/vcs/bazaar.py rename to src/pip/_internal/vcs/bazaar.py index 8a53d7415..916496956 100644 --- a/pip/vcs/bazaar.py +++ b/src/pip/_internal/vcs/bazaar.py @@ -5,10 +5,10 @@ import os from pip._vendor.six.moves.urllib import parse as urllib_parse -from pip.download import path_to_url -from pip.utils import display_path, rmtree -from pip.utils.temp_dir import TempDirectory -from pip.vcs import VersionControl, vcs +from pip._internal.download import path_to_url +from pip._internal.utils.misc import display_path, rmtree +from pip._internal.utils.temp_dir import TempDirectory +from pip._internal.vcs import VersionControl, vcs logger = logging.getLogger(__name__) diff --git a/pip/vcs/git.py b/src/pip/_internal/vcs/git.py similarity index 97% rename from pip/vcs/git.py rename to src/pip/_internal/vcs/git.py index c1d02ad76..6262f2729 100644 --- a/pip/vcs/git.py +++ b/src/pip/_internal/vcs/git.py @@ -7,11 +7,11 @@ from pip._vendor.packaging.version import parse as parse_version from pip._vendor.six.moves.urllib import parse as urllib_parse from pip._vendor.six.moves.urllib import request as urllib_request -from pip.compat import samefile -from pip.exceptions import BadCommand -from pip.utils import display_path -from pip.utils.temp_dir import TempDirectory -from pip.vcs import VersionControl, vcs +from pip._internal.compat import samefile +from pip._internal.exceptions import BadCommand +from pip._internal.utils.misc import display_path +from pip._internal.utils.temp_dir import TempDirectory +from pip._internal.vcs import VersionControl, vcs urlsplit = urllib_parse.urlsplit urlunsplit = urllib_parse.urlunsplit diff --git a/pip/vcs/mercurial.py b/src/pip/_internal/vcs/mercurial.py similarity index 94% rename from pip/vcs/mercurial.py rename to src/pip/_internal/vcs/mercurial.py index c9226d6a3..8304d52cd 100644 --- a/pip/vcs/mercurial.py +++ b/src/pip/_internal/vcs/mercurial.py @@ -5,10 +5,10 @@ import os from pip._vendor.six.moves import configparser -from pip.download import path_to_url -from pip.utils import display_path -from pip.utils.temp_dir import TempDirectory -from pip.vcs import VersionControl, vcs +from pip._internal.download import path_to_url +from pip._internal.utils.misc import display_path +from pip._internal.utils.temp_dir import TempDirectory +from pip._internal.vcs import VersionControl, vcs logger = logging.getLogger(__name__) diff --git a/pip/vcs/subversion.py b/src/pip/_internal/vcs/subversion.py similarity index 97% rename from pip/vcs/subversion.py rename to src/pip/_internal/vcs/subversion.py index 77b66c91e..7220a6eef 100644 --- a/pip/vcs/subversion.py +++ b/src/pip/_internal/vcs/subversion.py @@ -6,10 +6,10 @@ import re from pip._vendor.six.moves.urllib import parse as urllib_parse -from pip.index import Link -from pip.utils import display_path, rmtree -from pip.utils.logging import indent_log -from pip.vcs import VersionControl, vcs +from pip._internal.index import Link +from pip._internal.utils.logging import indent_log +from pip._internal.utils.misc import display_path, rmtree +from pip._internal.vcs import VersionControl, vcs _svn_xml_url_re = re.compile('url="([^"]+)"') _svn_rev_re = re.compile(r'committed-rev="(\d+)"') @@ -163,7 +163,7 @@ class Subversion(VersionControl): return self._get_svn_url_rev(location)[0] def _get_svn_url_rev(self, location): - from pip.exceptions import InstallationError + from pip._internal.exceptions import InstallationError entries_path = os.path.join(location, self.dirname, 'entries') if os.path.exists(entries_path): diff --git a/pip/wheel.py b/src/pip/_internal/wheel.py similarity index 96% rename from pip/wheel.py rename to src/pip/_internal/wheel.py index 3727522cd..a38e16eb9 100644 --- a/pip/wheel.py +++ b/src/pip/_internal/wheel.py @@ -23,18 +23,21 @@ from pip._vendor.distlib.scripts import ScriptMaker from pip._vendor.packaging.utils import canonicalize_name from pip._vendor.six import StringIO -import pip.index -from pip import pep425tags -from pip.download import path_to_url, unpack_url -from pip.exceptions import ( +from pip._internal import pep425tags +from pip._internal.download import path_to_url, unpack_url +from pip._internal.exceptions import ( InstallationError, InvalidWheelFilename, UnsupportedWheel ) -from pip.locations import PIP_DELETE_MARKER_FILENAME, distutils_scheme -from pip.utils import call_subprocess, captured_stdout, ensure_dir, read_chunks -from pip.utils.logging import indent_log -from pip.utils.setuptools_build import SETUPTOOLS_SHIM -from pip.utils.temp_dir import TempDirectory -from pip.utils.ui import open_spinner +from pip._internal.locations import ( + PIP_DELETE_MARKER_FILENAME, distutils_scheme +) +from pip._internal.utils.logging import indent_log +from pip._internal.utils.misc import ( + call_subprocess, captured_stdout, ensure_dir, read_chunks +) +from pip._internal.utils.setuptools_build import SETUPTOOLS_SHIM +from pip._internal.utils.temp_dir import TempDirectory +from pip._internal.utils.ui import open_spinner wheel_ext = '.whl' @@ -520,14 +523,14 @@ class Wheel(object): None is the wheel is not supported. """ if tags is None: # for mock - tags = pep425tags.supported_tags + tags = pep425tags.get_supported() indexes = [tags.index(c) for c in self.file_tags if c in tags] return min(indexes) if indexes else None def supported(self, tags=None): """Is this wheel supported on this system?""" if tags is None: # for mock - tags = pep425tags.supported_tags + tags = pep425tags.get_supported() return bool(set(tags).intersection(self.file_tags)) @@ -618,8 +621,8 @@ class WheelBuilder(object): def _install_build_reqs(self, reqs, prefix): # Local import to avoid circular import (wheel <-> req_install) - from pip.req.req_install import InstallRequirement - from pip.index import FormatControl + from pip._internal.req.req_install import InstallRequirement + from pip._internal.index import FormatControl # Ignore the --no-binary option when installing the build system, so # we don't recurse trying to build a self-hosting build system. finder = copy.copy(self.finder) @@ -727,6 +730,8 @@ class WheelBuilder(object): newly built wheel, in preparation for installation. :return: True if all the wheels built correctly. """ + from pip._internal import index + building_is_possible = self._wheel_dir or ( autobuilding and self.wheel_cache.cache_dir ) @@ -752,11 +757,11 @@ class WheelBuilder(object): if autobuilding: link = req.link base, ext = link.splitext() - if pip.index.egg_info_matches(base, None, link) is None: + if index.egg_info_matches(base, None, link) is None: # Doesn't look like a package - don't autobuild a wheel # because we'll have no way to lookup the result sanely continue - if "binary" not in pip.index.fmt_ctl_formats( + if "binary" not in index.fmt_ctl_formats( self.finder.format_control, canonicalize_name(req.name)): logger.info( @@ -813,8 +818,7 @@ class WheelBuilder(object): self.preparer.build_dir ) # Update the link for this. - req.link = pip.index.Link( - path_to_url(wheel_file)) + req.link = index.Link(path_to_url(wheel_file)) assert req.link.is_wheel # extract the wheel into the dir unpack_url( diff --git a/pip/_vendor/Makefile b/src/pip/_vendor/Makefile similarity index 100% rename from pip/_vendor/Makefile rename to src/pip/_vendor/Makefile diff --git a/pip/_vendor/README.rst b/src/pip/_vendor/README.rst similarity index 100% rename from pip/_vendor/README.rst rename to src/pip/_vendor/README.rst diff --git a/pip/_vendor/__init__.py b/src/pip/_vendor/__init__.py similarity index 100% rename from pip/_vendor/__init__.py rename to src/pip/_vendor/__init__.py diff --git a/pip/_vendor/appdirs.py b/src/pip/_vendor/appdirs.py similarity index 100% rename from pip/_vendor/appdirs.py rename to src/pip/_vendor/appdirs.py diff --git a/pip/_vendor/cachecontrol/__init__.py b/src/pip/_vendor/cachecontrol/__init__.py similarity index 100% rename from pip/_vendor/cachecontrol/__init__.py rename to src/pip/_vendor/cachecontrol/__init__.py diff --git a/pip/_vendor/cachecontrol/_cmd.py b/src/pip/_vendor/cachecontrol/_cmd.py similarity index 100% rename from pip/_vendor/cachecontrol/_cmd.py rename to src/pip/_vendor/cachecontrol/_cmd.py diff --git a/pip/_vendor/cachecontrol/adapter.py b/src/pip/_vendor/cachecontrol/adapter.py similarity index 100% rename from pip/_vendor/cachecontrol/adapter.py rename to src/pip/_vendor/cachecontrol/adapter.py diff --git a/pip/_vendor/cachecontrol/cache.py b/src/pip/_vendor/cachecontrol/cache.py similarity index 100% rename from pip/_vendor/cachecontrol/cache.py rename to src/pip/_vendor/cachecontrol/cache.py diff --git a/pip/_vendor/cachecontrol/caches/__init__.py b/src/pip/_vendor/cachecontrol/caches/__init__.py similarity index 100% rename from pip/_vendor/cachecontrol/caches/__init__.py rename to src/pip/_vendor/cachecontrol/caches/__init__.py diff --git a/pip/_vendor/cachecontrol/caches/file_cache.py b/src/pip/_vendor/cachecontrol/caches/file_cache.py similarity index 100% rename from pip/_vendor/cachecontrol/caches/file_cache.py rename to src/pip/_vendor/cachecontrol/caches/file_cache.py diff --git a/pip/_vendor/cachecontrol/caches/redis_cache.py b/src/pip/_vendor/cachecontrol/caches/redis_cache.py similarity index 100% rename from pip/_vendor/cachecontrol/caches/redis_cache.py rename to src/pip/_vendor/cachecontrol/caches/redis_cache.py diff --git a/pip/_vendor/cachecontrol/compat.py b/src/pip/_vendor/cachecontrol/compat.py similarity index 100% rename from pip/_vendor/cachecontrol/compat.py rename to src/pip/_vendor/cachecontrol/compat.py diff --git a/pip/_vendor/cachecontrol/controller.py b/src/pip/_vendor/cachecontrol/controller.py similarity index 100% rename from pip/_vendor/cachecontrol/controller.py rename to src/pip/_vendor/cachecontrol/controller.py diff --git a/pip/_vendor/cachecontrol/filewrapper.py b/src/pip/_vendor/cachecontrol/filewrapper.py similarity index 100% rename from pip/_vendor/cachecontrol/filewrapper.py rename to src/pip/_vendor/cachecontrol/filewrapper.py diff --git a/pip/_vendor/cachecontrol/heuristics.py b/src/pip/_vendor/cachecontrol/heuristics.py similarity index 100% rename from pip/_vendor/cachecontrol/heuristics.py rename to src/pip/_vendor/cachecontrol/heuristics.py diff --git a/pip/_vendor/cachecontrol/serialize.py b/src/pip/_vendor/cachecontrol/serialize.py similarity index 100% rename from pip/_vendor/cachecontrol/serialize.py rename to src/pip/_vendor/cachecontrol/serialize.py diff --git a/pip/_vendor/cachecontrol/wrapper.py b/src/pip/_vendor/cachecontrol/wrapper.py similarity index 100% rename from pip/_vendor/cachecontrol/wrapper.py rename to src/pip/_vendor/cachecontrol/wrapper.py diff --git a/pip/_vendor/colorama/__init__.py b/src/pip/_vendor/colorama/__init__.py similarity index 100% rename from pip/_vendor/colorama/__init__.py rename to src/pip/_vendor/colorama/__init__.py diff --git a/pip/_vendor/colorama/ansi.py b/src/pip/_vendor/colorama/ansi.py similarity index 100% rename from pip/_vendor/colorama/ansi.py rename to src/pip/_vendor/colorama/ansi.py diff --git a/pip/_vendor/colorama/ansitowin32.py b/src/pip/_vendor/colorama/ansitowin32.py similarity index 100% rename from pip/_vendor/colorama/ansitowin32.py rename to src/pip/_vendor/colorama/ansitowin32.py diff --git a/pip/_vendor/colorama/initialise.py b/src/pip/_vendor/colorama/initialise.py similarity index 100% rename from pip/_vendor/colorama/initialise.py rename to src/pip/_vendor/colorama/initialise.py diff --git a/pip/_vendor/colorama/win32.py b/src/pip/_vendor/colorama/win32.py similarity index 100% rename from pip/_vendor/colorama/win32.py rename to src/pip/_vendor/colorama/win32.py diff --git a/pip/_vendor/colorama/winterm.py b/src/pip/_vendor/colorama/winterm.py similarity index 100% rename from pip/_vendor/colorama/winterm.py rename to src/pip/_vendor/colorama/winterm.py diff --git a/pip/_vendor/distlib/__init__.py b/src/pip/_vendor/distlib/__init__.py similarity index 100% rename from pip/_vendor/distlib/__init__.py rename to src/pip/_vendor/distlib/__init__.py diff --git a/pip/_vendor/distlib/_backport/__init__.py b/src/pip/_vendor/distlib/_backport/__init__.py similarity index 100% rename from pip/_vendor/distlib/_backport/__init__.py rename to src/pip/_vendor/distlib/_backport/__init__.py diff --git a/pip/_vendor/distlib/_backport/misc.py b/src/pip/_vendor/distlib/_backport/misc.py similarity index 100% rename from pip/_vendor/distlib/_backport/misc.py rename to src/pip/_vendor/distlib/_backport/misc.py diff --git a/pip/_vendor/distlib/_backport/shutil.py b/src/pip/_vendor/distlib/_backport/shutil.py similarity index 100% rename from pip/_vendor/distlib/_backport/shutil.py rename to src/pip/_vendor/distlib/_backport/shutil.py diff --git a/pip/_vendor/distlib/_backport/sysconfig.cfg b/src/pip/_vendor/distlib/_backport/sysconfig.cfg similarity index 100% rename from pip/_vendor/distlib/_backport/sysconfig.cfg rename to src/pip/_vendor/distlib/_backport/sysconfig.cfg diff --git a/pip/_vendor/distlib/_backport/sysconfig.py b/src/pip/_vendor/distlib/_backport/sysconfig.py similarity index 100% rename from pip/_vendor/distlib/_backport/sysconfig.py rename to src/pip/_vendor/distlib/_backport/sysconfig.py diff --git a/pip/_vendor/distlib/_backport/tarfile.py b/src/pip/_vendor/distlib/_backport/tarfile.py similarity index 100% rename from pip/_vendor/distlib/_backport/tarfile.py rename to src/pip/_vendor/distlib/_backport/tarfile.py diff --git a/pip/_vendor/distlib/compat.py b/src/pip/_vendor/distlib/compat.py similarity index 100% rename from pip/_vendor/distlib/compat.py rename to src/pip/_vendor/distlib/compat.py diff --git a/pip/_vendor/distlib/database.py b/src/pip/_vendor/distlib/database.py similarity index 100% rename from pip/_vendor/distlib/database.py rename to src/pip/_vendor/distlib/database.py diff --git a/pip/_vendor/distlib/index.py b/src/pip/_vendor/distlib/index.py similarity index 100% rename from pip/_vendor/distlib/index.py rename to src/pip/_vendor/distlib/index.py diff --git a/pip/_vendor/distlib/locators.py b/src/pip/_vendor/distlib/locators.py similarity index 100% rename from pip/_vendor/distlib/locators.py rename to src/pip/_vendor/distlib/locators.py diff --git a/pip/_vendor/distlib/manifest.py b/src/pip/_vendor/distlib/manifest.py similarity index 100% rename from pip/_vendor/distlib/manifest.py rename to src/pip/_vendor/distlib/manifest.py diff --git a/pip/_vendor/distlib/markers.py b/src/pip/_vendor/distlib/markers.py similarity index 100% rename from pip/_vendor/distlib/markers.py rename to src/pip/_vendor/distlib/markers.py diff --git a/pip/_vendor/distlib/metadata.py b/src/pip/_vendor/distlib/metadata.py similarity index 100% rename from pip/_vendor/distlib/metadata.py rename to src/pip/_vendor/distlib/metadata.py diff --git a/pip/_vendor/distlib/resources.py b/src/pip/_vendor/distlib/resources.py similarity index 100% rename from pip/_vendor/distlib/resources.py rename to src/pip/_vendor/distlib/resources.py diff --git a/pip/_vendor/distlib/scripts.py b/src/pip/_vendor/distlib/scripts.py similarity index 100% rename from pip/_vendor/distlib/scripts.py rename to src/pip/_vendor/distlib/scripts.py diff --git a/pip/_vendor/distlib/t32.exe b/src/pip/_vendor/distlib/t32.exe similarity index 100% rename from pip/_vendor/distlib/t32.exe rename to src/pip/_vendor/distlib/t32.exe diff --git a/pip/_vendor/distlib/t64.exe b/src/pip/_vendor/distlib/t64.exe similarity index 100% rename from pip/_vendor/distlib/t64.exe rename to src/pip/_vendor/distlib/t64.exe diff --git a/pip/_vendor/distlib/util.py b/src/pip/_vendor/distlib/util.py similarity index 100% rename from pip/_vendor/distlib/util.py rename to src/pip/_vendor/distlib/util.py diff --git a/pip/_vendor/distlib/version.py b/src/pip/_vendor/distlib/version.py similarity index 100% rename from pip/_vendor/distlib/version.py rename to src/pip/_vendor/distlib/version.py diff --git a/pip/_vendor/distlib/w32.exe b/src/pip/_vendor/distlib/w32.exe similarity index 100% rename from pip/_vendor/distlib/w32.exe rename to src/pip/_vendor/distlib/w32.exe diff --git a/pip/_vendor/distlib/w64.exe b/src/pip/_vendor/distlib/w64.exe similarity index 100% rename from pip/_vendor/distlib/w64.exe rename to src/pip/_vendor/distlib/w64.exe diff --git a/pip/_vendor/distlib/wheel.py b/src/pip/_vendor/distlib/wheel.py similarity index 100% rename from pip/_vendor/distlib/wheel.py rename to src/pip/_vendor/distlib/wheel.py diff --git a/pip/_vendor/distro.py b/src/pip/_vendor/distro.py similarity index 100% rename from pip/_vendor/distro.py rename to src/pip/_vendor/distro.py diff --git a/pip/_vendor/html5lib/__init__.py b/src/pip/_vendor/html5lib/__init__.py similarity index 100% rename from pip/_vendor/html5lib/__init__.py rename to src/pip/_vendor/html5lib/__init__.py diff --git a/pip/_vendor/html5lib/_ihatexml.py b/src/pip/_vendor/html5lib/_ihatexml.py similarity index 100% rename from pip/_vendor/html5lib/_ihatexml.py rename to src/pip/_vendor/html5lib/_ihatexml.py diff --git a/pip/_vendor/html5lib/_inputstream.py b/src/pip/_vendor/html5lib/_inputstream.py similarity index 100% rename from pip/_vendor/html5lib/_inputstream.py rename to src/pip/_vendor/html5lib/_inputstream.py diff --git a/pip/_vendor/html5lib/_tokenizer.py b/src/pip/_vendor/html5lib/_tokenizer.py similarity index 100% rename from pip/_vendor/html5lib/_tokenizer.py rename to src/pip/_vendor/html5lib/_tokenizer.py diff --git a/pip/_vendor/html5lib/_trie/__init__.py b/src/pip/_vendor/html5lib/_trie/__init__.py similarity index 100% rename from pip/_vendor/html5lib/_trie/__init__.py rename to src/pip/_vendor/html5lib/_trie/__init__.py diff --git a/pip/_vendor/html5lib/_trie/_base.py b/src/pip/_vendor/html5lib/_trie/_base.py similarity index 100% rename from pip/_vendor/html5lib/_trie/_base.py rename to src/pip/_vendor/html5lib/_trie/_base.py diff --git a/pip/_vendor/html5lib/_trie/datrie.py b/src/pip/_vendor/html5lib/_trie/datrie.py similarity index 100% rename from pip/_vendor/html5lib/_trie/datrie.py rename to src/pip/_vendor/html5lib/_trie/datrie.py diff --git a/pip/_vendor/html5lib/_trie/py.py b/src/pip/_vendor/html5lib/_trie/py.py similarity index 100% rename from pip/_vendor/html5lib/_trie/py.py rename to src/pip/_vendor/html5lib/_trie/py.py diff --git a/pip/_vendor/html5lib/_utils.py b/src/pip/_vendor/html5lib/_utils.py similarity index 100% rename from pip/_vendor/html5lib/_utils.py rename to src/pip/_vendor/html5lib/_utils.py diff --git a/pip/_vendor/html5lib/constants.py b/src/pip/_vendor/html5lib/constants.py similarity index 100% rename from pip/_vendor/html5lib/constants.py rename to src/pip/_vendor/html5lib/constants.py diff --git a/pip/_vendor/requests/packages/urllib3/contrib/_securetransport/__init__.py b/src/pip/_vendor/html5lib/filters/__init__.py similarity index 100% rename from pip/_vendor/requests/packages/urllib3/contrib/_securetransport/__init__.py rename to src/pip/_vendor/html5lib/filters/__init__.py diff --git a/pip/_vendor/html5lib/filters/alphabeticalattributes.py b/src/pip/_vendor/html5lib/filters/alphabeticalattributes.py similarity index 100% rename from pip/_vendor/html5lib/filters/alphabeticalattributes.py rename to src/pip/_vendor/html5lib/filters/alphabeticalattributes.py diff --git a/pip/_vendor/html5lib/filters/base.py b/src/pip/_vendor/html5lib/filters/base.py similarity index 100% rename from pip/_vendor/html5lib/filters/base.py rename to src/pip/_vendor/html5lib/filters/base.py diff --git a/pip/_vendor/html5lib/filters/inject_meta_charset.py b/src/pip/_vendor/html5lib/filters/inject_meta_charset.py similarity index 100% rename from pip/_vendor/html5lib/filters/inject_meta_charset.py rename to src/pip/_vendor/html5lib/filters/inject_meta_charset.py diff --git a/pip/_vendor/html5lib/filters/lint.py b/src/pip/_vendor/html5lib/filters/lint.py similarity index 100% rename from pip/_vendor/html5lib/filters/lint.py rename to src/pip/_vendor/html5lib/filters/lint.py diff --git a/pip/_vendor/html5lib/filters/optionaltags.py b/src/pip/_vendor/html5lib/filters/optionaltags.py similarity index 100% rename from pip/_vendor/html5lib/filters/optionaltags.py rename to src/pip/_vendor/html5lib/filters/optionaltags.py diff --git a/pip/_vendor/html5lib/filters/sanitizer.py b/src/pip/_vendor/html5lib/filters/sanitizer.py similarity index 100% rename from pip/_vendor/html5lib/filters/sanitizer.py rename to src/pip/_vendor/html5lib/filters/sanitizer.py diff --git a/pip/_vendor/html5lib/filters/whitespace.py b/src/pip/_vendor/html5lib/filters/whitespace.py similarity index 100% rename from pip/_vendor/html5lib/filters/whitespace.py rename to src/pip/_vendor/html5lib/filters/whitespace.py diff --git a/pip/_vendor/html5lib/html5parser.py b/src/pip/_vendor/html5lib/html5parser.py similarity index 100% rename from pip/_vendor/html5lib/html5parser.py rename to src/pip/_vendor/html5lib/html5parser.py diff --git a/pip/_vendor/html5lib/serializer.py b/src/pip/_vendor/html5lib/serializer.py similarity index 100% rename from pip/_vendor/html5lib/serializer.py rename to src/pip/_vendor/html5lib/serializer.py diff --git a/pip/_vendor/html5lib/treeadapters/__init__.py b/src/pip/_vendor/html5lib/treeadapters/__init__.py similarity index 100% rename from pip/_vendor/html5lib/treeadapters/__init__.py rename to src/pip/_vendor/html5lib/treeadapters/__init__.py diff --git a/pip/_vendor/html5lib/treeadapters/genshi.py b/src/pip/_vendor/html5lib/treeadapters/genshi.py similarity index 100% rename from pip/_vendor/html5lib/treeadapters/genshi.py rename to src/pip/_vendor/html5lib/treeadapters/genshi.py diff --git a/pip/_vendor/html5lib/treeadapters/sax.py b/src/pip/_vendor/html5lib/treeadapters/sax.py similarity index 100% rename from pip/_vendor/html5lib/treeadapters/sax.py rename to src/pip/_vendor/html5lib/treeadapters/sax.py diff --git a/pip/_vendor/html5lib/treebuilders/__init__.py b/src/pip/_vendor/html5lib/treebuilders/__init__.py similarity index 100% rename from pip/_vendor/html5lib/treebuilders/__init__.py rename to src/pip/_vendor/html5lib/treebuilders/__init__.py diff --git a/pip/_vendor/html5lib/treebuilders/base.py b/src/pip/_vendor/html5lib/treebuilders/base.py similarity index 100% rename from pip/_vendor/html5lib/treebuilders/base.py rename to src/pip/_vendor/html5lib/treebuilders/base.py diff --git a/pip/_vendor/html5lib/treebuilders/dom.py b/src/pip/_vendor/html5lib/treebuilders/dom.py similarity index 100% rename from pip/_vendor/html5lib/treebuilders/dom.py rename to src/pip/_vendor/html5lib/treebuilders/dom.py diff --git a/pip/_vendor/html5lib/treebuilders/etree.py b/src/pip/_vendor/html5lib/treebuilders/etree.py similarity index 100% rename from pip/_vendor/html5lib/treebuilders/etree.py rename to src/pip/_vendor/html5lib/treebuilders/etree.py diff --git a/pip/_vendor/html5lib/treebuilders/etree_lxml.py b/src/pip/_vendor/html5lib/treebuilders/etree_lxml.py similarity index 100% rename from pip/_vendor/html5lib/treebuilders/etree_lxml.py rename to src/pip/_vendor/html5lib/treebuilders/etree_lxml.py diff --git a/pip/_vendor/html5lib/treewalkers/__init__.py b/src/pip/_vendor/html5lib/treewalkers/__init__.py similarity index 100% rename from pip/_vendor/html5lib/treewalkers/__init__.py rename to src/pip/_vendor/html5lib/treewalkers/__init__.py diff --git a/pip/_vendor/html5lib/treewalkers/base.py b/src/pip/_vendor/html5lib/treewalkers/base.py similarity index 100% rename from pip/_vendor/html5lib/treewalkers/base.py rename to src/pip/_vendor/html5lib/treewalkers/base.py diff --git a/pip/_vendor/html5lib/treewalkers/dom.py b/src/pip/_vendor/html5lib/treewalkers/dom.py similarity index 100% rename from pip/_vendor/html5lib/treewalkers/dom.py rename to src/pip/_vendor/html5lib/treewalkers/dom.py diff --git a/pip/_vendor/html5lib/treewalkers/etree.py b/src/pip/_vendor/html5lib/treewalkers/etree.py similarity index 100% rename from pip/_vendor/html5lib/treewalkers/etree.py rename to src/pip/_vendor/html5lib/treewalkers/etree.py diff --git a/pip/_vendor/html5lib/treewalkers/etree_lxml.py b/src/pip/_vendor/html5lib/treewalkers/etree_lxml.py similarity index 100% rename from pip/_vendor/html5lib/treewalkers/etree_lxml.py rename to src/pip/_vendor/html5lib/treewalkers/etree_lxml.py diff --git a/pip/_vendor/html5lib/treewalkers/genshi.py b/src/pip/_vendor/html5lib/treewalkers/genshi.py similarity index 100% rename from pip/_vendor/html5lib/treewalkers/genshi.py rename to src/pip/_vendor/html5lib/treewalkers/genshi.py diff --git a/pip/_vendor/ipaddress.py b/src/pip/_vendor/ipaddress.py similarity index 100% rename from pip/_vendor/ipaddress.py rename to src/pip/_vendor/ipaddress.py diff --git a/pip/_vendor/lockfile/__init__.py b/src/pip/_vendor/lockfile/__init__.py similarity index 100% rename from pip/_vendor/lockfile/__init__.py rename to src/pip/_vendor/lockfile/__init__.py diff --git a/pip/_vendor/lockfile/linklockfile.py b/src/pip/_vendor/lockfile/linklockfile.py similarity index 100% rename from pip/_vendor/lockfile/linklockfile.py rename to src/pip/_vendor/lockfile/linklockfile.py diff --git a/pip/_vendor/lockfile/mkdirlockfile.py b/src/pip/_vendor/lockfile/mkdirlockfile.py similarity index 100% rename from pip/_vendor/lockfile/mkdirlockfile.py rename to src/pip/_vendor/lockfile/mkdirlockfile.py diff --git a/pip/_vendor/lockfile/pidlockfile.py b/src/pip/_vendor/lockfile/pidlockfile.py similarity index 100% rename from pip/_vendor/lockfile/pidlockfile.py rename to src/pip/_vendor/lockfile/pidlockfile.py diff --git a/pip/_vendor/lockfile/sqlitelockfile.py b/src/pip/_vendor/lockfile/sqlitelockfile.py similarity index 100% rename from pip/_vendor/lockfile/sqlitelockfile.py rename to src/pip/_vendor/lockfile/sqlitelockfile.py diff --git a/pip/_vendor/lockfile/symlinklockfile.py b/src/pip/_vendor/lockfile/symlinklockfile.py similarity index 100% rename from pip/_vendor/lockfile/symlinklockfile.py rename to src/pip/_vendor/lockfile/symlinklockfile.py diff --git a/pip/_vendor/msgpack/__init__.py b/src/pip/_vendor/msgpack/__init__.py similarity index 100% rename from pip/_vendor/msgpack/__init__.py rename to src/pip/_vendor/msgpack/__init__.py diff --git a/pip/_vendor/msgpack/_version.py b/src/pip/_vendor/msgpack/_version.py similarity index 100% rename from pip/_vendor/msgpack/_version.py rename to src/pip/_vendor/msgpack/_version.py diff --git a/pip/_vendor/msgpack/exceptions.py b/src/pip/_vendor/msgpack/exceptions.py similarity index 100% rename from pip/_vendor/msgpack/exceptions.py rename to src/pip/_vendor/msgpack/exceptions.py diff --git a/pip/_vendor/msgpack/fallback.py b/src/pip/_vendor/msgpack/fallback.py similarity index 100% rename from pip/_vendor/msgpack/fallback.py rename to src/pip/_vendor/msgpack/fallback.py diff --git a/pip/_vendor/packaging/__about__.py b/src/pip/_vendor/packaging/__about__.py similarity index 100% rename from pip/_vendor/packaging/__about__.py rename to src/pip/_vendor/packaging/__about__.py diff --git a/pip/_vendor/packaging/__init__.py b/src/pip/_vendor/packaging/__init__.py similarity index 100% rename from pip/_vendor/packaging/__init__.py rename to src/pip/_vendor/packaging/__init__.py diff --git a/pip/_vendor/packaging/_compat.py b/src/pip/_vendor/packaging/_compat.py similarity index 100% rename from pip/_vendor/packaging/_compat.py rename to src/pip/_vendor/packaging/_compat.py diff --git a/pip/_vendor/packaging/_structures.py b/src/pip/_vendor/packaging/_structures.py similarity index 100% rename from pip/_vendor/packaging/_structures.py rename to src/pip/_vendor/packaging/_structures.py diff --git a/pip/_vendor/packaging/markers.py b/src/pip/_vendor/packaging/markers.py similarity index 100% rename from pip/_vendor/packaging/markers.py rename to src/pip/_vendor/packaging/markers.py diff --git a/pip/_vendor/packaging/requirements.py b/src/pip/_vendor/packaging/requirements.py similarity index 100% rename from pip/_vendor/packaging/requirements.py rename to src/pip/_vendor/packaging/requirements.py diff --git a/pip/_vendor/packaging/specifiers.py b/src/pip/_vendor/packaging/specifiers.py similarity index 100% rename from pip/_vendor/packaging/specifiers.py rename to src/pip/_vendor/packaging/specifiers.py diff --git a/pip/_vendor/packaging/utils.py b/src/pip/_vendor/packaging/utils.py similarity index 100% rename from pip/_vendor/packaging/utils.py rename to src/pip/_vendor/packaging/utils.py diff --git a/pip/_vendor/packaging/version.py b/src/pip/_vendor/packaging/version.py similarity index 100% rename from pip/_vendor/packaging/version.py rename to src/pip/_vendor/packaging/version.py diff --git a/pip/_vendor/pkg_resources/__init__.py b/src/pip/_vendor/pkg_resources/__init__.py similarity index 100% rename from pip/_vendor/pkg_resources/__init__.py rename to src/pip/_vendor/pkg_resources/__init__.py diff --git a/pip/_vendor/pkg_resources/py31compat.py b/src/pip/_vendor/pkg_resources/py31compat.py similarity index 100% rename from pip/_vendor/pkg_resources/py31compat.py rename to src/pip/_vendor/pkg_resources/py31compat.py diff --git a/pip/_vendor/progress/__init__.py b/src/pip/_vendor/progress/__init__.py similarity index 100% rename from pip/_vendor/progress/__init__.py rename to src/pip/_vendor/progress/__init__.py diff --git a/pip/_vendor/progress/bar.py b/src/pip/_vendor/progress/bar.py similarity index 100% rename from pip/_vendor/progress/bar.py rename to src/pip/_vendor/progress/bar.py diff --git a/pip/_vendor/progress/counter.py b/src/pip/_vendor/progress/counter.py similarity index 100% rename from pip/_vendor/progress/counter.py rename to src/pip/_vendor/progress/counter.py diff --git a/pip/_vendor/progress/helpers.py b/src/pip/_vendor/progress/helpers.py similarity index 100% rename from pip/_vendor/progress/helpers.py rename to src/pip/_vendor/progress/helpers.py diff --git a/pip/_vendor/progress/spinner.py b/src/pip/_vendor/progress/spinner.py similarity index 100% rename from pip/_vendor/progress/spinner.py rename to src/pip/_vendor/progress/spinner.py diff --git a/pip/_vendor/pyparsing.py b/src/pip/_vendor/pyparsing.py similarity index 100% rename from pip/_vendor/pyparsing.py rename to src/pip/_vendor/pyparsing.py diff --git a/pip/_vendor/pytoml/__init__.py b/src/pip/_vendor/pytoml/__init__.py similarity index 100% rename from pip/_vendor/pytoml/__init__.py rename to src/pip/_vendor/pytoml/__init__.py diff --git a/pip/_vendor/pytoml/core.py b/src/pip/_vendor/pytoml/core.py similarity index 100% rename from pip/_vendor/pytoml/core.py rename to src/pip/_vendor/pytoml/core.py diff --git a/pip/_vendor/pytoml/parser.py b/src/pip/_vendor/pytoml/parser.py similarity index 100% rename from pip/_vendor/pytoml/parser.py rename to src/pip/_vendor/pytoml/parser.py diff --git a/pip/_vendor/pytoml/writer.py b/src/pip/_vendor/pytoml/writer.py similarity index 100% rename from pip/_vendor/pytoml/writer.py rename to src/pip/_vendor/pytoml/writer.py diff --git a/pip/_vendor/requests/__init__.py b/src/pip/_vendor/requests/__init__.py similarity index 100% rename from pip/_vendor/requests/__init__.py rename to src/pip/_vendor/requests/__init__.py diff --git a/pip/_vendor/requests/_internal_utils.py b/src/pip/_vendor/requests/_internal_utils.py similarity index 100% rename from pip/_vendor/requests/_internal_utils.py rename to src/pip/_vendor/requests/_internal_utils.py diff --git a/pip/_vendor/requests/adapters.py b/src/pip/_vendor/requests/adapters.py similarity index 100% rename from pip/_vendor/requests/adapters.py rename to src/pip/_vendor/requests/adapters.py diff --git a/pip/_vendor/requests/api.py b/src/pip/_vendor/requests/api.py similarity index 100% rename from pip/_vendor/requests/api.py rename to src/pip/_vendor/requests/api.py diff --git a/pip/_vendor/requests/auth.py b/src/pip/_vendor/requests/auth.py similarity index 100% rename from pip/_vendor/requests/auth.py rename to src/pip/_vendor/requests/auth.py diff --git a/pip/_vendor/requests/cacert.pem b/src/pip/_vendor/requests/cacert.pem similarity index 100% rename from pip/_vendor/requests/cacert.pem rename to src/pip/_vendor/requests/cacert.pem diff --git a/pip/_vendor/requests/certs.py b/src/pip/_vendor/requests/certs.py similarity index 100% rename from pip/_vendor/requests/certs.py rename to src/pip/_vendor/requests/certs.py diff --git a/pip/_vendor/requests/compat.py b/src/pip/_vendor/requests/compat.py similarity index 100% rename from pip/_vendor/requests/compat.py rename to src/pip/_vendor/requests/compat.py diff --git a/pip/_vendor/requests/cookies.py b/src/pip/_vendor/requests/cookies.py similarity index 100% rename from pip/_vendor/requests/cookies.py rename to src/pip/_vendor/requests/cookies.py diff --git a/pip/_vendor/requests/exceptions.py b/src/pip/_vendor/requests/exceptions.py similarity index 100% rename from pip/_vendor/requests/exceptions.py rename to src/pip/_vendor/requests/exceptions.py diff --git a/pip/_vendor/requests/hooks.py b/src/pip/_vendor/requests/hooks.py similarity index 100% rename from pip/_vendor/requests/hooks.py rename to src/pip/_vendor/requests/hooks.py diff --git a/pip/_vendor/requests/models.py b/src/pip/_vendor/requests/models.py similarity index 100% rename from pip/_vendor/requests/models.py rename to src/pip/_vendor/requests/models.py diff --git a/pip/_vendor/requests/packages/__init__.py b/src/pip/_vendor/requests/packages/__init__.py similarity index 100% rename from pip/_vendor/requests/packages/__init__.py rename to src/pip/_vendor/requests/packages/__init__.py diff --git a/pip/_vendor/requests/packages/chardet/__init__.py b/src/pip/_vendor/requests/packages/chardet/__init__.py similarity index 100% rename from pip/_vendor/requests/packages/chardet/__init__.py rename to src/pip/_vendor/requests/packages/chardet/__init__.py diff --git a/pip/_vendor/requests/packages/chardet/big5freq.py b/src/pip/_vendor/requests/packages/chardet/big5freq.py similarity index 100% rename from pip/_vendor/requests/packages/chardet/big5freq.py rename to src/pip/_vendor/requests/packages/chardet/big5freq.py diff --git a/pip/_vendor/requests/packages/chardet/big5prober.py b/src/pip/_vendor/requests/packages/chardet/big5prober.py similarity index 100% rename from pip/_vendor/requests/packages/chardet/big5prober.py rename to src/pip/_vendor/requests/packages/chardet/big5prober.py diff --git a/pip/_vendor/requests/packages/chardet/chardetect.py b/src/pip/_vendor/requests/packages/chardet/chardetect.py similarity index 100% rename from pip/_vendor/requests/packages/chardet/chardetect.py rename to src/pip/_vendor/requests/packages/chardet/chardetect.py diff --git a/pip/_vendor/requests/packages/chardet/chardistribution.py b/src/pip/_vendor/requests/packages/chardet/chardistribution.py similarity index 100% rename from pip/_vendor/requests/packages/chardet/chardistribution.py rename to src/pip/_vendor/requests/packages/chardet/chardistribution.py diff --git a/pip/_vendor/requests/packages/chardet/charsetgroupprober.py b/src/pip/_vendor/requests/packages/chardet/charsetgroupprober.py similarity index 100% rename from pip/_vendor/requests/packages/chardet/charsetgroupprober.py rename to src/pip/_vendor/requests/packages/chardet/charsetgroupprober.py diff --git a/pip/_vendor/requests/packages/chardet/charsetprober.py b/src/pip/_vendor/requests/packages/chardet/charsetprober.py similarity index 100% rename from pip/_vendor/requests/packages/chardet/charsetprober.py rename to src/pip/_vendor/requests/packages/chardet/charsetprober.py diff --git a/pip/_vendor/requests/packages/chardet/cli/__init__.py b/src/pip/_vendor/requests/packages/chardet/cli/__init__.py similarity index 100% rename from pip/_vendor/requests/packages/chardet/cli/__init__.py rename to src/pip/_vendor/requests/packages/chardet/cli/__init__.py diff --git a/pip/_vendor/requests/packages/chardet/cli/chardetect.py b/src/pip/_vendor/requests/packages/chardet/cli/chardetect.py similarity index 100% rename from pip/_vendor/requests/packages/chardet/cli/chardetect.py rename to src/pip/_vendor/requests/packages/chardet/cli/chardetect.py diff --git a/pip/_vendor/requests/packages/chardet/codingstatemachine.py b/src/pip/_vendor/requests/packages/chardet/codingstatemachine.py similarity index 100% rename from pip/_vendor/requests/packages/chardet/codingstatemachine.py rename to src/pip/_vendor/requests/packages/chardet/codingstatemachine.py diff --git a/pip/_vendor/requests/packages/chardet/compat.py b/src/pip/_vendor/requests/packages/chardet/compat.py similarity index 100% rename from pip/_vendor/requests/packages/chardet/compat.py rename to src/pip/_vendor/requests/packages/chardet/compat.py diff --git a/pip/_vendor/requests/packages/chardet/constants.py b/src/pip/_vendor/requests/packages/chardet/constants.py similarity index 100% rename from pip/_vendor/requests/packages/chardet/constants.py rename to src/pip/_vendor/requests/packages/chardet/constants.py diff --git a/pip/_vendor/requests/packages/chardet/cp949prober.py b/src/pip/_vendor/requests/packages/chardet/cp949prober.py similarity index 100% rename from pip/_vendor/requests/packages/chardet/cp949prober.py rename to src/pip/_vendor/requests/packages/chardet/cp949prober.py diff --git a/pip/_vendor/requests/packages/chardet/enums.py b/src/pip/_vendor/requests/packages/chardet/enums.py similarity index 100% rename from pip/_vendor/requests/packages/chardet/enums.py rename to src/pip/_vendor/requests/packages/chardet/enums.py diff --git a/pip/_vendor/requests/packages/chardet/escprober.py b/src/pip/_vendor/requests/packages/chardet/escprober.py similarity index 100% rename from pip/_vendor/requests/packages/chardet/escprober.py rename to src/pip/_vendor/requests/packages/chardet/escprober.py diff --git a/pip/_vendor/requests/packages/chardet/escsm.py b/src/pip/_vendor/requests/packages/chardet/escsm.py similarity index 100% rename from pip/_vendor/requests/packages/chardet/escsm.py rename to src/pip/_vendor/requests/packages/chardet/escsm.py diff --git a/pip/_vendor/requests/packages/chardet/eucjpprober.py b/src/pip/_vendor/requests/packages/chardet/eucjpprober.py similarity index 100% rename from pip/_vendor/requests/packages/chardet/eucjpprober.py rename to src/pip/_vendor/requests/packages/chardet/eucjpprober.py diff --git a/pip/_vendor/requests/packages/chardet/euckrfreq.py b/src/pip/_vendor/requests/packages/chardet/euckrfreq.py similarity index 100% rename from pip/_vendor/requests/packages/chardet/euckrfreq.py rename to src/pip/_vendor/requests/packages/chardet/euckrfreq.py diff --git a/pip/_vendor/requests/packages/chardet/euckrprober.py b/src/pip/_vendor/requests/packages/chardet/euckrprober.py similarity index 100% rename from pip/_vendor/requests/packages/chardet/euckrprober.py rename to src/pip/_vendor/requests/packages/chardet/euckrprober.py diff --git a/pip/_vendor/requests/packages/chardet/euctwfreq.py b/src/pip/_vendor/requests/packages/chardet/euctwfreq.py similarity index 100% rename from pip/_vendor/requests/packages/chardet/euctwfreq.py rename to src/pip/_vendor/requests/packages/chardet/euctwfreq.py diff --git a/pip/_vendor/requests/packages/chardet/euctwprober.py b/src/pip/_vendor/requests/packages/chardet/euctwprober.py similarity index 100% rename from pip/_vendor/requests/packages/chardet/euctwprober.py rename to src/pip/_vendor/requests/packages/chardet/euctwprober.py diff --git a/pip/_vendor/requests/packages/chardet/gb2312freq.py b/src/pip/_vendor/requests/packages/chardet/gb2312freq.py similarity index 100% rename from pip/_vendor/requests/packages/chardet/gb2312freq.py rename to src/pip/_vendor/requests/packages/chardet/gb2312freq.py diff --git a/pip/_vendor/requests/packages/chardet/gb2312prober.py b/src/pip/_vendor/requests/packages/chardet/gb2312prober.py similarity index 100% rename from pip/_vendor/requests/packages/chardet/gb2312prober.py rename to src/pip/_vendor/requests/packages/chardet/gb2312prober.py diff --git a/pip/_vendor/requests/packages/chardet/hebrewprober.py b/src/pip/_vendor/requests/packages/chardet/hebrewprober.py similarity index 100% rename from pip/_vendor/requests/packages/chardet/hebrewprober.py rename to src/pip/_vendor/requests/packages/chardet/hebrewprober.py diff --git a/pip/_vendor/requests/packages/chardet/jisfreq.py b/src/pip/_vendor/requests/packages/chardet/jisfreq.py similarity index 100% rename from pip/_vendor/requests/packages/chardet/jisfreq.py rename to src/pip/_vendor/requests/packages/chardet/jisfreq.py diff --git a/pip/_vendor/requests/packages/chardet/jpcntx.py b/src/pip/_vendor/requests/packages/chardet/jpcntx.py similarity index 100% rename from pip/_vendor/requests/packages/chardet/jpcntx.py rename to src/pip/_vendor/requests/packages/chardet/jpcntx.py diff --git a/pip/_vendor/requests/packages/chardet/langbulgarianmodel.py b/src/pip/_vendor/requests/packages/chardet/langbulgarianmodel.py similarity index 100% rename from pip/_vendor/requests/packages/chardet/langbulgarianmodel.py rename to src/pip/_vendor/requests/packages/chardet/langbulgarianmodel.py diff --git a/pip/_vendor/requests/packages/chardet/langcyrillicmodel.py b/src/pip/_vendor/requests/packages/chardet/langcyrillicmodel.py similarity index 100% rename from pip/_vendor/requests/packages/chardet/langcyrillicmodel.py rename to src/pip/_vendor/requests/packages/chardet/langcyrillicmodel.py diff --git a/pip/_vendor/requests/packages/chardet/langgreekmodel.py b/src/pip/_vendor/requests/packages/chardet/langgreekmodel.py similarity index 100% rename from pip/_vendor/requests/packages/chardet/langgreekmodel.py rename to src/pip/_vendor/requests/packages/chardet/langgreekmodel.py diff --git a/pip/_vendor/requests/packages/chardet/langhebrewmodel.py b/src/pip/_vendor/requests/packages/chardet/langhebrewmodel.py similarity index 100% rename from pip/_vendor/requests/packages/chardet/langhebrewmodel.py rename to src/pip/_vendor/requests/packages/chardet/langhebrewmodel.py diff --git a/pip/_vendor/requests/packages/chardet/langhungarianmodel.py b/src/pip/_vendor/requests/packages/chardet/langhungarianmodel.py similarity index 100% rename from pip/_vendor/requests/packages/chardet/langhungarianmodel.py rename to src/pip/_vendor/requests/packages/chardet/langhungarianmodel.py diff --git a/pip/_vendor/requests/packages/chardet/langthaimodel.py b/src/pip/_vendor/requests/packages/chardet/langthaimodel.py similarity index 100% rename from pip/_vendor/requests/packages/chardet/langthaimodel.py rename to src/pip/_vendor/requests/packages/chardet/langthaimodel.py diff --git a/pip/_vendor/requests/packages/chardet/langturkishmodel.py b/src/pip/_vendor/requests/packages/chardet/langturkishmodel.py similarity index 100% rename from pip/_vendor/requests/packages/chardet/langturkishmodel.py rename to src/pip/_vendor/requests/packages/chardet/langturkishmodel.py diff --git a/pip/_vendor/requests/packages/chardet/latin1prober.py b/src/pip/_vendor/requests/packages/chardet/latin1prober.py similarity index 100% rename from pip/_vendor/requests/packages/chardet/latin1prober.py rename to src/pip/_vendor/requests/packages/chardet/latin1prober.py diff --git a/pip/_vendor/requests/packages/chardet/mbcharsetprober.py b/src/pip/_vendor/requests/packages/chardet/mbcharsetprober.py similarity index 100% rename from pip/_vendor/requests/packages/chardet/mbcharsetprober.py rename to src/pip/_vendor/requests/packages/chardet/mbcharsetprober.py diff --git a/pip/_vendor/requests/packages/chardet/mbcsgroupprober.py b/src/pip/_vendor/requests/packages/chardet/mbcsgroupprober.py similarity index 100% rename from pip/_vendor/requests/packages/chardet/mbcsgroupprober.py rename to src/pip/_vendor/requests/packages/chardet/mbcsgroupprober.py diff --git a/pip/_vendor/requests/packages/chardet/mbcssm.py b/src/pip/_vendor/requests/packages/chardet/mbcssm.py similarity index 100% rename from pip/_vendor/requests/packages/chardet/mbcssm.py rename to src/pip/_vendor/requests/packages/chardet/mbcssm.py diff --git a/pip/_vendor/requests/packages/chardet/sbcharsetprober.py b/src/pip/_vendor/requests/packages/chardet/sbcharsetprober.py similarity index 100% rename from pip/_vendor/requests/packages/chardet/sbcharsetprober.py rename to src/pip/_vendor/requests/packages/chardet/sbcharsetprober.py diff --git a/pip/_vendor/requests/packages/chardet/sbcsgroupprober.py b/src/pip/_vendor/requests/packages/chardet/sbcsgroupprober.py similarity index 100% rename from pip/_vendor/requests/packages/chardet/sbcsgroupprober.py rename to src/pip/_vendor/requests/packages/chardet/sbcsgroupprober.py diff --git a/pip/_vendor/requests/packages/chardet/sjisprober.py b/src/pip/_vendor/requests/packages/chardet/sjisprober.py similarity index 100% rename from pip/_vendor/requests/packages/chardet/sjisprober.py rename to src/pip/_vendor/requests/packages/chardet/sjisprober.py diff --git a/pip/_vendor/requests/packages/chardet/universaldetector.py b/src/pip/_vendor/requests/packages/chardet/universaldetector.py similarity index 100% rename from pip/_vendor/requests/packages/chardet/universaldetector.py rename to src/pip/_vendor/requests/packages/chardet/universaldetector.py diff --git a/pip/_vendor/requests/packages/chardet/utf8prober.py b/src/pip/_vendor/requests/packages/chardet/utf8prober.py similarity index 100% rename from pip/_vendor/requests/packages/chardet/utf8prober.py rename to src/pip/_vendor/requests/packages/chardet/utf8prober.py diff --git a/pip/_vendor/requests/packages/chardet/version.py b/src/pip/_vendor/requests/packages/chardet/version.py similarity index 100% rename from pip/_vendor/requests/packages/chardet/version.py rename to src/pip/_vendor/requests/packages/chardet/version.py diff --git a/pip/_vendor/requests/packages/idna/__init__.py b/src/pip/_vendor/requests/packages/idna/__init__.py similarity index 100% rename from pip/_vendor/requests/packages/idna/__init__.py rename to src/pip/_vendor/requests/packages/idna/__init__.py diff --git a/pip/_vendor/requests/packages/idna/codec.py b/src/pip/_vendor/requests/packages/idna/codec.py similarity index 100% rename from pip/_vendor/requests/packages/idna/codec.py rename to src/pip/_vendor/requests/packages/idna/codec.py diff --git a/pip/_vendor/requests/packages/idna/compat.py b/src/pip/_vendor/requests/packages/idna/compat.py similarity index 100% rename from pip/_vendor/requests/packages/idna/compat.py rename to src/pip/_vendor/requests/packages/idna/compat.py diff --git a/pip/_vendor/requests/packages/idna/core.py b/src/pip/_vendor/requests/packages/idna/core.py similarity index 100% rename from pip/_vendor/requests/packages/idna/core.py rename to src/pip/_vendor/requests/packages/idna/core.py diff --git a/pip/_vendor/requests/packages/idna/idnadata.py b/src/pip/_vendor/requests/packages/idna/idnadata.py similarity index 100% rename from pip/_vendor/requests/packages/idna/idnadata.py rename to src/pip/_vendor/requests/packages/idna/idnadata.py diff --git a/pip/_vendor/requests/packages/idna/intranges.py b/src/pip/_vendor/requests/packages/idna/intranges.py similarity index 100% rename from pip/_vendor/requests/packages/idna/intranges.py rename to src/pip/_vendor/requests/packages/idna/intranges.py diff --git a/pip/_vendor/requests/packages/idna/uts46data.py b/src/pip/_vendor/requests/packages/idna/uts46data.py similarity index 100% rename from pip/_vendor/requests/packages/idna/uts46data.py rename to src/pip/_vendor/requests/packages/idna/uts46data.py diff --git a/pip/_vendor/requests/packages/urllib3/__init__.py b/src/pip/_vendor/requests/packages/urllib3/__init__.py similarity index 100% rename from pip/_vendor/requests/packages/urllib3/__init__.py rename to src/pip/_vendor/requests/packages/urllib3/__init__.py diff --git a/pip/_vendor/requests/packages/urllib3/_collections.py b/src/pip/_vendor/requests/packages/urllib3/_collections.py similarity index 100% rename from pip/_vendor/requests/packages/urllib3/_collections.py rename to src/pip/_vendor/requests/packages/urllib3/_collections.py diff --git a/pip/_vendor/requests/packages/urllib3/connection.py b/src/pip/_vendor/requests/packages/urllib3/connection.py similarity index 100% rename from pip/_vendor/requests/packages/urllib3/connection.py rename to src/pip/_vendor/requests/packages/urllib3/connection.py diff --git a/pip/_vendor/requests/packages/urllib3/connectionpool.py b/src/pip/_vendor/requests/packages/urllib3/connectionpool.py similarity index 100% rename from pip/_vendor/requests/packages/urllib3/connectionpool.py rename to src/pip/_vendor/requests/packages/urllib3/connectionpool.py diff --git a/pip/_vendor/requests/packages/urllib3/packages/backports/__init__.py b/src/pip/_vendor/requests/packages/urllib3/contrib/__init__.py similarity index 100% rename from pip/_vendor/requests/packages/urllib3/packages/backports/__init__.py rename to src/pip/_vendor/requests/packages/urllib3/contrib/__init__.py diff --git a/pip/operations/__init__.py b/src/pip/_vendor/requests/packages/urllib3/contrib/_securetransport/__init__.py similarity index 100% rename from pip/operations/__init__.py rename to src/pip/_vendor/requests/packages/urllib3/contrib/_securetransport/__init__.py diff --git a/pip/_vendor/requests/packages/urllib3/contrib/_securetransport/bindings.py b/src/pip/_vendor/requests/packages/urllib3/contrib/_securetransport/bindings.py similarity index 100% rename from pip/_vendor/requests/packages/urllib3/contrib/_securetransport/bindings.py rename to src/pip/_vendor/requests/packages/urllib3/contrib/_securetransport/bindings.py diff --git a/pip/_vendor/requests/packages/urllib3/contrib/_securetransport/low_level.py b/src/pip/_vendor/requests/packages/urllib3/contrib/_securetransport/low_level.py similarity index 100% rename from pip/_vendor/requests/packages/urllib3/contrib/_securetransport/low_level.py rename to src/pip/_vendor/requests/packages/urllib3/contrib/_securetransport/low_level.py diff --git a/pip/_vendor/requests/packages/urllib3/contrib/appengine.py b/src/pip/_vendor/requests/packages/urllib3/contrib/appengine.py similarity index 100% rename from pip/_vendor/requests/packages/urllib3/contrib/appengine.py rename to src/pip/_vendor/requests/packages/urllib3/contrib/appengine.py diff --git a/pip/_vendor/requests/packages/urllib3/contrib/ntlmpool.py b/src/pip/_vendor/requests/packages/urllib3/contrib/ntlmpool.py similarity index 100% rename from pip/_vendor/requests/packages/urllib3/contrib/ntlmpool.py rename to src/pip/_vendor/requests/packages/urllib3/contrib/ntlmpool.py diff --git a/pip/_vendor/requests/packages/urllib3/contrib/pyopenssl.py b/src/pip/_vendor/requests/packages/urllib3/contrib/pyopenssl.py similarity index 100% rename from pip/_vendor/requests/packages/urllib3/contrib/pyopenssl.py rename to src/pip/_vendor/requests/packages/urllib3/contrib/pyopenssl.py diff --git a/pip/_vendor/requests/packages/urllib3/contrib/securetransport.py b/src/pip/_vendor/requests/packages/urllib3/contrib/securetransport.py similarity index 100% rename from pip/_vendor/requests/packages/urllib3/contrib/securetransport.py rename to src/pip/_vendor/requests/packages/urllib3/contrib/securetransport.py diff --git a/pip/_vendor/requests/packages/urllib3/contrib/socks.py b/src/pip/_vendor/requests/packages/urllib3/contrib/socks.py similarity index 100% rename from pip/_vendor/requests/packages/urllib3/contrib/socks.py rename to src/pip/_vendor/requests/packages/urllib3/contrib/socks.py diff --git a/pip/_vendor/requests/packages/urllib3/exceptions.py b/src/pip/_vendor/requests/packages/urllib3/exceptions.py similarity index 100% rename from pip/_vendor/requests/packages/urllib3/exceptions.py rename to src/pip/_vendor/requests/packages/urllib3/exceptions.py diff --git a/pip/_vendor/requests/packages/urllib3/fields.py b/src/pip/_vendor/requests/packages/urllib3/fields.py similarity index 100% rename from pip/_vendor/requests/packages/urllib3/fields.py rename to src/pip/_vendor/requests/packages/urllib3/fields.py diff --git a/pip/_vendor/requests/packages/urllib3/filepost.py b/src/pip/_vendor/requests/packages/urllib3/filepost.py similarity index 100% rename from pip/_vendor/requests/packages/urllib3/filepost.py rename to src/pip/_vendor/requests/packages/urllib3/filepost.py diff --git a/pip/_vendor/requests/packages/urllib3/packages/__init__.py b/src/pip/_vendor/requests/packages/urllib3/packages/__init__.py similarity index 100% rename from pip/_vendor/requests/packages/urllib3/packages/__init__.py rename to src/pip/_vendor/requests/packages/urllib3/packages/__init__.py diff --git a/src/pip/_vendor/requests/packages/urllib3/packages/backports/__init__.py b/src/pip/_vendor/requests/packages/urllib3/packages/backports/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/pip/_vendor/requests/packages/urllib3/packages/backports/makefile.py b/src/pip/_vendor/requests/packages/urllib3/packages/backports/makefile.py similarity index 100% rename from pip/_vendor/requests/packages/urllib3/packages/backports/makefile.py rename to src/pip/_vendor/requests/packages/urllib3/packages/backports/makefile.py diff --git a/pip/_vendor/requests/packages/urllib3/packages/ordered_dict.py b/src/pip/_vendor/requests/packages/urllib3/packages/ordered_dict.py similarity index 100% rename from pip/_vendor/requests/packages/urllib3/packages/ordered_dict.py rename to src/pip/_vendor/requests/packages/urllib3/packages/ordered_dict.py diff --git a/pip/_vendor/requests/packages/urllib3/packages/six.py b/src/pip/_vendor/requests/packages/urllib3/packages/six.py similarity index 100% rename from pip/_vendor/requests/packages/urllib3/packages/six.py rename to src/pip/_vendor/requests/packages/urllib3/packages/six.py diff --git a/pip/_vendor/requests/packages/urllib3/packages/ssl_match_hostname/__init__.py b/src/pip/_vendor/requests/packages/urllib3/packages/ssl_match_hostname/__init__.py similarity index 100% rename from pip/_vendor/requests/packages/urllib3/packages/ssl_match_hostname/__init__.py rename to src/pip/_vendor/requests/packages/urllib3/packages/ssl_match_hostname/__init__.py diff --git a/pip/_vendor/requests/packages/urllib3/packages/ssl_match_hostname/_implementation.py b/src/pip/_vendor/requests/packages/urllib3/packages/ssl_match_hostname/_implementation.py similarity index 100% rename from pip/_vendor/requests/packages/urllib3/packages/ssl_match_hostname/_implementation.py rename to src/pip/_vendor/requests/packages/urllib3/packages/ssl_match_hostname/_implementation.py diff --git a/pip/_vendor/requests/packages/urllib3/poolmanager.py b/src/pip/_vendor/requests/packages/urllib3/poolmanager.py similarity index 100% rename from pip/_vendor/requests/packages/urllib3/poolmanager.py rename to src/pip/_vendor/requests/packages/urllib3/poolmanager.py diff --git a/pip/_vendor/requests/packages/urllib3/request.py b/src/pip/_vendor/requests/packages/urllib3/request.py similarity index 100% rename from pip/_vendor/requests/packages/urllib3/request.py rename to src/pip/_vendor/requests/packages/urllib3/request.py diff --git a/pip/_vendor/requests/packages/urllib3/response.py b/src/pip/_vendor/requests/packages/urllib3/response.py similarity index 100% rename from pip/_vendor/requests/packages/urllib3/response.py rename to src/pip/_vendor/requests/packages/urllib3/response.py diff --git a/pip/_vendor/requests/packages/urllib3/util/__init__.py b/src/pip/_vendor/requests/packages/urllib3/util/__init__.py similarity index 100% rename from pip/_vendor/requests/packages/urllib3/util/__init__.py rename to src/pip/_vendor/requests/packages/urllib3/util/__init__.py diff --git a/pip/_vendor/requests/packages/urllib3/util/connection.py b/src/pip/_vendor/requests/packages/urllib3/util/connection.py similarity index 100% rename from pip/_vendor/requests/packages/urllib3/util/connection.py rename to src/pip/_vendor/requests/packages/urllib3/util/connection.py diff --git a/pip/_vendor/requests/packages/urllib3/util/request.py b/src/pip/_vendor/requests/packages/urllib3/util/request.py similarity index 100% rename from pip/_vendor/requests/packages/urllib3/util/request.py rename to src/pip/_vendor/requests/packages/urllib3/util/request.py diff --git a/pip/_vendor/requests/packages/urllib3/util/response.py b/src/pip/_vendor/requests/packages/urllib3/util/response.py similarity index 100% rename from pip/_vendor/requests/packages/urllib3/util/response.py rename to src/pip/_vendor/requests/packages/urllib3/util/response.py diff --git a/pip/_vendor/requests/packages/urllib3/util/retry.py b/src/pip/_vendor/requests/packages/urllib3/util/retry.py similarity index 100% rename from pip/_vendor/requests/packages/urllib3/util/retry.py rename to src/pip/_vendor/requests/packages/urllib3/util/retry.py diff --git a/pip/_vendor/requests/packages/urllib3/util/selectors.py b/src/pip/_vendor/requests/packages/urllib3/util/selectors.py similarity index 100% rename from pip/_vendor/requests/packages/urllib3/util/selectors.py rename to src/pip/_vendor/requests/packages/urllib3/util/selectors.py diff --git a/pip/_vendor/requests/packages/urllib3/util/ssl_.py b/src/pip/_vendor/requests/packages/urllib3/util/ssl_.py similarity index 100% rename from pip/_vendor/requests/packages/urllib3/util/ssl_.py rename to src/pip/_vendor/requests/packages/urllib3/util/ssl_.py diff --git a/pip/_vendor/requests/packages/urllib3/util/timeout.py b/src/pip/_vendor/requests/packages/urllib3/util/timeout.py similarity index 100% rename from pip/_vendor/requests/packages/urllib3/util/timeout.py rename to src/pip/_vendor/requests/packages/urllib3/util/timeout.py diff --git a/pip/_vendor/requests/packages/urllib3/util/url.py b/src/pip/_vendor/requests/packages/urllib3/util/url.py similarity index 100% rename from pip/_vendor/requests/packages/urllib3/util/url.py rename to src/pip/_vendor/requests/packages/urllib3/util/url.py diff --git a/pip/_vendor/requests/packages/urllib3/util/wait.py b/src/pip/_vendor/requests/packages/urllib3/util/wait.py similarity index 100% rename from pip/_vendor/requests/packages/urllib3/util/wait.py rename to src/pip/_vendor/requests/packages/urllib3/util/wait.py diff --git a/pip/_vendor/requests/sessions.py b/src/pip/_vendor/requests/sessions.py similarity index 100% rename from pip/_vendor/requests/sessions.py rename to src/pip/_vendor/requests/sessions.py diff --git a/pip/_vendor/requests/status_codes.py b/src/pip/_vendor/requests/status_codes.py similarity index 100% rename from pip/_vendor/requests/status_codes.py rename to src/pip/_vendor/requests/status_codes.py diff --git a/pip/_vendor/requests/structures.py b/src/pip/_vendor/requests/structures.py similarity index 100% rename from pip/_vendor/requests/structures.py rename to src/pip/_vendor/requests/structures.py diff --git a/pip/_vendor/requests/utils.py b/src/pip/_vendor/requests/utils.py similarity index 100% rename from pip/_vendor/requests/utils.py rename to src/pip/_vendor/requests/utils.py diff --git a/pip/_vendor/retrying.py b/src/pip/_vendor/retrying.py similarity index 100% rename from pip/_vendor/retrying.py rename to src/pip/_vendor/retrying.py diff --git a/pip/_vendor/six.py b/src/pip/_vendor/six.py similarity index 100% rename from pip/_vendor/six.py rename to src/pip/_vendor/six.py diff --git a/pip/_vendor/vendor.txt b/src/pip/_vendor/vendor.txt similarity index 100% rename from pip/_vendor/vendor.txt rename to src/pip/_vendor/vendor.txt diff --git a/pip/_vendor/webencodings/__init__.py b/src/pip/_vendor/webencodings/__init__.py similarity index 100% rename from pip/_vendor/webencodings/__init__.py rename to src/pip/_vendor/webencodings/__init__.py diff --git a/pip/_vendor/webencodings/labels.py b/src/pip/_vendor/webencodings/labels.py similarity index 100% rename from pip/_vendor/webencodings/labels.py rename to src/pip/_vendor/webencodings/labels.py diff --git a/pip/_vendor/webencodings/mklabels.py b/src/pip/_vendor/webencodings/mklabels.py similarity index 100% rename from pip/_vendor/webencodings/mklabels.py rename to src/pip/_vendor/webencodings/mklabels.py diff --git a/pip/_vendor/webencodings/tests.py b/src/pip/_vendor/webencodings/tests.py similarity index 100% rename from pip/_vendor/webencodings/tests.py rename to src/pip/_vendor/webencodings/tests.py diff --git a/pip/_vendor/webencodings/x_user_defined.py b/src/pip/_vendor/webencodings/x_user_defined.py similarity index 100% rename from pip/_vendor/webencodings/x_user_defined.py rename to src/pip/_vendor/webencodings/x_user_defined.py diff --git a/tasks/vendoring/__init__.py b/tasks/vendoring/__init__.py index c88e97d1d..22a844f26 100644 --- a/tasks/vendoring/__init__.py +++ b/tasks/vendoring/__init__.py @@ -126,7 +126,7 @@ def main(ctx): git_root = Path( ctx.run('git rev-parse --show-toplevel', hide=True).stdout.strip() ) - vendor_dir = git_root / 'pip' / '_vendor' + vendor_dir = git_root / 'src' / 'pip' / '_vendor' log('Using vendor dir: %s' % vendor_dir) clean_vendor(ctx, vendor_dir) vendor(ctx, vendor_dir) diff --git a/tasks/vendoring/patches/cachecontrol.patch b/tasks/vendoring/patches/cachecontrol.patch index d81e6bcde..ea6627e61 100644 --- a/tasks/vendoring/patches/cachecontrol.patch +++ b/tasks/vendoring/patches/cachecontrol.patch @@ -1,7 +1,7 @@ -diff --git a/pip/_vendor/cachecontrol/compat.py b/pip/_vendor/cachecontrol/compat.py +diff --git a/src/pip/_vendor/cachecontrol/compat.py b/src/pip/_vendor/cachecontrol/compat.py index 54ec211..018e6ac 100644 ---- a/pip/_vendor/cachecontrol/compat.py -+++ b/pip/_vendor/cachecontrol/compat.py +--- a/src/pip/_vendor/cachecontrol/compat.py ++++ b/src/pip/_vendor/cachecontrol/compat.py @@ -10,17 +10,8 @@ except ImportError: import pickle diff --git a/tasks/vendoring/patches/distro.patch b/tasks/vendoring/patches/distro.patch index 2c6039b15..420bed9ca 100644 --- a/tasks/vendoring/patches/distro.patch +++ b/tasks/vendoring/patches/distro.patch @@ -1,7 +1,7 @@ -diff --git a/pip/_vendor/distro.py b/pip/_vendor/distro.py +diff --git a/src/pip/_vendor/distro.py b/src/pip/_vendor/distro.py index 0afa527..9e7daad 100644 ---- a/pip/_vendor/distro.py -+++ b/pip/_vendor/distro.py +--- a/src/pip/_vendor/distro.py ++++ b/src/pip/_vendor/distro.py @@ -34,7 +34,6 @@ import sys import json import shlex diff --git a/tasks/vendoring/patches/requests.patch b/tasks/vendoring/patches/requests.patch index 20c5e767b..94f071401 100644 --- a/tasks/vendoring/patches/requests.patch +++ b/tasks/vendoring/patches/requests.patch @@ -1,7 +1,7 @@ -diff --git a/pip/_vendor/requests/__init__.py b/pip/_vendor/requests/__init__.py +diff --git a/src/pip/_vendor/requests/__init__.py b/src/pip/_vendor/requests/__init__.py index 9c3b769..44f6836 100644 ---- a/pip/_vendor/requests/__init__.py -+++ b/pip/_vendor/requests/__init__.py +--- a/src/pip/_vendor/requests/__init__.py ++++ b/src/pip/_vendor/requests/__init__.py @@ -48,11 +48,13 @@ __license__ = 'Apache 2.0' __copyright__ = 'Copyright 2016 Kenneth Reitz' @@ -21,10 +21,10 @@ index 9c3b769..44f6836 100644 import warnings -diff --git a/pip/_vendor/requests/compat.py b/pip/_vendor/requests/compat.py +diff --git a/src/pip/_vendor/requests/compat.py b/src/pip/_vendor/requests/compat.py index eb6530d..353ec29 100644 ---- a/pip/_vendor/requests/compat.py -+++ b/pip/_vendor/requests/compat.py +--- a/src/pip/_vendor/requests/compat.py ++++ b/src/pip/_vendor/requests/compat.py @@ -25,12 +25,14 @@ is_py2 = (_ver[0] == 2) #: Python 3.x? is_py3 = (_ver[0] == 3) diff --git a/tests/conftest.py b/tests/conftest.py index 867506e2c..bf70498e0 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -7,8 +7,8 @@ import sys import pytest import six -import pip -from pip.utils import appdirs +import pip._internal +from pip._internal.utils import appdirs from tests.lib import SRC_DIR, TestData from tests.lib.path import Path from tests.lib.scripttest import PipTestEnvironment @@ -224,7 +224,7 @@ class InMemoryPip(object): stdout = io.BytesIO() sys.stdout = stdout try: - returncode = pip.main(list(args)) + returncode = pip._internal.main(list(args)) except SystemExit as e: returncode = e.code or 0 finally: diff --git a/tests/functional/test_completion.py b/tests/functional/test_completion.py index 0ca68423d..f6b34b211 100644 --- a/tests/functional/test_completion.py +++ b/tests/functional/test_completion.py @@ -80,7 +80,7 @@ def setup_completion(script, words, cword): # expect_error is True because autocomplete exists with 1 status code result = script.run( - 'python', '-c', 'import pip;pip.autocomplete()', + 'python', '-c', 'import pip._internal;pip._internal.autocomplete()', expect_error=True, ) diff --git a/tests/functional/test_configuration.py b/tests/functional/test_configuration.py index bdee541d2..903939f5f 100644 --- a/tests/functional/test_configuration.py +++ b/tests/functional/test_configuration.py @@ -5,7 +5,7 @@ import textwrap import pytest -from pip.status_codes import ERROR +from pip._internal.status_codes import ERROR from tests.lib.configuration_helpers import ConfigurationMixin, kinds diff --git a/tests/functional/test_download.py b/tests/functional/test_download.py index b227868b7..090af1691 100644 --- a/tests/functional/test_download.py +++ b/tests/functional/test_download.py @@ -3,7 +3,7 @@ import textwrap import pytest -from pip.status_codes import ERROR +from pip._internal.status_codes import ERROR from tests.lib.path import Path diff --git a/tests/functional/test_help.py b/tests/functional/test_help.py index 04a50b4c6..1c3bc0eb3 100644 --- a/tests/functional/test_help.py +++ b/tests/functional/test_help.py @@ -1,10 +1,10 @@ import pytest from mock import Mock -from pip.basecommand import ERROR, SUCCESS -from pip.commands import commands_dict as commands -from pip.commands.help import HelpCommand -from pip.exceptions import CommandError +from pip._internal.basecommand import ERROR, SUCCESS +from pip._internal.commands import commands_dict as commands +from pip._internal.commands.help import HelpCommand +from pip._internal.exceptions import CommandError def test_run_method_should_return_success_when_finds_command_name(): diff --git a/tests/functional/test_install.py b/tests/functional/test_install.py index 4a6bc6251..dee56c7d7 100644 --- a/tests/functional/test_install.py +++ b/tests/functional/test_install.py @@ -6,9 +6,10 @@ from os.path import curdir, join, pardir import pytest -from pip import pep425tags -from pip.status_codes import ERROR -from pip.utils import appdirs, rmtree +from pip._internal import pep425tags +from pip._internal.status_codes import ERROR +from pip._internal.utils import appdirs +from pip._internal.utils.misc import rmtree from tests.lib import ( _create_svn_repo, _create_test_package, create_test_package_with_setup, path_to_url, pyversion, pyversion_tuple, requirements_file @@ -21,7 +22,7 @@ def test_without_setuptools(script, data): script.pip("uninstall", "setuptools", "-y") result = script.run( "python", "-c", - "import pip; pip.main([" + "import pip._internal; pip._internal.main([" "'install', " "'INITools==0.2', " "'-f', '%s', " @@ -45,7 +46,7 @@ def test_with_setuptools_and_import_error(script, data): result = script.run( "python", "-c", - "import pip; pip.main([" + "import pip._internal; pip._internal.main([" "'install', " "'INITools==0.2', " "'-f', '%s', " diff --git a/tests/functional/test_install_cleanup.py b/tests/functional/test_install_cleanup.py index 79fff57e2..a2c2644fd 100644 --- a/tests/functional/test_install_cleanup.py +++ b/tests/functional/test_install_cleanup.py @@ -3,8 +3,8 @@ from os.path import exists import pytest -from pip.locations import write_delete_marker_file -from pip.status_codes import PREVIOUS_BUILD_DIR_ERROR +from pip._internal.locations import write_delete_marker_file +from pip._internal.status_codes import PREVIOUS_BUILD_DIR_ERROR from tests.lib.local_repos import local_checkout diff --git a/tests/functional/test_install_config.py b/tests/functional/test_install_config.py index da041af10..6cd9bd233 100644 --- a/tests/functional/test_install_config.py +++ b/tests/functional/test_install_config.py @@ -186,7 +186,7 @@ def test_options_from_venv_config(script, virtualenv): Test if ConfigOptionParser reads a virtualenv-local config file """ - from pip.locations import config_basename + from pip._internal.locations import config_basename conf = "[global]\nno-index = true" ini = virtualenv.location / config_basename with open(ini, 'w') as f: diff --git a/tests/functional/test_install_user.py b/tests/functional/test_install_user.py index 6faea6149..cf0cb5137 100644 --- a/tests/functional/test_install_user.py +++ b/tests/functional/test_install_user.py @@ -7,7 +7,7 @@ from os.path import curdir, isdir, isfile import pytest -from pip.compat import cache_from_source, uses_pycache +from pip._internal.compat import cache_from_source, uses_pycache from tests.lib import pyversion from tests.lib.local_repos import local_checkout @@ -18,7 +18,7 @@ def _patch_dist_in_site_packages(script): def dist_in_site_packages(dist): return False - from pip.req import req_install + from pip._internal.req import req_install req_install.dist_in_site_packages = dist_in_site_packages """)) diff --git a/tests/functional/test_install_vcs_git.py b/tests/functional/test_install_vcs_git.py index b970c27c4..23d1a75e1 100644 --- a/tests/functional/test_install_vcs_git.py +++ b/tests/functional/test_install_vcs_git.py @@ -1,7 +1,7 @@ import pytest from mock import patch -from pip.vcs.git import Git +from pip._internal.vcs.git import Git from tests.lib import _create_test_package from tests.lib.git_submodule_helpers import ( _change_test_package_submodule, _create_test_package_with_submodule, @@ -73,7 +73,7 @@ def test_check_version(script): assert not git.check_version(version_pkg_path, ['abc123']) -@patch('pip.vcs.git.Git.get_short_refs') +@patch('pip._internal.vcs.git.Git.get_short_refs') def test_check_rev_options_should_handle_branch_name(get_refs_mock): get_refs_mock.return_value = {'master': '123456', '0.1': '123456'} git = Git() @@ -82,7 +82,7 @@ def test_check_rev_options_should_handle_branch_name(get_refs_mock): assert result == ['123456'] -@patch('pip.vcs.git.Git.get_short_refs') +@patch('pip._internal.vcs.git.Git.get_short_refs') def test_check_rev_options_should_handle_tag_name(get_refs_mock): get_refs_mock.return_value = {'master': '123456', '0.1': '123456'} git = Git() @@ -91,7 +91,7 @@ def test_check_rev_options_should_handle_tag_name(get_refs_mock): assert result == ['123456'] -@patch('pip.vcs.git.Git.get_short_refs') +@patch('pip._internal.vcs.git.Git.get_short_refs') def test_check_rev_options_should_handle_ambiguous_commit(get_refs_mock): get_refs_mock.return_value = {'master': '123456', '0.1': '123456'} git = Git() diff --git a/tests/functional/test_install_vcs_svn.py b/tests/functional/test_install_vcs_svn.py index b508d07ad..3a7088669 100644 --- a/tests/functional/test_install_vcs_svn.py +++ b/tests/functional/test_install_vcs_svn.py @@ -1,10 +1,10 @@ import pytest from mock import patch -from pip.vcs.subversion import Subversion +from pip._internal.vcs.subversion import Subversion -@patch('pip.vcs.call_subprocess') +@patch('pip._internal.vcs.call_subprocess') @pytest.mark.network def test_obtain_should_recognize_auth_info_url(call_subprocess_mock, script): svn = Subversion(url='svn+http://username:password@svn.example.com/') @@ -16,7 +16,7 @@ def test_obtain_should_recognize_auth_info_url(call_subprocess_mock, script): ] -@patch('pip.vcs.call_subprocess') +@patch('pip._internal.vcs.call_subprocess') @pytest.mark.network def test_export_should_recognize_auth_info_url(call_subprocess_mock, script): svn = Subversion(url='svn+http://username:password@svn.example.com/') diff --git a/tests/functional/test_search.py b/tests/functional/test_search.py index 548280b12..9a4fce4eb 100644 --- a/tests/functional/test_search.py +++ b/tests/functional/test_search.py @@ -1,9 +1,9 @@ import pytest -from pip.commands.search import ( +from pip._internal.commands.search import ( SearchCommand, highest_version, print_results, transform_hits ) -from pip.status_codes import NO_MATCHES_FOUND, SUCCESS +from pip._internal.status_codes import NO_MATCHES_FOUND, SUCCESS from tests.lib import pyversion if pyversion >= '3': diff --git a/tests/functional/test_show.py b/tests/functional/test_show.py index d524786f8..4f0d0720b 100644 --- a/tests/functional/test_show.py +++ b/tests/functional/test_show.py @@ -4,7 +4,7 @@ import re import pytest from pip import __version__ -from pip.commands.show import search_packages_info +from pip._internal.commands.show import search_packages_info def test_show(script): diff --git a/tests/functional/test_uninstall.py b/tests/functional/test_uninstall.py index c0fc37348..7e14157ad 100644 --- a/tests/functional/test_uninstall.py +++ b/tests/functional/test_uninstall.py @@ -10,8 +10,8 @@ from tempfile import mkdtemp import pretend import pytest -from pip.req import InstallRequirement -from pip.utils import rmtree +from pip._internal.req import InstallRequirement +from pip._internal.utils.misc import rmtree from tests.lib import assert_all_changes, create_test_package_with_setup from tests.lib.local_repos import local_checkout, local_repo @@ -371,7 +371,7 @@ def test_uninstallpathset_no_paths(caplog): Test UninstallPathSet logs notification when there are no paths to uninstall """ - from pip.req.req_uninstall import UninstallPathSet + from pip._internal.req.req_uninstall import UninstallPathSet from pkg_resources import get_distribution test_dist = get_distribution('pip') uninstall_set = UninstallPathSet(test_dist) diff --git a/tests/functional/test_warning.py b/tests/functional/test_warning.py index 56e2b27ed..20f246795 100644 --- a/tests/functional/test_warning.py +++ b/tests/functional/test_warning.py @@ -3,7 +3,7 @@ def test_environ(script, tmpdir): """$PYTHONWARNINGS was added in python2.7""" demo = tmpdir.join('warnings_demo.py') demo.write(''' -from pip.utils import deprecation +from pip._internal.utils import deprecation deprecation.install_warning_logger() from logging import basicConfig @@ -14,7 +14,8 @@ warn("deprecated!", deprecation.PipDeprecationWarning) ''') result = script.run('python', demo, expect_stderr=True) - assert result.stderr == 'ERROR:pip.deprecations:DEPRECATION: deprecated!\n' + assert result.stderr == \ + 'ERROR:pip._internal.deprecations:DEPRECATION: deprecated!\n' script.environ['PYTHONWARNINGS'] = 'ignore' result = script.run('python', demo) diff --git a/tests/functional/test_wheel.py b/tests/functional/test_wheel.py index c60e6cba9..e3e30173c 100644 --- a/tests/functional/test_wheel.py +++ b/tests/functional/test_wheel.py @@ -4,8 +4,8 @@ from os.path import exists import pytest -from pip.locations import write_delete_marker_file -from pip.status_codes import ERROR, PREVIOUS_BUILD_DIR_ERROR +from pip._internal.locations import write_delete_marker_file +from pip._internal.status_codes import ERROR, PREVIOUS_BUILD_DIR_ERROR from tests.lib import pyversion diff --git a/tests/lib/__init__.py b/tests/lib/__init__.py index f954bf3a7..8d5b24747 100644 --- a/tests/lib/__init__.py +++ b/tests/lib/__init__.py @@ -38,7 +38,7 @@ def path_to_url(path): def create_file(path, contents=None): """Create a file on the path, with the given contents """ - from pip.utils import ensure_dir + from pip._internal.utils.misc import ensure_dir ensure_dir(os.path.dirname(path)) with open(path, "w") as f: diff --git a/tests/lib/configuration_helpers.py b/tests/lib/configuration_helpers.py index 5bb2b6316..1164be8a7 100644 --- a/tests/lib/configuration_helpers.py +++ b/tests/lib/configuration_helpers.py @@ -7,17 +7,19 @@ import os import tempfile import textwrap -import pip.configuration -from pip.utils import ensure_dir +import pip._internal.configuration +from pip._internal.utils.misc import ensure_dir # This is so that tests don't need to import pip.configuration -kinds = pip.configuration.kinds +kinds = pip._internal.configuration.kinds class ConfigurationMixin(object): def setup(self): - self.configuration = pip.configuration.Configuration(isolated=False) + self.configuration = pip._internal.configuration.Configuration( + isolated=False, + ) self._files_to_clear = [] self._old_environ = os.environ.copy() diff --git a/tests/lib/local_repos.py b/tests/lib/local_repos.py index 39aed6950..54a330bb2 100644 --- a/tests/lib/local_repos.py +++ b/tests/lib/local_repos.py @@ -5,7 +5,7 @@ import subprocess from pip._vendor.six.moves.urllib import request as urllib_request -from pip.vcs import bazaar, git, mercurial, subversion +from pip._internal.vcs import bazaar, git, mercurial, subversion from tests.lib import path_to_url if hasattr(subprocess, "check_call"): diff --git a/tests/lib/options_helpers.py b/tests/lib/options_helpers.py index f82518756..fef74d3ae 100644 --- a/tests/lib/options_helpers.py +++ b/tests/lib/options_helpers.py @@ -3,9 +3,9 @@ import os -from pip import cmdoptions -from pip.basecommand import Command -from pip.commands import commands_dict +from pip._internal import cmdoptions +from pip._internal.basecommand import Command +from pip._internal.commands import commands_dict class FakeCommand(Command): diff --git a/tests/lib/test_lib.py b/tests/lib/test_lib.py index a5021b1c6..239190ed4 100644 --- a/tests/lib/test_lib.py +++ b/tests/lib/test_lib.py @@ -30,13 +30,12 @@ def test_correct_pip_version(script): # compare the directory tree of the invoked pip with that of this source # distribution - dir = re.match( + pip_folder_outputed = re.match( r'pip \d+(\.[\d]+)+(\.?(rc|dev|pre|post)\d+)? from (.*) ' r'\(python \d(.[\d])+\)$', result.stdout ).group(4) - pip_folder = join(SRC_DIR, 'pip') - pip_folder_outputed = join(dir, 'pip') + pip_folder = join(SRC_DIR, 'src', 'pip') diffs = filecmp.dircmp(pip_folder, pip_folder_outputed) @@ -58,5 +57,5 @@ def test_as_import(script): """ test that pip.__init__.py does not shadow the command submodule with a dictionary """ - import pip.commands.install as inst + import pip._internal.commands.install as inst assert inst is not None diff --git a/tests/scripts/test_all_pip.py b/tests/scripts/test_all_pip.py index 66a8e405e..2b3e9b1dd 100644 --- a/tests/scripts/test_all_pip.py +++ b/tests/scripts/test_all_pip.py @@ -6,7 +6,7 @@ from os.path import abspath, dirname from pip._vendor.six.moves.urllib import request as urllib_request -from pip.utils import rmtree +from pip._internal.utils.misc import rmtree src_folder = dirname(dirname(abspath(__file__))) diff --git a/tests/unit/test_appdirs.py b/tests/unit/test_appdirs.py index 570e3b228..0abd3899d 100644 --- a/tests/unit/test_appdirs.py +++ b/tests/unit/test_appdirs.py @@ -5,7 +5,7 @@ import sys import pretend -from pip.utils import appdirs +from pip._internal.utils import appdirs class TestUserCacheDir: @@ -80,7 +80,7 @@ class TestUserCacheDir: assert result_is_str, "user_cache_dir did not return a str" # Test against regression #3463 - from pip import create_main_parser + from pip._internal import create_main_parser create_main_parser().print_help() # This should not crash diff --git a/tests/unit/test_basecommand.py b/tests/unit/test_basecommand.py index 9fa311d40..c234c731c 100644 --- a/tests/unit/test_basecommand.py +++ b/tests/unit/test_basecommand.py @@ -1,6 +1,6 @@ import logging -from pip.basecommand import Command +from pip._internal.basecommand import Command class FakeCommand(Command): diff --git a/tests/unit/test_cache.py b/tests/unit/test_cache.py index 4340f5e20..0f080b657 100644 --- a/tests/unit/test_cache.py +++ b/tests/unit/test_cache.py @@ -1,5 +1,5 @@ -from pip.cache import WheelCache -from pip.compat import expanduser +from pip._internal.cache import WheelCache +from pip._internal.compat import expanduser class TestWheelCache: diff --git a/tests/unit/test_cmdoptions.py b/tests/unit/test_cmdoptions.py index 60d5c9629..6cbecbc31 100644 --- a/tests/unit/test_cmdoptions.py +++ b/tests/unit/test_cmdoptions.py @@ -1,6 +1,5 @@ -import pip -from pip import cmdoptions -from pip.basecommand import Command +from pip._internal import cmdoptions, index +from pip._internal.basecommand import Command class SimpleCommand(Command): @@ -19,21 +18,21 @@ class SimpleCommand(Command): def test_no_binary_overrides(): cmd = SimpleCommand() cmd.main(['fake', '--only-binary=:all:', '--no-binary=fred']) - expected = pip.index.FormatControl(set(['fred']), set([':all:'])) + expected = index.FormatControl(set(['fred']), set([':all:'])) assert cmd.options.format_control == expected def test_only_binary_overrides(): cmd = SimpleCommand() cmd.main(['fake', '--no-binary=:all:', '--only-binary=fred']) - expected = pip.index.FormatControl(set([':all:']), set(['fred'])) + expected = index.FormatControl(set([':all:']), set(['fred'])) assert cmd.options.format_control == expected def test_none_resets(): cmd = SimpleCommand() cmd.main(['fake', '--no-binary=:all:', '--no-binary=:none:']) - expected = pip.index.FormatControl(set([]), set([])) + expected = index.FormatControl(set([]), set([])) assert cmd.options.format_control == expected @@ -42,12 +41,12 @@ def test_none_preserves_other_side(): cmd.main( ['fake', '--no-binary=:all:', '--only-binary=fred', '--no-binary=:none:']) - expected = pip.index.FormatControl(set([]), set(['fred'])) + expected = index.FormatControl(set([]), set(['fred'])) assert cmd.options.format_control == expected def test_comma_separated_values(): cmd = SimpleCommand() cmd.main(['fake', '--no-binary=1,2,3']) - expected = pip.index.FormatControl(set(['1', '2', '3']), set([])) + expected = index.FormatControl(set(['1', '2', '3']), set([])) assert cmd.options.format_control == expected diff --git a/tests/unit/test_compat.py b/tests/unit/test_compat.py index 9e28971ca..5200fa252 100644 --- a/tests/unit/test_compat.py +++ b/tests/unit/test_compat.py @@ -3,8 +3,10 @@ import os import pytest -import pip.compat -from pip.compat import console_to_str, expanduser, get_path_uid, native_str +import pip._internal.compat +from pip._internal.compat import ( + console_to_str, expanduser, get_path_uid, native_str +) def test_get_path_uid(): @@ -62,7 +64,7 @@ def test_console_to_str_warning(monkeypatch): "Subprocess output does not appear to be encoded as") monkeypatch.setattr(locale, 'getpreferredencoding', lambda: 'utf-8') - monkeypatch.setattr(pip.compat.logger, 'warning', check_warning) + monkeypatch.setattr(pip._internal.compat.logger, 'warning', check_warning) console_to_str(some_bytes) diff --git a/tests/unit/test_configuration.py b/tests/unit/test_configuration.py index 33f075861..815b3c5e4 100644 --- a/tests/unit/test_configuration.py +++ b/tests/unit/test_configuration.py @@ -6,8 +6,10 @@ import os import pytest from mock import MagicMock -from pip.exceptions import ConfigurationError -from pip.locations import new_config_file, site_config_files, venv_config_file +from pip._internal.exceptions import ConfigurationError +from pip._internal.locations import ( + new_config_file, site_config_files, venv_config_file +) from tests.lib.configuration_helpers import ConfigurationMixin, kinds diff --git a/tests/unit/test_download.py b/tests/unit/test_download.py index c9b243fbb..29be13968 100644 --- a/tests/unit/test_download.py +++ b/tests/unit/test_download.py @@ -9,13 +9,13 @@ from mock import Mock, patch from pip._vendor.six.moves.urllib import request as urllib_request import pip -from pip.download import ( +from pip._internal.download import ( MultiDomainBasicAuth, PipSession, SafeFileCache, path_to_url, unpack_file_url, unpack_http_url, url_to_path ) -from pip.exceptions import HashMismatch -from pip.index import Link -from pip.utils.hashes import Hashes +from pip._internal.exceptions import HashMismatch +from pip._internal.index import Link +from pip._internal.utils.hashes import Hashes from tests.lib import create_file @@ -75,7 +75,7 @@ class MockResponse(object): pass -@patch('pip.download.unpack_file') +@patch('pip._internal.download.unpack_file') def test_unpack_http_url_bad_downloaded_checksum(mock_unpack_file): """ If already-downloaded file has bad checksum, re-download. @@ -255,8 +255,8 @@ class Test_unpack_file_url(object): class TestSafeFileCache: """ The no_perms test are useless on Windows since SafeFileCache uses - pip.utils.filesystem.check_path_owner which is based on os.geteuid - which is absent on Windows. + pip._internal.utils.filesystem.check_path_owner which is based on + os.geteuid which is absent on Windows. """ def test_cache_roundtrip(self, tmpdir): diff --git a/tests/unit/test_finder.py b/tests/unit/test_finder.py index 7cfb6d480..123ff7b7d 100644 --- a/tests/unit/test_finder.py +++ b/tests/unit/test_finder.py @@ -4,14 +4,16 @@ import pytest from mock import Mock, patch from pkg_resources import Distribution, parse_version -import pip.pep425tags -import pip.wheel -from pip.download import PipSession -from pip.exceptions import BestVersionAlreadyInstalled, DistributionNotFound -from pip.index import ( +import pip._internal.pep425tags +import pip._internal.wheel +from pip._internal.download import PipSession +from pip._internal.exceptions import ( + BestVersionAlreadyInstalled, DistributionNotFound +) +from pip._internal.index import ( FormatControl, InstallationCandidate, Link, PackageFinder, fmt_ctl_formats ) -from pip.req import InstallRequirement +from pip._internal.req import InstallRequirement def test_no_mpkg(data): @@ -35,7 +37,7 @@ def test_no_partial_name_match(data): def test_tilde(data): """Finder can accept a path with ~ in it and will normalize it.""" session = PipSession() - with patch('pip.index.os.path.exists', return_value=True): + with patch('pip._internal.index.os.path.exists', return_value=True): finder = PackageFinder(['~/python-pkgs'], [], session=session) req = InstallRequirement.from_line("gmpy") with pytest.raises(DistributionNotFound): @@ -138,9 +140,9 @@ class TestWheel: Test not finding an unsupported wheel. """ monkeypatch.setattr( - pip.pep425tags, - "supported_tags", - [('py1', 'none', 'any')], + pip._internal.pep425tags, + "get_supported", + lambda **kw: [("py1", "none", "any")], ) req = InstallRequirement.from_line("simple.dist") @@ -149,7 +151,7 @@ class TestWheel: [], session=PipSession(), ) - finder.valid_tags = pip.pep425tags.supported_tags + finder.valid_tags = pip._internal.pep425tags.get_supported() with pytest.raises(DistributionNotFound): finder.find_requirement(req, True) @@ -159,9 +161,9 @@ class TestWheel: Test finding supported wheel. """ monkeypatch.setattr( - pip.pep425tags, - "supported_tags", - [('py2', 'none', 'any')], + pip._internal.pep425tags, + "get_supported", + lambda **kw: [('py2', 'none', 'any')], ) req = InstallRequirement.from_line("simple.dist") @@ -497,7 +499,7 @@ class test_link_package_versions(object): # patch this for travis which has distribute in its base env for now @patch( - 'pip.wheel.pkg_resources.get_distribution', + 'pip._internal.wheel.pkg_resources.get_distribution', lambda x: Distribution(project_name='setuptools', version='0.9') ) def setup(self): diff --git a/tests/unit/test_index.py b/tests/unit/test_index.py index ec3059c98..6a5159053 100644 --- a/tests/unit/test_index.py +++ b/tests/unit/test_index.py @@ -2,8 +2,8 @@ import os.path import pytest -from pip.download import PipSession -from pip.index import HTMLPage, Link, PackageFinder +from pip._internal.download import PipSession +from pip._internal.index import HTMLPage, Link, PackageFinder def test_sort_locations_file_expand_dir(data): diff --git a/tests/unit/test_locations.py b/tests/unit/test_locations.py index 8e9e391b5..5bdfb8e6f 100644 --- a/tests/unit/test_locations.py +++ b/tests/unit/test_locations.py @@ -10,7 +10,7 @@ import tempfile from mock import Mock -from pip.locations import distutils_scheme +from pip._internal.locations import distutils_scheme if sys.platform == 'win32': pwd = Mock() diff --git a/tests/unit/test_options.py b/tests/unit/test_options.py index 45fd75d07..b6a1bf854 100644 --- a/tests/unit/test_options.py +++ b/tests/unit/test_options.py @@ -2,8 +2,8 @@ import os import pytest -import pip.configuration -from pip import main +import pip._internal.configuration +from pip._internal import main from tests.lib.options_helpers import AddFakeCommandMixin @@ -188,18 +188,18 @@ class TestOptionsConfigFiles(object): def test_venv_config_file_found(self, monkeypatch): # strict limit on the site_config_files list monkeypatch.setattr( - pip.configuration, 'site_config_files', ['/a/place'] + pip._internal.configuration, 'site_config_files', ['/a/place'] ) # If we are running in a virtualenv and all files appear to exist, # we should see two config files. monkeypatch.setattr( - pip.configuration, + pip._internal.configuration, 'running_under_virtualenv', lambda: True, ) monkeypatch.setattr(os.path, 'exists', lambda filename: True) - cp = pip.configuration.Configuration(isolated=False) + cp = pip._internal.configuration.Configuration(isolated=False) files = [] for _, val in cp._iter_config_files(): diff --git a/tests/unit/test_pep425tags.py b/tests/unit/test_pep425tags.py index 3bc3068da..d55353adb 100644 --- a/tests/unit/test_pep425tags.py +++ b/tests/unit/test_pep425tags.py @@ -2,7 +2,7 @@ import sys from mock import patch -from pip import pep425tags +from pip._internal import pep425tags class TestPEP425Tags(object): @@ -11,9 +11,9 @@ class TestPEP425Tags(object): """ Patch sysconfig.get_config_var for arbitrary keys. """ - import pip.pep425tags + import pip._internal.pep425tags - get_config_var = pip.pep425tags.sysconfig.get_config_var + get_config_var = pip._internal.pep425tags.sysconfig.get_config_var def _mock_get_config_var(var): if var in kwd: @@ -25,22 +25,25 @@ class TestPEP425Tags(object): """ Used to test ABI tags, verify correct use of the `u` flag """ - import pip.pep425tags + import pip._internal.pep425tags config_vars.update({'SOABI': None}) - base = pip.pep425tags.get_abbr_impl() + pip.pep425tags.get_impl_ver() + base = pip._internal.pep425tags.get_abbr_impl() + \ + pip._internal.pep425tags.get_impl_ver() if sys.version_info < (3, 3): config_vars.update({'Py_UNICODE_SIZE': 2}) mock_gcf = self.mock_get_config_var(**config_vars) - with patch('pip.pep425tags.sysconfig.get_config_var', mock_gcf): - abi_tag = pip.pep425tags.get_abi_tag() + with patch('pip._internal.pep425tags.sysconfig.get_config_var', + mock_gcf): + abi_tag = pip._internal.pep425tags.get_abi_tag() assert abi_tag == base + flags config_vars.update({'Py_UNICODE_SIZE': 4}) mock_gcf = self.mock_get_config_var(**config_vars) - with patch('pip.pep425tags.sysconfig.get_config_var', mock_gcf): - abi_tag = pip.pep425tags.get_abi_tag() + with patch('pip._internal.pep425tags.sysconfig.get_config_var', + mock_gcf): + abi_tag = pip._internal.pep425tags.get_abi_tag() assert abi_tag == base + flags + 'u' else: @@ -49,8 +52,9 @@ class TestPEP425Tags(object): # the 'u' so manual SOABI detection should not do so either. config_vars.update({'Py_UNICODE_SIZE': None}) mock_gcf = self.mock_get_config_var(**config_vars) - with patch('pip.pep425tags.sysconfig.get_config_var', mock_gcf): - abi_tag = pip.pep425tags.get_abi_tag() + with patch('pip._internal.pep425tags.sysconfig.get_config_var', + mock_gcf): + abi_tag = pip._internal.pep425tags.get_abi_tag() assert abi_tag == base + flags def test_broken_sysconfig(self): @@ -59,24 +63,26 @@ class TestPEP425Tags(object): Can be a problem on Python 2.7 Issue #1074. """ - import pip.pep425tags + import pip._internal.pep425tags def raises_ioerror(var): raise IOError("I have the wrong path!") - with patch('pip.pep425tags.sysconfig.get_config_var', raises_ioerror): - assert len(pip.pep425tags.get_supported()) + with patch('pip._internal.pep425tags.sysconfig.get_config_var', + raises_ioerror): + assert len(pip._internal.pep425tags.get_supported()) def test_no_hyphen_tag(self): """ Test that no tag contains a hyphen. """ - import pip.pep425tags + import pip._internal.pep425tags mock_gcf = self.mock_get_config_var(SOABI='cpython-35m-darwin') - with patch('pip.pep425tags.sysconfig.get_config_var', mock_gcf): - supported = pip.pep425tags.get_supported() + with patch('pip._internal.pep425tags.sysconfig.get_config_var', + mock_gcf): + supported = pip._internal.pep425tags.get_supported() for (py, abi, plat) in supported: assert '-' not in py @@ -110,40 +116,45 @@ class TestPEP425Tags(object): class TestManylinux1Tags(object): - @patch('pip.pep425tags.get_platform', lambda: 'linux_x86_64') - @patch('pip.utils.glibc.have_compatible_glibc', lambda major, minor: True) + @patch('pip._internal.pep425tags.get_platform', lambda: 'linux_x86_64') + @patch('pip._internal.utils.glibc.have_compatible_glibc', + lambda major, minor: True) def test_manylinux1_compatible_on_linux_x86_64(self): """ Test that manylinux1 is enabled on linux_x86_64 """ assert pep425tags.is_manylinux1_compatible() - @patch('pip.pep425tags.get_platform', lambda: 'linux_i686') - @patch('pip.utils.glibc.have_compatible_glibc', lambda major, minor: True) + @patch('pip._internal.pep425tags.get_platform', lambda: 'linux_i686') + @patch('pip._internal.utils.glibc.have_compatible_glibc', + lambda major, minor: True) def test_manylinux1_compatible_on_linux_i686(self): """ Test that manylinux1 is enabled on linux_i686 """ assert pep425tags.is_manylinux1_compatible() - @patch('pip.pep425tags.get_platform', lambda: 'linux_x86_64') - @patch('pip.utils.glibc.have_compatible_glibc', lambda major, minor: False) + @patch('pip._internal.pep425tags.get_platform', lambda: 'linux_x86_64') + @patch('pip._internal.utils.glibc.have_compatible_glibc', + lambda major, minor: False) def test_manylinux1_2(self): """ Test that manylinux1 is disabled with incompatible glibc """ assert not pep425tags.is_manylinux1_compatible() - @patch('pip.pep425tags.get_platform', lambda: 'arm6vl') - @patch('pip.utils.glibc.have_compatible_glibc', lambda major, minor: True) + @patch('pip._internal.pep425tags.get_platform', lambda: 'arm6vl') + @patch('pip._internal.utils.glibc.have_compatible_glibc', + lambda major, minor: True) def test_manylinux1_3(self): """ Test that manylinux1 is disabled on arm6vl """ assert not pep425tags.is_manylinux1_compatible() - @patch('pip.pep425tags.get_platform', lambda: 'linux_x86_64') - @patch('pip.utils.glibc.have_compatible_glibc', lambda major, minor: True) + @patch('pip._internal.pep425tags.get_platform', lambda: 'linux_x86_64') + @patch('pip._internal.utils.glibc.have_compatible_glibc', + lambda major, minor: True) @patch('sys.platform', 'linux2') def test_manylinux1_tag_is_first(self): """ diff --git a/tests/unit/test_proxy.py b/tests/unit/test_proxy.py deleted file mode 100644 index c33c8f56e..000000000 --- a/tests/unit/test_proxy.py +++ /dev/null @@ -1,15 +0,0 @@ -""" -Tests for the proxy support in pip. -""" - -import pip -from tests.lib import SRC_DIR -from tests.lib.path import Path - - -def test_correct_pip_version(): - """ - Check we are importing pip from the right place. - - """ - assert Path(pip.__file__).folder.folder.abspath == SRC_DIR diff --git a/tests/unit/test_req.py b/tests/unit/test_req.py index 40ba2cf63..0237b19ca 100644 --- a/tests/unit/test_req.py +++ b/tests/unit/test_req.py @@ -9,18 +9,18 @@ from pip._vendor import pkg_resources from pip._vendor.packaging.markers import Marker from pip._vendor.packaging.requirements import Requirement -from pip.commands.install import InstallCommand -from pip.download import PipSession, path_to_url -from pip.exceptions import ( +from pip._internal.commands.install import InstallCommand +from pip._internal.download import PipSession, path_to_url +from pip._internal.exceptions import ( HashErrors, InstallationError, InvalidWheelFilename, PreviousBuildDirError ) -from pip.index import PackageFinder -from pip.operations.prepare import RequirementPreparer -from pip.req import InstallRequirement, RequirementSet -from pip.req.req_file import process_line -from pip.req.req_install import parse_editable -from pip.resolve import Resolver -from pip.utils import read_text_file +from pip._internal.index import PackageFinder +from pip._internal.operations.prepare import RequirementPreparer +from pip._internal.req import InstallRequirement, RequirementSet +from pip._internal.req.req_file import process_line +from pip._internal.req.req_install import parse_editable +from pip._internal.resolve import Resolver +from pip._internal.utils.misc import read_text_file from tests.lib import assert_raises_regexp, requirements_file @@ -306,7 +306,7 @@ def test_egg_info_data(file_contents, expected): om = mock_open(read_data=file_contents) em = Mock() em.return_value = 'cp1252' - with patch('pip.utils.open', om, create=True): + with patch('pip._internal.utils.misc.open', om, create=True): with patch('locale.getpreferredencoding', em): ret = read_text_file('foo') assert ret == expected.decode('utf-8') @@ -547,9 +547,9 @@ class TestInstallRequirement(object): assert "If that is the case, use the '-r' flag to install" in err_msg -@patch('pip.req.req_install.os.path.abspath') -@patch('pip.req.req_install.os.path.exists') -@patch('pip.req.req_install.os.path.isdir') +@patch('pip._internal.req.req_install.os.path.abspath') +@patch('pip._internal.req.req_install.os.path.exists') +@patch('pip._internal.req.req_install.os.path.isdir') def test_parse_editable_local( isdir_mock, exists_mock, abspath_mock): exists_mock.return_value = isdir_mock.return_value = True @@ -578,9 +578,9 @@ def test_parse_editable_vcs_extras(): ) -@patch('pip.req.req_install.os.path.abspath') -@patch('pip.req.req_install.os.path.exists') -@patch('pip.req.req_install.os.path.isdir') +@patch('pip._internal.req.req_install.os.path.abspath') +@patch('pip._internal.req.req_install.os.path.exists') +@patch('pip._internal.req.req_install.os.path.isdir') def test_parse_editable_local_extras( isdir_mock, exists_mock, abspath_mock): exists_mock.return_value = isdir_mock.return_value = True diff --git a/tests/unit/test_req_file.py b/tests/unit/test_req_file.py index b379f501e..8b83b641c 100644 --- a/tests/unit/test_req_file.py +++ b/tests/unit/test_req_file.py @@ -6,15 +6,17 @@ import pytest from mock import Mock, patch from pretend import stub -import pip -from pip.download import PipSession -from pip.exceptions import InstallationError, RequirementsFileParseError -from pip.index import PackageFinder -from pip.req.req_file import ( +import pip._internal.index +from pip._internal.download import PipSession +from pip._internal.exceptions import ( + InstallationError, RequirementsFileParseError +) +from pip._internal.index import PackageFinder +from pip._internal.req.req_file import ( break_args_options, ignore_comments, join_lines, parse_requirements, preprocess, process_line, skip_regex ) -from pip.req.req_install import InstallRequirement +from pip._internal.req.req_install import InstallRequirement from tests.lib import requirements_file @@ -33,7 +35,7 @@ def options(session): return stub( isolated_mode=False, index_url='default_url', skip_requirements_regex=False, - format_control=pip.index.FormatControl(set(), set())) + format_control=pip._internal.index.FormatControl(set(), set())) class TestPreprocess(object): @@ -233,26 +235,26 @@ class TestProcessLine(object): def test_nested_requirements_file(self, monkeypatch): line = '-r another_file' req = InstallRequirement.from_line('SomeProject') - import pip.req.req_file + import pip._internal.req.req_file def stub_parse_requirements(req_url, finder, comes_from, options, session, wheel_cache, constraint): return [(req, constraint)] parse_requirements_stub = stub(call=stub_parse_requirements) - monkeypatch.setattr(pip.req.req_file, 'parse_requirements', + monkeypatch.setattr(pip._internal.req.req_file, 'parse_requirements', parse_requirements_stub.call) assert list(process_line(line, 'filename', 1)) == [(req, False)] def test_nested_constraints_file(self, monkeypatch): line = '-c another_file' req = InstallRequirement.from_line('SomeProject') - import pip.req.req_file + import pip._internal.req.req_file def stub_parse_requirements(req_url, finder, comes_from, options, session, wheel_cache, constraint): return [(req, constraint)] parse_requirements_stub = stub(call=stub_parse_requirements) - monkeypatch.setattr(pip.req.req_file, 'parse_requirements', + monkeypatch.setattr(pip._internal.req.req_file, 'parse_requirements', parse_requirements_stub.call) assert list(process_line(line, 'filename', 1)) == [(req, True)] @@ -353,7 +355,8 @@ class TestProcessLine(object): return iter([]) mock_parse = Mock() mock_parse.side_effect = parse - monkeypatch.setattr(pip.req.req_file, 'parse_requirements', mock_parse) + monkeypatch.setattr(pip._internal.req.req_file, 'parse_requirements', + mock_parse) list(process_line("-r reqs.txt", req_file, 1, finder=finder)) call = mock_parse.mock_calls[0] assert call[1][0] == 'http://me.com/me/reqs.txt' @@ -368,7 +371,8 @@ class TestProcessLine(object): return iter([]) mock_parse = Mock() mock_parse.side_effect = parse - monkeypatch.setattr(pip.req.req_file, 'parse_requirements', mock_parse) + monkeypatch.setattr(pip._internal.req.req_file, 'parse_requirements', + mock_parse) list(process_line("-r reqs.txt", req_file, 1, finder=finder)) call = mock_parse.mock_calls[0] assert call[1][0] == os.path.normpath('/path/reqs.txt') @@ -383,7 +387,8 @@ class TestProcessLine(object): return iter([]) mock_parse = Mock() mock_parse.side_effect = parse - monkeypatch.setattr(pip.req.req_file, 'parse_requirements', mock_parse) + monkeypatch.setattr(pip._internal.req.req_file, 'parse_requirements', + mock_parse) list(process_line("-r /other/reqs.txt", req_file, 1, finder=finder)) call = mock_parse.mock_calls[0] assert call[1][0] == '/other/reqs.txt' @@ -398,7 +403,8 @@ class TestProcessLine(object): return iter([]) mock_parse = Mock() mock_parse.side_effect = parse - monkeypatch.setattr(pip.req.req_file, 'parse_requirements', mock_parse) + monkeypatch.setattr(pip._internal.req.req_file, 'parse_requirements', + mock_parse) list(process_line("-r http://me.com/me/reqs.txt", req_file, 1, finder=finder)) call = mock_parse.mock_calls[0] @@ -502,7 +508,8 @@ class TestParseRequirements(object): list(parse_requirements( data.reqfiles.join("supported_options2.txt"), finder, session=PipSession())) - expected = pip.index.FormatControl(set(['fred']), set(['wilma'])) + expected = pip._internal.index.FormatControl( + set(['fred']), set(['wilma'])) assert finder.format_control == expected def test_req_file_parse_comment_start_of_line(self, tmpdir, finder): diff --git a/tests/unit/test_req_install.py b/tests/unit/test_req_install.py index 28f1cbdd4..17af7d5f5 100644 --- a/tests/unit/test_req_install.py +++ b/tests/unit/test_req_install.py @@ -3,7 +3,7 @@ import tempfile import pytest -from pip.req.req_install import InstallRequirement +from pip._internal.req.req_install import InstallRequirement class TestInstallRequirementBuildDirectory(object): diff --git a/tests/unit/test_req_uninstall.py b/tests/unit/test_req_uninstall.py index 6f1878d80..960d600c2 100644 --- a/tests/unit/test_req_uninstall.py +++ b/tests/unit/test_req_uninstall.py @@ -3,8 +3,8 @@ import os import pytest from mock import Mock -import pip.req.req_uninstall -from pip.req.req_uninstall import ( +import pip._internal.req.req_uninstall +from pip._internal.req.req_uninstall import ( UninstallPathSet, compact, compress_for_output_listing, uninstallation_paths ) @@ -95,7 +95,8 @@ def test_compressed_listing(tmpdir): class TestUninstallPathSet(object): def test_add(self, tmpdir, monkeypatch): - monkeypatch.setattr(pip.req.req_uninstall, 'is_local', mock_is_local) + monkeypatch.setattr(pip._internal.req.req_uninstall, 'is_local', + mock_is_local) # Fix case for windows tests file_extant = os.path.normcase(os.path.join(tmpdir, 'foo')) file_nonexistent = os.path.normcase( @@ -113,7 +114,8 @@ class TestUninstallPathSet(object): @pytest.mark.skipif("sys.platform == 'win32'") def test_add_symlink(self, tmpdir, monkeypatch): - monkeypatch.setattr(pip.req.req_uninstall, 'is_local', mock_is_local) + monkeypatch.setattr(pip._internal.req.req_uninstall, 'is_local', + mock_is_local) f = os.path.join(tmpdir, 'foo') with open(f, 'w'): pass @@ -125,7 +127,8 @@ class TestUninstallPathSet(object): assert ups.paths == set([l]) def test_compact_shorter_path(self, monkeypatch): - monkeypatch.setattr(pip.req.req_uninstall, 'is_local', lambda p: True) + monkeypatch.setattr(pip._internal.req.req_uninstall, 'is_local', + lambda p: True) monkeypatch.setattr('os.path.exists', lambda p: True) # This deals with nt/posix path differences short_path = os.path.normcase(os.path.abspath( @@ -137,7 +140,8 @@ class TestUninstallPathSet(object): @pytest.mark.skipif("sys.platform == 'win32'") def test_detect_symlink_dirs(self, monkeypatch, tmpdir): - monkeypatch.setattr(pip.req.req_uninstall, 'is_local', lambda p: True) + monkeypatch.setattr(pip._internal.req.req_uninstall, 'is_local', + lambda p: True) # construct 2 paths: # tmpdir/dir/file diff --git a/tests/unit/test_unit_outdated.py b/tests/unit/test_unit_outdated.py index 1276952db..c21d408f6 100644 --- a/tests/unit/test_unit_outdated.py +++ b/tests/unit/test_unit_outdated.py @@ -8,8 +8,8 @@ import pretend import pytest from pip._vendor import lockfile -from pip.index import InstallationCandidate -from pip.utils import outdated +from pip._internal.index import InstallationCandidate +from pip._internal.utils import outdated class MockPackageFinder(object): diff --git a/tests/unit/test_utils.py b/tests/unit/test_utils.py index e2f446c38..9ab2e81c0 100644 --- a/tests/unit/test_utils.py +++ b/tests/unit/test_utils.py @@ -16,18 +16,18 @@ import pytest from mock import Mock, patch from pip._vendor.six import BytesIO -from pip.exceptions import ( +from pip._internal.exceptions import ( HashMismatch, HashMissing, InstallationError, UnsupportedPythonVersion ) -from pip.utils import ( +from pip._internal.utils.encoding import auto_decode +from pip._internal.utils.glibc import check_glibc_version +from pip._internal.utils.hashes import Hashes, MissingHashes +from pip._internal.utils.misc import ( egg_link_path, ensure_dir, get_installed_distributions, normalize_path, rmtree, untar_file, unzip_file ) -from pip.utils.encoding import auto_decode -from pip.utils.glibc import check_glibc_version -from pip.utils.hashes import Hashes, MissingHashes -from pip.utils.packaging import check_dist_requires_python -from pip.utils.temp_dir import TempDirectory +from pip._internal.utils.packaging import check_dist_requires_python +from pip._internal.utils.temp_dir import TempDirectory class Tests_EgglinkPath: @@ -50,7 +50,7 @@ class Tests_EgglinkPath: ) # patches - from pip import utils + from pip._internal.utils import misc as utils self.old_site_packages = utils.site_packages self.mock_site_packages = utils.site_packages = 'SITE_PACKAGES' self.old_running_under_virtualenv = utils.running_under_virtualenv @@ -65,7 +65,7 @@ class Tests_EgglinkPath: self.mock_isfile = path.isfile = Mock() def teardown(self): - from pip import utils + from pip._internal.utils import misc as utils utils.site_packages = self.old_site_packages utils.running_under_virtualenv = self.old_running_under_virtualenv utils.virtualenv_no_global = self.old_virtualenv_no_global @@ -164,9 +164,9 @@ class Tests_EgglinkPath: assert egg_link_path(self.mock_dist) is None -@patch('pip.utils.dist_in_usersite') -@patch('pip.utils.dist_is_local') -@patch('pip.utils.dist_is_editable') +@patch('pip._internal.utils.misc.dist_in_usersite') +@patch('pip._internal.utils.misc.dist_is_local') +@patch('pip._internal.utils.misc.dist_is_editable') class Tests_get_installed_distributions: """test util.get_installed_distributions""" @@ -351,7 +351,7 @@ class Failer: def test_rmtree_retries(tmpdir, monkeypatch): """ - Test pip.utils.rmtree will retry failures + Test pip._internal.utils.rmtree will retry failures """ monkeypatch.setattr(shutil, 'rmtree', Failer(duration=1).call) rmtree('foo') @@ -359,7 +359,7 @@ def test_rmtree_retries(tmpdir, monkeypatch): def test_rmtree_retries_for_3sec(tmpdir, monkeypatch): """ - Test pip.utils.rmtree will retry failures for no more than 3 sec + Test pip._internal.utils.rmtree will retry failures for no more than 3 sec """ monkeypatch.setattr(shutil, 'rmtree', Failer(duration=5).call) with pytest.raises(OSError): @@ -404,7 +404,7 @@ class Test_normalize_path(object): class TestHashes(object): - """Tests for pip.utils.hashes""" + """Tests for pip._internal.utils.hashes""" def test_success(self, tmpdir): """Make sure no error is raised when at least one hash matches. @@ -448,7 +448,7 @@ class TestHashes(object): class TestEncoding(object): - """Tests for pip.utils.encoding""" + """Tests for pip._internal.utils.encoding""" def test_auto_decode_utf16_le(self): data = ( diff --git a/tests/unit/test_vcs.py b/tests/unit/test_vcs.py index d119d2903..ab041379c 100644 --- a/tests/unit/test_vcs.py +++ b/tests/unit/test_vcs.py @@ -2,10 +2,10 @@ import pytest from mock import Mock from pip._vendor.packaging.version import parse as parse_version -from pip.vcs import VersionControl -from pip.vcs.bazaar import Bazaar -from pip.vcs.git import Git -from pip.vcs.subversion import Subversion +from pip._internal.vcs import VersionControl +from pip._internal.vcs.bazaar import Bazaar +from pip._internal.vcs.git import Git +from pip._internal.vcs.subversion import Subversion from tests.lib import pyversion if pyversion >= '3': diff --git a/tests/unit/test_wheel.py b/tests/unit/test_wheel.py index b75de70e2..6a3594135 100644 --- a/tests/unit/test_wheel.py +++ b/tests/unit/test_wheel.py @@ -5,16 +5,17 @@ import pytest from mock import Mock, patch from pip._vendor.packaging.requirements import Requirement -from pip import pep425tags, wheel -from pip.compat import WINDOWS -from pip.exceptions import InvalidWheelFilename, UnsupportedWheel -from pip.utils import unpack_file +from pip._internal import pep425tags, wheel +from pip._internal.compat import WINDOWS +from pip._internal.exceptions import InvalidWheelFilename, UnsupportedWheel +from pip._internal.utils.misc import unpack_file from tests.lib import DATA_DIR @pytest.mark.parametrize("console_scripts", - ["pip = pip.main:pip", "pip:pip = pip.main:pip"]) + ["pip = pip._internal.main:pip", + "pip:pip = pip._internal.main:pip"]) def test_get_entrypoints(tmpdir, console_scripts): entry_points = tmpdir.join("entry_points.txt") with open(str(entry_points), "w") as fp: @@ -136,8 +137,9 @@ class TestWheelFile(object): assert not w.supported(tags=[('py1', 'none', 'any')]) @patch('sys.platform', 'darwin') - @patch('pip.pep425tags.get_abbr_impl', lambda: 'cp') - @patch('pip.pep425tags.get_platform', lambda: 'macosx_10_9_intel') + @patch('pip._internal.pep425tags.get_abbr_impl', lambda: 'cp') + @patch('pip._internal.pep425tags.get_platform', + lambda: 'macosx_10_9_intel') def test_supported_osx_version(self): """ Wheels built for macOS 10.6 are supported on 10.9 @@ -149,8 +151,9 @@ class TestWheelFile(object): assert w.supported(tags=tags) @patch('sys.platform', 'darwin') - @patch('pip.pep425tags.get_abbr_impl', lambda: 'cp') - @patch('pip.pep425tags.get_platform', lambda: 'macosx_10_6_intel') + @patch('pip._internal.pep425tags.get_abbr_impl', lambda: 'cp') + @patch('pip._internal.pep425tags.get_platform', + lambda: 'macosx_10_6_intel') def test_not_supported_osx_version(self): """ Wheels built for macOS 10.9 are not supported on 10.6 @@ -160,27 +163,27 @@ class TestWheelFile(object): assert not w.supported(tags=tags) @patch('sys.platform', 'darwin') - @patch('pip.pep425tags.get_abbr_impl', lambda: 'cp') + @patch('pip._internal.pep425tags.get_abbr_impl', lambda: 'cp') def test_supported_multiarch_darwin(self): """ Multi-arch wheels (intel) are supported on components (i386, x86_64) """ - with patch('pip.pep425tags.get_platform', + with patch('pip._internal.pep425tags.get_platform', lambda: 'macosx_10_5_universal'): universal = pep425tags.get_supported(['27'], False) - with patch('pip.pep425tags.get_platform', + with patch('pip._internal.pep425tags.get_platform', lambda: 'macosx_10_5_intel'): intel = pep425tags.get_supported(['27'], False) - with patch('pip.pep425tags.get_platform', + with patch('pip._internal.pep425tags.get_platform', lambda: 'macosx_10_5_x86_64'): x64 = pep425tags.get_supported(['27'], False) - with patch('pip.pep425tags.get_platform', + with patch('pip._internal.pep425tags.get_platform', lambda: 'macosx_10_5_i386'): i386 = pep425tags.get_supported(['27'], False) - with patch('pip.pep425tags.get_platform', + with patch('pip._internal.pep425tags.get_platform', lambda: 'macosx_10_5_ppc'): ppc = pep425tags.get_supported(['27'], False) - with patch('pip.pep425tags.get_platform', + with patch('pip._internal.pep425tags.get_platform', lambda: 'macosx_10_5_ppc64'): ppc64 = pep425tags.get_supported(['27'], False) @@ -200,15 +203,15 @@ class TestWheelFile(object): assert w.supported(tags=ppc64) @patch('sys.platform', 'darwin') - @patch('pip.pep425tags.get_abbr_impl', lambda: 'cp') + @patch('pip._internal.pep425tags.get_abbr_impl', lambda: 'cp') def test_not_supported_multiarch_darwin(self): """ Single-arch wheels (x86_64) are not supported on multi-arch (intel) """ - with patch('pip.pep425tags.get_platform', + with patch('pip._internal.pep425tags.get_platform', lambda: 'macosx_10_5_universal'): universal = pep425tags.get_supported(['27'], False) - with patch('pip.pep425tags.get_platform', + with patch('pip._internal.pep425tags.get_platform', lambda: 'macosx_10_5_intel'): intel = pep425tags.get_supported(['27'], False) @@ -241,7 +244,7 @@ class TestWheelFile(object): assert w.support_index_min(tags=[]) is None def test_unpack_wheel_no_flatten(self): - from pip import utils + from pip._internal.utils import misc as utils from tempfile import mkdtemp from shutil import rmtree @@ -359,7 +362,8 @@ class TestMoveWheelFiles(object): class TestWheelBuilder(object): def test_skip_building_wheels(self, caplog): - with patch('pip.wheel.WheelBuilder._build_one') as mock_build_one: + with patch('pip._internal.wheel.WheelBuilder._build_one') \ + as mock_build_one: wheel_req = Mock(is_wheel=True, editable=False, constraint=False) reqset = Mock(requirements=Mock(values=lambda: [wheel_req]), wheel_download_dir='/wheel/dir') diff --git a/tox.ini b/tox.ini index 077fedcca..df776e05e 100644 --- a/tox.ini +++ b/tox.ini @@ -33,7 +33,7 @@ deps = isort==4.2.5 commands = flake8 . - isort --recursive --check-only --diff pip tests + isort --recursive --check-only --diff src/pip tests [testenv:lint-py2] basepython = python2 From 8860dc016a1231a444d018b98796df5c2ef17441 Mon Sep 17 00:00:00 2001 From: Donald Stufft Date: Thu, 31 Aug 2017 14:19:13 -0400 Subject: [PATCH 2/2] Remove vendored test support, as it's never worked Since de-vendoring support exists only for downstream, and they need to patch pip to get that support anyways, it seems reasonable to push support for testing that configuration onto them. This is something they need to do anyways, since they need to test their versions of the vendored libraries. See https://github.com/pypa/pip/pull/4657 for more information. --- .travis.yml | 5 ----- .travis/run.sh | 38 -------------------------------------- 2 files changed, 43 deletions(-) diff --git a/.travis.yml b/.travis.yml index 10bcaee6f..b5dba342f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,11 +18,6 @@ matrix: python: 2.7 - env: TOXENV=py36 python: 3.6 - # Unvendored - - env: "TOXENV=py27 VENDOR=no WHEELS=yes" - python: 2.7 - - env: "TOXENV=py36 VENDOR=no WHEELS=yes" - python: 3.6 # All the other Py3 versions - env: TOXENV=py33 python: 3.3 diff --git a/.travis/run.sh b/.travis/run.sh index 94d97eb87..253facc57 100755 --- a/.travis/run.sh +++ b/.travis/run.sh @@ -2,44 +2,6 @@ set -e set -x -# We want to create the virtual environment here, but not actually run anything -tox --notest - -# If we have a VENDOR=no then we want to reinstall pip into the virtual -# environment without the vendor directory included as well as install the -# dependencies we need installed. -if [[ $VENDOR = "no" ]]; then - # Install our dependencies if we're not installing from wheels - if [[ $WHEELS != "yes" ]]; then - .tox/$TOXENV/bin/pip install -r src/pip/_vendor/vendor.txt --no-deps - fi - - # Install our dependencies if we're installing from wheels - if [[ $WHEELS = "yes" ]]; then - mkdir -p /tmp/wheels - pip wheel --wheel-dir /tmp/wheels --no-deps -r src/pip/_vendor/vendor.txt - cp /tmp/wheels/* `echo .tox/$TOXENV/lib/python*/site-packages/pip/_vendor/` - fi - - # Remove the vendored dependencies from within the installed pip inside of - # our installed copy of pip. - find .tox/$TOXENV/lib/python*/site-packages/pip/_vendor -d \ - -not -regex '.*/pip/_vendor/__init__\.py$' \ - -not -regex '.*/pip/_vendor$' \ - -exec rm -rf {} \; - - # Patch our installed pip/_vendor/__init__.py so that it knows to look for - # the vendored dependencies instead of only looking for the vendored. - sed -i 's/DEBUNDLED = False/DEBUNDLED = True/' \ - .tox/$TOXENV/lib/python*/site-packages/pip/_vendor/__init__.py - - # Test to make sure that we successfully installed without vendoring - if [ -f .tox/$TOXENV/lib/python*/site-packages/pip/_vendor/six.py ]; then - echo "Did not successfully unvendor" - exit 1 - fi -fi - if [[ $TOXENV == py* ]]; then # Run unit tests tox -- -m unit