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 >