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.
Files changed (354) hide show
  1. package/package.json +4 -2
  2. package/python3.4.2/lib/python3.4/site-packages/pip/__init__.py +1 -277
  3. package/python3.4.2/lib/python3.4/site-packages/pip/__main__.py +19 -7
  4. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/__init__.py +246 -0
  5. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/basecommand.py +373 -0
  6. package/python3.4.2/lib/python3.4/site-packages/pip/{baseparser.py → _internal/baseparser.py} +240 -224
  7. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/build_env.py +92 -0
  8. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/cache.py +202 -0
  9. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/cmdoptions.py +609 -0
  10. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/__init__.py +79 -0
  11. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/check.py +42 -0
  12. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/completion.py +94 -0
  13. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/configuration.py +227 -0
  14. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/download.py +233 -0
  15. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/freeze.py +96 -0
  16. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/hash.py +57 -0
  17. package/python3.4.2/lib/python3.4/site-packages/pip/{commands → _internal/commands}/help.py +36 -33
  18. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/install.py +477 -0
  19. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/list.py +343 -0
  20. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/search.py +135 -0
  21. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/show.py +164 -0
  22. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/uninstall.py +71 -0
  23. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/wheel.py +179 -0
  24. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/compat.py +235 -0
  25. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/configuration.py +378 -0
  26. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/download.py +922 -0
  27. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/exceptions.py +249 -0
  28. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/index.py +1117 -0
  29. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/locations.py +194 -0
  30. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/models/__init__.py +4 -0
  31. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/models/index.py +15 -0
  32. package/python3.4.2/lib/python3.4/site-packages/pip/{_vendor/requests/packages/urllib3/contrib → _internal/operations}/__init__.py +0 -0
  33. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/operations/check.py +106 -0
  34. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/operations/freeze.py +252 -0
  35. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/operations/prepare.py +378 -0
  36. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/pep425tags.py +317 -0
  37. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/req/__init__.py +69 -0
  38. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/req/req_file.py +338 -0
  39. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/req/req_install.py +1115 -0
  40. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/req/req_set.py +164 -0
  41. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/req/req_uninstall.py +455 -0
  42. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/resolve.py +354 -0
  43. package/python3.4.2/lib/python3.4/site-packages/pip/{status_codes.py → _internal/status_codes.py} +8 -6
  44. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/__init__.py +0 -0
  45. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/appdirs.py +258 -0
  46. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/deprecation.py +77 -0
  47. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/encoding.py +33 -0
  48. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/filesystem.py +28 -0
  49. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/glibc.py +84 -0
  50. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/hashes.py +94 -0
  51. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/logging.py +132 -0
  52. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/misc.py +851 -0
  53. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/outdated.py +163 -0
  54. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/packaging.py +70 -0
  55. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/setuptools_build.py +8 -0
  56. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/temp_dir.py +82 -0
  57. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/typing.py +29 -0
  58. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/ui.py +421 -0
  59. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/vcs/__init__.py +471 -0
  60. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/vcs/bazaar.py +113 -0
  61. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/vcs/git.py +311 -0
  62. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/vcs/mercurial.py +105 -0
  63. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/vcs/subversion.py +271 -0
  64. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/wheel.py +817 -0
  65. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/__init__.py +109 -8
  66. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/appdirs.py +604 -0
  67. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/__init__.py +11 -0
  68. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/_cmd.py +60 -0
  69. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/adapter.py +134 -0
  70. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/cache.py +39 -0
  71. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/caches/__init__.py +2 -0
  72. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/caches/file_cache.py +133 -0
  73. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/caches/redis_cache.py +43 -0
  74. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/compat.py +29 -0
  75. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/controller.py +373 -0
  76. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/filewrapper.py +78 -0
  77. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/heuristics.py +138 -0
  78. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/serialize.py +194 -0
  79. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/wrapper.py +27 -0
  80. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/certifi/__init__.py +3 -0
  81. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/certifi/__main__.py +2 -0
  82. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests → certifi}/cacert.pem +1765 -2358
  83. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/certifi/core.py +37 -0
  84. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/__init__.py +39 -32
  85. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/big5freq.py +386 -0
  86. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/big5prober.py +47 -42
  87. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/chardistribution.py +233 -231
  88. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/charsetgroupprober.py +106 -0
  89. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/charsetprober.py +145 -0
  90. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/cli/__init__.py +1 -0
  91. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/cli/chardetect.py +85 -0
  92. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/codingstatemachine.py +88 -0
  93. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/compat.py +34 -34
  94. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/cp949prober.py +49 -44
  95. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/enums.py +76 -0
  96. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/escprober.py +101 -0
  97. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/escsm.py +246 -0
  98. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/eucjpprober.py +92 -0
  99. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/euckrfreq.py +195 -0
  100. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/euckrprober.py +47 -42
  101. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/euctwfreq.py +387 -428
  102. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/euctwprober.py +46 -41
  103. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/gb2312freq.py +283 -472
  104. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/gb2312prober.py +46 -41
  105. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/hebrewprober.py +292 -283
  106. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/jisfreq.py +325 -569
  107. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/jpcntx.py +233 -219
  108. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/langbulgarianmodel.py +228 -229
  109. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/langcyrillicmodel.py +333 -329
  110. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/langgreekmodel.py +225 -225
  111. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/langhebrewmodel.py +200 -201
  112. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/langhungarianmodel.py +225 -225
  113. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/langthaimodel.py +199 -200
  114. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/langturkishmodel.py +193 -0
  115. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/latin1prober.py +145 -139
  116. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/mbcharsetprober.py +91 -0
  117. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/mbcsgroupprober.py +54 -54
  118. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/mbcssm.py +572 -0
  119. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/sbcharsetprober.py +132 -0
  120. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/sbcsgroupprober.py +73 -69
  121. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/sjisprober.py +92 -0
  122. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/universaldetector.py +286 -0
  123. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/utf8prober.py +82 -76
  124. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/version.py +9 -0
  125. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/colorama/__init__.py +7 -7
  126. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/colorama/ansi.py +102 -50
  127. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/colorama/ansitowin32.py +236 -190
  128. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/colorama/initialise.py +82 -56
  129. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/colorama/win32.py +156 -137
  130. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/colorama/winterm.py +162 -120
  131. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/__init__.py +23 -23
  132. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/_backport/__init__.py +6 -6
  133. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/_backport/misc.py +41 -41
  134. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/_backport/shutil.py +761 -761
  135. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/_backport/sysconfig.cfg +84 -84
  136. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/_backport/sysconfig.py +788 -788
  137. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/_backport/tarfile.py +2607 -2607
  138. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/compat.py +1117 -1064
  139. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/database.py +1318 -1301
  140. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/index.py +516 -488
  141. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/locators.py +1292 -1194
  142. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/manifest.py +393 -364
  143. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/markers.py +131 -190
  144. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/metadata.py +1068 -1026
  145. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/resources.py +355 -317
  146. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/scripts.py +415 -323
  147. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/t32.exe +0 -0
  148. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/t64.exe +0 -0
  149. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/util.py +1755 -1575
  150. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/version.py +736 -721
  151. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/w32.exe +0 -0
  152. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/w64.exe +0 -0
  153. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/wheel.py +984 -958
  154. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distro.py +1104 -0
  155. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/__init__.py +35 -23
  156. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/{ihatexml.py → _ihatexml.py} +288 -285
  157. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/{inputstream.py → _inputstream.py} +923 -881
  158. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/{tokenizer.py → _tokenizer.py} +1721 -1731
  159. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/{trie → _trie}/__init__.py +14 -12
  160. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/{trie → _trie}/_base.py +37 -37
  161. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/{trie → _trie}/datrie.py +44 -44
  162. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/{trie → _trie}/py.py +67 -67
  163. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/{utils.py → _utils.py} +124 -82
  164. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/constants.py +2947 -3104
  165. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/filters/alphabeticalattributes.py +29 -20
  166. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/filters/{_base.py → base.py} +12 -12
  167. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/filters/inject_meta_charset.py +73 -65
  168. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/filters/lint.py +93 -93
  169. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/filters/optionaltags.py +207 -205
  170. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/filters/sanitizer.py +896 -12
  171. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/filters/whitespace.py +38 -38
  172. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/html5parser.py +2791 -2713
  173. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/serializer.py +409 -0
  174. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treeadapters/__init__.py +30 -0
  175. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treeadapters/genshi.py +54 -0
  176. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treeadapters/sax.py +50 -44
  177. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treebuilders/__init__.py +88 -76
  178. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treebuilders/{_base.py → base.py} +417 -377
  179. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treebuilders/dom.py +236 -227
  180. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treebuilders/etree.py +340 -337
  181. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.py +366 -369
  182. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treewalkers/__init__.py +154 -57
  183. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treewalkers/{_base.py → base.py} +252 -200
  184. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treewalkers/dom.py +43 -46
  185. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treewalkers/etree.py +130 -138
  186. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treewalkers/{lxmletree.py → etree_lxml.py} +213 -208
  187. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treewalkers/{genshistream.py → genshi.py} +69 -69
  188. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/idna/__init__.py +2 -0
  189. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/idna/codec.py +118 -0
  190. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/idna/compat.py +12 -0
  191. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/idna/core.py +387 -0
  192. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/idna/idnadata.py +1585 -0
  193. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/idna/intranges.py +53 -0
  194. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/idna/package_data.py +2 -0
  195. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/idna/uts46data.py +7634 -0
  196. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/ipaddress.py +2419 -0
  197. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/lockfile/__init__.py +347 -0
  198. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/lockfile/linklockfile.py +73 -0
  199. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/lockfile/mkdirlockfile.py +84 -0
  200. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/lockfile/pidlockfile.py +190 -0
  201. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/lockfile/sqlitelockfile.py +156 -0
  202. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/lockfile/symlinklockfile.py +70 -0
  203. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/msgpack/__init__.py +66 -0
  204. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/msgpack/_version.py +1 -0
  205. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/msgpack/exceptions.py +41 -0
  206. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/msgpack/fallback.py +971 -0
  207. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/packaging/__about__.py +21 -0
  208. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/packaging/__init__.py +14 -0
  209. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/packaging/_compat.py +30 -0
  210. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/packaging/_structures.py +70 -0
  211. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/packaging/markers.py +301 -0
  212. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/packaging/requirements.py +130 -0
  213. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/packaging/specifiers.py +774 -0
  214. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/packaging/utils.py +63 -0
  215. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/packaging/version.py +441 -0
  216. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{pkg_resources.py → pkg_resources/__init__.py} +3125 -2762
  217. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/pkg_resources/py31compat.py +22 -0
  218. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/progress/__init__.py +127 -0
  219. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/progress/bar.py +88 -0
  220. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/progress/counter.py +48 -0
  221. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/progress/helpers.py +91 -0
  222. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/progress/spinner.py +44 -0
  223. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/pyparsing.py +5720 -0
  224. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/pytoml/__init__.py +3 -0
  225. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/pytoml/core.py +13 -0
  226. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/pytoml/parser.py +374 -0
  227. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/pytoml/writer.py +127 -0
  228. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/__init__.py +123 -77
  229. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/__version__.py +14 -0
  230. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/_internal_utils.py +42 -0
  231. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/adapters.py +525 -388
  232. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/api.py +152 -120
  233. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/auth.py +293 -193
  234. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/certs.py +18 -24
  235. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/compat.py +73 -115
  236. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/cookies.py +542 -454
  237. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/exceptions.py +122 -75
  238. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/help.py +120 -0
  239. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/hooks.py +34 -45
  240. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/models.py +948 -803
  241. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages.py +16 -0
  242. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/sessions.py +737 -637
  243. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/status_codes.py +91 -88
  244. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/structures.py +105 -127
  245. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/utils.py +904 -673
  246. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/retrying.py +267 -0
  247. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/six.py +891 -646
  248. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/__init__.py +97 -0
  249. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/_collections.py +319 -0
  250. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/connection.py +373 -0
  251. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/urllib3 → urllib3}/connectionpool.py +905 -710
  252. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/contrib/__init__.py +0 -0
  253. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/contrib/_securetransport/__init__.py +0 -0
  254. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/contrib/_securetransport/bindings.py +593 -0
  255. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/contrib/_securetransport/low_level.py +343 -0
  256. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/contrib/appengine.py +296 -0
  257. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/urllib3 → urllib3}/contrib/ntlmpool.py +112 -120
  258. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/contrib/pyopenssl.py +455 -0
  259. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/contrib/securetransport.py +810 -0
  260. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/contrib/socks.py +188 -0
  261. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/exceptions.py +246 -0
  262. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/urllib3 → urllib3}/fields.py +178 -177
  263. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/urllib3 → urllib3}/filepost.py +94 -100
  264. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/urllib3 → urllib3}/packages/__init__.py +5 -4
  265. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/packages/backports/__init__.py +0 -0
  266. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/packages/backports/makefile.py +53 -0
  267. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/urllib3 → urllib3}/packages/ordered_dict.py +259 -260
  268. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/packages/six.py +868 -0
  269. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/urllib3 → urllib3}/packages/ssl_match_hostname/__init__.py +19 -13
  270. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/urllib3 → urllib3}/packages/ssl_match_hostname/_implementation.py +157 -105
  271. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/poolmanager.py +440 -0
  272. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/urllib3 → urllib3}/request.py +148 -141
  273. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/response.py +626 -0
  274. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/util/__init__.py +54 -0
  275. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/util/connection.py +130 -0
  276. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/util/request.py +118 -0
  277. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/util/response.py +81 -0
  278. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/util/retry.py +401 -0
  279. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/util/selectors.py +581 -0
  280. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/util/ssl_.py +341 -0
  281. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/urllib3 → urllib3}/util/timeout.py +242 -234
  282. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/urllib3 → urllib3}/util/url.py +230 -162
  283. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/util/wait.py +40 -0
  284. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/webencodings/__init__.py +342 -0
  285. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/webencodings/labels.py +231 -0
  286. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/webencodings/mklabels.py +59 -0
  287. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/webencodings/tests.py +153 -0
  288. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/webencodings/x_user_defined.py +325 -0
  289. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/_markerlib/__init__.py +0 -16
  290. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/_markerlib/markers.py +0 -119
  291. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/sanitizer.py +0 -271
  292. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/serializer/__init__.py +0 -16
  293. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/serializer/htmlserializer.py +0 -320
  294. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treewalkers/pulldom.py +0 -63
  295. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/re-vendor.py +0 -34
  296. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/__init__.py +0 -3
  297. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/big5freq.py +0 -925
  298. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/chardetect.py +0 -46
  299. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/charsetgroupprober.py +0 -106
  300. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/charsetprober.py +0 -62
  301. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/codingstatemachine.py +0 -61
  302. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/constants.py +0 -39
  303. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/escprober.py +0 -86
  304. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/escsm.py +0 -242
  305. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/eucjpprober.py +0 -90
  306. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/euckrfreq.py +0 -596
  307. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/mbcharsetprober.py +0 -86
  308. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/mbcssm.py +0 -575
  309. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/sbcharsetprober.py +0 -120
  310. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/sjisprober.py +0 -91
  311. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/universaldetector.py +0 -170
  312. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/__init__.py +0 -58
  313. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/_collections.py +0 -205
  314. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/connection.py +0 -204
  315. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/contrib/pyopenssl.py +0 -422
  316. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/exceptions.py +0 -126
  317. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/packages/six.py +0 -385
  318. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/poolmanager.py +0 -258
  319. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/response.py +0 -308
  320. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/util/__init__.py +0 -27
  321. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/util/connection.py +0 -45
  322. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/util/request.py +0 -68
  323. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/util/response.py +0 -13
  324. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py +0 -133
  325. package/python3.4.2/lib/python3.4/site-packages/pip/backwardcompat/__init__.py +0 -138
  326. package/python3.4.2/lib/python3.4/site-packages/pip/basecommand.py +0 -201
  327. package/python3.4.2/lib/python3.4/site-packages/pip/cmdoptions.py +0 -371
  328. package/python3.4.2/lib/python3.4/site-packages/pip/commands/__init__.py +0 -88
  329. package/python3.4.2/lib/python3.4/site-packages/pip/commands/bundle.py +0 -42
  330. package/python3.4.2/lib/python3.4/site-packages/pip/commands/completion.py +0 -59
  331. package/python3.4.2/lib/python3.4/site-packages/pip/commands/freeze.py +0 -114
  332. package/python3.4.2/lib/python3.4/site-packages/pip/commands/install.py +0 -314
  333. package/python3.4.2/lib/python3.4/site-packages/pip/commands/list.py +0 -162
  334. package/python3.4.2/lib/python3.4/site-packages/pip/commands/search.py +0 -132
  335. package/python3.4.2/lib/python3.4/site-packages/pip/commands/show.py +0 -80
  336. package/python3.4.2/lib/python3.4/site-packages/pip/commands/uninstall.py +0 -59
  337. package/python3.4.2/lib/python3.4/site-packages/pip/commands/unzip.py +0 -7
  338. package/python3.4.2/lib/python3.4/site-packages/pip/commands/wheel.py +0 -195
  339. package/python3.4.2/lib/python3.4/site-packages/pip/commands/zip.py +0 -351
  340. package/python3.4.2/lib/python3.4/site-packages/pip/download.py +0 -644
  341. package/python3.4.2/lib/python3.4/site-packages/pip/exceptions.py +0 -46
  342. package/python3.4.2/lib/python3.4/site-packages/pip/index.py +0 -990
  343. package/python3.4.2/lib/python3.4/site-packages/pip/locations.py +0 -171
  344. package/python3.4.2/lib/python3.4/site-packages/pip/log.py +0 -276
  345. package/python3.4.2/lib/python3.4/site-packages/pip/pep425tags.py +0 -102
  346. package/python3.4.2/lib/python3.4/site-packages/pip/req.py +0 -1931
  347. package/python3.4.2/lib/python3.4/site-packages/pip/runner.py +0 -18
  348. package/python3.4.2/lib/python3.4/site-packages/pip/util.py +0 -720
  349. package/python3.4.2/lib/python3.4/site-packages/pip/vcs/__init__.py +0 -251
  350. package/python3.4.2/lib/python3.4/site-packages/pip/vcs/bazaar.py +0 -131
  351. package/python3.4.2/lib/python3.4/site-packages/pip/vcs/git.py +0 -194
  352. package/python3.4.2/lib/python3.4/site-packages/pip/vcs/mercurial.py +0 -151
  353. package/python3.4.2/lib/python3.4/site-packages/pip/vcs/subversion.py +0 -273
  354. package/python3.4.2/lib/python3.4/site-packages/pip/wheel.py +0 -560
@@ -1,990 +0,0 @@
1
- """Routines related to PyPI, indexes"""
2
-
3
- import sys
4
- import os
5
- import re
6
- import mimetypes
7
- import posixpath
8
-
9
- from pip.log import logger
10
- from pip.util import Inf, normalize_name, splitext, is_prerelease
11
- from pip.exceptions import (DistributionNotFound, BestVersionAlreadyInstalled,
12
- InstallationError, InvalidWheelFilename, UnsupportedWheel)
13
- from pip.backwardcompat import urlparse, url2pathname
14
- from pip.download import PipSession, url_to_path, path_to_url
15
- from pip.wheel import Wheel, wheel_ext
16
- from pip.pep425tags import supported_tags, supported_tags_noarch, get_platform
17
- from pip._vendor import html5lib, requests, pkg_resources
18
- from pip._vendor.requests.exceptions import SSLError
19
-
20
-
21
- __all__ = ['PackageFinder']
22
-
23
-
24
- DEFAULT_MIRROR_HOSTNAME = "last.pypi.python.org"
25
-
26
- INSECURE_SCHEMES = {
27
- "http": ["https"],
28
- }
29
-
30
-
31
- class PackageFinder(object):
32
- """This finds packages.
33
-
34
- This is meant to match easy_install's technique for looking for
35
- packages, by reading pages and looking for appropriate links
36
- """
37
-
38
- def __init__(self, find_links, index_urls,
39
- use_wheel=True, allow_external=[], allow_unverified=[],
40
- allow_all_external=False, allow_all_prereleases=False,
41
- process_dependency_links=False, session=None):
42
- self.find_links = find_links
43
- self.index_urls = index_urls
44
- self.dependency_links = []
45
- self.cache = PageCache()
46
- # These are boring links that have already been logged somehow:
47
- self.logged_links = set()
48
-
49
- self.use_wheel = use_wheel
50
-
51
- # Do we allow (safe and verifiable) externally hosted files?
52
- self.allow_external = set(normalize_name(n) for n in allow_external)
53
-
54
- # Which names are allowed to install insecure and unverifiable files?
55
- self.allow_unverified = set(
56
- normalize_name(n) for n in allow_unverified
57
- )
58
-
59
- # Anything that is allowed unverified is also allowed external
60
- self.allow_external |= self.allow_unverified
61
-
62
- # Do we allow all (safe and verifiable) externally hosted files?
63
- self.allow_all_external = allow_all_external
64
-
65
- # Stores if we ignored any external links so that we can instruct
66
- # end users how to install them if no distributions are available
67
- self.need_warn_external = False
68
-
69
- # Stores if we ignored any unsafe links so that we can instruct
70
- # end users how to install them if no distributions are available
71
- self.need_warn_unverified = False
72
-
73
- # Do we want to allow _all_ pre-releases?
74
- self.allow_all_prereleases = allow_all_prereleases
75
-
76
- # Do we process dependency links?
77
- self.process_dependency_links = process_dependency_links
78
- self._have_warned_dependency_links = False
79
-
80
- # The Session we'll use to make requests
81
- self.session = session or PipSession()
82
-
83
- def add_dependency_links(self, links):
84
- ## FIXME: this shouldn't be global list this, it should only
85
- ## apply to requirements of the package that specifies the
86
- ## dependency_links value
87
- ## FIXME: also, we should track comes_from (i.e., use Link)
88
- if self.process_dependency_links:
89
- if not self._have_warned_dependency_links:
90
- logger.deprecated(
91
- "1.6",
92
- "Dependency Links processing has been deprecated with an "
93
- "accelerated time schedule and will be removed in pip 1.6",
94
- )
95
- self._have_warned_dependency_links = True
96
- self.dependency_links.extend(links)
97
-
98
- def _sort_locations(self, locations):
99
- """
100
- Sort locations into "files" (archives) and "urls", and return
101
- a pair of lists (files,urls)
102
- """
103
- files = []
104
- urls = []
105
-
106
- # puts the url for the given file path into the appropriate list
107
- def sort_path(path):
108
- url = path_to_url(path)
109
- if mimetypes.guess_type(url, strict=False)[0] == 'text/html':
110
- urls.append(url)
111
- else:
112
- files.append(url)
113
-
114
- for url in locations:
115
-
116
- is_local_path = os.path.exists(url)
117
- is_file_url = url.startswith('file:')
118
- is_find_link = url in self.find_links
119
-
120
- if is_local_path or is_file_url:
121
- if is_local_path:
122
- path = url
123
- else:
124
- path = url_to_path(url)
125
- if is_find_link and os.path.isdir(path):
126
- path = os.path.realpath(path)
127
- for item in os.listdir(path):
128
- sort_path(os.path.join(path, item))
129
- elif is_file_url and os.path.isdir(path):
130
- urls.append(url)
131
- elif os.path.isfile(path):
132
- sort_path(path)
133
- else:
134
- urls.append(url)
135
-
136
- return files, urls
137
-
138
- def _link_sort_key(self, link_tuple):
139
- """
140
- Function used to generate link sort key for link tuples.
141
- The greater the return value, the more preferred it is.
142
- If not finding wheels, then sorted by version only.
143
- If finding wheels, then the sort order is by version, then:
144
- 1. existing installs
145
- 2. wheels ordered via Wheel.support_index_min()
146
- 3. source archives
147
- Note: it was considered to embed this logic into the Link
148
- comparison operators, but then different sdist links
149
- with the same version, would have to be considered equal
150
- """
151
- parsed_version, link, _ = link_tuple
152
- if self.use_wheel:
153
- support_num = len(supported_tags)
154
- if link == INSTALLED_VERSION:
155
- pri = 1
156
- elif link.ext == wheel_ext:
157
- wheel = Wheel(link.filename) # can raise InvalidWheelFilename
158
- if not wheel.supported():
159
- raise UnsupportedWheel("%s is not a supported wheel for this platform. It can't be sorted." % wheel.filename)
160
- pri = -(wheel.support_index_min())
161
- else: # sdist
162
- pri = -(support_num)
163
- return (parsed_version, pri)
164
- else:
165
- return parsed_version
166
-
167
- def _sort_versions(self, applicable_versions):
168
- """
169
- Bring the latest version (and wheels) to the front, but maintain the existing ordering as secondary.
170
- See the docstring for `_link_sort_key` for details.
171
- This function is isolated for easier unit testing.
172
- """
173
- return sorted(applicable_versions, key=self._link_sort_key, reverse=True)
174
-
175
- def find_requirement(self, req, upgrade):
176
-
177
- def mkurl_pypi_url(url):
178
- loc = posixpath.join(url, url_name)
179
- # For maximum compatibility with easy_install, ensure the path
180
- # ends in a trailing slash. Although this isn't in the spec
181
- # (and PyPI can handle it without the slash) some other index
182
- # implementations might break if they relied on easy_install's behavior.
183
- if not loc.endswith('/'):
184
- loc = loc + '/'
185
- return loc
186
-
187
- url_name = req.url_name
188
- # Only check main index if index URL is given:
189
- main_index_url = None
190
- if self.index_urls:
191
- # Check that we have the url_name correctly spelled:
192
- main_index_url = Link(mkurl_pypi_url(self.index_urls[0]), trusted=True)
193
- # This will also cache the page, so it's okay that we get it again later:
194
- page = self._get_page(main_index_url, req)
195
- if page is None:
196
- url_name = self._find_url_name(Link(self.index_urls[0], trusted=True), url_name, req) or req.url_name
197
-
198
- if url_name is not None:
199
- locations = [
200
- mkurl_pypi_url(url)
201
- for url in self.index_urls] + self.find_links
202
- else:
203
- locations = list(self.find_links)
204
- for version in req.absolute_versions:
205
- if url_name is not None and main_index_url is not None:
206
- locations = [
207
- posixpath.join(main_index_url.url, version)] + locations
208
-
209
- file_locations, url_locations = self._sort_locations(locations)
210
- _flocations, _ulocations = self._sort_locations(self.dependency_links)
211
- file_locations.extend(_flocations)
212
-
213
- # We trust every url that the user has given us whether it was given
214
- # via --index-url or --find-links
215
- locations = [Link(url, trusted=True) for url in url_locations]
216
-
217
- # We explicitly do not trust links that came from dependency_links
218
- locations.extend([Link(url) for url in _ulocations])
219
-
220
- logger.debug('URLs to search for versions for %s:' % req)
221
- for location in locations:
222
- logger.debug('* %s' % location)
223
-
224
- # Determine if this url used a secure transport mechanism
225
- parsed = urlparse.urlparse(str(location))
226
- if parsed.scheme in INSECURE_SCHEMES:
227
- secure_schemes = INSECURE_SCHEMES[parsed.scheme]
228
-
229
- if len(secure_schemes) == 1:
230
- ctx = (location, parsed.scheme, secure_schemes[0],
231
- parsed.netloc)
232
- logger.warn("%s uses an insecure transport scheme (%s). "
233
- "Consider using %s if %s has it available" %
234
- ctx)
235
- elif len(secure_schemes) > 1:
236
- ctx = (location, parsed.scheme, ", ".join(secure_schemes),
237
- parsed.netloc)
238
- logger.warn("%s uses an insecure transport scheme (%s). "
239
- "Consider using one of %s if %s has any of "
240
- "them available" % ctx)
241
- else:
242
- ctx = (location, parsed.scheme)
243
- logger.warn("%s uses an insecure transport scheme (%s)." %
244
- ctx)
245
-
246
- found_versions = []
247
- found_versions.extend(
248
- self._package_versions(
249
- # We trust every directly linked archive in find_links
250
- [Link(url, '-f', trusted=True) for url in self.find_links], req.name.lower()))
251
- page_versions = []
252
- for page in self._get_pages(locations, req):
253
- logger.debug('Analyzing links from page %s' % page.url)
254
- logger.indent += 2
255
- try:
256
- page_versions.extend(self._package_versions(page.links, req.name.lower()))
257
- finally:
258
- logger.indent -= 2
259
- dependency_versions = list(self._package_versions(
260
- [Link(url) for url in self.dependency_links], req.name.lower()))
261
- if dependency_versions:
262
- logger.info('dependency_links found: %s' % ', '.join([link.url for parsed, link, version in dependency_versions]))
263
- file_versions = list(self._package_versions(
264
- [Link(url) for url in file_locations], req.name.lower()))
265
- if not found_versions and not page_versions and not dependency_versions and not file_versions:
266
- logger.fatal('Could not find any downloads that satisfy the requirement %s' % req)
267
-
268
- if self.need_warn_external:
269
- logger.warn("Some externally hosted files were ignored (use "
270
- "--allow-external %s to allow)." % req.name)
271
-
272
- if self.need_warn_unverified:
273
- logger.warn("Some insecure and unverifiable files were ignored"
274
- " (use --allow-unverified %s to allow)." %
275
- req.name)
276
-
277
- raise DistributionNotFound('No distributions at all found for %s' % req)
278
- installed_version = []
279
- if req.satisfied_by is not None:
280
- installed_version = [(req.satisfied_by.parsed_version, INSTALLED_VERSION, req.satisfied_by.version)]
281
- if file_versions:
282
- file_versions.sort(reverse=True)
283
- logger.info('Local files found: %s' % ', '.join([url_to_path(link.url) for parsed, link, version in file_versions]))
284
- #this is an intentional priority ordering
285
- all_versions = installed_version + file_versions + found_versions + page_versions + dependency_versions
286
- applicable_versions = []
287
- for (parsed_version, link, version) in all_versions:
288
- if version not in req.req:
289
- logger.info("Ignoring link %s, version %s doesn't match %s"
290
- % (link, version, ','.join([''.join(s) for s in req.req.specs])))
291
- continue
292
- elif is_prerelease(version) and not (self.allow_all_prereleases or req.prereleases):
293
- # If this version isn't the already installed one, then
294
- # ignore it if it's a pre-release.
295
- if link is not INSTALLED_VERSION:
296
- logger.info("Ignoring link %s, version %s is a pre-release (use --pre to allow)." % (link, version))
297
- continue
298
- applicable_versions.append((parsed_version, link, version))
299
- applicable_versions = self._sort_versions(applicable_versions)
300
- existing_applicable = bool([link for parsed_version, link, version in applicable_versions if link is INSTALLED_VERSION])
301
- if not upgrade and existing_applicable:
302
- if applicable_versions[0][1] is INSTALLED_VERSION:
303
- logger.info('Existing installed version (%s) is most up-to-date and satisfies requirement'
304
- % req.satisfied_by.version)
305
- else:
306
- logger.info('Existing installed version (%s) satisfies requirement (most up-to-date version is %s)'
307
- % (req.satisfied_by.version, applicable_versions[0][2]))
308
- return None
309
- if not applicable_versions:
310
- logger.fatal('Could not find a version that satisfies the requirement %s (from versions: %s)'
311
- % (req, ', '.join([version for parsed_version, link, version in all_versions])))
312
-
313
- if self.need_warn_external:
314
- logger.warn("Some externally hosted files were ignored (use "
315
- "--allow-external to allow).")
316
-
317
- if self.need_warn_unverified:
318
- logger.warn("Some insecure and unverifiable files were ignored"
319
- " (use --allow-unverified %s to allow)." %
320
- req.name)
321
-
322
- raise DistributionNotFound('No distributions matching the version for %s' % req)
323
- if applicable_versions[0][1] is INSTALLED_VERSION:
324
- # We have an existing version, and its the best version
325
- logger.info('Installed version (%s) is most up-to-date (past versions: %s)'
326
- % (req.satisfied_by.version, ', '.join([version for parsed_version, link, version in applicable_versions[1:]]) or 'none'))
327
- raise BestVersionAlreadyInstalled
328
- if len(applicable_versions) > 1:
329
- logger.info('Using version %s (newest of versions: %s)' %
330
- (applicable_versions[0][2], ', '.join([version for parsed_version, link, version in applicable_versions])))
331
-
332
- selected_version = applicable_versions[0][1]
333
-
334
- if (selected_version.internal is not None
335
- and not selected_version.internal):
336
- logger.warn("%s an externally hosted file and may be "
337
- "unreliable" % req.name)
338
-
339
- if (selected_version.verifiable is not None
340
- and not selected_version.verifiable):
341
- logger.warn("%s is potentially insecure and "
342
- "unverifiable." % req.name)
343
-
344
- if selected_version._deprecated_regex:
345
- logger.deprecated(
346
- "1.7",
347
- "%s discovered using a deprecated method of parsing, "
348
- "in the future it will no longer be discovered" % req.name
349
- )
350
-
351
- return selected_version
352
-
353
-
354
- def _find_url_name(self, index_url, url_name, req):
355
- """Finds the true URL name of a package, when the given name isn't quite correct.
356
- This is usually used to implement case-insensitivity."""
357
- if not index_url.url.endswith('/'):
358
- # Vaguely part of the PyPI API... weird but true.
359
- ## FIXME: bad to modify this?
360
- index_url.url += '/'
361
- page = self._get_page(index_url, req)
362
- if page is None:
363
- logger.fatal('Cannot fetch index base URL %s' % index_url)
364
- return
365
- norm_name = normalize_name(req.url_name)
366
- for link in page.links:
367
- base = posixpath.basename(link.path.rstrip('/'))
368
- if norm_name == normalize_name(base):
369
- logger.notify('Real name of requirement %s is %s' % (url_name, base))
370
- return base
371
- return None
372
-
373
- def _get_pages(self, locations, req):
374
- """
375
- Yields (page, page_url) from the given locations, skipping
376
- locations that have errors, and adding download/homepage links
377
- """
378
- all_locations = list(locations)
379
- seen = set()
380
-
381
- while all_locations:
382
- location = all_locations.pop(0)
383
- if location in seen:
384
- continue
385
- seen.add(location)
386
-
387
- page = self._get_page(location, req)
388
- if page is None:
389
- continue
390
-
391
- yield page
392
-
393
- for link in page.rel_links():
394
- normalized = normalize_name(req.name).lower()
395
-
396
- if (not normalized in self.allow_external
397
- and not self.allow_all_external):
398
- self.need_warn_external = True
399
- logger.debug("Not searching %s for files because external "
400
- "urls are disallowed." % link)
401
- continue
402
-
403
- if (link.trusted is not None
404
- and not link.trusted
405
- and not normalized in self.allow_unverified):
406
- logger.debug("Not searching %s for urls, it is an "
407
- "untrusted link and cannot produce safe or "
408
- "verifiable files." % link)
409
- self.need_warn_unverified = True
410
- continue
411
-
412
- all_locations.append(link)
413
-
414
- _egg_fragment_re = re.compile(r'#egg=([^&]*)')
415
- _egg_info_re = re.compile(r'([a-z0-9_.]+)-([a-z0-9_.-]+)', re.I)
416
- _py_version_re = re.compile(r'-py([123]\.?[0-9]?)$')
417
-
418
- def _sort_links(self, links):
419
- "Returns elements of links in order, non-egg links first, egg links second, while eliminating duplicates"
420
- eggs, no_eggs = [], []
421
- seen = set()
422
- for link in links:
423
- if link not in seen:
424
- seen.add(link)
425
- if link.egg_fragment:
426
- eggs.append(link)
427
- else:
428
- no_eggs.append(link)
429
- return no_eggs + eggs
430
-
431
- def _package_versions(self, links, search_name):
432
- for link in self._sort_links(links):
433
- for v in self._link_package_versions(link, search_name):
434
- yield v
435
-
436
- def _known_extensions(self):
437
- extensions = ('.tar.gz', '.tar.bz2', '.tar', '.tgz', '.zip')
438
- if self.use_wheel:
439
- return extensions + (wheel_ext,)
440
- return extensions
441
-
442
- def _link_package_versions(self, link, search_name):
443
- """
444
- Return an iterable of triples (pkg_resources_version_key,
445
- link, python_version) that can be extracted from the given
446
- link.
447
-
448
- Meant to be overridden by subclasses, not called by clients.
449
- """
450
- platform = get_platform()
451
-
452
- version = None
453
- if link.egg_fragment:
454
- egg_info = link.egg_fragment
455
- else:
456
- egg_info, ext = link.splitext()
457
- if not ext:
458
- if link not in self.logged_links:
459
- logger.debug('Skipping link %s; not a file' % link)
460
- self.logged_links.add(link)
461
- return []
462
- if egg_info.endswith('.tar'):
463
- # Special double-extension case:
464
- egg_info = egg_info[:-4]
465
- ext = '.tar' + ext
466
- if ext not in self._known_extensions():
467
- if link not in self.logged_links:
468
- logger.debug('Skipping link %s; unknown archive format: %s' % (link, ext))
469
- self.logged_links.add(link)
470
- return []
471
- if "macosx10" in link.path and ext == '.zip':
472
- if link not in self.logged_links:
473
- logger.debug('Skipping link %s; macosx10 one' % (link))
474
- self.logged_links.add(link)
475
- return []
476
- if ext == wheel_ext:
477
- try:
478
- wheel = Wheel(link.filename)
479
- except InvalidWheelFilename:
480
- logger.debug('Skipping %s because the wheel filename is invalid' % link)
481
- return []
482
- if wheel.name.lower() != search_name.lower():
483
- logger.debug('Skipping link %s; wrong project name (not %s)' % (link, search_name))
484
- return []
485
- if not wheel.supported():
486
- logger.debug('Skipping %s because it is not compatible with this Python' % link)
487
- return []
488
- # This is a dirty hack to prevent installing Binary Wheels from
489
- # PyPI unless it is a Windows or Mac Binary Wheel. This is
490
- # paired with a change to PyPI disabling uploads for the
491
- # same. Once we have a mechanism for enabling support for binary
492
- # wheels on linux that deals with the inherent problems of
493
- # binary distribution this can be removed.
494
- comes_from = getattr(link, "comes_from", None)
495
- if ((
496
- not platform.startswith('win')
497
- and not platform.startswith('macosx')
498
- )
499
- and comes_from is not None
500
- and urlparse.urlparse(comes_from.url).netloc.endswith(
501
- "pypi.python.org")):
502
- if not wheel.supported(tags=supported_tags_noarch):
503
- logger.debug(
504
- "Skipping %s because it is a pypi-hosted binary "
505
- "Wheel on an unsupported platform" % link
506
- )
507
- return []
508
- version = wheel.version
509
-
510
- if not version:
511
- version = self._egg_info_matches(egg_info, search_name, link)
512
- if version is None:
513
- logger.debug('Skipping link %s; wrong project name (not %s)' % (link, search_name))
514
- return []
515
-
516
- if (link.internal is not None
517
- and not link.internal
518
- and not normalize_name(search_name).lower() in self.allow_external
519
- and not self.allow_all_external):
520
- # We have a link that we are sure is external, so we should skip
521
- # it unless we are allowing externals
522
- logger.debug("Skipping %s because it is externally hosted." % link)
523
- self.need_warn_external = True
524
- return []
525
-
526
- if (link.verifiable is not None
527
- and not link.verifiable
528
- and not (normalize_name(search_name).lower()
529
- in self.allow_unverified)):
530
- # We have a link that we are sure we cannot verify it's integrity,
531
- # so we should skip it unless we are allowing unsafe installs
532
- # for this requirement.
533
- logger.debug("Skipping %s because it is an insecure and "
534
- "unverifiable file." % link)
535
- self.need_warn_unverified = True
536
- return []
537
-
538
- match = self._py_version_re.search(version)
539
- if match:
540
- version = version[:match.start()]
541
- py_version = match.group(1)
542
- if py_version != sys.version[:3]:
543
- logger.debug('Skipping %s because Python version is incorrect' % link)
544
- return []
545
- logger.debug('Found link %s, version: %s' % (link, version))
546
- return [(pkg_resources.parse_version(version),
547
- link,
548
- version)]
549
-
550
- def _egg_info_matches(self, egg_info, search_name, link):
551
- match = self._egg_info_re.search(egg_info)
552
- if not match:
553
- logger.debug('Could not parse version from link: %s' % link)
554
- return None
555
- name = match.group(0).lower()
556
- # To match the "safe" name that pkg_resources creates:
557
- name = name.replace('_', '-')
558
- # project name and version must be separated by a dash
559
- look_for = search_name.lower() + "-"
560
- if name.startswith(look_for):
561
- return match.group(0)[len(look_for):]
562
- else:
563
- return None
564
-
565
- def _get_page(self, link, req):
566
- return HTMLPage.get_page(link, req,
567
- cache=self.cache,
568
- session=self.session,
569
- )
570
-
571
-
572
- class PageCache(object):
573
- """Cache of HTML pages"""
574
-
575
- failure_limit = 3
576
-
577
- def __init__(self):
578
- self._failures = {}
579
- self._pages = {}
580
- self._archives = {}
581
-
582
- def too_many_failures(self, url):
583
- return self._failures.get(url, 0) >= self.failure_limit
584
-
585
- def get_page(self, url):
586
- return self._pages.get(url)
587
-
588
- def is_archive(self, url):
589
- return self._archives.get(url, False)
590
-
591
- def set_is_archive(self, url, value=True):
592
- self._archives[url] = value
593
-
594
- def add_page_failure(self, url, level):
595
- self._failures[url] = self._failures.get(url, 0)+level
596
-
597
- def add_page(self, urls, page):
598
- for url in urls:
599
- self._pages[url] = page
600
-
601
-
602
- class HTMLPage(object):
603
- """Represents one page, along with its URL"""
604
-
605
- ## FIXME: these regexes are horrible hacks:
606
- _homepage_re = re.compile(r'<th>\s*home\s*page', re.I)
607
- _download_re = re.compile(r'<th>\s*download\s+url', re.I)
608
- _href_re = re.compile('href=(?:"([^"]*)"|\'([^\']*)\'|([^>\\s\\n]*))', re.I|re.S)
609
-
610
- def __init__(self, content, url, headers=None, trusted=None):
611
- self.content = content
612
- self.parsed = html5lib.parse(self.content, namespaceHTMLElements=False)
613
- self.url = url
614
- self.headers = headers
615
- self.trusted = trusted
616
-
617
- def __str__(self):
618
- return self.url
619
-
620
- @classmethod
621
- def get_page(cls, link, req, cache=None, skip_archives=True, session=None):
622
- if session is None:
623
- session = PipSession()
624
-
625
- url = link.url
626
- url = url.split('#', 1)[0]
627
- if cache.too_many_failures(url):
628
- return None
629
-
630
- # Check for VCS schemes that do not support lookup as web pages.
631
- from pip.vcs import VcsSupport
632
- for scheme in VcsSupport.schemes:
633
- if url.lower().startswith(scheme) and url[len(scheme)] in '+:':
634
- logger.debug('Cannot look at %(scheme)s URL %(link)s' % locals())
635
- return None
636
-
637
- if cache is not None:
638
- inst = cache.get_page(url)
639
- if inst is not None:
640
- return inst
641
- try:
642
- if skip_archives:
643
- if cache is not None:
644
- if cache.is_archive(url):
645
- return None
646
- filename = link.filename
647
- for bad_ext in ['.tar', '.tar.gz', '.tar.bz2', '.tgz', '.zip']:
648
- if filename.endswith(bad_ext):
649
- content_type = cls._get_content_type(url,
650
- session=session,
651
- )
652
- if content_type.lower().startswith('text/html'):
653
- break
654
- else:
655
- logger.debug('Skipping page %s because of Content-Type: %s' % (link, content_type))
656
- if cache is not None:
657
- cache.set_is_archive(url)
658
- return None
659
- logger.debug('Getting page %s' % url)
660
-
661
- # Tack index.html onto file:// URLs that point to directories
662
- (scheme, netloc, path, params, query, fragment) = urlparse.urlparse(url)
663
- if scheme == 'file' and os.path.isdir(url2pathname(path)):
664
- # add trailing slash if not present so urljoin doesn't trim final segment
665
- if not url.endswith('/'):
666
- url += '/'
667
- url = urlparse.urljoin(url, 'index.html')
668
- logger.debug(' file: URL is directory, getting %s' % url)
669
-
670
- resp = session.get(url, headers={"Accept": "text/html"})
671
- resp.raise_for_status()
672
-
673
- # The check for archives above only works if the url ends with
674
- # something that looks like an archive. However that is not a
675
- # requirement. For instance http://sourceforge.net/projects/docutils/files/docutils/0.8.1/docutils-0.8.1.tar.gz/download
676
- # redirects to http://superb-dca3.dl.sourceforge.net/project/docutils/docutils/0.8.1/docutils-0.8.1.tar.gz
677
- # Unless we issue a HEAD request on every url we cannot know
678
- # ahead of time for sure if something is HTML or not. However we
679
- # can check after we've downloaded it.
680
- content_type = resp.headers.get('Content-Type', 'unknown')
681
- if not content_type.lower().startswith("text/html"):
682
- logger.debug('Skipping page %s because of Content-Type: %s' %
683
- (link, content_type))
684
- if cache is not None:
685
- cache.set_is_archive(url)
686
- return None
687
-
688
- inst = cls(resp.text, resp.url, resp.headers, trusted=link.trusted)
689
- except requests.HTTPError as exc:
690
- level = 2 if exc.response.status_code == 404 else 1
691
- cls._handle_fail(req, link, exc, url, cache=cache, level=level)
692
- except requests.ConnectionError as exc:
693
- cls._handle_fail(
694
- req, link, "connection error: %s" % exc, url,
695
- cache=cache,
696
- )
697
- except requests.Timeout:
698
- cls._handle_fail(req, link, "timed out", url, cache=cache)
699
- except SSLError as exc:
700
- reason = ("There was a problem confirming the ssl certificate: "
701
- "%s" % exc)
702
- cls._handle_fail(req, link, reason, url,
703
- cache=cache,
704
- level=2,
705
- meth=logger.notify,
706
- )
707
- else:
708
- if cache is not None:
709
- cache.add_page([url, resp.url], inst)
710
- return inst
711
-
712
- @staticmethod
713
- def _handle_fail(req, link, reason, url, cache=None, level=1, meth=None):
714
- if meth is None:
715
- meth = logger.info
716
-
717
- meth("Could not fetch URL %s: %s", link, reason)
718
- meth("Will skip URL %s when looking for download links for %s" %
719
- (link.url, req))
720
-
721
- if cache is not None:
722
- cache.add_page_failure(url, level)
723
-
724
- @staticmethod
725
- def _get_content_type(url, session=None):
726
- """Get the Content-Type of the given url, using a HEAD request"""
727
- if session is None:
728
- session = PipSession()
729
-
730
- scheme, netloc, path, query, fragment = urlparse.urlsplit(url)
731
- if not scheme in ('http', 'https', 'ftp', 'ftps'):
732
- ## FIXME: some warning or something?
733
- ## assertion error?
734
- return ''
735
-
736
- resp = session.head(url, allow_redirects=True)
737
- resp.raise_for_status()
738
-
739
- return resp.headers.get("Content-Type", "")
740
-
741
- @property
742
- def api_version(self):
743
- if not hasattr(self, "_api_version"):
744
- _api_version = None
745
-
746
- metas = [x for x in self.parsed.findall(".//meta")
747
- if x.get("name", "").lower() == "api-version"]
748
- if metas:
749
- try:
750
- _api_version = int(metas[0].get("value", None))
751
- except (TypeError, ValueError):
752
- _api_version = None
753
- self._api_version = _api_version
754
- return self._api_version
755
-
756
- @property
757
- def base_url(self):
758
- if not hasattr(self, "_base_url"):
759
- base = self.parsed.find(".//base")
760
- if base is not None and base.get("href"):
761
- self._base_url = base.get("href")
762
- else:
763
- self._base_url = self.url
764
- return self._base_url
765
-
766
- @property
767
- def links(self):
768
- """Yields all links in the page"""
769
- for anchor in self.parsed.findall(".//a"):
770
- if anchor.get("href"):
771
- href = anchor.get("href")
772
- url = self.clean_link(urlparse.urljoin(self.base_url, href))
773
-
774
- # Determine if this link is internal. If that distinction
775
- # doesn't make sense in this context, then we don't make
776
- # any distinction.
777
- internal = None
778
- if self.api_version and self.api_version >= 2:
779
- # Only api_versions >= 2 have a distinction between
780
- # external and internal links
781
- internal = bool(anchor.get("rel")
782
- and "internal" in anchor.get("rel").split())
783
-
784
- yield Link(url, self, internal=internal)
785
-
786
- def rel_links(self):
787
- for url in self.explicit_rel_links():
788
- yield url
789
- for url in self.scraped_rel_links():
790
- yield url
791
-
792
- def explicit_rel_links(self, rels=('homepage', 'download')):
793
- """Yields all links with the given relations"""
794
- rels = set(rels)
795
-
796
- for anchor in self.parsed.findall(".//a"):
797
- if anchor.get("rel") and anchor.get("href"):
798
- found_rels = set(anchor.get("rel").split())
799
- # Determine the intersection between what rels were found and
800
- # what rels were being looked for
801
- if found_rels & rels:
802
- href = anchor.get("href")
803
- url = self.clean_link(urlparse.urljoin(self.base_url, href))
804
- yield Link(url, self, trusted=False)
805
-
806
- def scraped_rel_links(self):
807
- # Can we get rid of this horrible horrible method?
808
- for regex in (self._homepage_re, self._download_re):
809
- match = regex.search(self.content)
810
- if not match:
811
- continue
812
- href_match = self._href_re.search(self.content, pos=match.end())
813
- if not href_match:
814
- continue
815
- url = href_match.group(1) or href_match.group(2) or href_match.group(3)
816
- if not url:
817
- continue
818
- url = self.clean_link(urlparse.urljoin(self.base_url, url))
819
- yield Link(url, self, trusted=False, _deprecated_regex=True)
820
-
821
- _clean_re = re.compile(r'[^a-z0-9$&+,/:;=?@.#%_\\|-]', re.I)
822
-
823
- def clean_link(self, url):
824
- """Makes sure a link is fully encoded. That is, if a ' ' shows up in
825
- the link, it will be rewritten to %20 (while not over-quoting
826
- % or other characters)."""
827
- return self._clean_re.sub(
828
- lambda match: '%%%2x' % ord(match.group(0)), url)
829
-
830
-
831
- class Link(object):
832
-
833
- def __init__(self, url, comes_from=None, internal=None, trusted=None,
834
- _deprecated_regex=False):
835
- self.url = url
836
- self.comes_from = comes_from
837
- self.internal = internal
838
- self.trusted = trusted
839
- self._deprecated_regex = _deprecated_regex
840
-
841
- def __str__(self):
842
- if self.comes_from:
843
- return '%s (from %s)' % (self.url, self.comes_from)
844
- else:
845
- return str(self.url)
846
-
847
- def __repr__(self):
848
- return '<Link %s>' % self
849
-
850
- def __eq__(self, other):
851
- return self.url == other.url
852
-
853
- def __ne__(self, other):
854
- return self.url != other.url
855
-
856
- def __lt__(self, other):
857
- return self.url < other.url
858
-
859
- def __le__(self, other):
860
- return self.url <= other.url
861
-
862
- def __gt__(self, other):
863
- return self.url > other.url
864
-
865
- def __ge__(self, other):
866
- return self.url >= other.url
867
-
868
- def __hash__(self):
869
- return hash(self.url)
870
-
871
- @property
872
- def filename(self):
873
- _, netloc, path, _, _ = urlparse.urlsplit(self.url)
874
- name = posixpath.basename(path.rstrip('/')) or netloc
875
- assert name, ('URL %r produced no filename' % self.url)
876
- return name
877
-
878
- @property
879
- def scheme(self):
880
- return urlparse.urlsplit(self.url)[0]
881
-
882
- @property
883
- def path(self):
884
- return urlparse.urlsplit(self.url)[2]
885
-
886
- def splitext(self):
887
- return splitext(posixpath.basename(self.path.rstrip('/')))
888
-
889
- @property
890
- def ext(self):
891
- return self.splitext()[1]
892
-
893
- @property
894
- def url_without_fragment(self):
895
- scheme, netloc, path, query, fragment = urlparse.urlsplit(self.url)
896
- return urlparse.urlunsplit((scheme, netloc, path, query, None))
897
-
898
- _egg_fragment_re = re.compile(r'#egg=([^&]*)')
899
-
900
- @property
901
- def egg_fragment(self):
902
- match = self._egg_fragment_re.search(self.url)
903
- if not match:
904
- return None
905
- return match.group(1)
906
-
907
- _hash_re = re.compile(r'(sha1|sha224|sha384|sha256|sha512|md5)=([a-f0-9]+)')
908
-
909
- @property
910
- def hash(self):
911
- match = self._hash_re.search(self.url)
912
- if match:
913
- return match.group(2)
914
- return None
915
-
916
- @property
917
- def hash_name(self):
918
- match = self._hash_re.search(self.url)
919
- if match:
920
- return match.group(1)
921
- return None
922
-
923
- @property
924
- def show_url(self):
925
- return posixpath.basename(self.url.split('#', 1)[0].split('?', 1)[0])
926
-
927
- @property
928
- def verifiable(self):
929
- """
930
- Returns True if this link can be verified after download, False if it
931
- cannot, and None if we cannot determine.
932
- """
933
- trusted = self.trusted or getattr(self.comes_from, "trusted", None)
934
- if trusted is not None and trusted:
935
- # This link came from a trusted source. It *may* be verifiable but
936
- # first we need to see if this page is operating under the new
937
- # API version.
938
- try:
939
- api_version = getattr(self.comes_from, "api_version", None)
940
- api_version = int(api_version)
941
- except (ValueError, TypeError):
942
- api_version = None
943
-
944
- if api_version is None or api_version <= 1:
945
- # This link is either trusted, or it came from a trusted,
946
- # however it is not operating under the API version 2 so
947
- # we can't make any claims about if it's safe or not
948
- return
949
-
950
- if self.hash:
951
- # This link came from a trusted source and it has a hash, so we
952
- # can consider it safe.
953
- return True
954
- else:
955
- # This link came from a trusted source, using the new API
956
- # version, and it does not have a hash. It is NOT verifiable
957
- return False
958
- elif trusted is not None:
959
- # This link came from an untrusted source and we cannot trust it
960
- return False
961
-
962
-
963
- # An object to represent the "link" for the installed version of a requirement.
964
- # Using Inf as the url makes it sort higher.
965
- INSTALLED_VERSION = Link(Inf)
966
-
967
-
968
- def get_requirement_from_url(url):
969
- """Get a requirement from the URL, if possible. This looks for #egg
970
- in the URL"""
971
- link = Link(url)
972
- egg_info = link.egg_fragment
973
- if not egg_info:
974
- egg_info = splitext(link.filename)[0]
975
- return package_to_requirement(egg_info)
976
-
977
-
978
- def package_to_requirement(package_name):
979
- """Translate a name like Foo-1.2 to Foo==1.3"""
980
- match = re.search(r'^(.*?)-(dev|\d.*)', package_name)
981
- if match:
982
- name = match.group(1)
983
- version = match.group(2)
984
- else:
985
- name = package_name
986
- version = ''
987
- if version:
988
- return '%s==%s' % (name, version)
989
- else:
990
- return name