Commit Graph

91 Commits

Author SHA1 Message Date
Tzu-ping Chung 288bffc43c Unify Python project root detection logic
A Python project root is now defined as containing a pyproject.toml, or
a setup.py (pre-PEP-517 legacy layout). After this patch, this logic
applies to all checks except parse_editable, where we check for setup.py
and setup.cfg instead since non-setuptools PEP 517 projects cannot be
installed as editable right now.
2021-06-19 15:29:04 +08:00
Stéphane Bidoul ecdcfeb8d6 Remove now unused VCS export code 2021-04-03 15:44:00 +02:00
Pradyun Gedam c2ba7c043b
Merge pull request #9606 from hexagonrecursion/fstr 2021-02-21 08:30:00 +00:00
Jon Dufresne 0945809afc Remove typing.TYPE_CHECKING guards
The typing module has been available since Python 3.5. Guarding the
import has been unnecessary since dropping Python 2.

Some guards remain to either:

- Avoid circular imports
- Importing objects that are also guarded by typing.TYPE_CHECKING
- Avoid mypy_extensions dependency
2021-02-19 18:34:21 -08:00
Jon Dufresne a6392bd62e Replace pip._internal.utils.typing with stdlib typing
The stdlib module has been available since Python 3.5 and the
TYPE_CHECKING constant has been available since 3.5.2.

By using stdlib, this removes the need for pip to maintain its own
Python 2 typing compatibility shim.
2021-02-18 19:09:13 -08:00
Tzu-ping Chung 503e6d6f33
Merge pull request #9413 from jdufresne/type-vcs
Complete type annotations for the vcs package
2021-02-18 18:41:03 +08:00
Andrey Bienkowski 9b2cb894ba Convert more str.format() calls to f-strings 2021-02-13 09:27:17 +03:00
Stéphane Bidoul 78b891a6d1
Remove unused VCS schemes
These schemes without + are support in an ad-hoc fashion in
parse_editable_requirement.
2021-01-18 09:11:08 +01:00
Stéphane Bidoul b3761f6fab
Remove support for git+git@ pseudo VCS URLs.
Now that we don't need to support git@
pseudo-urls, we can simplify the test for
valid VCS URLs based on link.is_vcs, which
is turns is based on the URL scheme.

This also means we fail earlier if a git@ pseudo
URL is used.

Since VCS requirements are not validated to be URLs
in Requirement constructors, we can simplify update_editable.
2021-01-18 09:11:07 +01:00
Jon Dufresne c985454b42 Complete type annotations for the vcs package 2021-01-12 18:59:08 -08:00
Pradyun Gedam 9b83654de8
Merge pull request #9331 from sbidoul/7969-revert-sbi
Revert #7969 and fix VCS stdout/stderr capture
2021-01-09 21:09:04 +00:00
Stéphane Bidoul 35604e5a4c
Merge pull request #9403 from jdufresne/get-revision
Harmonize return type of VersionControl.get_revision in subclasses
2021-01-01 19:36:20 +01:00
Jon Dufresne ca053fbe88 Handle ._get_svn_url_rev() returning None in .get_remote_url()
The method Subversion._get_svn_url_rev() will sometimes return None for
a remote URL. The calling code should handle this. If it is None, raise
a RemoteNotFoundError as prescribed by the parent class docstring.

Followup to 0b761a164c.
2020-12-31 14:36:58 -08:00
Jon Dufresne c513c5e890 Harmonize return type of VersionControl.get_revision in subclasses
Previously, the Subversion subclass violated the parent's type signature
by returning an int, but it is now coerced to a str to match the
expected signature.
2020-12-30 11:25:29 -08:00
Stéphane Bidoul b3d348d6e7
Merge remote-tracking branch 'upstream/master' into 7969-revert-sbi 2020-12-27 17:01:58 +01:00
Stéphane Bidoul 74369e860e
vcs: capture subprocess stdout only 2020-12-27 16:54:57 +01:00
Stéphane Bidoul 8665a3e1e2
Revert "Improve check for svn version string"
This reverts commit 1471897b84.
2020-12-27 16:54:57 +01:00
Stéphane Bidoul eda67075c1
Revert "Create call_subprocess just for vcs commands"
This reverts commit 8adbc216a6.
2020-12-27 16:54:56 +01:00
Stéphane Bidoul 6693a71e0a
Revert "Remove show_stdout from run_command args"
This reverts commit 94882fd1ed.
2020-12-27 16:54:56 +01:00
Jon Dufresne 0b761a164c Harmonize type signature of VersionControl.get_remote_url() subclasses
In the base class, the signature is defined as:

    type: (str) -> str

Further, the docstring says:

    Raises RemoteNotFoundError if the repository does not have a remote
    url configured.

However, some subclasses were returning None instead of raising
RemoteNotFoundError. This violated the type signature and forced calling
code to handle multiple error paradigms.

Now, all subclasses implement the base's signature.

This allowed simplifying some call sites as they can assume None will
not be returned.

This mismatch was noticed while trying to remove "mypy:
disallow-untyped-defs=False" comments.
2020-12-25 13:45:17 -08:00
Jon Dufresne c148bcc1aa Use short Python3 super() syntax 2020-12-24 15:11:51 -08:00
Jon Dufresne f32adaf09b Remove __future__ imports
Unnecessary since dropping Python 2.
2020-12-24 08:38:09 -08:00
Pradyun Gedam 25ab172b55
Update linter: isort 2020-09-23 19:52:28 +05:30
Tzu-ping Chung c3e1a153fd Improve SVN version parser
SVN has multiple distributions on Windows, e.g. SlikSVN, CollabNet. Some
of them suffix the version with a "-{distro}" part, which causes the
previous implementation to fail.

This patch removes that final part and make the version logic work.
2020-07-31 06:38:43 +08:00
Devesh Kumar Singh 76a130105c Fix src/pip with flake8-bugbear 2020-06-10 00:36:03 +05:30
Devesh Kumar Singh 94882fd1ed Remove show_stdout from run_command args 2020-05-23 19:13:13 +05:30
Devesh Kumar Singh 8adbc216a6 Create call_subprocess just for vcs commands 2020-05-23 19:13:13 +05:30
Devesh Kumar Singh 1471897b84 Improve check for svn version string 2020-05-23 19:13:13 +05:30
Jason R. Coombs 6282a307dc 👹 Feed the hobgoblins (delint). 2020-03-06 12:43:10 -05:00
Jason R. Coombs 3511d3d493 Convert the remaining '%' formatters to '.format'. Fixes #6973. 2020-03-06 12:43:03 -05:00
Emil Burzo c7e239c47c fix linter 2019-10-02 08:51:14 +03:00
Emil Burzo 004103c0f5 fix code quality issues 2019-10-02 08:33:41 +03:00
Emil Burzo 60d2ade74c remove no longer used import 2019-10-01 19:00:03 +03:00
Emil Burzo 7e50674393 extract function to misc 2019-10-01 18:55:13 +03:00
Emil Burzo 05a48404ca
fix crash when sys.stdin is None 2019-09-30 16:25:25 +03:00
Pradyun Gedam 2eafb0218b
Update all the imports as needed 2019-09-30 11:15:24 +05:30
Maxim Kurnikov 3692097cca add per-file disallow_untyped_defs=False, and set it to True globally 2019-09-29 23:31:15 +02:00
Chris Jerdonek 7783c47131
Hide security-sensitive strings in VCS command log messages (#6890) 2019-08-21 03:22:57 -07:00
Chris Jerdonek 393f626276 Add type annotations to VCS methods passing an url to run_command(). 2019-08-16 16:20:56 -07:00
Pradyun Gedam 537b0fca12
Change isort multi_line_output to 3 2019-07-22 10:15:27 +05:30
johnthagen d25e7410d0 Fix Subversion class method definition order (#6614)
* Fix Subversion class method definition order

* Move switch and update method to group with other instance methods.
Remove `svn info` from list of commands that need get_remote_call_args in docstring
2019-06-15 15:18:48 -07:00
Chris Jerdonek 5c89643d3d Remove importing from vcs in pip/_internal/__init__.py.
This also renames the current vcs/__init__.py to vcs/versioncontrol.py.
2019-06-03 01:18:36 -07:00
johnthagen eb3db3b032 Add type hints to methods to improve documentation and type safety 2019-05-23 07:38:22 -04:00
johnthagen fcbefc01e1
Merge branch 'master' into svn-interactive-final 2019-05-22 14:49:29 -04:00
johnthagen a708240d2b Document why get_remote_call_options is not needed for svn info invocation 2019-05-22 07:05:35 -04:00
Chris Jerdonek 68c105c29d Make VersionControl.fetch_new() an instance method. 2019-05-22 00:11:07 -07:00
johnthagen 00efe18954 Remove unnecessary get_remote_call_options() invocation for local `svn info` call 2019-05-21 07:13:53 -04:00
johnthagen b47bc7ad5c Properly support interactive Subversion features based on Subversion client version 2019-05-20 07:37:20 -04:00
johnthagen 1c07d87c9c Move Subversion.__init__() and call_vcs_version(). 2019-05-18 13:34:50 -07:00
johnthagen a83a78ef4d Add Subversion interactive support. 2019-05-18 13:34:45 -07:00