# Path: pyp2rpm/utils.py
# PY3 = sys.version > '3'
# class ChangeDir(object):
#     def __init__(self, new_path):
#     def __enter__(self):
#     def __exit__(self, type, value, traceback):  # TODO handle exception
# def memoize_by_args(func):
#     def memoized(*args):
# def build_srpm(specfile, save_dir):
# def remove_major_minor_suffix(scripts):
# def runtime_to_build(runtime_deps):
# def unique_deps(deps):
#     def console_to_str(s):
#     def console_to_str(s):
# def c_time_locale():
# def rpm_eval(macro):
# def get_default_save_path():


import json
import locale
import logging
import os
import re
import sre_constants
import sys
from zipfile import ZipFile, ZipInfo
from tarfile import TarFile, TarInfo
from pyp2rpm import utils

    def close(self):
        if self.handle:
            self.handle.close()

    def __enter__(self):
        return self.open()

    def __exit__(self, type, value, traceback):  # TODO: handle exceptions here
        self.close()

    @property
    def extractor_cls(self):
        """Returns the class that can read this archive based on archive suffix.
        Returns:
            Class that can read this archive or None if no such exists.
        """
        file_cls = None

        # only catches ".gz", even from ".tar.gz"
        if self.is_tar:
            file_cls = TarFile
        elif self.is_zip:
            file_cls = ZipFile
        else:
            logger.info("Couldn't recognize archive suffix: {0}.".format(
                self.suffix))

        return file_cls


# Path: pyp2rpm/utils.py
# PY3 = sys.version > '3'
# class ChangeDir(object):
#     def __init__(self, new_path):
#     def __enter__(self):
#     def __exit__(self, type, value, traceback):  # TODO handle exception
# def memoize_by_args(func):
#     def memoized(*args):
# def build_srpm(specfile, save_dir):
# def remove_major_minor_suffix(scripts):
# def runtime_to_build(runtime_deps):
# def unique_deps(deps):
#     def console_to_str(s):
#     def console_to_str(s):
# def c_time_locale():
# def rpm_eval(macro):
# def get_default_save_path():


# Path: pyp2rpm/archive.py
import json
import locale
import logging
import os
import re
import sre_constants
import sys
from zipfile import ZipFile, ZipInfo
from tarfile import TarFile, TarInfo
from pyp2rpm import utils


    def close(self):
        if self.handle:
            self.handle.close()

    def __enter__(self):
        return self.open()

    def __exit__(self, type, value, traceback):  # TODO: handle exceptions here
        self.close()

    @property
    def extractor_cls(self):
        """Returns the class that can read this archive based on archive suffix.
        Returns:
            Class that can read this archive or None if no such exists.
        """
        file_cls = None

        # only catches ".gz", even from ".tar.gz"
        if self.is_tar:
            file_cls = TarFile
        elif self.is_zip:
            file_cls = ZipFile
        else:
            logger.info("Couldn't recognize archive suffix: {0}.".format(
                self.suffix))

        return file_cls


    @utils.memoize_by_args