Skip to content

Commit bc8c294

Browse files
Copy whole repo
1 parent 6f0e935 commit bc8c294

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

bufbuild-protovalidate-protocolbuffers/sync_to_pypi.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,15 @@ def _generate_package_for_version(version: str):
112112
for example, "0.14.0".
113113
"""
114114
logger.info(f"Generating package for version {version}")
115-
source_package_path = Path(__file__).parent.absolute()
116-
(source_package_path / "dist").mkdir(exist_ok=True)
115+
repo_path = Path(__file__).parent.parent.absolute()
116+
built_dist_path = repo_path / "bufbuild-protovalidate-protocolbuffers" / "dist"
117+
(repo_path / built_dist_path).mkdir(exist_ok=True)
117118

118119
with tempfile.TemporaryDirectory() as tmpdir:
119-
# since buf generate overwrites files checked into git, we generate a temporary working directory
120-
package_path = Path(tmpdir) / "bufbuild-protovalidate-protocolbuffers"
121-
shutil.copytree(source_package_path, package_path)
120+
# since buf generate overwrites files checked into git, we copy the whole repo to a temporary directory
121+
# (the whole repo since we also need the .git)
122+
package_path = Path(tmpdir) / "protovalidate-python" / "bufbuild-protovalidate-protocolbuffers"
123+
shutil.copytree(repo_path, package_path.parent)
122124

123125
shutil.rmtree(package_path / "buf" / "validate" / "proto5")
124126
shutil.rmtree(package_path / "buf" / "validate" / "proto6")
@@ -149,7 +151,7 @@ def _generate_package_for_version(version: str):
149151
)
150152

151153
for package in (package_path / "dist").iterdir():
152-
shutil.copy(package, source_package_path / "dist")
154+
shutil.copy(package, built_dist_path)
153155

154156

155157
@app.default

0 commit comments

Comments
 (0)