def make_isolated_main(): args = _parse_args() # disable colors if asked if args.no_color: terminal_color.disable_ANSI_colors() # Default paths base_path = os.path.abspath('.') source_path = os.path.join(base_path, 'src') build_path = os.path.join(base_path, 'build') devel_path = os.path.join(base_path, 'devel') install_path = config_cache.get_install_prefix_from_config_cmake() unused_catkin_toplevel, catkin_python_path, catkin_cmake_path = common.find_catkin() # Clear out previous temporaries if requested if args.pre_clean: console.pretty_print("Pre-cleaning before building.", console.cyan) shutil.rmtree(devel_path, ignore_errors=True) shutil.rmtree(build_path, ignore_errors=True) shutil.rmtree(install_path, ignore_errors=True) if not os.path.exists(build_path): os.mkdir(build_path) make.validate_build_space(base_path) # raises a RuntimeError if there is a problem build_workspace_isolated( workspace=base_path, sourcespace=source_path, buildspace=build_path, develspace=devel_path, installspace=install_path, merge=args.merge, install=args.install, jobs=args.jobs, force_cmake=args.force_cmake, build_packages=args.packages, quiet=args.quiet, cmake_args=args.cmake_args, make_args=args.make_args, catkin_cmake_path=catkin_cmake_path, catkin_python_path=catkin_python_path )
def make_isolated_main(): args = _parse_args() if args.no_color: terminal_color.disable_ANSI_colors() (base_path, build_path, devel_path, source_path) = common.get_default_paths(isolated=args.suffixes) unused_catkin_toplevel, catkin_python_path, unused_catkin_cmake_path = common.find_catkin(base_path) install_path = config_cache.get_install_prefix_from_config_cmake(isolated=args.suffixes) sys.path.insert(0, catkin_python_path) from catkin.builder import build_workspace_isolated # Clear out previous temporaries if requested if args.pre_clean: console.pretty_print("Pre-cleaning before building.", console.cyan) shutil.rmtree(devel_path, ignore_errors=True) shutil.rmtree(build_path, ignore_errors=True) shutil.rmtree(install_path, ignore_errors=True) if not os.path.exists(build_path): os.mkdir(build_path) # Validate package argument packages = find_packages(source_path, exclude_subspaces=True) packages_by_name = {p.name: path for path, p in packages.iteritems()} if args.packages: for package in args.packages: if package not in packages_by_name: raise RuntimeError('Package %s not found in the workspace' % package) make.validate_build_space(base_path) # raises a RuntimeError if there is a problem make.check_and_update_source_repo_paths(source_path) build_workspace_isolated( workspace=base_path, sourcespace=source_path, buildspace=build_path, develspace=devel_path, installspace=install_path, merge=args.merge, install=args.install, force_cmake=args.force_cmake, build_packages=args.packages, quiet=args.quiet, cmake_args=args.cmake_args, make_args=args.make_args ) # this is a really fugly way of building a specific target after all else has been built # (and rebuilt), usually this is enough as the check of already built packages is quick if args.target: env = os.environ.copy() cmd = ['make', args.target] make_paths = [] if args.packages: for package in args.packages: # It's an isolated build, so packages are listed under the build path as a flat list (not fully traceable dirs like in catkin_make) # make_path = os.path.join(make_path, packages_by_name[package]) make_paths.append(os.path.join(build_path, package)) else: for (unused_path, package) in topological_order_packages(packages): # 3rd party builds put make targets under an install directory # catkin package builds put make targets under the package name # why? no bloody idea, but just detect what is what here third_party_build_path = os.path.join(build_path, package.name, 'install') catkin_build_path = os.path.join(build_path, package.name) package_build_path = third_party_build_path if os.path.exists(third_party_build_path) else catkin_build_path make_paths.append(package_build_path) for make_path in make_paths: builder.print_command_banner(cmd, make_path, color=not args.no_color) if args.no_color: builder.run_command(cmd, make_path, env=env) else: builder.run_command_colorized(cmd, make_path, env=env)