Den ons 1 maj 2024 kl 06:06 skrev Khairul Azhar Kasmiran <kaza...@gmail.com
>:

> [[[
> Make svn_apply_autoprops.py Python 3-compatible.
>
> * contrib/client-side/svn_apply_autoprops.py:
>   (get_autoprop_lines): Use raw strings for regexes, and `for line in
> fd` instead of `for line in fd.xreadlines()`.
>   (filter_walk): Pass directory names separately.
>   (main): Use `open()` instead of `file()`, and `os.walk()` instead of
> `os.path.walk()`.
> ]]]
>

Thank you!

Committed as r1917446.

Kind regards,
Daniel


>
> -- Khairul
>
> On Wed, May 1, 2024 at 12:04 PM Khairul Azhar Kasmiran
> <kaza...@gmail.com> wrote:
> >
> > > Are there any systems where Python is only installed as "python" and
> not as "python3" or is this safe?
> >
> > If "python3" is missing, it should be installable via a package or can
> > be made available manually via a symbolic link, but I suppose this is
> > going to be troublesome for some so I've reverted the hashbang binary
> > back to "python" in the reattached patch.
> >
> > > I've tested and on Windows (Python 3.12) I get the following syntax
> warnings:
> > >
> > >
> C:\Devel\subversion_trunk\contrib\client-side\svn_apply_autoprops.py:71:
> SyntaxWarning: invalid escape sequence '\s'
> > >   re_start_autoprops = re.compile('^\s*\[auto-props\]\s*')
> > >
> C:\Devel\subversion_trunk\contrib\client-side\svn_apply_autoprops.py:72:
> SyntaxWarning: invalid escape sequence '\s'
> > >   re_end_autoprops = re.compile('^\s*\[\w+\]\s*')
> >
> > I was using Python 3.10 on both Windows and Linux and so was not
> > getting the warnings. I have since upgraded to Python 3.12 on Windows
> > and have made the necessary changes in the reattached patch. Testing
> > with Python 2.7 suggests that there are no problems with the raw
> > strings regarding backwards compatibility.
> >
> > [[[
> > Make svn_apply_autoprops.py Python 3-compatible.
> >
> > * contrib/client-side/svn_apply_autoprops.py:
> >   (get_autoprop_lines): Use raw strings for regexes, and `for line in
> > fd` instead of `for line in
> > fd.xreadlines()`.
> >   (filter_walk): Pass directory names separately.
> >   (main): Use `open()` instead of `file()`, and `os.walk()` instead of
> > `os.path.walk()`.
> > ]]]
> >
> > Best regards,
> > Khairul
> >
> > On Tue, Apr 30, 2024 at 11:31 PM Daniel Sahlberg
> > <daniel.l.sahlb...@gmail.com> wrote:
> > >
> > > Den mån 29 apr. 2024 kl 14:06 skrev Khairul Azhar Kasmiran <
> kaza...@gmail.com>:
> > >>
> > >> Hi everyone!
> > >>
> > >> As promised in [1], this patch makes svn_apply_autoprops.py Python
> > >> 3-compatible while keeping Python 2 compatibility. Afaik, the original
> > >> semantics are preserved 100% -- I think I did the conversion from
> > >> `os.path.walk()` to `os.walk()` correctly.
> > >>
> > >> [1] https://lists.apache.org/thread/j8cjrgxosz2cmcysymhy8pr4b5x9s96k
> > >>
> > >> [[[
> > >> Make svn_apply_autoprops.py Python 3-compatible.
> > >>
> > >> * contrib/client-side/svn_apply_autoprops.py: Set hashbang binary to
> `python3`.
> > >
> > >
> > > Are there any systems where Python is only installed as "python" and
> not as "python3" or is this safe?
> > >
> > >>
> > >>   (get_autoprop_lines): Use `for line in fd` instead of `for line in
> > >> fd.xreadlines()`.
> > >>   (filter_walk): Pass directory names separately.
> > >>   (main): Use `open()` instead of `file()`, and `os.walk()` instead of
> > >> `os.path.walk()`.
> > >> ]]]
> > >
> > >
> > > Thanks!
> > >
> > > I've tested and on Windows (Python 3.12) I get the following syntax
> warnings:
> > >
> > >
> C:\Devel\subversion_trunk\contrib\client-side\svn_apply_autoprops.py:71:
> SyntaxWarning: invalid escape sequence '\s'
> > >   re_start_autoprops = re.compile('^\s*\[auto-props\]\s*')
> > >
> C:\Devel\subversion_trunk\contrib\client-side\svn_apply_autoprops.py:72:
> SyntaxWarning: invalid escape sequence '\s'
> > >   re_end_autoprops = re.compile('^\s*\[\w+\]\s*')
> > >
> > > (I don't get those on Linux (Python 3.11)).
> > >
> > > It seems to help to use a raw string, but I'm not sure if this will
> kill backwards compatibility. ON the other hand if we set the hashbang to
> python3, we've explicitly killed any hope of backwards compatibility.
> > >
> > > Kind regards,
> > > Daniel
> > >
> > >
> > >
> > >>
> > >>
> > >> Best regards,
> > >> Khairul
>

Reply via email to