From 2cd8ed0d63f89a4009e9935065b104ccda896671 Mon Sep 17 00:00:00 2001 From: Nate Prewitt Date: Sat, 28 Jan 2017 22:34:36 -0700 Subject: [PATCH 1/3] move __PYENV_LAUNCHER__ unset so it's only run once --- pipenv/cli.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pipenv/cli.py b/pipenv/cli.py index 5dd4dfbc..98b975d9 100644 --- a/pipenv/cli.py +++ b/pipenv/cli.py @@ -39,6 +39,9 @@ click_completion.init() # Disable warnings for Python 2.6. requests.packages.urllib3.disable_warnings(InsecureRequestWarning) +# Prevent invalid shebangs with Homebrew-installed Python: https://bugs.python.org/issue22490 +os.environ.pop('__PYVENV_LAUNCHER__', None) + project = Project() @@ -499,8 +502,6 @@ def do_init(dev=False, requirements=False, skip_virtualenv=False, allow_global=F def pip_install(package_name=None, r=None, allow_global=False): - # Prevent invalid shebangs with Homebrew-installed Python: https://bugs.python.org/issue22490 - os.environ.pop('__PYVENV_LAUNCHER__', None) if r: c = delegator.run('{0} install -r {1} --require-hashes -i {2}'.format(which_pip(allow_global=allow_global), r, project.source['url'])) else: From 0346e8fe9f0c2c06edf9f7ef9f1bedaa1095d63e Mon Sep 17 00:00:00 2001 From: Nate Prewitt Date: Sat, 28 Jan 2017 22:36:40 -0700 Subject: [PATCH 2/3] update docstrings to match changes --- pipenv/cli.py | 5 +++-- pipenv/utils.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pipenv/cli.py b/pipenv/cli.py index 98b975d9..7668e01e 100644 --- a/pipenv/cli.py +++ b/pipenv/cli.py @@ -99,7 +99,7 @@ def ensure_project(three=None, python=None): def ensure_proper_casing(): - """Ensures proper casing of Pipfile packages, writes to disk.""" + """Ensures proper casing of Pipfile packages, writes changes to disk.""" p = project.parsed_pipfile def proper_case_section(section): @@ -257,11 +257,12 @@ def do_download_dependencies(dev=False, only=False, bare=False): return name_map + def parse_install_output(output): """Parse output from pip download to get name and file mappings for all dependencies and their sub dependencies. - This is required for proper file hashing with --require-hashes + This is required for proper file hashing with --require-hashes. """ output_sections = output.split('Collecting ') names = [] diff --git a/pipenv/utils.py b/pipenv/utils.py index ec68cf31..d62d724c 100644 --- a/pipenv/utils.py +++ b/pipenv/utils.py @@ -15,7 +15,6 @@ def format_toml(data): return '\n'.join(data) - def multi_split(s, split): """Splits on multiple given separators.""" for r in split: @@ -131,6 +130,7 @@ def mkdir_p(newdir): if tail: os.mkdir(newdir) + def is_required_version(version, specified_version): """Check to see if there's a hard requirement for version number provided in the Pipfile. From f6231d7386d3d81210e6482476006009280cd5da Mon Sep 17 00:00:00 2001 From: Nate Prewitt Date: Sat, 28 Jan 2017 22:38:03 -0700 Subject: [PATCH 3/3] move parsing into appropriate function --- pipenv/cli.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/pipenv/cli.py b/pipenv/cli.py index 7668e01e..90e42226 100644 --- a/pipenv/cli.py +++ b/pipenv/cli.py @@ -269,15 +269,19 @@ def parse_install_output(output): for section in output_sections: lines = section.split('\n') - # strip dependency data wrapped in parens - name = lines[0].split('(')[0].strip() + + # Strip dependency parens from name line. e.g. package (from other_package) + name = lines[0].split('(')[0] + # Strip version specification. e.g. package; python-version=2.6 + name = name.split(';')[0] + for line in lines: r = parse.parse('Saved {file}', line.strip()) if r is None: r = parse.parse('Using cached {file}', line.strip()) if r is None: continue - names.append((r['file'].replace('./.venv/downloads/', ''), name)) + names.append((r['file'].replace('./.venv/downloads/', ''), name.strip())) break return names @@ -333,9 +337,8 @@ def get_downloads_info(names_map, section): p = project.parsed_pipfile for fname in os.listdir(project.download_location): - # Remove version specification for 2.6 - package_name = names_map[fname].split(';')[0] - name = list(convert_deps_from_pip(package_name))[0] + # Get name from filename mapping. + name = list(convert_deps_from_pip(names_map[fname]))[0] # Get the version info from the filenames. version = parse_download_fname(fname)