Skip to content

Commit

Permalink
last port
Browse files Browse the repository at this point in the history
  • Loading branch information
giampaolo committed Jan 4, 2024
1 parent 5689b81 commit 584b7dd
Show file tree
Hide file tree
Showing 3 changed files with 143 additions and 95 deletions.
35 changes: 22 additions & 13 deletions .github/workflows/issues.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@


ROOT_DIR = os.path.realpath(
os.path.join(os.path.dirname(__file__), '..', '..'))
os.path.join(os.path.dirname(__file__), '..', '..')
)
SCRIPTS_DIR = os.path.join(ROOT_DIR, 'scripts')


Expand Down Expand Up @@ -101,7 +102,8 @@
# fmt: on

LABELS_MAP['scripts'].extend(
[x for x in os.listdir(SCRIPTS_DIR) if x.endswith('.py')])
[x for x in os.listdir(SCRIPTS_DIR) if x.endswith('.py')]
)

ILLOGICAL_PAIRS = [
('bug', 'enhancement'),
Expand Down Expand Up @@ -248,10 +250,12 @@ def add_labels_from_new_body(issue, text):
# add bug/enhancement label
log("search for 'Bug fix: y/n' line")
r = re.search(r"\* Bug fix:.*?\n", text)
if is_pr(issue) and \
r is not None and \
not has_label(issue, "bug") and \
not has_label(issue, "enhancement"):
if (
is_pr(issue)
and r is not None
and not has_label(issue, "bug")
and not has_label(issue, "enhancement")
):
log("found")
s = r.group(0).lower()
if 'yes' in s:
Expand Down Expand Up @@ -290,20 +294,25 @@ def add_labels_from_new_body(issue, text):

def on_new_issue(issue):
def has_text(text):
return text in issue.title.lower() or \
(issue.body and text in issue.body.lower())
return text in issue.title.lower() or (
issue.body and text in issue.body.lower()
)

def body_mentions_python_h():
if not issue.body:
return False
body = issue.body.replace(' ', '')
return "#include<Python.h>\n^~~~" in body or \
"#include<Python.h>\r\n^~~~" in body
return (
"#include<Python.h>\n^~~~" in body
or "#include<Python.h>\r\n^~~~" in body
)

log("searching for missing Python.h")
if has_text("missing python.h") or \
has_text("python.h: no such file or directory") or \
body_mentions_python_h():
if (
has_text("missing python.h")
or has_text("python.h: no such file or directory")
or body_mentions_python_h()
):
log("found mention of Python.h")
issue.create_comment(REPLY_MISSING_PYTHON_HEADERS)
issue.edit(state='closed')
Expand Down
39 changes: 19 additions & 20 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,13 @@ def get_version():
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = ['sphinx.ext.autodoc',
'sphinx.ext.coverage',
'sphinx.ext.imgmath',
'sphinx.ext.viewcode',
'sphinx.ext.intersphinx']
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.coverage',
'sphinx.ext.imgmath',
'sphinx.ext.viewcode',
'sphinx.ext.intersphinx',
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
Expand Down Expand Up @@ -271,15 +273,12 @@ def get_version():
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',

# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',

# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',

# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
Expand All @@ -289,8 +288,7 @@ def get_version():
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'psutil.tex', 'psutil Documentation',
AUTHOR, 'manual'),
(master_doc, 'psutil.tex', 'psutil Documentation', AUTHOR, 'manual')
]

# The name of an image file (relative to this directory) to place at the top of
Expand Down Expand Up @@ -330,10 +328,7 @@ def get_version():

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'psutil', 'psutil Documentation',
[author], 1),
]
man_pages = [(master_doc, 'psutil', 'psutil Documentation', [author], 1)]

# If true, show URL addresses after external links.
#
Expand All @@ -345,11 +340,15 @@ def get_version():
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'psutil', 'psutil Documentation',
author, 'psutil', 'One line description of project.',
'Miscellaneous'),
]
texinfo_documents = [(
master_doc,
'psutil',
'psutil Documentation',
author,
'psutil',
'One line description of project.',
'Miscellaneous',
)]

# Documents to append as an appendix to all manuals.
#
Expand All @@ -373,5 +372,5 @@ def get_version():
'https://media.readthedocs.org/css/sphinx_rtd_theme.css',
'https://media.readthedocs.org/css/readthedocs-doc-embed.css',
'_static/css/custom.css',
],
]
}
Loading

0 comments on commit 584b7dd

Please sign in to comment.