-
-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add nudge message with magic link to create new Trusted Publisher
PR #250 Co-authored-by: Sviatoslav Sydorenko <sviat@redhat.com>
- Loading branch information
1 parent
4f8925c
commit 3697819
Showing
5 changed files
with
70 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import pathlib | ||
import sys | ||
|
||
from packaging import utils | ||
|
||
|
||
def debug(msg: str): | ||
print(f'::debug::{msg.title()}', file=sys.stderr) | ||
|
||
|
||
def safe_parse_pkg_name(file_path: pathlib.Path) -> str | None: | ||
if file_path.suffix == '.whl': | ||
try: | ||
return utils.parse_wheel_filename(file_path.name)[0] | ||
except utils.InvalidWheelFilename: | ||
debug(f'Invalid wheel filename: {file_path.name}') | ||
return None | ||
elif file_path.suffix == '.gz': | ||
try: | ||
return utils.parse_sdist_filename(file_path.name)[0] | ||
except utils.InvalidSdistFilename: | ||
debug(f'Invalid sdist filename: {file_path.name}') | ||
return None | ||
return None | ||
|
||
|
||
packages_dir = pathlib.Path(sys.argv[1]).resolve() | ||
|
||
pkg_names = { | ||
pkg_name for file_path in packages_dir.iterdir() if | ||
(pkg_name := safe_parse_pkg_name(file_path)) is not None | ||
} | ||
|
||
for package_name in sorted(pkg_names): | ||
print(package_name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters