diff --git a/getteam.py b/getteam.py deleted file mode 100644 index 08c966bf..00000000 --- a/getteam.py +++ /dev/null @@ -1,119 +0,0 @@ -""" -A command line script that updates "The team" in the ``about.html`` file to -reflect the current ``credits.rst`` file from the astropy repository. - -Note that this first looks for the ``ASTROPY_REPO_PATH`` environment -variable to try to find a local copy of the astropy repo. -""" - - -def get_astropy_credits(warner=print): - """ - Looks for the ``credits.rst`` file in the astropy repo and returns it, or - returns False if the repo can't be found. - """ - import os - import requests - - creditspath = os.environ.get('ASTROPY_REPO_PATH', 'https://raw.githubusercontent.com/astropy/astropy/main/docs/credits.rst') - - if creditspath.startswith('http'): - #url - download page from web - u = None - try: - return requests.get(creditspath).content - except Exception as e: - warner('Could not download credits.rst from requested path: "{0}" Using placeholder for "The Team" page.'.format(e)) - return False - finally: - if u is not None: - u.close() - else: - if not os.path.isfile(creditspath): - warner('Credits.rst file at "{0}" is not a file! Using placeholder for "The Team" page.'.format(creditspath)) - return False - - with open(creditspath) as f: - return f.read() - - -def extract_names_list(docs, sectionname, warner=print): - from docutils import nodes - from docutils.core import publish_doctree - - if not isinstance(docs, nodes.document): - docs = publish_doctree(docs) - - assert isinstance(docs, nodes.document) - - foundsections = [] - for c in docs.children: - titleidx = c.first_child_matching_class(nodes.title) - if titleidx is not None: - title = str(c.children[titleidx].children[0]) - if title == sectionname: - section = c - break - else: - foundsections.append(title) - else: - warner("No section found with name {0}. Sections are:{1!s}".format(sectionname, foundsections)) - return None - - listidx = section.first_child_matching_class(nodes.bullet_list) - litems = section.children[listidx].children - - names = [] - for litem in litems: - # Use astext() to get the concatenated text content of the list item - # instead of joining node objects which can produce unexpected - # characters when their string representation is used. - names.append(litem.astext()) - - return names - - -def process_html(fn, newcontributors, indent='\t\t\t'): - """ - Returns a string of html mean to look like the input, but with content from - the credits file. - """ - lines = [] - incoord = incontrib = False - with open(fn) as fr: - for l in fr: - if l.endswith('\n'): - l = l[:-1] # strip newline - - if incontrib: - if '' in l: - lines.extend([(indent + '