Skip to content

Commit

Permalink
build: Ensure python3
Browse files Browse the repository at this point in the history
Bail out when python2 is detected.
  • Loading branch information
jp7677 committed Sep 4, 2021
1 parent 6f021c0 commit a5e330b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ while [ $# -gt 0 ]; do
done

function prepare {
python validate-methods.py \
python3 validate-methods.py \
src/nvapi.cpp \
src/nvapi_sys.cpp \
src/nvapi_disp.cpp \
Expand Down
10 changes: 7 additions & 3 deletions validate-methods.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import sys, re, getopt

if sys.version_info[0] < 3:
print("Method validation failed due to invalid Python interpreter. Please use Python 3 as your default Python interpreter.")
sys.exit(1)

if len(sys.argv) < 3:
print("Usage: python validate-methods.py <implementation1.cpp> [implementation2.cpp] <interface.cpp> <interface.h>")
print("Method validation failed due to invalid usage. Usage: python validate-methods.py <implementation1.cpp> [implementation2.cpp] <interface.cpp> <interface.h>")
sys.exit(1)

expectedMethods = []
Expand Down Expand Up @@ -36,11 +40,11 @@
availableMethods.append(result.group(1))

if len(expectedMethods) != len(foundMethods) or len(set(expectedMethods).intersection(foundMethods)) != len(expectedMethods):
print("Method validation failed. Please make sure that all implemented NVAPI methods are also listed in the `nvapi_QueryInterface` method.")
print("Method validation failed. Please make sure that all implemented NVAPI methods are also listed in the `nvapi_QueryInterface` function.")
sys.exit(1)

if not set(foundMethods).issubset(set(availableMethods)):
print("Method validation failed. Please make sure that all implemented NVAPI methods correspond to available methods in the `nvapi_interface_table` header method.")
print("Method validation failed. Please make sure that all implemented NVAPI methods correspond to available methods in the `nvapi_interface_table` struct.")
sys.exit(1)

sys.exit(0)

0 comments on commit a5e330b

Please sign in to comment.