Fix broken import for python 3.10.12
patches/lib/python3.10/site-packages/sphinx/util/typing.py/patch
----------------------------------------------------------------
o Imports changed again for python v3.10.12, define Union from typing.
o Patch fixed broken 'make test' target for local dev use.
Makefile
--------
o Added venv install dependencies for targets lint and linkcheck.
o Install dependent patched virtual env for named targets.
Change-Id: Id0681bcd758259efed45d943ea4d316bbd8d4354
diff --git a/Makefile b/Makefile
index 5a307f7..54463fc 100644
--- a/Makefile
+++ b/Makefile
@@ -21,11 +21,7 @@
##-------------------##
##---] GLOBALS [---##
##-------------------##
-TOP ?=$(strip \
- $(dir \
- $(abspath $(lastword $(MAKEFILE_LIST)))\
- )\
-)
+TOP ?=$(strip $(dir $(abspath $(lastword $(MAKEFILE_LIST))) ) )
##--------------------##
##---] INCLUDES [---##
@@ -70,6 +66,10 @@
## -----------------------------------------------------------------------
test: lint linkcheck
+# [TODO] relocate into repo:onf-make/
+lint : $(venv-activate-patched)
+linkcheck : $(venv-activate-patched)
+
## -----------------------------------------------------------------------
## Intent: Exercise all generation targets
## Bridge: library workaround to support legacy targets
diff --git a/makefiles/patches/README.md b/makefiles/patches/README.md
index 995a23d..ffdc30f 100644
--- a/makefiles/patches/README.md
+++ b/makefiles/patches/README.md
@@ -2,13 +2,20 @@
1) Checkout voltha-docs
2) cd voltha-docs
-3) make venv
+3) Create a virtual environment:
+ - make venv (default python version)
+ - make venv-activate-patched (for python v3.10+)
4) make patch-init
5) modify the file to be patched beneath staging/${relative_path_to_patch}
6) make patch-create PATCH_PATH=${relative_path_to_patch}
o This will create patches/${relative_path_to_patch}/patch
+ o make patch-create PATCH_PATH=lib/python3.10/site-packages/sphinx/util/typing.py
+ lib/python3.10/site-packages/sphinx/util/typing/patch
7) Verify
o make sterile
o make venv
+8) Validate
+ o make lint
+ o make test
-# [EOF]
\ No newline at end of file
+# [EOF]
diff --git a/patches/lib/python3.10/site-packages/sphinx/util/typing.py/patch b/patches/lib/python3.10/site-packages/sphinx/util/typing.py/patch
index d049e3b..da24cd5 100644
--- a/patches/lib/python3.10/site-packages/sphinx/util/typing.py/patch
+++ b/patches/lib/python3.10/site-packages/sphinx/util/typing.py/patch
@@ -1,18 +1,17 @@
---- staging/lib/python3.10/site-packages/sphinx/util/typing.py 2022-11-28 06:22:14.637278053 -0500
-+++ venv_docs/lib/python3.10/site-packages/sphinx/util/typing.py 2022-11-28 06:34:36.246702890 -0500
-@@ -34,15 +34,7 @@
+--- staging/lib/python3.10/site-packages/sphinx/util/typing.py 2023-09-14 16:25:24.179214865 -0400
++++ .venv/lib/python3.10/site-packages/sphinx/util/typing.py 2023-09-14 16:22:16.545588690 -0400
+@@ -34,14 +34,7 @@
return ref._eval_type(globalns, localns)
if sys.version_info > (3, 10):
-
-- try: # ver >= 3.10.6
-- from types import UnionType as types_Union
+- try: # ver >= 3.10.12
+- from typing import Union as types_Union
- except ImportError:
-- try: # ver < 3.10.6
+- try: # ver >= 3.10.6
- from types import Union as types_Union
- except ImportError:
- types_Union = None
--
+ from types import Union as types_Union
else:
types_Union = None