com.googler.python 1.0.7 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +4 -2
- package/python3.4.2/lib/python3.4/site-packages/pip/__init__.py +1 -277
- package/python3.4.2/lib/python3.4/site-packages/pip/__main__.py +19 -7
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/__init__.py +246 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/basecommand.py +373 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/{baseparser.py → _internal/baseparser.py} +240 -224
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/build_env.py +92 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/cache.py +202 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/cmdoptions.py +609 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/__init__.py +79 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/check.py +42 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/completion.py +94 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/configuration.py +227 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/download.py +233 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/freeze.py +96 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/hash.py +57 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/{commands → _internal/commands}/help.py +36 -33
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/install.py +477 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/list.py +343 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/search.py +135 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/show.py +164 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/uninstall.py +71 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/wheel.py +179 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/compat.py +235 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/configuration.py +378 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/download.py +922 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/exceptions.py +249 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/index.py +1117 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/locations.py +194 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/models/__init__.py +4 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/models/index.py +15 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/{_vendor/requests/packages/urllib3/contrib → _internal/operations}/__init__.py +0 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/operations/check.py +106 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/operations/freeze.py +252 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/operations/prepare.py +378 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/pep425tags.py +317 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/req/__init__.py +69 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/req/req_file.py +338 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/req/req_install.py +1115 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/req/req_set.py +164 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/req/req_uninstall.py +455 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/resolve.py +354 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/{status_codes.py → _internal/status_codes.py} +8 -6
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/__init__.py +0 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/appdirs.py +258 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/deprecation.py +77 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/encoding.py +33 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/filesystem.py +28 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/glibc.py +84 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/hashes.py +94 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/logging.py +132 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/misc.py +851 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/outdated.py +163 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/packaging.py +70 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/setuptools_build.py +8 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/temp_dir.py +82 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/typing.py +29 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/ui.py +421 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/vcs/__init__.py +471 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/vcs/bazaar.py +113 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/vcs/git.py +311 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/vcs/mercurial.py +105 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/vcs/subversion.py +271 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/wheel.py +817 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/__init__.py +109 -8
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/appdirs.py +604 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/__init__.py +11 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/_cmd.py +60 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/adapter.py +134 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/cache.py +39 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/caches/__init__.py +2 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/caches/file_cache.py +133 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/caches/redis_cache.py +43 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/compat.py +29 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/controller.py +373 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/filewrapper.py +78 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/heuristics.py +138 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/serialize.py +194 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/wrapper.py +27 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/certifi/__init__.py +3 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/certifi/__main__.py +2 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests → certifi}/cacert.pem +1765 -2358
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/certifi/core.py +37 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/__init__.py +39 -32
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/big5freq.py +386 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/big5prober.py +47 -42
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/chardistribution.py +233 -231
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/charsetgroupprober.py +106 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/charsetprober.py +145 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/cli/__init__.py +1 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/cli/chardetect.py +85 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/codingstatemachine.py +88 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/compat.py +34 -34
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/cp949prober.py +49 -44
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/enums.py +76 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/escprober.py +101 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/escsm.py +246 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/eucjpprober.py +92 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/euckrfreq.py +195 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/euckrprober.py +47 -42
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/euctwfreq.py +387 -428
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/euctwprober.py +46 -41
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/gb2312freq.py +283 -472
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/gb2312prober.py +46 -41
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/hebrewprober.py +292 -283
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/jisfreq.py +325 -569
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/jpcntx.py +233 -219
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/langbulgarianmodel.py +228 -229
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/langcyrillicmodel.py +333 -329
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/langgreekmodel.py +225 -225
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/langhebrewmodel.py +200 -201
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/langhungarianmodel.py +225 -225
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/langthaimodel.py +199 -200
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/langturkishmodel.py +193 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/latin1prober.py +145 -139
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/mbcharsetprober.py +91 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/mbcsgroupprober.py +54 -54
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/mbcssm.py +572 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/sbcharsetprober.py +132 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/sbcsgroupprober.py +73 -69
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/sjisprober.py +92 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/universaldetector.py +286 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/utf8prober.py +82 -76
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/version.py +9 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/colorama/__init__.py +7 -7
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/colorama/ansi.py +102 -50
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/colorama/ansitowin32.py +236 -190
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/colorama/initialise.py +82 -56
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/colorama/win32.py +156 -137
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/colorama/winterm.py +162 -120
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/__init__.py +23 -23
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/_backport/__init__.py +6 -6
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/_backport/misc.py +41 -41
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/_backport/shutil.py +761 -761
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/_backport/sysconfig.cfg +84 -84
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/_backport/sysconfig.py +788 -788
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/_backport/tarfile.py +2607 -2607
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/compat.py +1117 -1064
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/database.py +1318 -1301
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/index.py +516 -488
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/locators.py +1292 -1194
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/manifest.py +393 -364
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/markers.py +131 -190
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/metadata.py +1068 -1026
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/resources.py +355 -317
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/scripts.py +415 -323
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/t32.exe +0 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/t64.exe +0 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/util.py +1755 -1575
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/version.py +736 -721
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/w32.exe +0 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/w64.exe +0 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/wheel.py +984 -958
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distro.py +1104 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/__init__.py +35 -23
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/{ihatexml.py → _ihatexml.py} +288 -285
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/{inputstream.py → _inputstream.py} +923 -881
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/{tokenizer.py → _tokenizer.py} +1721 -1731
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/{trie → _trie}/__init__.py +14 -12
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/{trie → _trie}/_base.py +37 -37
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/{trie → _trie}/datrie.py +44 -44
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/{trie → _trie}/py.py +67 -67
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/{utils.py → _utils.py} +124 -82
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/constants.py +2947 -3104
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/filters/alphabeticalattributes.py +29 -20
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/filters/{_base.py → base.py} +12 -12
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/filters/inject_meta_charset.py +73 -65
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/filters/lint.py +93 -93
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/filters/optionaltags.py +207 -205
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/filters/sanitizer.py +896 -12
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/filters/whitespace.py +38 -38
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/html5parser.py +2791 -2713
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/serializer.py +409 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treeadapters/__init__.py +30 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treeadapters/genshi.py +54 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treeadapters/sax.py +50 -44
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treebuilders/__init__.py +88 -76
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treebuilders/{_base.py → base.py} +417 -377
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treebuilders/dom.py +236 -227
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treebuilders/etree.py +340 -337
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.py +366 -369
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treewalkers/__init__.py +154 -57
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treewalkers/{_base.py → base.py} +252 -200
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treewalkers/dom.py +43 -46
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treewalkers/etree.py +130 -138
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treewalkers/{lxmletree.py → etree_lxml.py} +213 -208
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treewalkers/{genshistream.py → genshi.py} +69 -69
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/idna/__init__.py +2 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/idna/codec.py +118 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/idna/compat.py +12 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/idna/core.py +387 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/idna/idnadata.py +1585 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/idna/intranges.py +53 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/idna/package_data.py +2 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/idna/uts46data.py +7634 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/ipaddress.py +2419 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/lockfile/__init__.py +347 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/lockfile/linklockfile.py +73 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/lockfile/mkdirlockfile.py +84 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/lockfile/pidlockfile.py +190 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/lockfile/sqlitelockfile.py +156 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/lockfile/symlinklockfile.py +70 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/msgpack/__init__.py +66 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/msgpack/_version.py +1 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/msgpack/exceptions.py +41 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/msgpack/fallback.py +971 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/packaging/__about__.py +21 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/packaging/__init__.py +14 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/packaging/_compat.py +30 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/packaging/_structures.py +70 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/packaging/markers.py +301 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/packaging/requirements.py +130 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/packaging/specifiers.py +774 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/packaging/utils.py +63 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/packaging/version.py +441 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{pkg_resources.py → pkg_resources/__init__.py} +3125 -2762
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/pkg_resources/py31compat.py +22 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/progress/__init__.py +127 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/progress/bar.py +88 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/progress/counter.py +48 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/progress/helpers.py +91 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/progress/spinner.py +44 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/pyparsing.py +5720 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/pytoml/__init__.py +3 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/pytoml/core.py +13 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/pytoml/parser.py +374 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/pytoml/writer.py +127 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/__init__.py +123 -77
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/__version__.py +14 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/_internal_utils.py +42 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/adapters.py +525 -388
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/api.py +152 -120
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/auth.py +293 -193
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/certs.py +18 -24
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/compat.py +73 -115
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/cookies.py +542 -454
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/exceptions.py +122 -75
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/help.py +120 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/hooks.py +34 -45
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/models.py +948 -803
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages.py +16 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/sessions.py +737 -637
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/status_codes.py +91 -88
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/structures.py +105 -127
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/utils.py +904 -673
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/retrying.py +267 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/six.py +891 -646
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/__init__.py +97 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/_collections.py +319 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/connection.py +373 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/urllib3 → urllib3}/connectionpool.py +905 -710
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/contrib/__init__.py +0 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/contrib/_securetransport/__init__.py +0 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/contrib/_securetransport/bindings.py +593 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/contrib/_securetransport/low_level.py +343 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/contrib/appengine.py +296 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/urllib3 → urllib3}/contrib/ntlmpool.py +112 -120
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/contrib/pyopenssl.py +455 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/contrib/securetransport.py +810 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/contrib/socks.py +188 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/exceptions.py +246 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/urllib3 → urllib3}/fields.py +178 -177
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/urllib3 → urllib3}/filepost.py +94 -100
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/urllib3 → urllib3}/packages/__init__.py +5 -4
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/packages/backports/__init__.py +0 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/packages/backports/makefile.py +53 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/urllib3 → urllib3}/packages/ordered_dict.py +259 -260
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/packages/six.py +868 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/urllib3 → urllib3}/packages/ssl_match_hostname/__init__.py +19 -13
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/urllib3 → urllib3}/packages/ssl_match_hostname/_implementation.py +157 -105
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/poolmanager.py +440 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/urllib3 → urllib3}/request.py +148 -141
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/response.py +626 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/util/__init__.py +54 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/util/connection.py +130 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/util/request.py +118 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/util/response.py +81 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/util/retry.py +401 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/util/selectors.py +581 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/util/ssl_.py +341 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/urllib3 → urllib3}/util/timeout.py +242 -234
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/urllib3 → urllib3}/util/url.py +230 -162
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/util/wait.py +40 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/webencodings/__init__.py +342 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/webencodings/labels.py +231 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/webencodings/mklabels.py +59 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/webencodings/tests.py +153 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/webencodings/x_user_defined.py +325 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/_markerlib/__init__.py +0 -16
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/_markerlib/markers.py +0 -119
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/sanitizer.py +0 -271
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/serializer/__init__.py +0 -16
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/serializer/htmlserializer.py +0 -320
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treewalkers/pulldom.py +0 -63
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/re-vendor.py +0 -34
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/__init__.py +0 -3
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/big5freq.py +0 -925
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/chardetect.py +0 -46
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/charsetgroupprober.py +0 -106
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/charsetprober.py +0 -62
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/codingstatemachine.py +0 -61
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/constants.py +0 -39
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/escprober.py +0 -86
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/escsm.py +0 -242
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/eucjpprober.py +0 -90
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/euckrfreq.py +0 -596
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/mbcharsetprober.py +0 -86
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/mbcssm.py +0 -575
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/sbcharsetprober.py +0 -120
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/sjisprober.py +0 -91
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/universaldetector.py +0 -170
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/__init__.py +0 -58
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/_collections.py +0 -205
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/connection.py +0 -204
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/contrib/pyopenssl.py +0 -422
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/exceptions.py +0 -126
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/packages/six.py +0 -385
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/poolmanager.py +0 -258
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/response.py +0 -308
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/util/__init__.py +0 -27
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/util/connection.py +0 -45
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/util/request.py +0 -68
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/util/response.py +0 -13
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py +0 -133
- package/python3.4.2/lib/python3.4/site-packages/pip/backwardcompat/__init__.py +0 -138
- package/python3.4.2/lib/python3.4/site-packages/pip/basecommand.py +0 -201
- package/python3.4.2/lib/python3.4/site-packages/pip/cmdoptions.py +0 -371
- package/python3.4.2/lib/python3.4/site-packages/pip/commands/__init__.py +0 -88
- package/python3.4.2/lib/python3.4/site-packages/pip/commands/bundle.py +0 -42
- package/python3.4.2/lib/python3.4/site-packages/pip/commands/completion.py +0 -59
- package/python3.4.2/lib/python3.4/site-packages/pip/commands/freeze.py +0 -114
- package/python3.4.2/lib/python3.4/site-packages/pip/commands/install.py +0 -314
- package/python3.4.2/lib/python3.4/site-packages/pip/commands/list.py +0 -162
- package/python3.4.2/lib/python3.4/site-packages/pip/commands/search.py +0 -132
- package/python3.4.2/lib/python3.4/site-packages/pip/commands/show.py +0 -80
- package/python3.4.2/lib/python3.4/site-packages/pip/commands/uninstall.py +0 -59
- package/python3.4.2/lib/python3.4/site-packages/pip/commands/unzip.py +0 -7
- package/python3.4.2/lib/python3.4/site-packages/pip/commands/wheel.py +0 -195
- package/python3.4.2/lib/python3.4/site-packages/pip/commands/zip.py +0 -351
- package/python3.4.2/lib/python3.4/site-packages/pip/download.py +0 -644
- package/python3.4.2/lib/python3.4/site-packages/pip/exceptions.py +0 -46
- package/python3.4.2/lib/python3.4/site-packages/pip/index.py +0 -990
- package/python3.4.2/lib/python3.4/site-packages/pip/locations.py +0 -171
- package/python3.4.2/lib/python3.4/site-packages/pip/log.py +0 -276
- package/python3.4.2/lib/python3.4/site-packages/pip/pep425tags.py +0 -102
- package/python3.4.2/lib/python3.4/site-packages/pip/req.py +0 -1931
- package/python3.4.2/lib/python3.4/site-packages/pip/runner.py +0 -18
- package/python3.4.2/lib/python3.4/site-packages/pip/util.py +0 -720
- package/python3.4.2/lib/python3.4/site-packages/pip/vcs/__init__.py +0 -251
- package/python3.4.2/lib/python3.4/site-packages/pip/vcs/bazaar.py +0 -131
- package/python3.4.2/lib/python3.4/site-packages/pip/vcs/git.py +0 -194
- package/python3.4.2/lib/python3.4/site-packages/pip/vcs/mercurial.py +0 -151
- package/python3.4.2/lib/python3.4/site-packages/pip/vcs/subversion.py +0 -273
- package/python3.4.2/lib/python3.4/site-packages/pip/wheel.py +0 -560
|
@@ -0,0 +1,851 @@
|
|
|
1
|
+
from __future__ import absolute_import
|
|
2
|
+
|
|
3
|
+
import contextlib
|
|
4
|
+
import errno
|
|
5
|
+
import io
|
|
6
|
+
import locale
|
|
7
|
+
# we have a submodule named 'logging' which would shadow this if we used the
|
|
8
|
+
# regular name:
|
|
9
|
+
import logging as std_logging
|
|
10
|
+
import os
|
|
11
|
+
import posixpath
|
|
12
|
+
import re
|
|
13
|
+
import shutil
|
|
14
|
+
import stat
|
|
15
|
+
import subprocess
|
|
16
|
+
import sys
|
|
17
|
+
import tarfile
|
|
18
|
+
import zipfile
|
|
19
|
+
from collections import deque
|
|
20
|
+
|
|
21
|
+
from pip._vendor import pkg_resources
|
|
22
|
+
# NOTE: retrying is not annotated in typeshed as on 2017-07-17, which is
|
|
23
|
+
# why we ignore the type on this import.
|
|
24
|
+
from pip._vendor.retrying import retry # type: ignore
|
|
25
|
+
from pip._vendor.six import PY2
|
|
26
|
+
from pip._vendor.six.moves import input
|
|
27
|
+
|
|
28
|
+
from pip._internal.compat import console_to_str, expanduser, stdlib_pkgs
|
|
29
|
+
from pip._internal.exceptions import InstallationError
|
|
30
|
+
from pip._internal.locations import (
|
|
31
|
+
running_under_virtualenv, site_packages, user_site, virtualenv_no_global,
|
|
32
|
+
write_delete_marker_file,
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
if PY2:
|
|
36
|
+
from io import BytesIO as StringIO
|
|
37
|
+
else:
|
|
38
|
+
from io import StringIO
|
|
39
|
+
|
|
40
|
+
__all__ = ['rmtree', 'display_path', 'backup_dir',
|
|
41
|
+
'ask', 'splitext',
|
|
42
|
+
'format_size', 'is_installable_dir',
|
|
43
|
+
'is_svn_page', 'file_contents',
|
|
44
|
+
'split_leading_dir', 'has_leading_dir',
|
|
45
|
+
'normalize_path',
|
|
46
|
+
'renames', 'get_prog',
|
|
47
|
+
'unzip_file', 'untar_file', 'unpack_file', 'call_subprocess',
|
|
48
|
+
'captured_stdout', 'ensure_dir',
|
|
49
|
+
'ARCHIVE_EXTENSIONS', 'SUPPORTED_EXTENSIONS',
|
|
50
|
+
'get_installed_version']
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
logger = std_logging.getLogger(__name__)
|
|
54
|
+
|
|
55
|
+
BZ2_EXTENSIONS = ('.tar.bz2', '.tbz')
|
|
56
|
+
XZ_EXTENSIONS = ('.tar.xz', '.txz', '.tlz', '.tar.lz', '.tar.lzma')
|
|
57
|
+
ZIP_EXTENSIONS = ('.zip', '.whl')
|
|
58
|
+
TAR_EXTENSIONS = ('.tar.gz', '.tgz', '.tar')
|
|
59
|
+
ARCHIVE_EXTENSIONS = (
|
|
60
|
+
ZIP_EXTENSIONS + BZ2_EXTENSIONS + TAR_EXTENSIONS + XZ_EXTENSIONS)
|
|
61
|
+
SUPPORTED_EXTENSIONS = ZIP_EXTENSIONS + TAR_EXTENSIONS
|
|
62
|
+
try:
|
|
63
|
+
import bz2 # noqa
|
|
64
|
+
SUPPORTED_EXTENSIONS += BZ2_EXTENSIONS
|
|
65
|
+
except ImportError:
|
|
66
|
+
logger.debug('bz2 module is not available')
|
|
67
|
+
|
|
68
|
+
try:
|
|
69
|
+
# Only for Python 3.3+
|
|
70
|
+
import lzma # noqa
|
|
71
|
+
SUPPORTED_EXTENSIONS += XZ_EXTENSIONS
|
|
72
|
+
except ImportError:
|
|
73
|
+
logger.debug('lzma module is not available')
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def import_or_raise(pkg_or_module_string, ExceptionType, *args, **kwargs):
|
|
77
|
+
try:
|
|
78
|
+
return __import__(pkg_or_module_string)
|
|
79
|
+
except ImportError:
|
|
80
|
+
raise ExceptionType(*args, **kwargs)
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def ensure_dir(path):
|
|
84
|
+
"""os.path.makedirs without EEXIST."""
|
|
85
|
+
try:
|
|
86
|
+
os.makedirs(path)
|
|
87
|
+
except OSError as e:
|
|
88
|
+
if e.errno != errno.EEXIST:
|
|
89
|
+
raise
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def get_prog():
|
|
93
|
+
try:
|
|
94
|
+
prog = os.path.basename(sys.argv[0])
|
|
95
|
+
if prog in ('__main__.py', '-c'):
|
|
96
|
+
return "%s -m pip" % sys.executable
|
|
97
|
+
else:
|
|
98
|
+
return prog
|
|
99
|
+
except (AttributeError, TypeError, IndexError):
|
|
100
|
+
pass
|
|
101
|
+
return 'pip'
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
# Retry every half second for up to 3 seconds
|
|
105
|
+
@retry(stop_max_delay=3000, wait_fixed=500)
|
|
106
|
+
def rmtree(dir, ignore_errors=False):
|
|
107
|
+
shutil.rmtree(dir, ignore_errors=ignore_errors,
|
|
108
|
+
onerror=rmtree_errorhandler)
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
def rmtree_errorhandler(func, path, exc_info):
|
|
112
|
+
"""On Windows, the files in .svn are read-only, so when rmtree() tries to
|
|
113
|
+
remove them, an exception is thrown. We catch that here, remove the
|
|
114
|
+
read-only attribute, and hopefully continue without problems."""
|
|
115
|
+
# if file type currently read only
|
|
116
|
+
if os.stat(path).st_mode & stat.S_IREAD:
|
|
117
|
+
# convert to read/write
|
|
118
|
+
os.chmod(path, stat.S_IWRITE)
|
|
119
|
+
# use the original function to repeat the operation
|
|
120
|
+
func(path)
|
|
121
|
+
return
|
|
122
|
+
else:
|
|
123
|
+
raise
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
def display_path(path):
|
|
127
|
+
"""Gives the display value for a given path, making it relative to cwd
|
|
128
|
+
if possible."""
|
|
129
|
+
path = os.path.normcase(os.path.abspath(path))
|
|
130
|
+
if sys.version_info[0] == 2:
|
|
131
|
+
path = path.decode(sys.getfilesystemencoding(), 'replace')
|
|
132
|
+
path = path.encode(sys.getdefaultencoding(), 'replace')
|
|
133
|
+
if path.startswith(os.getcwd() + os.path.sep):
|
|
134
|
+
path = '.' + path[len(os.getcwd()):]
|
|
135
|
+
return path
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
def backup_dir(dir, ext='.bak'):
|
|
139
|
+
"""Figure out the name of a directory to back up the given dir to
|
|
140
|
+
(adding .bak, .bak2, etc)"""
|
|
141
|
+
n = 1
|
|
142
|
+
extension = ext
|
|
143
|
+
while os.path.exists(dir + extension):
|
|
144
|
+
n += 1
|
|
145
|
+
extension = ext + str(n)
|
|
146
|
+
return dir + extension
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
def ask_path_exists(message, options):
|
|
150
|
+
for action in os.environ.get('PIP_EXISTS_ACTION', '').split():
|
|
151
|
+
if action in options:
|
|
152
|
+
return action
|
|
153
|
+
return ask(message, options)
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
def ask(message, options):
|
|
157
|
+
"""Ask the message interactively, with the given possible responses"""
|
|
158
|
+
while 1:
|
|
159
|
+
if os.environ.get('PIP_NO_INPUT'):
|
|
160
|
+
raise Exception(
|
|
161
|
+
'No input was expected ($PIP_NO_INPUT set); question: %s' %
|
|
162
|
+
message
|
|
163
|
+
)
|
|
164
|
+
response = input(message)
|
|
165
|
+
response = response.strip().lower()
|
|
166
|
+
if response not in options:
|
|
167
|
+
print(
|
|
168
|
+
'Your response (%r) was not one of the expected responses: '
|
|
169
|
+
'%s' % (response, ', '.join(options))
|
|
170
|
+
)
|
|
171
|
+
else:
|
|
172
|
+
return response
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
def format_size(bytes):
|
|
176
|
+
if bytes > 1000 * 1000:
|
|
177
|
+
return '%.1fMB' % (bytes / 1000.0 / 1000)
|
|
178
|
+
elif bytes > 10 * 1000:
|
|
179
|
+
return '%ikB' % (bytes / 1000)
|
|
180
|
+
elif bytes > 1000:
|
|
181
|
+
return '%.1fkB' % (bytes / 1000.0)
|
|
182
|
+
else:
|
|
183
|
+
return '%ibytes' % bytes
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
def is_installable_dir(path):
|
|
187
|
+
"""Return True if `path` is a directory containing a setup.py file."""
|
|
188
|
+
if not os.path.isdir(path):
|
|
189
|
+
return False
|
|
190
|
+
setup_py = os.path.join(path, 'setup.py')
|
|
191
|
+
if os.path.isfile(setup_py):
|
|
192
|
+
return True
|
|
193
|
+
return False
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
def is_svn_page(html):
|
|
197
|
+
"""
|
|
198
|
+
Returns true if the page appears to be the index page of an svn repository
|
|
199
|
+
"""
|
|
200
|
+
return (re.search(r'<title>[^<]*Revision \d+:', html) and
|
|
201
|
+
re.search(r'Powered by (?:<a[^>]*?>)?Subversion', html, re.I))
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
def file_contents(filename):
|
|
205
|
+
with open(filename, 'rb') as fp:
|
|
206
|
+
return fp.read().decode('utf-8')
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
def read_chunks(file, size=io.DEFAULT_BUFFER_SIZE):
|
|
210
|
+
"""Yield pieces of data from a file-like object until EOF."""
|
|
211
|
+
while True:
|
|
212
|
+
chunk = file.read(size)
|
|
213
|
+
if not chunk:
|
|
214
|
+
break
|
|
215
|
+
yield chunk
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
def split_leading_dir(path):
|
|
219
|
+
path = path.lstrip('/').lstrip('\\')
|
|
220
|
+
if '/' in path and (('\\' in path and path.find('/') < path.find('\\')) or
|
|
221
|
+
'\\' not in path):
|
|
222
|
+
return path.split('/', 1)
|
|
223
|
+
elif '\\' in path:
|
|
224
|
+
return path.split('\\', 1)
|
|
225
|
+
else:
|
|
226
|
+
return path, ''
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
def has_leading_dir(paths):
|
|
230
|
+
"""Returns true if all the paths have the same leading path name
|
|
231
|
+
(i.e., everything is in one subdirectory in an archive)"""
|
|
232
|
+
common_prefix = None
|
|
233
|
+
for path in paths:
|
|
234
|
+
prefix, rest = split_leading_dir(path)
|
|
235
|
+
if not prefix:
|
|
236
|
+
return False
|
|
237
|
+
elif common_prefix is None:
|
|
238
|
+
common_prefix = prefix
|
|
239
|
+
elif prefix != common_prefix:
|
|
240
|
+
return False
|
|
241
|
+
return True
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
def normalize_path(path, resolve_symlinks=True):
|
|
245
|
+
"""
|
|
246
|
+
Convert a path to its canonical, case-normalized, absolute version.
|
|
247
|
+
|
|
248
|
+
"""
|
|
249
|
+
path = expanduser(path)
|
|
250
|
+
if resolve_symlinks:
|
|
251
|
+
path = os.path.realpath(path)
|
|
252
|
+
else:
|
|
253
|
+
path = os.path.abspath(path)
|
|
254
|
+
return os.path.normcase(path)
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
def splitext(path):
|
|
258
|
+
"""Like os.path.splitext, but take off .tar too"""
|
|
259
|
+
base, ext = posixpath.splitext(path)
|
|
260
|
+
if base.lower().endswith('.tar'):
|
|
261
|
+
ext = base[-4:] + ext
|
|
262
|
+
base = base[:-4]
|
|
263
|
+
return base, ext
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
def renames(old, new):
|
|
267
|
+
"""Like os.renames(), but handles renaming across devices."""
|
|
268
|
+
# Implementation borrowed from os.renames().
|
|
269
|
+
head, tail = os.path.split(new)
|
|
270
|
+
if head and tail and not os.path.exists(head):
|
|
271
|
+
os.makedirs(head)
|
|
272
|
+
|
|
273
|
+
shutil.move(old, new)
|
|
274
|
+
|
|
275
|
+
head, tail = os.path.split(old)
|
|
276
|
+
if head and tail:
|
|
277
|
+
try:
|
|
278
|
+
os.removedirs(head)
|
|
279
|
+
except OSError:
|
|
280
|
+
pass
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
def is_local(path):
|
|
284
|
+
"""
|
|
285
|
+
Return True if path is within sys.prefix, if we're running in a virtualenv.
|
|
286
|
+
|
|
287
|
+
If we're not in a virtualenv, all paths are considered "local."
|
|
288
|
+
|
|
289
|
+
"""
|
|
290
|
+
if not running_under_virtualenv():
|
|
291
|
+
return True
|
|
292
|
+
return normalize_path(path).startswith(normalize_path(sys.prefix))
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
def dist_is_local(dist):
|
|
296
|
+
"""
|
|
297
|
+
Return True if given Distribution object is installed locally
|
|
298
|
+
(i.e. within current virtualenv).
|
|
299
|
+
|
|
300
|
+
Always True if we're not in a virtualenv.
|
|
301
|
+
|
|
302
|
+
"""
|
|
303
|
+
return is_local(dist_location(dist))
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
def dist_in_usersite(dist):
|
|
307
|
+
"""
|
|
308
|
+
Return True if given Distribution is installed in user site.
|
|
309
|
+
"""
|
|
310
|
+
norm_path = normalize_path(dist_location(dist))
|
|
311
|
+
return norm_path.startswith(normalize_path(user_site))
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
def dist_in_site_packages(dist):
|
|
315
|
+
"""
|
|
316
|
+
Return True if given Distribution is installed in
|
|
317
|
+
sysconfig.get_python_lib().
|
|
318
|
+
"""
|
|
319
|
+
return normalize_path(
|
|
320
|
+
dist_location(dist)
|
|
321
|
+
).startswith(normalize_path(site_packages))
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
def dist_is_editable(dist):
|
|
325
|
+
"""Is distribution an editable install?"""
|
|
326
|
+
for path_item in sys.path:
|
|
327
|
+
egg_link = os.path.join(path_item, dist.project_name + '.egg-link')
|
|
328
|
+
if os.path.isfile(egg_link):
|
|
329
|
+
return True
|
|
330
|
+
return False
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
def get_installed_distributions(local_only=True,
|
|
334
|
+
skip=stdlib_pkgs,
|
|
335
|
+
include_editables=True,
|
|
336
|
+
editables_only=False,
|
|
337
|
+
user_only=False):
|
|
338
|
+
"""
|
|
339
|
+
Return a list of installed Distribution objects.
|
|
340
|
+
|
|
341
|
+
If ``local_only`` is True (default), only return installations
|
|
342
|
+
local to the current virtualenv, if in a virtualenv.
|
|
343
|
+
|
|
344
|
+
``skip`` argument is an iterable of lower-case project names to
|
|
345
|
+
ignore; defaults to stdlib_pkgs
|
|
346
|
+
|
|
347
|
+
If ``include_editables`` is False, don't report editables.
|
|
348
|
+
|
|
349
|
+
If ``editables_only`` is True , only report editables.
|
|
350
|
+
|
|
351
|
+
If ``user_only`` is True , only report installations in the user
|
|
352
|
+
site directory.
|
|
353
|
+
|
|
354
|
+
"""
|
|
355
|
+
if local_only:
|
|
356
|
+
local_test = dist_is_local
|
|
357
|
+
else:
|
|
358
|
+
def local_test(d):
|
|
359
|
+
return True
|
|
360
|
+
|
|
361
|
+
if include_editables:
|
|
362
|
+
def editable_test(d):
|
|
363
|
+
return True
|
|
364
|
+
else:
|
|
365
|
+
def editable_test(d):
|
|
366
|
+
return not dist_is_editable(d)
|
|
367
|
+
|
|
368
|
+
if editables_only:
|
|
369
|
+
def editables_only_test(d):
|
|
370
|
+
return dist_is_editable(d)
|
|
371
|
+
else:
|
|
372
|
+
def editables_only_test(d):
|
|
373
|
+
return True
|
|
374
|
+
|
|
375
|
+
if user_only:
|
|
376
|
+
user_test = dist_in_usersite
|
|
377
|
+
else:
|
|
378
|
+
def user_test(d):
|
|
379
|
+
return True
|
|
380
|
+
|
|
381
|
+
return [d for d in pkg_resources.working_set
|
|
382
|
+
if local_test(d) and
|
|
383
|
+
d.key not in skip and
|
|
384
|
+
editable_test(d) and
|
|
385
|
+
editables_only_test(d) and
|
|
386
|
+
user_test(d)
|
|
387
|
+
]
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
def egg_link_path(dist):
|
|
391
|
+
"""
|
|
392
|
+
Return the path for the .egg-link file if it exists, otherwise, None.
|
|
393
|
+
|
|
394
|
+
There's 3 scenarios:
|
|
395
|
+
1) not in a virtualenv
|
|
396
|
+
try to find in site.USER_SITE, then site_packages
|
|
397
|
+
2) in a no-global virtualenv
|
|
398
|
+
try to find in site_packages
|
|
399
|
+
3) in a yes-global virtualenv
|
|
400
|
+
try to find in site_packages, then site.USER_SITE
|
|
401
|
+
(don't look in global location)
|
|
402
|
+
|
|
403
|
+
For #1 and #3, there could be odd cases, where there's an egg-link in 2
|
|
404
|
+
locations.
|
|
405
|
+
|
|
406
|
+
This method will just return the first one found.
|
|
407
|
+
"""
|
|
408
|
+
sites = []
|
|
409
|
+
if running_under_virtualenv():
|
|
410
|
+
if virtualenv_no_global():
|
|
411
|
+
sites.append(site_packages)
|
|
412
|
+
else:
|
|
413
|
+
sites.append(site_packages)
|
|
414
|
+
if user_site:
|
|
415
|
+
sites.append(user_site)
|
|
416
|
+
else:
|
|
417
|
+
if user_site:
|
|
418
|
+
sites.append(user_site)
|
|
419
|
+
sites.append(site_packages)
|
|
420
|
+
|
|
421
|
+
for site in sites:
|
|
422
|
+
egglink = os.path.join(site, dist.project_name) + '.egg-link'
|
|
423
|
+
if os.path.isfile(egglink):
|
|
424
|
+
return egglink
|
|
425
|
+
|
|
426
|
+
|
|
427
|
+
def dist_location(dist):
|
|
428
|
+
"""
|
|
429
|
+
Get the site-packages location of this distribution. Generally
|
|
430
|
+
this is dist.location, except in the case of develop-installed
|
|
431
|
+
packages, where dist.location is the source code location, and we
|
|
432
|
+
want to know where the egg-link file is.
|
|
433
|
+
|
|
434
|
+
"""
|
|
435
|
+
egg_link = egg_link_path(dist)
|
|
436
|
+
if egg_link:
|
|
437
|
+
return egg_link
|
|
438
|
+
return dist.location
|
|
439
|
+
|
|
440
|
+
|
|
441
|
+
def current_umask():
|
|
442
|
+
"""Get the current umask which involves having to set it temporarily."""
|
|
443
|
+
mask = os.umask(0)
|
|
444
|
+
os.umask(mask)
|
|
445
|
+
return mask
|
|
446
|
+
|
|
447
|
+
|
|
448
|
+
def unzip_file(filename, location, flatten=True):
|
|
449
|
+
"""
|
|
450
|
+
Unzip the file (with path `filename`) to the destination `location`. All
|
|
451
|
+
files are written based on system defaults and umask (i.e. permissions are
|
|
452
|
+
not preserved), except that regular file members with any execute
|
|
453
|
+
permissions (user, group, or world) have "chmod +x" applied after being
|
|
454
|
+
written. Note that for windows, any execute changes using os.chmod are
|
|
455
|
+
no-ops per the python docs.
|
|
456
|
+
"""
|
|
457
|
+
ensure_dir(location)
|
|
458
|
+
zipfp = open(filename, 'rb')
|
|
459
|
+
try:
|
|
460
|
+
zip = zipfile.ZipFile(zipfp, allowZip64=True)
|
|
461
|
+
leading = has_leading_dir(zip.namelist()) and flatten
|
|
462
|
+
for info in zip.infolist():
|
|
463
|
+
name = info.filename
|
|
464
|
+
data = zip.read(name)
|
|
465
|
+
fn = name
|
|
466
|
+
if leading:
|
|
467
|
+
fn = split_leading_dir(name)[1]
|
|
468
|
+
fn = os.path.join(location, fn)
|
|
469
|
+
dir = os.path.dirname(fn)
|
|
470
|
+
if fn.endswith('/') or fn.endswith('\\'):
|
|
471
|
+
# A directory
|
|
472
|
+
ensure_dir(fn)
|
|
473
|
+
else:
|
|
474
|
+
ensure_dir(dir)
|
|
475
|
+
fp = open(fn, 'wb')
|
|
476
|
+
try:
|
|
477
|
+
fp.write(data)
|
|
478
|
+
finally:
|
|
479
|
+
fp.close()
|
|
480
|
+
mode = info.external_attr >> 16
|
|
481
|
+
# if mode and regular file and any execute permissions for
|
|
482
|
+
# user/group/world?
|
|
483
|
+
if mode and stat.S_ISREG(mode) and mode & 0o111:
|
|
484
|
+
# make dest file have execute for user/group/world
|
|
485
|
+
# (chmod +x) no-op on windows per python docs
|
|
486
|
+
os.chmod(fn, (0o777 - current_umask() | 0o111))
|
|
487
|
+
finally:
|
|
488
|
+
zipfp.close()
|
|
489
|
+
|
|
490
|
+
|
|
491
|
+
def untar_file(filename, location):
|
|
492
|
+
"""
|
|
493
|
+
Untar the file (with path `filename`) to the destination `location`.
|
|
494
|
+
All files are written based on system defaults and umask (i.e. permissions
|
|
495
|
+
are not preserved), except that regular file members with any execute
|
|
496
|
+
permissions (user, group, or world) have "chmod +x" applied after being
|
|
497
|
+
written. Note that for windows, any execute changes using os.chmod are
|
|
498
|
+
no-ops per the python docs.
|
|
499
|
+
"""
|
|
500
|
+
ensure_dir(location)
|
|
501
|
+
if filename.lower().endswith('.gz') or filename.lower().endswith('.tgz'):
|
|
502
|
+
mode = 'r:gz'
|
|
503
|
+
elif filename.lower().endswith(BZ2_EXTENSIONS):
|
|
504
|
+
mode = 'r:bz2'
|
|
505
|
+
elif filename.lower().endswith(XZ_EXTENSIONS):
|
|
506
|
+
mode = 'r:xz'
|
|
507
|
+
elif filename.lower().endswith('.tar'):
|
|
508
|
+
mode = 'r'
|
|
509
|
+
else:
|
|
510
|
+
logger.warning(
|
|
511
|
+
'Cannot determine compression type for file %s', filename,
|
|
512
|
+
)
|
|
513
|
+
mode = 'r:*'
|
|
514
|
+
tar = tarfile.open(filename, mode)
|
|
515
|
+
try:
|
|
516
|
+
# note: python<=2.5 doesn't seem to know about pax headers, filter them
|
|
517
|
+
leading = has_leading_dir([
|
|
518
|
+
member.name for member in tar.getmembers()
|
|
519
|
+
if member.name != 'pax_global_header'
|
|
520
|
+
])
|
|
521
|
+
for member in tar.getmembers():
|
|
522
|
+
fn = member.name
|
|
523
|
+
if fn == 'pax_global_header':
|
|
524
|
+
continue
|
|
525
|
+
if leading:
|
|
526
|
+
fn = split_leading_dir(fn)[1]
|
|
527
|
+
path = os.path.join(location, fn)
|
|
528
|
+
if member.isdir():
|
|
529
|
+
ensure_dir(path)
|
|
530
|
+
elif member.issym():
|
|
531
|
+
try:
|
|
532
|
+
tar._extract_member(member, path)
|
|
533
|
+
except Exception as exc:
|
|
534
|
+
# Some corrupt tar files seem to produce this
|
|
535
|
+
# (specifically bad symlinks)
|
|
536
|
+
logger.warning(
|
|
537
|
+
'In the tar file %s the member %s is invalid: %s',
|
|
538
|
+
filename, member.name, exc,
|
|
539
|
+
)
|
|
540
|
+
continue
|
|
541
|
+
else:
|
|
542
|
+
try:
|
|
543
|
+
fp = tar.extractfile(member)
|
|
544
|
+
except (KeyError, AttributeError) as exc:
|
|
545
|
+
# Some corrupt tar files seem to produce this
|
|
546
|
+
# (specifically bad symlinks)
|
|
547
|
+
logger.warning(
|
|
548
|
+
'In the tar file %s the member %s is invalid: %s',
|
|
549
|
+
filename, member.name, exc,
|
|
550
|
+
)
|
|
551
|
+
continue
|
|
552
|
+
ensure_dir(os.path.dirname(path))
|
|
553
|
+
with open(path, 'wb') as destfp:
|
|
554
|
+
shutil.copyfileobj(fp, destfp)
|
|
555
|
+
fp.close()
|
|
556
|
+
# Update the timestamp (useful for cython compiled files)
|
|
557
|
+
tar.utime(member, path)
|
|
558
|
+
# member have any execute permissions for user/group/world?
|
|
559
|
+
if member.mode & 0o111:
|
|
560
|
+
# make dest file have execute for user/group/world
|
|
561
|
+
# no-op on windows per python docs
|
|
562
|
+
os.chmod(path, (0o777 - current_umask() | 0o111))
|
|
563
|
+
finally:
|
|
564
|
+
tar.close()
|
|
565
|
+
|
|
566
|
+
|
|
567
|
+
def unpack_file(filename, location, content_type, link):
|
|
568
|
+
filename = os.path.realpath(filename)
|
|
569
|
+
if (content_type == 'application/zip' or
|
|
570
|
+
filename.lower().endswith(ZIP_EXTENSIONS) or
|
|
571
|
+
zipfile.is_zipfile(filename)):
|
|
572
|
+
unzip_file(
|
|
573
|
+
filename,
|
|
574
|
+
location,
|
|
575
|
+
flatten=not filename.endswith('.whl')
|
|
576
|
+
)
|
|
577
|
+
elif (content_type == 'application/x-gzip' or
|
|
578
|
+
tarfile.is_tarfile(filename) or
|
|
579
|
+
filename.lower().endswith(
|
|
580
|
+
TAR_EXTENSIONS + BZ2_EXTENSIONS + XZ_EXTENSIONS)):
|
|
581
|
+
untar_file(filename, location)
|
|
582
|
+
elif (content_type and content_type.startswith('text/html') and
|
|
583
|
+
is_svn_page(file_contents(filename))):
|
|
584
|
+
# We don't really care about this
|
|
585
|
+
from pip._internal.vcs.subversion import Subversion
|
|
586
|
+
Subversion('svn+' + link.url).unpack(location)
|
|
587
|
+
else:
|
|
588
|
+
# FIXME: handle?
|
|
589
|
+
# FIXME: magic signatures?
|
|
590
|
+
logger.critical(
|
|
591
|
+
'Cannot unpack file %s (downloaded from %s, content-type: %s); '
|
|
592
|
+
'cannot detect archive format',
|
|
593
|
+
filename, location, content_type,
|
|
594
|
+
)
|
|
595
|
+
raise InstallationError(
|
|
596
|
+
'Cannot determine archive format of %s' % location
|
|
597
|
+
)
|
|
598
|
+
|
|
599
|
+
|
|
600
|
+
def call_subprocess(cmd, show_stdout=True, cwd=None,
|
|
601
|
+
on_returncode='raise',
|
|
602
|
+
command_desc=None,
|
|
603
|
+
extra_environ=None, unset_environ=None, spinner=None):
|
|
604
|
+
"""
|
|
605
|
+
Args:
|
|
606
|
+
unset_environ: an iterable of environment variable names to unset
|
|
607
|
+
prior to calling subprocess.Popen().
|
|
608
|
+
"""
|
|
609
|
+
if unset_environ is None:
|
|
610
|
+
unset_environ = []
|
|
611
|
+
# This function's handling of subprocess output is confusing and I
|
|
612
|
+
# previously broke it terribly, so as penance I will write a long comment
|
|
613
|
+
# explaining things.
|
|
614
|
+
#
|
|
615
|
+
# The obvious thing that affects output is the show_stdout=
|
|
616
|
+
# kwarg. show_stdout=True means, let the subprocess write directly to our
|
|
617
|
+
# stdout. Even though it is nominally the default, it is almost never used
|
|
618
|
+
# inside pip (and should not be used in new code without a very good
|
|
619
|
+
# reason); as of 2016-02-22 it is only used in a few places inside the VCS
|
|
620
|
+
# wrapper code. Ideally we should get rid of it entirely, because it
|
|
621
|
+
# creates a lot of complexity here for a rarely used feature.
|
|
622
|
+
#
|
|
623
|
+
# Most places in pip set show_stdout=False. What this means is:
|
|
624
|
+
# - We connect the child stdout to a pipe, which we read.
|
|
625
|
+
# - By default, we hide the output but show a spinner -- unless the
|
|
626
|
+
# subprocess exits with an error, in which case we show the output.
|
|
627
|
+
# - If the --verbose option was passed (= loglevel is DEBUG), then we show
|
|
628
|
+
# the output unconditionally. (But in this case we don't want to show
|
|
629
|
+
# the output a second time if it turns out that there was an error.)
|
|
630
|
+
#
|
|
631
|
+
# stderr is always merged with stdout (even if show_stdout=True).
|
|
632
|
+
if show_stdout:
|
|
633
|
+
stdout = None
|
|
634
|
+
else:
|
|
635
|
+
stdout = subprocess.PIPE
|
|
636
|
+
if command_desc is None:
|
|
637
|
+
cmd_parts = []
|
|
638
|
+
for part in cmd:
|
|
639
|
+
if ' ' in part or '\n' in part or '"' in part or "'" in part:
|
|
640
|
+
part = '"%s"' % part.replace('"', '\\"')
|
|
641
|
+
cmd_parts.append(part)
|
|
642
|
+
command_desc = ' '.join(cmd_parts)
|
|
643
|
+
logger.debug("Running command %s", command_desc)
|
|
644
|
+
env = os.environ.copy()
|
|
645
|
+
if extra_environ:
|
|
646
|
+
env.update(extra_environ)
|
|
647
|
+
for name in unset_environ:
|
|
648
|
+
env.pop(name, None)
|
|
649
|
+
try:
|
|
650
|
+
proc = subprocess.Popen(
|
|
651
|
+
cmd, stderr=subprocess.STDOUT, stdin=subprocess.PIPE,
|
|
652
|
+
stdout=stdout, cwd=cwd, env=env,
|
|
653
|
+
)
|
|
654
|
+
proc.stdin.close()
|
|
655
|
+
except Exception as exc:
|
|
656
|
+
logger.critical(
|
|
657
|
+
"Error %s while executing command %s", exc, command_desc,
|
|
658
|
+
)
|
|
659
|
+
raise
|
|
660
|
+
all_output = []
|
|
661
|
+
if stdout is not None:
|
|
662
|
+
while True:
|
|
663
|
+
line = console_to_str(proc.stdout.readline())
|
|
664
|
+
if not line:
|
|
665
|
+
break
|
|
666
|
+
line = line.rstrip()
|
|
667
|
+
all_output.append(line + '\n')
|
|
668
|
+
if logger.getEffectiveLevel() <= std_logging.DEBUG:
|
|
669
|
+
# Show the line immediately
|
|
670
|
+
logger.debug(line)
|
|
671
|
+
else:
|
|
672
|
+
# Update the spinner
|
|
673
|
+
if spinner is not None:
|
|
674
|
+
spinner.spin()
|
|
675
|
+
try:
|
|
676
|
+
proc.wait()
|
|
677
|
+
finally:
|
|
678
|
+
if proc.stdout:
|
|
679
|
+
proc.stdout.close()
|
|
680
|
+
if spinner is not None:
|
|
681
|
+
if proc.returncode:
|
|
682
|
+
spinner.finish("error")
|
|
683
|
+
else:
|
|
684
|
+
spinner.finish("done")
|
|
685
|
+
if proc.returncode:
|
|
686
|
+
if on_returncode == 'raise':
|
|
687
|
+
if (logger.getEffectiveLevel() > std_logging.DEBUG and
|
|
688
|
+
not show_stdout):
|
|
689
|
+
logger.info(
|
|
690
|
+
'Complete output from command %s:', command_desc,
|
|
691
|
+
)
|
|
692
|
+
logger.info(
|
|
693
|
+
''.join(all_output) +
|
|
694
|
+
'\n----------------------------------------'
|
|
695
|
+
)
|
|
696
|
+
raise InstallationError(
|
|
697
|
+
'Command "%s" failed with error code %s in %s'
|
|
698
|
+
% (command_desc, proc.returncode, cwd))
|
|
699
|
+
elif on_returncode == 'warn':
|
|
700
|
+
logger.warning(
|
|
701
|
+
'Command "%s" had error code %s in %s',
|
|
702
|
+
command_desc, proc.returncode, cwd,
|
|
703
|
+
)
|
|
704
|
+
elif on_returncode == 'ignore':
|
|
705
|
+
pass
|
|
706
|
+
else:
|
|
707
|
+
raise ValueError('Invalid value: on_returncode=%s' %
|
|
708
|
+
repr(on_returncode))
|
|
709
|
+
if not show_stdout:
|
|
710
|
+
return ''.join(all_output)
|
|
711
|
+
|
|
712
|
+
|
|
713
|
+
def read_text_file(filename):
|
|
714
|
+
"""Return the contents of *filename*.
|
|
715
|
+
|
|
716
|
+
Try to decode the file contents with utf-8, the preferred system encoding
|
|
717
|
+
(e.g., cp1252 on some Windows machines), and latin1, in that order.
|
|
718
|
+
Decoding a byte string with latin1 will never raise an error. In the worst
|
|
719
|
+
case, the returned string will contain some garbage characters.
|
|
720
|
+
|
|
721
|
+
"""
|
|
722
|
+
with open(filename, 'rb') as fp:
|
|
723
|
+
data = fp.read()
|
|
724
|
+
|
|
725
|
+
encodings = ['utf-8', locale.getpreferredencoding(False), 'latin1']
|
|
726
|
+
for enc in encodings:
|
|
727
|
+
try:
|
|
728
|
+
data = data.decode(enc)
|
|
729
|
+
except UnicodeDecodeError:
|
|
730
|
+
continue
|
|
731
|
+
break
|
|
732
|
+
|
|
733
|
+
assert type(data) != bytes # Latin1 should have worked.
|
|
734
|
+
return data
|
|
735
|
+
|
|
736
|
+
|
|
737
|
+
def _make_build_dir(build_dir):
|
|
738
|
+
os.makedirs(build_dir)
|
|
739
|
+
write_delete_marker_file(build_dir)
|
|
740
|
+
|
|
741
|
+
|
|
742
|
+
class FakeFile(object):
|
|
743
|
+
"""Wrap a list of lines in an object with readline() to make
|
|
744
|
+
ConfigParser happy."""
|
|
745
|
+
def __init__(self, lines):
|
|
746
|
+
self._gen = (l for l in lines)
|
|
747
|
+
|
|
748
|
+
def readline(self):
|
|
749
|
+
try:
|
|
750
|
+
try:
|
|
751
|
+
return next(self._gen)
|
|
752
|
+
except NameError:
|
|
753
|
+
return self._gen.next()
|
|
754
|
+
except StopIteration:
|
|
755
|
+
return ''
|
|
756
|
+
|
|
757
|
+
def __iter__(self):
|
|
758
|
+
return self._gen
|
|
759
|
+
|
|
760
|
+
|
|
761
|
+
class StreamWrapper(StringIO):
|
|
762
|
+
|
|
763
|
+
@classmethod
|
|
764
|
+
def from_stream(cls, orig_stream):
|
|
765
|
+
cls.orig_stream = orig_stream
|
|
766
|
+
return cls()
|
|
767
|
+
|
|
768
|
+
# compileall.compile_dir() needs stdout.encoding to print to stdout
|
|
769
|
+
@property
|
|
770
|
+
def encoding(self):
|
|
771
|
+
return self.orig_stream.encoding
|
|
772
|
+
|
|
773
|
+
|
|
774
|
+
@contextlib.contextmanager
|
|
775
|
+
def captured_output(stream_name):
|
|
776
|
+
"""Return a context manager used by captured_stdout/stdin/stderr
|
|
777
|
+
that temporarily replaces the sys stream *stream_name* with a StringIO.
|
|
778
|
+
|
|
779
|
+
Taken from Lib/support/__init__.py in the CPython repo.
|
|
780
|
+
"""
|
|
781
|
+
orig_stdout = getattr(sys, stream_name)
|
|
782
|
+
setattr(sys, stream_name, StreamWrapper.from_stream(orig_stdout))
|
|
783
|
+
try:
|
|
784
|
+
yield getattr(sys, stream_name)
|
|
785
|
+
finally:
|
|
786
|
+
setattr(sys, stream_name, orig_stdout)
|
|
787
|
+
|
|
788
|
+
|
|
789
|
+
def captured_stdout():
|
|
790
|
+
"""Capture the output of sys.stdout:
|
|
791
|
+
|
|
792
|
+
with captured_stdout() as stdout:
|
|
793
|
+
print('hello')
|
|
794
|
+
self.assertEqual(stdout.getvalue(), 'hello\n')
|
|
795
|
+
|
|
796
|
+
Taken from Lib/support/__init__.py in the CPython repo.
|
|
797
|
+
"""
|
|
798
|
+
return captured_output('stdout')
|
|
799
|
+
|
|
800
|
+
|
|
801
|
+
class cached_property(object):
|
|
802
|
+
"""A property that is only computed once per instance and then replaces
|
|
803
|
+
itself with an ordinary attribute. Deleting the attribute resets the
|
|
804
|
+
property.
|
|
805
|
+
|
|
806
|
+
Source: https://github.com/bottlepy/bottle/blob/0.11.5/bottle.py#L175
|
|
807
|
+
"""
|
|
808
|
+
|
|
809
|
+
def __init__(self, func):
|
|
810
|
+
self.__doc__ = getattr(func, '__doc__')
|
|
811
|
+
self.func = func
|
|
812
|
+
|
|
813
|
+
def __get__(self, obj, cls):
|
|
814
|
+
if obj is None:
|
|
815
|
+
# We're being accessed from the class itself, not from an object
|
|
816
|
+
return self
|
|
817
|
+
value = obj.__dict__[self.func.__name__] = self.func(obj)
|
|
818
|
+
return value
|
|
819
|
+
|
|
820
|
+
|
|
821
|
+
def get_installed_version(dist_name, lookup_dirs=None):
|
|
822
|
+
"""Get the installed version of dist_name avoiding pkg_resources cache"""
|
|
823
|
+
# Create a requirement that we'll look for inside of setuptools.
|
|
824
|
+
req = pkg_resources.Requirement.parse(dist_name)
|
|
825
|
+
|
|
826
|
+
# We want to avoid having this cached, so we need to construct a new
|
|
827
|
+
# working set each time.
|
|
828
|
+
if lookup_dirs is None:
|
|
829
|
+
working_set = pkg_resources.WorkingSet()
|
|
830
|
+
else:
|
|
831
|
+
working_set = pkg_resources.WorkingSet(lookup_dirs)
|
|
832
|
+
|
|
833
|
+
# Get the installed distribution from our working set
|
|
834
|
+
dist = working_set.find(req)
|
|
835
|
+
|
|
836
|
+
# Check to see if we got an installed distribution or not, if we did
|
|
837
|
+
# we want to return it's version.
|
|
838
|
+
return dist.version if dist else None
|
|
839
|
+
|
|
840
|
+
|
|
841
|
+
def consume(iterator):
|
|
842
|
+
"""Consume an iterable at C speed."""
|
|
843
|
+
deque(iterator, maxlen=0)
|
|
844
|
+
|
|
845
|
+
|
|
846
|
+
# Simulates an enum
|
|
847
|
+
def enum(*sequential, **named):
|
|
848
|
+
enums = dict(zip(sequential, range(len(sequential))), **named)
|
|
849
|
+
reverse = {value: key for key, value in enums.items()}
|
|
850
|
+
enums['reverse_mapping'] = reverse
|
|
851
|
+
return type('Enum', (), enums)
|