Skip to content

Commit

Permalink
make it easier to run tests on win32:
Browse files Browse the repository at this point in the history
* create a Python_execfile.exe utility
* bundle the tests if requested at build time (but not compiled or compressed in the library.zip)

git-svn-id: https://xpra.org/svn/Xpra/trunk@5369 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Feb 6, 2014
1 parent a170ae5 commit 434560e
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
strict_ENABLED = True
debug_ENABLED = False
PIC_ENABLED = True
bundle_tests_ENABLED = False

#allow some of these flags to be modified on the command line:
SWITCHES = ("enc_x264", "x264_static",
Expand All @@ -90,7 +91,7 @@
"server", "client", "x11",
"gtk2", "gtk3", "qt4", "html5",
"sound", "cyxor", "cymaths", "opengl", "argb",
"warn", "strict", "shadow", "debug", "PIC", "Xdummy", "verbose")
"warn", "strict", "shadow", "debug", "PIC", "Xdummy", "verbose", "bundle_tests")
HELP = "-h" in sys.argv or "--help" in sys.argv
if HELP:
setup()
Expand Down Expand Up @@ -771,6 +772,7 @@ def toggle_packages(enabled, *package_names):
{'script': 'xpra/sound/gstreamer_util.py', 'icon_resources': [(1, "win32/gstreamer.ico")], "dest_base": "GStreamer_info",},
{'script': 'xpra/sound/src.py', 'icon_resources': [(1, "win32/microphone.ico")],"dest_base": "Sound_Record",},
{'script': 'xpra/sound/sink.py', 'icon_resources': [(1, "win32/speaker.ico")], "dest_base": "Sound_Play",},
{'script': 'win32/python_execfile.py', 'icon_resources': [(1, "win32/python.ico")], "dest_base": "Python_execfile",},
]
if opengl_ENABLED:
console.append({'script': 'xpra/client/gl/gl_check.py', 'icon_resources': [(1, "win32/opengl.ico")], "dest_base": "OpenGL_check",})
Expand Down Expand Up @@ -1014,6 +1016,14 @@ def pkgconfig(*packages_options, **ekw):
cython_add(Extension("xpra.codecs.argb.argb",
["xpra/codecs/argb/argb.pyx"]))


if bundle_tests_ENABLED:
#bundle the tests directly (not in library.zip):
for k,v in glob_recurse("tests").items():
if (k!=""):
k = os.sep+k
data_files.append(("tests"+k, v))

toggle_packages(client_ENABLED, "xpra.client", "xpra.client.notifications")
toggle_packages(client_ENABLED and gtk2_ENABLED or gtk3_ENABLED, "xpra.client.gtk_base")
toggle_packages(client_ENABLED and gtk2_ENABLED, "xpra.client.gtk2")
Expand Down
2 changes: 2 additions & 0 deletions src/win32/MAKE-INSTALLER.BAT
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ SET SOUND=1
SET OPENGL=1
SET SHADOW=1
SET DEBUG=0
SET BUNDLE_TESTS=0
REM "*********CHANGE THESE BEFORE RUNNING**************"

REM support double-click on BAT file, so run from parent directory:
Expand Down Expand Up @@ -86,6 +87,7 @@ IF %CLIPBOARD% NEQ 1 SET BUILD_ARGS=%BUILD_ARGS% --without-clipboard
IF %SOUND% NEQ 1 SET BUILD_ARGS=%BUILD_ARGS% --without-sound
IF %OPENGL% NEQ 1 SET BUILD_ARGS=%BUILD_ARGS% --without-opengl
IF %SHADOW% NEQ 1 SET BUILD_ARGS=%BUILD_ARGS% --without-shadow
IF %BUNDLE_TESTS% EQU 1 SET BUILD_ARGS=%BUILD_ARGS% --with-bundle_tests

IF %DEBUG% NEQ 1 SET BUILD_ARGS=%BUILD_ARGS% --without-debug
IF %DEBUG% EQU 1 SET BUILD_ARGS=%BUILD_ARGS% --with-debug
Expand Down
Binary file added src/win32/python.ico
Binary file not shown.
29 changes: 29 additions & 0 deletions src/win32/python_execfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env python

# simple wrapper script so we can launch a script file with the same python interpreter
# and environment which is used by the xpra.exe / xpra_cmd.exe process.
#
# normally, the py2exe win32 platform code redirects the output to a log file
# this script disables that.

import os.path
import sys
from xpra.platform.win32 import set_redirect_output
set_redirect_output(False)

try:
import win32api #@UnresolvedImport
win32api.SetConsoleTitle("Python")
except:
pass


if len(sys.argv)<2:
print("you must specify a python script file to run!")
sys.exit(1)
filename = sys.argv[1]
if not os.path.exists(filename):
print("script file '%s' not found" % filename)
sys.exit(1)
execfile(filename)
sys.exit(0)

0 comments on commit 434560e

Please sign in to comment.