teuben / nemo

a Stellar Dynamics Toolbox (Not Everybody Must Observe)
https://astronemo.readthedocs.io
GNU General Public License v2.0
57 stars 42 forks source link

improvements for checkpars.py #53

Closed teuben closed 2 years ago

teuben commented 3 years ago

Now that we have a functional checkpars.py, we need a few enhancements: thanks @ParkerTewell for an excellent first version

1) script needs to made "chmod +x ", but via git: git update-index --chmod=+x install.sh after this a regular commit push.

2) I see a few programs with the output "man: None". Does this mean the man page doesn't exist. But I see a None for ccdmom, and the man page exists. There are a few more like this. But other "None" are indeed for missing man pages.

3) Add a "-h" which reminds the user of the valid options, and then exit the program. Could also report a version, as most scripts and programs report that in the inline help option

4) we already spoke about a "-f tasklist" where tasklist needs to be a valid file (either absolute or relative path)

5) currently the script needs to be executed from src/scripts, but if the default tasklist is $NEMO/src/scripts/tasklist it can be from anywhere. use os.environ['NEMO'] to get $NEMO

teuben commented 3 years ago

Another option would check the description in the .SH NAME field of the man page, with the output of the "help=u" line. I would like to argue that they should be the same. For example for ccdfits they differ by one word :-)

ParkerTewell commented 3 years ago

-h flag implemented

teuben commented 3 years ago

minor request: in the output it says "man" and "help", which means the output in the two rows is mis-aligned. if we rename "help" to "bin", they will align and it still reflects where it came from.

teuben commented 3 years ago

The output says Files read: 159 Bad files found: 78 but it really presumably found 159 of the (currently) 208 in the tasklist in $NEMOBIN. Once the -f flag is implemented, at the same time we should add this info, maybe the first line should read: Entries found: 208 in ....

teuben commented 3 years ago

I'm not sure if the merge from checkpars (about the chmod +x) worked. My example above was also wrong, i referred to install.sh, but it should have been checkpars.py. I repeated this experiment in my master branch, so your next edit should start from this.

ParkerTewell commented 3 years ago

checkpars returns None when it either 1) fails to read the man file, or 2) fails to find a keyword in the line following a .TP, I can change it to print something else based on the case.

I've changed the function to return None when it fails to read the man page and "Non-conformant" when it fails to read a keyword after a .TP line

teuben commented 3 years ago

yes, it would be useful to print something different in the two cases. I already found one file where the .TP was forgotten!

teuben commented 3 years ago

ccdppm.1 was flagged as non-conformant, but I think it may be because the last keyword is "8bit=" and there is a problem with scanning keyword names when a non-alpha character is in the name. I had several false negatives in that category.

ParkerTewell commented 3 years ago

Changed help to bin Implemented -f flag What's left: 1) scanning numeric keywords bug 2) changing the environment to $NEMO using os.environ['NEMO']

teuben commented 3 years ago

Also to fix: If a line in the 'help=h' output starts with a space, skip it. Look at 'runbody1 help=h'

ParkerTewell commented 3 years ago

help=h now skips lines that start with spaces Also added support to process hashtags, underscores, and numeric characters when scanning man pages. Up next: support for relative paths for -f

ParkerTewell commented 3 years ago

Added -f support plus lots of other stuff. What's next?

teuben commented 3 years ago

Once we have a robust way where the -v option works, we could also have an option to check the usage line, e.g. with a new -u flag. Here's my thoughts on this.

Each program has a one line description. E.g. "man tsf" shows tsf - type a stuctured file in the .SH "NAME" field.

The "tsf help=h" shows it slightly different: type contents of a (binary) structured file

The $NEMO/src/scripts/tasklist also has an entry, because "mknemo" has a method to maintain this list. The mknemo script will update a temporary file in $NEMO/etc/tasklist, and once every while I will mere new/uniq entries in the master list in $NEMO/src/scripts/tasklist

There's more behind this. This tasklist is also something in a wider circle , outside of NEMO, to allow a google type search one level deeper than the description of NEMO.

teuben commented 3 years ago

I did find a .SH scanning error. Look at the report on scanfits. Various .TP items in the ".SH FIXES" portion of the man page seem to think they are keywords (ING, TUCSON, etc.) I also try fooling it by putting a space before, the \fBING\fP but that also didn't get it fixed.

ParkerTewell commented 3 years ago

added -u flag

ParkerTewell commented 3 years ago

To Do: Fix checkpars so it can be run anywhere

ParkerTewell commented 2 years ago

Anymore improvements?

teuben commented 2 years ago

can you check the man page (checkpars.8), overall if it's correct, and there is a statement that it can only be run from $NEMO. Also the EXAMPLE should have a line "cd $NEMO" before the "make" line.

ParkerTewell commented 2 years ago

Good to close this issue?