Skip to content

Commit

Permalink
Merge pull request #2767 from jimklimov/fix-macos-python
Browse files Browse the repository at this point in the history
Fix MacOS CI hiccups with newer python 3.13
  • Loading branch information
jimklimov authored Jan 16, 2025
2 parents aeeed24 + e4739b9 commit 2dbb8b0
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 8 deletions.
14 changes: 9 additions & 5 deletions scripts/python/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,14 @@ NUT_MONITOR_COMMON = \
app/locale/it/LC_MESSAGES/NUT-Monitor.mo \
app/locale/ru/LC_MESSAGES/NUT-Monitor.mo

PYNUT_COMMON = \
module/nut_telnetlib.py \
PYNUT_COMMON_CODE = \
module/nut_telnetlib.py

PYNUT_COMMON_MISC = \
module/README.adoc

PYNUT_COMMON = $(PYNUT_COMMON_CODE) $(PYNUT_COMMON_MISC)

# Note: we both distribute and install the generated *.mo translation files
# so they are listed above and not in NUT_MONITOR_COMMON_TEMPLATE
NUT_MONITOR_COMMON_TEMPLATE = \
Expand Down Expand Up @@ -176,21 +180,21 @@ endif WITH_NUT_MONITOR
if WITH_PYNUT_PY
pynut_py_sitedir = $(PYTHON_SITE_PACKAGES)
pynut_py_site_DATA = $(PYNUT_GENERATED_NOEXEC)
pynut_py_site_SCRIPTS = $(PYNUT_GENERATED_SCRIPT)
pynut_py_site_SCRIPTS = $(PYNUT_GENERATED_SCRIPT) $(PYNUT_COMMON_CODE)
endif


if WITH_PYNUT_PY2
pynut_py2_sitedir = $(PYTHON2_SITE_PACKAGES)
pynut_py2_site_DATA = $(PYNUT_GENERATED_NOEXEC)
pynut_py2_site_SCRIPTS = $(PYNUT_GENERATED_SCRIPT)
pynut_py2_site_SCRIPTS = $(PYNUT_GENERATED_SCRIPT) $(PYNUT_COMMON_CODE)
endif


if WITH_PYNUT_PY3
pynut_py3_sitedir = $(PYTHON3_SITE_PACKAGES)
pynut_py3_site_DATA = $(PYNUT_GENERATED_NOEXEC)
pynut_py3_site_SCRIPTS = $(PYNUT_GENERATED_SCRIPT)
pynut_py3_site_SCRIPTS = $(PYNUT_GENERATED_SCRIPT) $(PYNUT_COMMON_CODE)
endif

#################################################################
Expand Down
3 changes: 3 additions & 0 deletions scripts/python/module/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ upload publish:
if test -x "$(srcdir)/$${B}.in" ; then chmod +x "PyNUTClient/$${B}"; fi ; \
done ; \
cp -pf "$(srcdir)/nut_telnetlib.py" PyNUTClient/ || exit ; \
if [ x"$(abs_srcdir)" != x"$(abs_builddir)" ] ; then \
cp -pf "$(srcdir)/nut_telnetlib.py" . || exit ; \
fi ; \
cp -pf "$(srcdir)/README.adoc" README.txt || exit ; \
cp -pf "$(top_srcdir)/LICENSE-GPL3" . || exit ; \
echo "from . import PyNUT" > PyNUTClient/__init__.py || exit
Expand Down
18 changes: 15 additions & 3 deletions tools/gitlog2changelog.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,11 @@ for line in fin:
# Match the author line and extract the part we want
# (Don't use startswith to allow Author override inside commit message.)
elif "Author:" in line:
authorList = re.split(": ", line, 1)
if sys.version_info >= (3, 13, ):
authorList = re.split(": ", line, maxsplit=1)
else:
authorList = re.split(": ", line, 1)

try:
author = authorList[1]
author = author[0 : len(author) - fin_chop]
Expand All @@ -169,7 +173,11 @@ for line in fin:

# Match the date line
elif line.startswith("Date:"):
dateList = re.split(": ", line, 1)
if sys.version_info >= (3, 13, ):
dateList = re.split(": ", line, maxsplit=1)
else:
dateList = re.split(": ", line, 1)

try:
date = dateList[1]
date = date[0 : len(date) - fin_chop]
Expand Down Expand Up @@ -213,7 +221,11 @@ for line in fin:
continue
# Collect the files for this commit. FIXME: Still need to add +/- to files
elif authorFound and dateFound and messageFound:
fileList = re.split(r' \| ', line, 2)
if sys.version_info >= (3, 13, ):
fileList = re.split(r' \| ', line, maxsplit=2)
else:
fileList = re.split(r' \| ', line, 2)

if len(fileList) > 1:
if len(files) > 0:
files = files + ", " + fileList[0].strip()
Expand Down

0 comments on commit 2dbb8b0

Please sign in to comment.