initial commit
This commit is contained in:
16
cmake-build-debug/catkin_generated/env_cached.sh
Executable file
16
cmake-build-debug/catkin_generated/env_cached.sh
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/usr/bin/env sh
|
||||
# generated from catkin/cmake/templates/env.sh.in
|
||||
|
||||
if [ $# -eq 0 ] ; then
|
||||
/bin/echo "Usage: env.sh COMMANDS"
|
||||
/bin/echo "Calling env.sh without arguments is not supported anymore. Instead spawn a subshell and source a setup file manually."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# ensure to not use different shell type which was set before
|
||||
CATKIN_SHELL=sh
|
||||
|
||||
# source setup_cached.sh from same directory as this file
|
||||
_CATKIN_SETUP_DIR=$(cd "`dirname "$0"`" > /dev/null && pwd)
|
||||
. "$_CATKIN_SETUP_DIR/setup_cached.sh"
|
||||
exec "$@"
|
||||
30
cmake-build-debug/catkin_generated/generate_cached_setup.py
Normal file
30
cmake-build-debug/catkin_generated/generate_cached_setup.py
Normal file
@@ -0,0 +1,30 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import print_function
|
||||
|
||||
import os
|
||||
import stat
|
||||
import sys
|
||||
|
||||
# find the import for catkin's python package - either from source space or from an installed underlay
|
||||
if os.path.exists(os.path.join('/opt/ros/noetic/share/catkin/cmake', 'catkinConfig.cmake.in')):
|
||||
sys.path.insert(0, os.path.join('/opt/ros/noetic/share/catkin/cmake', '..', 'python'))
|
||||
try:
|
||||
from catkin.environment_cache import generate_environment_script
|
||||
except ImportError:
|
||||
# search for catkin package in all workspaces and prepend to path
|
||||
for workspace in '/opt/ros/noetic'.split(';'):
|
||||
python_path = os.path.join(workspace, 'lib/python3/dist-packages')
|
||||
if os.path.isdir(os.path.join(python_path, 'catkin')):
|
||||
sys.path.insert(0, python_path)
|
||||
break
|
||||
from catkin.environment_cache import generate_environment_script
|
||||
|
||||
code = generate_environment_script('/home/admin1/workspace/catkin_ws_ov/src/rviz_camera_stream/cmake-build-debug/devel/env.sh')
|
||||
|
||||
output_filename = '/home/admin1/workspace/catkin_ws_ov/src/rviz_camera_stream/cmake-build-debug/catkin_generated/setup_cached.sh'
|
||||
with open(output_filename, 'w') as f:
|
||||
# print('Generate script for cached setup "%s"' % output_filename)
|
||||
f.write('\n'.join(code))
|
||||
|
||||
mode = os.stat(output_filename).st_mode
|
||||
os.chmod(output_filename, mode | stat.S_IXUSR)
|
||||
@@ -0,0 +1,2 @@
|
||||
- setup-file:
|
||||
local-name: /usr/local/setup.sh
|
||||
304
cmake-build-debug/catkin_generated/installspace/_setup_util.py
Executable file
304
cmake-build-debug/catkin_generated/installspace/_setup_util.py
Executable file
@@ -0,0 +1,304 @@
|
||||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Software License Agreement (BSD License)
|
||||
#
|
||||
# Copyright (c) 2012, Willow Garage, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the following
|
||||
# disclaimer in the documentation and/or other materials provided
|
||||
# with the distribution.
|
||||
# * Neither the name of Willow Garage, Inc. nor the names of its
|
||||
# contributors may be used to endorse or promote products derived
|
||||
# from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
"""This file generates shell code for the setup.SHELL scripts to set environment variables."""
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import argparse
|
||||
import copy
|
||||
import errno
|
||||
import os
|
||||
import platform
|
||||
import sys
|
||||
|
||||
CATKIN_MARKER_FILE = '.catkin'
|
||||
|
||||
system = platform.system()
|
||||
IS_DARWIN = (system == 'Darwin')
|
||||
IS_WINDOWS = (system == 'Windows')
|
||||
|
||||
PATH_TO_ADD_SUFFIX = ['bin']
|
||||
if IS_WINDOWS:
|
||||
# while catkin recommends putting dll's into bin, 3rd party packages often put dll's into lib
|
||||
# since Windows finds dll's via the PATH variable, prepend it with path to lib
|
||||
PATH_TO_ADD_SUFFIX.extend([['lib', os.path.join('lib', 'x86_64-linux-gnu')]])
|
||||
|
||||
# subfolder of workspace prepended to CMAKE_PREFIX_PATH
|
||||
ENV_VAR_SUBFOLDERS = {
|
||||
'CMAKE_PREFIX_PATH': '',
|
||||
'LD_LIBRARY_PATH' if not IS_DARWIN else 'DYLD_LIBRARY_PATH': ['lib', os.path.join('lib', 'x86_64-linux-gnu')],
|
||||
'PATH': PATH_TO_ADD_SUFFIX,
|
||||
'PKG_CONFIG_PATH': [os.path.join('lib', 'pkgconfig'), os.path.join('lib', 'x86_64-linux-gnu', 'pkgconfig')],
|
||||
'PYTHONPATH': 'lib/python3/dist-packages',
|
||||
}
|
||||
|
||||
|
||||
def rollback_env_variables(environ, env_var_subfolders):
|
||||
"""
|
||||
Generate shell code to reset environment variables.
|
||||
|
||||
by unrolling modifications based on all workspaces in CMAKE_PREFIX_PATH.
|
||||
This does not cover modifications performed by environment hooks.
|
||||
"""
|
||||
lines = []
|
||||
unmodified_environ = copy.copy(environ)
|
||||
for key in sorted(env_var_subfolders.keys()):
|
||||
subfolders = env_var_subfolders[key]
|
||||
if not isinstance(subfolders, list):
|
||||
subfolders = [subfolders]
|
||||
value = _rollback_env_variable(unmodified_environ, key, subfolders)
|
||||
if value is not None:
|
||||
environ[key] = value
|
||||
lines.append(assignment(key, value))
|
||||
if lines:
|
||||
lines.insert(0, comment('reset environment variables by unrolling modifications based on all workspaces in CMAKE_PREFIX_PATH'))
|
||||
return lines
|
||||
|
||||
|
||||
def _rollback_env_variable(environ, name, subfolders):
|
||||
"""
|
||||
For each catkin workspace in CMAKE_PREFIX_PATH remove the first entry from env[NAME] matching workspace + subfolder.
|
||||
|
||||
:param subfolders: list of str '' or subfoldername that may start with '/'
|
||||
:returns: the updated value of the environment variable.
|
||||
"""
|
||||
value = environ[name] if name in environ else ''
|
||||
env_paths = [path for path in value.split(os.pathsep) if path]
|
||||
value_modified = False
|
||||
for subfolder in subfolders:
|
||||
if subfolder:
|
||||
if subfolder.startswith(os.path.sep) or (os.path.altsep and subfolder.startswith(os.path.altsep)):
|
||||
subfolder = subfolder[1:]
|
||||
if subfolder.endswith(os.path.sep) or (os.path.altsep and subfolder.endswith(os.path.altsep)):
|
||||
subfolder = subfolder[:-1]
|
||||
for ws_path in _get_workspaces(environ, include_fuerte=True, include_non_existing=True):
|
||||
path_to_find = os.path.join(ws_path, subfolder) if subfolder else ws_path
|
||||
path_to_remove = None
|
||||
for env_path in env_paths:
|
||||
env_path_clean = env_path[:-1] if env_path and env_path[-1] in [os.path.sep, os.path.altsep] else env_path
|
||||
if env_path_clean == path_to_find:
|
||||
path_to_remove = env_path
|
||||
break
|
||||
if path_to_remove:
|
||||
env_paths.remove(path_to_remove)
|
||||
value_modified = True
|
||||
new_value = os.pathsep.join(env_paths)
|
||||
return new_value if value_modified else None
|
||||
|
||||
|
||||
def _get_workspaces(environ, include_fuerte=False, include_non_existing=False):
|
||||
"""
|
||||
Based on CMAKE_PREFIX_PATH return all catkin workspaces.
|
||||
|
||||
:param include_fuerte: The flag if paths starting with '/opt/ros/fuerte' should be considered workspaces, ``bool``
|
||||
"""
|
||||
# get all cmake prefix paths
|
||||
env_name = 'CMAKE_PREFIX_PATH'
|
||||
value = environ[env_name] if env_name in environ else ''
|
||||
paths = [path for path in value.split(os.pathsep) if path]
|
||||
# remove non-workspace paths
|
||||
workspaces = [path for path in paths if os.path.isfile(os.path.join(path, CATKIN_MARKER_FILE)) or (include_fuerte and path.startswith('/opt/ros/fuerte')) or (include_non_existing and not os.path.exists(path))]
|
||||
return workspaces
|
||||
|
||||
|
||||
def prepend_env_variables(environ, env_var_subfolders, workspaces):
|
||||
"""Generate shell code to prepend environment variables for the all workspaces."""
|
||||
lines = []
|
||||
lines.append(comment('prepend folders of workspaces to environment variables'))
|
||||
|
||||
paths = [path for path in workspaces.split(os.pathsep) if path]
|
||||
|
||||
prefix = _prefix_env_variable(environ, 'CMAKE_PREFIX_PATH', paths, '')
|
||||
lines.append(prepend(environ, 'CMAKE_PREFIX_PATH', prefix))
|
||||
|
||||
for key in sorted(key for key in env_var_subfolders.keys() if key != 'CMAKE_PREFIX_PATH'):
|
||||
subfolder = env_var_subfolders[key]
|
||||
prefix = _prefix_env_variable(environ, key, paths, subfolder)
|
||||
lines.append(prepend(environ, key, prefix))
|
||||
return lines
|
||||
|
||||
|
||||
def _prefix_env_variable(environ, name, paths, subfolders):
|
||||
"""
|
||||
Return the prefix to prepend to the environment variable NAME.
|
||||
|
||||
Adding any path in NEW_PATHS_STR without creating duplicate or empty items.
|
||||
"""
|
||||
value = environ[name] if name in environ else ''
|
||||
environ_paths = [path for path in value.split(os.pathsep) if path]
|
||||
checked_paths = []
|
||||
for path in paths:
|
||||
if not isinstance(subfolders, list):
|
||||
subfolders = [subfolders]
|
||||
for subfolder in subfolders:
|
||||
path_tmp = path
|
||||
if subfolder:
|
||||
path_tmp = os.path.join(path_tmp, subfolder)
|
||||
# skip nonexistent paths
|
||||
if not os.path.exists(path_tmp):
|
||||
continue
|
||||
# exclude any path already in env and any path we already added
|
||||
if path_tmp not in environ_paths and path_tmp not in checked_paths:
|
||||
checked_paths.append(path_tmp)
|
||||
prefix_str = os.pathsep.join(checked_paths)
|
||||
if prefix_str != '' and environ_paths:
|
||||
prefix_str += os.pathsep
|
||||
return prefix_str
|
||||
|
||||
|
||||
def assignment(key, value):
|
||||
if not IS_WINDOWS:
|
||||
return 'export %s="%s"' % (key, value)
|
||||
else:
|
||||
return 'set %s=%s' % (key, value)
|
||||
|
||||
|
||||
def comment(msg):
|
||||
if not IS_WINDOWS:
|
||||
return '# %s' % msg
|
||||
else:
|
||||
return 'REM %s' % msg
|
||||
|
||||
|
||||
def prepend(environ, key, prefix):
|
||||
if key not in environ or not environ[key]:
|
||||
return assignment(key, prefix)
|
||||
if not IS_WINDOWS:
|
||||
return 'export %s="%s$%s"' % (key, prefix, key)
|
||||
else:
|
||||
return 'set %s=%s%%%s%%' % (key, prefix, key)
|
||||
|
||||
|
||||
def find_env_hooks(environ, cmake_prefix_path):
|
||||
"""Generate shell code with found environment hooks for the all workspaces."""
|
||||
lines = []
|
||||
lines.append(comment('found environment hooks in workspaces'))
|
||||
|
||||
generic_env_hooks = []
|
||||
generic_env_hooks_workspace = []
|
||||
specific_env_hooks = []
|
||||
specific_env_hooks_workspace = []
|
||||
generic_env_hooks_by_filename = {}
|
||||
specific_env_hooks_by_filename = {}
|
||||
generic_env_hook_ext = 'bat' if IS_WINDOWS else 'sh'
|
||||
specific_env_hook_ext = environ['CATKIN_SHELL'] if not IS_WINDOWS and 'CATKIN_SHELL' in environ and environ['CATKIN_SHELL'] else None
|
||||
# remove non-workspace paths
|
||||
workspaces = [path for path in cmake_prefix_path.split(os.pathsep) if path and os.path.isfile(os.path.join(path, CATKIN_MARKER_FILE))]
|
||||
for workspace in reversed(workspaces):
|
||||
env_hook_dir = os.path.join(workspace, 'etc', 'catkin', 'profile.d')
|
||||
if os.path.isdir(env_hook_dir):
|
||||
for filename in sorted(os.listdir(env_hook_dir)):
|
||||
if filename.endswith('.%s' % generic_env_hook_ext):
|
||||
# remove previous env hook with same name if present
|
||||
if filename in generic_env_hooks_by_filename:
|
||||
i = generic_env_hooks.index(generic_env_hooks_by_filename[filename])
|
||||
generic_env_hooks.pop(i)
|
||||
generic_env_hooks_workspace.pop(i)
|
||||
# append env hook
|
||||
generic_env_hooks.append(os.path.join(env_hook_dir, filename))
|
||||
generic_env_hooks_workspace.append(workspace)
|
||||
generic_env_hooks_by_filename[filename] = generic_env_hooks[-1]
|
||||
elif specific_env_hook_ext is not None and filename.endswith('.%s' % specific_env_hook_ext):
|
||||
# remove previous env hook with same name if present
|
||||
if filename in specific_env_hooks_by_filename:
|
||||
i = specific_env_hooks.index(specific_env_hooks_by_filename[filename])
|
||||
specific_env_hooks.pop(i)
|
||||
specific_env_hooks_workspace.pop(i)
|
||||
# append env hook
|
||||
specific_env_hooks.append(os.path.join(env_hook_dir, filename))
|
||||
specific_env_hooks_workspace.append(workspace)
|
||||
specific_env_hooks_by_filename[filename] = specific_env_hooks[-1]
|
||||
env_hooks = generic_env_hooks + specific_env_hooks
|
||||
env_hooks_workspace = generic_env_hooks_workspace + specific_env_hooks_workspace
|
||||
count = len(env_hooks)
|
||||
lines.append(assignment('_CATKIN_ENVIRONMENT_HOOKS_COUNT', count))
|
||||
for i in range(count):
|
||||
lines.append(assignment('_CATKIN_ENVIRONMENT_HOOKS_%d' % i, env_hooks[i]))
|
||||
lines.append(assignment('_CATKIN_ENVIRONMENT_HOOKS_%d_WORKSPACE' % i, env_hooks_workspace[i]))
|
||||
return lines
|
||||
|
||||
|
||||
def _parse_arguments(args=None):
|
||||
parser = argparse.ArgumentParser(description='Generates code blocks for the setup.SHELL script.')
|
||||
parser.add_argument('--extend', action='store_true', help='Skip unsetting previous environment variables to extend context')
|
||||
parser.add_argument('--local', action='store_true', help='Only consider this prefix path and ignore other prefix path in the environment')
|
||||
return parser.parse_known_args(args=args)[0]
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
try:
|
||||
try:
|
||||
args = _parse_arguments()
|
||||
except Exception as e:
|
||||
print(e, file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
if not args.local:
|
||||
# environment at generation time
|
||||
CMAKE_PREFIX_PATH = r'/opt/ros/noetic'.split(';')
|
||||
else:
|
||||
# don't consider any other prefix path than this one
|
||||
CMAKE_PREFIX_PATH = []
|
||||
# prepend current workspace if not already part of CPP
|
||||
base_path = os.path.dirname(__file__)
|
||||
# CMAKE_PREFIX_PATH uses forward slash on all platforms, but __file__ is platform dependent
|
||||
# base_path on Windows contains backward slashes, need to be converted to forward slashes before comparison
|
||||
if os.path.sep != '/':
|
||||
base_path = base_path.replace(os.path.sep, '/')
|
||||
|
||||
if base_path not in CMAKE_PREFIX_PATH:
|
||||
CMAKE_PREFIX_PATH.insert(0, base_path)
|
||||
CMAKE_PREFIX_PATH = os.pathsep.join(CMAKE_PREFIX_PATH)
|
||||
|
||||
environ = dict(os.environ)
|
||||
lines = []
|
||||
if not args.extend:
|
||||
lines += rollback_env_variables(environ, ENV_VAR_SUBFOLDERS)
|
||||
lines += prepend_env_variables(environ, ENV_VAR_SUBFOLDERS, CMAKE_PREFIX_PATH)
|
||||
lines += find_env_hooks(environ, CMAKE_PREFIX_PATH)
|
||||
print('\n'.join(lines))
|
||||
|
||||
# need to explicitly flush the output
|
||||
sys.stdout.flush()
|
||||
except IOError as e:
|
||||
# and catch potential "broken pipe" if stdout is not writable
|
||||
# which can happen when piping the output to a file but the disk is full
|
||||
if e.errno == errno.EPIPE:
|
||||
print(e, file=sys.stderr)
|
||||
sys.exit(2)
|
||||
raise
|
||||
|
||||
sys.exit(0)
|
||||
16
cmake-build-debug/catkin_generated/installspace/env.sh
Executable file
16
cmake-build-debug/catkin_generated/installspace/env.sh
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/usr/bin/env sh
|
||||
# generated from catkin/cmake/templates/env.sh.in
|
||||
|
||||
if [ $# -eq 0 ] ; then
|
||||
/bin/echo "Usage: env.sh COMMANDS"
|
||||
/bin/echo "Calling env.sh without arguments is not supported anymore. Instead spawn a subshell and source a setup file manually."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# ensure to not use different shell type which was set before
|
||||
CATKIN_SHELL=sh
|
||||
|
||||
# source setup.sh from same directory as this file
|
||||
_CATKIN_SETUP_DIR=$(cd "`dirname "$0"`" > /dev/null && pwd)
|
||||
. "$_CATKIN_SETUP_DIR/setup.sh"
|
||||
exec "$@"
|
||||
@@ -0,0 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
# generated from catkin/cmake/templates/local_setup.bash.in
|
||||
|
||||
CATKIN_SHELL=bash
|
||||
|
||||
# source setup.sh from same directory as this file
|
||||
_CATKIN_SETUP_DIR=$(builtin cd "`dirname "${BASH_SOURCE[0]}"`" > /dev/null && pwd)
|
||||
. "$_CATKIN_SETUP_DIR/setup.sh" --extend --local
|
||||
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env sh
|
||||
# generated from catkin/cmake/template/local_setup.sh.in
|
||||
|
||||
# since this file is sourced either use the provided _CATKIN_SETUP_DIR
|
||||
# or fall back to the destination set at configure time
|
||||
: ${_CATKIN_SETUP_DIR:=/usr/local}
|
||||
CATKIN_SETUP_UTIL_ARGS="--extend --local"
|
||||
. "$_CATKIN_SETUP_DIR/setup.sh"
|
||||
unset CATKIN_SETUP_UTIL_ARGS
|
||||
@@ -0,0 +1,8 @@
|
||||
#!/usr/bin/env zsh
|
||||
# generated from catkin/cmake/templates/local_setup.zsh.in
|
||||
|
||||
CATKIN_SHELL=zsh
|
||||
|
||||
# source setup.sh from same directory as this file
|
||||
_CATKIN_SETUP_DIR=$(builtin cd -q "`dirname "$0"`" > /dev/null && pwd)
|
||||
emulate -R zsh -c 'source "$_CATKIN_SETUP_DIR/setup.sh" --extend --local'
|
||||
@@ -0,0 +1,8 @@
|
||||
prefix=/usr/local
|
||||
|
||||
Name: rviz_camera_stream
|
||||
Description: Description of rviz_camera_stream
|
||||
Version: 1.0.1
|
||||
Cflags:
|
||||
Libs: -L${prefix}/lib
|
||||
Requires: roscpp rviz
|
||||
@@ -0,0 +1,14 @@
|
||||
# generated from catkin/cmake/template/pkgConfig-version.cmake.in
|
||||
set(PACKAGE_VERSION "1.0.1")
|
||||
|
||||
set(PACKAGE_VERSION_EXACT False)
|
||||
set(PACKAGE_VERSION_COMPATIBLE False)
|
||||
|
||||
if("${PACKAGE_FIND_VERSION}" VERSION_EQUAL "${PACKAGE_VERSION}")
|
||||
set(PACKAGE_VERSION_EXACT True)
|
||||
set(PACKAGE_VERSION_COMPATIBLE True)
|
||||
endif()
|
||||
|
||||
if("${PACKAGE_FIND_VERSION}" VERSION_LESS "${PACKAGE_VERSION}")
|
||||
set(PACKAGE_VERSION_COMPATIBLE True)
|
||||
endif()
|
||||
@@ -0,0 +1,223 @@
|
||||
# generated from catkin/cmake/template/pkgConfig.cmake.in
|
||||
|
||||
# append elements to a list and remove existing duplicates from the list
|
||||
# copied from catkin/cmake/list_append_deduplicate.cmake to keep pkgConfig
|
||||
# self contained
|
||||
macro(_list_append_deduplicate listname)
|
||||
if(NOT "${ARGN}" STREQUAL "")
|
||||
if(${listname})
|
||||
list(REMOVE_ITEM ${listname} ${ARGN})
|
||||
endif()
|
||||
list(APPEND ${listname} ${ARGN})
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# append elements to a list if they are not already in the list
|
||||
# copied from catkin/cmake/list_append_unique.cmake to keep pkgConfig
|
||||
# self contained
|
||||
macro(_list_append_unique listname)
|
||||
foreach(_item ${ARGN})
|
||||
list(FIND ${listname} ${_item} _index)
|
||||
if(_index EQUAL -1)
|
||||
list(APPEND ${listname} ${_item})
|
||||
endif()
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
# pack a list of libraries with optional build configuration keywords
|
||||
# copied from catkin/cmake/catkin_libraries.cmake to keep pkgConfig
|
||||
# self contained
|
||||
macro(_pack_libraries_with_build_configuration VAR)
|
||||
set(${VAR} "")
|
||||
set(_argn ${ARGN})
|
||||
list(LENGTH _argn _count)
|
||||
set(_index 0)
|
||||
while(${_index} LESS ${_count})
|
||||
list(GET _argn ${_index} lib)
|
||||
if("${lib}" MATCHES "^(debug|optimized|general)$")
|
||||
math(EXPR _index "${_index} + 1")
|
||||
if(${_index} EQUAL ${_count})
|
||||
message(FATAL_ERROR "_pack_libraries_with_build_configuration() the list of libraries '${ARGN}' ends with '${lib}' which is a build configuration keyword and must be followed by a library")
|
||||
endif()
|
||||
list(GET _argn ${_index} library)
|
||||
list(APPEND ${VAR} "${lib}${CATKIN_BUILD_CONFIGURATION_KEYWORD_SEPARATOR}${library}")
|
||||
else()
|
||||
list(APPEND ${VAR} "${lib}")
|
||||
endif()
|
||||
math(EXPR _index "${_index} + 1")
|
||||
endwhile()
|
||||
endmacro()
|
||||
|
||||
# unpack a list of libraries with optional build configuration keyword prefixes
|
||||
# copied from catkin/cmake/catkin_libraries.cmake to keep pkgConfig
|
||||
# self contained
|
||||
macro(_unpack_libraries_with_build_configuration VAR)
|
||||
set(${VAR} "")
|
||||
foreach(lib ${ARGN})
|
||||
string(REGEX REPLACE "^(debug|optimized|general)${CATKIN_BUILD_CONFIGURATION_KEYWORD_SEPARATOR}(.+)$" "\\1;\\2" lib "${lib}")
|
||||
list(APPEND ${VAR} "${lib}")
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
|
||||
if(rviz_camera_stream_CONFIG_INCLUDED)
|
||||
return()
|
||||
endif()
|
||||
set(rviz_camera_stream_CONFIG_INCLUDED TRUE)
|
||||
|
||||
# set variables for source/devel/install prefixes
|
||||
if("FALSE" STREQUAL "TRUE")
|
||||
set(rviz_camera_stream_SOURCE_PREFIX /home/admin1/workspace/catkin_ws_ov/src/rviz_camera_stream)
|
||||
set(rviz_camera_stream_DEVEL_PREFIX /home/admin1/workspace/catkin_ws_ov/src/rviz_camera_stream/cmake-build-debug/devel)
|
||||
set(rviz_camera_stream_INSTALL_PREFIX "")
|
||||
set(rviz_camera_stream_PREFIX ${rviz_camera_stream_DEVEL_PREFIX})
|
||||
else()
|
||||
set(rviz_camera_stream_SOURCE_PREFIX "")
|
||||
set(rviz_camera_stream_DEVEL_PREFIX "")
|
||||
set(rviz_camera_stream_INSTALL_PREFIX /usr/local)
|
||||
set(rviz_camera_stream_PREFIX ${rviz_camera_stream_INSTALL_PREFIX})
|
||||
endif()
|
||||
|
||||
# warn when using a deprecated package
|
||||
if(NOT "" STREQUAL "")
|
||||
set(_msg "WARNING: package 'rviz_camera_stream' is deprecated")
|
||||
# append custom deprecation text if available
|
||||
if(NOT "" STREQUAL "TRUE")
|
||||
set(_msg "${_msg} ()")
|
||||
endif()
|
||||
message("${_msg}")
|
||||
endif()
|
||||
|
||||
# flag project as catkin-based to distinguish if a find_package()-ed project is a catkin project
|
||||
set(rviz_camera_stream_FOUND_CATKIN_PROJECT TRUE)
|
||||
|
||||
if(NOT " " STREQUAL " ")
|
||||
set(rviz_camera_stream_INCLUDE_DIRS "")
|
||||
set(_include_dirs "")
|
||||
if(NOT " " STREQUAL " ")
|
||||
set(_report "Check the issue tracker '' and consider creating a ticket if the problem has not been reported yet.")
|
||||
elseif(NOT "https://github.com/lucasw/rviz_camera_stream " STREQUAL " ")
|
||||
set(_report "Check the website 'https://github.com/lucasw/rviz_camera_stream' for information and consider reporting the problem.")
|
||||
else()
|
||||
set(_report "Report the problem to the maintainer 'Lucas Walter <wsacul@gmail.com>' and request to fix the problem.")
|
||||
endif()
|
||||
foreach(idir ${_include_dirs})
|
||||
if(IS_ABSOLUTE ${idir} AND IS_DIRECTORY ${idir})
|
||||
set(include ${idir})
|
||||
elseif("${idir} " STREQUAL "include ")
|
||||
get_filename_component(include "${rviz_camera_stream_DIR}/../../../include" ABSOLUTE)
|
||||
if(NOT IS_DIRECTORY ${include})
|
||||
message(FATAL_ERROR "Project 'rviz_camera_stream' specifies '${idir}' as an include dir, which is not found. It does not exist in '${include}'. ${_report}")
|
||||
endif()
|
||||
else()
|
||||
message(FATAL_ERROR "Project 'rviz_camera_stream' specifies '${idir}' as an include dir, which is not found. It does neither exist as an absolute directory nor in '\${prefix}/${idir}'. ${_report}")
|
||||
endif()
|
||||
_list_append_unique(rviz_camera_stream_INCLUDE_DIRS ${include})
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
set(libraries "")
|
||||
foreach(library ${libraries})
|
||||
# keep build configuration keywords, target names and absolute libraries as-is
|
||||
if("${library}" MATCHES "^(debug|optimized|general)$")
|
||||
list(APPEND rviz_camera_stream_LIBRARIES ${library})
|
||||
elseif(${library} MATCHES "^-l")
|
||||
list(APPEND rviz_camera_stream_LIBRARIES ${library})
|
||||
elseif(${library} MATCHES "^-")
|
||||
# This is a linker flag/option (like -pthread)
|
||||
# There's no standard variable for these, so create an interface library to hold it
|
||||
if(NOT rviz_camera_stream_NUM_DUMMY_TARGETS)
|
||||
set(rviz_camera_stream_NUM_DUMMY_TARGETS 0)
|
||||
endif()
|
||||
# Make sure the target name is unique
|
||||
set(interface_target_name "catkin::rviz_camera_stream::wrapped-linker-option${rviz_camera_stream_NUM_DUMMY_TARGETS}")
|
||||
while(TARGET "${interface_target_name}")
|
||||
math(EXPR rviz_camera_stream_NUM_DUMMY_TARGETS "${rviz_camera_stream_NUM_DUMMY_TARGETS}+1")
|
||||
set(interface_target_name "catkin::rviz_camera_stream::wrapped-linker-option${rviz_camera_stream_NUM_DUMMY_TARGETS}")
|
||||
endwhile()
|
||||
add_library("${interface_target_name}" INTERFACE IMPORTED)
|
||||
if("${CMAKE_VERSION}" VERSION_LESS "3.13.0")
|
||||
set_property(
|
||||
TARGET
|
||||
"${interface_target_name}"
|
||||
APPEND PROPERTY
|
||||
INTERFACE_LINK_LIBRARIES "${library}")
|
||||
else()
|
||||
target_link_options("${interface_target_name}" INTERFACE "${library}")
|
||||
endif()
|
||||
list(APPEND rviz_camera_stream_LIBRARIES "${interface_target_name}")
|
||||
elseif(TARGET ${library})
|
||||
list(APPEND rviz_camera_stream_LIBRARIES ${library})
|
||||
elseif(IS_ABSOLUTE ${library})
|
||||
list(APPEND rviz_camera_stream_LIBRARIES ${library})
|
||||
else()
|
||||
set(lib_path "")
|
||||
set(lib "${library}-NOTFOUND")
|
||||
# since the path where the library is found is returned we have to iterate over the paths manually
|
||||
foreach(path /usr/local/lib;/opt/ros/noetic/lib)
|
||||
find_library(lib ${library}
|
||||
PATHS ${path}
|
||||
NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
|
||||
if(lib)
|
||||
set(lib_path ${path})
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
if(lib)
|
||||
_list_append_unique(rviz_camera_stream_LIBRARY_DIRS ${lib_path})
|
||||
list(APPEND rviz_camera_stream_LIBRARIES ${lib})
|
||||
else()
|
||||
# as a fall back for non-catkin libraries try to search globally
|
||||
find_library(lib ${library})
|
||||
if(NOT lib)
|
||||
message(FATAL_ERROR "Project '${PROJECT_NAME}' tried to find library '${library}'. The library is neither a target nor built/installed properly. Did you compile project 'rviz_camera_stream'? Did you find_package() it before the subdirectory containing its code is included?")
|
||||
endif()
|
||||
list(APPEND rviz_camera_stream_LIBRARIES ${lib})
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
set(rviz_camera_stream_EXPORTED_TARGETS "")
|
||||
# create dummy targets for exported code generation targets to make life of users easier
|
||||
foreach(t ${rviz_camera_stream_EXPORTED_TARGETS})
|
||||
if(NOT TARGET ${t})
|
||||
add_custom_target(${t})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
set(depends "roscpp;rviz")
|
||||
foreach(depend ${depends})
|
||||
string(REPLACE " " ";" depend_list ${depend})
|
||||
# the package name of the dependency must be kept in a unique variable so that it is not overwritten in recursive calls
|
||||
list(GET depend_list 0 rviz_camera_stream_dep)
|
||||
list(LENGTH depend_list count)
|
||||
if(${count} EQUAL 1)
|
||||
# simple dependencies must only be find_package()-ed once
|
||||
if(NOT ${rviz_camera_stream_dep}_FOUND)
|
||||
find_package(${rviz_camera_stream_dep} REQUIRED NO_MODULE)
|
||||
endif()
|
||||
else()
|
||||
# dependencies with components must be find_package()-ed again
|
||||
list(REMOVE_AT depend_list 0)
|
||||
find_package(${rviz_camera_stream_dep} REQUIRED NO_MODULE ${depend_list})
|
||||
endif()
|
||||
_list_append_unique(rviz_camera_stream_INCLUDE_DIRS ${${rviz_camera_stream_dep}_INCLUDE_DIRS})
|
||||
|
||||
# merge build configuration keywords with library names to correctly deduplicate
|
||||
_pack_libraries_with_build_configuration(rviz_camera_stream_LIBRARIES ${rviz_camera_stream_LIBRARIES})
|
||||
_pack_libraries_with_build_configuration(_libraries ${${rviz_camera_stream_dep}_LIBRARIES})
|
||||
_list_append_deduplicate(rviz_camera_stream_LIBRARIES ${_libraries})
|
||||
# undo build configuration keyword merging after deduplication
|
||||
_unpack_libraries_with_build_configuration(rviz_camera_stream_LIBRARIES ${rviz_camera_stream_LIBRARIES})
|
||||
|
||||
_list_append_unique(rviz_camera_stream_LIBRARY_DIRS ${${rviz_camera_stream_dep}_LIBRARY_DIRS})
|
||||
_list_append_deduplicate(rviz_camera_stream_EXPORTED_TARGETS ${${rviz_camera_stream_dep}_EXPORTED_TARGETS})
|
||||
endforeach()
|
||||
|
||||
set(pkg_cfg_extras "")
|
||||
foreach(extra ${pkg_cfg_extras})
|
||||
if(NOT IS_ABSOLUTE ${extra})
|
||||
set(extra ${rviz_camera_stream_DIR}/${extra})
|
||||
endif()
|
||||
include(${extra})
|
||||
endforeach()
|
||||
@@ -0,0 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
# generated from catkin/cmake/templates/setup.bash.in
|
||||
|
||||
CATKIN_SHELL=bash
|
||||
|
||||
# source setup.sh from same directory as this file
|
||||
_CATKIN_SETUP_DIR=$(builtin cd "`dirname "${BASH_SOURCE[0]}"`" > /dev/null && pwd)
|
||||
. "$_CATKIN_SETUP_DIR/setup.sh"
|
||||
96
cmake-build-debug/catkin_generated/installspace/setup.sh
Normal file
96
cmake-build-debug/catkin_generated/installspace/setup.sh
Normal file
@@ -0,0 +1,96 @@
|
||||
#!/usr/bin/env sh
|
||||
# generated from catkin/cmake/template/setup.sh.in
|
||||
|
||||
# Sets various environment variables and sources additional environment hooks.
|
||||
# It tries it's best to undo changes from a previously sourced setup file before.
|
||||
# Supported command line options:
|
||||
# --extend: skips the undoing of changes from a previously sourced setup file
|
||||
# --local: only considers this workspace but not the chained ones
|
||||
# In plain sh shell which doesn't support arguments for sourced scripts you can
|
||||
# set the environment variable `CATKIN_SETUP_UTIL_ARGS=--extend/--local` instead.
|
||||
|
||||
# since this file is sourced either use the provided _CATKIN_SETUP_DIR
|
||||
# or fall back to the destination set at configure time
|
||||
: ${_CATKIN_SETUP_DIR:=/usr/local}
|
||||
_SETUP_UTIL="$_CATKIN_SETUP_DIR/_setup_util.py"
|
||||
unset _CATKIN_SETUP_DIR
|
||||
|
||||
if [ ! -f "$_SETUP_UTIL" ]; then
|
||||
echo "Missing Python script: $_SETUP_UTIL"
|
||||
return 22
|
||||
fi
|
||||
|
||||
# detect if running on Darwin platform
|
||||
_UNAME=`uname -s`
|
||||
_IS_DARWIN=0
|
||||
if [ "$_UNAME" = "Darwin" ]; then
|
||||
_IS_DARWIN=1
|
||||
fi
|
||||
unset _UNAME
|
||||
|
||||
# make sure to export all environment variables
|
||||
export CMAKE_PREFIX_PATH
|
||||
if [ $_IS_DARWIN -eq 0 ]; then
|
||||
export LD_LIBRARY_PATH
|
||||
else
|
||||
export DYLD_LIBRARY_PATH
|
||||
fi
|
||||
unset _IS_DARWIN
|
||||
export PATH
|
||||
export PKG_CONFIG_PATH
|
||||
export PYTHONPATH
|
||||
|
||||
# remember type of shell if not already set
|
||||
if [ -z "$CATKIN_SHELL" ]; then
|
||||
CATKIN_SHELL=sh
|
||||
fi
|
||||
|
||||
# invoke Python script to generate necessary exports of environment variables
|
||||
# use TMPDIR if it exists, otherwise fall back to /tmp
|
||||
if [ -d "${TMPDIR:-}" ]; then
|
||||
_TMPDIR="${TMPDIR}"
|
||||
else
|
||||
_TMPDIR=/tmp
|
||||
fi
|
||||
_SETUP_TMP=`mktemp "${_TMPDIR}/setup.sh.XXXXXXXXXX"`
|
||||
unset _TMPDIR
|
||||
if [ $? -ne 0 -o ! -f "$_SETUP_TMP" ]; then
|
||||
echo "Could not create temporary file: $_SETUP_TMP"
|
||||
return 1
|
||||
fi
|
||||
CATKIN_SHELL=$CATKIN_SHELL "$_SETUP_UTIL" $@ ${CATKIN_SETUP_UTIL_ARGS:-} >> "$_SETUP_TMP"
|
||||
_RC=$?
|
||||
if [ $_RC -ne 0 ]; then
|
||||
if [ $_RC -eq 2 ]; then
|
||||
echo "Could not write the output of '$_SETUP_UTIL' to temporary file '$_SETUP_TMP': may be the disk if full?"
|
||||
else
|
||||
echo "Failed to run '\"$_SETUP_UTIL\" $@': return code $_RC"
|
||||
fi
|
||||
unset _RC
|
||||
unset _SETUP_UTIL
|
||||
rm -f "$_SETUP_TMP"
|
||||
unset _SETUP_TMP
|
||||
return 1
|
||||
fi
|
||||
unset _RC
|
||||
unset _SETUP_UTIL
|
||||
. "$_SETUP_TMP"
|
||||
rm -f "$_SETUP_TMP"
|
||||
unset _SETUP_TMP
|
||||
|
||||
# source all environment hooks
|
||||
_i=0
|
||||
while [ $_i -lt $_CATKIN_ENVIRONMENT_HOOKS_COUNT ]; do
|
||||
eval _envfile=\$_CATKIN_ENVIRONMENT_HOOKS_$_i
|
||||
unset _CATKIN_ENVIRONMENT_HOOKS_$_i
|
||||
eval _envfile_workspace=\$_CATKIN_ENVIRONMENT_HOOKS_${_i}_WORKSPACE
|
||||
unset _CATKIN_ENVIRONMENT_HOOKS_${_i}_WORKSPACE
|
||||
# set workspace for environment hook
|
||||
CATKIN_ENV_HOOK_WORKSPACE=$_envfile_workspace
|
||||
. "$_envfile"
|
||||
unset CATKIN_ENV_HOOK_WORKSPACE
|
||||
_i=$((_i + 1))
|
||||
done
|
||||
unset _i
|
||||
|
||||
unset _CATKIN_ENVIRONMENT_HOOKS_COUNT
|
||||
@@ -0,0 +1,8 @@
|
||||
#!/usr/bin/env zsh
|
||||
# generated from catkin/cmake/templates/setup.zsh.in
|
||||
|
||||
CATKIN_SHELL=zsh
|
||||
|
||||
# source setup.sh from same directory as this file
|
||||
_CATKIN_SETUP_DIR=$(builtin cd -q "`dirname "$0"`" > /dev/null && pwd)
|
||||
emulate -R zsh -c 'source "$_CATKIN_SETUP_DIR/setup.sh"'
|
||||
1
cmake-build-debug/catkin_generated/ordered_paths.cmake
Normal file
1
cmake-build-debug/catkin_generated/ordered_paths.cmake
Normal file
@@ -0,0 +1 @@
|
||||
set(ORDERED_PATHS "/opt/ros/noetic/lib")
|
||||
16
cmake-build-debug/catkin_generated/package.cmake
Normal file
16
cmake-build-debug/catkin_generated/package.cmake
Normal file
@@ -0,0 +1,16 @@
|
||||
set(_CATKIN_CURRENT_PACKAGE "rviz_camera_stream")
|
||||
set(rviz_camera_stream_VERSION "1.0.1")
|
||||
set(rviz_camera_stream_MAINTAINER "Lucas Walter <wsacul@gmail.com>")
|
||||
set(rviz_camera_stream_PACKAGE_FORMAT "1")
|
||||
set(rviz_camera_stream_BUILD_DEPENDS "image_transport" "roscpp" "roslint" "rviz" "sensor_msgs")
|
||||
set(rviz_camera_stream_BUILD_EXPORT_DEPENDS "roscpp" "rviz" "tf")
|
||||
set(rviz_camera_stream_BUILDTOOL_DEPENDS "catkin")
|
||||
set(rviz_camera_stream_BUILDTOOL_EXPORT_DEPENDS )
|
||||
set(rviz_camera_stream_EXEC_DEPENDS "roscpp" "rviz" "tf")
|
||||
set(rviz_camera_stream_RUN_DEPENDS "roscpp" "rviz" "tf")
|
||||
set(rviz_camera_stream_TEST_DEPENDS )
|
||||
set(rviz_camera_stream_DOC_DEPENDS )
|
||||
set(rviz_camera_stream_URL_WEBSITE "https://github.com/lucasw/rviz_camera_stream")
|
||||
set(rviz_camera_stream_URL_BUGTRACKER "")
|
||||
set(rviz_camera_stream_URL_REPOSITORY "")
|
||||
set(rviz_camera_stream_DEPRECATED "")
|
||||
@@ -0,0 +1,8 @@
|
||||
# generated from catkin/cmake/template/pkg.context.pc.in
|
||||
CATKIN_PACKAGE_PREFIX = ""
|
||||
PROJECT_PKG_CONFIG_INCLUDE_DIRS = "".split(';') if "" != "" else []
|
||||
PROJECT_CATKIN_DEPENDS = "roscpp;rviz".replace(';', ' ')
|
||||
PKG_CONFIG_LIBRARIES_WITH_PREFIX = "".split(';') if "" != "" else []
|
||||
PROJECT_NAME = "rviz_camera_stream"
|
||||
PROJECT_SPACE_DIR = "/home/admin1/workspace/catkin_ws_ov/src/rviz_camera_stream/cmake-build-debug/devel"
|
||||
PROJECT_VERSION = "1.0.1"
|
||||
@@ -0,0 +1,8 @@
|
||||
# generated from catkin/cmake/template/pkg.context.pc.in
|
||||
CATKIN_PACKAGE_PREFIX = ""
|
||||
PROJECT_PKG_CONFIG_INCLUDE_DIRS = "".split(';') if "" != "" else []
|
||||
PROJECT_CATKIN_DEPENDS = "roscpp;rviz".replace(';', ' ')
|
||||
PKG_CONFIG_LIBRARIES_WITH_PREFIX = "".split(';') if "" != "" else []
|
||||
PROJECT_NAME = "rviz_camera_stream"
|
||||
PROJECT_SPACE_DIR = "/usr/local"
|
||||
PROJECT_VERSION = "1.0.1"
|
||||
11
cmake-build-debug/catkin_generated/setup_cached.sh
Executable file
11
cmake-build-debug/catkin_generated/setup_cached.sh
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env sh
|
||||
# generated from catkin/python/catkin/environment_cache.py
|
||||
|
||||
# based on a snapshot of the environment before and after calling the setup script
|
||||
# it emulates the modifications of the setup script without recurring computations
|
||||
|
||||
# new environment variables
|
||||
|
||||
# modified environment variables
|
||||
export CMAKE_PREFIX_PATH="/home/admin1/workspace/catkin_ws_ov/src/rviz_camera_stream/cmake-build-debug/devel:$CMAKE_PREFIX_PATH"
|
||||
export ROS_PACKAGE_PATH="/home/admin1/workspace/catkin_ws_ov/src/rviz_camera_stream:$ROS_PACKAGE_PATH"
|
||||
@@ -0,0 +1,304 @@
|
||||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Software License Agreement (BSD License)
|
||||
#
|
||||
# Copyright (c) 2012, Willow Garage, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the following
|
||||
# disclaimer in the documentation and/or other materials provided
|
||||
# with the distribution.
|
||||
# * Neither the name of Willow Garage, Inc. nor the names of its
|
||||
# contributors may be used to endorse or promote products derived
|
||||
# from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
"""This file generates shell code for the setup.SHELL scripts to set environment variables."""
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import argparse
|
||||
import copy
|
||||
import errno
|
||||
import os
|
||||
import platform
|
||||
import sys
|
||||
|
||||
CATKIN_MARKER_FILE = '.catkin'
|
||||
|
||||
system = platform.system()
|
||||
IS_DARWIN = (system == 'Darwin')
|
||||
IS_WINDOWS = (system == 'Windows')
|
||||
|
||||
PATH_TO_ADD_SUFFIX = ['bin']
|
||||
if IS_WINDOWS:
|
||||
# while catkin recommends putting dll's into bin, 3rd party packages often put dll's into lib
|
||||
# since Windows finds dll's via the PATH variable, prepend it with path to lib
|
||||
PATH_TO_ADD_SUFFIX.extend([['lib', os.path.join('lib', 'x86_64-linux-gnu')]])
|
||||
|
||||
# subfolder of workspace prepended to CMAKE_PREFIX_PATH
|
||||
ENV_VAR_SUBFOLDERS = {
|
||||
'CMAKE_PREFIX_PATH': '',
|
||||
'LD_LIBRARY_PATH' if not IS_DARWIN else 'DYLD_LIBRARY_PATH': ['lib', os.path.join('lib', 'x86_64-linux-gnu')],
|
||||
'PATH': PATH_TO_ADD_SUFFIX,
|
||||
'PKG_CONFIG_PATH': [os.path.join('lib', 'pkgconfig'), os.path.join('lib', 'x86_64-linux-gnu', 'pkgconfig')],
|
||||
'PYTHONPATH': 'lib/python3/dist-packages',
|
||||
}
|
||||
|
||||
|
||||
def rollback_env_variables(environ, env_var_subfolders):
|
||||
"""
|
||||
Generate shell code to reset environment variables.
|
||||
|
||||
by unrolling modifications based on all workspaces in CMAKE_PREFIX_PATH.
|
||||
This does not cover modifications performed by environment hooks.
|
||||
"""
|
||||
lines = []
|
||||
unmodified_environ = copy.copy(environ)
|
||||
for key in sorted(env_var_subfolders.keys()):
|
||||
subfolders = env_var_subfolders[key]
|
||||
if not isinstance(subfolders, list):
|
||||
subfolders = [subfolders]
|
||||
value = _rollback_env_variable(unmodified_environ, key, subfolders)
|
||||
if value is not None:
|
||||
environ[key] = value
|
||||
lines.append(assignment(key, value))
|
||||
if lines:
|
||||
lines.insert(0, comment('reset environment variables by unrolling modifications based on all workspaces in CMAKE_PREFIX_PATH'))
|
||||
return lines
|
||||
|
||||
|
||||
def _rollback_env_variable(environ, name, subfolders):
|
||||
"""
|
||||
For each catkin workspace in CMAKE_PREFIX_PATH remove the first entry from env[NAME] matching workspace + subfolder.
|
||||
|
||||
:param subfolders: list of str '' or subfoldername that may start with '/'
|
||||
:returns: the updated value of the environment variable.
|
||||
"""
|
||||
value = environ[name] if name in environ else ''
|
||||
env_paths = [path for path in value.split(os.pathsep) if path]
|
||||
value_modified = False
|
||||
for subfolder in subfolders:
|
||||
if subfolder:
|
||||
if subfolder.startswith(os.path.sep) or (os.path.altsep and subfolder.startswith(os.path.altsep)):
|
||||
subfolder = subfolder[1:]
|
||||
if subfolder.endswith(os.path.sep) or (os.path.altsep and subfolder.endswith(os.path.altsep)):
|
||||
subfolder = subfolder[:-1]
|
||||
for ws_path in _get_workspaces(environ, include_fuerte=True, include_non_existing=True):
|
||||
path_to_find = os.path.join(ws_path, subfolder) if subfolder else ws_path
|
||||
path_to_remove = None
|
||||
for env_path in env_paths:
|
||||
env_path_clean = env_path[:-1] if env_path and env_path[-1] in [os.path.sep, os.path.altsep] else env_path
|
||||
if env_path_clean == path_to_find:
|
||||
path_to_remove = env_path
|
||||
break
|
||||
if path_to_remove:
|
||||
env_paths.remove(path_to_remove)
|
||||
value_modified = True
|
||||
new_value = os.pathsep.join(env_paths)
|
||||
return new_value if value_modified else None
|
||||
|
||||
|
||||
def _get_workspaces(environ, include_fuerte=False, include_non_existing=False):
|
||||
"""
|
||||
Based on CMAKE_PREFIX_PATH return all catkin workspaces.
|
||||
|
||||
:param include_fuerte: The flag if paths starting with '/opt/ros/fuerte' should be considered workspaces, ``bool``
|
||||
"""
|
||||
# get all cmake prefix paths
|
||||
env_name = 'CMAKE_PREFIX_PATH'
|
||||
value = environ[env_name] if env_name in environ else ''
|
||||
paths = [path for path in value.split(os.pathsep) if path]
|
||||
# remove non-workspace paths
|
||||
workspaces = [path for path in paths if os.path.isfile(os.path.join(path, CATKIN_MARKER_FILE)) or (include_fuerte and path.startswith('/opt/ros/fuerte')) or (include_non_existing and not os.path.exists(path))]
|
||||
return workspaces
|
||||
|
||||
|
||||
def prepend_env_variables(environ, env_var_subfolders, workspaces):
|
||||
"""Generate shell code to prepend environment variables for the all workspaces."""
|
||||
lines = []
|
||||
lines.append(comment('prepend folders of workspaces to environment variables'))
|
||||
|
||||
paths = [path for path in workspaces.split(os.pathsep) if path]
|
||||
|
||||
prefix = _prefix_env_variable(environ, 'CMAKE_PREFIX_PATH', paths, '')
|
||||
lines.append(prepend(environ, 'CMAKE_PREFIX_PATH', prefix))
|
||||
|
||||
for key in sorted(key for key in env_var_subfolders.keys() if key != 'CMAKE_PREFIX_PATH'):
|
||||
subfolder = env_var_subfolders[key]
|
||||
prefix = _prefix_env_variable(environ, key, paths, subfolder)
|
||||
lines.append(prepend(environ, key, prefix))
|
||||
return lines
|
||||
|
||||
|
||||
def _prefix_env_variable(environ, name, paths, subfolders):
|
||||
"""
|
||||
Return the prefix to prepend to the environment variable NAME.
|
||||
|
||||
Adding any path in NEW_PATHS_STR without creating duplicate or empty items.
|
||||
"""
|
||||
value = environ[name] if name in environ else ''
|
||||
environ_paths = [path for path in value.split(os.pathsep) if path]
|
||||
checked_paths = []
|
||||
for path in paths:
|
||||
if not isinstance(subfolders, list):
|
||||
subfolders = [subfolders]
|
||||
for subfolder in subfolders:
|
||||
path_tmp = path
|
||||
if subfolder:
|
||||
path_tmp = os.path.join(path_tmp, subfolder)
|
||||
# skip nonexistent paths
|
||||
if not os.path.exists(path_tmp):
|
||||
continue
|
||||
# exclude any path already in env and any path we already added
|
||||
if path_tmp not in environ_paths and path_tmp not in checked_paths:
|
||||
checked_paths.append(path_tmp)
|
||||
prefix_str = os.pathsep.join(checked_paths)
|
||||
if prefix_str != '' and environ_paths:
|
||||
prefix_str += os.pathsep
|
||||
return prefix_str
|
||||
|
||||
|
||||
def assignment(key, value):
|
||||
if not IS_WINDOWS:
|
||||
return 'export %s="%s"' % (key, value)
|
||||
else:
|
||||
return 'set %s=%s' % (key, value)
|
||||
|
||||
|
||||
def comment(msg):
|
||||
if not IS_WINDOWS:
|
||||
return '# %s' % msg
|
||||
else:
|
||||
return 'REM %s' % msg
|
||||
|
||||
|
||||
def prepend(environ, key, prefix):
|
||||
if key not in environ or not environ[key]:
|
||||
return assignment(key, prefix)
|
||||
if not IS_WINDOWS:
|
||||
return 'export %s="%s$%s"' % (key, prefix, key)
|
||||
else:
|
||||
return 'set %s=%s%%%s%%' % (key, prefix, key)
|
||||
|
||||
|
||||
def find_env_hooks(environ, cmake_prefix_path):
|
||||
"""Generate shell code with found environment hooks for the all workspaces."""
|
||||
lines = []
|
||||
lines.append(comment('found environment hooks in workspaces'))
|
||||
|
||||
generic_env_hooks = []
|
||||
generic_env_hooks_workspace = []
|
||||
specific_env_hooks = []
|
||||
specific_env_hooks_workspace = []
|
||||
generic_env_hooks_by_filename = {}
|
||||
specific_env_hooks_by_filename = {}
|
||||
generic_env_hook_ext = 'bat' if IS_WINDOWS else 'sh'
|
||||
specific_env_hook_ext = environ['CATKIN_SHELL'] if not IS_WINDOWS and 'CATKIN_SHELL' in environ and environ['CATKIN_SHELL'] else None
|
||||
# remove non-workspace paths
|
||||
workspaces = [path for path in cmake_prefix_path.split(os.pathsep) if path and os.path.isfile(os.path.join(path, CATKIN_MARKER_FILE))]
|
||||
for workspace in reversed(workspaces):
|
||||
env_hook_dir = os.path.join(workspace, 'etc', 'catkin', 'profile.d')
|
||||
if os.path.isdir(env_hook_dir):
|
||||
for filename in sorted(os.listdir(env_hook_dir)):
|
||||
if filename.endswith('.%s' % generic_env_hook_ext):
|
||||
# remove previous env hook with same name if present
|
||||
if filename in generic_env_hooks_by_filename:
|
||||
i = generic_env_hooks.index(generic_env_hooks_by_filename[filename])
|
||||
generic_env_hooks.pop(i)
|
||||
generic_env_hooks_workspace.pop(i)
|
||||
# append env hook
|
||||
generic_env_hooks.append(os.path.join(env_hook_dir, filename))
|
||||
generic_env_hooks_workspace.append(workspace)
|
||||
generic_env_hooks_by_filename[filename] = generic_env_hooks[-1]
|
||||
elif specific_env_hook_ext is not None and filename.endswith('.%s' % specific_env_hook_ext):
|
||||
# remove previous env hook with same name if present
|
||||
if filename in specific_env_hooks_by_filename:
|
||||
i = specific_env_hooks.index(specific_env_hooks_by_filename[filename])
|
||||
specific_env_hooks.pop(i)
|
||||
specific_env_hooks_workspace.pop(i)
|
||||
# append env hook
|
||||
specific_env_hooks.append(os.path.join(env_hook_dir, filename))
|
||||
specific_env_hooks_workspace.append(workspace)
|
||||
specific_env_hooks_by_filename[filename] = specific_env_hooks[-1]
|
||||
env_hooks = generic_env_hooks + specific_env_hooks
|
||||
env_hooks_workspace = generic_env_hooks_workspace + specific_env_hooks_workspace
|
||||
count = len(env_hooks)
|
||||
lines.append(assignment('_CATKIN_ENVIRONMENT_HOOKS_COUNT', count))
|
||||
for i in range(count):
|
||||
lines.append(assignment('_CATKIN_ENVIRONMENT_HOOKS_%d' % i, env_hooks[i]))
|
||||
lines.append(assignment('_CATKIN_ENVIRONMENT_HOOKS_%d_WORKSPACE' % i, env_hooks_workspace[i]))
|
||||
return lines
|
||||
|
||||
|
||||
def _parse_arguments(args=None):
|
||||
parser = argparse.ArgumentParser(description='Generates code blocks for the setup.SHELL script.')
|
||||
parser.add_argument('--extend', action='store_true', help='Skip unsetting previous environment variables to extend context')
|
||||
parser.add_argument('--local', action='store_true', help='Only consider this prefix path and ignore other prefix path in the environment')
|
||||
return parser.parse_known_args(args=args)[0]
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
try:
|
||||
try:
|
||||
args = _parse_arguments()
|
||||
except Exception as e:
|
||||
print(e, file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
if not args.local:
|
||||
# environment at generation time
|
||||
CMAKE_PREFIX_PATH = r'/opt/ros/noetic'.split(';')
|
||||
else:
|
||||
# don't consider any other prefix path than this one
|
||||
CMAKE_PREFIX_PATH = []
|
||||
# prepend current workspace if not already part of CPP
|
||||
base_path = os.path.dirname(__file__)
|
||||
# CMAKE_PREFIX_PATH uses forward slash on all platforms, but __file__ is platform dependent
|
||||
# base_path on Windows contains backward slashes, need to be converted to forward slashes before comparison
|
||||
if os.path.sep != '/':
|
||||
base_path = base_path.replace(os.path.sep, '/')
|
||||
|
||||
if base_path not in CMAKE_PREFIX_PATH:
|
||||
CMAKE_PREFIX_PATH.insert(0, base_path)
|
||||
CMAKE_PREFIX_PATH = os.pathsep.join(CMAKE_PREFIX_PATH)
|
||||
|
||||
environ = dict(os.environ)
|
||||
lines = []
|
||||
if not args.extend:
|
||||
lines += rollback_env_variables(environ, ENV_VAR_SUBFOLDERS)
|
||||
lines += prepend_env_variables(environ, ENV_VAR_SUBFOLDERS, CMAKE_PREFIX_PATH)
|
||||
lines += find_env_hooks(environ, CMAKE_PREFIX_PATH)
|
||||
print('\n'.join(lines))
|
||||
|
||||
# need to explicitly flush the output
|
||||
sys.stdout.flush()
|
||||
except IOError as e:
|
||||
# and catch potential "broken pipe" if stdout is not writable
|
||||
# which can happen when piping the output to a file but the disk is full
|
||||
if e.errno == errno.EPIPE:
|
||||
print(e, file=sys.stderr)
|
||||
sys.exit(2)
|
||||
raise
|
||||
|
||||
sys.exit(0)
|
||||
@@ -0,0 +1,255 @@
|
||||
# Software License Agreement (BSD License)
|
||||
#
|
||||
# Copyright (c) 2012, Willow Garage, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the following
|
||||
# disclaimer in the documentation and/or other materials provided
|
||||
# with the distribution.
|
||||
# * Neither the name of Willow Garage, Inc. nor the names of its
|
||||
# contributors may be used to endorse or promote products derived
|
||||
# from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import os
|
||||
import runpy
|
||||
import sys
|
||||
from argparse import ArgumentParser
|
||||
|
||||
setup_modules = []
|
||||
|
||||
try:
|
||||
import distutils.core
|
||||
setup_modules.append(distutils.core)
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
try:
|
||||
import setuptools
|
||||
setup_modules.append(setuptools)
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
assert setup_modules, 'Must have distutils or setuptools installed'
|
||||
|
||||
|
||||
def _get_locations(pkgs, package_dir):
|
||||
"""
|
||||
Based on setuptools logic and the package_dir dict, builds a dict of location roots for each pkg in pkgs.
|
||||
|
||||
See http://docs.python.org/distutils/setupscript.html
|
||||
|
||||
:returns: a dict {pkgname: root} for each pkgname in pkgs (and each of their parents)
|
||||
"""
|
||||
# package_dir contains a dict {package_name: relativepath}
|
||||
# Example {'': 'src', 'foo': 'lib', 'bar': 'lib2'}
|
||||
#
|
||||
# '' means where to look for any package unless a parent package
|
||||
# is listed so package bar.pot is expected at lib2/bar/pot,
|
||||
# whereas package sup.dee is expected at src/sup/dee
|
||||
#
|
||||
# if package_dir does not state anything about a package,
|
||||
# setuptool expects the package folder to be in the root of the
|
||||
# project
|
||||
locations = {}
|
||||
allprefix = package_dir.get('', '')
|
||||
for pkg in pkgs:
|
||||
parent_location = None
|
||||
splits = pkg.split('.')
|
||||
# we iterate over compound name from parent to child
|
||||
# so once we found parent, children just append to their parent
|
||||
for key_len in range(len(splits)):
|
||||
key = '.'.join(splits[:key_len + 1])
|
||||
if key not in locations:
|
||||
if key in package_dir:
|
||||
locations[key] = package_dir[key]
|
||||
elif parent_location is not None:
|
||||
locations[key] = os.path.join(parent_location, splits[key_len])
|
||||
else:
|
||||
locations[key] = os.path.join(allprefix, key)
|
||||
parent_location = locations[key]
|
||||
return locations
|
||||
|
||||
|
||||
def generate_cmake_file(package_name, version, scripts, package_dir, pkgs, modules, setup_module=None):
|
||||
"""
|
||||
Generate lines to add to a cmake file which will set variables.
|
||||
|
||||
:param version: str, format 'int.int.int'
|
||||
:param scripts: [list of str]: relative paths to scripts
|
||||
:param package_dir: {modulename: path}
|
||||
:param pkgs: [list of str] python_packages declared in catkin package
|
||||
:param modules: [list of str] python modules
|
||||
:param setup_module: str, setuptools or distutils
|
||||
"""
|
||||
prefix = '%s_SETUP_PY' % package_name
|
||||
result = []
|
||||
if setup_module:
|
||||
result.append(r'set(%s_SETUP_MODULE "%s")' % (prefix, setup_module))
|
||||
result.append(r'set(%s_VERSION "%s")' % (prefix, version))
|
||||
result.append(r'set(%s_SCRIPTS "%s")' % (prefix, ';'.join(scripts)))
|
||||
|
||||
# Remove packages with '.' separators.
|
||||
#
|
||||
# setuptools allows specifying submodules in other folders than
|
||||
# their parent
|
||||
#
|
||||
# The symlink approach of catkin does not work with such submodules.
|
||||
# In the common case, this does not matter as the submodule is
|
||||
# within the containing module. We verify this assumption, and if
|
||||
# it passes, we remove submodule packages.
|
||||
locations = _get_locations(pkgs, package_dir)
|
||||
for pkgname, location in locations.items():
|
||||
if '.' not in pkgname:
|
||||
continue
|
||||
splits = pkgname.split('.')
|
||||
# hack: ignore write-combining setup.py files for msg and srv files
|
||||
if splits[1] in ['msg', 'srv']:
|
||||
continue
|
||||
# check every child has the same root folder as its parent
|
||||
root_name = splits[0]
|
||||
root_location = location
|
||||
for _ in range(len(splits) - 1):
|
||||
root_location = os.path.dirname(root_location)
|
||||
if root_location != locations[root_name]:
|
||||
raise RuntimeError(
|
||||
'catkin_export_python does not support setup.py files that combine across multiple directories: %s in %s, %s in %s' % (pkgname, location, root_name, locations[root_name]))
|
||||
|
||||
# If checks pass, remove all submodules
|
||||
pkgs = [p for p in pkgs if '.' not in p]
|
||||
|
||||
resolved_pkgs = []
|
||||
for pkg in pkgs:
|
||||
resolved_pkgs += [locations[pkg]]
|
||||
|
||||
result.append(r'set(%s_PACKAGES "%s")' % (prefix, ';'.join(pkgs)))
|
||||
result.append(r'set(%s_PACKAGE_DIRS "%s")' % (prefix, ';'.join(resolved_pkgs).replace('\\', '/')))
|
||||
|
||||
# skip modules which collide with package names
|
||||
filtered_modules = []
|
||||
for modname in modules:
|
||||
splits = modname.split('.')
|
||||
# check all parents too
|
||||
equals_package = [('.'.join(splits[:-i]) in locations) for i in range(len(splits))]
|
||||
if any(equals_package):
|
||||
continue
|
||||
filtered_modules.append(modname)
|
||||
module_locations = _get_locations(filtered_modules, package_dir)
|
||||
|
||||
result.append(r'set(%s_MODULES "%s")' % (prefix, ';'.join(['%s.py' % m.replace('.', '/') for m in filtered_modules])))
|
||||
result.append(r'set(%s_MODULE_DIRS "%s")' % (prefix, ';'.join([module_locations[m] for m in filtered_modules]).replace('\\', '/')))
|
||||
|
||||
return result
|
||||
|
||||
|
||||
def _create_mock_setup_function(setup_module, package_name, outfile):
|
||||
"""
|
||||
Create a function to call instead of distutils.core.setup or setuptools.setup.
|
||||
|
||||
It just captures some args and writes them into a file that can be used from cmake.
|
||||
|
||||
:param package_name: name of the package
|
||||
:param outfile: filename that cmake will use afterwards
|
||||
:returns: a function to replace disutils.core.setup and setuptools.setup
|
||||
"""
|
||||
|
||||
def setup(*args, **kwargs):
|
||||
"""Check kwargs and write a scriptfile."""
|
||||
if 'version' not in kwargs:
|
||||
sys.stderr.write("\n*** Unable to find 'version' in setup.py of %s\n" % package_name)
|
||||
raise RuntimeError('version not found in setup.py')
|
||||
version = kwargs['version']
|
||||
package_dir = kwargs.get('package_dir', {})
|
||||
|
||||
pkgs = kwargs.get('packages', [])
|
||||
scripts = kwargs.get('scripts', [])
|
||||
modules = kwargs.get('py_modules', [])
|
||||
|
||||
unsupported_args = [
|
||||
'entry_points',
|
||||
'exclude_package_data',
|
||||
'ext_modules ',
|
||||
'ext_package',
|
||||
'include_package_data',
|
||||
'namespace_packages',
|
||||
'setup_requires',
|
||||
'use_2to3',
|
||||
'zip_safe']
|
||||
used_unsupported_args = [arg for arg in unsupported_args if arg in kwargs]
|
||||
if used_unsupported_args:
|
||||
sys.stderr.write('*** Arguments %s to setup() not supported in catkin devel space in setup.py of %s\n' % (used_unsupported_args, package_name))
|
||||
|
||||
result = generate_cmake_file(package_name=package_name,
|
||||
version=version,
|
||||
scripts=scripts,
|
||||
package_dir=package_dir,
|
||||
pkgs=pkgs,
|
||||
modules=modules,
|
||||
setup_module=setup_module)
|
||||
with open(outfile, 'w') as out:
|
||||
out.write('\n'.join(result))
|
||||
|
||||
return setup
|
||||
|
||||
|
||||
def main():
|
||||
"""Script main, parses arguments and invokes Dummy.setup indirectly."""
|
||||
parser = ArgumentParser(description='Utility to read setup.py values from cmake macros. Creates a file with CMake set commands setting variables.')
|
||||
parser.add_argument('package_name', help='Name of catkin package')
|
||||
parser.add_argument('setupfile_path', help='Full path to setup.py')
|
||||
parser.add_argument('outfile', help='Where to write result to')
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
# print("%s" % sys.argv)
|
||||
# PACKAGE_NAME = sys.argv[1]
|
||||
# OUTFILE = sys.argv[3]
|
||||
# print("Interrogating setup.py for package %s into %s " % (PACKAGE_NAME, OUTFILE),
|
||||
# file=sys.stderr)
|
||||
|
||||
# print("executing %s" % args.setupfile_path)
|
||||
|
||||
# be sure you're in the directory containing
|
||||
# setup.py so the sys.path manipulation works,
|
||||
# so the import of __version__ works
|
||||
os.chdir(os.path.dirname(os.path.abspath(args.setupfile_path)))
|
||||
|
||||
# patch setup() function of distutils and setuptools for the
|
||||
# context of evaluating setup.py
|
||||
backup_modules = {}
|
||||
try:
|
||||
|
||||
for module in setup_modules:
|
||||
backup_modules[id(module)] = module.setup
|
||||
module.setup = _create_mock_setup_function(
|
||||
setup_module=module.__name__, package_name=args.package_name, outfile=args.outfile)
|
||||
|
||||
runpy.run_path(args.setupfile_path)
|
||||
finally:
|
||||
for module in setup_modules:
|
||||
module.setup = backup_modules[id(module)]
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
@@ -0,0 +1,29 @@
|
||||
<package>
|
||||
<name>rviz_camera_stream</name>
|
||||
<version>1.0.1</version>
|
||||
<description>
|
||||
Publish a camera view as rendered by rviz on an Image topic
|
||||
</description>
|
||||
|
||||
<maintainer email="wsacul@gmail.com">Lucas Walter</maintainer>
|
||||
<author email="tbd@tbd.com">Mikhail Medvedev</author>
|
||||
|
||||
<license>BSD</license>
|
||||
|
||||
<url type="website">https://github.com/lucasw/rviz_camera_stream</url>
|
||||
|
||||
<buildtool_depend>catkin</buildtool_depend>
|
||||
<build_depend>image_transport</build_depend>
|
||||
<build_depend>roscpp</build_depend>
|
||||
<build_depend>roslint</build_depend>
|
||||
<build_depend>rviz</build_depend>
|
||||
<build_depend>sensor_msgs</build_depend>
|
||||
|
||||
<run_depend>roscpp</run_depend>
|
||||
<run_depend>rviz</run_depend>
|
||||
<run_depend>tf</run_depend>
|
||||
|
||||
<export>
|
||||
<rviz plugin="${prefix}/plugin_description.xml"/>
|
||||
</export>
|
||||
</package>
|
||||
@@ -0,0 +1,8 @@
|
||||
prefix=@PROJECT_SPACE_DIR
|
||||
|
||||
Name: @(CATKIN_PACKAGE_PREFIX + PROJECT_NAME)
|
||||
Description: Description of @PROJECT_NAME
|
||||
Version: @PROJECT_VERSION
|
||||
Cflags: @(' '.join(['-I%s' % include for include in PROJECT_PKG_CONFIG_INCLUDE_DIRS]))
|
||||
Libs: -L${prefix}/lib @(' '.join(PKG_CONFIG_LIBRARIES_WITH_PREFIX))
|
||||
Requires: @(PROJECT_CATKIN_DEPENDS)
|
||||
Reference in New Issue
Block a user