diff -r 87cfa131b535 -r e7e0ae78773e configurationengine/build-scripts/utils.py --- a/configurationengine/build-scripts/utils.py Fri Mar 12 08:30:17 2010 +0200 +++ b/configurationengine/build-scripts/utils.py Tue Aug 10 14:29:28 2010 +0300 @@ -43,7 +43,7 @@ else: os.makedirs(path) -def build_egg(source_dir, target_dir): +def build_egg(source_dir, target_dir, python_executable='python'): """ Build an egg file from the given source directory (must contain a setup.py) into the given target directory. @@ -53,7 +53,7 @@ orig_workdir = os.getcwd() os.chdir(source_dir) try: - cmd = 'python setup.py bdist_egg --dist-dir "%s"' % target_dir + cmd = '%s setup.py bdist_egg --dist-dir "%s"' % (python_executable, target_dir) return run_command(cmd) finally: os.chdir(orig_workdir) @@ -65,12 +65,13 @@ os.makedirs(target_dir) shutil.copy2(source_path, target_path) -def get_python_version(): +def get_python_version(executable='python'): """ - Return the version of the Python that is run when the command 'python' - is run (not the Python where this script is executing). + Return the version of the Python that is run when the given Python + executable is run (not the Python where this script is executing). + @param executable: The Python executable to run, defaults to 'python'. """ - p = subprocess.Popen('python -c "import sys; print sys.version[:3]"', stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True) + p = subprocess.Popen('%s -c "import sys; print sys.version[:3]"' % executable, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True) out, err = p.communicate() if p.returncode != 0: log.critical("Failed to get python version")