1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# Utilities to index Go modules hosted on Bazaar repositories.
_BAZAAR = "bzr"
_LAUNCHPAD_DEFAULT_INSTANCE = "https://bazaar.launchpad.net"
_LAUNCHPAD_DEFAULT_REV = "head:"
_LAUNCHPAD_DEFAULT_BRANCH = "trunk"
def _launchpad(
name,
user,
repo,
branch = _LAUNCHPAD_DEFAULT_BRANCH,
rev = _LAUNCHPAD_DEFAULT_REV,
instance = _LAUNCHPAD_DEFAULT_INSTANCE):
"""Register a module hosted on Launchpad.
Args:
name (str): The name of the module.
user (str): The ID of the user.
repo (str): The name of the repository.
branch (str): The name of the branch.
Defaults to `bzr.LAUNCHPAD_DEFAULT_BRANCH`.
rev (str): The revision number.
Defaults to `bzr.LAUNCHPAD_DEFAULT_REV`.
instance (str): The name of the instance.
Defaults to `bzr.LAUNCHPAD_DEFAULT_INSTANCE`.
"""
return module(
name = name,
vcs = _BAZAAR,
repo = "%s/~%s/%s/%s" % (instance, user, repo, branch),
dir = "%s/~%s/%s/%s/files/%s{/dir}" %
(instance, user, repo, branch, rev),
file = "%s/~%s/%s/%s/view/%s{/dir}/{file}#L{line}" %
(instance, user, repo, branch, rev),
)
bzr = make_module(
"bzr",
BAZAR = _BAZAAR,
LAUNCHPAD_DEFAULT_INSTANCE = _LAUNCHPAD_DEFAULT_INSTANCE,
LAUNCHPAD_DEFAULT_REV = _LAUNCHPAD_DEFAULT_REV,
LAUNCHPAD_DEFAULT_BRANCH = _LAUNCHPAD_DEFAULT_BRANCH,
launchpad = _launchpad,
)
|