Bug 1427568 - Adding python 3 support for mozversion. r=wlach draft
authorVedant Chakravadhanula <vedantc98@gmail.com>
Tue, 02 Jan 2018 09:17:28 +0530
changeset 715123 a8444f8946d576454900fc3223894f2a4f47a2b9
parent 714633 f5a1cb52c12e8fbcf2e3b5a675fe2a84d43507a7
child 744710 4040f0bcb5c1c7bf0ca5d57c3a3c74d052783ac7
push id94069
push userbmo:vedantc98@gmail.com
push dateTue, 02 Jan 2018 03:48:11 +0000
reviewerswlach
bugs1427568
milestone59.0a1
Bug 1427568 - Adding python 3 support for mozversion. r=wlach MozReview-Commit-ID: HyRVFvMBNek
testing/mozbase/mozversion/mozversion/mozversion.py
testing/mozbase/mozversion/setup.py
--- 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
       """)