Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

fix: resolve issue importing library #64

Merged
merged 4 commits into from Aug 20, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -1,7 +1,7 @@
Types for Google Cloud Gkehub Configmanagement v1 API
=====================================================

.. automodule:: google.cloud.gkehub.configmanagement_v1.types
.. automodule:: google.cloud.gkehub_v1.configmanagement_v1.types
parthea marked this conversation as resolved.
Show resolved Hide resolved
:members:
:undoc-members:
:show-inheritance:
@@ -1,7 +1,7 @@
Types for Google Cloud Gkehub Multiclusteringress v1 API
========================================================

.. automodule:: google.cloud.gkehub.multiclusteringress_v1.types
.. automodule:: google.cloud.gkehub_v1.multiclusteringress_v1.types
:members:
:undoc-members:
:show-inheritance:
8 changes: 4 additions & 4 deletions docs/index.rst
Expand Up @@ -9,10 +9,10 @@ API Reference

gkehub_v1/services
gkehub_v1/types
configmanagement_v1/services
configmanagement_v1/types
multiclusteringress_v1/services
multiclusteringress_v1/types
gkehub_v1/configmanagement_v1/services
gkehub_v1/configmanagement_v1/types
gkehub_v1/multiclusteringress_v1/services
gkehub_v1/multiclusteringress_v1/types

API Reference
-------------
Expand Down
4 changes: 2 additions & 2 deletions google/cloud/gkehub_v1/types/feature.py
Expand Up @@ -15,8 +15,8 @@
#
import proto # type: ignore

from google.cloud.gkehub import configmanagement_v1 as configmanagement_pb2 # type: ignore
from google.cloud.gkehub import multiclusteringress_v1 as multiclusteringress_pb2 # type: ignore
from google.cloud.gkehub_v1 import configmanagement_v1 as configmanagement_pb2 # type: ignore
from google.cloud.gkehub_v1 import multiclusteringress_v1 as multiclusteringress_pb2 # type: ignore
parthea marked this conversation as resolved.
Show resolved Hide resolved
from google.protobuf import timestamp_pb2 # type: ignore


Expand Down
37 changes: 30 additions & 7 deletions owlbot.py
Expand Up @@ -25,21 +25,33 @@
default_version = "v1"

for library in s.get_staging_dirs(default_version):
dependencies = [
submodules = [
"configmanagement",
"multiclusteringress",
]
tseaver marked this conversation as resolved.
Show resolved Hide resolved

# rename dependencies google.cloud.gkehub.dep.vX to google.cloud.gkehub.dep_vX
for dep in dependencies:
for submodule in submodules:
# Move v1 submodule namespace from google.cloud.gkehub.{submodule}_v1 to google.cloud.gkehub_vX.{submodule}_v1
s.move(library / f"google/cloud/gkehub/{submodule}_v1", library / f"google/cloud/gkehub_{library.name}/{submodule}_v1")

# Adjust docs based on new submodule namespace google.cloud.gkehub_vX.{submodule}_v1.types"
s.replace(
library / f"docs/{submodule}_v1/types.rst",
f"google.cloud.gkehub.{submodule}_v1.types",
f"google.cloud.gkehub_{library.name}.{submodule}_v1.types",
)
parthea marked this conversation as resolved.
Show resolved Hide resolved

# Move docs to correct location /docs/gkehub_vX/{submodule}_v1
s.move(library / f"docs/{submodule}_v1", library / f"docs/gkehub_{library.name}/{submodule}_v1")

# Rename v1 submodule imports from google.cloud.gkehub.submodule.v1 to google.cloud.gkehub_vX.submodule_v1
s.replace(
[
library / f"google/cloud/gkehub_{library.name}/**/*.py",
library / f"tests/unit/gapic/gkehub_{library.name}/**/*.py",
library / f"google/cloud/gkehub/{dep}_{library.name}/**/*.py",
],
f"from google.cloud.gkehub.{dep}.{library.name} import",
f"from google.cloud.gkehub import {dep}_{library.name} as"
f"from google.cloud.gkehub.{submodule}.v1 import",
f"from google.cloud.gkehub_{library.name} import {submodule}_v1 as"
)

# Work around gapic generator bug https://github.com/googleapis/gapic-generator-python/issues/902
Expand All @@ -64,7 +76,18 @@
//container.googleapis.com/projects/my-"""
)

s.move(library, excludes=["setup.py", "README.rst", "docs/index.rst", "google/cloud/gkehub/configmanagement", "google/cloud/gkehub/multiclusteringress"])
excludes=[
"setup.py",
"README.rst",
"docs/index.rst",
"docs/configmanagement_v1/**",
"docs/multiclusteringress_v1/**",
"google/cloud/gkehub/configmanagement/**",
"google/cloud/gkehub/configmanagement_v1/**",
"google/cloud/gkehub/multiclusteringress/**",
"google/cloud/gkehub/multiclusteringress_v1/**"
]
s.move(library, excludes=excludes)

s.remove_staging_dirs()

Expand Down
4 changes: 2 additions & 2 deletions tests/unit/gapic/gkehub_v1/test_gke_hub.py
Expand Up @@ -34,8 +34,8 @@
from google.api_core import operations_v1
from google.auth import credentials as ga_credentials
from google.auth.exceptions import MutualTLSChannelError
from google.cloud.gkehub import configmanagement_v1 as configmanagement_pb2 # type: ignore
from google.cloud.gkehub import multiclusteringress_v1 as multiclusteringress_pb2 # type: ignore
from google.cloud.gkehub_v1 import configmanagement_v1 as configmanagement_pb2 # type: ignore
from google.cloud.gkehub_v1 import multiclusteringress_v1 as multiclusteringress_pb2 # type: ignore
from google.cloud.gkehub_v1.services.gke_hub import GkeHubAsyncClient
from google.cloud.gkehub_v1.services.gke_hub import GkeHubClient
from google.cloud.gkehub_v1.services.gke_hub import pagers
Expand Down