|
11 | 11 | import shutil
|
12 | 12 | import stat
|
13 | 13 |
|
14 |
| -from pipenv.vendor.vistir.path import rmtree |
15 |
| - |
16 | 14 | logger = logging.getLogger(__name__)
|
17 | 15 |
|
18 | 16 |
|
19 |
| -from typing import Dict, Iterable, List, Optional |
20 |
| - |
21 |
| -from pipenv.patched.pip._internal.models.link import Link |
22 |
| -from pipenv.patched.pip._internal.network.download import Downloader |
23 |
| -from pipenv.patched.pip._internal.operations.prepare import ( |
24 |
| - File, |
25 |
| - get_file_url, |
26 |
| - get_http_url, |
27 |
| - unpack_vcs_link, |
28 |
| -) |
29 |
| -from pipenv.patched.pip._internal.utils.hashes import Hashes |
30 |
| -from pipenv.patched.pip._internal.utils.unpacking import unpack_file |
| 17 | +from typing import Dict, Iterable, List |
31 | 18 |
|
32 | 19 |
|
33 |
| -def is_socket(path): |
34 |
| - # type: (str) -> bool |
| 20 | +# This can be removed once this pr is merged |
| 21 | +# https://github.com/python/cpython/pull/16575 |
| 22 | +def is_socket(path: str) -> bool: |
35 | 23 | return stat.S_ISSOCK(os.lstat(path).st_mode)
|
36 | 24 |
|
37 | 25 |
|
38 |
| -def copy2_fixed(src, dest): |
39 |
| - # type: (str, str) -> None |
| 26 | +def copy2_fixed(src: str, dest: str) -> None: |
40 | 27 | """Wrap shutil.copy2() but map errors copying socket files to
|
41 | 28 | SpecialFileError as expected.
|
42 | 29 |
|
@@ -108,55 +95,3 @@ def ignore(d: str, names: List[str]) -> List[str]:
|
108 | 95 | symlinks=True,
|
109 | 96 | copy_function=_copy2_ignoring_special_files,
|
110 | 97 | )
|
111 |
| - |
112 |
| - |
113 |
| -def old_unpack_url( |
114 |
| - link: Link, |
115 |
| - location: str, |
116 |
| - download: Downloader, |
117 |
| - verbosity: int, |
118 |
| - download_dir: Optional[str] = None, |
119 |
| - hashes: Optional[Hashes] = None, |
120 |
| -) -> Optional[File]: |
121 |
| - """Unpack link into location, downloading if required. |
122 |
| -
|
123 |
| - :param hashes: A Hashes object, one of whose embedded hashes must match, |
124 |
| - or HashMismatch will be raised. If the Hashes is empty, no matches are |
125 |
| - required, and unhashable types of requirements (like VCS ones, which |
126 |
| - would ordinarily raise HashUnsupported) are allowed. |
127 |
| - """ |
128 |
| - # non-editable vcs urls |
129 |
| - if link.is_vcs: |
130 |
| - unpack_vcs_link(link, location, verbosity=verbosity) |
131 |
| - return None |
132 |
| - |
133 |
| - # Once out-of-tree-builds are no longer supported, could potentially |
134 |
| - # replace the below condition with `assert not link.is_existing_dir` |
135 |
| - # - unpack_url does not need to be called for in-tree-builds. |
136 |
| - # |
137 |
| - # As further cleanup, _copy_source_tree and accompanying tests can |
138 |
| - # be removed. |
139 |
| - # |
140 |
| - # TODO when use-deprecated=out-of-tree-build is removed |
141 |
| - if link.is_existing_dir(): |
142 |
| - if os.path.isdir(location): |
143 |
| - rmtree(location) |
144 |
| - _copy_source_tree(link.file_path, location) |
145 |
| - return None |
146 |
| - |
147 |
| - # file urls |
148 |
| - if link.is_file: |
149 |
| - file = get_file_url(link, download_dir, hashes=hashes) |
150 |
| - # http urls |
151 |
| - else: |
152 |
| - file = get_http_url( |
153 |
| - link, |
154 |
| - download, |
155 |
| - download_dir, |
156 |
| - hashes=hashes, |
157 |
| - ) |
158 |
| - # unpack the archive to the build dir location. even when only downloading |
159 |
| - # archives, they have to be unpacked to parse dependencies, except wheels |
160 |
| - if not link.is_wheel: |
161 |
| - unpack_file(file.path, location, file.content_type) |
162 |
| - return file |
0 commit comments