mirror of
https://github.com/seL4/seL4.git
synced 2026-03-27 10:29:57 +00:00
Move the version check just before the usage
Signed-off-by: Cindy Liu <hcindyl@google.com>
This commit is contained in:
@@ -156,6 +156,14 @@ def parse_xml(xml_file):
|
||||
|
||||
|
||||
def generate(args, invocations):
|
||||
# We require jinja2 to be at least version 2.10,
|
||||
# In the past we used the 'namespace' feature from that version.
|
||||
# other versions of jinja, particularly `minijinja`, don't support
|
||||
# namespaces. However in case `namespace` is needed in the future require a
|
||||
# version which supports it.
|
||||
jinja2_version = version("jinja2")
|
||||
if jinja2_version < "2.10":
|
||||
sys.exit("Jinja2 should be >= 2.10")
|
||||
|
||||
header_title = "API"
|
||||
if args.libsel4:
|
||||
@@ -177,15 +185,6 @@ def generate(args, invocations):
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
# We require jinja2 to be at least version 2.10,
|
||||
# In the past we used the 'namespace' feature from that version.
|
||||
# other versions of jinja, particularly `minijinja`, don't support
|
||||
# namespaces. However in case `namespace` is needed in the future require a
|
||||
# version which supports it.
|
||||
jinja2_version = version("jinja2")
|
||||
if jinja2_version < "2.10":
|
||||
sys.exit("Jinja2 should be >= 2.10")
|
||||
|
||||
args = parse_args()
|
||||
|
||||
invocations = parse_xml(args.xml)
|
||||
|
||||
@@ -18,13 +18,6 @@ import sys
|
||||
import xml.dom.minidom
|
||||
from condition import condition_to_cpp
|
||||
|
||||
# We require jinja2 to be at least version 2.10,
|
||||
# In the past we used the 'namespace' feature from that version.
|
||||
# other versions of jinja, particularly `minijinja`, don't support namespaces.
|
||||
# However in case `namespace` is needed in the future require a
|
||||
# version which supports it.
|
||||
pkg_resources.require("jinja2>=2.10")
|
||||
|
||||
|
||||
COMMON_HEADER = """
|
||||
/* This header was generated by kernel/tools/syscall_header_gen.py.
|
||||
@@ -210,6 +203,15 @@ def map_syscalls_neg(syscalls):
|
||||
|
||||
|
||||
def generate_kernel_file(kernel_header, api, debug):
|
||||
# We require jinja2 to be at least version 2.10,
|
||||
# In the past we used the 'namespace' feature from that version.
|
||||
# other versions of jinja, particularly `minijinja`, don't support
|
||||
# namespaces. However in case `namespace` is needed in the future require a
|
||||
# version which supports it.
|
||||
jinja2_version = version("jinja2")
|
||||
if jinja2_version < "2.10":
|
||||
sys.exit("Jinja2 should be >= 2.10")
|
||||
|
||||
template = Environment(loader=BaseLoader, trim_blocks=False,
|
||||
lstrip_blocks=False).from_string(KERNEL_HEADER_TEMPLATE)
|
||||
data = template.render({'assembler': map_syscalls_neg(api),
|
||||
@@ -227,15 +229,6 @@ def generate_libsel4_file(libsel4_header, syscalls):
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
# We require jinja2 to be at least version 2.10,
|
||||
# In the past we used the 'namespace' feature from that version.
|
||||
# other versions of jinja, particularly `minijinja`, don't support
|
||||
# namespaces. However in case `namespace` is needed in the future require a
|
||||
# version which supports it.
|
||||
jinja2_version = version("jinja2")
|
||||
if jinja2_version < "2.10":
|
||||
sys.exit("Jinja2 should be >= 2.10")
|
||||
|
||||
args = parse_args()
|
||||
|
||||
(api, debug) = parse_xml(args.xml, args.mcs)
|
||||
|
||||
Reference in New Issue
Block a user