示例#1
0
    def _search_patch_plugins(self, argparser, parent_parser,
                              patch_function_wrapper):
        plugin_dirs = PDTFileLocations.get_plugin_locations()

        self.simplePluginManager = yapsy.PluginManager.PluginManager()
        self.simplePluginManager.setPluginPlaces(plugin_dirs)
        self.simplePluginManager.collectPlugins()

         # Loop round the plugins and print their names.
        for plugin in self.simplePluginManager.getAllPlugins():
            print "Found plugin: ", plugin.plugin_object.plugin_name()

            # Hook the plugin into the menu system:
            plugin.plugin_object.build_arg_parser(argparser=argparser,
                    parent_parser=parent_parser,
                    action_wrapper=patch_function_wrapper)
示例#2
0
    def load_rc_file(cls):
        pdtrcdata = configobj.ConfigObj(infile=cls._pdtrc)


        if not pdtrcdata:
            err =  "Nothing defined in %s\n" % (PDTFileLocations.get_rc_file(),)
            err += "Try adding:\n"
            raise RuntimeError(err)

        # Default profile names:
        if 'default_targets' in pdtrcdata:
            cls.default_targets = pdtrcdata['default_targets']

        if 'profile_groups' in pdtrcdata:
            cls.profile_groups = pdtrcdata['profile_groups']

        # Load the profiles:
        if not 'profiles' in pdtrcdata:
            raise RuntimeError('No-profiles defined in %s' % cls._pdtrc)
        for (profile_name, profile_data) in pdtrcdata['profiles'
                ].iteritems():
            cls.profiles[profile_name] = PDTProfile(profile_name,
                    profile_data)
#!/usr/bin/python
# -*- coding: utf-8 -*-

from sqlalchemy import create_engine, ForeignKey
from sqlalchemy import Column, Date, Integer,  Unicode
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship


from sqlalchemy.orm import sessionmaker

from pdt.filelocations import PDTFileLocations



engine = create_engine(PDTFileLocations.get_patch_sqlalchemy_url(),
                       echo=True)
Base = declarative_base()


class Patch(Base):

    """"""

    __tablename__ = 'patches'

    id = Column(Integer, primary_key=True)
    target_filename = Column(Unicode)
    patch_data = Column(Unicode)
    patch_set = Column(Integer, ForeignKey('patchsets.id'))