コード例 #1
0
ファイル: test_basic.py プロジェクト: vbatts/texscythe
    def setup_class(self):
        self.config = {
            "sqldb"             : os.path.join(DIRPATH, "basic.db"),
            "plist"             : os.path.join(DIRPATH, "PLIST-basic"),
            "prefix_filenames"  : "",
            "tlpdb"             : os.path.join(DIRPATH, "basic.tlpdb"),
            "arch"              : None,
        }

        self.sess = tlpdbparser.initdb(self.config, return_sess=True)
コード例 #2
0
ファイル: orm.py プロジェクト: vext01/texscythe
def init_orm(cfg, force_create=False):
    """Set up ORM.
    SQL database is created and populated if non-existent or out of date.
    """

    # Check existence and mtime *before* opening connection.
    create, update = check_sqldb(cfg)
    if force_create:
        create = True

    engine = create_engine('sqlite:///%s' % (cfg.sqldb,))
    sess = sessionmaker(bind=engine)()

    if create:
        print("SQL database non-existent. Initialising...")
    elif update:
        print("SQL database out of date. Re-initialising...")

    if create or update:
        from tlpdbparser import initdb
        initdb(cfg, sess, engine)

    return sess
コード例 #3
0
ファイル: texscythe.py プロジェクト: vbatts/texscythe
    if args.sqldb is not None:
        config["sqldb"] = args.sqldb
    if args.prefix_filenames is not None:
        config["prefix_filenames"] = args.prefix_filenames
    if args.output_plist is not None:
        config["plist"] = args.output_plist
    if args.tlpdb is not None:
        config["tlpdb"] = args.tlpdb
    if args.arch is not None:
        config["arch"] = args.arch

    if not args.version:
        print_version()
        print("\nRunning with configuration:")
        for k in config.iterkeys():
            print("    %s: %s" % (k.ljust(25), config[k]))
        print("")

    # primary tasks
    if args.subset:
        import subset
        subset.compute_subset(config, args.include, args.exclude)
    elif args.initdb:
        import tlpdbparser
        tlpdbparser.initdb(config)
    elif args.version:
        print_version()
    else:
        assert False # should not happen