pcp
[Top] [All Lists]

Re: python3 woes on f22

To: Mark Goodwin <mgoodwin@xxxxxxxxxx>, "Frank Ch. Eigler" <fche@xxxxxxxxxx>
Subject: Re: python3 woes on f22
From: Nathan Scott <nathans@xxxxxxxxxx>
Date: Tue, 14 Jul 2015 00:22:28 -0400 (EDT)
Cc: pcp@xxxxxxxxxxx
Delivered-to: pcp@xxxxxxxxxxx
In-reply-to: <y0my4ikulyq.fsf@xxxxxxxx>
References: <5594A1B5.5090003@xxxxxxxxxx> <y0mbnfhvx03.fsf@xxxxxxxx> <55A2FFBB.5000803@xxxxxxxxxx> <227885808.37023848.1436780775020.JavaMail.zimbra@xxxxxxxxxx> <y0my4ikulyq.fsf@xxxxxxxx>
Reply-to: Nathan Scott <nathans@xxxxxxxxxx>
Thread-index: Y0pdYgk9VbJE9SbSSrhCSw7H5HZViw==
Thread-topic: python3 woes on f22

----- Original Message -----
> > [...]
> > Perhaps we could generalise it into a pcp-env(1), which could expand the
> > $PCP_PYTHON_PROG from pcp.conf, for use in shebang lines like:
> > #!/usr/bin/pcp env $PCP_PYTHON_PROG
> 
> Note that UNIX shebang lines only permit a single argument ("env"),
> so you'd need a combined front-end like /usr/bin/pcp-env or something.

Yep...

$ cat /usr/libexec/pcp/bin/pcp-python
#! /bin/sh
. $PCP_DIR/etc/pcp.env
exec $PCP_PYTHON_PROG $@

Works beautifully...

$ PCP_PYTHON_PROG=python2 /usr/bin/pcp python --version
Python 2.7.5
$ PCP_PYTHON_PROG=python3 /usr/bin/pcp python --version
Python 3.3.2

Simple verification on pcp-free(1) and friends suggests all is well
there; I'll do some automated QA and a man page shortly.  And remove
those sed/find hacks over in fedora.spec.

A really neat and simple solution, Mark - good one, thanks!

> But thinking of it as a user option (something changeable within
> /etc/pcp.conf) is odd:

Not really, and pcp.conf is only one avenue of modifying it - its just
like using /usr/bin/env to allow environment-driven alternatives.  And
its very handy - I wish I'd thought of this when porting everything to
python3, would've made life alot easier.

cheers.

--
Nathan

<Prev in Thread] Current Thread [Next in Thread>