forked from aboutcode-org/fetchcode
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bump pip's src from 20.1.1 to 21.2.4
Please note that fetchcode's vcs might not work on this branch. Initially pip was commited without it's history and with few changes applied. This update approaches this differently- by commiting pip code in a single commit & applying changes on top of it in separate commits. While much of pip's code will be stripped from this repository, the goal of this is to make it easier to take changes from upstream, even after the code will be modified. While git-subtree could be used it brings it's own set of issues. Update should make it easier to track potentially replicated issues from pip when taking their vcs pkg. It also made cleaning up easier, due to some maintenance activities done in pip: - dropping Python 2 & 3.5 support pypa/pip#9189 - modernized code after above - partially done, tracked in: pypa/pip#8802 - added py3.9 support - updated vendored libraries (e.g. fixing CVE-2021-28363) multiple PRs pip._internal.vcs (and related code) changes between 20.1.1 and 21.2.4 - Fetch resources that are missing locally: pypa/pip#8817 - Improve SVN version parser (Windows) pypa/pip#8665 - Always close stderr after subprocess completion: pypa/pip#9156 - Remove vcs export feature: pypa/pip#9713 - Remove support for git+ssh@ scheme in favour of git+ssh:// pypa/pip#9436 - Security fix in git tags parsing (CVE-2021-3572): pypa/pip#9827 - Reimplement Git version parsing: pypa/pip#10117 In next commits, most of pip's internals will be removed from fetchcode, leaving only vcs module with supporting code (like utils functions, tests (which will be submitted alongside this change)) This will allow for changes such as ability to add return codes (probably via futures) from long running downloads and other features. Switching to having own vcs module might also be a good call due to pip._internal.vcs integration with pip's cli in vcs module (some pip code has been commented out in commit mentioned below) While generally copy-pasting code (rather than using submodules/subtrees etc) makes it harder to track, my git-foo is not great enough for me to attempt regrafting subset of pips history that is of note from fetchcode perspective. It has been agreed with @pombredanne & @TG1999 that history from pip will be regrafted on fetchcode by @pombredanne (thanks!). It will be done only for the files that are of concern for fetchcode to limit noise in git history. The code submitted in scope of this commit is work of many pip's authors that can bee seen here: https://github.com/pypa/pip/blob/21.2.4/AUTHORS.txt Pip is licensed under MIT (https://pypi.org/project/pip/) Signed-off-by: Alexander Mazuruk <[email protected]>
- Loading branch information
1 parent
4c8b749
commit faa7ffd
Showing
312 changed files
with
58,271 additions
and
18,370 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,13 @@ | ||
from fetchcode.vcs.pip._internal.utils.typing import MYPY_CHECK_RUNNING | ||
from typing import List, Optional | ||
|
||
if MYPY_CHECK_RUNNING: | ||
from typing import List, Optional | ||
__version__ = "21.2.4" | ||
|
||
|
||
__version__ = "20.1.1" | ||
|
||
|
||
def main(args=None): | ||
# type: (Optional[List[str]]) -> int | ||
def main(args: Optional[List[str]] = None) -> int: | ||
"""This is an internal API only meant for use by pip's own console scripts. | ||
For additional details, see https://github.com/pypa/pip/issues/7498. | ||
""" | ||
from fetchcode.vcs.pip._internal.utils.entrypoints import _wrapper | ||
from pip._internal.utils.entrypoints import _wrapper | ||
|
||
return _wrapper(args) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,31 @@ | ||
from __future__ import absolute_import | ||
|
||
import os | ||
import sys | ||
import warnings | ||
|
||
# Remove '' and current working directory from the first entry | ||
# of sys.path, if present to avoid using current directory | ||
# in pip commands check, freeze, install, list and show, | ||
# when invoked as python -m pip <command> | ||
if sys.path[0] in ('', os.getcwd()): | ||
if sys.path[0] in ("", os.getcwd()): | ||
sys.path.pop(0) | ||
|
||
# If we are running from a wheel, add the wheel to sys.path | ||
# This allows the usage python pip-*.whl/pip install pip-*.whl | ||
if __package__ == '': | ||
if __package__ == "": | ||
# __file__ is pip-*.whl/pip/__main__.py | ||
# first dirname call strips of '/__main__.py', second strips off '/pip' | ||
# Resulting path is the name of the wheel itself | ||
# Add that to sys.path so we can import pip | ||
path = os.path.dirname(os.path.dirname(__file__)) | ||
sys.path.insert(0, path) | ||
|
||
from fetchcode.vcs.pip._internal.cli.main import main as _main # isort:skip # noqa | ||
if __name__ == "__main__": | ||
# Work around the error reported in #9540, pending a proper fix. | ||
# Note: It is essential the warning filter is set *before* importing | ||
# pip, as the deprecation happens at import time, not runtime. | ||
warnings.filterwarnings( | ||
"ignore", category=DeprecationWarning, module=".*packaging\\.version" | ||
) | ||
from pip._internal.cli.main import main as _main | ||
|
||
if __name__ == '__main__': | ||
sys.exit(_main()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,19 @@ | ||
import fetchcode.vcs.pip._internal.utils.inject_securetransport # noqa | ||
from fetchcode.vcs.pip._internal.utils.typing import MYPY_CHECK_RUNNING | ||
from typing import List, Optional | ||
|
||
if MYPY_CHECK_RUNNING: | ||
from typing import Optional, List | ||
import pip._internal.utils.inject_securetransport # noqa | ||
from pip._internal.utils import _log | ||
|
||
# init_logging() must be called before any call to logging.getLogger() | ||
# which happens at import of most modules. | ||
_log.init_logging() | ||
|
||
def main(args=None): | ||
# type: (Optional[List[str]]) -> int | ||
|
||
def main(args: (Optional[List[str]]) = None) -> int: | ||
"""This is preserved for old console scripts that may still be referencing | ||
it. | ||
For additional details, see https://github.com/pypa/pip/issues/7498. | ||
""" | ||
from fetchcode.vcs.pip._internal.utils.entrypoints import _wrapper | ||
from pip._internal.utils.entrypoints import _wrapper | ||
|
||
return _wrapper(args) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.