We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c8c0a9b commit d26bac4Copy full SHA for d26bac4
src/websockets/version.py
@@ -43,9 +43,11 @@ def get_version(tag: str) -> str:
43
# Check that this file belongs to the installed package.
44
files = importlib.metadata.files("websockets")
45
if files:
46
- version_file = [f for f in files if f.name == file_path.name][0]
47
- if version_file.locate() == file_path:
48
- return version
+ version_files = [f for f in files if f.name == file_path.name]
+ if version_files:
+ version_file = version_files[0]
49
+ if version_file.locate() == file_path:
50
+ return version
51
52
# Read version from git if available.
53
try:
0 commit comments