Bug 1427568 - Adding python 3 support for mozversion. r=wlach
MozReview-Commit-ID: HyRVFvMBNek
--- a/testing/mozbase/mozversion/mozversion/mozversion.py
+++ b/testing/mozbase/mozversion/mozversion/mozversion.py
@@ -1,19 +1,19 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
from __future__ import absolute_import
import argparse
-import ConfigParser
-from StringIO import StringIO
import os
import re
+from six import StringIO
+from six.moves import configparser
import sys
import tempfile
import xml.dom.minidom
import zipfile
import mozfile
import mozlog
@@ -35,17 +35,17 @@ class Version(object):
for type, section in INI_DATA_MAPPING:
config_file = os.path.join(path, "%s.ini" % type)
if os.path.exists(config_file):
self._parse_ini_file(open(config_file), type, section)
else:
self._logger.warning('Unable to find %s' % config_file)
def _parse_ini_file(self, fp, type, section):
- config = ConfigParser.RawConfigParser()
+ config = configparser.RawConfigParser()
config.readfp(fp)
name_map = {'codename': 'display_name',
'milestone': 'version',
'sourcerepository': 'repository',
'sourcestamp': 'changeset'}
for key, value in config.items(section):
name = name_map.get(key, key).lower()
self._info['%s_%s' % (type, name)] = config.has_option(
--- a/testing/mozbase/mozversion/setup.py
+++ b/testing/mozbase/mozversion/setup.py
@@ -8,24 +8,27 @@ from setuptools import setup
PACKAGE_VERSION = '1.4'
setup(name='mozversion',
version=PACKAGE_VERSION,
description='Library to get version information for applications',
long_description="see https://firefox-source-docs.mozilla.org/mozbase/index.html",
- classifiers=[],
+ classifiers=['Programming Language :: Python :: 2.7',
+ 'Programming Language :: Python :: 3'],
keywords='mozilla',
author='Mozilla Automation and Testing Team',
author_email='tools@lists.mozilla.org',
url='https://wiki.mozilla.org/Auto-tools/Projects/Mozbase',
license='MPL',
packages=['mozversion'],
include_package_data=True,
zip_safe=False,
- install_requires=['mozfile >= 1.0', 'mozlog >= 3.0'],
+ install_requires=['mozfile >= 1.0',
+ 'mozlog >= 3.0',
+ 'six >= 1.10.0'],
extras_require={'device': ['mozdevice >= 0.44']},
entry_points="""
# -*- Entry points: -*-
[console_scripts]
mozversion = mozversion:cli
""")