Yeah, I think the "right way" (i.e., cross platform) would be to use a combination of manipulating PATH and various python env vars (see ENVIRONMENT VARIABLES in man python) such as PYTHONHOME, et al for a given development environment.
Normally you would have a "helper/launcher" script or something that sets/exports these into a bash/terminal/shell/commandline/etc session.

I have just a simple "runchirp" script that gets me going on mac:

#!/bin/bash
CHIRP_DEBUG=True /opt/kk7ds/bin/python chirp.hg/chirpw



From: "chirp.cordless@xoxy.net" <chirp.cordless@xoxy.net>
To: chirp_devel@intrepid.danplanet.com
Sent: Wednesday, April 9, 2014 11:01 PM
Subject: Re: [chirp_devel] run_tests: No module named serial

Tom,

I edited the shebang line to insert the path to the "correct" python
so I could run the tests. But I think that might be a mistake to do
for all users.

I'm not sure, but run_test is not a Mac-only file, is it?
I assume that most linux users have the "correct" Python
in /usr/bin/python, or else nobody is running tests?
Nobody develops chirp on a Mac?
Or those that do overwrite the Apple-supplied python?

Even on a Mac, I note that the shell script in the app looked
in two places for it. Can't do that on the shebang line, so it
would have to be wrapped in a script - but which shell works
on all platforms?

And I have no idea what Windows would do here.
Plus, I can't test it other than on a Mac. Sounds like
lots of trouble created for other developers.

I don't mind doing the work, it's going to be a pain editing
run_tests every time, and then restoring it so hg doesn't try
to add it to a patch. I could probably add a mac_run_tests
wrapper, essentially duplicating what the script in the app does.

You're busy. This isn't urgent. Give me some direction so I'm
not going to break stuff for others, and I'll do it.

-dan


On Apr 9, 2014, at 4:48 PM, Tom Hayward - esarfl@gmail.com  wrote:
> Sorry I don't have the time to focus on this right now, but here's another hint:
> http://stackoverflow.com/questions/2429511/why-do-people-write-usr-bin-env-python-on-the-first-line-of-a-python-script
>
> Notice that this is *not* how Dan calls Python from run_tests. You
> might fix it and submit it as your first bug fix :-)
>
> Tom KD7LXL


_______________________________________________
chirp_devel mailing list
chirp_devel@intrepid.danplanet.com
http://intrepid.danplanet.com/mailman/listinfo/chirp_devel
Developer docs: http://chirp.danplanet.com/projects/chirp/wiki/Developers