Merge pull request #79 from pebenito/ci-fixes

Update CI tests and fix new issues.
This commit is contained in:
Chris PeBenito 2022-11-30 15:19:01 -05:00 committed by GitHub
commit a66c264b2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 20 additions and 100 deletions

View File

@ -14,21 +14,23 @@ jobs:
matrix:
build-opts:
- {python: 3.6, tox: py36}
- {python: 3.7, tox: py37}
- {python: 3.8, tox: py38}
- {python: 3.9, tox: py39}
- {python: 3.6, tox: pep8}
- {python: 3.6, tox: lint}
- {python: 3.6, tox: mypy}
#- {python: 3.6, tox: coverage}
- {python: '3.6', tox: py36}
- {python: '3.7', tox: py37}
- {python: '3.8', tox: py38}
- {python: '3.9', tox: py39}
- {python: '3.10', tox: py310}
- {python: '3.11', tox: py311}
- {python: '3.6', tox: pep8}
- {python: '3.6', tox: lint}
- {python: '3.6', tox: mypy}
#- {python: '3.6', tox: coverage}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
# This should be the minimum required Python version to build refpolicy.
- name: Set up Python ${{ matrix.build-opts.python }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.build-opts.python }}

View File

@ -18,7 +18,7 @@ from abc import ABC, abstractmethod
from collections import defaultdict
from collections.abc import Collection
from enum import Enum
from typing import Any, Callable, MutableMapping, Optional, Union
from typing import Any, Callable, MutableMapping, Optional, Type, Union
from weakref import WeakKeyDictionary
from .util import validate_perms_any
@ -57,7 +57,7 @@ class CriteriaDescriptor:
def __init__(self, name_regex: Optional[str] = None,
lookup_function: Optional[Union[Callable, str]] = None,
default_value=None, enum_class: Optional[Enum] = None) -> None:
default_value=None, enum_class: Optional[Type[Enum]] = None) -> None:
assert name_regex or lookup_function or enum_class, \
"A simple attribute should be used if there is no regex, lookup function, or enum."

View File

@ -115,8 +115,8 @@ class PermissionMap:
def __deepcopy__(self, memo) -> 'PermissionMap':
newobj = PermissionMap.__new__(PermissionMap)
newobj.log = self.log
newobj.permmap = copy.deepcopy(self._permmap)
newobj.permmapfile = self._permmapfile
newobj._permmap = copy.deepcopy(self._permmap)
newobj._permmapfile = self._permmapfile
memo[id(self)] = newobj
return newobj

View File

@ -139,12 +139,6 @@ class Bounds(PolicyObject):
def __setstate__(self, state) -> Any: ...
class BoundsRuletype(PolicyEnum):
__new__: Any = ...
_generate_next_value_: Any = ...
_member_map_: Any = ...
_member_names_: Any = ...
_member_type_: Any = ...
_value2member_map_: Any = ...
typebounds: int = ...
class Category(PolicySymbol):
@ -337,12 +331,6 @@ class ConstraintIterator(PolicyIterator):
def __setstate__(self, state) -> Any: ...
class ConstraintRuletype(PolicyEnum):
__new__: Any = ...
_generate_next_value_: Any = ...
_member_map_: Any = ...
_member_names_: Any = ...
_member_type_: Any = ...
_value2member_map_: Any = ...
constrain: int = ...
mlsconstrain: int = ...
mlsvalidatetrans: int = ...
@ -397,12 +385,6 @@ class DefaultRange(Default):
def __setstate__(self, state) -> Any: ...
class DefaultRangeValue(PolicyEnum):
__new__: Any = ...
_generate_next_value_: Any = ...
_member_map_: Any = ...
_member_names_: Any = ...
_member_type_: Any = ...
_value2member_map_: Any = ...
high: int = ...
low: int = ...
low_high: int = ...
@ -410,24 +392,12 @@ class DefaultRangeValue(PolicyEnum):
def from_default_range(self, range: Optional[int]) -> Optional[DefaultRangeValue]: ...
class DefaultRuletype(PolicyEnum):
__new__: Any = ...
_generate_next_value_: Any = ...
_member_map_: Any = ...
_member_names_: Any = ...
_member_type_: Any = ...
_value2member_map_: Any = ...
default_range: int = ...
default_role: int = ...
default_type: int = ...
default_user: int = ...
class DefaultValue(PolicyEnum):
__new__: Any = ...
_generate_next_value_: Any = ...
_member_map_: Any = ...
_member_names_: Any = ...
_member_type_: Any = ...
_value2member_map_: Any = ...
glblub: int = ...
source: int = ...
target: int = ...
@ -486,12 +456,6 @@ class FSUseIterator(OcontextIterator):
def __setstate__(self, state) -> Any: ...
class FSUseRuletype(PolicyEnum):
__new__: Any = ...
_generate_next_value_: Any = ...
_member_map_: Any = ...
_member_names_: Any = ...
_member_type_: Any = ...
_value2member_map_: Any = ...
fs_use_task: int = ...
fs_use_trans: int = ...
fs_use_xattr: int = ...
@ -573,12 +537,6 @@ class GenfsconOcontextIterator(OcontextIterator):
def __setstate__(self, state) -> Any: ...
class HandleUnknown(PolicyEnum):
__new__: Any = ...
_generate_next_value_: Any = ...
_member_map_: Any = ...
_member_names_: Any = ...
_member_type_: Any = ...
_value2member_map_: Any = ...
allow: int = ...
deny: int = ...
reject: int = ...
@ -867,12 +825,6 @@ class MLSRuleIterator(HashtabIterator):
def __setstate__(self, state) -> Any: ...
class MLSRuletype(PolicyEnum):
__new__: Any = ...
_generate_next_value_: Any = ...
_member_map_: Any = ...
_member_names_: Any = ...
_member_type_: Any = ...
_value2member_map_: Any = ...
range_transition: int = ...
class Netifcon(Ocontext):
@ -924,12 +876,6 @@ class Nodecon(Ocontext):
def __setstate__(self, state) -> Any: ...
class NodeconIPVersion(PolicyEnum):
__new__: Any = ...
_generate_next_value_: Any = ...
_member_map_: Any = ...
_member_names_: Any = ...
_member_type_: Any = ...
_value2member_map_: Any = ...
ipv4: int = ...
ipv6: int = ...
@ -1047,12 +993,6 @@ class PolicyCapabilityIterator(EbitmapIterator):
def __setstate__(self, state) -> Any: ...
class PolicyEnum(enum.Enum):
__new__: Any = ...
_generate_next_value_: Any = ...
_member_map_: Any = ...
_member_names_: Any = ...
_member_type_: Any = ...
_value2member_map_: Any = ...
@classmethod
def lookup(self, value) -> Any: ...
def __eq__(self, other) -> bool: ...
@ -1112,12 +1052,6 @@ class PolicySymbol(PolicyObject):
def __setstate__(self, state) -> Any: ...
class PolicyTarget(PolicyEnum):
__new__: Any = ...
_generate_next_value_: Any = ...
_member_map_: Any = ...
_member_names_: Any = ...
_member_type_: Any = ...
_value2member_map_: Any = ...
selinux: int = ...
xen: int = ...
@ -1147,12 +1081,6 @@ class PortconIterator(OcontextIterator):
def __setstate__(self, state) -> Any: ...
class PortconProtocol(PolicyEnum):
__new__: Any = ...
_generate_next_value_: Any = ...
_member_map_: Any = ...
_member_names_: Any = ...
_member_type_: Any = ...
_value2member_map_: Any = ...
dccp: int = ...
sctp: int = ...
tcp: int = ...
@ -1173,12 +1101,6 @@ class PortconRange(Tuple[int, int]):
def _make(self, *args, **kwargs) -> Any: ...
class RBACRuletype(PolicyEnum):
__new__: Any = ...
_generate_next_value_: Any = ...
_member_map_: Any = ...
_member_names_: Any = ...
_member_type_: Any = ...
_value2member_map_: Any = ...
allow: int = ...
role_transition: int = ...
@ -1460,12 +1382,6 @@ class TERuleIterator(PolicyIterator):
class TERuleNoFilename(AttributeError, setools.exception.PolicyrepException): ...
class TERuletype(PolicyEnum):
__new__: Any = ...
_generate_next_value_: Any = ...
_member_map_: Any = ...
_member_names_: Any = ...
_member_type_: Any = ...
_value2member_map_: Any = ...
allow: int = ...
allowxperm: int = ...
auditallow: int = ...

View File

@ -35,9 +35,11 @@ class TabRegistry(sip.wrappertype):
saving tab/workspace info.
"""
def __new__(cls, clsname, superclasses, attributedict):
classdef = super().__new__(cls, clsname, superclasses, attributedict)
def __new__(cls, *args, **kwargs):
classdef = super().__new__(cls, *args, **kwargs)
clsname = args[0]
attributedict = args[2]
if clsname != "AnalysisTab":
assert "section" in attributedict, "Class {} is missing the section value, " \
"this is an setools bug".format(clsname)