On Mon, 2016-05-23 at 05:52 -0700, Justin Ross wrote:
> ...
> > 2) Python scripts can be executed on Linux without adding "python"
> > prior
> > to the script name because it is detected from the first line in
> > the script
> > (#!/usr/bin/env python). This doesn't work on Windows unless "py"
> > extension
> > files are associated with python. To do this, all python scripts
> > must end
> > with .py which is not the case for a lot of the scripts such as the
> > qpidd
> > management tools (qpid-python-test, qpid-config, ...)
> >
There is a simple solution for this issue (which is what we do with the
proton tests) I'm a little surprised we don't use it here:
find_package(Python ...)
- I'm pretty sure this is already in the Qpid Cmake build somewhere
- This sets up a bunch of useful variables if it finds python including
PYTHON_EXECUTABLE.
Followed by:
add_test(... ${PYTHON_EXECUTABLE} python_script ...)
If you want to call a python script directly there is no need for an
intermediate shell/cmd/powershell script - this is why we were moving
Qpid testing over to being driven by python scripts.
> The tests wrt Windows have long been a problem. I started working on
> improving them a couple months ago. One of the things I did was add
> batch
> files for all the command line tools so that the test scripts could
> more
> easily use them.
If the scripts are to be used inside other test scripts this is more of
a problem, but I'd suggest the more canonical Windows solution would be
to create .py files as well as unadorned names (either copies or
links). This way there is no extra script just the original one with a
slightly different name.
Equally, given these are our own test scripts, we can amend them to add
the implied invocation of python, remembering that we will need to
allow python to be in an arbitrary place, so we need to use
${PYTHON_EXECUTABLE} and set it up for the tests.
Andrew
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]