Beispiel #1
0
    def run(self, args=None):
        if not args:
            args = sys.argv[1:]

        self.args = self.parser.parse_args(args)
        self.config = config.set_config()

        for config_fp in self.args.config:
            self.config.readfp(config_fp)

        if self.args.debug:
            logging.getRootLogger().setLevel(logging.DEBUG)

        engine = sqlalchemy.create_engine(config.get_config().main_sql,
                                          echo=True)
        self.session = sqlalchemy.orm.sessionmaker(bind=engine)()
        package.Base.metadata.create_all(engine)

        command = self.args.command.replace("-", "_")

        try:
            func = getattr(self, command)
        except AttributeError:
            logging.error("Couldn't find function to use: %s", command)
        else:
            func()
Beispiel #2
0
    def __init__(self):
        self.config = config.get_config()

        loader = jinja2.FileSystemLoader(self.config.templates_directory)
        template_env = jinja2.Environment(loader=loader)
        self.template = template_env.get_template(self.config.templates_mail)

        self.smtp = smtplib.SMTP(self.config.mail_server,
                                 self.config.mail_port)
Beispiel #3
0
def package_url(package):
    return url_join(config.get_config().main_url, 'pypi', package, 'json')