# Path: pyp2rpm/exceptions.py
# class VirtualenvFailException(BaseException):
#     pass
# 
# Path: pyp2rpm/settings.py
# DEFAULT_PYTHON_VERSION = DEFAULT_PYTHON_VERSIONS[DEFAULT_TEMPLATE][0]
# 
# MODULE_SUFFIXES = ('.py', '.pyc')


import os
import glob
import logging
import pprint
import virtualenvapi.exceptions as ve
from virtualenvapi.manage import VirtualEnvironment
from pyp2rpm.exceptions import VirtualenvFailException
from pyp2rpm.settings import DEFAULT_PYTHON_VERSION, MODULE_SUFFIXES
    def __init__(self, name, temp_dir, name_convertor,
                 base_python_version):
        self.name = name
        self.temp_dir = temp_dir
        self.name_convertor = name_convertor
        if not base_python_version:
            base_python_version = DEFAULT_PYTHON_VERSION
        python_version = 'python' + base_python_version
        self.env = VirtualEnvironment(temp_dir + '/venv',
                                      python=python_version)
        try:
            self.env.open_or_create()
        except (ve.VirtualenvCreationException,
                ve.VirtualenvReadonlyException):
            raise VirtualenvFailException('Failed to create virtualenv')
        self.dirs_before_install = DirsContent()
        self.dirs_after_install = DirsContent()
        self.dirs_before_install.fill(temp_dir + '/venv/')
        self.data = {}

    def install_package_to_venv(self):
        '''
        Installs package given as first argument to virtualenv without
        dependencies
        '''
        try:
            self.env.install((self.name,), force=True,
                             options=["--no-deps"])
        except (ve.PackageInstallationException,
                ve.VirtualenvReadonlyException):

# Path: pyp2rpm/exceptions.py
# class VirtualenvFailException(BaseException):
#     pass
# 
# Path: pyp2rpm/settings.py
# DEFAULT_PYTHON_VERSION = DEFAULT_PYTHON_VERSIONS[DEFAULT_TEMPLATE][0]
# 
# MODULE_SUFFIXES = ('.py', '.pyc')


# Path: pyp2rpm/virtualenv.py
import os
import glob
import logging
import pprint
import virtualenvapi.exceptions as ve
from virtualenvapi.manage import VirtualEnvironment
from pyp2rpm.exceptions import VirtualenvFailException
from pyp2rpm.settings import DEFAULT_PYTHON_VERSION, MODULE_SUFFIXES

    def __init__(self, name, temp_dir, name_convertor,
                 base_python_version):
        self.name = name
        self.temp_dir = temp_dir
        self.name_convertor = name_convertor
        if not base_python_version:
            base_python_version = DEFAULT_PYTHON_VERSION
        python_version = 'python' + base_python_version
        self.env = VirtualEnvironment(temp_dir + '/venv',
                                      python=python_version)
        try:
            self.env.open_or_create()
        except (ve.VirtualenvCreationException,
                ve.VirtualenvReadonlyException):
            raise VirtualenvFailException('Failed to create virtualenv')
        self.dirs_before_install = DirsContent()
        self.dirs_after_install = DirsContent()
        self.dirs_before_install.fill(temp_dir + '/venv/')
        self.data = {}

    def install_package_to_venv(self):
        '''
        Installs package given as first argument to virtualenv without
        dependencies
        '''
        try:
            self.env.install((self.name,), force=True,
                             options=["--no-deps"])
        except (ve.PackageInstallationException,
                ve.VirtualenvReadonlyException):

            raise VirtualenvFailException(