Skip to content

Commit 1345a3a

Browse files
authored
2021.6.24 update
1 parent 48b356d commit 1345a3a

File tree

7 files changed

+615
-2
lines changed

7 files changed

+615
-2
lines changed

_demos/about/License

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Copyright 2021 Hubert Tournier
2+
3+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
4+
5+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
6+
7+
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8+
9+
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10+
11+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

_demos/about/Makefile

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
NAME=about
2+
VERSION=1.0.0
3+
SOURCES=${NAME}.py
4+
DESTROOTDIR=/usr/local
5+
6+
# Default action is to show this help message:
7+
.help:
8+
@echo "Possible targets:"
9+
@echo " check-code Verify PEP 8 compliance (lint)"
10+
@echo " check-security Verify security issues (audit)"
11+
@echo " check-unused Find unused code"
12+
@echo " check-version Find required Python version"
13+
@echo " check-sloc Count Single Lines of Code"
14+
@echo " checks Make all the previous tests"
15+
@echo " format Format code"
16+
@echo " tarball Make a tar.gz file for distribution"
17+
@echo " all Build everything"
18+
@echo " install Install under ${DESTROOTDIR}"
19+
@echo " uninstall Uninstall from ${DESTROOTDIR}"
20+
@echo " whatis Rebuild the whatis(1) database"
21+
@echo " clean Remove the compressed man page"
22+
@echo " distclean Remove everything made"
23+
24+
check-code: /usr/local/bin/pylint
25+
-pylint ${SOURCES}
26+
27+
lint: check-code
28+
29+
check-security: /usr/local/bin/bandit
30+
bandit -r ${SOURCES}
31+
32+
audit: check-security
33+
34+
check-unused: /usr/local/bin/vulture
35+
vulture --sort-by-size ${SOURCES}
36+
37+
check-version: /usr/local/bin/vermin
38+
vermin ${SOURCES}
39+
40+
check-sloc: /usr/local/bin/pygount
41+
pygount --format=summary .
42+
43+
checks: check-code check-security check-unused check-version check-sloc
44+
45+
format: /usr/local/bin/black
46+
black ${SOURCES}
47+
48+
tarball:
49+
tar czf ${NAME}-${VERSION}.tar.gz License Makefile README.md ${NAME}.py ${NAME}.1
50+
51+
${NAME}.1.gz: ${NAME}.1
52+
@gzip -k9 ${NAME}.1
53+
54+
all: tarball ${NAME}.1.gz
55+
56+
install: ${NAME}.1.gz
57+
install -m 0755 -o root -g wheel ${NAME}.py ${DESTROOTDIR}/bin/${NAME}
58+
install -m 0644 -o root -g wheel ${NAME}.1.gz ${DESTROOTDIR}/man/man1
59+
60+
uninstall:
61+
rm -f ${DESTROOTDIR}/bin/${NAME}
62+
rm -f ${DESTROOTDIR}/man/man1/${NAME}.1.gz
63+
64+
whatis:
65+
makewhatis
66+
67+
love:
68+
@echo "Not war!"
69+
70+
clean:
71+
@rm -f ${NAME}.1.gz
72+
73+
distclean: clean
74+
@rm -f ${NAME}-${VERSION}.tar.gz

_demos/about/README.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# ABOUT(1)
2+
3+
## NAME
4+
about - show system information
5+
6+
## SYNOPSIS
7+
**about**
8+
[-a\|--all]
9+
[-S\|--sys\|--system]
10+
[-H\|--hw\|--hardware]
11+
[-O\|--os\|--operating]
12+
[-E\|--env\|--environment]
13+
[-P\|--py\|--python]
14+
[-d\|--debug]
15+
[-h\|--help\|-?]
16+
[-v\|--version]
17+
[--]
18+
19+
## DESCRIPTION
20+
The **about** utility shows most of the system information available through the [Python Standard Library](https://docs.python.org/3/library/index.html).
21+
22+
## OPTIONS
23+
24+
Options | Use
25+
------- | ---
26+
-a\|--all|Same as -SHOEP.
27+
-S\|--sys\|--system|Show information about the system.
28+
-H\|--hw\|--hardware|Show information about the hardware.
29+
-O\|--os\|--operating|Show information about the Operating System.
30+
-E\|--env\|--environment|Show information about the environment.
31+
-P\|--py\|--python|Show information about Python.
32+
-d\|--debug|Enable debug level messages.
33+
-h\|--help\|-?|Print usage and a short help message and exit.
34+
-v\|--version|Print version and exit.
35+
--|Options processing terminator.
36+
37+
## EXIT STATUS
38+
The about utility exits 0 on success, and >0 if an error occurs.
39+
40+
## SEE ALSO
41+
[uname(1)](https://www.freebsd.org/cgi/man.cgi?query=uname), [sysctl(8)](https://www.freebsd.org/cgi/man.cgi?query=sysctl)
42+
43+
https://docs.python.org/3/library/index.html
44+
45+
## STANDARDS
46+
The about command is not a standard [UNIX](https://en.wikipedia.org/wiki/Unix)/[POSIX](https://en.wikipedia.org/wiki/POSIX) command.
47+
48+
It tries to follow the [PEP 8](https://www.python.org/dev/peps/pep-0008/) style guide for [Python](https://www.python.org/) code.
49+
We check this with the [Pylint](https://www.pylint.org/) command.
50+
51+
## PORTABILITY
52+
Tested OK under Windows.
53+
54+
## HISTORY
55+
The about command was created as an example for the [PNU project](https://github.com/HubTou/PNU), testing many of the [standard Python functions](https://docs.python.org/3/library/index.html) for getting system information.
56+
57+
## LICENSE
58+
This utility is available under the [3-clause BSD license](https://opensource.org/licenses/BSD-3-Clause).
59+
60+
## AUTHOR
61+
[Hubert Tournier](https://github.com/HubTou)
62+

_demos/about/about.1

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
.TH ABOUT 1
2+
.SH NAME
3+
about \- show system information
4+
.SH SYNOPSIS
5+
.B about
6+
[\-a|\-\-all]
7+
[\-S|\-\-sys|\-\-system]
8+
[\-H|\-\-hw|\-\-hardware]
9+
[\-O|\-\-os|\-\-operating]
10+
[\-E|\-\-env|\-\-environment]
11+
[\-P|\-\-py|\-\-python]
12+
[\-d|\-\-debug]
13+
[\-h|\-\-help|\-?]
14+
[\-v|\-\-version]
15+
[\-\-]
16+
.SH DESCRIPTION
17+
The
18+
.B about
19+
utility shows most of the system information available through the Python Standard Library.
20+
.SH OPTIONS
21+
.TP
22+
.BR \-a|\-\-all
23+
Same as -SHOEP.
24+
.TP
25+
.BR \-S|\-\-sys|\-\-system
26+
Show information about the system.
27+
.TP
28+
.BR \-H|\-\-hw|\-\-hardware
29+
Show information about the hardware.
30+
.TP
31+
.BR \-O|\-\-os|\-\-operating
32+
Show information about the Operating System.
33+
.TP
34+
.BR \-E|\-\-env|\-\-environment
35+
Show information about the environment.
36+
.TP
37+
.BR \-P|\-\-py|\-\-python
38+
Show information about Python.
39+
.TP
40+
.BR \-d|\-\-debug
41+
Enable debug level messages.
42+
.TP
43+
.BR \-h|\-\-help|\-?
44+
Print usage and a short help message and exit.
45+
.TP
46+
.BR \-v|\-\-version
47+
Print version and exit.
48+
.TP
49+
.BR \-\-
50+
Options processing terminator.
51+
.SH EXIT STATUS
52+
The about utility exits 0 on success, and >0 if an error occurs.
53+
.SH SEE ALSO
54+
uname(1), sysctl(8)
55+
.PP
56+
https://docs.python.org/3/library/index.html
57+
.SH STANDARDS
58+
The about command is not a standard UNIX/POSIX command.
59+
.PP
60+
It tries to follow the PEP 8 style guide for Python code (see https://www.python.org/dev/peps/pep-0008/).
61+
We check this with the Pylint command (see https://www.pylint.org/).
62+
.SH PORTABILITY
63+
Tested OK under Windows.
64+
.SH HISTORY
65+
The about command was created as an example for the PNU project, testing many of the standard Python functions for getting system information.
66+
.SH LICENSE
67+
This utility is available under the 3-clause BSD license (see https://opensource.org/licenses/BSD-3-Clause).
68+
.SH AUTHOR
69+
Hubert Tournier

0 commit comments

Comments
 (0)