Beispiel #1
0
 def get_dirs_differance(self):
     '''
     Makes final versions of site_packages and scripts using DirsContent
     sub method and filters
     '''
     try:
         diff = self.dirs_after_install - self.dirs_before_install
     except ValueError:
         raise VirtualenvFailException(
             "Some of the DirsContent attributes is uninicialized")
     site_packages = site_packages_filter(diff.lib_sitepackages)
     packages = set(
         [p for p in site_packages if not self.modul_pattern.search(p)])
     py_modules = set(
         [os.path.splitext(m)[0] for m in site_packages - packages])
     scripts = scripts_filter(list(diff.bindir))
     logger.debug(
         'Packages from files differance in virtualenv: {0}.'.format(
             packages))
     logger.debug(
         'py_modules from files differance in virtualenv: {0}.'.format(
             py_modules))
     logger.debug(
         'Scripts from files differance in virtualenv: {0}.'.format(
             scripts))
     return (packages, py_modules, scripts)
Beispiel #2
0
 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(
             'Failed to install package to virtualenv')
     self.dirs_after_install.fill(self.temp_dir + '/venv/')
Beispiel #3
0
 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 = {}
Beispiel #4
0
 def get_dirs_differance(self):
     '''
     Makes final versions of site_packages and scripts using DirsContent
     sub method and filters
     '''
     try:
         diff = self.dirs_after_install - self.dirs_before_install
     except ValueError:
         raise VirtualenvFailException(
             "Some of the DirsContent attributes is uninicialized")
     site_packages = site_packages_filter(diff.lib_sitepackages)
     logger.debug(
         'Site_packages from files differance in virtualenv: {0}.'.format(
             site_packages))
     scripts = scripts_filter(list(diff.bindir))
     logger.debug(
         'Scripts from files differance in virtualenv: {0}.'.format(
             scripts))
     return (site_packages, scripts)
Beispiel #5
0
    def get_dirs_differance(self):
        '''
        Makes final versions of site_packages and scripts using DirsContent
        sub method and filters
        '''
        try:
            diff = self.dirs_after_install - self.dirs_before_install
        except ValueError:
            raise VirtualenvFailException(
                "Some of the DirsContent attributes is uninicialized")
        self.data['has_pth'] = \
            any([x for x in diff.lib_sitepackages if x.endswith('.pth')])

        site_packages = site_packages_filter(diff.lib_sitepackages)
        self.data['packages'] = sorted(
            [p for p in site_packages if not p.endswith(MODULE_SUFFIXES)])
        self.data['py_modules'] = sorted(
            set([
                os.path.splitext(m)[0]
                for m in site_packages - set(self.data['packages'])
            ]))
        self.data['scripts'] = scripts_filter(sorted(diff.bindir))
        logger.debug('Data from files differance in virtualenv:')
        logger.debug(pprint.pformat(self.data))