gui: Several python 3 related fixes from fedora-selinux/selinux

- gui/polgengui.py: Fix sepolicy.generate import in polgengui.py
- gui/polgengui.py: Convert polgen.glade to Builder format polgen.ui
- python/sepolicy: Use list instead of map
- python/sepolicy: Do not use types.BooleanType
This commit is contained in:
Petr Lautrbach 2018-02-15 20:16:19 +01:00
parent 7ef4db2ba4
commit 203045ec1e
3 changed files with 2783 additions and 34 deletions

View File

@ -31,7 +31,7 @@ Source18: selinux-autorelabel.target
Source19: selinux-autorelabel-generator.sh Source19: selinux-autorelabel-generator.sh
# download https://raw.githubusercontent.com/fedora-selinux/scripts/master/selinux/make-fedora-selinux-patch.sh # download https://raw.githubusercontent.com/fedora-selinux/scripts/master/selinux/make-fedora-selinux-patch.sh
# run: # run:
# HEAD https://github.com/fedora-selinux/selinux/commit/3dd7e297f42b8c05964591b008915e2514c6cb2d # HEAD https://github.com/fedora-selinux/selinux/commit/c5e8255a66a4ee88ec4a01dfa431acb323531b7
# $ for i in policycoreutils selinux-python selinux-gui selinux-sandbox selinux-dbus semodule-utils restorecond; do # $ for i in policycoreutils selinux-python selinux-gui selinux-sandbox selinux-dbus semodule-utils restorecond; do
# ./make-fedora-selinux-patch.sh $i # ./make-fedora-selinux-patch.sh $i
# done # done
@ -185,6 +185,7 @@ sed -i '1s~#! */usr/bin/python\([^3].*\|\)$~#!%{__python3}\1~' \
%{buildroot}%{_bindir}/sepolgen{,-ifgen} \ %{buildroot}%{_bindir}/sepolgen{,-ifgen} \
%{buildroot}%{_datadir}/system-config-selinux/system-config-selinux.py \ %{buildroot}%{_datadir}/system-config-selinux/system-config-selinux.py \
%{buildroot}%{_datadir}/system-config-selinux/selinux_server.py \ %{buildroot}%{_datadir}/system-config-selinux/selinux_server.py \
%{buildroot}%{_datadir}/system-config-selinux/polgengui.py \
%nil %nil
%find_lang %{name} %find_lang %{name}
@ -402,7 +403,6 @@ system-config-selinux is a utility for managing the SELinux environment
%{_datadir}/system-config-selinux/html_util.py* %{_datadir}/system-config-selinux/html_util.py*
%{_datadir}/system-config-selinux/polgengui.py* %{_datadir}/system-config-selinux/polgengui.py*
%{_datadir}/system-config-selinux/system-config-selinux.py* %{_datadir}/system-config-selinux/system-config-selinux.py*
%{_datadir}/system-config-selinux/*.glade
%{_datadir}/system-config-selinux/*.ui %{_datadir}/system-config-selinux/*.ui
%{python2_sitelib}/sepolicy/gui.py* %{python2_sitelib}/sepolicy/gui.py*
%{python2_sitelib}/sepolicy/sepolicy.glade %{python2_sitelib}/sepolicy/sepolicy.glade

File diff suppressed because it is too large Load Diff

View File

@ -776,6 +776,49 @@ index 5cfc071..24e3526 100644
def reinit(): def reinit():
diff --git selinux-python-2.7/sepolicy/sepolicy/generate.py selinux-python-2.7/sepolicy/sepolicy/generate.py
index d68f96e..31aa968 100644
--- selinux-python-2.7/sepolicy/sepolicy/generate.py
+++ selinux-python-2.7/sepolicy/sepolicy/generate.py
@@ -110,7 +110,7 @@ def get_all_ports():
def get_all_users():
- users = map(lambda x: x['name'], sepolicy.info(sepolicy.USER))
+ users = [x['name'] for x in sepolicy.info(sepolicy.USER)]
users.remove("system_u")
users.remove("root")
users.sort()
@@ -459,25 +459,25 @@ class policy:
self.out_udp = [all, False, False, verify_ports(ports)]
def set_use_resolve(self, val):
- if not isinstance(val, types.BooleanType):
+ if type(val) is not bool:
raise ValueError(_("use_resolve must be a boolean value "))
self.use_resolve = val
def set_use_syslog(self, val):
- if not isinstance(val, types.BooleanType):
+ if type(val) is not bool:
raise ValueError(_("use_syslog must be a boolean value "))
self.use_syslog = val
def set_use_kerberos(self, val):
- if not isinstance(val, types.BooleanType):
+ if type(val) is not bool:
raise ValueError(_("use_kerberos must be a boolean value "))
self.use_kerberos = val
def set_manage_krb5_rcache(self, val):
- if not isinstance(val, types.BooleanType):
+ if type(val) is not bool:
raise ValueError(_("manage_krb5_rcache must be a boolean value "))
self.manage_krb5_rcache = val
diff --git selinux-python-2.7/sepolicy/sepolicy/gui.py selinux-python-2.7/sepolicy/sepolicy/gui.py diff --git selinux-python-2.7/sepolicy/sepolicy/gui.py selinux-python-2.7/sepolicy/sepolicy/gui.py
index 007c94a..6562aa8 100644 index 007c94a..6562aa8 100644
--- selinux-python-2.7/sepolicy/sepolicy/gui.py --- selinux-python-2.7/sepolicy/sepolicy/gui.py