@@ -32,53 +32,62 @@ CONTAINERREGISTRY_RELEASE = "v0.0.12"
32
32
33
33
def docker_repositories ():
34
34
"""Download dependencies of docker rules."""
35
- native .http_file (
36
- name = "puller" ,
37
- url = ("https://storage.googleapis.com/containerregistry-releases/" +
38
- CONTAINERREGISTRY_RELEASE + "/puller.par" ),
39
- sha256 = "7ebdefbb8a98c5bf8b737a7891a8860ed2f22ae149d3dba200bc104305b6e1d6" ,
40
- executable = True ,
41
- )
35
+ excludes = native .existing_rules ().keys ()
42
36
43
- native .http_file (
44
- name = "pusher" ,
45
- url = ("https://storage.googleapis.com/containerregistry-releases/" +
46
- CONTAINERREGISTRY_RELEASE + "/pusher.par" ),
47
- sha256 = "a8e48dd99b3e85ac5fe30e1daec327ee509540ff18f5ad7f4724d84ccfd3d150" ,
48
- executable = True ,
49
- )
37
+ if "puller" not in excludes :
38
+ native .http_file (
39
+ name = "puller" ,
40
+ url = ("https://storage.googleapis.com/containerregistry-releases/" +
41
+ CONTAINERREGISTRY_RELEASE + "/puller.par" ),
42
+ sha256 = "7ebdefbb8a98c5bf8b737a7891a8860ed2f22ae149d3dba200bc104305b6e1d6" ,
43
+ executable = True ,
44
+ )
50
45
51
- native .git_repository (
52
- name = "containerregistry" ,
53
- remote = "https://github.com/google/containerregistry.git" ,
54
- tag = CONTAINERREGISTRY_RELEASE ,
55
- )
46
+ if "pusher" not in excludes :
47
+ native .http_file (
48
+ name = "pusher" ,
49
+ url = ("https://storage.googleapis.com/containerregistry-releases/" +
50
+ CONTAINERREGISTRY_RELEASE + "/pusher.par" ),
51
+ sha256 = "a8e48dd99b3e85ac5fe30e1daec327ee509540ff18f5ad7f4724d84ccfd3d150" ,
52
+ executable = True ,
53
+ )
54
+
55
+ if "containerregistry" not in excludes :
56
+ native .git_repository (
57
+ name = "containerregistry" ,
58
+ remote = "https://github.com/google/containerregistry.git" ,
59
+ tag = CONTAINERREGISTRY_RELEASE ,
60
+ )
56
61
57
62
# TODO(mattmoor): Remove all of this (copied from google/containerregistry)
58
63
# once transitive workspace instantiation lands.
59
- native .new_http_archive (
60
- name = "httplib2" ,
61
- url = "https://codeload.github.com/httplib2/httplib2/tar.gz/v0.10.3" ,
62
- sha256 = "d1bee28a68cc665c451c83d315e3afdbeb5391f08971dcc91e060d5ba16986f1" ,
63
- strip_prefix = "httplib2-0.10.3/python2/httplib2/" ,
64
- type = "tar.gz" ,
65
- build_file_content = """
64
+ if "httplib2" not in excludes :
65
+ # TODO(mattmoor): Is there a clean way to override?
66
+ native .new_http_archive (
67
+ name = "httplib2" ,
68
+ url = "https://codeload.github.com/httplib2/httplib2/tar.gz/v0.10.3" ,
69
+ sha256 = "d1bee28a68cc665c451c83d315e3afdbeb5391f08971dcc91e060d5ba16986f1" ,
70
+ strip_prefix = "httplib2-0.10.3/python2/httplib2/" ,
71
+ type = "tar.gz" ,
72
+ build_file_content = """
66
73
py_library(
67
74
name = "httplib2",
68
75
srcs = glob(["**/*.py"]),
69
76
data = ["cacerts.txt"],
70
77
visibility = ["//visibility:public"]
71
78
)""" ,
72
- )
79
+ )
73
80
74
81
# Used by oauth2client
75
- native .new_http_archive (
76
- name = "six" ,
77
- url = "https://pypi.python.org/packages/source/s/six/six-1.9.0.tar.gz" ,
78
- sha256 = "e24052411fc4fbd1f672635537c3fc2330d9481b18c0317695b46259512c91d5" ,
79
- strip_prefix = "six-1.9.0/" ,
80
- type = "tar.gz" ,
81
- build_file_content = """
82
+ if "six" not in excludes :
83
+ # TODO(mattmoor): Is there a clean way to override?
84
+ native .new_http_archive (
85
+ name = "six" ,
86
+ url = "https://pypi.python.org/packages/source/s/six/six-1.9.0.tar.gz" ,
87
+ sha256 = "e24052411fc4fbd1f672635537c3fc2330d9481b18c0317695b46259512c91d5" ,
88
+ strip_prefix = "six-1.9.0/" ,
89
+ type = "tar.gz" ,
90
+ build_file_content = """
82
91
# Rename six.py to __init__.py
83
92
genrule(
84
93
name = "rename",
@@ -91,16 +100,18 @@ py_library(
91
100
srcs = [":__init__.py"],
92
101
visibility = ["//visibility:public"],
93
102
)"""
94
- )
103
+ )
95
104
96
105
# Used for authentication in containerregistry
97
- native .new_http_archive (
98
- name = "oauth2client" ,
99
- url = "https://codeload.github.com/google/oauth2client/tar.gz/v4.0.0" ,
100
- sha256 = "7230f52f7f1d4566a3f9c3aeb5ffe2ed80302843ce5605853bee1f08098ede46" ,
101
- strip_prefix = "oauth2client-4.0.0/oauth2client/" ,
102
- type = "tar.gz" ,
103
- build_file_content = """
106
+ if "oauth2client" not in excludes :
107
+ # TODO(mattmoor): Is there a clean way to override?
108
+ native .new_http_archive (
109
+ name = "oauth2client" ,
110
+ url = "https://codeload.github.com/google/oauth2client/tar.gz/v4.0.0" ,
111
+ sha256 = "7230f52f7f1d4566a3f9c3aeb5ffe2ed80302843ce5605853bee1f08098ede46" ,
112
+ strip_prefix = "oauth2client-4.0.0/oauth2client/" ,
113
+ type = "tar.gz" ,
114
+ build_file_content = """
104
115
py_library(
105
116
name = "oauth2client",
106
117
srcs = glob(["**/*.py"]),
@@ -110,26 +121,29 @@ py_library(
110
121
"@six//:six",
111
122
]
112
123
)"""
113
- )
124
+ )
114
125
115
126
# Used for parallel execution in containerregistry
116
- native .new_http_archive (
117
- name = "concurrent" ,
118
- url = "https://codeload.github.com/agronholm/pythonfutures/tar.gz/3.0.5" ,
119
- sha256 = "a7086ddf3c36203da7816f7e903ce43d042831f41a9705bc6b4206c574fcb765" ,
120
- strip_prefix = "pythonfutures-3.0.5/concurrent/" ,
121
- type = "tar.gz" ,
122
- build_file_content = """
127
+ if "concurrent" not in excludes :
128
+ # TODO(mattmoor): Is there a clean way to override?
129
+ native .new_http_archive (
130
+ name = "concurrent" ,
131
+ url = "https://codeload.github.com/agronholm/pythonfutures/tar.gz/3.0.5" ,
132
+ sha256 = "a7086ddf3c36203da7816f7e903ce43d042831f41a9705bc6b4206c574fcb765" ,
133
+ strip_prefix = "pythonfutures-3.0.5/concurrent/" ,
134
+ type = "tar.gz" ,
135
+ build_file_content = """
123
136
py_library(
124
137
name = "concurrent",
125
138
srcs = glob(["**/*.py"]),
126
139
visibility = ["//visibility:public"]
127
140
)"""
128
- )
141
+ )
129
142
130
143
# For packaging python tools.
131
- native .git_repository (
132
- name = "subpar" ,
133
- remote = "https://github.com/google/subpar" ,
134
- commit = "7e12cc130eb8f09c8cb02c3585a91a4043753c56" ,
135
- )
144
+ if "subpar" not in excludes :
145
+ native .git_repository (
146
+ name = "subpar" ,
147
+ remote = "https://github.com/google/subpar" ,
148
+ commit = "7e12cc130eb8f09c8cb02c3585a91a4043753c56" ,
149
+ )
0 commit comments