Hello community,
here is the log from the commit of package setools for openSUSE:Factory checked in at 2019-11-13 13:13:37
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/setools (Old)
and /work/SRC/openSUSE:Factory/.setools.new.2990 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "setools"
Wed Nov 13 13:13:37 2019 rev:33 rq:747293 version:4.2.2
Changes:
--------
--- /work/SRC/openSUSE:Factory/setools/setools.changes 2019-02-06 14:06:36.502658106 +0100
+++ /work/SRC/openSUSE:Factory/.setools.new.2990/setools.changes 2019-11-13 13:13:39.354781240 +0100
@@ -1,0 +2,15 @@
+Thu Oct 31 12:02:30 CET 2019 - Matej Cepl
+
+- Add python3.8-compat.patch to allow build with Python 3.8
+ Still doesn't work though because of gh#SELinuxProject/setools#31
+
+-------------------------------------------------------------------
+Thu Oct 31 09:38:27 CET 2019 - Matej Cepl
+
+- Update to the upstream version 4.2.2:
+ - Remove source policy references from man pages, as loading
+ source policies is no longer supported.
+ - Fixed a performance regression in alias loading after alias
+ dereferencing fixes in 4.2.1.
+
+-------------------------------------------------------------------
Old:
----
4.2.1.tar.gz
New:
----
4.2.2.tar.gz
python3.8-compat.patch
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ setools.spec ++++++
--- /var/tmp/diff_new_pack.aZo7UZ/_old 2019-11-13 13:13:40.226782148 +0100
+++ /var/tmp/diff_new_pack.aZo7UZ/_new 2019-11-13 13:13:40.226782148 +0100
@@ -12,7 +12,7 @@
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
@@ -22,13 +22,16 @@
%define skip_python2 1
Name: setools
-Version: 4.2.1
+Version: 4.2.2
Release: 0
Url: https://github.com/SELinuxProject/setools
Summary: Policy analysis tools for SELinux
License: GPL-2.0-only
Group: System/Management
Source: https://github.com/SELinuxProject/setools/archive/%{version}.tar.gz
+# PATCH-FIX-UPSTREAM python3.8-compat.patch mcepl@suse.com
+# allow build with Python 3.8
+Patch0: python3.8-compat.patch
BuildRequires: %{python_module Cython}
BuildRequires: %{python_module devel}
BuildRequires: %{python_module setuptools}
@@ -99,6 +102,7 @@
%prep
%setup -q -n %{name}-%{version}
+%autopatch -p1
%build
%python_build
++++++ 4.2.1.tar.gz -> 4.2.2.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/setools-4.2.1/ChangeLog new/setools-4.2.2/ChangeLog
--- old/setools-4.2.1/ChangeLog 2019-02-05 01:18:05.000000000 +0100
+++ new/setools-4.2.2/ChangeLog 2019-06-15 21:32:13.000000000 +0200
@@ -1,3 +1,11 @@
+*setools-4.2.2 (15 Jun 2019)
+
+ * Remove source policy references from man pages, as loading source policies
+ is no longer supported.
+ * Fixed a performance regression in alias loading after alias dereferencing
+ fixes in 4.2.1.
+
+
*setools-4.2.1 (4 Feb 2019)
* Set SIGPIPE handler for CLI tools.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/setools-4.2.1/man/apol.1 new/setools-4.2.2/man/apol.1
--- old/setools-4.2.1/man/apol.1 2019-02-05 01:18:05.000000000 +0100
+++ new/setools-4.2.2/man/apol.1 2019-06-15 21:32:13.000000000 +0200
@@ -13,14 +13,7 @@
.SH POLICY
.PP
-\fBapol\fR supports loading SELinux policies in one of two formats.
-.RS
-.IP "source:"
-A single text file containing a monolithic policy source. This file is usually named policy.conf.
-.IP "binary:"
A single file containing a binary policy. This file is usually named by version on Linux systems, for example, \fIpolicy.30\fR. This file is usually named \fIsepolicy\fR on Android systems.
-.RE
-.PP
If not provided, \fBapol\fR will start with none loaded.
.SH OPTIONS
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/setools-4.2.1/man/sediff.1 new/setools-4.2.2/man/sediff.1
--- old/setools-4.2.1/man/sediff.1 2019-02-05 01:18:05.000000000 +0100
+++ new/setools-4.2.2/man/sediff.1 2019-06-15 21:32:13.000000000 +0200
@@ -12,15 +12,8 @@
.SH POLICY
.PP
-\fBsediff\fR supports loading SELinux policies in one of two formats.
-.RS
-.IP "source:"
-A single text file containing a monolithic policy source. This file is usually named policy.conf.
-.IP "binary:"
A single file containing a binary policy. This file is usually named by version on Linux systems, for example, \fIpolicy.30\fR. This file is usually named \fIsepolicy\fR on Android systems.
-.RE
-.PP
-Policies do not need to be the same format. If not provided, \fBsediff\fR will print an error message and exit.
+If not provided, \fBsediff\fR will print an error message and exit.
.SH EXPRESSIONS
.P
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/setools-4.2.1/man/sedta.1 new/setools-4.2.2/man/sedta.1
--- old/setools-4.2.1/man/sedta.1 2019-02-05 01:18:05.000000000 +0100
+++ new/setools-4.2.2/man/sedta.1 2019-06-15 21:32:13.000000000 +0200
@@ -14,15 +14,7 @@
.SH POLICY
.PP
-\fBsedta\fR supports loading SELinux policies in one of two formats.
-.RS
-.IP "source:"
-A single text file containing a monolithic policy source. This file is usually named policy.conf.
-.IP "binary:"
A single file containing a binary policy. This file is usually named by version on Linux systems, for example, \fIpolicy.30\fR. This file is usually named \fIsepolicy\fR on Android systems.
-.RE
-.PP
-.PP
If no policy file is provided, \fBsedta\fR will search for the policy running on the current
system. If no policy can be found, \fBsedta\fR will print an error message and exit.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/setools-4.2.1/man/seinfo.1 new/setools-4.2.2/man/seinfo.1
--- old/setools-4.2.1/man/seinfo.1 2019-02-05 01:18:05.000000000 +0100
+++ new/setools-4.2.2/man/seinfo.1 2019-06-15 21:32:13.000000000 +0200
@@ -12,14 +12,7 @@
.SH POLICY
.PP
-\fBapol\fR supports loading SELinux policies in one of two formats.
-.RS
-.IP "source:"
-A single text file containing a monolithic policy source. This file is usually named policy.conf.
-.IP "binary:"
A single file containing a binary policy. This file is usually named by version on Linux systems, for example, \fIpolicy.30\fR. This file is usually named \fIsepolicy\fR on Android systems.
-.RE
-.PP
If no policy file is provided, \fBseinfo\fR will search for the policy running on the current
system. If no policy can be found, \fBseinfo\fR will print an error message and exit.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/setools-4.2.1/man/seinfoflow.1 new/setools-4.2.2/man/seinfoflow.1
--- old/setools-4.2.1/man/seinfoflow.1 2019-02-05 01:18:05.000000000 +0100
+++ new/setools-4.2.2/man/seinfoflow.1 2019-06-15 21:32:13.000000000 +0200
@@ -14,15 +14,7 @@
.SH POLICY
.PP
-\fBseinfoflow\fR supports loading SELinux policies in one of two formats.
-.RS
-.IP "source:"
-A single text file containing a monolithic policy source. This file is usually named policy.conf.
-.IP "binary:"
A single file containing a binary policy. This file is usually named by version on Linux systems, for example, \fIpolicy.30\fR. This file is usually named \fIsepolicy\fR on Android systems.
-.RE
-.PP
-.PP
If no policy file is provided, \fBseinfoflow\fR will search for the policy running on the current
system. If no policy can be found, \fBseinfoflow\fR will print an error message and exit.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/setools-4.2.1/man/sesearch.1 new/setools-4.2.2/man/sesearch.1
--- old/setools-4.2.1/man/sesearch.1 2019-02-05 01:18:05.000000000 +0100
+++ new/setools-4.2.2/man/sesearch.1 2019-06-15 21:32:13.000000000 +0200
@@ -12,14 +12,7 @@
.SH POLICY
.PP
-\fBsesearch\fR supports loading SELinux policies in one of two formats.
-.RS
-.IP "source:"
-A single text file containing a monolithic policy source. This file is usually named policy.conf.
-.IP "binary:"
A single file containing a binary policy. This file is usually named by version on Linux systems, for example, \fIpolicy.30\fR. This file is usually named \fIsepolicy\fR on Android systems.
-.RE
-.PP
If no policy file is provided, \fBsesearch\fR will search for the policy running on the current
system. If no policy can be found, \fBsesearch\fR will print an error message and exit.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/setools-4.2.1/setools/policyrep/mls.pxi new/setools-4.2.2/setools/policyrep/mls.pxi
--- old/setools-4.2.1/setools/policyrep/mls.pxi 2019-02-05 01:18:05.000000000 +0100
+++ new/setools-4.2.2/setools/policyrep/mls.pxi 2019-06-15 21:32:13.000000000 +0200
@@ -1,5 +1,5 @@
# Copyright 2014-2016, Tresys Technology, LLC
-# Copyright 2017-2018, Chris PeBenito
+# Copyright 2017-2019, Chris PeBenito
#
# This file is part of SETools.
#
@@ -65,6 +65,7 @@
c.key = symbol
c.name = policy.category_value_to_name(symbol.s.value - 1)
c._value = symbol.s.value
+ c._aliases = policy.category_alias_map[symbol.s.value]
_cat_cache[policy][symbol] = c
return c
@@ -75,14 +76,8 @@
# Comparison based on their index instead of their names.
return self._value < other._value
- cdef inline void _load_aliases(self):
- """Helper method to load aliases."""
- if self._aliases is None:
- self._aliases = list(self.policy.category_aliases(self))
-
def aliases(self):
"""Generator that yields all aliases for this category."""
- self._load_aliases()
return iter(self._aliases)
def statement(self):
@@ -90,7 +85,6 @@
str stmt
size_t count
- self._load_aliases()
count = len(self._aliases)
stmt = "category {0}".format(self.name)
@@ -127,6 +121,7 @@
s.key = symbol
s.name = policy.level_value_to_name(symbol.level.sens - 1)
s._value = symbol.level.sens
+ s._aliases = policy.sensitivity_alias_map[symbol.level.sens]
return s
def __hash__(self):
@@ -144,14 +139,8 @@
def __lt__(self, other):
return self._value < other._value
- cdef inline void _load_aliases(self):
- """Helper method to load aliases."""
- if self._aliases is None:
- self._aliases = list(self.policy.sensitivity_aliases(self))
-
def aliases(self):
"""Generator that yields all aliases for this sensitivity."""
- self._load_aliases()
return iter(self._aliases)
def level_decl(self):
@@ -167,7 +156,6 @@
str stmt
size_t count
- self._load_aliases()
count = len(self._aliases)
stmt = "sensitivity {0}".format(self.name)
@@ -540,66 +528,6 @@
datum = self.node.datum if self.node else NULL
-cdef class CategoryAliasHashtabIterator(HashtabIterator):
-
- """Iterate over category aliases in the policy."""
-
- cdef uint32_t primary
-
- @staticmethod
- cdef factory(SELinuxPolicy policy, sepol.hashtab_t *table, Category primary):
- """Factory function for creating category alias iterators."""
- i = CategoryAliasHashtabIterator()
- i.policy = policy
- i.table = table
- i.primary = primary._value
- i.reset()
- return i
-
- def __next__(self):
- super().__next__()
- datum = self.curr.datum if self.curr else NULL
-
- while datum != NULL and (not datum.isalias or datum.s.value != self.primary):
- super().__next__()
- datum = self.curr.datum if self.curr else NULL
-
- return intern(self.curr.key)
-
- def __len__(self):
- cdef sepol.cat_datum_t *datum
- cdef sepol.hashtab_node_t *node
- cdef uint32_t bucket = 0
- cdef size_t count = 0
-
- while bucket < self.table[0].size:
- node = self.table[0].htable[bucket]
- while node != NULL:
- datum = node.datum if node else NULL
- if datum != NULL and self.primary == datum.s.value and datum.isalias:
- count += 1
-
- node = node.next
-
- bucket += 1
-
- return count
-
- def reset(self):
- super().reset()
-
- cdef sepol.cat_datum_t *datum = self.node.datum if self.node else NULL
-
- # advance over any attributes or aliases
- while datum != NULL and (not datum.isalias and self.primary != datum.s.value):
- self._next_node()
-
- if self.node == NULL or self.bucket >= self.table[0].size:
- break
-
- datum = self.node.datum if self.node else NULL
-
-
cdef class SensitivityHashtabIterator(HashtabIterator):
"""Iterate over sensitivity in the policy."""
@@ -652,66 +580,6 @@
self._next_node()
if self.node == NULL or self.bucket >= self.table[0].size:
- break
-
- datum = self.node.datum if self.node else NULL
-
-
-cdef class SensitivityAliasHashtabIterator(HashtabIterator):
-
- """Iterate over sensitivity aliases in the policy."""
-
- cdef uint32_t primary
-
- @staticmethod
- cdef factory(SELinuxPolicy policy, sepol.hashtab_t *table, Sensitivity primary):
- """Factory function for creating Sensitivity alias iterators."""
- i = SensitivityAliasHashtabIterator()
- i.policy = policy
- i.table = table
- i.primary = primary._value
- i.reset()
- return i
-
- def __next__(self):
- super().__next__()
- datum = self.curr.datum if self.curr else NULL
-
- while datum != NULL and (not datum.isalias or datum.level.sens != self.primary):
- super().__next__()
- datum = self.curr.datum if self.curr else NULL
-
- return intern(self.curr.key)
-
- def __len__(self):
- cdef sepol.level_datum_t *datum
- cdef sepol.hashtab_node_t *node
- cdef uint32_t bucket = 0
- cdef size_t count = 0
-
- while bucket < self.table[0].size:
- node = self.table[0].htable[bucket]
- while node != NULL:
- datum = node.datum if node else NULL
- if datum != NULL and self.primary == datum.level.sens and datum.isalias:
- count += 1
-
- node = node.next
-
- bucket += 1
-
- return count
-
- def reset(self):
- super().reset()
-
- cdef sepol.level_datum_t *datum = self.node.datum if self.node else NULL
-
- # advance over any attributes or aliases
- while datum != NULL and (not datum.isalias and self.primary != datum.level.sens):
- self._next_node()
-
- if self.node == NULL or self.bucket >= self.table[0].size:
break
datum = self.node.datum if self.node else NULL
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/setools-4.2.1/setools/policyrep/selinuxpolicy.pxi new/setools-4.2.2/setools/policyrep/selinuxpolicy.pxi
--- old/setools-4.2.1/setools/policyrep/selinuxpolicy.pxi 2019-02-05 01:18:05.000000000 +0100
+++ new/setools-4.2.2/setools/policyrep/selinuxpolicy.pxi 2019-06-15 21:32:13.000000000 +0200
@@ -46,6 +46,9 @@
object log
object constraint_counts
object terule_counts
+ dict type_alias_map
+ dict category_alias_map
+ dict sensitivity_alias_map
object __weakref__
# Public attributes:
@@ -598,12 +601,6 @@
"""Return the category datum for the specified category value."""
return self.cat_val_to_struct[value]
- cdef inline category_aliases(self, Category primary):
- """Return an interator for the aliases for the specified category."""
- return CategoryAliasHashtabIterator.factory(self,
- &self.handle.p.symtab[sepol.SYM_CATS].table,
- primary)
-
cdef inline str category_value_to_name(self, size_t value):
"""Return the name of the category by its value."""
return intern(self.handle.p.sym_val_to_name[sepol.SYM_CATS][value])
@@ -636,17 +633,6 @@
"""Return the name of the role by its value."""
return intern(self.handle.p.sym_val_to_name[sepol.SYM_ROLES][value])
- cdef inline sensitivity_aliases(self, Sensitivity primary):
- """Return an interator for the aliases for the specified sensitivity."""
- return SensitivityAliasHashtabIterator.factory(self,
- &self.handle.p.symtab[sepol.SYM_LEVELS].table, primary)
-
- cdef inline type_aliases(self, Type primary):
- """Return an iterator for the aliases for the specified type."""
- return TypeAliasHashtabIterator.factory(self,
- &self.handle.p.symtab[sepol.SYM_TYPES].table,
- primary)
-
cdef inline sepol.type_datum_t* type_value_to_datum(self, size_t value):
"""Return the type datum for the specified type value."""
return self.handle.p.type_val_to_struct[value]
@@ -725,6 +711,15 @@
if self.mls:
self._create_mls_val_to_struct()
+ #
+ # Create value to alias mappings
+ #
+ self._load_type_aliases()
+
+ if self.mls:
+ self._load_sensitivity_aliases()
+ self._load_category_aliases()
+
self.log.info("Successfully opened SELinux policy \"{0}\"".format(filename))
self.path = filename
@@ -844,6 +839,84 @@
node = node.next
+ bucket += 1
+
+ cdef _load_category_aliases(self):
+ """Build map of aliases to categories"""
+ cdef:
+ sepol.hashtab_t *table = &self.handle.p.symtab[sepol.SYM_CATS].table
+ sepol.cat_datum_t *datum
+ sepol.hashtab_node_t *node
+ uint32_t bucket = 0
+ list entry
+
+ self.category_alias_map = dict()
+
+ while bucket < table[0].size:
+ node = table[0].htable[bucket]
+ while node != NULL:
+ datum = node.datum if node else NULL
+ if datum == NULL:
+ continue
+
+ entry = self.category_alias_map.setdefault(datum.s.value, list())
+ if datum.isalias:
+ entry.append(intern(node.key))
+
+ node = node.next
+
+ bucket += 1
+
+ cdef _load_sensitivity_aliases(self):
+ """Build map of aliases to sensitivities"""
+ cdef:
+ sepol.hashtab_t *table = &self.handle.p.symtab[sepol.SYM_LEVELS].table
+ sepol.level_datum_t *datum
+ sepol.hashtab_node_t *node
+ uint32_t bucket = 0
+ list entry
+
+ self.sensitivity_alias_map = dict()
+
+ while bucket < table[0].size:
+ node = table[0].htable[bucket]
+ while node != NULL:
+ datum = node.datum if node else NULL
+ if datum == NULL:
+ continue
+
+ entry = self.sensitivity_alias_map.setdefault(datum.level.sens, list())
+ if datum.isalias:
+ entry.append(intern(node.key))
+
+ node = node.next
+
+ bucket += 1
+
+ cdef _load_type_aliases(self):
+ """Build map of aliases to types"""
+ cdef:
+ sepol.hashtab_t *table = &self.handle.p.symtab[sepol.SYM_TYPES].table
+ sepol.type_datum_t *datum
+ sepol.hashtab_node_t *node
+ uint32_t bucket = 0
+ list entry
+
+ self.type_alias_map = dict()
+
+ while bucket < table[0].size:
+ node = table[0].htable[bucket]
+ while node != NULL:
+ datum = node.datum if node else NULL
+ if datum == NULL:
+ continue
+
+ entry = self.type_alias_map.setdefault(datum.s.value, list())
+ if type_is_alias(datum):
+ entry.append(intern(node.key))
+
+ node = node.next
+
bucket += 1
cdef _rebuild_attrs_from_map(self):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/setools-4.2.1/setools/policyrep/typeattr.pxi new/setools-4.2.2/setools/policyrep/typeattr.pxi
--- old/setools-4.2.1/setools/policyrep/typeattr.pxi 2019-02-05 01:18:05.000000000 +0100
+++ new/setools-4.2.2/setools/policyrep/typeattr.pxi 2019-06-15 21:32:13.000000000 +0200
@@ -1,5 +1,5 @@
# Copyright 2014, Tresys Technology, LLC
-# Copyright 2017-2018, Chris PeBenito
+# Copyright 2017-2019, Chris PeBenito
#
# This file is part of SETools.
#
@@ -86,13 +86,9 @@
t.value = symbol.s.value
t.name = policy.type_value_to_name(symbol.s.value - 1)
t.ispermissive = <bint>symbol.flags & sepol.TYPE_FLAGS_PERMISSIVE
+ t._aliases = policy.type_alias_map[symbol.s.value]
return t
- cdef inline void _load_aliases(self):
- """Helper method to load aliases."""
- if self._aliases is None:
- self._aliases = list(self.policy.type_aliases(self))
-
cdef inline void _load_attributes(self):
"""Helper method to load attributes."""
cdef sepol.type_datum_t *symbol = self.key
@@ -110,7 +106,6 @@
def aliases(self):
"""Generator that yields all aliases for this type."""
- self._load_aliases()
return iter(self._aliases)
def statement(self):
@@ -119,7 +114,6 @@
str stmt
self._load_attributes()
- self._load_aliases()
count = len(self._aliases)
stmt = "type {0}".format(self.name)
@@ -297,66 +291,6 @@
self._next_node()
-cdef class TypeAliasHashtabIterator(HashtabIterator):
-
- """Iterate over type aliases in the policy."""
-
- cdef uint32_t primary
-
- @staticmethod
- cdef factory(SELinuxPolicy policy, sepol.hashtab_t *table, Type primary):
- """Factory function for creating type alias iterators."""
- i = TypeAliasHashtabIterator()
- i.policy = policy
- i.table = table
- i.primary = primary.value
- i.reset()
- return i
-
- def __next__(self):
- super().__next__()
- datum = self.curr.datum if self.curr else NULL
-
- while datum != NULL and (not type_is_alias(datum) or datum.s.value != self.primary):
- super().__next__()
- datum = self.curr.datum if self.curr else NULL
-
- return intern(self.curr.key)
-
- def __len__(self):
- cdef sepol.type_datum_t *datum
- cdef sepol.hashtab_node_t *node
- cdef uint32_t bucket = 0
- cdef size_t count = 0
-
- while bucket < self.table[0].size:
- node = self.table[0].htable[bucket]
- while node != NULL:
- datum = node.datum if node else NULL
- if datum != NULL and self.primary == datum.s.value and type_is_alias(datum):
- count += 1
-
- node = node.next
-
- bucket += 1
-
- return count
-
- def reset(self):
- super().reset()
-
- cdef sepol.type_datum_t *datum = self.node.datum if self.node else NULL
-
- # advance over any attributes or aliases
- while datum != NULL and (not type_is_alias(datum) and self.primary != datum.s.value):
- self._next_node()
-
- if self.node == NULL or self.bucket >= self.table[0].size:
- break
-
- datum = self.node.datum if self.node else NULL
-
-
#
# Ebitmap Iterator Classes
#
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/setools-4.2.1/setup.py new/setools-4.2.2/setup.py
--- old/setools-4.2.1/setup.py 2019-02-05 01:18:05.000000000 +0100
+++ new/setools-4.2.2/setup.py 2019-06-15 21:32:13.000000000 +0200
@@ -128,7 +128,7 @@
'-fno-exceptions'])]
setup(name='setools',
- version='4.2.1',
+ version='4.2.2',
description='SELinux Policy tools.',
author='Chris PeBenito',
author_email='pebenito@ieee.org',
++++++ python3.8-compat.patch ++++++
--- a/setup.py
+++ b/setup.py
@@ -12,7 +12,6 @@ import os
import shutil
from os.path import join
from itertools import chain
-from contextlib import suppress
from Cython.Build import cythonize
@@ -48,12 +47,16 @@ class CleanCommand(clean):
dirs_to_remove.append(join(root, d))
for file in files_to_remove:
- with suppress(Exception):
+ try:
os.unlink(file)
+ except Exception:
+ pass
for dir_ in dirs_to_remove:
- with suppress(Exception):
+ try:
shutil.rmtree(dir_, ignore_errors=True)
+ except Exception:
+ pass
clean.run(self)
@@ -81,12 +84,14 @@ class QtHelpCommand(Command):
lib_dirs = ['.', '/usr/lib64', '/usr/lib', '/usr/local/lib']
include_dirs = []
-with suppress(KeyError):
+try:
userspace_src = os.environ["USERSPACE_SRC"]
include_dirs.insert(0, userspace_src + "/libsepol/include")
include_dirs.insert(1, userspace_src + "/libselinux/include")
lib_dirs.insert(0, userspace_src + "/libsepol/src")
lib_dirs.insert(1, userspace_src + "/libselinux/src")
+except KeyError:
+ pass
if sys.platform.startswith('darwin'):
macros=[('DARWIN',1)]
@@ -100,12 +105,19 @@ if enable_coverage:
cython_annotate = bool(os.environ.get("SETOOLS_ANNOTATE", False))
+linked_libraries = ['selinux', 'sepol']
+py_ver = sys.version_info[:2]
+if py_ver >= (3, 8):
+ linked_libraries.append('python{:d}.{:d}{}'.format(py_ver[0],
+ py_ver[1],
+ sys.abiflags))
+
ext_py_mods = [Extension('setools.policyrep', ['setools/policyrep.pyx'],
include_dirs=include_dirs,
- libraries=['selinux', 'sepol'],
+ libraries=linked_libraries,
library_dirs=lib_dirs,
define_macros=macros,
- extra_compile_args=['-Werror', '-Wextra',
+ extra_compile_args=['-Wextra',
'-Waggregate-return',
'-Wfloat-equal',
'-Wformat', '-Wformat=2',