build: eliminate use of python execfile command

As discussed in
id:8cc9dd580ad672527e12f43706f9803b2c8e99d8.1405220724.git.wking@tremily.us,
execfile is unavailable in python3.

The approach of this commit avoids modifying the python module path,
which is arguably preferable since it avoids potentially accidentally
importing a module from the wrong place.
This commit is contained in:
David Bremner 2015-01-03 14:14:03 +01:00
parent 3220230317
commit 2bb906a6dd
2 changed files with 3 additions and 2 deletions

View file

@ -130,7 +130,7 @@ else
fi fi
echo -n "Checking that python bindings version is $VERSION... " echo -n "Checking that python bindings version is $VERSION... "
py_version=`python -c "execfile('$PV_FILE'); print __VERSION__"` py_version=`python -c "with open('$PV_FILE') as vf: exec(vf.read()); print __VERSION__"`
if [ "$py_version" = "$VERSION" ] if [ "$py_version" = "$VERSION" ]
then then
echo Yes. echo Yes.

View file

@ -10,7 +10,8 @@ outdir = argv[2]
if not isdir(outdir): if not isdir(outdir):
makedirs(outdir, 0o755) makedirs(outdir, 0o755)
execfile(sourcedir + "/conf.py") with open(sourcedir + "/conf.py") as cf:
exec(cf.read())
def header(file, startdocname, command, description, authors, section): def header(file, startdocname, command, description, authors, section):