diff options
Diffstat (limited to 'venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_internal/vcs/bazaar.py')
| -rw-r--r-- | venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_internal/vcs/bazaar.py | 113 |
1 files changed, 0 insertions, 113 deletions
diff --git a/venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_internal/vcs/bazaar.py b/venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_internal/vcs/bazaar.py deleted file mode 100644 index 6ed629a..0000000 --- a/venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_internal/vcs/bazaar.py +++ /dev/null | |||
| @@ -1,113 +0,0 @@ | |||
| 1 | from __future__ import absolute_import | ||
| 2 | |||
| 3 | import logging | ||
| 4 | import os | ||
| 5 | |||
| 6 | from pip._vendor.six.moves.urllib import parse as urllib_parse | ||
| 7 | |||
| 8 | from pip._internal.download import path_to_url | ||
| 9 | from pip._internal.utils.misc import display_path, rmtree | ||
| 10 | from pip._internal.utils.temp_dir import TempDirectory | ||
| 11 | from pip._internal.vcs import VersionControl, vcs | ||
| 12 | |||
| 13 | logger = logging.getLogger(__name__) | ||
| 14 | |||
| 15 | |||
| 16 | class Bazaar(VersionControl): | ||
| 17 | name = 'bzr' | ||
| 18 | dirname = '.bzr' | ||
| 19 | repo_name = 'branch' | ||
| 20 | schemes = ( | ||
| 21 | 'bzr', 'bzr+http', 'bzr+https', 'bzr+ssh', 'bzr+sftp', 'bzr+ftp', | ||
| 22 | 'bzr+lp', | ||
| 23 | ) | ||
| 24 | |||
| 25 | def __init__(self, url=None, *args, **kwargs): | ||
| 26 | super(Bazaar, self).__init__(url, *args, **kwargs) | ||
| 27 | # This is only needed for python <2.7.5 | ||
| 28 | # Register lp but do not expose as a scheme to support bzr+lp. | ||
| 29 | if getattr(urllib_parse, 'uses_fragment', None): | ||
| 30 | urllib_parse.uses_fragment.extend(['lp']) | ||
| 31 | |||
| 32 | def get_base_rev_args(self, rev): | ||
| 33 | return ['-r', rev] | ||
| 34 | |||
| 35 | def export(self, location): | ||
| 36 | """ | ||
| 37 | Export the Bazaar repository at the url to the destination location | ||
| 38 | """ | ||
| 39 | # Remove the location to make sure Bazaar can export it correctly | ||
| 40 | if os.path.exists(location): | ||
| 41 | rmtree(location) | ||
| 42 | |||
| 43 | with TempDirectory(kind="export") as temp_dir: | ||
| 44 | self.unpack(temp_dir.path) | ||
| 45 | |||
| 46 | self.run_command( | ||
| 47 | ['export', location], | ||
| 48 | cwd=temp_dir.path, show_stdout=False, | ||
| 49 | ) | ||
| 50 | |||
| 51 | def switch(self, dest, url, rev_options): | ||
| 52 | self.run_command(['switch', url], cwd=dest) | ||
| 53 | |||
| 54 | def update(self, dest, rev_options): | ||
| 55 | cmd_args = ['pull', '-q'] + rev_options.to_args() | ||
| 56 | self.run_command(cmd_args, cwd=dest) | ||
| 57 | |||
| 58 | def obtain(self, dest): | ||
| 59 | url, rev = self.get_url_rev() | ||
| 60 | rev_options = self.make_rev_options(rev) | ||
| 61 | if self.check_destination(dest, url, rev_options): | ||
| 62 | rev_display = rev_options.to_display() | ||
| 63 | logger.info( | ||
| 64 | 'Checking out %s%s to %s', | ||
| 65 | url, | ||
| 66 | rev_display, | ||
| 67 | display_path(dest), | ||
| 68 | ) | ||
| 69 | cmd_args = ['branch', '-q'] + rev_options.to_args() + [url, dest] | ||
| 70 | self.run_command(cmd_args) | ||
| 71 | |||
| 72 | def get_url_rev(self): | ||
| 73 | # hotfix the URL scheme after removing bzr+ from bzr+ssh:// readd it | ||
| 74 | url, rev = super(Bazaar, self).get_url_rev() | ||
| 75 | if url.startswith('ssh://'): | ||
| 76 | url = 'bzr+' + url | ||
| 77 | return url, rev | ||
| 78 | |||
| 79 | def get_url(self, location): | ||
| 80 | urls = self.run_command(['info'], show_stdout=False, cwd=location) | ||
| 81 | for line in urls.splitlines(): | ||
| 82 | line = line.strip() | ||
| 83 | for x in ('checkout of branch: ', | ||
| 84 | 'parent branch: '): | ||
| 85 | if line.startswith(x): | ||
| 86 | repo = line.split(x)[1] | ||
| 87 | if self._is_local_repository(repo): | ||
| 88 | return path_to_url(repo) | ||
| 89 | return repo | ||
| 90 | return None | ||
| 91 | |||
| 92 | def get_revision(self, location): | ||
| 93 | revision = self.run_command( | ||
| 94 | ['revno'], show_stdout=False, cwd=location, | ||
| 95 | ) | ||
| 96 | return revision.splitlines()[-1] | ||
| 97 | |||
| 98 | def get_src_requirement(self, dist, location): | ||
| 99 | repo = self.get_url(location) | ||
| 100 | if not repo: | ||
| 101 | return None | ||
| 102 | if not repo.lower().startswith('bzr:'): | ||
| 103 | repo = 'bzr+' + repo | ||
| 104 | egg_project_name = dist.egg_name().split('-', 1)[0] | ||
| 105 | current_rev = self.get_revision(location) | ||
| 106 | return '%s@%s#egg=%s' % (repo, current_rev, egg_project_name) | ||
| 107 | |||
| 108 | def is_commit_id_equal(self, dest, name): | ||
| 109 | """Always assume the versions don't match""" | ||
| 110 | return False | ||
| 111 | |||
| 112 | |||
| 113 | vcs.register(Bazaar) | ||
