Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pass debug Python interpreter on Windows when using Debug build type #72

Merged
merged 1 commit into from
May 10, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions job_templates/ci_job.xml.em
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ echo "# BEGIN SECTION: Run script"
echo "# END SECTION"
@[end if]@
@[elif os_name == 'windows']@
setlocal enableDelayedExpansion
rmdir /S /Q ws workspace "work space"

echo "# BEGIN SECTION: Determine arguments"
Expand Down Expand Up @@ -267,6 +268,11 @@ if "%CI_ISOLATED%" == "true" (
if "%CI_CMAKE_BUILD_TYPE%" NEQ "None" (
set "CI_ARGS=%CI_ARGS% --cmake-build-type %CI_CMAKE_BUILD_TYPE%"
)
if "%CI_CMAKE_BUILD_TYPE%" == "Debug" (
where python_d > python_debug_interpreter.txt
set /p PYTHON_DEBUG_INTERPRETER=<python_debug_interpreter.txt
set "CI_ARGS=%CI_ARGS% --python-interpreter !PYTHON_DEBUG_INTERPRETER!"
)
if "%CI_ENABLE_C_COVERAGE%" == "true" (
set "CI_ARGS=%CI_ARGS% --coverage"
)
Expand Down
3 changes: 3 additions & 0 deletions ros2_batch_job/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ def get_args(sysargv=None):
parser.add_argument(
'--workspace-path', default=None,
help="base path of the workspace")
parser.add_argument(
'--python-interpreter', default=None,
help='pass different Python interpreter to ament')

argv = sysargv[1:] if sysargv is not None else sys.argv[1:]
argv, ament_build_args = extract_argument_group(argv, '--ament-build-args')
Expand Down
4 changes: 2 additions & 2 deletions ros2_batch_job/batch_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@


class BatchJob:
def __init__(self):
def __init__(self, *, python_interpreter=None):
self.run = run
self.run_history = []
self.python = sys.executable
self.python = sys.executable if python_interpreter is None else python_interpreter
self.python_history = []

def push_run(self, run_func):
Expand Down
2 changes: 1 addition & 1 deletion ros2_batch_job/linux_batch/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class LinuxBatchJob(BatchJob):
def __init__(self, args):
self.args = args
# The BatchJob constructor will set self.run and self.python
BatchJob.__init__(self)
BatchJob.__init__(self, python_interpreter=args.python_interpreter)

def pre(self):
# Check if ROS_DOMAIN_ID was already set in the environment
Expand Down
2 changes: 1 addition & 1 deletion ros2_batch_job/osx_batch/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class OSXBatchJob(BatchJob):
def __init__(self, args):
self.args = args
# The BatchJob constructor will set self.run and self.python
BatchJob.__init__(self)
BatchJob.__init__(self, python_interpreter=args.python_interpreter)

def pre(self):
# Prepend the PATH with `/usr/local/bin` for global Homebrew binaries.
Expand Down
2 changes: 1 addition & 1 deletion ros2_batch_job/windows_batch/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class WindowsBatchJob(BatchJob):
def __init__(self, args):
self.args = args
# The BatchJob constructor will set self.run and self.python
BatchJob.__init__(self)
BatchJob.__init__(self, python_interpreter=args.python_interpreter)

def pre(self):
if 'ROS_DOMAIN_ID' not in os.environ:
Expand Down