Skip to content

Commit

Permalink
winVersion: deprecate Wonidows 7/8.0 constants. Re nvaccess#15647.
Browse files Browse the repository at this point in the history
Deprecate winVersion.WIN7/WIN_SP1/WIN8 constants.
  • Loading branch information
josephsl committed Oct 23, 2023
1 parent b67e7f4 commit 3148bac
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion source/winVersion.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
When working on this file, consider moving to winAPI.
"""

from typing import Optional, Dict
from typing import Optional, Dict, Any
import sys
import os
import functools
Expand Down Expand Up @@ -226,3 +226,16 @@ def isFullScreenMagnificationAvailable() -> bool:
stack_info=True
)
return True

def __getattr__(attrName: str) -> Any:
"""Module level `__getattr__` used to preserve backward compatibility."""
if attrName == "WIN7" and NVDAState._allowDeprecatedAPI():
log.warning("WIN7 is deprecated.")
return WinVersion(major=6, minor=1, build=7600)
if attrName == "WIN7_SP1" and NVDAState._allowDeprecatedAPI():
log.warning("WIN7_SP1 is deprecated.")
return WinVersion(major=6, minor=1, build=7601, servicePack="1")
if attrName == "WIN8" and NVDAState._allowDeprecatedAPI():
log.warning("WIN8 is deprecated.")
return WinVersion(major=6, minor=2, build=9200)
raise AttributeError(f"module {repr(__name__)} has no attribute {repr(attrName)}")

0 comments on commit 3148bac

Please sign in to comment.