Skip to content

Commit 5663c02

Browse files
committed
Java: pick-best-jars.py: handle module-info.class and META_INF/versions
1 parent d6f4a7a commit 5663c02

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

java/maven-indexer/pick-best-jars.py

+4
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,18 @@ def read_bytes(fname):
2323
with open(fname, "rb") as f:
2424
return f.read()
2525

26+
META_INF_VERSIONS = re.compile("META-INF/versions/[0-9]+/")
2627
def _read_jar_index(jarname):
2728
bypackage = dict()
2829
cd_file = jarname[:-6] + ".cd"
2930
zip_suffix = read_bytes(jarname) + read_bytes(cd_file)
3031
for l in listzip.listzip(zip_suffix):
3132
if l.endswith(".class") and not utils.is_private(l):
3233
lpackage = os.path.dirname(l)
34+
lpackage = META_INF_VERSIONS.sub("", lpackage)
3335
cname = os.path.basename(l)
36+
if cname == "module-info.class":
37+
continue
3438
if lpackage not in bypackage:
3539
bypackage[lpackage] = set()
3640
bypackage[lpackage].add(cname)

0 commit comments

Comments
 (0)