def mkrepo(name, dir, repo): loc = path.join(dir, name) # flags = darcs_version().startswith("2") and "--old-fashioned-inventory" or "" flags = "" # We will not create darcs-1 repos any more \o/ print "Creating new repository at: %s" % loc execute("darcs get %s --repodir %s" % (repo, loc)) deleteFolder(path.join(loc,"_darcs")) execute("darcs init %s --repodir %s" % (flags, loc))
def run_git_reop(repos): for p,r,b in repos: repoP = path.join(p,".git") if not path.isdir(repoP): print "Creating git repo" execute("git --git-dir=%s --work-tree=%s init" % (repoP,p)) execute("git --git-dir=%s --work-tree=%s pull %s %s" % (repoP,p,r,b))
def deps(): prepare() owd = os.getcwd() os.chdir(deps_dir) if not path.isfile(path.join(deps_dir, "Makefile")): execute("cmake -DDEPS=true ../") sys_exec_make("all") os.chdir(owd)
def etags(): """ etags -- generate build/TAGS file for emacs (*nix only) """ prepare() execute("find src extensions projects \ \\( -name *.h -o -name *.cpp \\) \ -not -path */_darcs/* \ | xargs etags -o %s/TAGS" % (build_dir))
def run_repo(repos): """ fetch/update repositories """ for p,r in repos: if path.isdir(path.join(p, "_darcs")): cmd = "pull" else: cmd = "get" print "Updating %s from %s" % (relpath(p), r) execute("darcs %s %s --repodir %s" % (cmd, r, p))
def run_git_repo(repos): for p, r, b in repos: if not os.path.exists(p): os.mkdir(p) print (p) repoP = path.join(p, ".git") if not path.isdir(repoP): print "Creating git repo" execute("git --git-dir=%s --work-tree=%s init" % (repoP, p)) execute("git --git-dir=%s --work-tree=%s pull %s %s" % (repoP, p, r, b))
def commit_repo(user, repos): """ push changes to repositories """ if system("win"): user = get_windows_username(); else: if user: user = user + "@" else: user = "" for p,r in repos: print "Commiting %s to %s" % (relpath(p), r) execute("darcs push %s%s --repodir %s" % (user, r, p))
def darcs(*args): """ darcs <cmd> -- run darcs command on all extensions, projects and openengine """ cmd = " ".join(args) ds = [path.join("extensions", e) for e in os.listdir("extensions")] + \ [path.join("projects", p) for p in os.listdir("projects")] print "**** OpenEngine" try: execute("darcs %s --repodir %s" % (cmd, ".")) except ExecError: pass for d in ds: if path.isdir(path.join(d, "_darcs")): print "**** %s" % d try: execute("darcs %s --repodir %s" % (cmd, d)) except ExecError: pass
def deps(): """ deps -- compile dependency libraries """ prepare() owd = os.getcwd() os.chdir(deps_dir) if not path.isfile(path.join(deps_dir, "Makefile")): if system("win"): execute("cmake -DDEPS=true -G \"MinGW Makefiles\" ../") else: execute("cmake -DDEPS=true ../") sys_exec_make("all") sys_exec_make("install") os.chdir(owd)
def commit_git_repo(user, repos): for p,r,b in repos: print "Commiting %s to %s (%s)" % (relpath(p), r, b) repoP = path.join(p, ".git") execute("git --git-dir=%s --work-tree=%s push %s %s" % (repoP,p,r,b))
def run(self): execute("darcs push %s%s --repodir %s" % (self.user, self.r, self.p))
def run(self): execute("darcs %s %s --repodir %s" % (self.cmd, self.r, self.p))
def sys_exec_make(target): if system("win"): execute("mingw32-make --jobs %s" % (target)) else: execute("make --jobs %d %s" % (cores()+1, target))
def sys_exec_cmake(): if system("win"): execute("cmake -G \"MinGW Makefiles\" ../") else: execute("cmake ../")