Skip to content

Commit

Permalink
#690 generate the python executable copies based on the script filena…
Browse files Browse the repository at this point in the history
…me as part of the build process

git-svn-id: https://xpra.org/svn/Xpra/trunk@7756 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Sep 23, 2014
1 parent b7949d8 commit c75d671
Show file tree
Hide file tree
Showing 17 changed files with 37 additions and 19 deletions.
2 changes: 1 addition & 1 deletion osx/Helpers/Bug_Report
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ exe_name=$(basename $0)
full_path=$(cd "$(dirname "$0")"; pwd -P)
PYTHON="$full_path/PythonExecWrapper"

exec "$PYTHON" "Bug Report" -c "import sys;sys.argv[0]=\"$full_path/$exe_name\";from xpra.client.gtk_base.bug_report import main;main()" "$@"
exec "$PYTHON" "$exe_name" -c "import sys;sys.argv[0]=\"$full_path/$exe_name\";from xpra.client.gtk_base.bug_report import main;main()" "$@"
2 changes: 1 addition & 1 deletion osx/Helpers/Config_info
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ exe_name=$(basename $0)
full_path=$(cd "$(dirname "$0")"; pwd -P)
PYTHON="$full_path/PythonExecWrapper"

exec "$PYTHON" "Config Info" -c "import sys;sys.argv[0]=\"$full_path/$exe_name\";from xpra.scripts.config import main;main()" "$@"
exec "$PYTHON" "$exe_name" -c "import sys;sys.argv[0]=\"$full_path/$exe_name\";from xpra.scripts.config import main;main()" "$@"
2 changes: 1 addition & 1 deletion osx/Helpers/Encoding_info
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ exe_name=$(basename $0)
full_path=$(cd "$(dirname "$0")"; pwd -P)
PYTHON="$full_path/PythonExecWrapper"

exec "$PYTHON" "Encoding Info" -c "import sys;sys.argv[0]=\"$full_path/$exe_name\";from xpra.codecs.loader import main;main()" "$@"
exec "$PYTHON" "$exe_name" -c "import sys;sys.argv[0]=\"$full_path/$exe_name\";from xpra.codecs.loader import main;main()" "$@"
2 changes: 1 addition & 1 deletion osx/Helpers/Feature_info
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ exe_name=$(basename $0)
full_path=$(cd "$(dirname "$0")"; pwd -P)
PYTHON="$full_path/PythonExecWrapper"

exec "$PYTHON" "Feature Info" -c "import sys;sys.argv[0]=\"$full_path/$exe_name\";from xpra.platform.features import main;main()" "$@"
exec "$PYTHON" "$exe_name" -c "import sys;sys.argv[0]=\"$full_path/$exe_name\";from xpra.platform.features import main;main()" "$@"
2 changes: 1 addition & 1 deletion osx/Helpers/GStreamer_info
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ exe_name=$(basename $0)
full_path=$(cd "$(dirname "$0")"; pwd -P)
PYTHON="$full_path/PythonExecWrapper"

exec "$PYTHON" "GStreamer Info" -c "import sys;sys.argv[0]=\"$full_path/$exe_name\";from xpra.sound.gstreamer_util import main;main()" "$@"
exec "$PYTHON" "$exe_name" -c "import sys;sys.argv[0]=\"$full_path/$exe_name\";from xpra.sound.gstreamer_util import main;main()" "$@"
2 changes: 1 addition & 1 deletion osx/Helpers/GTK_info
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ exe_name=$(basename $0)
full_path=$(cd "$(dirname "$0")"; pwd -P)
PYTHON="$full_path/PythonExecWrapper"

exec "$PYTHON" "GTK Info" -c "import sys;sys.argv[0]=\"$full_path/$exe_name\";from xpra.gtk_common.gtk_util import main;main()" "$@"
exec "$PYTHON" "$exe_name" -c "import sys;sys.argv[0]=\"$full_path/$exe_name\";from xpra.gtk_common.gtk_util import main;main()" "$@"
2 changes: 1 addition & 1 deletion osx/Helpers/Keyboard_Tool
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ exe_name=$(basename $0)
full_path=$(cd "$(dirname "$0")"; pwd -P)
PYTHON="$full_path/PythonExecWrapper"

exec "$PYTHON" "Keyboard Tool" -c "import sys;sys.argv[0]=\"$full_path/$exe_name\";from xpra.gtk_common.gtk_view_keyboard import main;main()" "$@"
exec "$PYTHON" "$exe_name" -c "import sys;sys.argv[0]=\"$full_path/$exe_name\";from xpra.gtk_common.gtk_view_keyboard import main;main()" "$@"
2 changes: 1 addition & 1 deletion osx/Helpers/Keymap_info
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ exe_name=$(basename $0)
full_path=$(cd "$(dirname "$0")"; pwd -P)
PYTHON="$full_path/PythonExecWrapper"

exec "$PYTHON" "Keymap Info" -c "import sys;sys.argv[0]=\"$full_path/$exe_name\";from xpra.gtk_common.keymap import main;main()" "$@"
exec "$PYTHON" "$exe_name" -c "import sys;sys.argv[0]=\"$full_path/$exe_name\";from xpra.gtk_common.keymap import main;main()" "$@"
2 changes: 1 addition & 1 deletion osx/Helpers/Network_info
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ exe_name=$(basename $0)
full_path=$(cd "$(dirname "$0")"; pwd -P)
PYTHON="$full_path/PythonExecWrapper"

exec "$PYTHON" "Network Info" -c "import sys;sys.argv[0]=\"$full_path/$exe_name\";from xpra.net.net_util import main;main()" "$@"
exec "$PYTHON" "$exe_name" -c "import sys;sys.argv[0]=\"$full_path/$exe_name\";from xpra.net.net_util import main;main()" "$@"
2 changes: 1 addition & 1 deletion osx/Helpers/OpenGL_check
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ exe_name=$(basename $0)
full_path=$(cd "$(dirname "$0")"; pwd -P)
PYTHON="$full_path/PythonExecWrapper"

exec "$PYTHON" "OpenGL Check" -c "import sys;sys.argv[0]=\"$full_path/$exe_name\";from xpra.client.gl.gl_check import main;main()" "$@"
exec "$PYTHON" "$exe_name" -c "import sys;sys.argv[0]=\"$full_path/$exe_name\";from xpra.client.gl.gl_check import main;main()" "$@"
2 changes: 1 addition & 1 deletion osx/Helpers/Path_info
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ exe_name=$(basename $0)
full_path=$(cd "$(dirname "$0")"; pwd -P)
PYTHON="$full_path/PythonExecWrapper"

exec "$PYTHON" "Path Info" -c "import sys;sys.argv[0]=\"$full_path/$exe_name\";from xpra.platform.paths import main;main()" "$@"
exec "$PYTHON" "$exe_name" -c "import sys;sys.argv[0]=\"$full_path/$exe_name\";from xpra.platform.paths import main;main()" "$@"
2 changes: 1 addition & 1 deletion osx/Helpers/Python
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ exe_name=$(basename $0)
full_path=$(cd "$(dirname "$0")"; pwd -P)
PYTHON="$full_path/PythonExecWrapper"

exec "$PYTHON" "Python" "$@"
exec "$PYTHON" "$exe_name" "$@"
13 changes: 9 additions & 4 deletions osx/Helpers/PythonExecWrapper
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# which is used on OSX as the default application name
# as shown in the global menu.

APPNAME=$1
APPNAME=`echo "$1" | sed 's+_+ +g'`
if [ -z "$APPNAME" ]; then
echo "usage $0 APPNAME [args ..]"
exit 1
Expand Down Expand Up @@ -44,9 +44,13 @@ export GST_PLUGIN_PATH="$bundle_lib/gstreamer-0.10"
export GST_PLUGIN_SCANNER="$bundle_contents/Helpers/gst-plugin-scanner"

#Set $PYTHON to point inside the bundle
#This is not the real "python" but a copy of it named "xpra"
#This is not the real "python" but a copy of it named "$APPNAME"
#with underscores replaced by spaces
#which is created by the build scripts because
#some versions of Mac OSX (10.6 onwards?) do not seem to honour
#the name we want to supply with "exec -a"
#This is hacked together in make-app.sh
export PYTHON="$bundle_bin/python"
export PYTHON="$bundle_bin/$APPNAME"
export PYTHONHOME="$bundle_res"
#Add the bundle's python modules
PYTHONPATH="$bundle_lib:$PYTHONPATH"
Expand Down Expand Up @@ -81,4 +85,5 @@ if test -f "$bundle_res/environment.sh"; then
source "$bundle_res/environment.sh"
fi

exec -a "$APPNAME" "$PYTHON" "$@"
#'exec -a "$APPNAME" was used here before - see note above'
exec "$PYTHON" "$@"
2 changes: 1 addition & 1 deletion osx/Helpers/Version_info
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ exe_name=$(basename $0)
full_path=$(cd "$(dirname "$0")"; pwd -P)
PYTHON="$full_path/PythonExecWrapper"

exec "$PYTHON" "Version Info" -c "import sys;sys.argv[0]=\"$full_path/$exe_name\";from xpra.scripts.version import main;main()" "$@"
exec "$PYTHON" "$exe_name" -c "import sys;sys.argv[0]=\"$full_path/$exe_name\";from xpra.scripts.version import main;main()" "$@"
2 changes: 1 addition & 1 deletion osx/Helpers/Xpra
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ while (($#)); do
done
args="$args]"

exec "$PYTHON" "Xpra" -c "import sys;sys.argv[0]=\"$full_path/$exe_name\";from xpra.scripts.main import main;main('xpra', $args)"
exec "$PYTHON" "$exe_name" -c "import sys;sys.argv[0]=\"$full_path/$exe_name\";from xpra.scripts.main import main;main('xpra', $args)"
2 changes: 1 addition & 1 deletion osx/Helpers/Xpra_Launcher
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ exe_name=$(basename $0)
full_path=$(cd "$(dirname "$0")"; pwd -P)
PYTHON="$full_path/PythonExecWrapper"

exec "$PYTHON" "Xpra Launcher" -c "import sys;sys.argv[0]=\"${full_path}/$exe_name\";from xpra.client.gtk_base.client_launcher import main;main()" "$@"
exec "$PYTHON" "$exe_name" -c "import sys;sys.argv[0]=\"${full_path}/$exe_name\";from xpra.client.gtk_base.client_launcher import main;main()" "$@"
13 changes: 13 additions & 0 deletions osx/make-app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,19 @@ rsync -pltv ./Helpers/* "${HELPERS_DIR}/"
#we dont need the wrapper installed by distutils:
rm "${MACOS_DIR}/Xpra_Launcher-bin"

#ensure that every wrapper has a "python" executable to match:
#(see PythonExecWrapper for why we need this "exec -a" workaround)
python_executable="$RSCDIR/bin/python"
for x in `ls "$HELPERS_DIR" | egrep -v "Python|SSH_ASKPASS|gst-plugin-scanner"`; do
#replace underscore with space in actual binary filename:
target="$RSCDIR/bin/`echo $x | sed 's+_+ +g'`"
if [ ! -e "$target" ]; then
#symlinks don't work for us here (osx uses the referent as program name)
#and hardlinks could cause problems, so we duplicate the file:
cp "$python_executable" "$target"
fi
done

# launcher needs to be in main ("MacOS" dir) since it is launched from the custom Info.plist:
cp ./Helpers/Xpra_Launcher ${MACOS_DIR}
# Add the icon:
Expand Down

0 comments on commit c75d671

Please sign in to comment.