File: pmpython.1

package info (click to toggle)
pcp 6.3.8-1
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 235,180 kB
  • sloc: ansic: 1,253,622; sh: 173,998; xml: 160,490; cpp: 83,331; python: 20,482; perl: 18,302; yacc: 6,886; makefile: 2,955; lex: 2,862; fortran: 60; java: 52
file content (112 lines) | stat: -rw-r--r-- 3,430 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
'\"macro stdmacro
.\"
.\" Copyright (c) 2016 Ken McDonell.  All Rights Reserved.
.\"
.\" This program is free software; you can redistribute it and/or modify it
.\" under the terms of the GNU General Public License as published by the
.\" Free Software Foundation; either version 2 of the License, or (at your
.\" option) any later version.
.\"
.\" This program is distributed in the hope that it will be useful, but
.\" WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
.\" or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
.\" for more details.
.\"
.TH PMPYTHON 1 "PCP" "Performance Co-Pilot"
.SH NAME
\f3pmpython\f1 \- run a python script using a preferred python variant
.SH SYNOPSIS
\f3pmpython\f1
[\f2python-args-and-script\f1]
.SH DESCRIPTION
.B pmpython
provides a way to run python scripts using a customisable python
interpreter, rather than embedding the name of
a particular version of python into each script.
.PP
This can be useful as it allows version-independent python code to be
run anywhere.
All python modules shipped with PCP support versions 2.6 and later (in
the python2 series), and 3.3 and later (in the python3 release series).
.PP
Due to python monitoring and collecting scripts being relatively simple
in PCP (not requiring new modules, language features, etc), it has been
possible to ensure they work for all of the above python versions.
.PP
However, the name of the python interpreter is not always the same,
thus,
it is common for PCP python scripts to use a \(lqshebang\(rq line that
launches the
.B python
interpreter indirectly
as follows:
.PP
.in 1.0i
.ft CR
.nf
#!/usr/bin/env pmpython
.fi
.ft
.in
.PP
.BR env (1)
is used to find the correct path for the
.B pmpython
executable from the user's
.BR $PATH .
.PP
By default the name of the python interpreter is found from the
the value of
.B $PCP_PYTHON_PROG
from the environment (if set) else
from
.IR /etc/pcp.conf .
The latter is the
more typical case where
this value is based on
some heuristics about the platform at the time the PCP packages were
build and
favour the use of
.I python3
in all recent releases of PCP (for those platforms that support it).
.PP
This allows an appropriate name to be used for the python
interpreter instead of a hard-coded
python version name, while still allowing the user to override the python
interpreter as follows:
.PP
.in 1.0i
.ft CR
.nf
$ PCP_PYTHON_PROG=python3 pmpython --version
Python 3.4.2
$ PCP_PYTHON_PROG=python2 pmpython --version
Python 2.7.9
.fi
.ft R
.in
.PP
This is convenient for shipping identical scripts on multiple platforms,
and for testing different python versions with the one script (e.g. in
the case where multiple versions of python are installed, PCP_PYTHON_PROG
can be set in the local environment to override the global setting).
.PP
.B pmpython
is a replacement for an earlier tool with similar function, namely
.BR pcp-python (1).
.SH PCP ENVIRONMENT
Environment variables with the prefix \fBPCP_\fP are used to parameterize
the file and directory names used by PCP.
On each installation, the
file \fI/etc/pcp.conf\fP contains the local values for these variables.
The \fB$PCP_CONF\fP variable may be used to specify an alternative
configuration file, as described in \fBpcp.conf\fP(5).
.SH SEE ALSO
.BR env (1),
.BR pcp (1),
.BR pcp-python (1)
and
.BR PCPIntro (1).

.\" control lines for scripts/man-spell
.\" +ok+ args