def createsetuppy(gituser, gitmail, reponame, projectShortDescription,
                  projectDescription):
    template = read_string_from_file("setup.py.template", "")
    template = template.replace("${gituser}", gituser)
    template = template.replace("${gitmail}", gitmail)
    template = template.replace("${reponame}", reponame)
    template = template.replace("${projectDescription}", projectDescription)
    template = template.replace("${projectShortDescription}",
                                projectShortDescription)
    return template
Exemple #2
0
    dburl = get_lichess_db_url(variant, dbname)
    dbpath = os.path.join(zip_path(env), dbname)
    print("retrieving {}".format(dbname))
    store_url(dburl, dbpath)

if args.unzip or args.all:
    assert_env()
    for name in os.listdir(zip_path(env)):
        zippath = os.path.join(zip_path(env), name)
        sourcepath = os.path.join(source_path(env), name + ".pgn")
        unzip(zippath, sourcepath, get_force("unzip"))

if args.filter or args.all:
    assert_env()
    filter_logic_path = os.path.join(env_path(env), "filter_logic.py")
    filter_logic = read_string_from_file(filter_logic_path, "")
    for name in os.listdir(source_path(env)):
        pgnpath = os.path.join(source_path(env), name)
        filteredpath = os.path.join(filtered_path(env), name)
        if (not os.path.isfile(filteredpath)) or get_force("filter"):
            visitor = FilterVisitor(open(filteredpath, "w"), filter_logic)
            visit_pgn_file(pgnpath, visitor)
            pass

if args.build or args.all:
    assert_env()
    for name in os.listdir(filtered_path(env)):
        filteredpath = os.path.join(filtered_path(env), name)
        bookpath = os.path.join(book_path(env), name) + ".bin"
        if (not os.path.isfile(bookpath)) or get_force("build"):
            build_book_file(filteredpath, bookpath)
def createtravistest(reponame):
    template = read_string_from_file("travistest.template", "")
    template = template.replace("${reponame}", reponame)
    return template
def createmetayaml(gituser, reponame):
    template = read_string_from_file("meta.yaml.template", "")
    template = template.replace("${gituser}", gituser)
    template = template.replace("${reponame}", reponame)
    return template
def creategitignore(reponame):
    template = read_string_from_file("gitignore.template", "")
    template = template.replace("${reponame}", reponame)
    return template
def createreadme(title, description):
    template = read_string_from_file("README.md.template", "")
    template = template.replace("${title}", title)
    template = template.replace("${description}", description)
    return template
def creategitconfig(gituser, gitmail, reponame):
    template = read_string_from_file("configtemplate", "")
    template = template.replace("${gituser}", gituser)
    template = template.replace("${gitmail}", gitmail)
    template = template.replace("${reponame}", reponame)
    return template
parser.add_argument('--force', action="store_true", help='force')

args = parser.parse_args()

###################################################

print(args)

if args.create:
    reponame = args.create
    print("creating {} as {}".format(reponame, repopath()))
    if args.force:
        rmtree(repopath())
    create_dir(repopath())
    write_string_to_file(repoconfigpath(),
                         read_string_from_file("repotemplate.json", "{}"),
                         force=args.force)

if args.populate:
    reponame = args.populate
    if args.force:
        print("removing .git")
        rmtree(repofilepath(".git"))
    subprocess.Popen(["git", "init"], cwd=str(Path(repopath()))).wait()
    configjson = readrepoconfigjson()
    gituser = configjson["gituser"]
    gitpass = configjson["gitpass"]
    gitmail = configjson["gitmail"]
    project = configjson["project"]
    projectTitle = project["title"]
    projectDescription = project["description"]