Skip to content

Commit 93ca639

Browse files
authored
If it looks like a path did not get expanded, expand it (gorilla-co#90)
1 parent 0f4be0e commit 93ca639

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

s3pypi/core.py

+15-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import email
22
import logging
33
import re
4+
from contextlib import suppress
45
from dataclasses import dataclass
56
from itertools import groupby
67
from operator import attrgetter
@@ -50,7 +51,7 @@ def upload_packages(
5051
else DummyLocker()
5152
)
5253

53-
distributions = [parse_distribution(path) for path in dist]
54+
distributions = parse_distributions(dist)
5455
get_name = attrgetter("name")
5556

5657
for name, group in groupby(sorted(distributions, key=get_name), get_name):
@@ -89,6 +90,19 @@ def parse_distribution(path: Path) -> Distribution:
8990
return Distribution(name, version, path)
9091

9192

93+
def parse_distributions(paths: List[Path]) -> List[Distribution]:
94+
dists = []
95+
for path in paths:
96+
if path.is_file():
97+
dists.append(parse_distribution(path))
98+
elif not path.exists():
99+
expanded_paths = Path(".").glob(str(path))
100+
for expanded_path in (f for f in expanded_paths if f.is_file()):
101+
with suppress(S3PyPiError):
102+
dists.append(parse_distribution(expanded_path))
103+
return dists
104+
105+
92106
def extract_wheel_metadata(path: Path) -> PackageMetadata:
93107
with ZipFile(path, "r") as whl:
94108
try:

0 commit comments

Comments
 (0)