Blob Blame Raw
From 39a28c23990f667ef1dc50c3fe6d0ca79a7e793d Mon Sep 17 00:00:00 2001
From: Vit Mojzis <vmojzis@redhat.com>
Date: Fri, 29 Jun 2018 10:31:18 +0200
Subject: [PATCH 2/2] Do not export/use setools.InfoFlowAnalysis and
 setools.DomainTransitionAnalysis

dta and infoflow modules require networkx which brings lot of dependencies.
These dependencies are not necessary for setools module itself as it's
used in policycoreutils.

Therefore it's better to use setools.infoflow.InfoFlowAnalysis and
setools.dta.DomainTransitionAnalysis and let the package containing
sedta and seinfoflow to require python3-networkx
---
 sedta                       | 4 ++--
 seinfoflow                  | 3 ++-
 setools/__init__.py         | 4 ++--
 setoolsgui/apol/dta.py      | 2 +-
 setoolsgui/apol/infoflow.py | 2 +-
 tests/dta.py                | 2 +-
 tests/infoflow.py           | 2 +-
 7 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/sedta b/sedta
index 84820b0..8c380ab 100755
--- a/sedta
+++ b/sedta
@@ -21,7 +21,7 @@ import sys
 import argparse
 import logging
 
-import setools
+import setools.dta
 
 
 def print_transition(trans):
@@ -110,7 +110,7 @@ else:
 
 try:
     p = setools.SELinuxPolicy(args.policy)
-    g = setools.DomainTransitionAnalysis(p, reverse=args.reverse, exclude=args.exclude)
+    g = setools.dta.DomainTransitionAnalysis(p, reverse=args.reverse, exclude=args.exclude)
 
     if args.shortest_path or args.all_paths:
         if args.shortest_path:
diff --git a/seinfoflow b/seinfoflow
index 3ec05ca..89764fe 100755
--- a/seinfoflow
+++ b/seinfoflow
@@ -18,6 +18,7 @@
 #
 
 import setools
+import setools.infoflow
 import argparse
 import sys
 import logging
@@ -78,7 +79,7 @@ else:
 try:
     p = setools.SELinuxPolicy(args.policy)
     m = setools.PermissionMap(args.map)
-    g = setools.InfoFlowAnalysis(p, m, min_weight=args.min_weight, exclude=args.exclude)
+    g = setools.infoflow.InfoFlowAnalysis(p, m, min_weight=args.min_weight, exclude=args.exclude)
 
     if args.shortest_path or args.all_paths:
         if args.shortest_path:
diff --git a/setools/__init__.py b/setools/__init__.py
index a84c846..cbb2a00 100644
--- a/setools/__init__.py
+++ b/setools/__init__.py
@@ -74,11 +74,11 @@ from .pcideviceconquery import PcideviceconQuery
 from .devicetreeconquery import DevicetreeconQuery
 
 # Information Flow Analysis
-from .infoflow import InfoFlowAnalysis
+#from .infoflow import InfoFlowAnalysis
 from .permmap import PermissionMap
 
 # Domain Transition Analysis
-from .dta import DomainTransitionAnalysis
+#from .dta import DomainTransitionAnalysis
 
 # Policy difference
 from .diff import PolicyDifference
diff --git a/setoolsgui/apol/dta.py b/setoolsgui/apol/dta.py
index 0aaf13f..5b1ea20 100644
--- a/setoolsgui/apol/dta.py
+++ b/setoolsgui/apol/dta.py
@@ -23,7 +23,7 @@ from PyQt5.QtCore import pyqtSignal, Qt, QStringListModel, QThread
 from PyQt5.QtGui import QPalette, QTextCursor
 from PyQt5.QtWidgets import QCompleter, QHeaderView, QMessageBox, QProgressDialog, \
                             QTreeWidgetItem
-from setools import DomainTransitionAnalysis
+from setools.dta import DomainTransitionAnalysis
 
 from ..logtosignal import LogHandlerToSignal
 from .analysistab import AnalysisTab
diff --git a/setoolsgui/apol/infoflow.py b/setoolsgui/apol/infoflow.py
index b272a99..7b05945 100644
--- a/setoolsgui/apol/infoflow.py
+++ b/setoolsgui/apol/infoflow.py
@@ -26,7 +26,7 @@ from PyQt5.QtCore import pyqtSignal, Qt, QStringListModel, QThread
 from PyQt5.QtGui import QPalette, QTextCursor
 from PyQt5.QtWidgets import QCompleter, QHeaderView, QMessageBox, QProgressDialog, \
                             QTreeWidgetItem
-from setools import InfoFlowAnalysis
+from setools.infoflow import InfoFlowAnalysis
 from setools.exception import UnmappedClass, UnmappedPermission
 
 from ..logtosignal import LogHandlerToSignal
diff --git a/tests/dta.py b/tests/dta.py
index be04ae4..de4f337 100644
--- a/tests/dta.py
+++ b/tests/dta.py
@@ -18,7 +18,7 @@
 import os
 import unittest
 
-from setools import DomainTransitionAnalysis
+from setools.dta import DomainTransitionAnalysis
 from setools import TERuletype as TERT
 from setools.policyrep.exception import InvalidType
 from setools.policyrep.libpolicyrep import Type
diff --git a/tests/infoflow.py b/tests/infoflow.py
index 87bb1b0..dc1e7b9 100644
--- a/tests/infoflow.py
+++ b/tests/infoflow.py
@@ -18,7 +18,7 @@
 import os
 import unittest
 
-from setools import InfoFlowAnalysis
+from setools.infoflow import InfoFlowAnalysis
 from setools import TERuletype as TERT
 from setools.permmap import PermissionMap
 from setools.policyrep.exception import InvalidType
-- 
2.14.3