Skip to content

Commit 8f8a2e9

Browse files
committed
Pass package names to semver-bump
1 parent ca3258c commit 8f8a2e9

File tree

1 file changed

+23
-14
lines changed

1 file changed

+23
-14
lines changed

scripts/semver-bump

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,23 +32,32 @@ def update_version_in_file(file_path, old_version, new_version):
3232
file.write(content)
3333

3434

35-
def main():
36-
bump_type = sys.argv[1]
35+
def main(bump_type, packages):
3736

38-
for package_dir in os.listdir("."):
39-
if os.path.isdir(package_dir) and package_dir.startswith("plain"):
40-
pyproject_path = os.path.join(package_dir, "pyproject.toml")
37+
for package_dir in packages:
38+
pyproject_path = os.path.join(package_dir, "pyproject.toml")
4139

42-
with open(pyproject_path, "r") as file:
43-
content = file.read()
40+
with open(pyproject_path, "r") as file:
41+
content = file.read()
4442

45-
version_match = re.search(r'version = "(.*?)"', content)
46-
if version_match:
47-
old_version = version_match.group(1)
48-
new_version = bump_version(old_version, bump_type)
49-
update_version_in_file(pyproject_path, old_version, new_version)
50-
print(f"Bumped {package_dir} from {old_version} to {new_version}")
43+
version_match = re.search(r'version = "(.*?)"', content)
44+
if version_match:
45+
old_version = version_match.group(1)
46+
new_version = bump_version(old_version, bump_type)
47+
update_version_in_file(pyproject_path, old_version, new_version)
48+
print(f"Bumped {package_dir} from {old_version} to {new_version}")
5149

5250

5351
if __name__ == "__main__":
54-
main()
52+
bump_type = sys.argv[1]
53+
54+
if len(sys.argv) > 1:
55+
packages = sys.argv[2:]
56+
else:
57+
packages = [
58+
package
59+
for package in os.listdir(".")
60+
if os.path.isdir(package) and package.startswith("plain")
61+
]
62+
63+
main(bump_type, packages)

0 commit comments

Comments
 (0)