python_setup.py
Go to the documentation of this file.
1 import os
2 from ros_introspection.cmake import Command
3 from ros_introspection.setup_py import SetupPy
4 from util import roscompile
5 
6 
7 def has_python(package):
8  return len(package.source_code.get_source_by_language('python')) > 0
9 
10 
11 def has_python_library(package):
12  key = 'src/%s' % package.name
13  for source in package.source_code.get_source_by_language('python'):
14  if key in source.rel_fn:
15  return True
16  return False
17 
18 
19 @roscompile
20 def check_setup_py(package):
21  if not has_python(package):
22  return
23  if package.setup_py is None:
24  if not has_python_library(package):
25  # No library, and no existing setup_py means nothing to write
26  return
27  package.setup_py = SetupPy(package.name, os.path.join(package.root, 'setup.py'))
28 
29  if 'catkin_python_setup' not in package.cmake.content_map:
30  package.cmake.add_command(Command('catkin_python_setup'))
31 
32 
33 @roscompile
35  execs = [source.rel_fn for source in package.source_code.get_source_by_language('python') if source.is_executable()]
36  if len(execs) == 0:
37  return
38  cmd = 'catkin_install_python'
39  if cmd not in package.cmake.content_map:
40  cmake_cmd = Command(cmd)
41  cmake_cmd.add_section('PROGRAMS', execs)
42  cmake_cmd.add_section('DESTINATION', ['${CATKIN_PACKAGE_BIN_DESTINATION}'])
43  package.cmake.add_command(cmake_cmd)
44  else:
45  package.cmake.section_check(execs, cmd, 'PROGRAMS')
def update_python_installs(package)
Definition: python_setup.py:34
def has_python(package)
Definition: python_setup.py:7
def check_setup_py(package)
Definition: python_setup.py:20
def has_python_library(package)
Definition: python_setup.py:11


roscompile
Author(s):
autogenerated on Wed Jun 19 2019 19:56:53