Message ID | 20240412165407.42163-1-jonathanh@nvidia.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | drm/msm: Fix gen_header.py for older python3 versions | expand |
Hi all, On 12/04/2024 17:54, Jon Hunter wrote: > The gen_header.py script is failing for older versions of python3 such > as python 3.5. Two issues observed with python 3.5 are ... > > 1. Python 3 versions prior to 3.6 do not support the f-string format. > 2. Early python 3 versions do not support the 'required' argument for > the argparse add_subparsers(). > > Fix both of the above so that older versions of python 3 still work. > > Fixes: 8f7abf0b86fe ("drm/msm: generate headers on the fly") > Signed-off-by: Jon Hunter <jonathanh@nvidia.com> > --- > drivers/gpu/drm/msm/registers/gen_header.py | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/msm/registers/gen_header.py b/drivers/gpu/drm/msm/registers/gen_header.py > index 9b2842d4a354..90d5c2991d05 100644 > --- a/drivers/gpu/drm/msm/registers/gen_header.py > +++ b/drivers/gpu/drm/msm/registers/gen_header.py > @@ -323,7 +323,7 @@ class Array(object): > indices = [] > if self.length != 1: > if self.fixed_offsets: > - indices.append((self.index_ctype(), None, f"__offset_{self.local_name}")) > + indices.append((self.index_ctype(), None, "__offset_%s" % self.local_name)) > else: > indices.append((self.index_ctype(), self.stride, None)) > return indices > @@ -942,7 +942,8 @@ def main(): > parser.add_argument('--rnn', type=str, required=True) > parser.add_argument('--xml', type=str, required=True) > > - subparsers = parser.add_subparsers(required=True) > + subparsers = parser.add_subparsers() > + subparsers.required = True > > parser_c_defines = subparsers.add_parser('c-defines') > parser_c_defines.set_defaults(func=dump_c_defines) Any feedback on this? All our farm builders are still broken :-( Thanks Jon
On Fri, Apr 12, 2024 at 05:54:07PM +0100, Jon Hunter wrote: > The gen_header.py script is failing for older versions of python3 such > as python 3.5. Two issues observed with python 3.5 are ... > > 1. Python 3 versions prior to 3.6 do not support the f-string format. > 2. Early python 3 versions do not support the 'required' argument for > the argparse add_subparsers(). > > Fix both of the above so that older versions of python 3 still work. > Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
diff --git a/drivers/gpu/drm/msm/registers/gen_header.py b/drivers/gpu/drm/msm/registers/gen_header.py index 9b2842d4a354..90d5c2991d05 100644 --- a/drivers/gpu/drm/msm/registers/gen_header.py +++ b/drivers/gpu/drm/msm/registers/gen_header.py @@ -323,7 +323,7 @@ class Array(object): indices = [] if self.length != 1: if self.fixed_offsets: - indices.append((self.index_ctype(), None, f"__offset_{self.local_name}")) + indices.append((self.index_ctype(), None, "__offset_%s" % self.local_name)) else: indices.append((self.index_ctype(), self.stride, None)) return indices @@ -942,7 +942,8 @@ def main(): parser.add_argument('--rnn', type=str, required=True) parser.add_argument('--xml', type=str, required=True) - subparsers = parser.add_subparsers(required=True) + subparsers = parser.add_subparsers() + subparsers.required = True parser_c_defines = subparsers.add_parser('c-defines') parser_c_defines.set_defaults(func=dump_c_defines)
The gen_header.py script is failing for older versions of python3 such as python 3.5. Two issues observed with python 3.5 are ... 1. Python 3 versions prior to 3.6 do not support the f-string format. 2. Early python 3 versions do not support the 'required' argument for the argparse add_subparsers(). Fix both of the above so that older versions of python 3 still work. Fixes: 8f7abf0b86fe ("drm/msm: generate headers on the fly") Signed-off-by: Jon Hunter <jonathanh@nvidia.com> --- drivers/gpu/drm/msm/registers/gen_header.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)