未验证 提交 7821d783 编写于 作者: F Feiyu Chan 提交者: GitHub

use jinja2 2.11.3 to avoid error on python 3.6.0 (#43788)

use jinja 2.11.3 in python lower than 3.6.2
上级 4b74178b
...@@ -100,7 +100,13 @@ if(NOT PYTHON_EXECUTABLE) ...@@ -100,7 +100,13 @@ if(NOT PYTHON_EXECUTABLE)
endif() endif()
# install extra dependencies # install extra dependencies
execute_process(COMMAND ${PYTHON_EXECUTABLE} -m pip install -U pyyaml jinja2) if(${PYTHON_VERSION_STRING} VERSION_LESS "3.6.2")
execute_process(COMMAND ${PYTHON_EXECUTABLE} -m pip install -U pyyaml
typing-extensions>=4.1.1 jinja2==2.11.3)
else()
execute_process(COMMAND ${PYTHON_EXECUTABLE} -m pip install -U pyyaml jinja2
typing-extensions)
endif()
# parse apis # parse apis
set(parsed_api_dir ${CMAKE_SOURCE_DIR}/python/paddle/utils/code_gen/parsed_apis) set(parsed_api_dir ${CMAKE_SOURCE_DIR}/python/paddle/utils/code_gen/parsed_apis)
......
...@@ -30,10 +30,12 @@ TODO: Documentation of {{api_name}} op. ...@@ -30,10 +30,12 @@ TODO: Documentation of {{api_name}} op.
{% set name = input["name"] %} {% set name = input["name"] %}
{% set typename = input["typename"] %} {% set typename = input["typename"] %}
AddInput({{name| to_opmaker_name}}, "({{typename}}), input {{i}} of {{op_name}} op.") AddInput({{name| to_opmaker_name}}, "({{typename}}), input {{i}} of {{op_name}} op.")
{%- if typename is vec +%} {%- if typename is vec %}
.AsDuplicable() .AsDuplicable()
{%- endif %} {%- endif %}
{%- if input["optional"] +%} {%- if input["optional"] %}
.AsDispensable() .AsDispensable()
{%- endif %} {%- endif %}
{%- endmacro %} {%- endmacro %}
...@@ -44,10 +46,12 @@ AddInput({{name| to_opmaker_name}}, "({{typename}}), input {{i}} of {{op_name}} ...@@ -44,10 +46,12 @@ AddInput({{name| to_opmaker_name}}, "({{typename}}), input {{i}} of {{op_name}}
{% set typename = output["typename"] %} {% set typename = output["typename"] %}
{% set is_intermediate = output["intermediate"] %} {% set is_intermediate = output["intermediate"] %}
AddOutput({{name | to_opmaker_name}}, "({{typename}}), output {{i}} of {{op_name}} op.") AddOutput({{name | to_opmaker_name}}, "({{typename}}), output {{i}} of {{op_name}} op.")
{%- if typename is vec +%} {%- if typename is vec %}
.AsDuplicable() .AsDuplicable()
{%- endif %} {%- endif %}
{%- if is_intermediate +%} {%- if is_intermediate %}
.AsIntermediate() .AsIntermediate()
{%- endif %} {%- endif %}
{%- endmacro %} {%- endmacro %}
...@@ -67,7 +71,7 @@ AddInput("{{name | to_pascal_case}}TensorList", "attribute {{i}} for {{op_name}} ...@@ -67,7 +71,7 @@ AddInput("{{name | to_pascal_case}}TensorList", "attribute {{i}} for {{op_name}}
.AsDispensable(); .AsDispensable();
{% endif %} {% endif %}
AddAttr<{{typename | to_op_attr_type}}>("{{name}}", "({{typename | to_op_attr_type}}), attribute {{i}} for {{op_name}} op.") AddAttr<{{typename | to_op_attr_type}}>("{{name}}", "({{typename | to_op_attr_type}}), attribute {{i}} for {{op_name}} op.")
{%- if "default_value" in attr +%} {% if "default_value" in attr %}
.SetDefault({{process_default_value(attr)}}) .SetDefault({{process_default_value(attr)}})
{%- endif %} {%- endif %}
{%- endmacro %} {%- endmacro %}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册