[apparmor] [patch] backport python3 compability patch to 2.8 branch
John Johansen
john.johansen at canonical.com
Mon May 6 23:14:48 UTC 2013
On 05/06/2013 02:54 PM, Christian Boltz wrote:
> Hello,
>
> I'd like to propose the python3 compability changes from trunk r2052 to
> the 2.8 branch.
>
> Most of trunk r2052 also applies to the 2.8 branch. The only difference
> is one part for utils/vim/create-apparmor.vim.py:
>
I wish the patch was smaller but I think having python 3.0 support in 2.8
is important.
It looks good on my quick read so
Acked-by: John Johansen <john.johansen at canonical.com>
> Trunk r2052 has:
> create-apparmor.vim.py
> @@ -164,16 +163,16 @@
>
> regex = "@@(" + "|".join(aa_regex_map) + ")@@"
>
> -print '" generated from apparmor.vim.in by create-apparmor.vim.py'
> -print '" do not edit this file - edit apparmor.vim.in or create-apparmor.vim.py instead' + "\n"
> +sys.stdout.write('" generated from apparmor.vim.in by create-apparmor.vim.py\n')
> +sys.stdout.write('" do not edit this file - edit apparmor.vim.in or create-apparmor.vim.py instead' + "\n\n")
>
> -with file("apparmor.vim.in") as template:
> +with open("apparmor.vim.in") as template:
> for line in template:
> line = re.sub(regex, my_repl, line.rstrip())
> - print line
> -
> -print "\n\n\n"
> -
> -print '" file rules added with create_file_rule()'
> -print re.sub(regex, my_repl, filerule)
> + sys.stdout.write('%s\n' % line)
> +
> +sys.stdout.write("\n\n\n\n")
> +
> +sys.stdout.write('" file rules added with create_file_rule()\n')
> +sys.stdout.write(re.sub(regex, my_repl, filerule)+'\n')
>
>
> The patch I'm proposing just has
> create-apparmor.vim.py
> @@ -113,7 +112,8 @@ def my_repl(matchobj):
>
> regex = "@@(" + "|".join(aa_regex_map) + ")@@"
>
> -with file("apparmor.vim.in") as template:
> +with open("apparmor.vim.in") as template:
> for line in template:
> line = re.sub(regex, my_repl, line.rstrip())
> - print line
> + sys.stdout.write('%s\n' % line)
> +# print line
>
>
> See the attachment for the full patch.
>
>
> Regards,
>
> Christian Boltz
>
>
>
More information about the AppArmor
mailing list