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

Create a new wheel_builder module and move WheelBuilder+friends #7288

Merged
merged 4 commits into from
Nov 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions src/pip/_internal/commands/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@
from pip._internal.utils.temp_dir import TempDirectory
from pip._internal.utils.typing import MYPY_CHECK_RUNNING
from pip._internal.utils.virtualenv import virtualenv_no_global
from pip._internal.wheel import WheelBuilder
from pip._internal.wheel_builder import WheelBuilder

if MYPY_CHECK_RUNNING:
from optparse import Values
from typing import Any, List, Optional

from pip._internal.models.format_control import FormatControl
from pip._internal.req.req_install import InstallRequirement
from pip._internal.wheel import BinaryAllowedPredicate
from pip._internal.wheel_builder import BinaryAllowedPredicate


logger = logging.getLogger(__name__)
Expand Down
2 changes: 1 addition & 1 deletion src/pip/_internal/commands/wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from pip._internal.req.req_tracker import RequirementTracker
from pip._internal.utils.temp_dir import TempDirectory
from pip._internal.utils.typing import MYPY_CHECK_RUNNING
from pip._internal.wheel import WheelBuilder
from pip._internal.wheel_builder import WheelBuilder

if MYPY_CHECK_RUNNING:
from optparse import Values
Expand Down
15 changes: 15 additions & 0 deletions src/pip/_internal/utils/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import contextlib
import errno
import getpass
import hashlib
import io
import logging
import os
Expand Down Expand Up @@ -868,3 +869,17 @@ def is_console_interactive():
"""Is this console interactive?
"""
return sys.stdin is not None and sys.stdin.isatty()


def hash_file(path, blocksize=1 << 20):
# type: (str, int) -> Tuple[Any, int]
"""Return (hash, length) for path using hashlib.sha256()
"""

h = hashlib.sha256()
length = 0
with open(path, 'rb') as f:
for block in read_chunks(f, size=blocksize):
length += len(block)
h.update(block)
return (h, length) # type: ignore
Loading