Skip to content

Commit

Permalink
Comments
Browse files Browse the repository at this point in the history
  • Loading branch information
uranusjr committed May 28, 2018
1 parent 824f822 commit f1a0d65
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
14 changes: 8 additions & 6 deletions pipenv/patched/piptools/repositories/pypi.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,15 @@
SafeFileCache,
)

from notpip._vendor.packaging.requirements import InvalidRequirement, Requirement
from notpip._vendor.packaging.version import Version, InvalidVersion, parse as parse_version
from notpip._vendor.packaging.version import parse as parse_version
from notpip._vendor.packaging.specifiers import SpecifierSet
from notpip._vendor.pyparsing import ParseException

from ..cache import CACHE_DIR
from pipenv.environments import PIPENV_CACHE_DIR
from ..exceptions import NoCandidateFound
from ..utils import (fs_str, is_pinned_requirement, lookup_table, as_tuple, key_from_req,
make_install_requirement, format_requirement, dedup)
from ..utils import (
fs_str, lookup_table,
is_pinned_requirement, make_install_requirement,
)

from .base import BaseRepository

Expand Down Expand Up @@ -266,6 +265,9 @@ def get_legacy_dependencies(self, ireq):
setup_requires = self.finder.get_extras_links(
dist.get_metadata_lines('requires.txt')
)
# HACK: Sometimes the InstallRequirement doesn't properly get
# these values set on it during the resolution process. It's
# difficult to pin down what is going wrong. This fixes things.
ireq.version = dist.version
ireq.project_name = dist.project_name
ireq.req = dist.as_requirement()
Expand Down
5 changes: 5 additions & 0 deletions pipenv/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,13 @@ class PipCommand(basecommand.Command):
if ' -i ' in dep:
dep, url = dep.split(' -i ')
req = Requirement.from_line(dep)

# req.as_line() is theoratically the same as dep, but is guarenteed to
# be normalized. This is safer than passing in dep.
# TODO: Stop passing dep lines around; just use requirement objects.
constraints.append(req.as_line())
# extra_constraints = []

if url:
index_lookup[req.name] = project.get_source(url=url).get('name')
if req.markers:
Expand Down
5 changes: 4 additions & 1 deletion tasks/vendoring/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,10 @@ def generate_patch(ctx, package_path, patch_description, base='HEAD'):
pkg = Path(package_path)
if len(pkg.parts) != 2 or pkg.parts[0] not in ('vendor', 'patched'):
raise ValueError('example usage: generate-patch patched/pew some-description')
patch_fn = '{0}-{1}.patch'.format(pkg.parts[1], patch_description)
if patch_description:
patch_fn = '{0}-{1}.patch'.format(pkg.parts[1], patch_description)
else:
patch_fn = '{0}.patch'.format(pkg.parts[1])
command = 'git diff {base} -p {root} > {out}'.format(
base=base,
root=Path('pipenv').joinpath(pkg),
Expand Down

0 comments on commit f1a0d65

Please sign in to comment.