Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge #3191, #3196 and #3209 #3217

Merged
merged 89 commits into from
Nov 14, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
80a6dcb
add PIPENV_SKIP_LOCK envvar, and suitable doc
devxpy Oct 27, 2018
023e786
fix PIPENV_SKIP_LOCK for `pipenv unisntall` command.
devxpy Oct 27, 2018
09ba364
Merge branch 'master' into master
devxpy Oct 30, 2018
e2769fe
Merge branch 'master' into master
devxpy Oct 30, 2018
9ed610f
Merge branch 'master' into master
devxpy Nov 3, 2018
18be92b
Merge branch 'master' into master
devxpy Nov 7, 2018
2b195dd
fix errors from merge
devxpy Nov 8, 2018
3eba19d
Improve toml parsing
frostming Nov 8, 2018
e147dc3
Drops prettytoml/contoml form vendors
frostming Nov 8, 2018
b27d6a7
clear references in patched.txt
frostming Nov 8, 2018
1555200
Add back some tests
frostming Nov 8, 2018
53b073c
python 2.7 unicode
frostming Nov 8, 2018
b3aa66b
make tomlkit dump toml's inline table
frostming Nov 8, 2018
9743d98
Merge branch 'master' into improve-toml-parse
techalchemy Nov 8, 2018
36f054d
Grab updates from latest vendored changes
techalchemy Nov 8, 2018
65d7090
Force inline table
frostming Nov 8, 2018
5b49670
Fix broken requirementslib updates
techalchemy Nov 8, 2018
f3003b6
Merge branch 'master' into update-vendor
techalchemy Nov 8, 2018
0762528
Final fix
frostming Nov 9, 2018
3490fc8
fix patch
frostming Nov 9, 2018
de78c1e
Only convert outline tables when write toml
frostming Nov 9, 2018
accd0ea
Move to utils function
frostming Nov 9, 2018
6df7d88
update tomlkit
frostming Nov 10, 2018
1f7c9ef
update patch
frostming Nov 10, 2018
de98b87
backports import
frostming Nov 10, 2018
f5c7c58
Change fallback style
frostming Nov 10, 2018
2b90c89
Revendor requirementslib
techalchemy Nov 11, 2018
dec7be5
Introduce `pipenv.environments.Environment`
techalchemy Nov 11, 2018
642b6f9
Update vistir and requirementslib
techalchemy Nov 11, 2018
aedb41c
Fix stdout and stderr wrappers
techalchemy Nov 11, 2018
45100b8
Fix stdout and stderr wrappers
techalchemy Nov 11, 2018
118c9d3
Add dramatically improved queued installation
techalchemy Nov 11, 2018
5602952
Merge branch 'update-vendor' of github.com:pypa/pipenv into update-ve…
techalchemy Nov 11, 2018
690d1e8
Merge branch 'update-vendor' into feature/improved-async-installer
techalchemy Nov 11, 2018
8644611
Merge branch 'master' into update-vendor
techalchemy Nov 11, 2018
ac96370
Merge branch 'update-vendor' into feature/improved-async-installer
techalchemy Nov 11, 2018
8643a73
Fix configparser import
techalchemy Nov 11, 2018
0caf7a0
Fix configparser import
techalchemy Nov 11, 2018
650cc32
Fix resource errors
techalchemy Nov 11, 2018
fe9d996
Fix resource errors
techalchemy Nov 11, 2018
e5be2ac
Fix python 2.7 installations
techalchemy Nov 12, 2018
382be38
Fix python 2.7 installations
techalchemy Nov 12, 2018
489e534
Fix various bugs with python 2.7 and vendored deps
techalchemy Nov 12, 2018
3984632
Fix various bugs with python 2.7 and vendored deps
techalchemy Nov 12, 2018
32a6dd3
Support python 2 parsing
techalchemy Nov 12, 2018
4009198
Fix environment site import
techalchemy Nov 12, 2018
32b1113
Support python 2 parsing
techalchemy Nov 12, 2018
1216ae0
Fix environment site import
techalchemy Nov 12, 2018
70fc92b
Fix import errors on setup parsing
techalchemy Nov 12, 2018
7e139ad
Fix import errors on setup parsing
techalchemy Nov 12, 2018
8502ac9
Revendor
techalchemy Nov 12, 2018
013e3d0
Revendor
techalchemy Nov 12, 2018
96cbd58
Fix prefix comparison for py2
techalchemy Nov 12, 2018
8fa4057
Merge branch 'master' into update-vendor
techalchemy Nov 12, 2018
0c7f287
Fix prefix comparison for py2
techalchemy Nov 12, 2018
eed0f0f
Merge branch 'master' into feature/improved-async-installer
techalchemy Nov 12, 2018
d7d50ef
no samefile for windows python2.7
techalchemy Nov 12, 2018
9eabde0
no samefile for windows python2.7
techalchemy Nov 12, 2018
ef59d15
Fix bugs in environment implementation
techalchemy Nov 13, 2018
9296f56
Fix bugs in environment implementation
techalchemy Nov 13, 2018
e62b800
Fix syntax
techalchemy Nov 13, 2018
cb601b0
Fix syntax
techalchemy Nov 13, 2018
13c9e62
Update pythonfinder
techalchemy Nov 13, 2018
7bc754a
Merge branch 'master' into update-vendor
techalchemy Nov 13, 2018
d73879b
Update requirementslib
techalchemy Nov 13, 2018
e328ae2
Fix feedback
techalchemy Nov 13, 2018
310e0b2
Fix pythonfinder
techalchemy Nov 13, 2018
6b3c9a7
Remove accidentally committed test script
techalchemy Nov 13, 2018
4370281
Merge branch 'update-vendor' into feature/improved-async-installer
techalchemy Nov 13, 2018
c3cdbfb
Merge remote-tracking branch 'frostming/improve-toml-parse' into main…
techalchemy Nov 13, 2018
72e2ef7
Derive source names from URLs when not supplied
techalchemy Nov 13, 2018
1e3b8f9
Update news entries
techalchemy Nov 13, 2018
15f8d78
Syntax error and pythonfinder issue fixes
techalchemy Nov 13, 2018
f494571
Code cleanup -- unused functions
techalchemy Nov 13, 2018
2e10ff6
Fix pythonfinder
techalchemy Nov 13, 2018
f9b97da
Get rid of split file test
techalchemy Nov 14, 2018
095c9ef
remove useless tests
frostming Nov 14, 2018
08c384b
Implement `auto_envvar_prefix`
techalchemy Nov 14, 2018
2f97279
Update vendor file
techalchemy Nov 14, 2018
3585ef1
Merge branch 'maintenance/merge-3191-3196-3209' of github.com:pypa/pi…
techalchemy Nov 14, 2018
ec166f9
Reformat cli and command code
techalchemy Nov 14, 2018
e864343
Merge remote-tracking branch 'devxpy/master' into maintenance/merge-3…
techalchemy Nov 14, 2018
86c894d
Woops, delegator isn't updated, neither packaging
techalchemy Nov 14, 2018
ada66d3
Remove old patch
techalchemy Nov 14, 2018
bfa0b29
Update vendored deps
techalchemy Nov 14, 2018
5e5e1ed
Stray print
techalchemy Nov 14, 2018
08d94d4
Update core and rebuild ci
techalchemy Nov 14, 2018
a8f4c7e
accidental commit
techalchemy Nov 14, 2018
41cbe4d
Pin postreleases to pass packaging ci
techalchemy Nov 14, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Grab updates from latest vendored changes
Signed-off-by: Dan Ryan <dan@danryan.co>
  • Loading branch information
techalchemy committed Nov 8, 2018
commit 36f054d3a81790918a9300808c4302f247a31685
2 changes: 1 addition & 1 deletion pipenv/vendor/pythonfinder/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import print_function, absolute_import

__version__ = '1.1.7'
__version__ = '1.1.8'

# Add NullHandler to "pythonfinder" logger, because Python2's default root
# logger has no handler and warnings like this would be reported:
Expand Down
7 changes: 5 additions & 2 deletions pipenv/vendor/pythonfinder/models/pyenv.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,16 @@ def expanded_paths(self):
)

def get_version_order(self):
version_order_file = self.root.joinpath("version").read_text(encoding="utf-8")
version_order_file, version_order_lines = self.root.joinpath("version"), []
if version_order_file.exists():
version_order_lines = version_order_file.read_text(encoding="utf-8").splitlines()

version_paths = [
p for p in self.root.glob("versions/*")
if not (p.parent.name == "envs" or p.name == "envs")
]
versions = {v.name: v for v in version_paths}
version_order = [versions[v] for v in version_order_file.splitlines() if v in versions]
version_order = [versions[v] for v in version_order_lines if v in versions]
for version in version_order:
version_paths.remove(version)
version_order += version_paths
Expand Down
2 changes: 1 addition & 1 deletion pipenv/vendor/pythonfinder/models/python.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def parse(cls, version):
def get_architecture(self):
if self.architecture:
return self.architecture
arch, _ = platform.architecture(path.path.as_posix())
arch, _ = platform.architecture(self.comes_from.path.as_posix())
self.architecture = arch
return self.architecture

Expand Down
2 changes: 1 addition & 1 deletion pipenv/vendor/requirementslib/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding=utf-8 -*-
__version__ = '1.2.5'
__version__ = '1.2.6'

import logging

Expand Down
37 changes: 0 additions & 37 deletions pipenv/vendor/requirementslib/models/baserequirement.py

This file was deleted.

6 changes: 3 additions & 3 deletions pipenv/vendor/requirementslib/models/markers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
from packaging.markers import InvalidMarker, Marker

from ..exceptions import RequirementError
from .baserequirement import BaseRequirement
from .utils import filter_none, validate_markers


@attr.s
class PipenvMarkers(BaseRequirement):
class PipenvMarkers(object):
"""System-level requirements - see PEP508 for more detail"""

os_name = attr.ib(
Expand Down Expand Up @@ -78,7 +77,8 @@ def from_line(cls, line):

@classmethod
def from_pipfile(cls, name, pipfile):
found_keys = [k for k in pipfile.keys() if k in cls.attr_fields()]
attr_fields = [field.name for field in attr.fields(cls)]
found_keys = [k for k in pipfile.keys() if k in attr_fields]
marker_strings = ["{0} {1}".format(k, pipfile[k]) for k in found_keys]
if pipfile.get("markers"):
marker_strings.append(pipfile.get("markers"))
Expand Down
39 changes: 33 additions & 6 deletions pipenv/vendor/requirementslib/models/pipfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,16 @@ def load(cls, f, encoding=None):
content = content.decode(encoding)
_data = tomlkit.loads(content)
if "source" not in _data:
# HACK: There is no good way to prepend a section to an existing
# TOML document, but there's no good way to copy non-structural
# content from one TOML document to another either. Modify the
# TOML content directly, and load the new in-memory document.
sep = "" if content.startswith("\n") else "\n"
content = plette.pipfiles.DEFAULT_SOURCE_TOML + sep + content
if "sources" in _data:
_data["source"] = _data["sources"]
content = tomlkit.dumps(_data)
else:
# HACK: There is no good way to prepend a section to an existing
# TOML document, but there's no good way to copy non-structural
# content from one TOML document to another either. Modify the
# TOML content directly, and load the new in-memory document.
sep = "" if content.startswith("\n") else "\n"
content = plette.pipfiles.DEFAULT_SOURCE_TOML + sep + content
data = tomlkit.loads(content)
return cls(data)

Expand All @@ -53,6 +57,8 @@ class Pipfile(object):
path = attr.ib(validator=is_path, type=Path)
projectfile = attr.ib(validator=is_projectfile, type=ProjectFile)
_pipfile = attr.ib(type=plette.pipfiles.Pipfile)
_pyproject = attr.ib(default=attr.Factory(tomlkit.document), type=tomlkit.toml_document.TOMLDocument)
build_system = attr.ib(default=attr.Factory(dict), type=dict)
requirements = attr.ib(default=attr.Factory(list), type=list)
dev_requirements = attr.ib(default=attr.Factory(list), type=list)

Expand Down Expand Up @@ -212,3 +218,24 @@ def packages(self, as_requirements=True):
if as_requirements:
return self.requirements
return self._pipfile.get('packages', {})

def _read_pyproject(self):
pyproject = self.path.parent.joinpath("pyproject.toml")
if pyproject.exists():
self._pyproject = tomlkit.load(pyproject)
build_system = self._pyproject.get("build-system", None)
if not os.path.exists(self.path_to("setup.py")):
if not build_system or not build_system.get("requires"):
build_system = {
"requires": ["setuptools>=38.2.5", "wheel"],
"build-backend": "setuptools.build_meta",
}
self._build_system = build_system

@property
def build_requires(self):
return self.build_system.get("requires", [])

@property
def build_backend(self):
return self.build_system.get("build-backend", None)
81 changes: 64 additions & 17 deletions pipenv/vendor/requirementslib/models/requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
add_ssh_scheme_to_git_uri,
strip_ssh_from_git_uri,
)
from .baserequirement import BaseRequirement
from .utils import (
HASH_STRING,
build_vcs_link,
Expand All @@ -61,7 +60,7 @@


@attr.s(slots=True)
class NamedRequirement(BaseRequirement):
class NamedRequirement(object):
name = attr.ib()
version = attr.ib(validator=attr.validators.optional(validate_specifiers))
req = attr.ib()
Expand Down Expand Up @@ -98,7 +97,8 @@ def from_line(cls, line):
def from_pipfile(cls, name, pipfile):
creation_args = {}
if hasattr(pipfile, "keys"):
creation_args = {k: v for k, v in pipfile.items() if k in cls.attr_fields()}
attr_fields = [field.name for field in attr.fields(cls)]
creation_args = {k: v for k, v in pipfile.items() if k in attr_fields}
creation_args["name"] = name
version = get_version(pipfile)
extras = creation_args.get("extras", None)
Expand Down Expand Up @@ -131,7 +131,7 @@ def pipfile_part(self):


@attr.s(slots=True)
class FileRequirement(BaseRequirement):
class FileRequirement(object):
"""File requirements for tar.gz installable files or wheels or setup.py
containing directories."""

Expand All @@ -152,6 +152,8 @@ class FileRequirement(BaseRequirement):
name = attr.ib()
#: A :class:`~pkg_resources.Requirement` isntance
req = attr.ib()
#: Whether this is a direct url requirement
is_direct = attr.ib(default=False)
_uri_scheme = attr.ib(default=None)

@classmethod
Expand Down Expand Up @@ -256,18 +258,26 @@ def get_link_from_line(cls, line):

return LinkInfo(vcs_type, prefer, relpath, path, uri, link)

def __attrs_post_init__(self):
if self.req and getattr(self.req, "url"):
self.uri = self.req.url

@uri.default
def get_uri(self):
if self.path and not self.uri:
self._uri_scheme = "path"
self.uri = pip_shims.shims.path_to_url(os.path.abspath(self.path))
elif self.req and getattr(self.req, "url"):
self.uri = self.req.url

@name.default
def get_name(self):
loc = self.path or self.uri
if loc:
self._uri_scheme = "path" if self.path else "uri"
name = None
if self.req and getattr(self.req, "name"):
return self.req.name
if self.link and self.link.egg_fragment:
return self.link.egg_fragment
elif self.link and self.link.is_wheel:
Expand Down Expand Up @@ -326,9 +336,18 @@ def get_link(self):

@req.default
def get_requirement(self):
req = init_requirement(normalize_name(self.name))
req.editable = False
req.line = self.link.url_without_fragment
if self.link.is_artifact and not self.editable:
if self._uri_scheme == "uri":
if self.name:
req_str = "{0} @{1}".format(self.name, self.link.url_without_fragment)
else:
req_str = "{0}".format(self.link.url_without_fragment)
req = init_requirement(req_str)
req.line = req_str
else:
req = init_requirement(normalize_name(self.name))
req.editable = False
req.line = self.link.url_without_fragment
if self.path and self.link and self.link.scheme.startswith("file"):
req.local_file = True
req.path = self.path
Expand All @@ -337,7 +356,8 @@ def get_requirement(self):
else:
req.local_file = False
req.path = None
req.url = self.link.url_without_fragment
if not getattr(req, "url", None):
req.url = self.link.url_without_fragment
if self.editable:
req.editable = True
req.link = self.link
Expand All @@ -351,9 +371,13 @@ def is_remote_artifact(self):
for scheme in ("http", "https", "ftp", "ftps", "uri")
)
and (self.link.is_artifact or self.link.is_wheel)
and not self.req.editable
and not self.editable
)

@property
def is_direct_url(self):
return self.is_remote_artifact

@property
def formatted_path(self):
if self.path:
Expand All @@ -371,10 +395,18 @@ def from_line(cls, line):
editable = line.startswith("-e ")
line = line.split(" ", 1)[1] if editable else line
setup_path = None
name = None
req = None
if not any([is_installable_file(line), is_valid_url(line), is_file_url(line)]):
raise RequirementError(
"Supplied requirement is not installable: {0!r}".format(line)
)
try:
req = init_requirement(line)
except Exception:
raise RequirementError(
"Supplied requirement is not installable: {0!r}".format(line)
)
else:
name = getattr(req, "name", None)
line = getattr(req, "url", None)
vcs_type, prefer, relpath, path, uri, link = cls.get_link_from_line(line)
setup_path = Path(path) / "setup.py" if path else None
arg_dict = {
Expand All @@ -389,8 +421,12 @@ def from_line(cls, line):
from pip_shims import Wheel

arg_dict["name"] = Wheel(link.filename).name
elif name:
arg_dict["name"] = name
elif link.egg_fragment:
arg_dict["name"] = link.egg_fragment
if req:
arg_dict["req"] = req
created = cls(**arg_dict)
return created

Expand Down Expand Up @@ -428,7 +464,9 @@ def from_pipfile(cls, name, pipfile):
if not uri:
uri = pip_shims.shims.path_to_url(path)
link = create_link(uri)

req = None
if link.is_artifact and not link.is_wheel and not link.scheme.startswith("file"):
req = init_requirement("{0}@{1}".format(name, uri))
arg_dict = {
"name": name,
"path": path,
Expand All @@ -437,6 +475,8 @@ def from_pipfile(cls, name, pipfile):
"link": link,
"uri_scheme": uri_scheme,
}
if req:
arg_dict["req"] = req
return cls(**arg_dict)

@property
Expand All @@ -449,7 +489,10 @@ def line_part(self):
seed = unquote(self.link.url_without_fragment) or self.uri
# add egg fragments to remote artifacts (valid urls only)
if not self._has_hashed_name and self.is_remote_artifact:
seed += "#egg={0}".format(self.name)
if not self.link.is_wheel and self.link.is_artifact:
seed = "{0}@{1}".format(self.name, seed)
else:
seed += "#egg={0}".format(self.name)
editable = "-e " if self.editable else ""
return "{0}{1}".format(editable, seed)

Expand Down Expand Up @@ -575,7 +618,8 @@ def get_requirement(self):
)
req = init_requirement(canonicalize_name(self.name))
req.editable = self.editable
req.url = self.uri
if not getattr(req, "url") and self.uri:
req.url = self.uri
req.line = self.link.url
if self.ref:
req.revision = self.ref
Expand Down Expand Up @@ -813,7 +857,7 @@ def pipfile_part(self):
class Requirement(object):
name = attr.ib()
vcs = attr.ib(default=None, validator=attr.validators.optional(validate_vcs))
req = attr.ib(default=None, validator=optional_instance_of(BaseRequirement))
req = attr.ib(default=None)
markers = attr.ib(default=None)
specifiers = attr.ib(validator=attr.validators.optional(validate_specifiers))
index = attr.ib(default=None)
Expand Down Expand Up @@ -915,8 +959,11 @@ def from_line(cls, line):
# Installable local files and installable non-vcs urls are handled
# as files, generally speaking
line_is_vcs = is_vcs(line)
# check for pep-508 compatible requirements
name, _, possible_url = line.partition("@")
if is_installable_file(line) or (
(is_file_url(line) or is_valid_url(line)) and not line_is_vcs
(is_valid_url(possible_url) or is_file_url(line) or is_valid_url(line)) and
not (line_is_vcs or is_vcs(possible_url))
):
r = FileRequirement.from_line(line_with_prefix)
elif line_is_vcs:
Expand Down
Loading