add Python3 support with six 39/36339/3
authorRoss Brattain <ross.b.brattain@intel.com>
Wed, 21 Jun 2017 21:57:13 +0000 (14:57 -0700)
committerRoss Brattain <ross.b.brattain@intel.com>
Thu, 29 Jun 2017 06:08:14 +0000 (23:08 -0700)
switch to relative imports for package file

use absolute imports in main
this requires renaming anteater.py to main.py
to avoid absolute import name conflict

update setup.py to indicate python 3.4 support

Change-Id: I0fcaf8a9825557962dc98a6a4eef490051fbbfb0
Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
anteater/main.py [moved from anteater/anteater.py with 86% similarity]
anteater/src/__init__.py
anteater/src/get_lists.py
anteater/src/patch_scan.py
anteater/src/project_scan.py
anteater/utils/__init__.py
anteater/utils/anteater_logger.py
setup.py
tasks.py

similarity index 86%
rename from anteater/anteater.py
rename to anteater/main.py
index 063fcbd..3a23ceb 100644 (file)
@@ -23,16 +23,17 @@ Options:
   -h --help     Show this screen.
   --version     Show version.
 """
+from __future__ import absolute_import
 
-import ConfigParser
+import six.moves.configparser
 from docopt import docopt
 import os
-from src.patch_scan import prepare_patchset
-from src.project_scan import prepare_project
-import utils.anteater_logger as antlog
+from anteater.src.patch_scan import prepare_patchset
+from anteater.src.project_scan import prepare_project
+from anteater.utils import anteater_logger as antlog
 
 
-config = ConfigParser.RawConfigParser()
+config = six.moves.configparser.RawConfigParser()
 config.read('anteater.conf')
 reports_dir = config.get('config', 'reports_dir')
 logger = antlog.Logger(__name__).getLogger()
index 896994c..1db8868 100644 (file)
@@ -1,3 +1,4 @@
+from __future__ import absolute_import
 import pkg_resources
 
 try:
index b7b9aea..e27335a 100644 (file)
     Gathers various values from the gate check yaml file and return them to the
     calling instance
 """
+from __future__ import absolute_import
 
 import anteater.utils.anteater_logger as antlog
-import ConfigParser
+import six.moves.configparser
 import copy
 import os
 import yaml
 import re
 
-config = ConfigParser.RawConfigParser()
+
+config = six.moves.configparser.RawConfigParser()
 config.read('anteater.conf')
 logger = antlog.Logger(__name__).getLogger()
 master_list = config.get('config', 'master_list')
index f8ef225..71604a8 100644 (file)
 from __future__ import division, print_function, absolute_import
 from binaryornot.check import is_binary
 import anteater.utils.anteater_logger as antlog
-import anteater.src.get_lists as get_lists
-import ConfigParser
 import hashlib
+import six.moves.configparser
 import sys
 import re
 
+from . import get_lists
 
 logger = antlog.Logger(__name__).getLogger()
-config = ConfigParser.RawConfigParser()
+config = six.moves.configparser.RawConfigParser()
 config.read('anteater.conf')
 reports_dir = config.get('config', 'reports_dir')
 failure = False
index 15498f1..647c256 100644 (file)
 """
 
 from __future__ import division, print_function, absolute_import
-import ConfigParser
 import hashlib
+import six.moves.configparser
 import os
 import re
 import anteater.utils.anteater_logger as antlog
-import anteater.src.get_lists as get_lists
 from binaryornot.check import is_binary
 
+from . import get_lists
+
 logger = antlog.Logger(__name__).getLogger()
-config = ConfigParser.RawConfigParser()
+config = six.moves.configparser.RawConfigParser()
 config.read('anteater.conf')
 reports_dir = config.get('config', 'reports_dir')
 master_list = config.get('config', 'master_list')
index 896994c..1db8868 100644 (file)
@@ -1,3 +1,4 @@
+from __future__ import absolute_import
 import pkg_resources
 
 try:
index 1fe705f..785e644 100644 (file)
@@ -9,11 +9,14 @@
 # http://www.apache.org/licenses/LICENSE-2.0
 ##############################################################################
 
-import ConfigParser
+from __future__ import absolute_import
+
 import logging
+
 import os
+import six.moves.configparser
 
-config = ConfigParser.RawConfigParser()
+config = six.moves.configparser.RawConfigParser()
 config.read('anteater.conf')
 anteater_log = config.get('config', 'anteater_log')
 
index 47d1b19..d392231 100755 (executable)
--- a/setup.py
+++ b/setup.py
@@ -1,4 +1,5 @@
 # -*- coding: utf-8 -*-
+from __future__ import absolute_import
 import re
 import sys
 from setuptools.command.test import test as TestCommand
@@ -37,7 +38,7 @@ def find_version(fname):
         raise RuntimeError('Cannot find version information')
     return version
 
-__version__ = find_version("anteater/anteater.py")
+__version__ = find_version("anteater/main.py")
 
 
 def read(fname):
@@ -64,6 +65,8 @@ setup(
         'Natural Language :: English',
         "Programming Language :: Python :: 2",
         'Programming Language :: Python :: 2.7',
+        "Programming Language :: Python :: 3",
+        'Programming Language :: Python :: 3.4',
         'Programming Language :: Python :: Implementation :: CPython',
         'Programming Language :: Python :: Implementation :: PyPy'
     ],
@@ -71,7 +74,7 @@ setup(
     py_modules=["anteater"],
     entry_points={
         'console_scripts': [
-            "anteater = anteater.anteater:main"
+            "anteater = anteater.main:main"
         ]
     },
     tests_require=['pytest'],
index e2e084b..55ac340 100644 (file)
--- a/tasks.py
+++ b/tasks.py
@@ -1,4 +1,6 @@
 # -*- coding: utf-8 -*-
+from __future__ import absolute_import
+from __future__ import print_function
 import os
 import sys