[PATCH] cli: prefer detected python executable instead of harcoded one

José Fonseca jose.r.fonseca at gmail.com
Tue Aug 26 13:40:51 PDT 2014


Thanks. I pushed this, but had to tweak to leave Windows alone, as there's
no standard Python path on Windows. it could be  C:\Python26\python.exe or
C:\Python27\python.exe and there is no guarantee that the system that
builds and uses apitrace binaries have the same python version.  (Of
course, this could be fixed by bundling Python into apitrace binaries
package, but it's a step I'm not ready to make at this moment.)

Jose

On Sun, Aug 3, 2014 at 2:06 AM, Laurent Carlier <lordheavym at gmail.com>
wrote:

> In ArchLinux, python means python3
> ---
>  cli/CMakeLists.txt      | 1 +
>  cli/cli_diff.cpp        | 4 ++--
>  cli/cli_diff_images.cpp | 4 ++--
>  cli/cli_diff_state.cpp  | 4 ++--
>  4 files changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/cli/CMakeLists.txt b/cli/CMakeLists.txt
> index f1b71c1..e299b91 100644
> --- a/cli/CMakeLists.txt
> +++ b/cli/CMakeLists.txt
> @@ -7,6 +7,7 @@ add_definitions(
>      -DAPITRACE_PROGRAMS_INSTALL_DIR="${CMAKE_INSTALL_PREFIX}/bin"
>
>  -DAPITRACE_SCRIPTS_INSTALL_DIR="${CMAKE_INSTALL_PREFIX}/${SCRIPTS_INSTALL_DIR}"
>
>  -DAPITRACE_WRAPPERS_INSTALL_DIR="${CMAKE_INSTALL_PREFIX}/${WRAPPER_INSTALL_DIR}"
> +    -DAPITRACE_PYTHON_EXECUTABLE="${PYTHON_EXECUTABLE}"
>  )
>
>  add_executable (apitrace
> diff --git a/cli/cli_diff.cpp b/cli/cli_diff.cpp
> index 6aec76f..daeccd3 100644
> --- a/cli/cli_diff.cpp
> +++ b/cli/cli_diff.cpp
> @@ -47,7 +47,7 @@ usage(void)
>      os::String command = find_command();
>
>      char *args[4];
> -    args[0] = (char *) "python";
> +    args[0] = (char *) APITRACE_PYTHON_EXECUTABLE;
>      args[1] = (char *) command.str();
>      args[2] = (char *) "--help";
>      args[3] = NULL;
> @@ -65,7 +65,7 @@ command(int argc, char *argv[])
>      os::String apitracePath = os::getProcessName();
>
>      std::vector<const char *> args;
> -    args.push_back("python");
> +    args.push_back(APITRACE_PYTHON_EXECUTABLE);
>      args.push_back(command.str());
>      args.push_back("--apitrace");
>      args.push_back(apitracePath.str());
> diff --git a/cli/cli_diff_images.cpp b/cli/cli_diff_images.cpp
> index 87678bf..54523cd 100644
> --- a/cli/cli_diff_images.cpp
> +++ b/cli/cli_diff_images.cpp
> @@ -47,7 +47,7 @@ usage(void)
>      os::String command = find_command();
>
>      char *args[4];
> -    args[0] = (char *) "python";
> +    args[0] = (char *) APITRACE_PYTHON_EXECUTABLE;
>      args[1] = (char *) command.str();
>      args[2] = (char *) "--help";
>      args[3] = NULL;
> @@ -63,7 +63,7 @@ command(int argc, char *argv[])
>      os::String command = find_command();
>
>      std::vector<const char *> args;
> -    args.push_back("python");
> +    args.push_back(APITRACE_PYTHON_EXECUTABLE);
>      args.push_back(command.str());
>      for (i = 1; i < argc; i++) {
>          args.push_back(argv[i]);
> diff --git a/cli/cli_diff_state.cpp b/cli/cli_diff_state.cpp
> index 952efa9..0488e77 100644
> --- a/cli/cli_diff_state.cpp
> +++ b/cli/cli_diff_state.cpp
> @@ -47,7 +47,7 @@ usage(void)
>      os::String command = find_command();
>
>      char *args[4];
> -    args[0] = (char *) "python";
> +    args[0] = (char *) APITRACE_PYTHON_EXECUTABLE;
>      args[1] = (char *) command.str();
>      args[2] = (char *) "--help";
>      args[3] = NULL;
> @@ -63,7 +63,7 @@ command(int argc, char *argv[])
>      os::String command = find_command();
>
>      std::vector<const char *> args;
> -    args.push_back("python");
> +    args.push_back(APITRACE_PYTHON_EXECUTABLE);
>      args.push_back(command.str());
>      for (i = 1; i < argc; i++) {
>          args.push_back(argv[i]);
> --
> 2.0.3
>
> _______________________________________________
> apitrace mailing list
> apitrace at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/apitrace
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/apitrace/attachments/20140826/bddc57e6/attachment.html>


More information about the apitrace mailing list