Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop the dependency on six #150

Merged
merged 1 commit into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.keys():
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
Loading