Skip to content

Commit

Permalink
Drop dependency on six
Browse files Browse the repository at this point in the history
This drops the compatibility with Python 2.7, this should be OK (EPEL 7
is EOL).
  • Loading branch information
praiskup committed Sep 8, 2024
1 parent e736718 commit b1d5e6a
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 15 deletions.
7 changes: 1 addition & 6 deletions bin/dg
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import shutil

from argparse import ArgumentParser, RawDescriptionHelpFormatter

import six

import logging
logging.basicConfig(format='dg: %(levelname)-8s: %(message)s')

Expand Down Expand Up @@ -161,10 +159,7 @@ def print_multispec_combinations(args):

def render_template(args):
temp_filename = False
if six.PY2:
output = sys.stdout
else:
output = sys.stdout.buffer
output = sys.stdout.buffer
try:
if args.output:
_, temp_filename = tempfile.mkstemp(prefix="distgen-")
Expand Down
3 changes: 1 addition & 2 deletions distgen/config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import six
import copy

from distgen.err import fatal
Expand All @@ -11,7 +10,7 @@ def _merge_yaml(origin, override):
itself, otherwise recurse down for each item.
"""
if isinstance(origin, dict) and isinstance(override, dict):
for k, v in six.iteritems(override):
for k, _ in override.items():
if k in origin:
origin[k] = _merge_yaml(origin[k], override[k])
else:
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
distro
jinja2
six
pyyaml
setuptools
2 changes: 0 additions & 2 deletions rpm/distgen.spec.dg
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ BuildArch: noarch
Requires: %{pypkg}-jinja2
Requires: %{pypkg}-distro
Requires: %{meh_pypkg}PyYAML
Requires: %{pypkg}-six

BuildRequires: make
BuildRequires: %{pypkg}-devel
Expand All @@ -37,7 +36,6 @@ BuildRequires: %{pypkg}-pytest-catchlog
%endif
BuildRequires: %{meh_pypkg}PyYAML
BuildRequires: %{pypkg}-setuptools
BuildRequires: %{pypkg}-six

Source0: https://pypi.org/packages/source/d/%name/%name-%version.tar.gz

Expand Down
6 changes: 2 additions & 4 deletions tests/unittests/test_generator.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import io
import os

import pytest
import six

from distgen.commands import CommandsConfig
from distgen.generator import Generator
Expand Down Expand Up @@ -63,7 +63,7 @@ def test_load_project(self, project, result):
def test_render(self, project, template, max_passes, result):
# TODO: more test cases for rendering
self.g.load_project(project)
out = six.BytesIO()
out = io.BytesIO()
self.g.render(
[os.path.join(project, 'common.yaml')],
os.path.join(project, 'complex.yaml'),
Expand All @@ -75,6 +75,4 @@ def test_render(self, project, template, max_passes, result):
max_passes=max_passes,
)

if six.PY2:
result = result.decode('utf-8')
assert out.getvalue() == result

0 comments on commit b1d5e6a

Please sign in to comment.