Re: [Mesa-dev] [PATCH v2] anv: Import mako templates only during execution of anv_extensions

2018-01-11 Thread Dylan Baker
Reviewed-by: Dylan Baker 

Quoting Andres Gomez (2018-01-10 13:11:51)
> anv_extensions usage from anv_icd was bringing the unwanted dependency
> of mako templates for the latter. We don't want that since it will
> force the dependency even for distributable tarballs which was not
> needed until now.
> 
> Jason suggested this approach.
> 
> v2: Patch simplification (Jason).
> 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104551
> Fixes: 0ab04ba979b ("anv: Use python to generate ICD json files")
> Cc: Jason Ekstrand 
> Cc: Emil Velikov 
> Signed-off-by: Andres Gomez 
> ---
>  src/intel/vulkan/anv_extensions.py | 10 +-
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/src/intel/vulkan/anv_extensions.py 
> b/src/intel/vulkan/anv_extensions.py
> index 16e5582598e..adfebca985c 100644
> --- a/src/intel/vulkan/anv_extensions.py
> +++ b/src/intel/vulkan/anv_extensions.py
> @@ -29,8 +29,6 @@ import copy
>  import re
>  import xml.etree.cElementTree as et
>  
> -from mako.template import Template
> -
>  MAX_API_VERSION = '1.0.57'
>  
>  class Extension:
> @@ -160,7 +158,7 @@ def _init_exts_from_xml(xml):
>  ext = ext_name_map[ext_name]
>  ext.type = ext_elem.attrib['type']
>  
> -_TEMPLATE = Template(COPYRIGHT + """
> +_TEMPLATE = COPYRIGHT + """
>  #include "anv_private.h"
>  
>  #include "vk_util.h"
> @@ -258,7 +256,7 @@ VkResult anv_EnumerateDeviceExtensionProperties(
>  
>  return vk_outarray_status(&out);
>  }
> -""")
> +"""
>  
>  if __name__ == '__main__':
>  parser = argparse.ArgumentParser()
> @@ -282,5 +280,7 @@ if __name__ == '__main__':
>  'device_extensions': [e for e in EXTENSIONS if e.type == 'device'],
>  }
>  
> +from mako.template import Template
> +
>  with open(args.out, 'w') as f:
> -f.write(_TEMPLATE.render(**template_env))
> +f.write(Template(_TEMPLATE).render(**template_env))
> -- 
> 2.15.1
> 
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


signature.asc
Description: signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v2] anv: Import mako templates only during execution of anv_extensions

2018-01-10 Thread Jason Ekstrand
Reviewed-by: Jason Ekstrand 

On Wed, Jan 10, 2018 at 1:11 PM, Andres Gomez  wrote:

> anv_extensions usage from anv_icd was bringing the unwanted dependency
> of mako templates for the latter. We don't want that since it will
> force the dependency even for distributable tarballs which was not
> needed until now.
>
> Jason suggested this approach.
>
> v2: Patch simplification (Jason).
>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104551
> Fixes: 0ab04ba979b ("anv: Use python to generate ICD json files")
> Cc: Jason Ekstrand 
> Cc: Emil Velikov 
> Signed-off-by: Andres Gomez 
> ---
>  src/intel/vulkan/anv_extensions.py | 10 +-
>  1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/src/intel/vulkan/anv_extensions.py b/src/intel/vulkan/anv_
> extensions.py
> index 16e5582598e..adfebca985c 100644
> --- a/src/intel/vulkan/anv_extensions.py
> +++ b/src/intel/vulkan/anv_extensions.py
> @@ -29,8 +29,6 @@ import copy
>  import re
>  import xml.etree.cElementTree as et
>
> -from mako.template import Template
> -
>  MAX_API_VERSION = '1.0.57'
>
>  class Extension:
> @@ -160,7 +158,7 @@ def _init_exts_from_xml(xml):
>  ext = ext_name_map[ext_name]
>  ext.type = ext_elem.attrib['type']
>
> -_TEMPLATE = Template(COPYRIGHT + """
> +_TEMPLATE = COPYRIGHT + """
>  #include "anv_private.h"
>
>  #include "vk_util.h"
> @@ -258,7 +256,7 @@ VkResult anv_EnumerateDeviceExtensionProperties(
>
>  return vk_outarray_status(&out);
>  }
> -""")
> +"""
>
>  if __name__ == '__main__':
>  parser = argparse.ArgumentParser()
> @@ -282,5 +280,7 @@ if __name__ == '__main__':
>  'device_extensions': [e for e in EXTENSIONS if e.type ==
> 'device'],
>  }
>
> +from mako.template import Template
> +
>  with open(args.out, 'w') as f:
> -f.write(_TEMPLATE.render(**template_env))
> +f.write(Template(_TEMPLATE).render(**template_env))
> --
> 2.15.1
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH v2] anv: Import mako templates only during execution of anv_extensions

2018-01-10 Thread Andres Gomez
anv_extensions usage from anv_icd was bringing the unwanted dependency
of mako templates for the latter. We don't want that since it will
force the dependency even for distributable tarballs which was not
needed until now.

Jason suggested this approach.

v2: Patch simplification (Jason).

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104551
Fixes: 0ab04ba979b ("anv: Use python to generate ICD json files")
Cc: Jason Ekstrand 
Cc: Emil Velikov 
Signed-off-by: Andres Gomez 
---
 src/intel/vulkan/anv_extensions.py | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/intel/vulkan/anv_extensions.py 
b/src/intel/vulkan/anv_extensions.py
index 16e5582598e..adfebca985c 100644
--- a/src/intel/vulkan/anv_extensions.py
+++ b/src/intel/vulkan/anv_extensions.py
@@ -29,8 +29,6 @@ import copy
 import re
 import xml.etree.cElementTree as et
 
-from mako.template import Template
-
 MAX_API_VERSION = '1.0.57'
 
 class Extension:
@@ -160,7 +158,7 @@ def _init_exts_from_xml(xml):
 ext = ext_name_map[ext_name]
 ext.type = ext_elem.attrib['type']
 
-_TEMPLATE = Template(COPYRIGHT + """
+_TEMPLATE = COPYRIGHT + """
 #include "anv_private.h"
 
 #include "vk_util.h"
@@ -258,7 +256,7 @@ VkResult anv_EnumerateDeviceExtensionProperties(
 
 return vk_outarray_status(&out);
 }
-""")
+"""
 
 if __name__ == '__main__':
 parser = argparse.ArgumentParser()
@@ -282,5 +280,7 @@ if __name__ == '__main__':
 'device_extensions': [e for e in EXTENSIONS if e.type == 'device'],
 }
 
+from mako.template import Template
+
 with open(args.out, 'w') as f:
-f.write(_TEMPLATE.render(**template_env))
+f.write(Template(_TEMPLATE).render(**template_env))
-- 
2.15.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev