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-21 09:53:56 +01:00
parent d2208a6657
commit a7f12f35a5
3 changed files with 2783 additions and 34 deletions

View File

@ -31,7 +31,7 @@ Source18: selinux-autorelabel.target
Source19: selinux-autorelabel-generator.sh
# download https://raw.githubusercontent.com/fedora-selinux/scripts/master/selinux/make-fedora-selinux-patch.sh
# run:
# HEAD https://github.com/fedora-selinux/selinux/commit/4ead62f4657f72be332e453c402960d4f7ac8c5e
# HEAD https://github.com/fedora-selinux/selinux/commit/72e13edfb09ce2e73cfa6aaa15b26c3aed4e77e3
# $ for i in policycoreutils selinux-python selinux-gui selinux-sandbox selinux-dbus semodule-utils restorecond; do
# BRANCH=f27 VERSION=2.7 ./make-fedora-selinux-patch.sh $i
# done
@ -187,6 +187,7 @@ sed -i '1s%\(#! *\)/usr/bin/python\([^3].*\|\)$%\1%{__python3}\2%' \
%{buildroot}%{_bindir}/audit2why \
%{buildroot}%{_bindir}/sepolicy \
%{buildroot}%{_bindir}/sepolgen{,-ifgen} \
%{buildroot}%{_datadir}/system-config-selinux/polgengui.py \
%{buildroot}%{_datadir}/system-config-selinux/system-config-selinux.py \
%{buildroot}%{_datadir}/system-config-selinux/selinux_server.py \
%nil
@ -404,7 +405,6 @@ system-config-selinux is a utility for managing the SELinux environment
%{_datadir}/system-config-selinux/html_util.py*
%{_datadir}/system-config-selinux/polgengui.py*
%{_datadir}/system-config-selinux/system-config-selinux.py*
%{_datadir}/system-config-selinux/*.glade
%{_datadir}/system-config-selinux/*.ui
%{python_sitelib}/sepolicy/gui.py*
%{python_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():
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
index 007c94a..6562aa8 100644
--- selinux-python-2.7/sepolicy/sepolicy/gui.py