-
-
Notifications
You must be signed in to change notification settings - Fork 86
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
- Loading branch information
1 parent
0ab0b79
commit fc7df7c
Showing
4 changed files
with
55 additions
and
0 deletions.
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,31 @@ | ||
import pathlib | ||
import sys | ||
|
||
from packaging import utils | ||
|
||
|
||
def debug(msg: str): | ||
print(f'::debug::{msg.title()}', file=sys.stderr) | ||
|
||
|
||
packages_dir = pathlib.Path(sys.argv[1]).resolve().absolute() | ||
|
||
wheel_file_names = [ | ||
f.name for f in packages_dir.iterdir() if f.suffix == '.whl' | ||
] | ||
sdist_file_names = [ | ||
f.name for f in packages_dir.iterdir() if f.suffix == '.gz' | ||
] | ||
|
||
# Parse the package name from the distribution files and print it. On error, | ||
# don't print anything. | ||
if wheel_file_names: | ||
try: | ||
print(utils.parse_wheel_filename(wheel_file_names[0])[0]) | ||
except utils.InvalidWheelFilename: | ||
debug(f'Invalid wheel filename: {wheel_file_names[0]}') | ||
elif sdist_file_names: | ||
try: | ||
print(utils.parse_sdist_filename(sdist_file_names[0])[0]) | ||
except utils.InvalidSdistFilename: | ||
debug(f'Invalid sdist filename: {sdist_file_names[0]}') |
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