def get_help(pkg): global suppress_notfound_err try: pkg_base_path = dc.get_base_path(pkg) except Exception: if not suppress_notfound_err: sys.stderr.write("Package not found: '" + pkg + "'\n") sys.exit(1) yaml_file = pkg_base_path + "/package.yaml" try: metadict = yaml.load(open(yaml_file).read()) except Exception: return (pkg_base_path, pkg_base_path, None) pkg_path = pkg_base_path if "variants" in metadict: # just pick first variant, they should all have the same copy of docs... v0 = metadict["variants"][0] pkg_path = os.path.join(pkg_path, *v0) return (pkg_base_path, pkg_path, metadict.get("help"), metadict.get("description"))
def get_help(pkg): global suppress_notfound_err try: pkg_base_path = dc.get_base_path(pkg) except Exception: if not suppress_notfound_err: sys.stderr.write("Package not found: '" + pkg + "'\n") sys.exit(1) yaml_file = pkg_base_path + "/package.yaml" try: metadict = yaml.load(open(yaml_file).read()) except Exception: return (pkg_base_path, None) if "help" not in metadict: return (pkg_base_path, None) return (pkg_base_path, metadict["help"])
#!!REZ_PYTHON_BINARY! import sys import rez_config as rc pkg = sys.argv[1] try: print rc.get_base_path(pkg) except Exception: print "package not found: '" + pkg + "'" sys.exit(1) # Copyright 2008-2012 Dr D Studios Pty Limited (ACN 127 184 954) (Dr. D Studios) # # This file is part of Rez. # # Rez is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Rez is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with Rez. If not, see <http://www.gnu.org/licenses/>.
def print_altered_packages(pkgs, are_updated): global rowcolindex3 if len(pkgs) > 0: print big_line_sep if are_updated: tok = "updated packages:" else: tok = "rolled-back packages:" if opts.html: print '<tr><td align="center"><font size="2">' + tok + '</font></td><td>' print '<table border="0">' rowcolindex = 0 else: print tok for pkg in pkgs: print small_line_sep if opts.html: print '<tr><td bgcolor=#' + rowcols3[rowcolindex3] + '>' print '<table cellspacing="5" border="0"><tr><td align="center"><font size=2>' rowcolindex3 = 1 - rowcolindex3 path = pkg[1].rsplit("/",1)[0] fam = pkg[0] oldverstr = pkg[1].rsplit("/",1)[-1] newverstr = pkg[2].rsplit("/",1)[-1] oldver = dc.Version(oldverstr) newver = dc.Version(newverstr) if are_updated: print fam + br + " [" + str(oldver) + " -> " + str(newver) + "]" else: print fam + br + " [" + str(newver) + " -> " + str(oldver) + "]" if opts.html: print '</font></td></tr></table></td><td width="100%"><table border="0" bgcolor=#' + \ table_bgcolor + ' cellpadding="0" cellspacing="1" width="100%">' # list all changelogs between versions pkgpath = dc.get_base_path(fam + "-" + str(newver)) currver = dc.Version(pkgpath.rsplit("/",1)[-1]) while currver > oldver: if opts.html: rowcolindex = 1 - rowcolindex print '<tr bgcolor=#' + rowcols[rowcolindex] + \ '><td align="center" width="5%"><font size=2> ' + str(currver) + " </font></td><td>" else: print "\n" + fam + "-" + str(currver) + ":" chlogpath = pkgpath + "/.metadata/changelog.txt" if os.path.isfile(chlogpath): f = open(chlogpath) chlog = '\t' + f.read().strip().replace('\n', '\n\t') if opts.html: lines = chlog.split('\n') lines2 = [] prev_row = False rowcolindex2 = 0 td_cols = rowcols2[rowcolindex] for l in lines: l2 = l.strip() if len(l2) > 0: if l2.find("-----------------") == -1: if l2.find("Changelog since rev") == 0: l2 = "<tr><td bgcolor=#" + td_cols[rowcolindex2] + \ "><font size=1>" + l2 + "</font></td></tr>" else: is_rev_line = False if l2[0] == 'r': toks = l2.split(' ') if ((toks[-1] == "lines") or (toks[-1] == "line")) and ("|" in toks): l2 = "<tr><td bgcolor=#" + td_cols[rowcolindex2] + "><font size=2><i>" + l2 + "</i>" rowcolindex2 = 1 - rowcolindex2 if prev_row: l2 = "</font></td></tr>" + l2 prev_row = True is_rev_line = True if not is_rev_line: l2 = "<br>" + l2 lines2.append(l2) chlog = str('\n').join(lines2) chlog = '<table border="0" cellpadding="5" cellspacing="1" width="100%">' + chlog + '</table>' f.close() print chlog else: if opts.html: print '<table cellspacing="1"><tr><td><font size=2> ' print "\tno changelog available." if opts.html: print "</td></tr></table></font>" if opts.html: print "</td></tr>" pkgpath = dc.get_base_path(fam + "-0+<" + str(currver)) currver = dc.Version(pkgpath.rsplit("/",1)[-1]) if opts.html: print "</table></td></tr>" print "<tr><td></td><td></td></tr>" if opts.html: print "</table></td></tr>"
fams = set(old_pkgs.keys()) - set(new_pkgs.keys()) for fam in fams: removed_pkgs.append(old_pkgs[fam]) # added packages added_pkgs = [] fams = set(new_pkgs.keys()) - set(old_pkgs.keys()) for fam in fams: added_pkgs.append(new_pkgs[fam]) # altered packages updated_pkgs = [] rolledback_pkgs = [] fams = set(new_pkgs.keys()) & set(old_pkgs.keys()) for fam in fams: old_path = dc.get_base_path(old_pkgs[fam]) new_path = dc.get_base_path(new_pkgs[fam]) if old_path != new_path: oldverstr = old_path.rsplit("/",1)[-1] newverstr = new_path.rsplit("/",1)[-1] oldver = dc.Version(oldverstr) newver = dc.Version(newverstr) if oldver < newver: updated_pkgs.append( (fam, old_path, new_path) ) else: rolledback_pkgs.append( (fam, new_path, old_path) ) ######################################################################################### # generate output #########################################################################################
(opts, args) = p.parse_args() if len(args) == 1: pkg = args[0] else: p.error("incorrect number of arguments") ########################################################################################## # find pkg and load metadata ########################################################################################## # attempt to load the latest fam = pkg.split("=")[0].split("-", 1)[0] try: pkg_base_path = dc.get_base_path(pkg) except Exception: sys.stderr.write("Package not found: '" + pkg + "'\n") sys.exit(1) print print "info @ " + pkg_base_path + ":" try: pkg_info = open(pkg_base_path + "/.metadata/info.txt").readlines() except Exception: pkg_info = None if pkg_info: yaml_file = pkg_base_path + "/package.yaml"
def print_altered_packages(pkgs, are_updated): global rowcolindex3 if len(pkgs) > 0: print big_line_sep if are_updated: tok = "updated packages:" else: tok = "rolled-back packages:" if opts.html: print '<tr><td align="center"><font size="2">' + tok + '</font></td><td>' print '<table border="0">' rowcolindex = 0 else: print tok for pkg in pkgs: print small_line_sep if opts.html: print '<tr><td bgcolor=#' + rowcols3[rowcolindex3] + '>' print '<table cellspacing="5" border="0"><tr><td align="center"><font size=2>' rowcolindex3 = 1 - rowcolindex3 path = pkg[1].rsplit("/", 1)[0] fam = pkg[0] oldverstr = pkg[1].rsplit("/", 1)[-1] newverstr = pkg[2].rsplit("/", 1)[-1] oldver = dc.Version(oldverstr) newver = dc.Version(newverstr) if are_updated: print fam + br + " [" + str(oldver) + " -> " + str( newver) + "]" else: print fam + br + " [" + str(newver) + " -> " + str( oldver) + "]" if opts.html: print '</font></td></tr></table></td><td width="100%"><table border="0" bgcolor=#' + \ table_bgcolor + ' cellpadding="0" cellspacing="1" width="100%">' # list all changelogs between versions pkgpath = dc.get_base_path(fam + "-" + str(newver)) currver = dc.Version(pkgpath.rsplit("/", 1)[-1]) while currver > oldver: if opts.html: rowcolindex = 1 - rowcolindex print '<tr bgcolor=#' + rowcols[rowcolindex] + \ '><td align="center" width="5%"><font size=2> ' + str(currver) + " </font></td><td>" else: print "\n" + fam + "-" + str(currver) + ":" chlogpath = pkgpath + "/.metadata/changelog.txt" if os.path.isfile(chlogpath): f = open(chlogpath) chlog = '\t' + f.read().strip().replace('\n', '\n\t') if opts.html: lines = chlog.split('\n') lines2 = [] prev_row = False rowcolindex2 = 0 td_cols = rowcols2[rowcolindex] for l in lines: l2 = l.strip() if len(l2) > 0: if l2.find("-----------------") == -1: if l2.find("Changelog since rev") == 0: l2 = "<tr><td bgcolor=#" + td_cols[rowcolindex2] + \ "><font size=1>" + l2 + "</font></td></tr>" else: is_rev_line = False if l2[0] == 'r': toks = l2.split(' ') if ((toks[-1] == "lines") or (toks[-1] == "line")) and ("|" in toks): l2 = "<tr><td bgcolor=#" + td_cols[ rowcolindex2] + "><font size=2><i>" + l2 + "</i>" rowcolindex2 = 1 - rowcolindex2 if prev_row: l2 = "</font></td></tr>" + l2 prev_row = True is_rev_line = True if not is_rev_line: l2 = "<br>" + l2 lines2.append(l2) chlog = str('\n').join(lines2) chlog = '<table border="0" cellpadding="5" cellspacing="1" width="100%">' + chlog + '</table>' f.close() print chlog else: if opts.html: print '<table cellspacing="1"><tr><td><font size=2> ' print "\tno changelog available." if opts.html: print "</td></tr></table></font>" if opts.html: print "</td></tr>" pkgpath = dc.get_base_path(fam + "-0+<" + str(currver)) currver = dc.Version(pkgpath.rsplit("/", 1)[-1]) if opts.html: print "</table></td></tr>" print "<tr><td></td><td></td></tr>" if opts.html: print "</table></td></tr>"
fams = set(old_pkgs.keys()) - set(new_pkgs.keys()) for fam in fams: removed_pkgs.append(old_pkgs[fam]) # added packages added_pkgs = [] fams = set(new_pkgs.keys()) - set(old_pkgs.keys()) for fam in fams: added_pkgs.append(new_pkgs[fam]) # altered packages updated_pkgs = [] rolledback_pkgs = [] fams = set(new_pkgs.keys()) & set(old_pkgs.keys()) for fam in fams: old_path = dc.get_base_path(old_pkgs[fam]) new_path = dc.get_base_path(new_pkgs[fam]) if old_path != new_path: oldverstr = old_path.rsplit("/", 1)[-1] newverstr = new_path.rsplit("/", 1)[-1] oldver = dc.Version(oldverstr) newver = dc.Version(newverstr) if oldver < newver: updated_pkgs.append((fam, old_path, new_path)) else: rolledback_pkgs.append((fam, new_path, old_path)) ######################################################################################### # generate output #########################################################################################
(opts, args) = p.parse_args() if len(args) == 1: pkg = args[0] else: p.error("incorrect number of arguments") ########################################################################################## # find pkg and load metadata ########################################################################################## # attempt to load the latest fam = pkg.split("=")[0].split("-", 1)[0] try: pkg_base_path = dc.get_base_path(pkg) except Exception: sys.stderr.write("Package not found: '" + pkg + "'\n") sys.exit(1) print print "info @ " + pkg_base_path + ":" try: pkg_info = open(pkg_base_path + "/.metadata/info.txt").readlines() except Exception: pkg_info = None if (pkg_info): yaml_file = pkg_base_path + "/package.yaml" try: