Skip to content

Commit

Permalink
Merge pull request #169 from jbohren-forks/fix-context-awareness
Browse files Browse the repository at this point in the history
build: preventing build --this from looking outside of the workspace
  • Loading branch information
wjwwood committed Mar 23, 2015
2 parents ddcb7ff + d17f449 commit c905ea9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions catkin_tools/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ def wide_log(msg, **kwargs):
wide_log_fn(msg, **kwargs)


def find_enclosing_package(search_start_path=None):
def find_enclosing_package(search_start_path=None, ws_path=None):
"""Get the package containing the current directory."""

search_start_path = search_start_path or os.getcwd()
Expand All @@ -418,7 +418,7 @@ def find_enclosing_package(search_start_path=None):

# Update search path or end
(search_start_path, child_path) = os.path.split(search_start_path)
if len(child_path) == 0:
if len(child_path) == 0 or search_start_path == ws_path:
break

return None
5 changes: 4 additions & 1 deletion catkin_tools/verbs/catkin_build/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from __future__ import print_function

import argparse
import os
import sys
import time

Expand All @@ -29,6 +30,7 @@

from catkin_tools.context import Context

from catkin_tools.metadata import find_enclosing_workspace
from catkin_tools.metadata import get_metadata
from catkin_tools.metadata import update_metadata

Expand Down Expand Up @@ -187,7 +189,8 @@ def main(opts):
if opts.build_this or opts.start_with_this:
# Determine the enclosing package
try:
this_package = find_enclosing_package()
ws_path = find_enclosing_workspace(os.getcwd())
this_package = find_enclosing_package(search_start_path=os.getcwd(), ws_path=ws_path)
except (InvalidPackage, RuntimeError):
this_package = None

Expand Down

0 comments on commit c905ea9

Please sign in to comment.