pvr: csbgen: Isolate "main" function with __name__ check

Signed-off-by: Matt Coster <matt.coster@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16884>
This commit is contained in:
Matt Coster
2022-05-12 10:27:31 +01:00
committed by Marge Bot
parent a8b80c610b
commit 2285ddc720
+9 -7
View File
@@ -31,7 +31,6 @@ from __future__ import annotations
import copy
import os
import sys
import textwrap
import typing as t
import xml.parsers.expat as expat
@@ -966,11 +965,14 @@ class Parser:
file.close()
if len(sys.argv) < 2:
print("No input xml file specified")
sys.exit(1)
if __name__ == "__main__":
import sys
input_file = sys.argv[1]
if len(sys.argv) < 2:
print("No input xml file specified")
sys.exit(1)
p = Parser()
p.parse(input_file)
input_file = sys.argv[1]
p = Parser()
p.parse(input_file)