Skip to content

Commit

Permalink
stubsabot: Add distributions argument (#10505)
Browse files Browse the repository at this point in the history
[stubsabot] Add distributions argument

This allows to specify which explicitly which distributions to update.
Useful for testing.
  • Loading branch information
srittau authored Jul 25, 2023
1 parent 38dc97b commit 9b94bd4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion scripts/stubsabot.py
Original file line number Diff line number Diff line change
Expand Up @@ -692,8 +692,14 @@ async def main() -> None:
default=None,
help="Limit number of actions performed and the remainder are logged. Useful for testing",
)
parser.add_argument("distributions", nargs="*", help="Distributions to update, default = all")
args = parser.parse_args()

if args.distributions:
paths_to_update = [Path("stubs") / distribution for distribution in args.distributions]
else:
paths_to_update = list(Path("stubs").iterdir())

if args.action_level > ActionLevel.nothing:
subprocess.run(["git", "update-index", "--refresh"], capture_output=True)
diff_result = subprocess.run(["git", "diff-index", "HEAD", "--name-only"], text=True, capture_output=True)
Expand Down Expand Up @@ -725,7 +731,7 @@ async def main() -> None:
async with aiohttp.ClientSession(connector=conn) as session:
tasks = [
asyncio.create_task(determine_action(stubs_path, session))
for stubs_path in Path("stubs").iterdir()
for stubs_path in paths_to_update
if stubs_path.name not in denylist
]

Expand Down

0 comments on commit 9b94bd4

Please sign in to comment.