Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions containeranalysis/google/cloud/devtools/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
#
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

try:
import pkg_resources

pkg_resources.declare_namespace(__name__)
except ImportError:
import pkgutil

__path__ = pkgutil.extend_path(__path__, __name__)
12 changes: 6 additions & 6 deletions containeranalysis/synth.metadata
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
{
"updateTime": "2019-10-05T12:17:24.587398Z",
"updateTime": "2019-11-05T21:33:52.199324Z",
"sources": [
{
"generator": {
"name": "artman",
"version": "0.38.0",
"dockerImage": "googleapis/artman@sha256:0d2f8d429110aeb8d82df6550ef4ede59d40df9062d260a1580fce688b0512bf"
"version": "0.41.0",
"dockerImage": "googleapis/artman@sha256:75b38a3b073a7b243545f2332463096624c802bb1e56b8cb6f22ba1ecd325fa9"
}
},
{
"git": {
"name": "googleapis",
"remote": "https://github.com/googleapis/googleapis.git",
"sha": "ceb8e2fb12f048cc94caae532ef0b4cf026a78f3",
"internalRef": "272971705"
"sha": "cb542d6f5f1c9431ec4181d9cfd7f8d8c953e60b",
"internalRef": "278688708"
}
},
{
"template": {
"name": "python_library",
"origin": "synthtool.gcp",
"version": "2019.5.2"
"version": "2019.10.17"
}
}
],
Expand Down
37 changes: 25 additions & 12 deletions containeranalysis/synth.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,30 +33,42 @@
include_protos=True,
)

excludes = ["nox.py", "setup.py", "google/cloud/containeranalysis_v1/proto", "README.rst", "docs/index.rst"]
excludes = [
"nox.py",
"setup.py",
"google/cloud/containeranalysis_v1/proto",
"google/cloud/devtools/__init__.py", # other packages also use this namespace
"README.rst",
"docs/index.rst",
]

s.move(library, excludes=excludes)
# .proto files end up in the wrong place by default
s.move(library / "google/cloud/containeranalysis_v1/proto", "google/cloud/devtools/containeranalysis_v1/proto")

s.move(
library / "google/cloud/containeranalysis_v1/proto",
"google/cloud/devtools/containeranalysis_v1/proto",
)

# Insert helper method to get grafeas client
s.replace("google/**/container_analysis_client.py",
r"""_GAPIC_LIBRARY_VERSION = pkg_resources\.get_distribution\(
s.replace(
"google/**/container_analysis_client.py",
r"""_GAPIC_LIBRARY_VERSION = pkg_resources\.get_distribution\(
'google-cloud-containeranalysis',
\)\.version""",
r"""from grafeas import grafeas_v1
r"""from grafeas import grafeas_v1
from grafeas.grafeas_v1.gapic.transports import grafeas_grpc_transport

_GAPIC_LIBRARY_VERSION = pkg_resources.get_distribution(
"google-cloud-containeranalysis"
).version
""")
""",
)

s.replace("google/**/container_analysis_client.py",
r''' \# Service calls
def set_iam_policy\(''',
r''' def get_grafeas_client(self):
s.replace(
"google/**/container_analysis_client.py",
r""" \# Service calls
def set_iam_policy\(""",
r''' def get_grafeas_client(self):
"""Returns an equivalent grafeas client.

Returns:
Expand All @@ -69,7 +81,8 @@ def set_iam_policy\(''',
return grafeas_v1.GrafeasClient(grafeas_transport)

# Service calls
def set_iam_policy(''')
def set_iam_policy(''',
)
# ----------------------------------------------------------------------------
# Add templated files
# ----------------------------------------------------------------------------
Expand Down