mirror of
https://github.com/kennethreitz/pipenv.git
synced 2026-06-05 22:50:18 +00:00
@@ -8,4 +8,5 @@ requirements-parser = "*"
|
||||
"backports.shutil_get_terminal_size" = "*"
|
||||
parse = "*"
|
||||
toml = "*"
|
||||
requests = "*"
|
||||
click = "*"
|
||||
|
||||
Generated
+5
-1
@@ -36,6 +36,10 @@
|
||||
"version": "==0.3.7",
|
||||
"hash": "sha256:a4c0f5bc358a62849653471e309dcc991223cf86abafbec17cd8f41327279e89"
|
||||
},
|
||||
"requests": {
|
||||
"version": "==2.13.0",
|
||||
"hash": "sha256:1a720e8862a41aa22e339373b526f508ef0c8988baf48b84d3fc891a8e237efb"
|
||||
},
|
||||
"click": {
|
||||
"version": "==6.7",
|
||||
"hash": "sha256:29f99fc6125fbc931b758dc053b3114e55c77a6e4c6c3a2674a2dc986016381d"
|
||||
@@ -79,6 +83,6 @@
|
||||
}
|
||||
],
|
||||
"requires": {},
|
||||
"Pipfile-sha256": "bceb0e55b886dea8ff6ada0dfe673c18a010695c160b0643e93c0fb6c5337fd6"
|
||||
"Pipfile-sha256": "24f12b631b7c40b8c5eff934a1aef263ed04f5eaffb4acf4706442f3d23cba36"
|
||||
}
|
||||
}
|
||||
+24
-2
@@ -6,6 +6,7 @@ import sys
|
||||
import distutils.spawn
|
||||
import shutil
|
||||
import signal
|
||||
from HTMLParser import HTMLParser
|
||||
|
||||
# Backport required for earlier versions of Python.
|
||||
if sys.version_info < (3, 3):
|
||||
@@ -18,6 +19,7 @@ import crayons
|
||||
import delegator
|
||||
import parse
|
||||
import pexpect
|
||||
import requests
|
||||
|
||||
from . import _pipfile as pipfile
|
||||
from .project import Project
|
||||
@@ -396,6 +398,26 @@ def which_pip(allow_global=False):
|
||||
|
||||
return which('pip')
|
||||
|
||||
def proper_case(package_name):
|
||||
|
||||
# Capture tag contents here.
|
||||
collected = []
|
||||
|
||||
class SimpleHTMLParser(HTMLParser):
|
||||
def handle_data(self, data):
|
||||
if len(data) > 2:
|
||||
collected.append(data)
|
||||
|
||||
# Hit the simple API.
|
||||
r = requests.get('{0}/{1}'.format(project.source['url'], package_name))
|
||||
|
||||
# Parse the HTML.
|
||||
parser = SimpleHTMLParser()
|
||||
parser.feed(r.content)
|
||||
|
||||
# Use the last link on the page, use it to get proper casing.
|
||||
return parse_download_fname(collected[-1])[0]
|
||||
|
||||
def format_help(help):
|
||||
"""Formats the help string."""
|
||||
help = help.replace(' check', str(crayons.green(' check')))
|
||||
@@ -499,8 +521,8 @@ def install(package_name=False, more_packages=False, dev=False, three=False, sys
|
||||
|
||||
for package_name in package_names:
|
||||
|
||||
# Lower-case incoming package name.
|
||||
package_name = package_name
|
||||
# Proper-case incoming package name (check against API).
|
||||
package_name = proper_case(package_name)
|
||||
|
||||
click.echo('Installing {0}...'.format(crayons.green(package_name)))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user