Skip to content

Make gen-nutupsconf-aug.py work with Python 3 - #346

Merged
clepple merged 2 commits into
networkupstools:masterfrom
The-Compiler:augeas-py3
Dec 6, 2016
Merged

clepple merged 2 commits into
networkupstools:masterfrom
The-Compiler:augeas-py3

Conversation

@The-Compiler

@The-Compiler The-Compiler commented Nov 29, 2016 •

Copy link
Copy Markdown
Contributor

This makes the script work with Python 2.6+.
Fixes #345.

cc @zman0900

This makes the script work with Python 2.6+.
Fixes #345.
@The-Compiler The-Compiler mentioned this pull request Nov 29, 2016
@clepple

clepple commented Nov 29, 2016

Copy link
Copy Markdown
Member

Thanks! (If only my other 2-to-3 conversion projects were that simple...)

Since this will automatically close the parent issue when merged, I think we need to check and make sure that all of the other instances of scripts invoking python are fixed (hence the WIP tag). Have you had a chance to compare the rest of the output of the build process?

  • scripts/python/module/PyNUT.py (not build-related, but also invokes python)
  • tools/gitlog2changelog.py
  • tools/nut-snmpinfo.py

@clepple clepple added the WIP label Nov 29, 2016
@The-Compiler

Copy link
Copy Markdown
Contributor Author
  • scripts/python/module/PyNUT.py seems to run (and the changelog claims it supports python 3)
  • tools/gitlog2changelog.py has been fixed in 7bf209a - the output is line-wrapped slightly differently though, but I haven't tracked this down (I'd guess it's fine?)
  • tools/nut-snmpinfo.py seems to work fine

What about those?

  • scripts/Solaris/precheck.py (broken)
  • scripts/Solaris/prepackage.py (broken)
  • scripts/python/module/test_nutclient.py(seems to work)

@aquette

aquette commented Nov 30, 2016

Copy link
Copy Markdown
Member

@jimklimov could you please check the scripts/Solaris/pre{check,package}.py as mentioned above by @The-Compiler ? you've probably been looking at those already, or otherwise we may want to remove these and get from a new ground (still tied to you ;)). Thanks!

@jimklimov

jimklimov commented Nov 30, 2016 •

Copy link
Copy Markdown
Member

Just in case, what and where should I check? :)

The first part seems easier: git checkout The-Compiler:augeas-py3 and try to configure and run it on a bunch of machines?

As far as relevant platforms go, there is Solaris 10u8 (last released by Sun on more or less free-to-use conditions). then there are later releases of Oracle Solaris 10u*, 11.{0,1,2,3} and some beta of 12, and various open descendants of OpenSolaris, the popular general-purpose ones being OpenIndiana Hipster (bleeding-edge rolling-release) and OmniOS (several releases of varied bleediness vs stability). Some customers may quite run Solaris 8 or 9 still, especially on sturdy old boxes with CPUs no longer supported by newer kernels.

Oh, and also we have an AIX 6.1 and 7.1 to try and feed this to ;)

Solaris 10 has Python 2.4, illumos opensourced ones have 2.6/2.7 (in progress of eradicating 2.6, but not all finished yet), and may have 3.4 or so as an optional package with which not everything works...

@The-Compiler

Copy link
Copy Markdown
Contributor Author

The main question is whether those need to work on Python 3 - I guess not?

@jimklimov

Copy link
Copy Markdown
Member

Well, it depends. Many of them do not have python at all, or not python3. Those that do, do not have a python2 symlink out of the box, but a /usr/bin/python pointing right to ./python2.7 or whichever the chosen implementation is. On OI/Hipster at least there is a pre-packaged /usr/bin/python3 symlink however.

So I guess the main goals are to:

  • work where python3 is default
  • work where python2 is default
  • work where python is not available

Maybe different levels of "work" are achievable given the (lack of) tools, so perhaps some prepared files should be available in tarballs and/or git, so these other systems can still compile NUT as well - just not recompile everything from origins, It may well be up to autogen.sh to detect the situation and call the proper python interpreter perhaps for a customized version of the script, or something like that.

Or abandon python and rewrite stuff in POSIX shell, sed, grep... =D

@The-Compiler

Copy link
Copy Markdown
Contributor Author

FWIW those scripts would be trivial to reimplement as a shellscript (I'm not volunteering 😆), but at the moment I think it's fine to keep them as-is (with a python shebang and python2-only) as we know it'll only run on Solaris (right?).

This should be ready to merge from my POV then.

@clepple
clepple merged commit 7bf209a into networkupstools:master Dec 6, 2016
@clepple

clepple commented Dec 6, 2016

Copy link
Copy Markdown
Member

@The-Compiler meant to merge this earlier - thanks again! (We can open a new issue for Solaris if needed.)

@jimklimov jimklimov added augeas Configuration file parser (reader, writer) multi-tool for scripting, etc. python labels Apr 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

augeas Configuration file parser (reader, writer) multi-tool for scripting, etc. python WIP

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python 2/3

4 participants