> On 17 Jan 2023, at 16:55, Anthony PERARD <anthony.per...@citrix.com> wrote: > > On Tue, Jan 17, 2023 at 04:07:24PM +0000, Luca Fancellu wrote: >>> On 16 Jan 2023, at 18:10, Anthony PERARD <anthony.per...@citrix.com> wrote: >>> diff --git a/xen/tools/compat-xlat-header.py >>> b/xen/tools/compat-xlat-header.py >>> new file mode 100644 >>> index 0000000000..c1b361ac56 >>> --- /dev/null >>> +++ b/xen/tools/compat-xlat-header.py >>> @@ -0,0 +1,468 @@ >>> +#!/usr/bin/env python >> >> Would it make sense to start with python3 since it is a new script? > > That shebang isn't even used as the script doesn't even have the > execution bit set. So why do you say that the script isn't python3? Not > really asking, just been pedantic :-)
Yes I didn’t pay attention to that > > Even if it's a new script, it isn't a new project. We can't depend on > brand new functionality from our dependencies. We need to be able to > build the hypervisor with old build toolchain / distribution. > > Anyway, I did start by writing a python3 script in all its glory (or at > least some of the new part of the language that I know about), but I had > to rework it to be able to use it on older distribution. Our centos7 > container in our GitLab CI seems to use python2.7. That makes sense, thanks for the explanation. > > So I had to stop using str.removeprefix() and I introduce some function > doing the same thing instead (so that works with older than python 3.9). > Then I had to stop using f-strings and use %-formatting instead. > Then use "m.groups()[0]" instead of "m[1]" where "m" is a match result > from re.match() and other. > And use the classing "from __future__ ..." preamble. > > Cheers, > > -- > Anthony PERARD