1
1
Fork 0
mirror of https://github.com/pypa/pip synced 2023-12-13 21:30:23 +01:00

Merge branch 'launchpad' of https://github.com/pnasrat/pip into develop

This commit is contained in:
Paul Nasrat 2011-05-03 21:56:25 +01:00
commit 3b4f620566
3 changed files with 39 additions and 2 deletions

View file

@ -104,12 +104,13 @@ Bazaar
~~~~~~
Pip supports Bazaar using the ``bzr+http``, ``bzr+https``, ``bzr+ssh``,
``bzr+sftp`` and ``bzr+ftp`` schemes::
``bzr+sftp``, ``bzr+ftp`` and ``bzr+lp`` schemes::
-e bzr+http://bzr.myproject.org/MyProject/trunk/#egg=MyProject
-e bzr+sftp://user@myproject.org/MyProject/trunk/#egg=MyProject
-e bzr+ssh://user@myproject.org/MyProject/trunk/#egg=MyProject
-e bzr+ftp://user@myproject.org/MyProject/trunk/#egg=MyProject
-e bzr+lp:MyProject#egg=MyProject
Tags or revisions can be installed like this::

View file

@ -2,6 +2,7 @@ import os
import tempfile
import re
from pip import call_subprocess
from pip.backwardcompat import urlparse
from pip.log import logger
from pip.util import rmtree, display_path
from pip.vcs import vcs, VersionControl
@ -13,10 +14,16 @@ class Bazaar(VersionControl):
dirname = '.bzr'
repo_name = 'branch'
bundle_file = 'bzr-branch.txt'
schemes = ('bzr', 'bzr+http', 'bzr+https', 'bzr+ssh', 'bzr+sftp', 'bzr+ftp')
schemes = ('bzr', 'bzr+http', 'bzr+https', 'bzr+ssh', 'bzr+sftp', 'bzr+ftp', 'bzr+lp')
guide = ('# This was a Bazaar branch; to make it a branch again run:\n'
'bzr branch -r %(rev)s %(url)s .\n')
def __init__(self, url=None, *args, **kwargs):
super(Bazaar, self).__init__(url, *args, **kwargs)
urlparse.non_hierarchical.extend(['lp'])
urlparse.uses_fragment.extend(['lp'])
def parse_vcs_bundle_file(self, content):
url = rev = None
for line in content.splitlines():

29
tests/test_vcs_bazaar.py Normal file
View file

@ -0,0 +1,29 @@
from tests.test_pip import pyversion
from pip.vcs.bazaar import Bazaar
if pyversion >= '3':
VERBOSE_FALSE = False
else:
VERBOSE_FALSE = 0
def test_bazaar_simple_urls():
"""
Test bzr url support.
SSH and launchpad have special handling.
"""
http_bzr_repo = Bazaar(url='bzr+http://bzr.myproject.org/MyProject/trunk/#egg=MyProject')
https_bzr_repo = Bazaar(url='bzr+https://bzr.myproject.org/MyProject/trunk/#egg=MyProject')
ssh_bzr_repo = Bazaar(url='bzr+ssh://bzr.myproject.org/MyProject/trunk/#egg=MyProject')
ftp_bzr_repo = Bazaar(url='bzr+ftp://bzr.myproject.org/MyProject/trunk/#egg=MyProject')
sftp_bzr_repo = Bazaar(url='bzr+sftp://bzr.myproject.org/MyProject/trunk/#egg=MyProject')
launchpad_bzr_repo = Bazaar(url='bzr+lp:MyLaunchpadProject#egg=MyLaunchpadProject')
assert http_bzr_repo.get_url_rev() == ('http://bzr.myproject.org/MyProject/trunk/', None)
assert https_bzr_repo.get_url_rev() == ('https://bzr.myproject.org/MyProject/trunk/', None)
assert ssh_bzr_repo.get_url_rev() == ('bzr+ssh://bzr.myproject.org/MyProject/trunk/', None)
assert ftp_bzr_repo.get_url_rev() == ('ftp://bzr.myproject.org/MyProject/trunk/', None)
assert sftp_bzr_repo.get_url_rev() == ('sftp://bzr.myproject.org/MyProject/trunk/', None)
assert launchpad_bzr_repo.get_url_rev() == ('lp:MyLaunchpadProject', None)