From 2f5a5c8bee6028c8889085ed74ae6f42ab64604f Mon Sep 17 00:00:00 2001 From: Diego Marquez Date: Thu, 8 Feb 2024 13:15:20 -0500 Subject: [PATCH] chore: add `setup.py` for `library_generation` (#2447) Python sources in `library_generation` are imported via https://github.com/googleapis/sdk-platform-java/blob/c1ef755b4d73bdf8fdac6f86cb10834e920c9c43/library_generation/generate_repo.py#L17-L19 This `setup.py` can be used via `python -m pip install .` so running something like `cd library_generation && python generate_repo.py` can detect the `library_generation` _package_. --- .gitignore | 12 +++++----- library_generation/.gitignore | 1 - library_generation/setup.py | 23 ++++++++++++++++++++ library_generation/test/integration_tests.py | 1 + 4 files changed, 30 insertions(+), 7 deletions(-) delete mode 100644 library_generation/.gitignore create mode 100644 library_generation/setup.py diff --git a/.gitignore b/.gitignore index a9b6f36914..5a54c06a20 100644 --- a/.gitignore +++ b/.gitignore @@ -22,9 +22,9 @@ target/ .venv # library generation -output/ -library_generation/output/ -library_generation/test/output -library_generation/test/googleapis -library_generation/test/resources/integration/golden -showcase/scripts/output/ +**/output/ +**/googleapis +library_generation/test/**/golden*/ +library_generation/test/resources/test_repo_level_postprocess/ +**/*egg-info/ +**/build/ diff --git a/library_generation/.gitignore b/library_generation/.gitignore deleted file mode 100644 index c18dd8d83c..0000000000 --- a/library_generation/.gitignore +++ /dev/null @@ -1 +0,0 @@ -__pycache__/ diff --git a/library_generation/setup.py b/library_generation/setup.py new file mode 100644 index 0000000000..132cee48f0 --- /dev/null +++ b/library_generation/setup.py @@ -0,0 +1,23 @@ +""" +Package information of library_generation python scripts +""" + +from setuptools import setup + +setup(name='library_generation', + version='0.1', + package_dir={ + 'library_generation': '.', + }, + package_data={ + 'library_generation': [ + '*.sh', + 'templates/*.j2', + 'gapic-generator-java-wrapper', + 'requirements.*', + 'owlbot/src/requirements.*', + 'owlbot/bin/*.sh', + 'owlbot/templates/**/*.j2', + ], + } +) diff --git a/library_generation/test/integration_tests.py b/library_generation/test/integration_tests.py index 8f0cb4a1ef..55f9b88658 100644 --- a/library_generation/test/integration_tests.py +++ b/library_generation/test/integration_tests.py @@ -108,6 +108,7 @@ def test_generate_repo(self): @classmethod def __pull_repo_to(cls, dest: Path, repo: str, committish: str): repo_url = f"{repo_prefix}/{repo}" + print(f'Cloning repository {repo_url}') repo = Repo.clone_from(repo_url, dest) repo.git.checkout(committish)