From 0420de99a0013628e6a23272a91b273692bfea44 Mon Sep 17 00:00:00 2001 From: nerdvegas Date: Thu, 10 Feb 2022 15:39:52 +1100 Subject: [PATCH 1/6] simplifying wiki update script --- .github/workflows/wiki.yaml | 10 ++-- wiki/pages/_Command-Line-Tools.md | 4 +- wiki/update-wiki.py | 88 +++++++------------------------ 3 files changed, 24 insertions(+), 78 deletions(-) diff --git a/.github/workflows/wiki.yaml b/.github/workflows/wiki.yaml index a683aa8a7..445ec9e35 100644 --- a/.github/workflows/wiki.yaml +++ b/.github/workflows/wiki.yaml @@ -14,8 +14,6 @@ jobs: build: name: Build Wiki Artifact runs-on: ubuntu-latest - env: - TEMP_WIKI_DIR: "wiki/.rez-gen-wiki-tmp" steps: - uses: actions/checkout@v2 @@ -32,16 +30,14 @@ jobs: rezver=$(cat ./src/rez/utils/_version.py | grep -w _rez_version | tr '"' ' ' | awk '{print $NF}') python update-wiki.py \ - --keep-temp \ - --no-push \ --github-release=${rezver} \ - --wiki-dir="${{ github.workspace }}"/"${{ env.TEMP_WIKI_DIR }}" \ - --wiki-url="${{ env.CLONE_URL }}" + --wiki-url="${{ env.CLONE_URL }}" \ + --out="${{ github.workspace }}"/out - uses: actions/upload-artifact@v2 with: name: wiki-markdown - path: ${{ env.TEMP_WIKI_DIR }} + path: out publish: name: Publish to GitHub Wiki diff --git a/wiki/pages/_Command-Line-Tools.md b/wiki/pages/_Command-Line-Tools.md index e268e0a0b..434525e91 100644 --- a/wiki/pages/_Command-Line-Tools.md +++ b/wiki/pages/_Command-Line-Tools.md @@ -1,3 +1 @@ -Auto-generated from __WIKI_PY_URL__ - -__GENERATED_MD__ \ No newline at end of file +__GENERATED_MD__ diff --git a/wiki/update-wiki.py b/wiki/update-wiki.py index fe40f48ec..7ee23ec59 100644 --- a/wiki/update-wiki.py +++ b/wiki/update-wiki.py @@ -27,7 +27,6 @@ from collections import defaultdict import errno from io import open -import inspect import os import re import subprocess @@ -35,12 +34,17 @@ import sys +# py3.7+ only +if sys.version_info[:2] < (3, 7): + print("update-wiki.py: ust use python-3.7 or greater", file=sys.stderr) + sys.exit(1) + + THIS_FILE = os.path.abspath(__file__) THIS_DIR = os.path.dirname(THIS_FILE) REZ_SOURCE_DIR = os.getenv("REZ_SOURCE_DIR", os.path.dirname(THIS_DIR)) -TMP_NAME = ".rez-gen-wiki-tmp" # See also: .gitignore -TEMP_WIKI_DIR = os.getenv("TEMP_WIKI_DIR", os.path.join(THIS_DIR, TMP_NAME)) +OUT_DIR = "out" GITHUB_RELEASE = os.getenv("GITHUB_REF", "Unknown") GITHUB_REPO = os.getenv("GITHUB_REPOSITORY", "nerdvegas/rez") GITHUB_BRANCH = os.getenv("GITHUB_BRANCH", "master") @@ -453,7 +457,7 @@ def process_markdown_files(): def do_replace(filename, token_md): srcfile = os.path.join(pagespath, "_%s.md" % filename) - destfile = os.path.join(TEMP_WIKI_DIR, "%s.md" % filename) + destfile = os.path.join(OUT_DIR, "%s.md" % filename) # with open(srcfile) as f: with open(srcfile, encoding='utf-8') as f: @@ -488,8 +492,7 @@ def do_replace(filename, token_md): do_replace( "Command-Line-Tools", { - "__GENERATED_MD__": make_cli_markdown(src_path), - "__WIKI_PY_URL__": make_cli_source_link(), + "__GENERATED_MD__": make_cli_markdown(src_path) } ) @@ -525,7 +528,7 @@ def do_replace(filename, token_md): print("Processing ", name, "...", sep="") src = os.path.join(pagespath, name) - dest = os.path.join(TEMP_WIKI_DIR, name) + dest = os.path.join(OUT_DIR, name) if name in no_toc: shutil.copyfile(src, dest) @@ -542,28 +545,6 @@ def do_replace(filename, token_md): # Command-Line-Tools.md functions and formatter classes ################################################################################ -def make_cli_source_link(): - """Create a markdown link to ``make_cli_markdown`` function on GitHub. - - Returns: - str: Formatted link to ``make_cli_markdown`` function on GitHub. - """ - link = ( - "[`{path}:{func.__name__}()`]" - "(https://github.com/{repo}/blob/{branch}/{path}#L{start}-L{end})" - ) - - lines, start = inspect.getsourcelines(make_cli_markdown) - return link.format( - func=make_cli_markdown, - path=os.path.relpath(THIS_FILE, REZ_SOURCE_DIR), - repo=GITHUB_REPO, - branch=GITHUB_BRANCH, - start=start, - end=start + len(lines), - ) - - def make_cli_markdown(src_path): """Generate the formatted markdown for each rez cli tool. @@ -728,18 +709,6 @@ def __init__(self, **kwargs): "Overrides environment variable GITHUB_REF." ) ) - self.add_argument( - "--no-push", - action="store_false", - dest="push", - help="Don't git commit and push new changes.", - ) - self.add_argument( - "--keep-temp", - action="store_true", - dest="keep", - help="Don't remove temporary wiki repository directory.", - ) self.add_argument( "--github-repo", default=GITHUB_REPO, @@ -777,13 +746,10 @@ def __init__(self, **kwargs): ) ) self.add_argument( - "--wiki-dir", - default=TEMP_WIKI_DIR, + "--out", + default="out", dest="dir", - help=( - "Use this EMPTY directory to temporarily store cloned wiki. " - "Overrides environment variable TEMP_WIKI_DIR." - ) + help="Output dir" ) @@ -802,34 +768,20 @@ def __init__(self, **kwargs): GITHUB_REPO = args.repo GITHUB_BRANCH = args.branch GITHUB_WORKFLOW = args.workflow - TEMP_WIKI_DIR = os.path.abspath(args.dir) - if not os.path.exists(TEMP_WIKI_DIR): - os.makedirs(TEMP_WIKI_DIR) + OUT_DIR = os.path.abspath(args.dir) + + if not os.path.exists(OUT_DIR): + os.makedirs(OUT_DIR) subprocess.check_call( - ["git", "clone", "--no-checkout", CLONE_URL, TEMP_WIKI_DIR] + ["git", "clone", "--no-checkout", CLONE_URL, OUT_DIR] ) shutil.copytree( os.path.join(THIS_DIR, 'media'), - os.path.join(TEMP_WIKI_DIR, 'media'), + os.path.join(OUT_DIR, 'media'), ) os.environ['REZ_SOURCE_DIR'] = REZ_SOURCE_DIR # python utils/process.py # Replaced by... - os.chdir(TEMP_WIKI_DIR) + os.chdir(OUT_DIR) process_markdown_files() - - # bash utils/update.sh # Replaced by... - subprocess.check_call(['git', 'add', '.']) - if not args.push: - subprocess.call(['git', 'status']) - elif subprocess.call(['git', 'diff', '--quiet', '--staged']): - # --quiet implies --exit-code, exits with 1 if there were differences - subprocess.check_call(['git', 'commit', '-m', 'doc update']) - subprocess.check_call(['git', 'push']) - else: - print("No changes to commit and push.") - - os.chdir(THIS_DIR) - if not args.keep: - shutil.rmtree(TEMP_WIKI_DIR, ignore_errors=True) From c298836552e62655a82e3ad10531419123422b76 Mon Sep 17 00:00:00 2001 From: nerdvegas Date: Fri, 11 Feb 2022 14:57:08 +1100 Subject: [PATCH 2/6] wiki toc replace wip --- .github/workflows/wiki.yaml | 3 +- wiki/update-wiki.py | 353 +++++------------------------------- 2 files changed, 49 insertions(+), 307 deletions(-) diff --git a/.github/workflows/wiki.yaml b/.github/workflows/wiki.yaml index 445ec9e35..7e9672101 100644 --- a/.github/workflows/wiki.yaml +++ b/.github/workflows/wiki.yaml @@ -30,9 +30,10 @@ jobs: rezver=$(cat ./src/rez/utils/_version.py | grep -w _rez_version | tr '"' ' ' | awk '{print $NF}') python update-wiki.py \ + --github-repo="${{ github.repository }}/rez" \ --github-release=${rezver} \ --wiki-url="${{ env.CLONE_URL }}" \ - --out="${{ github.workspace }}"/out + --out="${{ github.workspace }}/out" - uses: actions/upload-artifact@v2 with: diff --git a/wiki/update-wiki.py b/wiki/update-wiki.py index 7ee23ec59..0bc672f1a 100644 --- a/wiki/update-wiki.py +++ b/wiki/update-wiki.py @@ -45,295 +45,48 @@ REZ_SOURCE_DIR = os.getenv("REZ_SOURCE_DIR", os.path.dirname(THIS_DIR)) OUT_DIR = "out" -GITHUB_RELEASE = os.getenv("GITHUB_REF", "Unknown") -GITHUB_REPO = os.getenv("GITHUB_REPOSITORY", "nerdvegas/rez") -GITHUB_BRANCH = os.getenv("GITHUB_BRANCH", "master") -GITHUB_WORKFLOW = os.getenv("GITHUB_WORKFLOW", "Wiki") -CLONE_URL = os.getenv( - "CLONE_URL", - "git@github.com:{0}.wiki.git".format(GITHUB_REPO) -) +GITHUB_RELEASE = "unknown-release" +GITHUB_REPO = "unknown/rez" +GITHUB_BRANCH = "master" +GITHUB_WORKFLOW = "Wiki" +CLONE_URL = None -################################################################################ -# https://github.com/rasbt/markdown-toclify -################################################################################ - -VALIDS = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-&' - - -def read_lines(in_file): - """Returns a list of lines from a input markdown file.""" - - with open(in_file, 'r') as inf: - in_contents = inf.read().split('\n') - return in_contents - - -def remove_lines(lines, remove=('[[back to top]', ' tags.""" - - if not remove: - return lines[:] - - out = [] - for l in lines: - if l.startswith(remove): - continue - out.append(l) - return out - - -def dashify_headline(line): - """ - Takes a header line from a Markdown document and - returns a tuple of the - '#'-stripped version of the head line, - a string version for anchor tags, - and the level of the headline as integer. - E.g., - >>> dashify_headline('### some header lvl3') - ('Some header lvl3', 'some-header-lvl3', 3) - """ - stripped_right = line.rstrip('#') - stripped_both = stripped_right.lstrip('#') - level = len(stripped_right) - len(stripped_both) - stripped_wspace = stripped_both.strip() - - # character replacements - replaced_colon = stripped_wspace.replace('.', '') - replaced_slash = replaced_colon.replace('/', '') - rem_nonvalids = ''.join([c if c in VALIDS - else '-' for c in replaced_slash]) - - lowered = rem_nonvalids.lower() - dashified = re.sub(r'(-)\1+', r'\1', lowered) # remove duplicate dashes - dashified = dashified.strip('-') # strip dashes from start and end - - # exception '&' (double-dash in github) - dashified = dashified.replace('-&-', '--') - - return [stripped_wspace, dashified, level] - - -def tag_and_collect(file_lines, id_tag=True, back_links=False, exclude_h=None): - """ - Gets headlines from the markdown document and creates anchor tags. - Keyword arguments: - lines: a list of sublists where every sublist - represents a line from a Markdown document. - id_tag: if true, creates inserts a the tags (not req. by GitHub) - back_links: if true, adds "back to top" links below each headline - exclude_h: header levels to exclude. E.g., [2, 3] - excludes level 2 and 3 headings. - Returns a tuple of 2 lists: - 1st list: - A modified version of the input list where - anchor tags where inserted - above the header lines (if github is False). - 2nd list: - A list of 3-value sublists, where the first value - represents the heading, the second value the string - that was inserted assigned to the IDs in the anchor tags, - and the third value is an integer that reprents the headline level. - E.g., - [['some header lvl3', 'some-header-lvl3', 3], ...] - """ - out_contents = [] - headlines = [] - - for line in file_lines: - saw_headline = False - orig_len = len(line) - - if re.match(r'^\#{1,6} ', line): - line = line.lstrip() - - # comply with new markdown standards - - # not a headline if '#' not followed by whitespace '##no-header': - if not line.lstrip('#').startswith(' '): - continue - # not a headline if more than 6 '#': - if len(line) - len(line.lstrip('#')) > 6: - continue - # headers can be indented by at most 3 spaces: - if orig_len - len(line) > 3: - continue - - # ignore empty headers - if not set(line) - {'#', ' '}: - continue - - saw_headline = True - dashified = dashify_headline(line) - - if not exclude_h or not dashified[-1] in exclude_h: - if id_tag: - id_tag = '' - out_contents.append(id_tag.format(dashified=dashified)) - headlines.append(dashified) - - out_contents.append(line) - if back_links and saw_headline: - out_contents.append('[[back to top](#table-of-contents)]') - return out_contents, headlines - - -def positioning_headlines(headlines): - """ - Strips unnecessary whitespaces/tabs if first header is not left-aligned +def add_toc(txt): + """Add github-style ToC to start of md content. """ - left_just = False - for row in headlines: - if row[-1] == 1: - left_just = True - break - if not left_just: - for row in headlines: - row[-1] -= 1 - return headlines - - -def create_toc(headlines, hyperlink=True, top_link=False, no_toc_header=False): - """ - Creates the table of contents from the headline list - that was returned by the tag_and_collect function. - Keyword Arguments: - headlines: list of lists - e.g., ['Some header lvl3', 'some-header-lvl3', 3] - hyperlink: Creates hyperlinks in Markdown format if True, - e.g., '- [Some header lvl1](#some-header-lvl1)' - top_link: if True, add a id tag for linking the table - of contents itself (for the back-to-top-links) - no_toc_header: suppresses TOC header if True. - Returns a list of headlines for a table of contents - in Markdown format, - e.g., [' - [Some header lvl3](#some-header-lvl3)', ...] - """ - processed = [] - if not no_toc_header: - if top_link: - processed.append('\n') - processed.append('# Table of Contents') - - for line in headlines: - indent = (line[2] - 1) * ' ' - if hyperlink: - item = '%s- [%s](#%s)' % (indent, line[0], line[1]) - else: - item = '%s- %s' % (indent, line[0]) - processed.append(item) - processed.append('\n') - return processed - - -def build_markdown(toc_headlines, body, spacer=0, placeholder=None): - """ - Returns a string with the Markdown output contents incl. - the table of contents. - Keyword arguments: - toc_headlines: lines for the table of contents - as created by the create_toc function. - body: contents of the Markdown file including - ID-anchor tags as returned by the - tag_and_collect function. - spacer: Adds vertical space after the table - of contents. Height in pixels. - placeholder: If a placeholder string is provided, the placeholder - will be replaced by the TOC instead of inserting the TOC at - the top of the document - """ - if spacer: - spacer_line = ['\n
\n' % (spacer)] - toc_markdown = "\n".join(toc_headlines + spacer_line) - else: - toc_markdown = "\n".join(toc_headlines) - - body_markdown = "\n".join(body).strip() - - if placeholder: - markdown = body_markdown.replace(placeholder, toc_markdown) - else: - markdown = toc_markdown + body_markdown - - return markdown + lines = txt.split('\n') + toc_lines = [] + mindepth = None + for line in lines: + if not line.startswith('#'): + continue -def output_markdown(markdown_cont, output_file): - """ - Writes to an output file if `outfile` is a valid path. - """ - if output_file: - with open(output_file, 'w') as out: - out.write(markdown_cont) - - -def markdown_toclify(input_file, output_file=None, github=False, - back_to_top=False, no_link=False, - no_toc_header=False, spacer=0, placeholder=None, - exclude_h=None): - """ Function to add table of contents to markdown files. - Parameters - ----------- - input_file: str - Path to the markdown input file. - output_file: str (defaul: None) - Path to the markdown output file. - github: bool (default: False) - Uses GitHub TOC syntax if True. - back_to_top: bool (default: False) - Inserts back-to-top links below headings if True. - no_link: bool (default: False) - Creates the table of contents without internal links if True. - no_toc_header: bool (default: False) - Suppresses the Table of Contents header if True - spacer: int (default: 0) - Inserts horizontal space (in pixels) after the table of contents. - placeholder: str (default: None) - Inserts the TOC at the placeholder string instead - of inserting the TOC at the top of the document. - exclude_h: list (default None) - Excludes header levels, e.g., if [2, 3], ignores header - levels 2 and 3 in the TOC. - Returns - ----------- - cont: str - Markdown contents including the TOC. - """ - raw_contents = read_lines(input_file) - cleaned_contents = remove_lines(raw_contents, remove=('[[back to top]', ' Date: Fri, 11 Feb 2022 15:34:38 +1100 Subject: [PATCH 3/6] further cleanup of wiki script --- .github/workflows/wiki.yaml | 2 +- ...nd-Line-Tools.md => Command-Line-Tools.md} | 0 ..._Configuring-Rez.md => Configuring-Rez.md} | 2 +- wiki/pages/{_Credits.md => Credits.md} | 2 - wiki/pages/{__Footer.md => _Footer.md} | 0 wiki/pages/{__Sidebar.md => _Sidebar.md} | 0 wiki/update-wiki.py | 93 ++++++++----------- 7 files changed, 43 insertions(+), 56 deletions(-) rename wiki/pages/{_Command-Line-Tools.md => Command-Line-Tools.md} (100%) rename wiki/pages/{_Configuring-Rez.md => Configuring-Rez.md} (98%) rename wiki/pages/{_Credits.md => Credits.md} (99%) rename wiki/pages/{__Footer.md => _Footer.md} (100%) rename wiki/pages/{__Sidebar.md => _Sidebar.md} (100%) diff --git a/.github/workflows/wiki.yaml b/.github/workflows/wiki.yaml index 7e9672101..051aeca2a 100644 --- a/.github/workflows/wiki.yaml +++ b/.github/workflows/wiki.yaml @@ -30,7 +30,7 @@ jobs: rezver=$(cat ./src/rez/utils/_version.py | grep -w _rez_version | tr '"' ' ' | awk '{print $NF}') python update-wiki.py \ - --github-repo="${{ github.repository }}/rez" \ + --github-repo="${{ github.repository }}" \ --github-release=${rezver} \ --wiki-url="${{ env.CLONE_URL }}" \ --out="${{ github.workspace }}/out" diff --git a/wiki/pages/_Command-Line-Tools.md b/wiki/pages/Command-Line-Tools.md similarity index 100% rename from wiki/pages/_Command-Line-Tools.md rename to wiki/pages/Command-Line-Tools.md diff --git a/wiki/pages/_Configuring-Rez.md b/wiki/pages/Configuring-Rez.md similarity index 98% rename from wiki/pages/_Configuring-Rez.md rename to wiki/pages/Configuring-Rez.md index da71c9d2d..4cbce243d 100644 --- a/wiki/pages/_Configuring-Rez.md +++ b/wiki/pages/Configuring-Rez.md @@ -2,7 +2,7 @@ Rez has a good number of configurable settings. The default settings, and documentation for every setting, can be found -[here](https://github.com/__GITHUB_REPO__/blob/master/src/rez/rezconfig.py). +[here](https://github.com/__GITHUB_REPO__/blob/__GITHUB_BRANCH__/src/rez/rezconfig.py). Settings are determined in the following way: diff --git a/wiki/pages/_Credits.md b/wiki/pages/Credits.md similarity index 99% rename from wiki/pages/_Credits.md rename to wiki/pages/Credits.md index 81c8032d3..411eec94d 100644 --- a/wiki/pages/_Credits.md +++ b/wiki/pages/Credits.md @@ -1,5 +1,3 @@ - - ## Contributors

diff --git a/wiki/pages/__Footer.md b/wiki/pages/_Footer.md similarity index 100% rename from wiki/pages/__Footer.md rename to wiki/pages/_Footer.md diff --git a/wiki/pages/__Sidebar.md b/wiki/pages/_Sidebar.md similarity index 100% rename from wiki/pages/__Sidebar.md rename to wiki/pages/_Sidebar.md diff --git a/wiki/update-wiki.py b/wiki/update-wiki.py index 0bc672f1a..268b068af 100644 --- a/wiki/update-wiki.py +++ b/wiki/update-wiki.py @@ -190,17 +190,10 @@ def create_contributors_md(src_path): def process_markdown_files(): - no_toc = [ - "Credits.md", - "Command-Line-Tools.md", - "Home.md", - "_Footer.md", - "_Sidebar.md", - ] - pagespath = os.path.join(THIS_DIR, "pages") + processed_files = {} - src_path = os.getenv("REZ_SOURCE_DIR") + src_path = REZ_SOURCE_DIR if src_path is None: print( "Must provide REZ_SOURCE_DIR which points at root of " @@ -208,9 +201,8 @@ def process_markdown_files(): ) sys.exit(1) - def do_replace(filename, token_md): - srcfile = os.path.join(pagespath, "_%s.md" % filename) - destfile = os.path.join(OUT_DIR, "%s.md" % filename) + def apply_replacements(filename, token_md): + srcfile = os.path.join(pagespath, filename) with open(srcfile, encoding='utf-8') as f: txt = f.read() @@ -218,45 +210,56 @@ def do_replace(filename, token_md): for token, md in token_md.items(): txt = txt.replace(token, md) - print("Writing ", destfile, "...", sep="") - with open(destfile, 'w', encoding='utf-8') as f: - f.write(txt) + return txt - # generate markdown from rezconfig.py, add to _Configuring-Rez.md and write - # out to Configuring-Rez.md + # generate Configuring-Rez.md filepath = os.path.join(src_path, "src", "rez", "rezconfig.py") with open(filepath) as f: txt = f.read() - do_replace( - "Configuring-Rez", + processed_files["Configuring-Rez.md"] = apply_replacements( + "Configuring-Rez.md", { "__REZCONFIG_MD__": creating_configuring_rez_md(txt), "__GITHUB_REPO__": GITHUB_REPO, + "__GITHUB_BRANCH__": GITHUB_BRANCH } ) - # generate markdown contributors list, add to _Credits.md and write out to - # Credits.md + # generate Credits.md md = create_contributors_md(src_path) - do_replace("Credits", {"__CONTRIBUTORS_MD__": md}) + processed_files["Credits.md"] = apply_replacements( + "Credits.md", + { + "__CONTRIBUTORS_MD__": md + } + ) - do_replace( - "Command-Line-Tools", + # generate Command-Line-Tools.md + processed_files["Command-Line-Tools.md"] = apply_replacements( + "Command-Line-Tools.md", { "__GENERATED_MD__": create_clitools_markdown(src_path) } ) - do_replace("_Footer", {"__GITHUB_REPO__": GITHUB_REPO}) + # generate _Footer.md + processed_files["_Footer.md"] = apply_replacements( + "_Footer.md", + { + "__GITHUB_REPO__": GITHUB_REPO + } + ) + # generate _Sidebar.md try: from urllib import quote except ImportError: from urllib.parse import quote + user, repo_name = GITHUB_REPO.split('/') - do_replace( - "_Sidebar", + processed_files["_Sidebar.md"] = apply_replacements( + "_Sidebar.md", { "__GITHUB_RELEASE__": GITHUB_RELEASE, "__GITHUB_REPO__": GITHUB_REPO, @@ -267,36 +270,24 @@ def do_replace(filename, token_md): } ) - # process each md file: - # * adds TOC; - # * replaces short-form content links like '[[here:Blah.md#Header]]' with full form; - # * copies to the root dir. - # - skip_regex = r'^_(?!(Sidebar|Footer))|(? Date: Fri, 11 Feb 2022 15:47:04 +1100 Subject: [PATCH 4/6] removed old misleading docstring --- wiki/update-wiki.py | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/wiki/update-wiki.py b/wiki/update-wiki.py index 268b068af..d8d832ea1 100644 --- a/wiki/update-wiki.py +++ b/wiki/update-wiki.py @@ -1,22 +1,5 @@ -# -*- coding: utf-8 -*- -"""Python implementation of old ``update-wiki.sh`` merged with ``process.py``. - -*From ``update-wiki.sh``* - -This script calls git heavily to: -1. Takes the content from this repo; -2. Then writes it into a local clone of https://github.com/nerdvegas/rez.wiki.git; -3. Then follows the procedure outlined in README from 2. - -This process exists because GitHub does not support contributions to wiki -repositories - this is a workaround. - -See Also: - Original wiki update script files: - - - ``wiki/update-wiki.sh`` at rez 2.50.0, which calls - - ``utils/process.py`` from nerdvegas/rez.wiki at d632328, and - - ``utils/update.sh`` from nerdvegas/rez.wiki at d632328 +""" +Script to generate wiki content. """ from __future__ import absolute_import from __future__ import division From 75df2ddc381e7022e4b6e0d936951844998ceaba Mon Sep 17 00:00:00 2001 From: nerdvegas Date: Fri, 11 Feb 2022 15:55:47 +1100 Subject: [PATCH 5/6] removed some unnecessary code --- wiki/update-wiki.py | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/wiki/update-wiki.py b/wiki/update-wiki.py index d8d832ea1..ac59a4e5a 100644 --- a/wiki/update-wiki.py +++ b/wiki/update-wiki.py @@ -405,26 +405,7 @@ def _format_action(self, action): class UpdateWikiParser(argparse.ArgumentParser): - """Parser flags, using global variables as defaults.""" - INIT_DEFAULTS = { - "prog": "update-wiki", - "description": "Update GitHub Wiki", - "formatter_class": argparse.ArgumentDefaultsHelpFormatter, - } - def __init__(self, **kwargs): - """Setup default arguments and parser description/program name. - - If no parser description/program name are given, default ones will - be assigned. - - Args: - kwargs (dict[str]): - Same key word arguments taken by - ``argparse.ArgumentParser.__init__()`` - """ - for key, value in self.INIT_DEFAULTS.items(): - kwargs.setdefault(key, value) super(UpdateWikiParser, self).__init__(**kwargs) self.add_argument( From 5af1dab9823532849c8519872a58ed29c13e1b97 Mon Sep 17 00:00:00 2001 From: nerdvegas Date: Sat, 12 Feb 2022 08:29:18 +1100 Subject: [PATCH 6/6] removed print typo --- wiki/update-wiki.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wiki/update-wiki.py b/wiki/update-wiki.py index ac59a4e5a..3e0d534e9 100644 --- a/wiki/update-wiki.py +++ b/wiki/update-wiki.py @@ -19,7 +19,7 @@ # py3.7+ only if sys.version_info[:2] < (3, 7): - print("update-wiki.py: ust use python-3.7 or greater", file=sys.stderr) + print("update-wiki.py: use python-3.7 or greater", file=sys.stderr) sys.exit(1)