b2c4c6
From 39a28c23990f667ef1dc50c3fe6d0ca79a7e793d Mon Sep 17 00:00:00 2001
b2c4c6
From: Vit Mojzis <vmojzis@redhat.com>
b2c4c6
Date: Fri, 29 Jun 2018 10:31:18 +0200
d57070
Subject: [PATCH 2/2] Do not export/use setools.InfoFlowAnalysis and
d57070
 setools.DomainTransitionAnalysis
d57070
d57070
dta and infoflow modules require networkx which brings lot of dependencies.
d57070
These dependencies are not necessary for setools module itself as it's
d57070
used in policycoreutils.
d57070
d57070
Therefore it's better to use setools.infoflow.InfoFlowAnalysis and
d57070
setools.dta.DomainTransitionAnalysis and let the package containing
d57070
sedta and seinfoflow to require python3-networkx
d57070
---
b2c4c6
 sedta                       | 4 ++--
d57070
 seinfoflow                  | 3 ++-
d57070
 setools/__init__.py         | 4 ++--
d57070
 setoolsgui/apol/dta.py      | 2 +-
d57070
 setoolsgui/apol/infoflow.py | 2 +-
b2c4c6
 tests/dta.py                | 2 +-
b2c4c6
 tests/infoflow.py           | 2 +-
b2c4c6
 7 files changed, 10 insertions(+), 9 deletions(-)
d57070
d57070
diff --git a/sedta b/sedta
b2c4c6
index 84820b0..8c380ab 100755
d57070
--- a/sedta
d57070
+++ b/sedta
b2c4c6
@@ -21,7 +21,7 @@ import sys
b2c4c6
 import argparse
d57070
 import logging
d57070
 
b2c4c6
-import setools
d57070
+import setools.dta
d57070
 
d57070
 
d57070
 def print_transition(trans):
b2c4c6
@@ -110,7 +110,7 @@ else:
d57070
 
d57070
 try:
d57070
     p = setools.SELinuxPolicy(args.policy)
d57070
-    g = setools.DomainTransitionAnalysis(p, reverse=args.reverse, exclude=args.exclude)
d57070
+    g = setools.dta.DomainTransitionAnalysis(p, reverse=args.reverse, exclude=args.exclude)
d57070
 
d57070
     if args.shortest_path or args.all_paths:
d57070
         if args.shortest_path:
d57070
diff --git a/seinfoflow b/seinfoflow
b2c4c6
index 3ec05ca..89764fe 100755
d57070
--- a/seinfoflow
d57070
+++ b/seinfoflow
b2c4c6
@@ -18,6 +18,7 @@
b2c4c6
 #
d57070
 
d57070
 import setools
d57070
+import setools.infoflow
d57070
 import argparse
d57070
 import sys
d57070
 import logging
b2c4c6
@@ -78,7 +79,7 @@ else:
d57070
 try:
d57070
     p = setools.SELinuxPolicy(args.policy)
d57070
     m = setools.PermissionMap(args.map)
d57070
-    g = setools.InfoFlowAnalysis(p, m, min_weight=args.min_weight, exclude=args.exclude)
d57070
+    g = setools.infoflow.InfoFlowAnalysis(p, m, min_weight=args.min_weight, exclude=args.exclude)
d57070
 
d57070
     if args.shortest_path or args.all_paths:
d57070
         if args.shortest_path:
d57070
diff --git a/setools/__init__.py b/setools/__init__.py
b2c4c6
index a84c846..cbb2a00 100644
d57070
--- a/setools/__init__.py
d57070
+++ b/setools/__init__.py
d57070
@@ -74,11 +74,11 @@ from .pcideviceconquery import PcideviceconQuery
d57070
 from .devicetreeconquery import DevicetreeconQuery
d57070
 
d57070
 # Information Flow Analysis
d57070
-from .infoflow import InfoFlowAnalysis
b2c4c6
+#from .infoflow import InfoFlowAnalysis
d57070
 from .permmap import PermissionMap
d57070
 
d57070
 # Domain Transition Analysis
d57070
-from .dta import DomainTransitionAnalysis
b2c4c6
+#from .dta import DomainTransitionAnalysis
d57070
 
d57070
 # Policy difference
d57070
 from .diff import PolicyDifference
d57070
diff --git a/setoolsgui/apol/dta.py b/setoolsgui/apol/dta.py
d57070
index 0aaf13f..5b1ea20 100644
d57070
--- a/setoolsgui/apol/dta.py
d57070
+++ b/setoolsgui/apol/dta.py
d57070
@@ -23,7 +23,7 @@ from PyQt5.QtCore import pyqtSignal, Qt, QStringListModel, QThread
d57070
 from PyQt5.QtGui import QPalette, QTextCursor
d57070
 from PyQt5.QtWidgets import QCompleter, QHeaderView, QMessageBox, QProgressDialog, \
d57070
                             QTreeWidgetItem
d57070
-from setools import DomainTransitionAnalysis
d57070
+from setools.dta import DomainTransitionAnalysis
d57070
 
d57070
 from ..logtosignal import LogHandlerToSignal
d57070
 from .analysistab import AnalysisTab
d57070
diff --git a/setoolsgui/apol/infoflow.py b/setoolsgui/apol/infoflow.py
b2c4c6
index b272a99..7b05945 100644
d57070
--- a/setoolsgui/apol/infoflow.py
d57070
+++ b/setoolsgui/apol/infoflow.py
b2c4c6
@@ -26,7 +26,7 @@ from PyQt5.QtCore import pyqtSignal, Qt, QStringListModel, QThread
d57070
 from PyQt5.QtGui import QPalette, QTextCursor
d57070
 from PyQt5.QtWidgets import QCompleter, QHeaderView, QMessageBox, QProgressDialog, \
d57070
                             QTreeWidgetItem
d57070
-from setools import InfoFlowAnalysis
d57070
+from setools.infoflow import InfoFlowAnalysis
d57070
 from setools.exception import UnmappedClass, UnmappedPermission
d57070
 
d57070
 from ..logtosignal import LogHandlerToSignal
d57070
diff --git a/tests/dta.py b/tests/dta.py
b2c4c6
index be04ae4..de4f337 100644
d57070
--- a/tests/dta.py
d57070
+++ b/tests/dta.py
b2c4c6
@@ -18,7 +18,7 @@
b2c4c6
 import os
d57070
 import unittest
d57070
 
b2c4c6
-from setools import DomainTransitionAnalysis
d57070
+from setools.dta import DomainTransitionAnalysis
d57070
 from setools import TERuletype as TERT
d57070
 from setools.policyrep.exception import InvalidType
b2c4c6
 from setools.policyrep.libpolicyrep import Type
d57070
diff --git a/tests/infoflow.py b/tests/infoflow.py
b2c4c6
index 87bb1b0..dc1e7b9 100644
d57070
--- a/tests/infoflow.py
d57070
+++ b/tests/infoflow.py
b2c4c6
@@ -18,7 +18,7 @@
b2c4c6
 import os
d57070
 import unittest
d57070
 
b2c4c6
-from setools import InfoFlowAnalysis
d57070
+from setools.infoflow import InfoFlowAnalysis
d57070
 from setools import TERuletype as TERT
d57070
 from setools.permmap import PermissionMap
d57070
 from setools.policyrep.exception import InvalidType
d57070
-- 
b2c4c6
2.14.3
d57070