aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoss Brattain <ross.b.brattain@intel.com>2017-06-21 14:57:13 -0700
committerRoss Brattain <ross.b.brattain@intel.com>2017-06-28 23:08:14 -0700
commiteceefe7114bc5d0fc94ac77ee4e510c94c1a76bf (patch)
treecf24e060a2972701c3b6788ed0ed748c8168fe0f
parentf2149d0366a2dd7add11d017679307256632d372 (diff)
add Python3 support with six
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>
-rw-r--r--anteater/main.py (renamed from anteater/anteater.py)11
-rw-r--r--anteater/src/__init__.py1
-rw-r--r--anteater/src/get_lists.py6
-rw-r--r--anteater/src/patch_scan.py6
-rw-r--r--anteater/src/project_scan.py7
-rw-r--r--anteater/utils/__init__.py1
-rw-r--r--anteater/utils/anteater_logger.py7
-rwxr-xr-xsetup.py7
-rw-r--r--tasks.py2
9 files changed, 31 insertions, 17 deletions
diff --git a/anteater/anteater.py b/anteater/main.py
index 063fcbd..3a23ceb 100644
--- a/anteater/anteater.py
+++ b/anteater/main.py
@@ -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()
diff --git a/anteater/src/__init__.py b/anteater/src/__init__.py
index 896994c..1db8868 100644
--- a/anteater/src/__init__.py
+++ b/anteater/src/__init__.py
@@ -1,3 +1,4 @@
+from __future__ import absolute_import
import pkg_resources
try:
diff --git a/anteater/src/get_lists.py b/anteater/src/get_lists.py
index b7b9aea..e27335a 100644
--- a/anteater/src/get_lists.py
+++ b/anteater/src/get_lists.py
@@ -13,15 +13,17 @@
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')
diff --git a/anteater/src/patch_scan.py b/anteater/src/patch_scan.py
index f8ef225..71604a8 100644
--- a/anteater/src/patch_scan.py
+++ b/anteater/src/patch_scan.py
@@ -19,15 +19,15 @@
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
diff --git a/anteater/src/project_scan.py b/anteater/src/project_scan.py
index 15498f1..647c256 100644
--- a/anteater/src/project_scan.py
+++ b/anteater/src/project_scan.py
@@ -16,16 +16,17 @@
"""
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')
diff --git a/anteater/utils/__init__.py b/anteater/utils/__init__.py
index 896994c..1db8868 100644
--- a/anteater/utils/__init__.py
+++ b/anteater/utils/__init__.py
@@ -1,3 +1,4 @@
+from __future__ import absolute_import
import pkg_resources
try:
diff --git a/anteater/utils/anteater_logger.py b/anteater/utils/anteater_logger.py
index 1fe705f..785e644 100644
--- a/anteater/utils/anteater_logger.py
+++ b/anteater/utils/anteater_logger.py
@@ -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')
diff --git a/setup.py b/setup.py
index 47d1b19..d392231 100755
--- 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'],
diff --git a/tasks.py b/tasks.py
index e2e084b..55ac340 100644
--- 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