Check for correct string class

Use python-six and check against correct string class on both Python 2
and Python 3.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2017-08-28 14:31:09 +02:00
parent 65910f2c33
commit 5379fb5e28
5 changed files with 10 additions and 4 deletions

View File

@ -18,6 +18,7 @@ BuildRequires: python-enum34
BuildRequires: python2-dnf
BuildRequires: python2-multilib
BuildRequires: python2-libcomps
BuildRequires: python2-six
Requires: createrepo >= 0.4.11
Requires: yum => 3.4.3-28
@ -46,6 +47,7 @@ Requires: python-enum34
Requires: python2-dnf
Requires: python2-multilib
Requires: python2-libcomps
Requires: python2-six
BuildArch: noarch

View File

@ -40,8 +40,9 @@ from __future__ import print_function
import contextlib
import os.path
import platform
import jsonschema
import re
import jsonschema
import six
from kobo.shortcuts import force_list
from productmd.composeinfo import COMPOSE_TYPES

View File

@ -4,6 +4,7 @@ from __future__ import print_function
import os
import pipes
import six
from collections import namedtuple
from .wrappers import iso
@ -27,7 +28,7 @@ def quote(str):
def emit(f, cmd):
"""Print line of shell code into the stream."""
if isinstance(cmd, basestring):
if isinstance(cmd, six.string_types):
print(cmd, file=f)
else:
print(' '.join([quote(x) for x in cmd]), file=f)

View File

@ -19,6 +19,7 @@ import os
import shutil
import pipes
import glob
import six
import kobo.log
from kobo.shortcuts import run, force_list
@ -226,7 +227,7 @@ def get_file_from_scm(scm_dict, target_path, logger=None):
>>> get_file_from_scm(scm_dict, target_path)
['/tmp/path/share/variants.dtd']
"""
if isinstance(scm_dict, basestring):
if isinstance(scm_dict, six.string_types):
scm_type = "file"
scm_repo = None
scm_file = os.path.abspath(scm_dict)
@ -279,7 +280,7 @@ def get_dir_from_scm(scm_dict, target_path, logger=None):
>>> get_dir_from_scm(scm_dict, target_path)
['/tmp/path/share/variants.dtd', '/tmp/path/share/rawhide-fedora.ks', ...]
"""
if isinstance(scm_dict, basestring):
if isinstance(scm_dict, six.string_types):
scm_type = "file"
scm_repo = None
scm_dir = os.path.abspath(scm_dict)

View File

@ -61,6 +61,7 @@ setup(
"lockfile",
"lxml",
"productmd",
"six",
],
tests_require = [
"mock",