├── .github
├── ISSUE_TEMPLATE.md
└── workflows
│ └── workflow.yml
├── .gitignore
├── .readthedocs.yaml
├── CHANGELOG.rst
├── LICENSE
├── MANIFEST.in
├── README.md
├── catkin_tools
├── __init__.py
├── argument_parsing.py
├── commands
│ ├── __init__.py
│ └── catkin.py
├── common.py
├── config.py
├── context.py
├── execution
│ ├── __init__.py
│ ├── controllers.py
│ ├── events.py
│ ├── executor.py
│ ├── io.py
│ ├── job_server.py
│ ├── jobs.py
│ └── stages.py
├── jobs
│ ├── __init__.py
│ ├── catkin.py
│ ├── cmake.py
│ ├── cmake
│ │ ├── python.cmake
│ │ └── python_install_dir.cmake
│ ├── commands
│ │ ├── __init__.py
│ │ ├── cmake.py
│ │ └── make.py
│ └── utils.py
├── metadata.py
├── notifications
│ ├── __init__.py
│ ├── impl.py
│ └── resources
│ │ ├── linux
│ │ ├── catkin_icon.png
│ │ ├── catkin_icon_red.png
│ │ └── catkin_icon_yellow.png
│ │ └── osx
│ │ ├── catkin build.app
│ │ └── Contents
│ │ │ ├── Info.plist
│ │ │ ├── MacOS
│ │ │ └── catkin build
│ │ │ ├── PkgInfo
│ │ │ └── Resources
│ │ │ ├── AppIcon.icns
│ │ │ ├── catkin_blue_logo_only.icns
│ │ │ └── en.lproj
│ │ │ ├── Credits.rtf
│ │ │ ├── InfoPlist.strings
│ │ │ └── MainMenu.nib
│ │ └── catkin_build_notifier_src
│ │ ├── .gitignore
│ │ ├── AppIcon.icns
│ │ ├── README.markdown
│ │ ├── Terminal Notifier.xcodeproj
│ │ ├── project.pbxproj
│ │ ├── project.xcworkspace
│ │ │ ├── contents.xcworkspacedata
│ │ │ └── xcshareddata
│ │ │ │ └── Terminal Notifier.xccheckout
│ │ └── xcshareddata
│ │ │ └── xcschemes
│ │ │ └── Terminal Notifier.xcscheme
│ │ ├── Terminal Notifier
│ │ ├── AppDelegate.h
│ │ ├── AppDelegate.m
│ │ ├── Terminal Notifier-Info.plist
│ │ ├── Terminal Notifier-Prefix.pch
│ │ ├── en.lproj
│ │ │ ├── Credits.rtf
│ │ │ ├── InfoPlist.strings
│ │ │ └── MainMenu.xib
│ │ └── main.m
│ │ ├── catkin_blue_logo_only.icns
│ │ └── terminal-notifier
│ │ └── Images.xcassets
│ │ └── AppIcon.appiconset
│ │ ├── Contents.json
│ │ ├── catkin_blue_logo_only128x128.png
│ │ ├── catkin_blue_logo_only16x16.png
│ │ ├── catkin_blue_logo_only256x256.png
│ │ ├── catkin_blue_logo_only32x32.png
│ │ └── catkin_blue_logo_only512x512.png
├── resultspace.py
├── spaces
│ ├── __init__.py
│ ├── build.py
│ ├── devel.py
│ ├── install.py
│ ├── log.py
│ └── source.py
├── terminal_color.py
├── utils.py
└── verbs
│ ├── __init__.py
│ ├── catkin_build
│ ├── __init__.py
│ ├── build.py
│ ├── cli.py
│ └── color.py
│ ├── catkin_clean
│ ├── __init__.py
│ ├── clean.py
│ └── cli.py
│ ├── catkin_config
│ ├── __init__.py
│ └── cli.py
│ ├── catkin_create
│ ├── __init__.py
│ └── cli.py
│ ├── catkin_env
│ ├── __init__.py
│ └── cli.py
│ ├── catkin_init
│ ├── __init__.py
│ └── cli.py
│ ├── catkin_list
│ ├── __init__.py
│ └── cli.py
│ ├── catkin_locate
│ ├── __init__.py
│ └── cli.py
│ ├── catkin_profile
│ ├── __init__.py
│ └── cli.py
│ ├── catkin_shell_verbs.bash
│ └── catkin_test
│ ├── __init__.py
│ ├── cli.py
│ └── test.py
├── completion
├── _catkin
└── catkin.bash
├── docs
├── .gitignore
├── Makefile
├── _static
│ └── .gitignore
├── _templates
│ └── .gitignore
├── advanced
│ ├── catkin_shell_verbs.rst
│ ├── executor_events.dia
│ ├── executor_events.svg
│ ├── executor_job_lifecycle.svg
│ ├── executor_job_resources.svg
│ ├── job_executor.rst
│ ├── linked_develspace.rst
│ └── verb_customization.rst
├── build_types.rst
├── catkin_build.dia
├── catkin_tools_execution.dia
├── cheat_sheet.rst
├── conf.py
├── development
│ ├── adding_build_types.rst
│ └── extending_the_catkin_command.rst
├── examples
│ ├── README.md
│ ├── failure_ws
│ │ ├── 0_init.bash
│ │ ├── 1_build_warning.bash
│ │ ├── 2_build_err.bash
│ │ ├── all.bash
│ │ └── src
│ │ │ ├── catkin_pkg_cmake_err
│ │ │ ├── CMakeLists.txt
│ │ │ ├── package.xml
│ │ │ └── sub
│ │ │ │ └── CMakeLists.txt
│ │ │ ├── catkin_pkg_cmake_warn
│ │ │ ├── CMakeLists.txt
│ │ │ └── package.xml
│ │ │ ├── catkin_pkg_make_err
│ │ │ ├── CMakeLists.txt
│ │ │ ├── main.cpp
│ │ │ └── package.xml
│ │ │ └── catkin_pkg_make_warn
│ │ │ ├── CMakeLists.txt
│ │ │ ├── grep-errors.txt
│ │ │ ├── main.cpp
│ │ │ └── package.xml
│ ├── quickstart_ws
│ │ ├── 0_quickstart.bash
│ │ ├── 1_prebuild.bash
│ │ ├── 1_prebuild.out
│ │ ├── 2_postbuild.bash
│ │ ├── 2_postbuild.out
│ │ └── all.bash
│ ├── ros_tutorials_ws
│ │ ├── 0_checkout.bash
│ │ ├── 1_init.bash
│ │ ├── 2_dry_run.bash
│ │ ├── 3_build.bash
│ │ ├── 4_build_v.bash
│ │ ├── 5_build_i.bash
│ │ ├── 6_build_partial.bash
│ │ ├── 7_build_this.bash
│ │ ├── 8_build_start_with.bash
│ │ ├── 9_build_no_deps.bash
│ │ └── all.bash
│ ├── slowrecord
│ └── slowrun
├── executor_job_lifecycle.dia
├── executor_job_lifecycle.svg
├── history.rst
├── index.rst
├── installing.rst
├── make.bat
├── mechanics.rst
├── migration.rst
├── quick_start.rst
├── requirements.txt
├── spelling_wordlist.txt
├── troubleshooting.rst
└── verbs
│ ├── catkin_build.rst
│ ├── catkin_clean.rst
│ ├── catkin_config.rst
│ ├── catkin_create.rst
│ ├── catkin_env.rst
│ ├── catkin_init.rst
│ ├── catkin_list.rst
│ ├── catkin_locate.rst
│ ├── catkin_profile.rst
│ ├── catkin_test.rst
│ └── cli
│ ├── catkin_build.txt
│ ├── catkin_clean.txt
│ ├── catkin_config.txt
│ ├── catkin_create.txt
│ ├── catkin_create_pkg.txt
│ ├── catkin_env.txt
│ ├── catkin_init.txt
│ ├── catkin_list.txt
│ ├── catkin_locate.txt
│ ├── catkin_profile.txt
│ ├── catkin_profile_add.txt
│ ├── catkin_profile_list.txt
│ ├── catkin_profile_remove.txt
│ ├── catkin_profile_rename.txt
│ ├── catkin_profile_set.txt
│ ├── catkin_test.txt
│ └── dump_cli
├── requirements.txt
├── setup.py
├── stdeb.cfg
└── tests
├── README.md
├── __init__.py
├── system
├── __init__.py
├── resources
│ ├── catkin_pkgs
│ │ ├── build_type_condition
│ │ │ ├── CMakeLists.txt
│ │ │ └── package.xml
│ │ ├── cmake_args
│ │ │ ├── CMakeLists.txt
│ │ │ └── package.xml
│ │ ├── cmake_err
│ │ │ ├── CMakeLists.txt
│ │ │ └── package.xml
│ │ ├── cmake_warning
│ │ │ ├── CMakeLists.txt
│ │ │ └── package.xml
│ │ ├── depend_condition
│ │ │ ├── CMakeLists.txt
│ │ │ └── package.xml
│ │ ├── make_err
│ │ │ ├── CMakeLists.txt
│ │ │ ├── fail.cpp
│ │ │ └── package.xml
│ │ ├── make_warning
│ │ │ ├── CMakeLists.txt
│ │ │ ├── package.xml
│ │ │ └── warn.cpp
│ │ ├── products_0
│ │ │ ├── CMakeLists.txt
│ │ │ ├── cmake
│ │ │ │ ├── extras.cmake.develspace.in
│ │ │ │ └── extras.cmake.installspace.in
│ │ │ ├── include
│ │ │ │ └── make_products_0
│ │ │ │ │ └── fun.h
│ │ │ ├── lib.cpp
│ │ │ ├── main.cpp
│ │ │ └── package.xml
│ │ ├── products_unicode
│ │ │ ├── CMakeLists.txt
│ │ │ ├── cmake
│ │ │ │ ├── extras.cmake.develspace.in
│ │ │ │ └── extras.cmake.installspace.in
│ │ │ ├── include
│ │ │ │ └── make_products_0
│ │ │ │ │ └── fun.h
│ │ │ ├── lib.cpp
│ │ │ ├── main.cpp
│ │ │ └── package.xml
│ │ ├── python_pkg
│ │ │ ├── CMakeLists.txt
│ │ │ ├── package.xml
│ │ │ ├── setup.py
│ │ │ └── src
│ │ │ │ └── python_pkg
│ │ │ │ ├── __init__.py
│ │ │ │ └── lib.py
│ │ ├── python_tests
│ │ │ ├── CMakeLists.txt
│ │ │ ├── package.xml
│ │ │ ├── setup.py
│ │ │ └── test_good.py
│ │ ├── python_tests_err
│ │ │ ├── CMakeLists.txt
│ │ │ ├── package.xml
│ │ │ ├── setup.py
│ │ │ └── test_bad.py
│ │ └── python_tests_targets
│ │ │ ├── CMakeLists.txt
│ │ │ ├── package.xml
│ │ │ ├── setup.py
│ │ │ ├── test_bad.py
│ │ │ └── test_good.py
│ ├── cmake_pkgs
│ │ ├── app_pkg
│ │ │ ├── CMakeLists.txt
│ │ │ ├── package.xml
│ │ │ └── vanilla.cpp
│ │ ├── cmake_pkg
│ │ │ ├── CMakeLists.txt
│ │ │ ├── package.xml
│ │ │ └── vanilla.cpp
│ │ ├── lib_pkg
│ │ │ ├── CMakeLists.txt
│ │ │ ├── Config.cmake.in
│ │ │ ├── package.xml
│ │ │ ├── vanilla.cpp
│ │ │ └── vanilla.h
│ │ ├── test_err_pkg
│ │ │ ├── CMakeLists.txt
│ │ │ ├── package.xml
│ │ │ └── test.cpp
│ │ └── test_pkg
│ │ │ ├── CMakeLists.txt
│ │ │ ├── package.xml
│ │ │ └── test.cpp
│ └── ros_pkgs
│ │ └── pkg_with_roslint
│ │ ├── CMakeLists.txt
│ │ ├── main.cpp
│ │ └── package.xml
├── verbs
│ ├── __init__.py
│ ├── catkin_build
│ │ ├── __init__.py
│ │ ├── test_args.py
│ │ ├── test_build.py
│ │ ├── test_bwlists.py
│ │ ├── test_context.py
│ │ ├── test_eclipse.py
│ │ ├── test_modify_ws.py
│ │ ├── test_pythonpath.py
│ │ ├── test_unicode_in_env.py
│ │ └── test_whitespace_in_paths.py
│ ├── catkin_clean
│ │ ├── __init__.py
│ │ └── clean.py
│ ├── catkin_config
│ │ ├── __init__.py
│ │ └── test_config.py
│ ├── catkin_init
│ │ ├── __init__.py
│ │ └── test_init.py
│ ├── catkin_profile
│ │ ├── __init__.py
│ │ └── test_profile.py
│ └── catkin_test
│ │ ├── __init__.py
│ │ └── test_unit_tests.py
└── workspace_factory.py
├── unit
├── __init__.py
├── ascii_text.txt
├── test_common.py
├── test_config.py
├── test_io.py
├── test_job_flag_regex.py
├── test_jobs.py
└── unicode_text.txt
├── utils.py
└── workspace_assertions.py
/.github/ISSUE_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | [//]: # (Thank you for reporting an issue for catkin_tools!)
2 |
3 | [//]: # (Please fill out the details below so that your issue can be resolved quickly!)
4 | [//]: # (If you want to suggest a feature or start a discussion, feel free to delete them.)
5 |
6 | ### System Info
7 |
8 | * Operating System: `uname -a`
9 | * Python Version: `python --version`
10 | * Version of catkin_tools: `catkin --version` OR *Git revision*
11 | * ROS Distro: `echo $ROS_DISTRO`
12 |
13 | ### Build / Run Issue
14 |
15 | [//]: # (If you are migrating from catkin_make, please follow the migration guide:)
16 | [//]: # (https://catkin-tools.readthedocs.org/en/latest/migration.html)
17 |
18 | [//]: # (Please also check for solved issues here:)
19 | [//]: # (https://catkin-tools.readthedocs.org/en/latest/troubleshooting.html)
20 |
21 | [//]: # (And check for open issues here:)
22 | [//]: # (https://github.com/catkin/catkin_tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug)
23 |
24 | [//]: # (If you have an issue building and running code, please verify the following:)
25 |
26 | * [ ] Works with `catkin_make`
27 | * [ ] Works with `catkin_make_isolated --merge`
28 | * [ ] Works with `catkin build`
29 | * [ ] Works with `catkin build -p1`
30 | * [x] I did not `read this`
31 |
32 | ### Expected Behavior
33 |
34 | [//]: # (Please describe what you expected or think should happen.)
35 |
36 |
37 | ### Actual Behavior
38 |
39 | [//]: # (Please describe what actually happens.)
40 |
41 | [//]: # (Please put long CLI output into Gists: http://gist.github.com)
42 | [//]: # (Use `VERBOSE=1 catkin build -p1 -v` for verbose output)
43 | [//]: # (Please post `logs` directory if available.)
44 |
45 |
46 | ### Steps to Reproduce the Issue
47 |
48 | [//]: # (Please give a series of command-line commands which cause the problem.)
49 | [//]: # (Include a checkout URI for the workspace so that we can reproduce the issue.)
50 | [//]: # (If we can't reproduce it on our own machines, we can't fix it!)
51 |
52 | ```bash
53 |
54 | ```
55 |
56 |
--------------------------------------------------------------------------------
/.github/workflows/workflow.yml:
--------------------------------------------------------------------------------
1 | name: build
2 |
3 | on: [push, pull_request]
4 |
5 | jobs:
6 | lint:
7 | runs-on: ubuntu-latest
8 | name: Lint
9 | steps:
10 | - name: Check out source repository
11 | uses: actions/checkout@v3
12 | - name: Set up Python environment
13 | uses: actions/setup-python@v4
14 | with:
15 | python-version: "3.12"
16 | - name: flake8 lint
17 | uses: py-actions/flake8@v2
18 | with:
19 | max-line-length: "120"
20 | path: "catkin_tools"
21 | - name: isort
22 | uses: isort/isort-action@v1
23 | with:
24 | requirements-files: "requirements.txt"
25 | sort-paths: "catkin_tools tests"
26 | configuration: "--check-only --diff --force-single-line-imports --line-length 120"
27 |
28 | build_and_test:
29 | strategy:
30 | fail-fast: false
31 | matrix:
32 | versions:
33 | - dist: ubuntu-20.04
34 | python: "3.9"
35 | catkin: noetic-devel
36 | - dist: ubuntu-20.04
37 | python: "3.10"
38 | catkin: noetic-devel
39 | - dist: ubuntu-20.04
40 | python: "3.11"
41 | catkin: noetic-devel
42 | - dist: ubuntu-20.04
43 | python: "3.12"
44 | catkin: noetic-devel
45 | - dist: ubuntu-20.04
46 | python: "3.13"
47 | catkin: noetic-devel
48 | - dist: ubuntu-22.04
49 | python: "3.9"
50 | catkin: noetic-devel
51 | - dist: ubuntu-22.04
52 | python: "3.10"
53 | catkin: noetic-devel
54 | - dist: ubuntu-22.04
55 | python: "3.11"
56 | catkin: noetic-devel
57 | - dist: ubuntu-22.04
58 | python: "3.12"
59 | catkin: noetic-devel
60 | - dist: ubuntu-22.04
61 | python: "3.13"
62 | catkin: noetic-devel
63 | - dist: ubuntu-24.04
64 | python: "3.9"
65 | catkin: noetic-devel
66 | - dist: ubuntu-24.04
67 | python: "3.10"
68 | catkin: noetic-devel
69 | - dist: ubuntu-24.04
70 | python: "3.11"
71 | catkin: noetic-devel
72 | - dist: ubuntu-24.04
73 | python: "3.12"
74 | catkin: noetic-devel
75 | - dist: ubuntu-24.04
76 | python: "3.13"
77 | catkin: noetic-devel
78 |
79 | runs-on: ${{ matrix.versions.dist }}
80 | steps:
81 | - uses: actions/checkout@v3
82 | - name: Set up Python ${{ matrix.versions.python }}
83 | uses: actions/setup-python@v4
84 | with:
85 | python-version: ${{ matrix.versions.python }}
86 | - name: Install package and dependencies
87 | run: |
88 | python -m pip install --upgrade pip
89 | pip install .
90 | pip install --upgrade empy pytest pynose coverage
91 | - name: Set up catkin
92 | run: |
93 | git clone https://github.com/ros/catkin.git -b ${{ matrix.versions.catkin }} /tmp/catkin_source
94 | mkdir /tmp/catkin_source/build
95 | pushd /tmp/catkin_source/build
96 | cmake -DCMAKE_POLICY_VERSION_MINIMUM=3.5 .. && make
97 | popd
98 | - name: Test catkin_tools
99 | run: |
100 | source /tmp/catkin_source/build/devel/setup.bash
101 | pytest tests --ignore=tests/system/resources
102 |
103 | docs:
104 | runs-on: ubuntu-latest
105 | name: Documentation
106 | steps:
107 | - uses: actions/checkout@v3
108 | - name: Set up Python
109 | uses: actions/setup-python@v4
110 | with:
111 | python-version: 3.12
112 | - name: Install documentation dependencies
113 | run: |
114 | python -m pip install --upgrade pip
115 | pip install .
116 | pip install --upgrade -r docs/requirements.txt
117 | - name: Build documentation
118 | working-directory: docs
119 | run: |
120 | make html
121 | sphinx-build -b spelling . build -t use_spelling
122 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.py[cod]
2 |
3 | # C extensions
4 | *.so
5 |
6 | # Packages
7 | *.egg
8 | *.egg-info
9 | dist
10 | build
11 | eggs
12 | parts
13 | bin
14 | var
15 | sdist
16 | develop-eggs
17 | .installed.cfg
18 | lib
19 | lib64
20 | __pycache__
21 |
22 | # Installer logs
23 | pip-log.txt
24 |
25 | # Unit test / coverage reports
26 | .coverage
27 | .tox
28 | nosetests.xml
29 |
30 | # Translations
31 | *.mo
32 |
33 | # Mr Developer
34 | .mr.developer.cfg
35 | .project
36 | .pydevproject
37 | .DS_Store
38 | deb_dist
39 |
40 | # vi
41 | *.sw[op]
42 |
--------------------------------------------------------------------------------
/.readthedocs.yaml:
--------------------------------------------------------------------------------
1 | # .readthedocs.yaml
2 | # Read the Docs configuration file
3 | # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
4 |
5 | # Required
6 | version: 2
7 |
8 | # Set the version of Python and other tools you might need
9 | build:
10 | os: ubuntu-22.04
11 | tools:
12 | python: "3.11"
13 |
14 | # Build documentation in the docs/ directory with Sphinx
15 | sphinx:
16 | configuration: docs/conf.py
17 |
18 | # We recommend specifying your dependencies to enable reproducible builds:
19 | # https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
20 | python:
21 | install:
22 | - requirements: docs/requirements.txt
23 |
--------------------------------------------------------------------------------
/MANIFEST.in:
--------------------------------------------------------------------------------
1 | recursive-include completion *
2 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # catkin_tools [](https://github.com/catkin/catkin_tools/actions/workflows/workflow.yml)
2 |
3 | Command line tools for working with [catkin](https://github.com/ros/catkin)
4 |
5 | Documentation: https://catkin-tools.readthedocs.org/
6 |
--------------------------------------------------------------------------------
/catkin_tools/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/catkin/catkin_tools/e9f058b9a9d26d760f633981bbfca0c303b1cb51/catkin_tools/__init__.py
--------------------------------------------------------------------------------
/catkin_tools/commands/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/catkin/catkin_tools/e9f058b9a9d26d760f633981bbfca0c303b1cb51/catkin_tools/commands/__init__.py
--------------------------------------------------------------------------------
/catkin_tools/execution/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/catkin/catkin_tools/e9f058b9a9d26d760f633981bbfca0c303b1cb51/catkin_tools/execution/__init__.py
--------------------------------------------------------------------------------
/catkin_tools/execution/events.py:
--------------------------------------------------------------------------------
1 | # Copyright 2016 Open Source Robotics Foundation, Inc.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | import time
16 |
17 |
18 | class ExecutionEvent(object):
19 |
20 | """Structure for events generated by the Executor.
21 |
22 | Events can be jobs starting/finishing, commands starting/failing/finishing,
23 | commands producing output (each line is an event), or when the executor
24 | quits or fails.
25 | """
26 |
27 | # TODO: Make this a map of ID -> fields
28 | EVENT_IDS = [
29 | 'JOB_STATUS', # A report of running job states
30 | 'QUEUED_JOB', # A job has been queued to be executed
31 | 'STARTED_JOB', # A job has started to be executed
32 | 'FINISHED_JOB', # A job has finished executing (succeeded or failed)
33 | 'ABANDONED_JOB', # A job has been abandoned for some reason
34 | 'STARTED_STAGE', # A job stage has started to be executed
35 | 'FINISHED_STAGE', # A job stage has finished executing (succeeded or failed)
36 | 'STAGE_PROGRESS', # A job stage has executed partially
37 | 'STDOUT', # A status message from a job
38 | 'STDERR', # A warning or error message from a job
39 | 'SUBPROCESS', # A subprocess has been created
40 | 'MESSAGE'
41 | ]
42 |
43 | def __init__(self, event_id, **kwargs):
44 | """Create a new event.
45 |
46 | :param event_id: One of the valid EVENT_IDS
47 | :param **kwargs: The additional data to be passed along with this event.
48 | """
49 | # Store the time this event was generated
50 | self.time = time.time()
51 |
52 | # Make sure the event ID is valid
53 | if event_id not in ExecutionEvent.EVENT_IDS:
54 | print(ExecutionEvent.EVENT_IDS)
55 | raise ValueError("The event ID %s is not a valid executor event." % event_id)
56 |
57 | # Store the event data
58 | self.event_id = event_id
59 | self.data = kwargs
60 |
--------------------------------------------------------------------------------
/catkin_tools/execution/jobs.py:
--------------------------------------------------------------------------------
1 | # Copyright 2016 Open Source Robotics Foundation, Inc.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | from catkin_tools.terminal_color import ColorMapper
16 |
17 | mapper = ColorMapper()
18 | clr = mapper.clr
19 |
20 |
21 | class Job(object):
22 |
23 | """A Job is a series of operations, each of which is considered a "stage" of the job."""
24 |
25 | def __init__(self, jid, deps, env, stages, continue_on_failure=True):
26 | """
27 | jid: Unique job identifier
28 | deps: Dependencies (in terms of other jid's)
29 | stages: List of stages to be run in order
30 |
31 | """
32 | self.jid = jid
33 | self.deps = deps
34 | self.env = env
35 | self.stages = stages
36 | self.continue_on_failure = continue_on_failure
37 |
38 | def all_deps_completed(self, completed_jobs):
39 | """Return True if all dependencies have been completed."""
40 | return all([dep_id in completed_jobs for dep_id in self.deps])
41 |
42 | def all_deps_succeeded(self, completed_jobs):
43 | """Return True if all dependencies have been completed and succeeded."""
44 | return all([completed_jobs.get(dep_id, False) for dep_id in self.deps])
45 |
46 | def any_deps_failed(self, completed_jobs):
47 | """Return True if any dependencies which have been completed have failed."""
48 | return any([not completed_jobs.get(dep_id, True) for dep_id in self.deps])
49 |
--------------------------------------------------------------------------------
/catkin_tools/jobs/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/catkin/catkin_tools/e9f058b9a9d26d760f633981bbfca0c303b1cb51/catkin_tools/jobs/__init__.py
--------------------------------------------------------------------------------
/catkin_tools/jobs/cmake/python.cmake:
--------------------------------------------------------------------------------
1 | # the CMake variable PYTHON_INSTALL_DIR has the same value as the Python function catkin.builder.get_python_install_dir()
2 |
3 | set(PYTHON_VERSION "$ENV{ROS_PYTHON_VERSION}" CACHE STRING "Specify specific Python version to use (2 or 3)")
4 | if("${PYTHON_VERSION}" STREQUAL "")
5 | message(STATUS "ROS_PYTHON_VERSION not set, using default")
6 | endif()
7 |
8 | find_package(Python${PYTHON_VERSION} COMPONENTS Interpreter)
9 |
10 | if("${PYTHON_VERSION}" STREQUAL "3")
11 | set(_MAJOR ${Python3_VERSION_MAJOR})
12 | set(_MINOR ${Python3_VERSION_MINOR})
13 | set(_EXECUTABLE ${Python3_EXECUTABLE})
14 | elseif("${PYTHON_VERSION}" STREQUAL "2")
15 | set(_MAJOR ${Python2_VERSION_MAJOR})
16 | set(_MINOR ${Python2_VERSION_MINOR})
17 | set(_EXECUTABLE ${Python2_EXECUTABLE})
18 | else()
19 | set(_MAJOR ${Python_VERSION_MAJOR})
20 | set(_MINOR ${Python_VERSION_MINOR})
21 | set(_EXECUTABLE ${Python_EXECUTABLE})
22 | endif()
23 |
24 | message(STATUS "Using PYTHON_EXECUTABLE: ${_EXECUTABLE}")
25 |
26 | set(_PYTHON_PATH_VERSION_SUFFIX "${_MAJOR}.${_MINOR}")
27 |
28 | set(enable_setuptools_deb_layout OFF)
29 | if(EXISTS "/etc/debian_version")
30 | set(enable_setuptools_deb_layout ON)
31 | endif()
32 | option(SETUPTOOLS_DEB_LAYOUT "Enable debian style python package layout" ${enable_setuptools_deb_layout})
33 |
34 | if(SETUPTOOLS_DEB_LAYOUT)
35 | message(STATUS "Using Debian Python package layout")
36 | set(PYTHON_PACKAGES_DIR dist-packages)
37 | set(SETUPTOOLS_ARG_EXTRA "--install-layout=deb")
38 | # use major version only when installing 3.x with debian layout
39 | if("${_MAJOR}" STREQUAL "3")
40 | set(_PYTHON_PATH_VERSION_SUFFIX "${_MAJOR}")
41 | endif()
42 | else()
43 | message(STATUS "Using default Python package layout")
44 | set(PYTHON_PACKAGES_DIR site-packages)
45 | # setuptools is fussy about windows paths, make sure the install prefix is in native format
46 | file(TO_NATIVE_PATH "${CMAKE_INSTALL_PREFIX}" SETUPTOOLS_INSTALL_PREFIX)
47 | endif()
48 |
49 | if(NOT WIN32)
50 | set(PYTHON_INSTALL_DIR lib/python${_PYTHON_PATH_VERSION_SUFFIX}/${PYTHON_PACKAGES_DIR}
51 | CACHE INTERNAL "This needs to be in PYTHONPATH when 'setup.py install' is called. And it needs to match. But setuptools won't tell us where it will install things.")
52 | else()
53 | # Windows setuptools installs to lib/site-packages not lib/python2.7/site-packages
54 | set(PYTHON_INSTALL_DIR lib/${PYTHON_PACKAGES_DIR}
55 | CACHE INTERNAL "This needs to be in PYTHONPATH when 'setup.py install' is called. And it needs to match. But setuptools won't tell us where it will install things.")
56 | endif()
57 |
--------------------------------------------------------------------------------
/catkin_tools/jobs/cmake/python_install_dir.cmake:
--------------------------------------------------------------------------------
1 | # Include a copy of ros/catkin/cmake/python.cmake to reproduce catkin's behavior
2 | include(python.cmake)
3 | # Print resulting PYTHON_INSTALL_DIR for further processing
4 | message(${PYTHON_INSTALL_DIR})
5 |
--------------------------------------------------------------------------------
/catkin_tools/jobs/commands/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/catkin/catkin_tools/e9f058b9a9d26d760f633981bbfca0c303b1cb51/catkin_tools/jobs/commands/__init__.py
--------------------------------------------------------------------------------
/catkin_tools/jobs/commands/make.py:
--------------------------------------------------------------------------------
1 | # Copyright 2014 Open Source Robotics Foundation, Inc.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | from catkin_tools.utils import which
16 |
17 | MAKE_EXEC = which('make')
18 |
--------------------------------------------------------------------------------
/catkin_tools/notifications/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright 2014 Open Source Robotics Foundation, Inc.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | from .impl import notify
16 |
17 | __all__ = ['notify']
18 |
--------------------------------------------------------------------------------
/catkin_tools/notifications/impl.py:
--------------------------------------------------------------------------------
1 | # Copyright 2014 Open Source Robotics Foundation, Inc.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | """This modules provides a portable, failsafe notification function"""
16 |
17 | import os
18 | import platform
19 | import subprocess
20 |
21 | from catkin_tools.utils import which
22 |
23 | this_dir = os.path.dirname(__file__)
24 |
25 |
26 | def _notify_osx(title, msg, icon_image):
27 | # Note: icon_image is unused on OS X. Maybe it would make more sense
28 | # to pass a boolean `success' and then let the platform specific
29 | # notification implementations decide how that translates to icons
30 | # or what not.
31 | app_path = os.path.join(this_dir, 'resources', 'osx', 'catkin build.app')
32 | open_exec = which('open')
33 | if open_exec is None:
34 | return
35 | command = [open_exec, app_path, '--args', title, msg]
36 | terminal = os.environ.get('TERM_PROGRAM', None)
37 | if terminal == "Apple_Terminal":
38 | command += ["-activate", "com.apple.Terminal"]
39 | elif terminal == "iTerm.app":
40 | command += ["-activate", "com.googlecode.iterm2"]
41 | subprocess.Popen(command,
42 | stdout=subprocess.PIPE,
43 | stderr=subprocess.PIPE)
44 |
45 |
46 | def _notify_linux(title, msg, icon_image):
47 | icon_path = os.path.join(this_dir, 'resources', 'linux', icon_image)
48 | notify_send_exec = which('notify-send')
49 | if notify_send_exec is None:
50 | return
51 | subprocess.Popen([notify_send_exec, '-i', icon_path, '-t', '2000', '--hint', 'int:transient:1', title, msg],
52 | stdout=subprocess.PIPE,
53 | stderr=subprocess.PIPE)
54 |
55 |
56 | def notify(title, msg, icon_image='catkin_icon.png'):
57 | if platform.system() == 'Darwin':
58 | return _notify_osx(title, msg, icon_image=icon_image)
59 | if platform.system() == 'Linux':
60 | return _notify_linux(title, msg, icon_image=icon_image)
61 |
--------------------------------------------------------------------------------
/catkin_tools/notifications/resources/linux/catkin_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/catkin/catkin_tools/e9f058b9a9d26d760f633981bbfca0c303b1cb51/catkin_tools/notifications/resources/linux/catkin_icon.png
--------------------------------------------------------------------------------
/catkin_tools/notifications/resources/linux/catkin_icon_red.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/catkin/catkin_tools/e9f058b9a9d26d760f633981bbfca0c303b1cb51/catkin_tools/notifications/resources/linux/catkin_icon_red.png
--------------------------------------------------------------------------------
/catkin_tools/notifications/resources/linux/catkin_icon_yellow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/catkin/catkin_tools/e9f058b9a9d26d760f633981bbfca0c303b1cb51/catkin_tools/notifications/resources/linux/catkin_icon_yellow.png
--------------------------------------------------------------------------------
/catkin_tools/notifications/resources/osx/catkin build.app/Contents/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | BuildMachineOSBuild
6 | 13C1021
7 | CFBundleDevelopmentRegion
8 | en
9 | CFBundleExecutable
10 | catkin build
11 | CFBundleIconFile
12 | AppIcon
13 | CFBundleIdentifier
14 | com.catkin.catkin-build
15 | CFBundleInfoDictionaryVersion
16 | 6.0
17 | CFBundleName
18 | catkin build
19 | CFBundlePackageType
20 | APPL
21 | CFBundleShortVersionString
22 | 1.0.0
23 | CFBundleSignature
24 | ????
25 | CFBundleVersion
26 | 0
27 | DTCompiler
28 | com.apple.compilers.llvm.clang.1_0
29 | DTPlatformBuild
30 | 5B1008
31 | DTPlatformVersion
32 | GM
33 | DTSDKBuild
34 | 13C64
35 | DTSDKName
36 | macosx10.9
37 | DTXcode
38 | 0511
39 | DTXcodeBuild
40 | 5B1008
41 | LSApplicationCategoryType
42 | public.app-category.developer-tools
43 | LSMinimumSystemVersion
44 | 10.8
45 | LSUIElement
46 |
47 | NSHumanReadableCopyright
48 | Copyright © 2012 Eloy Durán. All rights reserved.
49 | NSMainNibFile
50 | MainMenu
51 | NSPrincipalClass
52 | NSApplication
53 |
54 |
55 |
--------------------------------------------------------------------------------
/catkin_tools/notifications/resources/osx/catkin build.app/Contents/MacOS/catkin build:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/catkin/catkin_tools/e9f058b9a9d26d760f633981bbfca0c303b1cb51/catkin_tools/notifications/resources/osx/catkin build.app/Contents/MacOS/catkin build
--------------------------------------------------------------------------------
/catkin_tools/notifications/resources/osx/catkin build.app/Contents/PkgInfo:
--------------------------------------------------------------------------------
1 | APPL????
--------------------------------------------------------------------------------
/catkin_tools/notifications/resources/osx/catkin build.app/Contents/Resources/AppIcon.icns:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/catkin/catkin_tools/e9f058b9a9d26d760f633981bbfca0c303b1cb51/catkin_tools/notifications/resources/osx/catkin build.app/Contents/Resources/AppIcon.icns
--------------------------------------------------------------------------------
/catkin_tools/notifications/resources/osx/catkin build.app/Contents/Resources/catkin_blue_logo_only.icns:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/catkin/catkin_tools/e9f058b9a9d26d760f633981bbfca0c303b1cb51/catkin_tools/notifications/resources/osx/catkin build.app/Contents/Resources/catkin_blue_logo_only.icns
--------------------------------------------------------------------------------
/catkin_tools/notifications/resources/osx/catkin build.app/Contents/Resources/en.lproj/Credits.rtf:
--------------------------------------------------------------------------------
1 | {\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;}
2 | {\colortbl;\red255\green255\blue255;}
3 | \paperw9840\paperh8400
4 | \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural
5 |
6 | \f0\b\fs24 \cf0 Engineering:
7 | \b0 \
8 | Some people\
9 | \
10 |
11 | \b Human Interface Design:
12 | \b0 \
13 | Some other people\
14 | \
15 |
16 | \b Testing:
17 | \b0 \
18 | Hopefully not nobody\
19 | \
20 |
21 | \b Documentation:
22 | \b0 \
23 | Whoever\
24 | \
25 |
26 | \b With special thanks to:
27 | \b0 \
28 | Mom\
29 | }
30 |
--------------------------------------------------------------------------------
/catkin_tools/notifications/resources/osx/catkin build.app/Contents/Resources/en.lproj/InfoPlist.strings:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/catkin/catkin_tools/e9f058b9a9d26d760f633981bbfca0c303b1cb51/catkin_tools/notifications/resources/osx/catkin build.app/Contents/Resources/en.lproj/InfoPlist.strings
--------------------------------------------------------------------------------
/catkin_tools/notifications/resources/osx/catkin build.app/Contents/Resources/en.lproj/MainMenu.nib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/catkin/catkin_tools/e9f058b9a9d26d760f633981bbfca0c303b1cb51/catkin_tools/notifications/resources/osx/catkin build.app/Contents/Resources/en.lproj/MainMenu.nib
--------------------------------------------------------------------------------
/catkin_tools/notifications/resources/osx/catkin_build_notifier_src/.gitignore:
--------------------------------------------------------------------------------
1 | .*.sw?
2 | .DS_Store
3 | DerivedData
4 | xcuserdata
5 | Ruby/*.zip
6 | Ruby/*.gem
7 | Ruby/vendor
8 |
--------------------------------------------------------------------------------
/catkin_tools/notifications/resources/osx/catkin_build_notifier_src/AppIcon.icns:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/catkin/catkin_tools/e9f058b9a9d26d760f633981bbfca0c303b1cb51/catkin_tools/notifications/resources/osx/catkin_build_notifier_src/AppIcon.icns
--------------------------------------------------------------------------------
/catkin_tools/notifications/resources/osx/catkin_build_notifier_src/Terminal Notifier.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/catkin_tools/notifications/resources/osx/catkin_build_notifier_src/Terminal Notifier.xcodeproj/project.xcworkspace/xcshareddata/Terminal Notifier.xccheckout:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDESourceControlProjectFavoriteDictionaryKey
6 |
7 | IDESourceControlProjectIdentifier
8 | 8E18BD4D-A900-420F-8E14-B3E5136FC8F5
9 | IDESourceControlProjectName
10 | Terminal Notifier
11 | IDESourceControlProjectOriginsDictionary
12 |
13 | 1248FE46-581E-4245-A915-F87E980A87F0
14 | https://github.com/catkin/catkin_tools.git
15 |
16 | IDESourceControlProjectPath
17 | catkin_tools/notifications/resources/osx/catkin_build_notifier_src/Terminal Notifier.xcodeproj/project.xcworkspace
18 | IDESourceControlProjectRelativeInstallPathDictionary
19 |
20 | 1248FE46-581E-4245-A915-F87E980A87F0
21 | ../../../../../../..
22 |
23 | IDESourceControlProjectURL
24 | https://github.com/catkin/catkin_tools.git
25 | IDESourceControlProjectVersion
26 | 110
27 | IDESourceControlProjectWCCIdentifier
28 | 1248FE46-581E-4245-A915-F87E980A87F0
29 | IDESourceControlProjectWCConfigurations
30 |
31 |
32 | IDESourceControlRepositoryExtensionIdentifierKey
33 | public.vcs.git
34 | IDESourceControlWCCIdentifierKey
35 | 1248FE46-581E-4245-A915-F87E980A87F0
36 | IDESourceControlWCCName
37 | catkin_tools
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/catkin_tools/notifications/resources/osx/catkin_build_notifier_src/Terminal Notifier/AppDelegate.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | @interface AppDelegate : NSObject
4 | @end
5 |
--------------------------------------------------------------------------------
/catkin_tools/notifications/resources/osx/catkin_build_notifier_src/Terminal Notifier/AppDelegate.m:
--------------------------------------------------------------------------------
1 | #import "AppDelegate.h"
2 | #import
3 | #import
4 |
5 | NSString * const NotificationCenterUIBundleID = @"com.apple.notificationcenterui";
6 |
7 |
8 | @implementation NSUserDefaults (SubscriptAndUnescape)
9 | - (id)objectForKeyedSubscript:(id)key;
10 | {
11 | id obj = [self objectForKey:key];
12 | if ([obj isKindOfClass:[NSString class]] && [(NSString *)obj hasPrefix:@"\\"]) {
13 | obj = [(NSString *)obj substringFromIndex:1];
14 | }
15 | return obj;
16 | }
17 | @end
18 |
19 | @implementation AppDelegate
20 |
21 | - (void)applicationDidFinishLaunching:(NSNotification *)notification;
22 | {
23 | NSUserNotification *userNotification = notification.userInfo[NSApplicationLaunchUserNotificationKey];
24 | if (userNotification) {
25 | [self userActivatedNotification:userNotification];
26 | } else {
27 | NSArray *runningProcesses = [[[NSWorkspace sharedWorkspace] runningApplications] valueForKey:@"bundleIdentifier"];
28 | if ([runningProcesses indexOfObject:NotificationCenterUIBundleID] == NSNotFound) {
29 | NSLog(@"[!] Unable to post a notification for the current user (%@), as it has no running NotificationCenter instance.", NSUserName());
30 | exit(1);
31 | }
32 |
33 | NSArray *arguments = [[NSProcessInfo processInfo] arguments];
34 |
35 | NSString *title = @"No title";
36 | if ([arguments count] > 1)
37 | {
38 | title = arguments[1];
39 | }
40 |
41 | NSString *message = @"No message";
42 | if ([arguments count] > 2)
43 | {
44 | message = arguments[2];
45 | }
46 |
47 | NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
48 | NSMutableDictionary *options = [NSMutableDictionary dictionary];
49 | if (defaults[@"activate"]) options[@"bundleID"] = defaults[@"activate"];
50 |
51 | NSUserNotification *userNotification = [NSUserNotification new];
52 | userNotification.title = title;
53 | // userNotification.subtitle = message;
54 | userNotification.informativeText = message;
55 | userNotification.userInfo = options;
56 |
57 | NSUserNotificationCenter *center = [NSUserNotificationCenter defaultUserNotificationCenter];
58 | center.delegate = self;
59 | [center scheduleNotification:userNotification];
60 | }
61 | }
62 |
63 | - (BOOL)userNotificationCenter:(NSUserNotificationCenter *)center
64 | shouldPresentNotification:(NSUserNotification *)userNotification;
65 | {
66 | return YES;
67 | }
68 |
69 | // Once the notification is delivered we can exit.
70 | - (void)userNotificationCenter:(NSUserNotificationCenter *)center
71 | didDeliverNotification:(NSUserNotification *)userNotification;
72 | {
73 | exit(0);
74 | }
75 |
76 | - (void)userActivatedNotification:(NSUserNotification *)userNotification;
77 | {
78 | [[NSUserNotificationCenter defaultUserNotificationCenter] removeDeliveredNotification:userNotification];
79 |
80 | NSString *bundleID = userNotification.userInfo[@"bundleID"];
81 |
82 | BOOL success = YES;
83 | if (bundleID) success &= [self activateAppWithBundleID:bundleID];
84 |
85 | exit(success ? 0 : 1);
86 | }
87 |
88 | - (BOOL)activateAppWithBundleID:(NSString *)bundleID;
89 | {
90 | id app = [SBApplication applicationWithBundleIdentifier:bundleID];
91 | if (app) {
92 | [app activate];
93 | return YES;
94 | } else {
95 | NSLog(@"Unable to find an application with the specified bundle indentifier.");
96 | return NO;
97 | }
98 | }
99 |
100 | @end
101 |
--------------------------------------------------------------------------------
/catkin_tools/notifications/resources/osx/catkin_build_notifier_src/Terminal Notifier/Terminal Notifier-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | ${EXECUTABLE_NAME}
9 | CFBundleIdentifier
10 | com.catkin.${PRODUCT_NAME:rfc1034identifier}
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | ${PRODUCT_NAME}
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 0
23 | LSApplicationCategoryType
24 | public.app-category.developer-tools
25 | LSMinimumSystemVersion
26 | ${MACOSX_DEPLOYMENT_TARGET}
27 | LSUIElement
28 |
29 | NSHumanReadableCopyright
30 | Copyright © 2012 Eloy Durán. All rights reserved.
31 | NSMainNibFile
32 | MainMenu
33 | NSPrincipalClass
34 | NSApplication
35 |
36 |
37 |
--------------------------------------------------------------------------------
/catkin_tools/notifications/resources/osx/catkin_build_notifier_src/Terminal Notifier/Terminal Notifier-Prefix.pch:
--------------------------------------------------------------------------------
1 | //
2 | // Prefix header for all source files of the 'Terminal Notifier' target in the 'Terminal Notifier' project
3 | //
4 |
5 | #ifdef __OBJC__
6 | #import
7 | #endif
8 |
--------------------------------------------------------------------------------
/catkin_tools/notifications/resources/osx/catkin_build_notifier_src/Terminal Notifier/en.lproj/Credits.rtf:
--------------------------------------------------------------------------------
1 | {\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;}
2 | {\colortbl;\red255\green255\blue255;}
3 | \paperw9840\paperh8400
4 | \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural
5 |
6 | \f0\b\fs24 \cf0 Engineering:
7 | \b0 \
8 | Some people\
9 | \
10 |
11 | \b Human Interface Design:
12 | \b0 \
13 | Some other people\
14 | \
15 |
16 | \b Testing:
17 | \b0 \
18 | Hopefully not nobody\
19 | \
20 |
21 | \b Documentation:
22 | \b0 \
23 | Whoever\
24 | \
25 |
26 | \b With special thanks to:
27 | \b0 \
28 | Mom\
29 | }
30 |
--------------------------------------------------------------------------------
/catkin_tools/notifications/resources/osx/catkin_build_notifier_src/Terminal Notifier/en.lproj/InfoPlist.strings:
--------------------------------------------------------------------------------
1 | /* Localized versions of Info.plist keys */
2 |
3 |
--------------------------------------------------------------------------------
/catkin_tools/notifications/resources/osx/catkin_build_notifier_src/Terminal Notifier/main.m:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | int main(int argc, char *argv[])
4 | {
5 | return NSApplicationMain(argc, (const char **)argv);
6 | }
7 |
--------------------------------------------------------------------------------
/catkin_tools/notifications/resources/osx/catkin_build_notifier_src/catkin_blue_logo_only.icns:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/catkin/catkin_tools/e9f058b9a9d26d760f633981bbfca0c303b1cb51/catkin_tools/notifications/resources/osx/catkin_build_notifier_src/catkin_blue_logo_only.icns
--------------------------------------------------------------------------------
/catkin_tools/notifications/resources/osx/catkin_build_notifier_src/terminal-notifier/Images.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "mac",
5 | "scale" : "2x",
6 | "size" : "16x16"
7 | },
8 | {
9 | "size" : "16x16",
10 | "idiom" : "mac",
11 | "filename" : "catkin_blue_logo_only16x16.png",
12 | "scale" : "1x"
13 | },
14 | {
15 | "size" : "32x32",
16 | "idiom" : "mac",
17 | "filename" : "catkin_blue_logo_only32x32.png",
18 | "scale" : "1x"
19 | },
20 | {
21 | "idiom" : "mac",
22 | "scale" : "2x",
23 | "size" : "32x32"
24 | },
25 | {
26 | "size" : "128x128",
27 | "idiom" : "mac",
28 | "filename" : "catkin_blue_logo_only128x128.png",
29 | "scale" : "1x"
30 | },
31 | {
32 | "idiom" : "mac",
33 | "scale" : "2x",
34 | "size" : "128x128"
35 | },
36 | {
37 | "size" : "256x256",
38 | "idiom" : "mac",
39 | "filename" : "catkin_blue_logo_only256x256.png",
40 | "scale" : "1x"
41 | },
42 | {
43 | "idiom" : "mac",
44 | "scale" : "2x",
45 | "size" : "256x256"
46 | },
47 | {
48 | "size" : "512x512",
49 | "idiom" : "mac",
50 | "filename" : "catkin_blue_logo_only512x512.png",
51 | "scale" : "1x"
52 | },
53 | {
54 | "idiom" : "mac",
55 | "scale" : "2x",
56 | "size" : "512x512"
57 | }
58 | ],
59 | "info" : {
60 | "version" : 1,
61 | "author" : "xcode"
62 | }
63 | }
--------------------------------------------------------------------------------
/catkin_tools/notifications/resources/osx/catkin_build_notifier_src/terminal-notifier/Images.xcassets/AppIcon.appiconset/catkin_blue_logo_only128x128.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/catkin/catkin_tools/e9f058b9a9d26d760f633981bbfca0c303b1cb51/catkin_tools/notifications/resources/osx/catkin_build_notifier_src/terminal-notifier/Images.xcassets/AppIcon.appiconset/catkin_blue_logo_only128x128.png
--------------------------------------------------------------------------------
/catkin_tools/notifications/resources/osx/catkin_build_notifier_src/terminal-notifier/Images.xcassets/AppIcon.appiconset/catkin_blue_logo_only16x16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/catkin/catkin_tools/e9f058b9a9d26d760f633981bbfca0c303b1cb51/catkin_tools/notifications/resources/osx/catkin_build_notifier_src/terminal-notifier/Images.xcassets/AppIcon.appiconset/catkin_blue_logo_only16x16.png
--------------------------------------------------------------------------------
/catkin_tools/notifications/resources/osx/catkin_build_notifier_src/terminal-notifier/Images.xcassets/AppIcon.appiconset/catkin_blue_logo_only256x256.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/catkin/catkin_tools/e9f058b9a9d26d760f633981bbfca0c303b1cb51/catkin_tools/notifications/resources/osx/catkin_build_notifier_src/terminal-notifier/Images.xcassets/AppIcon.appiconset/catkin_blue_logo_only256x256.png
--------------------------------------------------------------------------------
/catkin_tools/notifications/resources/osx/catkin_build_notifier_src/terminal-notifier/Images.xcassets/AppIcon.appiconset/catkin_blue_logo_only32x32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/catkin/catkin_tools/e9f058b9a9d26d760f633981bbfca0c303b1cb51/catkin_tools/notifications/resources/osx/catkin_build_notifier_src/terminal-notifier/Images.xcassets/AppIcon.appiconset/catkin_blue_logo_only32x32.png
--------------------------------------------------------------------------------
/catkin_tools/notifications/resources/osx/catkin_build_notifier_src/terminal-notifier/Images.xcassets/AppIcon.appiconset/catkin_blue_logo_only512x512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/catkin/catkin_tools/e9f058b9a9d26d760f633981bbfca0c303b1cb51/catkin_tools/notifications/resources/osx/catkin_build_notifier_src/terminal-notifier/Images.xcassets/AppIcon.appiconset/catkin_blue_logo_only512x512.png
--------------------------------------------------------------------------------
/catkin_tools/spaces/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/catkin/catkin_tools/e9f058b9a9d26d760f633981bbfca0c303b1cb51/catkin_tools/spaces/__init__.py
--------------------------------------------------------------------------------
/catkin_tools/spaces/build.py:
--------------------------------------------------------------------------------
1 | # Copyright 2017 Open Source Robotics Foundation, Inc.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | description = dict(
16 | default='build',
17 | short_flag='-b',
18 | space='Build Space',
19 | description='Intermediate generated files are placed in this location.'
20 | )
21 |
--------------------------------------------------------------------------------
/catkin_tools/spaces/devel.py:
--------------------------------------------------------------------------------
1 | # Copyright 2017 Open Source Robotics Foundation, Inc.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | description = dict(
16 | default='devel',
17 | short_flag='-d',
18 | space='Devel Space',
19 | description='This result space contains compiled products but ' +
20 | 'references the source space for static assets and scripts.'
21 | )
22 |
--------------------------------------------------------------------------------
/catkin_tools/spaces/install.py:
--------------------------------------------------------------------------------
1 | # Copyright 2017 Open Source Robotics Foundation, Inc.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | description = dict(
16 | default='install',
17 | short_flag='-i',
18 | space='Install Space',
19 | description='Self-contained installation result space.'
20 | )
21 |
--------------------------------------------------------------------------------
/catkin_tools/spaces/log.py:
--------------------------------------------------------------------------------
1 | # Copyright 2017 Open Source Robotics Foundation, Inc.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | description = dict(
16 | default='logs',
17 | short_flag='-L',
18 | space='Log Space',
19 | description='Output generated during the build stages.'
20 | )
21 |
--------------------------------------------------------------------------------
/catkin_tools/spaces/source.py:
--------------------------------------------------------------------------------
1 | # Copyright 2017 Open Source Robotics Foundation, Inc.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | description = dict(
16 | default='src',
17 | short_flag='-s',
18 | space='Source Space',
19 | description='Source files, should not be modified by build system.'
20 | )
21 |
--------------------------------------------------------------------------------
/catkin_tools/utils.py:
--------------------------------------------------------------------------------
1 | # Copyright 2014 Open Source Robotics Foundation, Inc.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | import os
16 | import sys
17 |
18 | if sys.version_info >= (3, 10):
19 | from importlib.metadata import entry_points
20 | else:
21 | import importlib.metadata
22 |
23 | def entry_points(*, group):
24 | for ep in importlib.metadata.entry_points().get(group, []):
25 | yield ep
26 |
27 |
28 | def which(program):
29 | """Custom version of the ``which`` built-in shell command.
30 |
31 | Searches the paths in the ``PATH`` environment variable for a given
32 | executable name. It returns the full path to the first instance of the
33 | executable found or None if it was not found.
34 |
35 | :param program: name of the executable to find
36 | :type program: str
37 | :returns: Full path to the first instance of the executable, or None
38 | :rtype: str or None
39 | """
40 | def is_exe(fpath):
41 | return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
42 |
43 | fpath, _ = os.path.split(program)
44 | if fpath:
45 | if is_exe(program):
46 | return program
47 | else:
48 | for path in os.environ.get('PATH', os.defpath).split(os.pathsep):
49 | path = path.strip('"')
50 | exe_file = os.path.join(path, program)
51 | if is_exe(exe_file):
52 | return exe_file
53 | return None
54 |
--------------------------------------------------------------------------------
/catkin_tools/verbs/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/catkin/catkin_tools/e9f058b9a9d26d760f633981bbfca0c303b1cb51/catkin_tools/verbs/__init__.py
--------------------------------------------------------------------------------
/catkin_tools/verbs/catkin_build/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright 2014 Open Source Robotics Foundation, Inc.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | from catkin_tools.argument_parsing import argument_preprocessor
16 |
17 | from .cli import main
18 | from .cli import prepare_arguments
19 |
20 | # This describes this command to the loader
21 | description = dict(
22 | verb='build',
23 | description="Builds a catkin workspace.",
24 | main=main,
25 | prepare_arguments=prepare_arguments,
26 | argument_preprocessor=argument_preprocessor,
27 | )
28 |
--------------------------------------------------------------------------------
/catkin_tools/verbs/catkin_build/color.py:
--------------------------------------------------------------------------------
1 | # Copyright 2014 Open Source Robotics Foundation, Inc.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | """This module implements many of the colorization functions used by catkin build"""
16 |
17 | from catkin_tools.terminal_color import ColorMapper
18 | from catkin_tools.terminal_color import ansi
19 | from catkin_tools.terminal_color import fmt
20 | from catkin_tools.terminal_color import sanitize
21 |
22 | # This map translates more human readable format strings into colorized versions
23 | _color_translation_map = {
24 | # 'output': 'colorized_output'
25 | '': fmt('@!' + sanitize('') + '@|'),
26 |
27 | "[{package}] ==> '{cmd.cmd_str}' in '{location}'":
28 | fmt("[@{cf}{package}@|] @!@{bf}==>@| '@!{cmd.cmd_str}@|' @{kf}@!in@| '@!{location}@|'"),
29 |
30 | "Starting ==> {package}":
31 | fmt("Starting @!@{gf}==>@| @!@{cf}{package}@|"),
32 |
33 | "[{package}] {msg}":
34 | fmt("[@{cf}{package}@|] {msg}"),
35 |
36 | "[{package}] <== '{cmd.cmd_str}' failed with return code '{retcode}'":
37 | fmt("[@{cf}{package}@|] @!@{rf}<==@| '@!{cmd.cmd_str}@|' @{rf}failed with return code@| '@!{retcode}@|'"),
38 |
39 | "[{package}] <== '{cmd.cmd_str}' finished with return code '{retcode}'":
40 | fmt("[@{cf}{package}@|] @{gf}<==@| '@!{cmd.cmd_str}@|' finished with return code '@!{retcode}@|'"),
41 |
42 | "Finished <== {package:<":
43 | fmt("@!@{kf}Finished@| @{gf}<==@| @{cf}{package:<").rstrip(ansi('reset')),
44 |
45 | "Failed <== {package:<":
46 | fmt("@!@{rf}Failed@| @{gf}<==@| @{cf}{package:<").rstrip(ansi('reset')),
47 |
48 | "} [ {time} ]":
49 | fmt("}@| [ @{yf}{time}@| ]"),
50 |
51 | "[build - {run_time}] ":
52 | fmt("[@{pf}build@| - @{yf}{run_time}@|] "),
53 |
54 | "[{name} - {run_time}] ":
55 | fmt("[@{cf}{name}@| - @{yf}{run_time}@|] "),
56 |
57 | "[{0}/{1} Active | {2}/{3} Completed]":
58 | fmt("[@!@{gf}{0}@|/@{gf}{1}@| Active | @!@{gf}{2}@|/@{gf}{3}@| Completed]"),
59 |
60 | "[{0}/{1} Jobs | {2}/{3} Active | {4}/{5} Completed]":
61 | fmt("[@!@{gf}{0}@|/@{gf}{1}@| Jobs | @!@{gf}{2}@|/@{gf}{3}@| Active | @!@{gf}{4}@|/@{gf}{5}@| Completed]"),
62 |
63 | "[!{package}] ":
64 | fmt("[@!@{rf}!@|@{cf}{package}@|] "),
65 | }
66 |
67 | color_mapper = ColorMapper(_color_translation_map)
68 |
69 | clr = color_mapper.clr
70 |
--------------------------------------------------------------------------------
/catkin_tools/verbs/catkin_clean/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright 2014 Open Source Robotics Foundation, Inc.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | from .cli import main
16 | from .cli import prepare_arguments
17 |
18 | # This describes this command to the loader
19 | description = dict(
20 | verb='clean',
21 | description="Deletes various products of the build verb.",
22 | main=main,
23 | prepare_arguments=prepare_arguments,
24 | )
25 |
--------------------------------------------------------------------------------
/catkin_tools/verbs/catkin_config/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright 2014 Open Source Robotics Foundation, Inc.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | from catkin_tools.argument_parsing import argument_preprocessor
16 |
17 | from .cli import main
18 | from .cli import prepare_arguments
19 |
20 | # This describes this command to the loader
21 | description = dict(
22 | verb='config',
23 | description="Configures a catkin workspace's context.",
24 | main=main,
25 | prepare_arguments=prepare_arguments,
26 | argument_preprocessor=argument_preprocessor,
27 | )
28 |
--------------------------------------------------------------------------------
/catkin_tools/verbs/catkin_create/__init__.py:
--------------------------------------------------------------------------------
1 |
2 | # Copyright 2014 Open Source Robotics Foundation, Inc.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 |
16 | from .cli import main
17 | from .cli import prepare_arguments
18 |
19 | # This describes this command to the loader
20 | description = dict(
21 | verb='create',
22 | description="Creates catkin workspace resources like packages.",
23 | main=main,
24 | prepare_arguments=prepare_arguments,
25 | )
26 |
--------------------------------------------------------------------------------
/catkin_tools/verbs/catkin_env/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright 2014 Open Source Robotics Foundation, Inc.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | from .cli import argument_preprocessor
16 | from .cli import main
17 | from .cli import prepare_arguments
18 |
19 | # This describes this command to the loader
20 | description = dict(
21 | verb='env',
22 | description=" Run an arbitrary command in a modified environment.",
23 | main=main,
24 | prepare_arguments=prepare_arguments,
25 | argument_preprocessor=argument_preprocessor,
26 | )
27 |
--------------------------------------------------------------------------------
/catkin_tools/verbs/catkin_env/cli.py:
--------------------------------------------------------------------------------
1 | # Copyright 2014 Open Source Robotics Foundation, Inc.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | import os
16 | import re
17 | import sys
18 |
19 | from osrf_pycommon.process_utils import execute_process
20 |
21 | from catkin_tools.common import format_env_dict
22 | from catkin_tools.common import parse_env_str
23 |
24 |
25 | def prepare_arguments(parser):
26 |
27 | add = parser.add_argument
28 |
29 | add('-i', '--ignore-environment', default=False, action='store_true',
30 | help='Start with an empty environment.')
31 | add('-s', '--stdin', default=False, action='store_true',
32 | help='Read environment variable definitions from stdin. '
33 | 'Variables should be given in NAME=VALUE format, separated by null-bytes.')
34 |
35 | add('envs_', metavar='NAME=VALUE', nargs='*', type=str, default=[],
36 | help='Explicitly set environment variables for the subcommand. '
37 | 'These override variables given to stdin.')
38 |
39 | cmd_group = parser.add_argument_group('command')
40 | add = cmd_group.add_argument
41 | add('cmd_', metavar='COMMAND', nargs='?', type=str, default=None,
42 | help='Command to run. If omitted, the environment is printed to stdout.')
43 | add('args_', metavar='ARG', nargs='*', type=str, default=[],
44 | help='Arguments to the command.')
45 |
46 | return parser
47 |
48 |
49 | def argument_preprocessor(args):
50 | """This preprocessor extracts environment variables and the raw subcommand
51 | to be executed by the env verb.
52 |
53 | :param args: system arguments from which special arguments need to be extracted
54 | :type args: list
55 | :returns: a tuple containing a list of the arguments which can be handled
56 | by argparse and a dict of the extra arguments which this function has
57 | extracted
58 | :rtype: tuple
59 | """
60 |
61 | raw_args = list(sys.argv[1:]) if args is None else args
62 | args = []
63 |
64 | # Get leading optional arguments
65 | for arg in list(raw_args):
66 | if arg.startswith('-'):
67 | args.append(arg)
68 | raw_args.pop(0)
69 | else:
70 | # Done parsing options
71 | break
72 |
73 | # Get envs
74 | envs = {}
75 | for arg in list(raw_args):
76 | env_match = re.match('(.+?)=(.+)', arg)
77 | if env_match is not None and len(env_match.groups()) == 2:
78 | envs.update(dict([env_match.groups()]))
79 | raw_args.pop(0)
80 | else:
81 | # Done parsing envs
82 | break
83 |
84 | # Get command
85 | cmd = raw_args
86 |
87 | extras = {
88 | 'envs': envs,
89 | 'cmd': cmd,
90 | }
91 |
92 | return args, extras
93 |
94 |
95 | def main(opts):
96 |
97 | environ = {}
98 |
99 | # Get the initial environment
100 | if not opts.ignore_environment:
101 | environ.update(os.environ)
102 |
103 | # Update environment from stdin
104 | if opts.stdin:
105 | input_env_str = sys.stdin.read().strip()
106 | environ.update(parse_env_str(input_env_str.encode()))
107 |
108 | # Finally, update with explicit vars
109 | environ.update(opts.envs)
110 |
111 | if len(opts.cmd) == 0:
112 | # Print environment and exit if there's no command
113 | print(format_env_dict(environ))
114 | else:
115 | # Run the subcommand with the modified environment
116 | for ret in execute_process(opts.cmd, env=environ, emulate_tty=True):
117 | if ret:
118 | if isinstance(ret, int):
119 | return ret
120 | else:
121 | print(ret.decode(), end='')
122 |
123 | # Flush stdout
124 | # NOTE: This is done to ensure that automated use of this tool doesn't miss
125 | # the output
126 | sys.stdout.flush()
127 | return 0
128 |
--------------------------------------------------------------------------------
/catkin_tools/verbs/catkin_init/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright 2014 Open Source Robotics Foundation, Inc.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | from .cli import main
16 | from .cli import prepare_arguments
17 |
18 | # This describes this command to the loader
19 | description = dict(
20 | verb='init',
21 | description="Initializes a given folder as a catkin workspace.",
22 | main=main,
23 | prepare_arguments=prepare_arguments,
24 | )
25 |
--------------------------------------------------------------------------------
/catkin_tools/verbs/catkin_init/cli.py:
--------------------------------------------------------------------------------
1 | # Copyright 2014 Open Source Robotics Foundation, Inc.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | import os
16 |
17 | from catkin_tools.argument_parsing import add_workspace_arg
18 | from catkin_tools.context import Context
19 | from catkin_tools.metadata import init_metadata_root
20 | from catkin_tools.terminal_color import fmt
21 |
22 |
23 | def prepare_arguments(parser):
24 | # Workspace / profile args
25 | add_workspace_arg(parser)
26 |
27 | add = parser.add_argument
28 |
29 | add('--reset', action='store_true', default=False,
30 | help='Reset (delete) all of the metadata for the given workspace.')
31 |
32 | return parser
33 |
34 |
35 | def main(opts):
36 | try:
37 | # Load a context with initialization
38 | ctx = Context.load(opts.workspace, strict=True)
39 |
40 | # Initialize the workspace if necessary
41 | if ctx:
42 | print('Catkin workspace `%s` is already initialized. No action taken.' % ctx.workspace)
43 | else:
44 | print('Initializing catkin workspace in `%s`.' % (opts.workspace or os.getcwd()))
45 | # initialize the workspace
46 | init_metadata_root(
47 | opts.workspace or os.getcwd(),
48 | opts.reset)
49 |
50 | ctx = Context.load(opts.workspace)
51 | print(ctx.summary())
52 |
53 | except IOError as exc:
54 | # Usually happens if workspace is already underneath another catkin_tools workspace
55 | print(fmt('[init] @!@{rf}Error:@| Could not initialize catkin workspace: %s' % str(exc)))
56 | return 1
57 |
58 | return 0
59 |
--------------------------------------------------------------------------------
/catkin_tools/verbs/catkin_list/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright 2014 Open Source Robotics Foundation, Inc.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | from .cli import main
16 | from .cli import prepare_arguments
17 |
18 | # This describes this command to the loader
19 | description = dict(
20 | verb='list',
21 | description="Lists catkin packages in the workspace or other arbitrary folders.",
22 | main=main,
23 | prepare_arguments=prepare_arguments,
24 | )
25 |
--------------------------------------------------------------------------------
/catkin_tools/verbs/catkin_locate/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright 2015 Open Source Robotics Foundation, Inc.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | from .cli import main
16 | from .cli import prepare_arguments
17 |
18 | # This describes this command to the loader
19 | description = dict(
20 | verb='locate',
21 | description="Get the paths to various locations in a workspace.",
22 | main=main,
23 | prepare_arguments=prepare_arguments,
24 | )
25 |
--------------------------------------------------------------------------------
/catkin_tools/verbs/catkin_profile/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright 2014 Open Source Robotics Foundation, Inc.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | from .cli import main
16 | from .cli import prepare_arguments
17 |
18 | # This describes this command to the loader
19 | description = dict(
20 | verb='profile',
21 | description="Manage config profiles for a catkin workspace.",
22 | main=main,
23 | prepare_arguments=prepare_arguments,
24 | )
25 |
--------------------------------------------------------------------------------
/catkin_tools/verbs/catkin_shell_verbs.bash:
--------------------------------------------------------------------------------
1 | # Catkin Shell Verbs
2 |
3 | function __catkin_help_augmented() {
4 | # Print out an augmented --help line
5 |
6 | # Get catkin executable
7 | CATKIN=$1
8 |
9 | # Add our shell verbs to the main helpline
10 | ORIGINAL_HELP_TEXT="$($CATKIN --help)"
11 | AUGMENTED_HELP_TEXT=""
12 |
13 | # Read each line of the help text, preserving whitespace
14 | while IFS= read -r LINE; do
15 | if [[ $LINE =~ "^\s+clean\s+" ]]; then
16 | # Insert cd summary
17 | AUGMENTED_HELP_TEXT+="$CATKIN_CD_SUMMARY\n$LINE\n"
18 | elif [[ $LINE =~ "^\s+profile\s+" ]]; then
19 | # Insert source summary
20 | AUGMENTED_HELP_TEXT+="$LINE\n$CATKIN_SOURCE_SUMMARY\n"
21 | elif [[ $LINE =~ "^catkin command" ]]; then
22 | # Update summary
23 | AUGMENTED_HELP_TEXT+="catkin command with shell verbs\n"
24 | elif [[ $LINE =~ "^\s+\[\s*[a-z]+\s*\|{0,1}" ]]; then
25 | # Update verb list
26 | VERB_LIST=${LINE/build/build | cd}
27 | VERB_LIST=${VERB_LIST/profile/source | profile}
28 | VERB_LIST="$(echo "$VERB_LIST" | fmt -c -w 80)"
29 | AUGMENTED_HELP_TEXT+="$VERB_LIST\n"
30 | else
31 | # Pass-though
32 | AUGMENTED_HELP_TEXT+="$LINE\n"
33 | fi
34 | done <<< "$ORIGINAL_HELP_TEXT"
35 | echo $AUGMENTED_HELP_TEXT
36 | }
37 |
38 | function catkin() {
39 | # Define help lines
40 | CATKIN_CD_SUMMARY=' cd Changes directory to a package or space.'
41 | CATKIN_SOURCE_SUMMARY=' source Sources a resultspace environment.'
42 |
43 | # Get actual catkin executable
44 | # Using `command` we ignore shell functions
45 | CATKIN="$(command which catkin)"
46 |
47 | # Get setup file extension
48 | if [ -n "$ZSH_VERSION" ]; then
49 | SHELL_EXT="zsh"
50 | elif [ -n "$BASH_VERSION" ]; then
51 | SHELL_EXT="bash"
52 | else
53 | SHELL_EXT=""
54 | fi
55 |
56 | # Capture original args
57 | ORIG_ARGS=("$@")
58 |
59 | # Handle main arguments
60 | OPTSPEC=":hw-:"
61 | WORKSPACE_ARGS=""
62 |
63 | # Process main arguments
64 | while getopts "$OPTSPEC" optchar ; do
65 | case "${optchar}" in
66 | -)
67 | case "${OPTARG}" in
68 | # TODO: replace --args below with `$1` ?
69 | workspace) WORKSPACE_ARGS="--workspace $2"; OPTIND=$(( $OPTIND + 1 ));;
70 | profile) PROFILE_ARGS="--profile $2"; OPTIND=$(( $OPTIND + 1 ));;
71 | help) __catkin_help_augmented $CATKIN; return;;
72 | esac;;
73 | w) WORKSPACE_ARGS="--workspace $2";;
74 | h) __catkin_help_augmented $CATKIN; return;;
75 | *);;
76 | esac
77 | done
78 |
79 | # Pass the arguments through xargs to remove extra spaces
80 | # that can be in the result in some shells, e.g. zsh.
81 | # See: https://github.com/catkin/catkin_tools/pull/417
82 | MAIN_ARGS=$(echo "${WORKSPACE_ARGS} ${PROFILE_ARGS}" | xargs)
83 |
84 | # Get subcommand
85 | SUBCOMMAND="$1"
86 |
87 | # Check if there's no subcommand
88 | if [ -z "$SUBCOMMAND" ]; then
89 | __catkin_help_augmented $CATKIN; return
90 | fi
91 |
92 | # Shift subcommand
93 | shift
94 |
95 | # Handle shell verbs
96 | case "${SUBCOMMAND}" in
97 | cd) cd "$($CATKIN locate $MAIN_ARGS $@)";;
98 | source) source "$($CATKIN locate $MAIN_ARGS -d)/setup.$SHELL_EXT";;
99 | *) $CATKIN "${ORIG_ARGS[@]}"
100 | esac
101 | }
102 |
--------------------------------------------------------------------------------
/catkin_tools/verbs/catkin_test/__init__.py:
--------------------------------------------------------------------------------
1 | # Licensed under the Apache License, Version 2.0 (the "License");
2 | # you may not use this file except in compliance with the License.
3 | # You may obtain a copy of the License at
4 | #
5 | # http://www.apache.org/licenses/LICENSE-2.0
6 | #
7 | # Unless required by applicable law or agreed to in writing, software
8 | # distributed under the License is distributed on an "AS IS" BASIS,
9 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | # See the License for the specific language governing permissions and
11 | # limitations under the License.
12 |
13 | from catkin_tools.argument_parsing import argument_preprocessor
14 |
15 | from .cli import main
16 | from .cli import prepare_arguments
17 |
18 | # This describes this command to the loader
19 | description = dict(
20 | verb='test',
21 | description="Tests a catkin workspace.",
22 | main=main,
23 | prepare_arguments=prepare_arguments,
24 | argument_preprocessor=argument_preprocessor,
25 | )
26 |
--------------------------------------------------------------------------------
/docs/.gitignore:
--------------------------------------------------------------------------------
1 | _build
2 |
--------------------------------------------------------------------------------
/docs/_static/.gitignore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/catkin/catkin_tools/e9f058b9a9d26d760f633981bbfca0c303b1cb51/docs/_static/.gitignore
--------------------------------------------------------------------------------
/docs/_templates/.gitignore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/catkin/catkin_tools/e9f058b9a9d26d760f633981bbfca0c303b1cb51/docs/_templates/.gitignore
--------------------------------------------------------------------------------
/docs/advanced/catkin_shell_verbs.rst:
--------------------------------------------------------------------------------
1 | Shell support in ``catkin`` command
2 | ===================================
3 |
4 | You can use the ``locate`` verb to locate the shell file for your installation.
5 | When you source the resulting file, you can use ``bash``/``zsh`` shell functions which provide added utility.
6 |
7 | .. code-block:: shell
8 |
9 | . `catkin locate --shell-verbs`
10 |
11 | Provided verbs are:
12 |
13 | - ``catkin cd`` -- Change to package directory in source space.
14 | - ``catkin source`` -- Source the devel space or install space of the containing workspace.
15 |
16 | Full Command-Line Interface
17 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
18 |
19 | Change to package directory in source space with `cd` verb.
20 |
21 | .. code-block:: text
22 |
23 | usage: catkin cd [ARGS...]
24 |
25 | ARGS are any valid catkin locate arguments
26 |
27 | The `source` verb sources the devel space or install space of the containing workspace.
28 |
29 | .. code-block:: text
30 |
31 | usage: catkin source [-w /path/to/ws]
32 |
33 | Sources setup.sh in the workspace.
34 |
35 | optional arguments:
36 | -w [/path/to/ws] Source setup.sh from given workspace.
37 |
--------------------------------------------------------------------------------
/docs/advanced/linked_develspace.rst:
--------------------------------------------------------------------------------
1 | Linked Devel Space
2 | ==================
3 |
4 | In addition to the ``merged`` and ``isolated`` **devel space** layouts provided by ``catkin_make`` and ``catkin_make_isolated``, respectively, ``catkin_tools`` provides a default ``linked`` layout which enables robust cleaning of individual packages from a workspace.
5 | It does this by building each package into its own hidden FHS tree, and then symbolically linking all products into the unified **devel space** which is specified in the workspace configuration.
6 |
7 | When building with a ``linked`` layout, Catkin packages are built into FHS trees stored in the ``.private`` hidden directory at the root of the **devel space**.
8 | Within this directory is a directory for each package in the workspace.
9 |
10 | Setup File Generation
11 | ^^^^^^^^^^^^^^^^^^^^^
12 |
13 | In the ``merged`` layout, every package writes and then over-writes the colliding setup files in the root of the **devel space**.
14 | This leads to race conditions and other problems when trying to parallelize building.
15 | With he ``linked`` layout, however, only one package generates these files, and this is either a built-in "prebuild" package, or if it exists in the workspace, the ``catkin`` CMake package, itself.
16 |
17 | .catkin File Generation
18 | ^^^^^^^^^^^^^^^^^^^^^^^
19 |
20 | When using the ``linked`` layout, ``catkin_tools`` is also responsible for managing the ``.catkin`` file in the root of the **devel space**.
21 |
--------------------------------------------------------------------------------
/docs/advanced/verb_customization.rst:
--------------------------------------------------------------------------------
1 | Verb Aliasing
2 | =============
3 |
4 | The ``catkin`` command allows you to define your own verb "aliases" which expand to more complex expressions including built-in verbs, command-line options, and other verb aliases.
5 | These are processed before any other command-line processing takes place, and can be useful for making certain use patterns more convenient.
6 |
7 | The Built-In Aliases
8 | ^^^^^^^^^^^^^^^^^^^^
9 |
10 | You can list the available aliases using the ``--list-aliases`` option to the ``catkin`` command.
11 | Below are the built-in aliases as displayed by this command:
12 |
13 | .. code-block:: bash
14 |
15 | $ catkin --list-aliases
16 | b: build
17 | bt: b --this
18 | ls: list
19 | install: config --install
20 |
21 |
22 | Defining Additional Aliases
23 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
24 |
25 | Verb aliases are defined in the ``verb_aliases`` sub-directory of the catkin config folder, ``~/.config/catkin/verb_aliases``.
26 | Any YAML files in that folder (files with a ``.yaml`` extension) will be processed as definition files.
27 |
28 | These files are formatted as simple YAML dictionaries which map aliases to expanded expressions, which must be composed of other ``catkin`` verbs, options, or aliases:
29 |
30 | .. code-block:: yaml
31 |
32 | :
33 |
34 | For example, aliases which configure a workspace profile so that it ignores the value of the ``CMAKE_PREFIX_PATH`` environment variable, and instead *extends* one or another ROS install spaces could be defined as follows:
35 |
36 | .. code-block:: yaml
37 |
38 | # ~/.config/catkin/verb_aliases/10-ros-distro-aliases.yaml
39 | extend-sys: config --profile sys --extend /opt/ros/noetic -x _sys
40 | extend-overlay: config --profile overlay --extend ~/ros/noetic/install -x _overlay
41 |
42 | After defining these aliases, one could use them with optional additional options and build a given configuration profile.
43 |
44 | .. code-block:: bash
45 |
46 | $ catkin extend-overlay
47 | $ catkin profile set overlay
48 | $ catkin build some_package
49 |
50 | .. note::
51 |
52 | The ``catkin`` command will initialize the ``verb_aliases`` directory with a file named ``00-default-aliases.yaml`` containing the set of built-in aliases.
53 | These defaults can be overridden by adding additional definition files, but the default alias file should not be modified since any changes to it will be over-written by invocations of the ``catkin`` command.
54 |
55 | Alias Precedence and Overriding Aliases
56 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
57 |
58 | Verb alias files in the ``verb_aliases`` directory are processed in alphabetical order, so files which start with larger numbers will override files with smaller numbers.
59 | In this way you can override the built-in aliases using a file which starts with a number higher than ``00-``.
60 |
61 | For example, the ``bt: build --this`` alias exists in the default alias file, ``00-default-aliases.yaml``, but you can create a file to override it with an alternate definition defined in a file named ``01-my-aliases.yaml``.
62 |
63 | .. code-block:: yaml
64 |
65 | # ~/.config/catkin/verb_aliases/01-my-aliases.yaml
66 | # Override `bt` to build with no deps
67 | bt: build --this --no-deps
68 |
69 | You can also disable or unset an alias by setting its value to ``null``.
70 | For example, the ``ls: list`` alias is defined in the default aliases, but you can override it with this entry in a custom file named something like ``02-unset.yaml``:
71 |
72 | .. code-block:: yaml
73 |
74 | # ~/.config/catkin/verb_aliases/02-unset.yaml
75 | # Disable `ls` alias
76 | ls: null
77 |
78 | Recursive Alias Expansion
79 | ^^^^^^^^^^^^^^^^^^^^^^^^^
80 |
81 | Additionally, verb aliases can be recursive, for instance in the ``bt`` alias, the ``b`` alias expands to ``build`` so that ``b --this`` expands to ``build --this``.
82 | The ``catkin`` command shows the expansion of aliases when they are invoked so that their behavior is more transparent:
83 |
84 | .. code-block:: bash
85 |
86 | $ catkin bt
87 | ==> Expanding alias 'bt' from 'catkin bt' to 'catkin b --this'
88 | ==> Expanding alias 'b' from 'catkin b --this' to 'catkin build --this'
89 | ...
90 |
91 |
--------------------------------------------------------------------------------
/docs/build_types.rst:
--------------------------------------------------------------------------------
1 | Supported Build Types
2 | =====================
3 |
4 | The current release of ``catkin_tools`` supports building two types of packages:
5 |
6 | - **Catkin** -- CMake packages that use the Catkin CMake macros
7 | - **CMake** -- "Plain" CMake packages
8 |
9 | There is currently limited support for adding other build types.
10 | For information on extending ``catkin_tools`` to be able to build other types of packages, see :doc:`Adding New Build Types `.
11 | Below are details on the stages involved in building a given package for each of the currently-supported build types.
12 |
13 | Catkin
14 | ^^^^^^
15 |
16 | Catkin packages are CMake packages which utilize the Catkin CMake macros for finding packages and defining configuration files.
17 |
18 | Configuration Arguments
19 | -----------------------
20 |
21 | - ``--cmake-args``
22 | - ``--make-args``
23 | - ``--catkin-make-args``
24 |
25 | Build Stages
26 | ------------
27 |
28 | ============== ============ ==================================================
29 | First Subsequent Description
30 | ============== ============ ==================================================
31 | ``mkdir`` | Create package build space if it doesn't exist.
32 | ---------------------------- --------------------------------------------------
33 | ``cmake`` ``check`` | Run CMake configure step **once** for the
34 | | first build and the ``cmake_check_build_system``
35 | | target for subsequent builds unless the
36 | | ``--force-cmake`` argument is given.
37 | -------------- ------------ --------------------------------------------------
38 | ``preclean`` `optional` | Run the ``clean`` target before building.
39 | | This is only done with the ``--pre-clean`` \
40 | option.
41 | ---------------------------- --------------------------------------------------
42 | ``make`` | Build the default target with GNU make.
43 | ---------------------------- --------------------------------------------------
44 | ``install`` `optional` | Run the ``install`` target after building.
45 | | This is only done with the ``--install`` option.
46 | ---------------------------- --------------------------------------------------
47 | ``setupgen`` | Generate a ``setup.sh`` file to "source" the \
48 | | result space.
49 | ---------------------------- --------------------------------------------------
50 | ``envgen`` | Generate an ``env.sh`` file for loading the \
51 | | result space's environment.
52 | ============================ ==================================================
53 |
54 | CMake
55 | ^^^^^
56 |
57 | Configuration Arguments
58 | -----------------------
59 |
60 | - ``--cmake-args``
61 | - ``--make-args``
62 |
63 | Build Stages
64 | ------------
65 |
66 | ============== ============ ==================================================
67 | First Subsequent Description
68 | ============== ============ ==================================================
69 | ``mkdir`` | Create package build space if it doesn't exist.
70 | ---------------------------- --------------------------------------------------
71 | ``cmake`` ``check`` | Run CMake configure step **once** for the
72 | | first build and the ``cmake_check_build_system``
73 | | target for subsequent builds unless the
74 | | ``--force-cmake`` argument is given.
75 | -------------- ------------ --------------------------------------------------
76 | ``preclean`` `optional` | Run the ``clean`` target before building.
77 | | This is only done with the ``--pre-clean`` \
78 | option.
79 | ---------------------------- --------------------------------------------------
80 | ``make`` | Build the default target with GNU make.
81 | ---------------------------- --------------------------------------------------
82 | ``install`` | Run the ``install`` target after building,
83 | | and install products to the **devel space**.
84 | | If the ``--install`` option is given,
85 | | products are installed to the \
86 | **install space** instead.
87 | ---------------------------- --------------------------------------------------
88 | ``setupgen`` | Generate a ``setup.sh`` file if necessary.
89 | ============================ ==================================================
90 |
91 |
92 |
--------------------------------------------------------------------------------
/docs/development/adding_build_types.rst:
--------------------------------------------------------------------------------
1 | Adding New Build Types
2 | ======================
3 |
4 | The current release of ``catkin_tools`` supports building two types of packages:
5 |
6 | - **Catkin** -- CMake packages that use the Catkin CMake macros
7 | - **CMake** -- "Plain" CMake packages
8 |
9 | In order to fully support additional build types, numerous additions need to be made to the command-line interfaces so that the necessary parameters can be passed to the ``build`` verb.
10 | For partial support, however, all that's needed is to add a build type identifier and a function for generating build jobs.
11 |
12 | The supported build types are easily extendable using the ``setuptools`` ``entry_points`` interface without modifying the ``catkin_tools`` project, itself.
13 | Regardless of what package the ``entry_point`` is defined in, it will be defined in the ``setup.py`` of that package, and will take this form:
14 |
15 | .. code-block:: python
16 |
17 | from setuptools import setup
18 |
19 | setup(
20 | ...
21 | entry_points={
22 | ...
23 | 'catkin_tools.jobs': [
24 | 'mybuild = my_package.some.module:description',
25 | ],
26 | },
27 | )
28 |
29 | This entry in the ``setup.py`` places a file in the ``PYTHONPATH`` when either the ``install`` or the ``develop`` verb is given to ``setup.py``.
30 | This file relates the key (in this case ``mybuild``) to a module and attribute (in this case ``my_package.some.module`` and ``description``).
31 |
32 | Then the ``catkin`` command will use the ``importlib.metadata`` modules to retrieve these mapping at run time.
33 | Any entry for the ``catkin_tools.jobs`` group must point to a ``description`` attribute of a module, where the ``description`` attribute is a ``dict``.
34 | The ``description`` ``dict`` should take this form:
35 |
36 | .. code-block:: python
37 |
38 | description = dict(
39 | build_type='mybuild',
40 | description="Builds a package with the 'mybuild' build type",
41 | create_build_job=create_mybuild_build_job
42 | )
43 |
44 | This ``dict`` defines all the information that the ``catkin`` command needs to create jobs for the ``mybuild`` build type.
45 | The ``build_type`` key takes a string which is the build type identifier.
46 | The ``description`` key takes a string which briefly describes the build type.
47 | The ``create_build_job`` key takes a callable (function) factory which is called in order to create a ``Job`` to build a package of type ``mybuild``.
48 |
49 | The signature of the factory callable should be similar to the following:
50 |
51 | .. code-block:: python
52 |
53 | def create_mybuild_build_job(context, package, package_path, dependencies, **kwargs):
54 | # Initialize empty list of build stages
55 | stages = []
56 |
57 | # Add stages required to build ``mybuild``-type packages,
58 | # based on the configuration context.
59 | # ...
60 |
61 | # Create and return new build Job
62 | return Job(
63 | jid=package.name,
64 | deps=dependencies,
65 | stages=stages)
66 |
--------------------------------------------------------------------------------
/docs/examples/README.md:
--------------------------------------------------------------------------------
1 | Documentation Examples
2 | ======================
3 |
4 | This document explains how to run examples and generate all static text and
5 | asciinema videos.
6 |
7 | ## Prerequisites
8 |
9 | * [perl](http://perl.org)
10 | * [asciinema](http://asciinema.org)
11 | * [rosinstall\_generator](https://github.com/vcstools/wstool)
12 | * [wstool](https://github.com/vcstools/wstool)
13 | * [catkin](https://github.com/ros/catkin)
14 |
15 | ## Generating All Examples
16 |
17 | All examples must be run from the examples directory.
18 |
19 | ```bash
20 | ./quickstart_ws/all.bash
21 | ./failure_ws/all.bash
22 | ./ros_tutorials_ws/all.bash
23 | ```
24 |
25 | ## Scripts
26 |
27 | ### slowrun
28 |
29 | The `slowrun` script executes a script line by line, echoing characters to the
30 | console with a delay, as if they were being typed.
31 |
32 | Optional arguments:
33 |
34 | * `--buffer` -- buffer and delay printing of each line from the output from subcommands
35 |
36 | ### slowrecord
37 |
38 | The `slowrecord` script executes a script line by line with `slowrun`, but also
39 | spawns a `urxvt` terminal with a specific size, and records the commands with
40 | `asciinema`.
41 |
42 | Optional arguments:
43 |
44 | * `--check` -- check interactively before uploading
45 | * `--tall` -- use a taller window for recording
46 |
--------------------------------------------------------------------------------
/docs/examples/failure_ws/0_init.bash:
--------------------------------------------------------------------------------
1 | cp -R $(catkin locate --examples)/failure_ws /tmp/failure_ws
2 | cd /tmp/failure_ws
3 | catkin init
4 |
--------------------------------------------------------------------------------
/docs/examples/failure_ws/1_build_warning.bash:
--------------------------------------------------------------------------------
1 | cd /tmp/failure_ws # Navigate to the workspace
2 | catkin build catkin_pkg_make_warn # Build a package with warnings
3 |
--------------------------------------------------------------------------------
/docs/examples/failure_ws/2_build_err.bash:
--------------------------------------------------------------------------------
1 | cd /tmp/failure_ws # Navigate to the workspace
2 | catkin build catkin_pkg_make_err # Build a package which fails
3 |
--------------------------------------------------------------------------------
/docs/examples/failure_ws/all.bash:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | SLOWRECORD=$(pwd)/slowrecord
4 | WS=/tmp/failure_ws
5 |
6 | pushd `dirname $0`
7 |
8 | rm -rf $WS
9 |
10 | source /opt/ros/noetic/setup.bash
11 | bash 0_init.bash
12 | $SLOWRECORD --check --tall --buffer 1_build_warning.bash
13 | $SLOWRECORD --check --tall --buffer 2_build_err.bash
14 |
15 | popd
16 |
--------------------------------------------------------------------------------
/docs/examples/failure_ws/src/catkin_pkg_cmake_err/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | catkin_pkg_cmake_err
4 | 0.0.0
5 | The catkin_pkg_cmake_err package
6 |
7 |
8 |
9 |
10 | jbohren
11 |
12 |
13 |
14 |
15 |
16 | TODO
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 | catkin
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/docs/examples/failure_ws/src/catkin_pkg_cmake_err/sub/CMakeLists.txt:
--------------------------------------------------------------------------------
1 |
2 | message(SEND_ERROR "This package sends an error from cmake!")
3 | #message(SEND_ERROR "This package sends an error from cmake.\nOne\n\nTwo\n\n\nThree")
4 |
5 |
--------------------------------------------------------------------------------
/docs/examples/failure_ws/src/catkin_pkg_cmake_warn/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | catkin_pkg_cmake_warn
4 | 0.0.0
5 | The catkin_pkg_cmake_warn package
6 |
7 |
8 |
9 |
10 | jbohren
11 |
12 |
13 |
14 |
15 |
16 | TODO
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 | catkin
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/docs/examples/failure_ws/src/catkin_pkg_make_err/main.cpp:
--------------------------------------------------------------------------------
1 | int main(int argc, char** argv) {
2 | int i = 0
3 | return i;
4 | }
5 |
--------------------------------------------------------------------------------
/docs/examples/failure_ws/src/catkin_pkg_make_err/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | catkin_pkg_make_err
4 | 0.0.0
5 | The catkin_pkg_make_err package
6 |
7 |
8 |
9 |
10 | jbohren
11 |
12 |
13 |
14 |
15 |
16 | TODO
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 | catkin
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/docs/examples/failure_ws/src/catkin_pkg_make_warn/grep-errors.txt:
--------------------------------------------------------------------------------
1 | main.cpp: In function ‘int main(int, char**)’:
2 | main.cpp:4:7: warning: unused variable ‘i’ [-Wunused-variable]
3 |
--------------------------------------------------------------------------------
/docs/examples/failure_ws/src/catkin_pkg_make_warn/main.cpp:
--------------------------------------------------------------------------------
1 |
2 | int main(int argc, char** argv) {
3 | double d = 0;
4 | char* foo = "hello";
5 | }
6 |
--------------------------------------------------------------------------------
/docs/examples/failure_ws/src/catkin_pkg_make_warn/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | catkin_pkg_make_warn
4 | 0.0.0
5 | The catkin_pkg_make_warn package
6 |
7 |
8 |
9 |
10 | jbohren
11 |
12 |
13 |
14 |
15 |
16 | TODO
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 | catkin
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/docs/examples/quickstart_ws/0_quickstart.bash:
--------------------------------------------------------------------------------
1 | source /opt/ros/noetic/setup.bash # Source ROS noetic to use Catkin
2 | mkdir -p /tmp/quickstart_ws/src # Make a new workspace and source space
3 | cd /tmp/quickstart_ws # Navigate to the workspace root
4 | catkin init # Initialize it with a hidden marker file
5 | cd /tmp/quickstart_ws/src # Navigate to the source space
6 | catkin create pkg pkg_a # Populate the source space with packages...
7 | catkin create pkg pkg_b
8 | catkin create pkg pkg_c --catkin-deps pkg_a
9 | catkin create pkg pkg_d --catkin-deps pkg_a pkg_b
10 | catkin list # List the packages in the workspace
11 | catkin build # Build all packages in the workspace
12 | source /tmp/quickstart_ws/devel/setup.bash # Load the workspace's environment
13 | catkin clean # Clean all the build products
14 |
--------------------------------------------------------------------------------
/docs/examples/quickstart_ws/1_prebuild.bash:
--------------------------------------------------------------------------------
1 | cd /tmp/quickstart_ws # Navigate to the workspace root
2 | tree -aL 2 # Show prebuild directory tree
3 |
--------------------------------------------------------------------------------
/docs/examples/quickstart_ws/1_prebuild.out:
--------------------------------------------------------------------------------
1 | .
2 | ├── .catkin_tools
3 | │ ├── CATKIN_IGNORE
4 | │ ├── profiles
5 | │ ├── README
6 | │ └── VERSION
7 | └── src
8 | ├── pkg_a
9 | ├── pkg_b
10 | ├── pkg_c
11 | └── pkg_d
12 |
13 | 7 directories, 3 files
14 |
--------------------------------------------------------------------------------
/docs/examples/quickstart_ws/2_postbuild.bash:
--------------------------------------------------------------------------------
1 | cd /tmp/quickstart_ws # Navigate to the workspace root
2 | tree -aL 2 # Show postbuild directory tree
3 |
--------------------------------------------------------------------------------
/docs/examples/quickstart_ws/2_postbuild.out:
--------------------------------------------------------------------------------
1 | .
2 | ├── build
3 | │ ├── .built_by
4 | │ ├── catkin_tools_prebuild
5 | │ ├── .catkin_tools.yaml
6 | │ ├── pkg_a
7 | │ ├── pkg_b
8 | │ ├── pkg_c
9 | │ └── pkg_d
10 | ├── .catkin_tools
11 | │ ├── CATKIN_IGNORE
12 | │ ├── profiles
13 | │ ├── README
14 | │ └── VERSION
15 | ├── devel
16 | │ ├── .built_by
17 | │ ├── .catkin
18 | │ ├── env.sh -> /tmp/quickstart_ws/devel/.private/catkin_tools_prebuild/env.sh
19 | │ ├── etc
20 | │ ├── lib
21 | │ ├── .private
22 | │ ├── setup.bash -> /tmp/quickstart_ws/devel/.private/catkin_tools_prebuild/setup.bash
23 | │ ├── setup.sh -> /tmp/quickstart_ws/devel/.private/catkin_tools_prebuild/setup.sh
24 | │ ├── _setup_util.py -> /tmp/quickstart_ws/devel/.private/catkin_tools_prebuild/_setup_util.py
25 | │ ├── setup.zsh -> /tmp/quickstart_ws/devel/.private/catkin_tools_prebuild/setup.zsh
26 | │ └── share
27 | ├── logs
28 | │ ├── catkin_tools_prebuild
29 | │ ├── pkg_a
30 | │ ├── pkg_b
31 | │ ├── pkg_c
32 | │ └── pkg_d
33 | └── src
34 | ├── pkg_a
35 | ├── pkg_b
36 | ├── pkg_c
37 | └── pkg_d
38 |
39 | 24 directories, 14 files
40 |
--------------------------------------------------------------------------------
/docs/examples/quickstart_ws/all.bash:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | SLOWRECORD=$(pwd)/slowrecord
4 | WS=/tmp/quickstart_ws
5 |
6 | pushd `dirname $0`
7 |
8 | rm -rf $WS
9 | bash 0_quickstart.bash
10 | pushd $WS; catkin clean -y; popd
11 | bash 1_prebuild.bash > 1_prebuild.out
12 | rm -rf $WS
13 | $SLOWRECORD --check --tall --buffer 0_quickstart.bash
14 | bash 2_postbuild.bash > 2_postbuild.out
15 |
16 | popd
17 |
--------------------------------------------------------------------------------
/docs/examples/ros_tutorials_ws/0_checkout.bash:
--------------------------------------------------------------------------------
1 | export ROS_DISTRO=noetic # Set ROS distribution
2 | mkdir -p /tmp/ros_tutorials_ws/src # Create workspace
3 | cd /tmp/ros_tutorials_ws/src # Navigate to source space
4 | rosinstall_generator --deps ros_tutorials > .rosinstall # Get list of packages
5 | wstool update # Checkout all packages
6 | cd /tmp/ros_tutorials_ws # Navigate to ros workspace root
7 | catkin init # Initialize workspace
8 |
--------------------------------------------------------------------------------
/docs/examples/ros_tutorials_ws/1_init.bash:
--------------------------------------------------------------------------------
1 | cd /tmp/ros_tutorials_ws # Navigate to workspace
2 | catkin init # Initialize workspace
3 |
--------------------------------------------------------------------------------
/docs/examples/ros_tutorials_ws/2_dry_run.bash:
--------------------------------------------------------------------------------
1 | cd /tmp/ros_tutorials_ws # Navigate to workspace
2 | catkin build --dry-run # Show the package build order
3 |
--------------------------------------------------------------------------------
/docs/examples/ros_tutorials_ws/3_build.bash:
--------------------------------------------------------------------------------
1 | cd /tmp/ros_tutorials_ws # Navigate to workspace
2 | catkin build # Build all the packages in the workspace
3 | ls build # Show the resulting build space
4 | ls devel # Show the resulting devel space
5 |
--------------------------------------------------------------------------------
/docs/examples/ros_tutorials_ws/4_build_v.bash:
--------------------------------------------------------------------------------
1 | cd /tmp/ros_tutorials_ws # Navigate to workspace
2 | catkin build --verbose # Build all the packages in the workspace
3 |
--------------------------------------------------------------------------------
/docs/examples/ros_tutorials_ws/5_build_i.bash:
--------------------------------------------------------------------------------
1 | cd /tmp/ros_tutorials_ws # Navigate to workspace
2 | catkin build --interleave-output # Build all the packages in the workspace
3 |
--------------------------------------------------------------------------------
/docs/examples/ros_tutorials_ws/6_build_partial.bash:
--------------------------------------------------------------------------------
1 | cd /tmp/ros_tutorials_ws # Navigate to workspace
2 | catkin build roslib # Build roslib and its dependencies
3 |
--------------------------------------------------------------------------------
/docs/examples/ros_tutorials_ws/7_build_this.bash:
--------------------------------------------------------------------------------
1 | cd /tmp/ros_tutorials_ws # Navigate to workspace
2 | cd src/ros/roslib # Navigate to roslib source directory
3 | ls # Show source directory contents
4 | catkin build --this # Build roslib and its dependencies
5 |
--------------------------------------------------------------------------------
/docs/examples/ros_tutorials_ws/8_build_start_with.bash:
--------------------------------------------------------------------------------
1 | cd /tmp/ros_tutorials_ws # Navigate to workspace
2 | catkin build --start-with roslib # Build roslib and its dependents
3 |
--------------------------------------------------------------------------------
/docs/examples/ros_tutorials_ws/9_build_no_deps.bash:
--------------------------------------------------------------------------------
1 | cd /tmp/ros_tutorials_ws # Navigate to workspace
2 | catkin build roslib --no-deps # Build roslib only
3 |
--------------------------------------------------------------------------------
/docs/examples/ros_tutorials_ws/all.bash:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | SLOWRECORD=$(pwd)/slowrecord
4 | WS=/tmp/failure_ws
5 |
6 | pushd `dirname $0`
7 |
8 | rm -rf $WS
9 |
10 | source /opt/ros/noetic/setup.bash
11 |
12 | $SLOWRECORD --check --tall 0_checkout.bash
13 | $SLOWRECORD --check --tall --buffer 1_init.bash
14 | $SLOWRECORD --check --tall --buffer 2_dry_run.bash
15 | $SLOWRECORD --check --tall 3_build.bash
16 | $SLOWRECORD --check --tall 4_build_v.bash
17 | $SLOWRECORD --check --tall 5_build_i.bash
18 | $SLOWRECORD --check --tall 6_build_partial.bash
19 | $SLOWRECORD --check --tall 7_build_this.bash
20 | $SLOWRECORD --check --tall 8_build_start_with.bash
21 | $SLOWRECORD --check --tall 9_build_no_deps.bash
22 |
23 | popd
24 |
--------------------------------------------------------------------------------
/docs/examples/slowrecord:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | pushd `dirname $0` > /dev/null
4 | SCRIPTPATH=`pwd -P`
5 | popd > /dev/null
6 |
7 | # Check before uploading
8 | if [[ "$1" == "--check" ]]; then
9 | upload=""
10 | shift
11 | else
12 | upload="--yes"
13 | fi
14 |
15 | # Set terminal height
16 | if [[ "$1" == "--tall" ]]; then
17 | height=25
18 | shift
19 | else
20 | height=15
21 | fi
22 |
23 | slowcmd="$SCRIPTPATH/slowrun $@"
24 | urxvt -geometry 85x$height -e asciinema rec $upload --command="$slowcmd"
25 |
--------------------------------------------------------------------------------
/docs/examples/slowrun:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | # This script replays a bash script, but prints the command to the console
4 | # one character at a time as if someone was typing it. It also prints the
5 | # name of the immediately-enclosing directory as part of simulated shell
6 | # prompt.
7 | #
8 | # The script takes a single argument, the bash script to execute. It then
9 | # prints out and executes the script, line by line. If a line contains a
10 | # comment, the comment is also printed, but in gray.
11 | #
12 | # Usage:
13 | #
14 | # slowrun SCRIPT [START] [END]
15 | #
16 | # Examples:
17 | #
18 | # slowrun tldr.bash
19 | #
20 | # asciinema rec --command="./slowrun quickstart.bash "
21 | #
22 | # urxvt -geometry 100x30 -e asciinema rec --command="./slowrun quickstart.bash"
23 |
24 | function slowecho {
25 | COLOR=''
26 | NC='\033[0m'
27 | printf "[\033[0;34m$(basename $(pwd) )\033[0m]$ "
28 | sleep 1
29 | arg=${@}
30 | for (( i=0; i < ${#arg}; i+=1 )) ; do
31 | if [ "${arg:$i:1}" == "#" ]; then
32 | COLOR='\033[1;30m'
33 | fi
34 | if [ "${arg:$i:1}" == " " ]; then
35 | sleep 0.2
36 | else
37 | sleep 0.05
38 | fi
39 | printf "${COLOR}${arg:$i:1}"
40 | done
41 | printf "${NC}\n"
42 | }
43 |
44 | if [[ "$1" == "--buffer" ]]; then
45 | buffer=true
46 | shift
47 | else
48 | buffer=false
49 | fi
50 |
51 | lineno=0
52 | startno=${2:-0}
53 | endno=${3:-1000}
54 |
55 | export CATKIN_TOOLS_FORCE_COLOR=1
56 | alias ls='ls --color'
57 |
58 | shopt -s expand_aliases
59 |
60 | while IFS='' read -r line || [[ -n "$line" ]]; do
61 | ((lineno++))
62 | if (( lineno > endno )); then
63 | break
64 | fi
65 | if (( lineno >= startno )); then
66 | if [[ $line == *" #"* ]]; then
67 | filtered_line=$(echo "$line" | perl -pe 's/^(.+?)\s*#(.*)$/\1 #\2/')
68 | slowecho "$filtered_line"
69 | fi
70 | if [ "$buffer" = true ] ; then
71 | eval $line | \
72 | while read -r buffered_line; do
73 | printf "${buffered_line}\n"
74 | sleep 0.1
75 | done
76 | eval $line > /dev/null
77 | else
78 | eval $line
79 | fi
80 | fi
81 | done < "$1"
82 |
--------------------------------------------------------------------------------
/docs/installing.rst:
--------------------------------------------------------------------------------
1 | Installing ``catkin_tools``
2 | ===========================
3 |
4 | You can install the ``catkin_tools`` package as a binary through a package manager like ``pip`` or ``apt-get``, or from source.
5 |
6 | .. note::
7 |
8 | This project is still in beta and has not been released yet, please install from source.
9 | In particular, interface and behavior are still subject to incompatible changes.
10 | If you rely on a stable environment, please use ``catkin_make`` instead of this tool.
11 |
12 | Installing on Ubuntu with apt-get
13 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
14 |
15 | First you must have the ROS repositories which contain the ``.deb`` for ``catkin_tools``:
16 |
17 | .. code-block:: bash
18 |
19 | $ sudo sh \
20 | -c 'echo "deb http://packages.ros.org/ros/ubuntu `lsb_release -sc` main" \
21 | > /etc/apt/sources.list.d/ros-latest.list'
22 | $ wget http://packages.ros.org/ros.key -O - | sudo apt-key add -
23 |
24 | Once you have added that repository, run these commands to install ``catkin_tools``:
25 |
26 | .. code-block:: bash
27 |
28 | $ sudo apt-get update
29 | $ sudo apt-get install python3-catkin-tools
30 |
31 | Installing on other platforms with pip
32 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
33 |
34 | Simply install it with ``pip``:
35 |
36 | .. code-block:: bash
37 |
38 | $ sudo pip3 install -U catkin_tools
39 |
40 | Installing from source
41 | ^^^^^^^^^^^^^^^^^^^^^^
42 |
43 | First clone the source for ``catkin_tools``:
44 |
45 | .. code-block:: bash
46 |
47 | $ git clone https://github.com/catkin/catkin_tools.git
48 | $ cd catkin_tools
49 |
50 | Then install the dependencies with ``pip``:
51 |
52 | .. code-block:: bash
53 |
54 | $ pip3 install -r requirements.txt --upgrade
55 |
56 | Then install with the ``setup.py`` file:
57 |
58 | .. code-block:: bash
59 |
60 | $ python3 setup.py install --record install_manifest.txt
61 |
62 | .. note::
63 |
64 | Depending on your environment/machine, you may need to use ``sudo`` with this command.
65 |
66 | .. note::
67 |
68 | If you want to perform a *local* install to your home directory, use the ``install --user`` option.
69 |
70 | Developing
71 | ----------
72 |
73 | To setup ``catkin_tools`` for fast iteration during development, use the ``develop`` verb to ``setup.py``:
74 |
75 | .. code-block:: bash
76 |
77 | $ python3 setup.py develop
78 |
79 | Now the commands, like ``catkin``, will be in the system path and the local source files located in the ``catkin_tools`` folder will be on the ``PYTHONPATH``.
80 | When you are done with your development, undo this by running this command:
81 |
82 | .. code-block:: bash
83 |
84 | $ python3 setup.py develop -u
85 |
86 |
87 | Uninstalling from Source
88 | ------------------------
89 |
90 | If you installed from source with the ``--record`` option, you can run the following to remove ``catkin_tools``:
91 |
92 | .. code-block:: bash
93 |
94 | $ cat install_manifest.txt | xargs rm -rf
95 |
--------------------------------------------------------------------------------
/docs/requirements.txt:
--------------------------------------------------------------------------------
1 | sphinx-rtd-theme
2 | sphinxcontrib-spelling
3 |
--------------------------------------------------------------------------------
/docs/spelling_wordlist.txt:
--------------------------------------------------------------------------------
1 | acyclic
2 | args
3 | autotools
4 | buildsystem
5 | buildtool
6 | buildtools
7 | CMake
8 | config
9 | deinitialize
10 | dependent
11 | dependents
12 | devel
13 | devel
14 | distributable
15 | env
16 | executables
17 | extendable
18 | internet
19 | logfile
20 | Makefiles
21 | metadata
22 | multi
23 | parallelize
24 | parallelized
25 | parallelizing
26 | parameterized
27 | prebuild
28 | prepends
29 | preprocess
30 | Quickstart
31 | roadmap
32 | subdirectories
33 | subdirectory
34 | Ubuntu
35 | underlaid
36 | Unformatted
37 | Uninstalling
38 | unsatisfiable
39 | unsetting
40 | buildlist
41 | buildlisted
42 | Buildlisting
43 | workflow
44 | workspace
45 | Workspace
46 | workspaces
47 | Workspaces
48 |
--------------------------------------------------------------------------------
/docs/troubleshooting.rst:
--------------------------------------------------------------------------------
1 | Troubleshooting
2 | ===============
3 |
4 | Configuration Summary Warnings
5 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6 |
7 | The ``catkin`` tool is capable of detecting some issues or inconsistencies with the build configuration automatically.
8 | In these cases, it will often describe the problem as well as how to resolve it.
9 | The ``catkin`` tool will detect the following issues automatically.
10 |
11 | Missing Workspace Components
12 | ----------------------------
13 |
14 | - Uninitialized workspace (missing ``.catkin_tools`` directory)
15 | - Missing **source space** as specified by the configuration
16 |
17 | Inconsistent Environment
18 | ------------------------
19 |
20 | - The ``CMAKE_PREFIX_PATH`` environment variable is different than the cached ``CMAKE_PREFIX_PATH``
21 | - The explicitly extended workspace path yields a different ``CMAKE_PREFIX_PATH`` than the cached ``CMAKE_PREFIX_PATH``
22 | - The **build space** or **devel space** was built with a different tool such as ``catkin_make`` or ``catkin_make_isolated``
23 | - The **build space** or **devel space** was built in a different isolation mode
24 |
25 | Dependency Resolution
26 | ^^^^^^^^^^^^^^^^^^^^^
27 |
28 | Packages Are Being Built Out of Order
29 | -------------------------------------
30 |
31 | - The ``package.xml`` dependency tags are most likely incorrect.
32 | Note that dependencies are only used to order the packages, and there is no warning if a package can't be found.
33 | - Run ``catkin list --deps /path/to/ws/src`` to list the dependencies of each package and look for errors.
34 |
35 |
36 | Incorrect Resolution of Workspace Overlays
37 | ------------------------------------------
38 |
39 | It's possible for a CMake package to include header directories as ``SYSTEM`` includes pointing to the workspace root include directory (like ``/path/to/ws/devel/include``).
40 | If this happens, CMake will ignore any "normal" includes to that path, and prefer the ``SYSTEM`` include.
41 | This means that ``/path/to/ws/devel/include`` will be searched *after* any other normal includes.
42 | If another package specifies ``/opt/ros/noetic/include`` as a normal include, it will take precedence.
43 |
44 | - Minimal example here: https://github.com/jbohren/isystem
45 | - Overview of GCC's system include precedence here: https://gcc.gnu.org/onlinedocs/cpp/System-Headers.html
46 |
47 | As a workaround, you can force CMake to ignore all specified root include directories, and rely on CPATH for header resolution in these paths:
48 |
49 | .. code-block:: bash
50 |
51 | catkin config -a --cmake-args -DCMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES="/opt/ros/noetic/include"
52 |
53 | This is actually a bug in CMake and has been reported here: https://cmake.org/Bug/view.php?id=15970
54 |
55 |
56 | Migration Problems
57 | ^^^^^^^^^^^^^^^^^^
58 |
59 | For troubleshooting problems when migrating from ``catkin_make`` or ``catkin_make_isolated``, see :ref:`migration-troubleshooting`.
60 |
--------------------------------------------------------------------------------
/docs/verbs/catkin_clean.rst:
--------------------------------------------------------------------------------
1 | ``catkin clean`` -- Clean Build Products
2 | ========================================
3 |
4 | The ``clean`` verb makes it easier and safer to clean various products of a catkin workspace.
5 | In addition to removing entire **build**, **devel**, and **install spaces**, it also gives you more fine-grained control over removing just parts of these directories.
6 |
7 | The ``clean`` verb is context-aware, but in order to work, it must be given the path to an initialized catkin workspace, or called from a path contained in an initialized catkin workspace.
8 |
9 | Space Cleaning
10 | ^^^^^^^^^^^^^^
11 |
12 | For any configuration, any of the active profile's spaces can be cleaned entirely.
13 | This includes any of the top-level directories which are configured for a given profile.
14 | See the full command line interface for specifying specific spaces to clean.
15 |
16 | To clean all of the spaces for a given profile, you can call the ``clean`` verb without arguments:
17 |
18 | .. code-block:: bash
19 |
20 | catkin clean
21 |
22 | When running this command, ``catkin`` will prompt you to confirm that you want to delete the entire directories:
23 |
24 | .. code-block:: bash
25 |
26 | $ catkin clean
27 | [clean] Warning: This will completely remove the following directories. (Use `--yes` to skip this check)
28 | [clean] Log Space: /tmp/quickstart_ws/logs
29 | [clean] Build Space: /tmp/quickstart_ws/build
30 | [clean] Devel Space: /tmp/quickstart_ws/devel
31 |
32 | [clean] Are you sure you want to completely remove the directories listed above? [yN]:
33 |
34 | If you want to skip this check, you can use the ``--yes`` or ``-y`` options:
35 |
36 | .. code-block:: bash
37 |
38 | $ catkin clean -y
39 | [clean] Removing develspace: /tmp/quickstart_ws/devel
40 | [clean] Removing buildspace: /tmp/quickstart_ws/build
41 | [clean] Removing log space: /tmp/quickstart_ws/logs
42 |
43 | .. note::
44 |
45 | The ``clean`` verb will also ask for additional confirmation if any of the directories to be removed are outside of your workspace root.
46 | To skip this additional check, you can use the ``--force`` option.
47 |
48 | Partial Cleaning
49 | ^^^^^^^^^^^^^^^^
50 |
51 | If a workspace is built with a ``linked`` **devel space**, the ``clean`` verb can be used to clean the products from individual packages.
52 | This is possible since the ``catkin`` program will symbolically link the build products into the **devel space**, and stores a list of these links.
53 |
54 | Cleaning a Single Package
55 | -------------------------
56 |
57 | Cleaning a single package (or several packages) is as simple as naming them:
58 |
59 | .. code-block:: bash
60 |
61 | catkin clean PKGNAME
62 |
63 | This will remove products from this package from the devel space, and remove its build space.
64 |
65 | Cleaning Products from Missing Packages
66 | ---------------------------------------
67 |
68 | Sometimes, you may disable or remove source packages from your workspace's **source space**.
69 | After packages have been removed from your **source space**, you can automatically clean the "orphaned" products with the following command:
70 |
71 | .. code-block:: bash
72 |
73 | catkin clean --orphans
74 |
75 | Cleaning Dependent Packages
76 | ---------------------------
77 |
78 | When cleaning one package, it's sometimes useful to also clean all of the packages which depend on it.
79 | This can prevent leftover elements from affecting the dependents.
80 | To clean a package and only the packages which depend on it, you can run the following:
81 |
82 | .. code-block:: bash
83 |
84 | catkin clean --dependents PKGNAME
85 |
86 |
87 | Cleaning Products from All Profiles
88 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
89 |
90 | By default, the ``clean`` operating is applied only to the active or specified profile.
91 | To apply it to *all* profiles, use the ``--all-profiles`` option.
92 |
93 | Cleaning Everything
94 | ^^^^^^^^^^^^^^^^^^^
95 |
96 | If you want to clean **everything** except the source space (i.e. all files and folders generated by the ``catkin`` command, you can use ``--deinit`` to "deinitialize" the workspace.
97 | This will clean all products from all packages for all profiles, as well as the profile metadata, itself.
98 | After running this, a ``catkin_tools`` workspace will need to be reinitialized to be used.
99 |
100 | .. code-block:: bash
101 |
102 | catkin clean --deinit
103 |
104 | Full Command-Line Interface
105 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
106 |
107 | .. literalinclude:: cli/catkin_clean.txt
108 | :language: text
109 |
--------------------------------------------------------------------------------
/docs/verbs/catkin_create.rst:
--------------------------------------------------------------------------------
1 | ``catkin create`` -- Create Packages
2 | ====================================
3 |
4 | This verb enables you to quickly create workspace elements like boilerplate Catkin packages.
5 |
6 | Full Command-Line Interface
7 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
8 |
9 | .. literalinclude:: cli/catkin_create.txt
10 | :language: text
11 |
12 | ``catkin create pkg``
13 | -------------------------
14 |
15 | .. literalinclude:: cli/catkin_create_pkg.txt
16 | :language: text
17 |
18 |
--------------------------------------------------------------------------------
/docs/verbs/catkin_env.rst:
--------------------------------------------------------------------------------
1 | ``catkin env`` -- Environment Utility
2 | =====================================
3 |
4 | The ``env`` verb can be used to both print the current environment variables and run a command in a modified environment.
5 | This verb is supplied as a cross-platform alternative to the UNIX ``env`` command or the ``cmake -E environment`` command.
6 | It is primarily used in the build stage command reproduction.
7 |
8 | Full Command-Line Interface
9 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
10 |
11 | .. literalinclude:: cli/catkin_env.txt
12 | :language: text
13 |
--------------------------------------------------------------------------------
/docs/verbs/catkin_init.rst:
--------------------------------------------------------------------------------
1 | ``catkin init`` -- Initialize a Workspace
2 | =========================================
3 |
4 | The ``init`` verb is the simplest way to "initialize" a catkin workspace so that it can be automatically detected automatically by other verbs which need to know the location of the workspace root.
5 |
6 | This verb does not store any configuration information, but simply creates the hidden ``.catkin_tools`` directory in the specified workspace.
7 | If you want to initialize a workspace simultaneously with an initial config, see the ``--init`` option for the ``config`` verb.
8 |
9 | Catkin workspaces can be initialized anywhere.
10 | The only constraint is that catkin workspaces cannot contain other catkin workspaces.
11 | If you call ``catkin init`` and it reports an error saying that the given directory is already contained in a workspace, you can call ``catkin config`` to determine the root of that workspace.
12 |
13 | Full Command-Line Interface
14 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
15 |
16 | .. literalinclude:: cli/catkin_init.txt
17 | :language: text
18 |
--------------------------------------------------------------------------------
/docs/verbs/catkin_list.rst:
--------------------------------------------------------------------------------
1 | ``catkin list`` -- List Package Info
2 | ====================================
3 |
4 | The ``list`` verb for the ``catkin`` command is used to find and list information about catkin packages.
5 | By default, it will list the packages in the workspace containing the current working directory in topological order.
6 | It can also be used to list the packages in any other arbitrary directory.
7 |
8 | List Package Dependencies
9 | ^^^^^^^^^^^^^^^^^^^^^^^^^
10 |
11 | ``catkin list`` can also show the dependencies of all packages or a subset of the packages when
12 | ``catkin list --dependencies`` or ``catkin list --dependencies my_package`` is used.
13 | Recursive dependencies can be listed with ``catkin list --recursive-dependencies``.
14 |
15 | Checking for Catkin Package Warnings
16 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
17 |
18 | In addition to the names of the packages in your workspace, running ``catkin list`` will output any warnings about catkin packages in your workspace.
19 | To suppress these warnings, you can use the ``--quiet`` option.
20 |
21 | Using Unformatted Output in Shell Scripts
22 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
23 |
24 | ``catkin list --unformatted`` is useful for automating shell scripts in UNIX pipe-based programs.
25 | For ``--dependencies``, valid YAML output is produced.
26 |
27 | Full Command-Line Interface
28 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
29 |
30 | .. literalinclude:: cli/catkin_list.txt
31 | :language: text
32 |
--------------------------------------------------------------------------------
/docs/verbs/catkin_locate.rst:
--------------------------------------------------------------------------------
1 | ``catkin locate`` -- Locate Directories
2 | =======================================
3 |
4 | The ``locate`` verb can be used to locate important locations in the workspace such as the active ``source``, ``build``, ``devel``, and ``install`` spaces, and package directories in the workspace.
5 |
6 | Full Command-Line Interface
7 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
8 |
9 | .. literalinclude:: cli/catkin_locate.txt
10 | :language: text
11 |
--------------------------------------------------------------------------------
/docs/verbs/catkin_test.rst:
--------------------------------------------------------------------------------
1 | ``catkin test`` -- Test Packages
2 | ==================================
3 |
4 | The ``test`` verb is used to test one or more packages in a catkin workspace.
5 | Like most verbs, ``test`` is context-aware and can be executed from within any directory contained by an initialized workspace.
6 | Specific workspaces can also be built from arbitrary working directories with the ``--workspace`` option.
7 |
8 | Basic Usage
9 | ^^^^^^^^^^^
10 |
11 | Before running tests for packages in the workspace, they have to be built with ``catkin build``.
12 | Then, to run the tests, use the following:
13 |
14 | .. code-block:: bash
15 |
16 | $ catkin test
17 |
18 | Under the hood, this invokes the ``make`` targets ``run_tests`` or ``test``, depending on the package.
19 | catkin packages all define the ``run_tests`` target which aggregates all types of tests and runs them together.
20 | For cmake packages that do not use catkin, the ``test`` target is invoked.
21 | This target is usually populated by cmake when the ``enable_testing()`` command is used in the ``CMakeLists.txt``.
22 | If it does not exist, a warning is printed.
23 |
24 | To run a catkin test for a specific catkin package, from a directory within that package:
25 |
26 | .. code-block:: bash
27 |
28 | $ catkin test --this
29 |
30 | Advanced Options
31 | ^^^^^^^^^^^^^^^^
32 |
33 | To manually specify a different ``make`` target, use ``--test-target``:
34 |
35 | .. code-block:: bash
36 |
37 | $ catkin test --test-target gtest
38 |
39 | It is also possible to use ``--catkin-test-target`` to change the target only for catkin packages.
40 |
41 | Normally, the tests are run in parallel, similar to the build jobs of ``catkin build``.
42 | To avoid building packages in parallel or to reduce the amount of parallel jobs, use ``-p``:
43 |
44 | .. code-block:: bash
45 |
46 | $ catkin test -p 1
47 |
48 | Sometimes, it can be helpful to see the output of tests while they are still running.
49 | This can be achieved using ``--interleave-output``.
50 |
51 | Full Command-Line Interface
52 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
53 |
54 | .. literalinclude:: cli/catkin_test.txt
55 | :language: text
56 |
--------------------------------------------------------------------------------
/docs/verbs/cli/catkin_clean.txt:
--------------------------------------------------------------------------------
1 | usage: catkin clean [-h] [--workspace WORKSPACE] [--profile PROFILE]
2 | [--dry-run] [--verbose] [--yes] [--force] [--all-profiles]
3 | [--deinit] [-b] [-d] [-i] [-L] [--this] [--dependents]
4 | [--orphans] [--setup-files]
5 | [PKGNAME ...]
6 |
7 | Deletes various products of the build verb.
8 |
9 | optional arguments:
10 | -h, --help show this help message and exit
11 | --workspace WORKSPACE, -w WORKSPACE
12 | The path to the catkin_tools workspace or a directory
13 | contained within it (default: ".")
14 | --profile PROFILE The name of a config profile to use (default: active
15 | profile)
16 | --dry-run, -n Show the effects of the clean action without modifying
17 | the workspace.
18 | --verbose, -v Verbose status output.
19 | --yes, -y Assume "yes" to all interactive checks.
20 | --force, -f Allow cleaning files outside of the workspace root.
21 | --all-profiles Apply the specified clean operation for all profiles
22 | in this workspace.
23 |
24 | Full:
25 | Remove everything except the source space.
26 |
27 | --deinit De-initialize the workspace, delete all build profiles
28 | and configuration. This will also clean subdirectories
29 | for all profiles in the workspace.
30 |
31 | Spaces:
32 | Clean workspace subdirectories for the selected profile.
33 |
34 | -b, --build, --build-space
35 | Remove the entire build space.
36 | -d, --devel, --devel-space
37 | Remove the entire devel space.
38 | -i, --install, --install-space
39 | Remove the entire install space.
40 | -L, --logs, --log-space
41 | Remove the entire log space.
42 |
43 | Packages:
44 | Clean products from specific packages in the workspace. Note that these
45 | options are only available in a `linked` devel space layout. These options
46 | will also automatically enable the --force-cmake option for the next build
47 | invocation.
48 |
49 | PKGNAME Explicilty specify a list of specific packages to
50 | clean from the build, devel, and install space.
51 | --this Clean the package containing the current working
52 | directory from the build, devel, and install space.
53 | --dependents, --deps Clean the packages which depend on the packages to be
54 | cleaned.
55 | --orphans Remove products from packages are no longer in the
56 | source space. Note that this also removes packages
57 | which are skiplisted or which contain `CATKIN_IGNORE`
58 | marker files.
59 |
60 | Advanced:
61 | Clean other specific parts of the workspace.
62 |
63 | --setup-files Clear the catkin-generated setup files from the devel
64 | and install spaces.
65 |
--------------------------------------------------------------------------------
/docs/verbs/cli/catkin_create.txt:
--------------------------------------------------------------------------------
1 | usage: catkin create [-h] [--workspace WORKSPACE] [--profile PROFILE]
2 | {pkg} ...
3 |
4 | Creates catkin workspace resources like packages.
5 |
6 | positional arguments:
7 | {pkg} sub-command help
8 | pkg Create a new catkin package.
9 |
10 | optional arguments:
11 | -h, --help show this help message and exit
12 | --workspace WORKSPACE, -w WORKSPACE
13 | The path to the catkin_tools workspace or a directory
14 | contained within it (default: ".")
15 | --profile PROFILE The name of a config profile to use (default: active
16 | profile)
17 |
--------------------------------------------------------------------------------
/docs/verbs/cli/catkin_create_pkg.txt:
--------------------------------------------------------------------------------
1 | usage: catkin create pkg [-h] [-p PATH] --rosdistro ROSDISTRO
2 | [-v MAJOR.MINOR.PATCH] [-l LICENSE] [-m NAME EMAIL]
3 | [-a NAME EMAIL] [-d DESCRIPTION]
4 | [--catkin-deps [DEP ...]] [--system-deps [DEP ...]]
5 | [--boost-components [COMP ...]]
6 | PKG_NAME [PKG_NAME ...]
7 |
8 | Create a new Catkin package. Note that while the default options used by this
9 | command are sufficient for prototyping and local usage, it is important that
10 | any publicly-available packages have a valid license and a valid maintainer
11 | e-mail address.
12 |
13 | positional arguments:
14 | PKG_NAME The name of one or more packages to create. This name
15 | should be completely lower-case with individual words
16 | separated by underscores.
17 |
18 | optional arguments:
19 | -h, --help show this help message and exit
20 | -p PATH, --path PATH The path into which the package should be generated.
21 | --rosdistro ROSDISTRO
22 | The ROS distro (default: environment variable
23 | ROS_DISTRO if defined)
24 |
25 | Package Metadata:
26 | -v MAJOR.MINOR.PATCH, --version MAJOR.MINOR.PATCH
27 | Initial package version. (default 0.0.0)
28 | -l LICENSE, --license LICENSE
29 | The software license under which the code is
30 | distributed, such as BSD, MIT, GPLv3, or others.
31 | (default: "TODO")
32 | -m NAME EMAIL, --maintainer NAME EMAIL
33 | A maintainer who is responsible for the package.
34 | (default: [username, username@todo.todo]) (multiple
35 | allowed)
36 | -a NAME EMAIL, --author NAME EMAIL
37 | An author who contributed to the package. (default: no
38 | additional authors) (multiple allowed)
39 | -d DESCRIPTION, --description DESCRIPTION
40 | Description of the package. (default: empty)
41 |
42 | Package Dependencies:
43 | --catkin-deps [DEP ...], -c [DEP ...]
44 | The names of one or more Catkin dependencies. These
45 | are Catkin-based packages which are either built as
46 | source or installed by your system's package manager.
47 | --system-deps [DEP ...], -s [DEP ...]
48 | The names of one or more system dependencies. These
49 | are other packages installed by your operating
50 | system's package manager.
51 |
52 | C++ Options:
53 | --boost-components [COMP ...]
54 | One or more boost components used by the package.
55 |
--------------------------------------------------------------------------------
/docs/verbs/cli/catkin_env.txt:
--------------------------------------------------------------------------------
1 | usage: catkin env [-h] [-i] [-s] [NAME=VALUE ...] [COMMAND] [ARG ...]
2 |
3 | Run an arbitrary command in a modified environment.
4 |
5 | positional arguments:
6 | NAME=VALUE Explicitly set environment variables for the
7 | subcommand. These override variables given to stdin.
8 |
9 | optional arguments:
10 | -h, --help show this help message and exit
11 | -i, --ignore-environment
12 | Start with an empty environment.
13 | -s, --stdin Read environment variable definitions from stdin.
14 | Variables should be given in NAME=VALUE format,
15 | separated by null-bytes.
16 |
17 | command:
18 | COMMAND Command to run. If omitted, the environment is printed
19 | to stdout.
20 | ARG Arguments to the command.
21 |
--------------------------------------------------------------------------------
/docs/verbs/cli/catkin_init.txt:
--------------------------------------------------------------------------------
1 | usage: catkin init [-h] [--workspace WORKSPACE] [--reset]
2 |
3 | Initializes a given folder as a catkin workspace.
4 |
5 | optional arguments:
6 | -h, --help show this help message and exit
7 | --workspace WORKSPACE, -w WORKSPACE
8 | The path to the catkin_tools workspace or a directory
9 | contained within it (default: ".")
10 | --reset Reset (delete) all of the metadata for the given
11 | workspace.
12 |
--------------------------------------------------------------------------------
/docs/verbs/cli/catkin_list.txt:
--------------------------------------------------------------------------------
1 | usage: catkin list [-h] [--workspace WORKSPACE] [--profile PROFILE]
2 | [--deps | --rdeps] [--depends-on [PKG ...]]
3 | [--rdepends-on [PKG ...]] [--this]
4 | [--directory [DIRECTORY ...]] [--quiet] [--unformatted]
5 | [PKG ...]
6 |
7 | Lists catkin packages in the workspace or other arbitrary folders.
8 |
9 | optional arguments:
10 | -h, --help show this help message and exit
11 | --workspace WORKSPACE, -w WORKSPACE
12 | The path to the catkin_tools workspace or a directory
13 | contained within it (default: ".")
14 | --profile PROFILE The name of a config profile to use (default: active
15 | profile)
16 |
17 | Information:
18 | Control which information is shown.
19 |
20 | --deps, --dependencies
21 | Show direct dependencies of each package.
22 | --rdeps, --recursive-dependencies
23 | Show recursive dependencies of each package.
24 |
25 | Packages:
26 | Control which packages are listed.
27 |
28 | --depends-on [PKG ...]
29 | Only show packages that directly depend on specific
30 | package(s).
31 | --rdepends-on [PKG ...], --recursive-depends-on [PKG ...]
32 | Only show packages that recursively depend on specific
33 | package(s). Limited to packages present in the current
34 | workspace.
35 | --this Show the package which contains the current working
36 | directory.
37 | --directory [DIRECTORY ...], -d [DIRECTORY ...]
38 | Process all packages in the given directories
39 | PKG Manually specify a list of packages to process.
40 | Defaults to all packages.
41 |
42 | Interface:
43 | The behavior of the command-line interface.
44 |
45 | --quiet Don't print out detected package warnings.
46 | --unformatted, -u Print list without punctuation and additional details.
47 |
--------------------------------------------------------------------------------
/docs/verbs/cli/catkin_locate.txt:
--------------------------------------------------------------------------------
1 | usage: catkin locate [-h] [--workspace WORKSPACE] [--profile PROFILE] [-e]
2 | [-r] [-q] [-b | -d | -i | -L | -s] [--this]
3 | [--shell-verbs] [--examples]
4 | [PACKAGE]
5 |
6 | Get the paths to various locations in a workspace.
7 |
8 | optional arguments:
9 | -h, --help show this help message and exit
10 | --workspace WORKSPACE, -w WORKSPACE
11 | The path to the catkin_tools workspace or a directory
12 | contained within it (default: ".")
13 | --profile PROFILE The name of a config profile to use (default: active
14 | profile)
15 |
16 | Behavior:
17 | -e, --existing-only Only print paths to existing directories.
18 | -r, --relative Print relative paths instead of the absolute paths.
19 | -q, --quiet Suppress warning output.
20 |
21 | Sub-Space Options:
22 | Get the absolute path to one of the following locations in the given
23 | workspace with the given profile.
24 |
25 | -b, --build, --build-space
26 | Get the path to the build space.
27 | -d, --devel, --devel-space
28 | Get the path to the devel space.
29 | -i, --install, --install-space
30 | Get the path to the install space.
31 | -L, --logs, --log-space
32 | Get the path to the log space.
33 | -s, --src, --source-space
34 | Get the path to the source space.
35 |
36 | Package Directories:
37 | Get the absolute path to package directories in the given workspace and
38 | sub-space. By default this will output paths in the workspace's source
39 | space. If the -b (--build) flag is given, it will output the path to the
40 | package's build directory. If the -d or -i (--devel or --install) flags
41 | are given, it will output the path to the package's share directory in
42 | that space. If no package is provided, the base space paths are printed,
43 | e.g. `catkin locate -s` might return `/path/to/ws/src` and `catkin locate
44 | -s foo` might return `/path/to/ws/src/foo`.
45 |
46 | PACKAGE The name of a package to locate.
47 | --this Locate package containing current working directory.
48 |
49 | Special Directories:
50 | Get the absolute path to a special catkin location
51 |
52 | --shell-verbs Get the path to the shell verbs script.
53 | --examples Get the path to the examples directory.
54 |
--------------------------------------------------------------------------------
/docs/verbs/cli/catkin_profile.txt:
--------------------------------------------------------------------------------
1 | usage: catkin profile [-h] [--workspace WORKSPACE]
2 | {list,set,add,rename,remove} ...
3 |
4 | Manage config profiles for a catkin workspace.
5 |
6 | positional arguments:
7 | {list,set,add,rename,remove}
8 | sub-command help
9 | list List the available profiles.
10 | set Set the active profile by name.
11 | add Add a new profile by name.
12 | rename Rename a given profile.
13 | remove Remove a profile by name.
14 |
15 | optional arguments:
16 | -h, --help show this help message and exit
17 | --workspace WORKSPACE, -w WORKSPACE
18 | The path to the catkin workspace. Default: current
19 | working directory
20 |
--------------------------------------------------------------------------------
/docs/verbs/cli/catkin_profile_add.txt:
--------------------------------------------------------------------------------
1 | usage: catkin profile add [-h] [-f]
2 | [--copy BASE_PROFILE | --copy-active | --extend PARENT_PROFILE]
3 | name
4 |
5 | positional arguments:
6 | name The new profile name.
7 |
8 | optional arguments:
9 | -h, --help show this help message and exit
10 | -f, --force Overwrite an existing profile.
11 | --copy BASE_PROFILE Copy the settings from an existing profile. (default:
12 | None)
13 | --copy-active Copy the settings from the active profile.
14 | --extend PARENT_PROFILE
15 | Extend another profile
16 |
--------------------------------------------------------------------------------
/docs/verbs/cli/catkin_profile_list.txt:
--------------------------------------------------------------------------------
1 | usage: catkin profile list [-h] [--unformatted] [--active]
2 |
3 | optional arguments:
4 | -h, --help show this help message and exit
5 | --unformatted, -u Print profile list without punctuation and additional
6 | details.
7 | --active Print only active profile.
8 |
--------------------------------------------------------------------------------
/docs/verbs/cli/catkin_profile_remove.txt:
--------------------------------------------------------------------------------
1 | usage: catkin profile remove [-h] [name ...]
2 |
3 | positional arguments:
4 | name One or more profile names to remove.
5 |
6 | optional arguments:
7 | -h, --help show this help message and exit
8 |
--------------------------------------------------------------------------------
/docs/verbs/cli/catkin_profile_rename.txt:
--------------------------------------------------------------------------------
1 | usage: catkin profile rename [-h] [-f] current_name new_name
2 |
3 | positional arguments:
4 | current_name The current name of the profile to be renamed.
5 | new_name The new name for the profile.
6 |
7 | optional arguments:
8 | -h, --help show this help message and exit
9 | -f, --force Overwrite an existing profile.
10 |
--------------------------------------------------------------------------------
/docs/verbs/cli/catkin_profile_set.txt:
--------------------------------------------------------------------------------
1 | usage: catkin profile set [-h] name
2 |
3 | positional arguments:
4 | name The profile to activate.
5 |
6 | optional arguments:
7 | -h, --help show this help message and exit
8 |
--------------------------------------------------------------------------------
/docs/verbs/cli/catkin_test.txt:
--------------------------------------------------------------------------------
1 | usage: catkin test [-h] [--workspace WORKSPACE] [--profile PROFILE] [--this]
2 | [--continue-on-failure] [-p PACKAGE_JOBS] [-t TARGET]
3 | [--catkin-test-target TARGET] [--make-args ARG [ARG ...]]
4 | [--verbose] [--interleave-output] [--summarize]
5 | [--no-status] [--limit-status-rate LIMIT_STATUS_RATE]
6 | [--no-notify]
7 | [PKGNAME ...]
8 |
9 | Test one or more packages in a catkin workspace. This invokes `make run_tests`
10 | or `make test` for either all or the specified packages in a catkin workspace.
11 |
12 | optional arguments:
13 | -h, --help show this help message and exit
14 | --workspace WORKSPACE, -w WORKSPACE
15 | The path to the catkin_tools workspace or a directory
16 | contained within it (default: ".")
17 | --profile PROFILE The name of a config profile to use (default: active
18 | profile)
19 |
20 | Packages:
21 | Control which packages get tested.
22 |
23 | PKGNAME Workspace packages to test. If no packages are given,
24 | then all the packages are tested.
25 | --this Test the package containing the current working
26 | directory.
27 | --continue-on-failure, -c
28 | Continue testing packages even if the tests for other
29 | requested packages fail.
30 |
31 | Config:
32 | Parameters for the underlying build system.
33 |
34 | -p PACKAGE_JOBS, --parallel-packages PACKAGE_JOBS
35 | Maximum number of packages allowed to be built in
36 | parallel (default is cpu count)
37 | -t TARGET, --test-target TARGET
38 | Make target to run for tests (default is "run_tests"
39 | for catkin and "test" for cmake)
40 | --catkin-test-target TARGET
41 | Make target to run for tests for catkin packages,
42 | overwrites --test-target (default is "run_tests")
43 | --make-args ARG [ARG ...]
44 | Arbitrary arguments which are passed to make. It
45 | collects all of following arguments until a "--" is
46 | read.
47 |
48 | Interface:
49 | The behavior of the command-line interface.
50 |
51 | --verbose, -v Print output from commands in ordered blocks once the
52 | command finishes.
53 | --interleave-output, -i
54 | Prevents ordering of command output when multiple
55 | commands are running at the same time.
56 | --summarize, --summary, -s
57 | Adds a summary to the end of the log
58 | --no-status Suppresses status line, useful in situations where
59 | carriage return is not properly supported.
60 | --limit-status-rate LIMIT_STATUS_RATE, --status-rate LIMIT_STATUS_RATE
61 | Limit the update rate of the status bar to this
62 | frequency. Zero means unlimited. Must be positive,
63 | default is 10 Hz.
64 | --no-notify Suppresses system pop-up notification.
65 |
--------------------------------------------------------------------------------
/docs/verbs/cli/dump_cli:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | catkin build -h > catkin_build.txt
4 | catkin clean -h > catkin_clean.txt
5 | catkin config -h > catkin_config.txt
6 | catkin create -h > catkin_create.txt
7 | catkin create pkg -h > catkin_create_pkg.txt
8 | catkin env -h > catkin_env.txt
9 | catkin init -h > catkin_init.txt
10 | catkin list -h > catkin_list.txt
11 | catkin locate -h > catkin_locate.txt
12 | catkin profile -h > catkin_profile.txt
13 | catkin profile list -h > catkin_profile_list.txt
14 | catkin profile set -h > catkin_profile_set.txt
15 | catkin profile add -h > catkin_profile_add.txt
16 | catkin profile rename -h > catkin_profile_rename.txt
17 | catkin profile remove -h > catkin_profile_remove.txt
18 | catkin test -h > catkin_test.txt
19 |
--------------------------------------------------------------------------------
/requirements.txt:
--------------------------------------------------------------------------------
1 | catkin_pkg
2 | osrf_pycommon
3 | pyyaml
4 | setuptools
5 |
--------------------------------------------------------------------------------
/stdeb.cfg:
--------------------------------------------------------------------------------
1 | [DEFAULT]
2 | Depends3: python3-setuptools, python3-catkin-pkg-modules, python3-yaml, python3-osrf-pycommon
3 | Conflicts3: python-catkin-tools
4 | Suite: xenial yakkety zesty artful bionic cosmic disco eoan focal stretch buster bookworm
5 | Setup-Env-Vars: DEB_BUILD=1
6 | No-Python2:
7 |
--------------------------------------------------------------------------------
/tests/README.md:
--------------------------------------------------------------------------------
1 | Testing
2 | =======
3 |
4 | The `catkin_tools` test harness includes the following types of tests,
5 | organized into different directories:
6 |
7 | * **unit** -- API tests for the `catkin_tools` python interface
8 | * **system** -- Tests which not only test integrated parts of `catkin_tools`
9 | but the interaction with other, external projects like catkin_pkg and catkin.
10 |
11 | ## Running Tests
12 |
13 | All tests can be run from the root of the repository.
14 |
15 | First, make sure the required test dependencies are installed:
16 |
17 | *Ubuntu* -- `sudo apt-get install cmake libgtest-dev build-essential python3-setuptools python3-pip`
18 |
19 | *OS X* -- `pip install setuptools`
20 |
21 | *Both Platforms*
22 |
23 | ```
24 | pip install argparse catkin-pkg distribute PyYAML psutil
25 | pip install nose coverage flake8 empy --upgrade
26 | pip install git+https://github.com/osrf/osrf_pycommon.git
27 | ```
28 |
29 | Second, build the Catkin CMake tool:
30 |
31 | ```
32 | git clone https://github.com/ros/catkin.git /tmp/catkin_source -b noetic-devel --depth 1
33 | mkdir /tmp/catkin_source/build
34 | pushd /tmp/catkin_source/build
35 | cmake .. && make
36 | source devel/setup.bash
37 | popd
38 | ```
39 |
40 | Finally, install `catkin_tools`:
41 |
42 | ```
43 | python setup.py develop
44 | ```
45 |
46 | To run all tests and view the output, run the following from the repository root:
47 |
48 | ```
49 | python setup.py nosetests -s
50 | ```
51 |
--------------------------------------------------------------------------------
/tests/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/catkin/catkin_tools/e9f058b9a9d26d760f633981bbfca0c303b1cb51/tests/__init__.py
--------------------------------------------------------------------------------
/tests/system/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/catkin/catkin_tools/e9f058b9a9d26d760f633981bbfca0c303b1cb51/tests/system/__init__.py
--------------------------------------------------------------------------------
/tests/system/resources/catkin_pkgs/build_type_condition/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.10)
2 | project(build_type_condition)
3 |
--------------------------------------------------------------------------------
/tests/system/resources/catkin_pkgs/build_type_condition/package.xml:
--------------------------------------------------------------------------------
1 |
2 | build_type_condition
3 | Package with conditional build_type element.
4 | 0.1.0
5 | BSD
6 | todo
7 |
8 | catkin
9 | ament
10 |
11 |
12 | ament_cmake
13 |
14 |
15 |
--------------------------------------------------------------------------------
/tests/system/resources/catkin_pkgs/cmake_args/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.10)
2 | project(cmake_args)
3 |
4 | find_package(catkin REQUIRED)
5 |
6 | catkin_package()
7 |
8 | if(NOT VAR1)
9 | message(SEND_ERROR "VAR1 NOT DEFINED!")
10 | endif()
11 |
12 | if(NOT VAR2)
13 | message(SEND_ERROR "VAR2 NOT DEFINED!")
14 | endif()
15 |
16 | if(NOT VAR3)
17 | message(SEND_ERROR "VAR3 NOT DEFINED!")
18 | endif()
19 |
--------------------------------------------------------------------------------
/tests/system/resources/catkin_pkgs/cmake_args/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | cmake_args
4 | 0.1.0
5 | This package fails unless three CMake arguments are set.
6 | todo
7 | BSD
8 | catkin
9 |
10 |
--------------------------------------------------------------------------------
/tests/system/resources/catkin_pkgs/cmake_err/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.10)
2 | project(cmake_err)
3 | find_package(catkin REQUIRED)
4 | catkin_package()
5 | message(SEND_ERROR "This package sends an error from cmake.")
6 |
--------------------------------------------------------------------------------
/tests/system/resources/catkin_pkgs/cmake_err/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | cmake_err
4 | 0.1.0
5 | This package produces a CMake error when configuring.
6 | todo
7 | BSD
8 | catkin
9 |
10 |
--------------------------------------------------------------------------------
/tests/system/resources/catkin_pkgs/cmake_warning/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.10)
2 | project(cmake_warning)
3 | find_package(catkin REQUIRED)
4 | catkin_package()
5 | message(WARNING "This sends a warning from cmake.")
6 |
--------------------------------------------------------------------------------
/tests/system/resources/catkin_pkgs/cmake_warning/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | cmake_warning
4 | 0.1.0
5 | This package produces a warning when configuring CMake.
6 | todo
7 | TODO
8 | catkin
9 |
10 |
--------------------------------------------------------------------------------
/tests/system/resources/catkin_pkgs/depend_condition/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.10)
2 | project(build_type_condition)
3 |
--------------------------------------------------------------------------------
/tests/system/resources/catkin_pkgs/depend_condition/package.xml:
--------------------------------------------------------------------------------
1 |
2 | depend_condition
3 | Package with conditional depend element.
4 | 0.1.0
5 | BSD
6 | todo
7 |
8 | catkin
9 | ros1_pkg
10 | ros2_pkg
11 |
12 |
--------------------------------------------------------------------------------
/tests/system/resources/catkin_pkgs/make_err/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.10)
2 | project(make_err)
3 | find_package(catkin REQUIRED)
4 | catkin_package()
5 | add_executable(fail fail.cpp)
6 |
--------------------------------------------------------------------------------
/tests/system/resources/catkin_pkgs/make_err/fail.cpp:
--------------------------------------------------------------------------------
1 | #error This sends an error from make
2 |
--------------------------------------------------------------------------------
/tests/system/resources/catkin_pkgs/make_err/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | make_err
4 | 0.0.0
5 | This package produces a make error when building.
6 | todo
7 | BSD
8 | catkin
9 |
10 |
--------------------------------------------------------------------------------
/tests/system/resources/catkin_pkgs/make_warning/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.10)
2 | project(make_warning)
3 | find_package(catkin REQUIRED)
4 | catkin_package()
5 | add_library(warn warn.cpp)
6 |
--------------------------------------------------------------------------------
/tests/system/resources/catkin_pkgs/make_warning/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | make_warning
4 | 0.1.0
5 | This package generats a warning in the make stage.
6 | todo
7 | BSD
8 | catkin
9 |
10 |
--------------------------------------------------------------------------------
/tests/system/resources/catkin_pkgs/make_warning/warn.cpp:
--------------------------------------------------------------------------------
1 | #warning This sends a warning from make
2 |
--------------------------------------------------------------------------------
/tests/system/resources/catkin_pkgs/products_0/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.10)
2 | project(products_0)
3 | find_package(catkin REQUIRED)
4 |
5 | catkin_package(
6 | INCLUDE_DIRS include
7 | LIBRARIES ${PROJECT_NAME}_lib
8 | CFG_EXTRAS extras.cmake)
9 |
10 | include_directories(include)
11 |
12 | add_library(${PROJECT_NAME}_lib lib.cpp)
13 | target_link_libraries(${PROJECT_NAME}_lib ${catkin_LIBRARIES})
14 |
15 | add_executable(main main.cpp)
16 | target_link_libraries(main ${PROJECT_NAME}_lib ${catkin_LIBRARIES})
17 |
18 | install(TARGETS ${PROJECT_NAME}_lib main
19 | ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
20 | LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
21 | RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
22 | )
23 |
--------------------------------------------------------------------------------
/tests/system/resources/catkin_pkgs/products_0/cmake/extras.cmake.develspace.in:
--------------------------------------------------------------------------------
1 | set($ENV{PRODUCTS_0} "devel")
2 |
--------------------------------------------------------------------------------
/tests/system/resources/catkin_pkgs/products_0/cmake/extras.cmake.installspace.in:
--------------------------------------------------------------------------------
1 | set($ENV{PRODUCTS_0} "install")
2 |
--------------------------------------------------------------------------------
/tests/system/resources/catkin_pkgs/products_0/include/make_products_0/fun.h:
--------------------------------------------------------------------------------
1 | namespace make_products_0 {
2 | int fun();
3 | }
4 |
--------------------------------------------------------------------------------
/tests/system/resources/catkin_pkgs/products_0/lib.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | int make_products_0::fun() {
3 | return 0;
4 | }
5 |
--------------------------------------------------------------------------------
/tests/system/resources/catkin_pkgs/products_0/main.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include
3 |
4 | int main(int argc, char** argv) {
5 | return make_products_0::fun();
6 | }
7 |
--------------------------------------------------------------------------------
/tests/system/resources/catkin_pkgs/products_0/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | products_0
4 | 0.1.0
5 | This package generates products in the make stage.
6 | todo
7 | BSD
8 | catkin
9 |
10 |
--------------------------------------------------------------------------------
/tests/system/resources/catkin_pkgs/products_unicode/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.10)
2 | project(products_unicode)
3 | find_package(catkin REQUIRED)
4 |
5 | catkin_package(
6 | INCLUDE_DIRS include
7 | LIBRARIES ${PROJECT_NAME}_lib
8 | CFG_EXTRAS extras.cmake)
9 |
10 | include_directories(include)
11 |
12 | add_library(${PROJECT_NAME}_lib lib.cpp)
13 | set_target_properties(${PROJECT_NAME}_lib PROPERTIES OUTPUT_NAME "${PROJECT_NAME}_lïb")
14 | target_link_libraries(${PROJECT_NAME}_lib ${catkin_LIBRARIES})
15 |
16 | add_executable(main main.cpp)
17 | set_target_properties(main PROPERTIES OUTPUT_NAME "maïn")
18 | target_link_libraries(main ${PROJECT_NAME}_lib ${catkin_LIBRARIES})
19 |
20 | install(TARGETS ${PROJECT_NAME}_lib main
21 | ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
22 | LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
23 | RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
24 | )
25 |
--------------------------------------------------------------------------------
/tests/system/resources/catkin_pkgs/products_unicode/cmake/extras.cmake.develspace.in:
--------------------------------------------------------------------------------
1 | set($ENV{PRODUCTS_UNICODE} "devel")
2 |
--------------------------------------------------------------------------------
/tests/system/resources/catkin_pkgs/products_unicode/cmake/extras.cmake.installspace.in:
--------------------------------------------------------------------------------
1 | set($ENV{PRODUCTS_UNICODE} "install")
2 |
--------------------------------------------------------------------------------
/tests/system/resources/catkin_pkgs/products_unicode/include/make_products_0/fun.h:
--------------------------------------------------------------------------------
1 | namespace make_products_0 {
2 | int fun();
3 | }
4 |
--------------------------------------------------------------------------------
/tests/system/resources/catkin_pkgs/products_unicode/lib.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | int make_products_0::fun() {
3 | return 0;
4 | }
5 |
--------------------------------------------------------------------------------
/tests/system/resources/catkin_pkgs/products_unicode/main.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include
3 |
4 | int main(int argc, char** argv) {
5 | return make_products_0::fun();
6 | }
7 |
--------------------------------------------------------------------------------
/tests/system/resources/catkin_pkgs/products_unicode/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | products_unicode
4 | 0.1.0
5 | This package generates products in the make stage.
6 | todo
7 | BSD
8 | catkin
9 |
10 |
--------------------------------------------------------------------------------
/tests/system/resources/catkin_pkgs/python_pkg/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.10)
2 | project(python_pkg)
3 | find_package(catkin REQUIRED)
4 |
5 | catkin_python_setup()
6 | catkin_package()
7 |
--------------------------------------------------------------------------------
/tests/system/resources/catkin_pkgs/python_pkg/package.xml:
--------------------------------------------------------------------------------
1 |
2 | python_pkg
3 | 0.1.0
4 | BSD
5 | todo
6 | This package contains a python package.
7 |
8 | catkin
9 |
10 |
11 |
--------------------------------------------------------------------------------
/tests/system/resources/catkin_pkgs/python_pkg/setup.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | from distutils.core import setup
3 |
4 | from catkin_pkg.python_setup import generate_distutils_setup
5 |
6 | d = generate_distutils_setup(
7 | packages=['python_pkg'],
8 | package_dir={'': 'src'}
9 | )
10 | setup(**d)
11 |
--------------------------------------------------------------------------------
/tests/system/resources/catkin_pkgs/python_pkg/src/python_pkg/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/catkin/catkin_tools/e9f058b9a9d26d760f633981bbfca0c303b1cb51/tests/system/resources/catkin_pkgs/python_pkg/src/python_pkg/__init__.py
--------------------------------------------------------------------------------
/tests/system/resources/catkin_pkgs/python_pkg/src/python_pkg/lib.py:
--------------------------------------------------------------------------------
1 | def example_function():
2 | pass
3 |
--------------------------------------------------------------------------------
/tests/system/resources/catkin_pkgs/python_tests/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.10)
2 | project(python_tests)
3 | find_package(catkin REQUIRED)
4 |
5 | catkin_package()
6 |
7 | if(CATKIN_ENABLE_TESTING)
8 | catkin_add_nosetests(test_good.py)
9 | endif()
10 |
--------------------------------------------------------------------------------
/tests/system/resources/catkin_pkgs/python_tests/package.xml:
--------------------------------------------------------------------------------
1 |
2 | python_tests
3 | 0.1.0
4 | BSD
5 | todo
6 | This package contains a python test.
7 |
8 | catkin
9 | unittest
10 |
11 |
12 |
--------------------------------------------------------------------------------
/tests/system/resources/catkin_pkgs/python_tests/setup.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | from distutils.core import setup
3 |
4 | from catkin_pkg.python_setup import generate_distutils_setup
5 |
6 | d = generate_distutils_setup()
7 | setup(**d)
8 |
--------------------------------------------------------------------------------
/tests/system/resources/catkin_pkgs/python_tests/test_good.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | try:
3 | from collections import Callable
4 | except ImportError:
5 | # https://stackoverflow.com/a/70641487
6 | import collections
7 | collections.Callable = collections.abc.Callable
8 |
9 | import unittest
10 |
11 |
12 | class TestGood(unittest.TestCase):
13 |
14 | def test_zero(self):
15 | self.assertEqual(0, 0)
16 |
17 | if __name__ == '__main__':
18 | unittest.main()
19 |
--------------------------------------------------------------------------------
/tests/system/resources/catkin_pkgs/python_tests_err/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.10)
2 | project(python_tests_err)
3 | find_package(catkin REQUIRED)
4 |
5 | catkin_package()
6 |
7 | if (CATKIN_ENABLE_TESTING)
8 | catkin_add_nosetests(test_bad.py)
9 | endif()
10 |
--------------------------------------------------------------------------------
/tests/system/resources/catkin_pkgs/python_tests_err/package.xml:
--------------------------------------------------------------------------------
1 |
2 | python_tests_err
3 | 0.1.0
4 | BSD
5 | todo
6 | This package contains a unit test that should fail when run.
7 |
8 | catkin
9 | unittest
10 |
11 |
12 |
--------------------------------------------------------------------------------
/tests/system/resources/catkin_pkgs/python_tests_err/setup.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | from distutils.core import setup
3 |
4 | from catkin_pkg.python_setup import generate_distutils_setup
5 |
6 | d = generate_distutils_setup()
7 | setup(**d)
8 |
--------------------------------------------------------------------------------
/tests/system/resources/catkin_pkgs/python_tests_err/test_bad.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | try:
3 | from collections import Callable
4 | except ImportError:
5 | # https://stackoverflow.com/a/70641487
6 | import collections
7 | collections.Callable = collections.abc.Callable
8 |
9 | import unittest
10 |
11 |
12 | class TestBad(unittest.TestCase):
13 |
14 | def test_zero(self):
15 | self.assertEqual(0, 1)
16 |
17 | if __name__ == '__main__':
18 | unittest.main()
19 |
--------------------------------------------------------------------------------
/tests/system/resources/catkin_pkgs/python_tests_targets/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.10)
2 | project(python_tests_targets)
3 | find_package(catkin REQUIRED)
4 |
5 | catkin_package()
6 |
7 | if(CATKIN_ENABLE_TESTING)
8 | catkin_add_nosetests(test_good.py)
9 | catkin_add_nosetests(test_bad.py)
10 | endif()
11 |
--------------------------------------------------------------------------------
/tests/system/resources/catkin_pkgs/python_tests_targets/package.xml:
--------------------------------------------------------------------------------
1 |
2 | python_tests_targets
3 | 0.1.0
4 | BSD
5 | todo
6 | This package contains two python tests.
7 |
8 | catkin
9 | unittest
10 |
11 |
12 |
--------------------------------------------------------------------------------
/tests/system/resources/catkin_pkgs/python_tests_targets/setup.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | from distutils.core import setup
3 |
4 | from catkin_pkg.python_setup import generate_distutils_setup
5 |
6 | d = generate_distutils_setup()
7 | setup(**d)
8 |
--------------------------------------------------------------------------------
/tests/system/resources/catkin_pkgs/python_tests_targets/test_bad.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | try:
3 | from collections import Callable
4 | except ImportError:
5 | # https://stackoverflow.com/a/70641487
6 | import collections
7 | collections.Callable = collections.abc.Callable
8 |
9 | import unittest
10 |
11 |
12 | class TestBad(unittest.TestCase):
13 |
14 | def test_zero(self):
15 | self.assertEqual(0, 1)
16 |
17 | if __name__ == '__main__':
18 | unittest.main()
19 |
--------------------------------------------------------------------------------
/tests/system/resources/catkin_pkgs/python_tests_targets/test_good.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | try:
3 | from collections import Callable
4 | except ImportError:
5 | # https://stackoverflow.com/a/70641487
6 | import collections
7 | collections.Callable = collections.abc.Callable
8 |
9 | import unittest
10 |
11 |
12 | class TestGood(unittest.TestCase):
13 |
14 | def test_zero(self):
15 | self.assertEqual(0, 0)
16 |
17 | if __name__ == '__main__':
18 | unittest.main()
19 |
--------------------------------------------------------------------------------
/tests/system/resources/cmake_pkgs/app_pkg/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.10)
2 | project(app_pkg)
3 |
4 | find_package(lib_pkg REQUIRED)
5 |
6 | include_directories(${lib_pkg_INCLUDE_DIRS})
7 |
8 | add_executable(vanilla_app vanilla.cpp)
9 | target_link_libraries(vanilla_app vanilla)
10 |
11 | install(TARGETS vanilla_app
12 | RUNTIME DESTINATION bin
13 | LIBRARY DESTINATION lib
14 | ARCHIVE DESTINATION lib/static)
15 |
--------------------------------------------------------------------------------
/tests/system/resources/cmake_pkgs/app_pkg/package.xml:
--------------------------------------------------------------------------------
1 |
2 | app_pkg
3 | vanilla CMake
4 | 0.1.0
5 | BSD
6 | jbo
7 | lib_pkg
8 |
9 | cmake
10 |
11 |
12 |
--------------------------------------------------------------------------------
/tests/system/resources/cmake_pkgs/app_pkg/vanilla.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include
4 |
5 | int main(int argc, char **argv) {
6 | vanilla();
7 | return 0;
8 | }
9 |
--------------------------------------------------------------------------------
/tests/system/resources/cmake_pkgs/cmake_pkg/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.10)
2 | project(cmake_pkg)
3 |
4 | add_executable(vanilla vanilla.cpp)
5 |
6 | install(TARGETS vanilla
7 | RUNTIME DESTINATION bin
8 | LIBRARY DESTINATION lib
9 | ARCHIVE DESTINATION lib/static)
10 |
--------------------------------------------------------------------------------
/tests/system/resources/cmake_pkgs/cmake_pkg/package.xml:
--------------------------------------------------------------------------------
1 |
2 | cmake_pkg
3 | vanilla CMake
4 | 0.1.0
5 | BSD
6 | jbo
7 |
8 | cmake
9 |
10 |
11 |
--------------------------------------------------------------------------------
/tests/system/resources/cmake_pkgs/cmake_pkg/vanilla.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | int main(int argc, char **argv) {
4 |
5 | return 0;
6 | }
7 |
--------------------------------------------------------------------------------
/tests/system/resources/cmake_pkgs/lib_pkg/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.10)
2 | project(lib_pkg)
3 |
4 | # make cache variables for install destinations
5 | include(GNUInstallDirs)
6 |
7 | include_directories(${CMAKE_SOURCE_DIR})
8 | add_library(vanilla SHARED vanilla.cpp)
9 |
10 | # install the target and create export-set
11 | install(TARGETS vanilla
12 | EXPORT vanillaTargets
13 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
14 | LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
15 | ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
16 | INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
17 | )
18 |
19 | # install header file
20 | INSTALL(FILES vanilla.h
21 | DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
22 | )
23 |
24 | # generate and install export file
25 | install(EXPORT vanillaTargets
26 | FILE vanillaTargets.cmake
27 | DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/lib_pkg
28 | )
29 |
30 | # include CMakePackageConfigHelpers macro
31 | include(CMakePackageConfigHelpers)
32 |
33 | # create config file
34 | configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in
35 | "${CMAKE_CURRENT_BINARY_DIR}/lib_pkgConfig.cmake"
36 | INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/lib_pkg
37 | )
38 |
39 | # install config files
40 | install(FILES
41 | "${CMAKE_CURRENT_BINARY_DIR}/lib_pkgConfig.cmake"
42 | DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/lib_pkg
43 | )
44 |
45 | # generate the export targets for the build tree
46 | export(EXPORT vanillaTargets
47 | FILE "${CMAKE_CURRENT_BINARY_DIR}/cmake/vanillaTargets.cmake"
48 | )
49 |
--------------------------------------------------------------------------------
/tests/system/resources/cmake_pkgs/lib_pkg/Config.cmake.in:
--------------------------------------------------------------------------------
1 | @PACKAGE_INIT@
2 |
3 | include("${CMAKE_CURRENT_LIST_DIR}/vanillaTargets.cmake")
4 |
5 | check_required_components(vanilla)
6 |
--------------------------------------------------------------------------------
/tests/system/resources/cmake_pkgs/lib_pkg/package.xml:
--------------------------------------------------------------------------------
1 |
2 | lib_pkg
3 | vanilla CMake
4 | 0.1.0
5 | BSD
6 | jbo
7 |
8 | cmake
9 |
10 |
11 |
--------------------------------------------------------------------------------
/tests/system/resources/cmake_pkgs/lib_pkg/vanilla.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | void vanilla() {
5 | std::cerr<<"vanilla."<
2 | test_err_pkg
3 | This package has a failing ctest test
4 | 0.1.0
5 | BSD
6 | todo
7 |
8 | cmake
9 |
10 |
11 |
--------------------------------------------------------------------------------
/tests/system/resources/cmake_pkgs/test_err_pkg/test.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | int main() {
4 | std::cout << "Test failure" << std::endl;
5 | return 1;
6 | }
7 |
--------------------------------------------------------------------------------
/tests/system/resources/cmake_pkgs/test_pkg/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.10)
2 | project(test_pkg)
3 |
4 | include(CTest)
5 | add_executable(MyTest test.cpp)
6 | add_test(NAME MyTest COMMAND MyTest)
7 | enable_testing()
8 |
9 | install(TARGETS MyTest
10 | RUNTIME DESTINATION bin
11 | LIBRARY DESTINATION lib
12 | ARCHIVE DESTINATION lib/static)
13 |
--------------------------------------------------------------------------------
/tests/system/resources/cmake_pkgs/test_pkg/package.xml:
--------------------------------------------------------------------------------
1 |
2 | test_pkg
3 | This package has a passing ctest test
4 | 0.1.0
5 | BSD
6 | todo
7 |
8 | cmake
9 |
10 |
11 |
--------------------------------------------------------------------------------
/tests/system/resources/cmake_pkgs/test_pkg/test.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | int main() {
4 | std::cout << "Test success" << std::endl;
5 | return 0;
6 | }
7 |
--------------------------------------------------------------------------------
/tests/system/resources/ros_pkgs/pkg_with_roslint/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.10)
2 | project(pkg_with_roslint)
3 | find_package(catkin REQUIRED COMPONENTS roslint)
4 | catkin_package()
5 |
6 | roslint_cpp(main.cpp)
7 | roslint_add_test()
8 |
--------------------------------------------------------------------------------
/tests/system/resources/ros_pkgs/pkg_with_roslint/main.cpp:
--------------------------------------------------------------------------------
1 |
2 | int main(int argc, char** argv) {
3 | return 0;
4 | }
5 |
--------------------------------------------------------------------------------
/tests/system/resources/ros_pkgs/pkg_with_roslint/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | pkg_with_roslint
4 | 0.0.0
5 | The catkin_pkg_roslint package
6 | jbohren
7 | TODO
8 | catkin
9 | roslint
10 |
11 |
--------------------------------------------------------------------------------
/tests/system/verbs/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/catkin/catkin_tools/e9f058b9a9d26d760f633981bbfca0c303b1cb51/tests/system/verbs/__init__.py
--------------------------------------------------------------------------------
/tests/system/verbs/catkin_build/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/catkin/catkin_tools/e9f058b9a9d26d760f633981bbfca0c303b1cb51/tests/system/verbs/catkin_build/__init__.py
--------------------------------------------------------------------------------
/tests/system/verbs/catkin_build/test_args.py:
--------------------------------------------------------------------------------
1 | import os
2 | import shutil
3 |
4 | from ....utils import catkin_failure
5 | from ....utils import catkin_success
6 | from ....utils import redirected_stdio
7 | from ...workspace_factory import workspace_factory
8 |
9 | TEST_DIR = os.path.dirname(__file__)
10 | RESOURCES_DIR = os.path.join(os.path.dirname(__file__), '..', '..', 'resources')
11 |
12 | BUILD = ['build', '--no-notify', '--no-status']
13 | CLEAN = ['clean', '--all', '--yes'] # , '--no-notify', '--no-color', '--no-status']
14 |
15 |
16 | def test_cmake_args():
17 | """Test passing CMake args to packages."""
18 | with redirected_stdio():
19 | with workspace_factory():
20 | shutil.copytree(os.path.join(RESOURCES_DIR, 'catkin_pkgs', 'cmake_args'), 'src')
21 |
22 | # cmake_args package requires all three vars to be set
23 | assert catkin_failure(
24 | BUILD +
25 | ['cmake_args', '--no-deps'] +
26 | ['--cmake-args', '-DVAR1=VAL1'])
27 |
28 | assert catkin_failure(
29 | BUILD +
30 | ['cmake_args', '--no-deps'] +
31 | ['--cmake-args', '-DVAR1=VAL1', '-DVAR2=VAL2'])
32 |
33 | assert catkin_success(
34 | BUILD +
35 | ['cmake_args', '--no-deps'] +
36 | ['--cmake-args', '-DVAR1=VAL1', '-DVAR2=VAL2', '-DVAR3=VAL3'])
37 |
38 | assert catkin_success(
39 | BUILD +
40 | ['cmake_args', '--no-deps'] +
41 | ['--cmake-args', '-DVAR1=VAL1', '-DVAR2=VAL2', '-DVAR3=VAL3', '--'])
42 |
43 |
44 | def test_no_cmake_args():
45 | """Test building when disabling CMake args in config"""
46 | pass # TODO: Add test which sets cmake args with catkin config, then ignores them when building
47 |
48 |
49 | def test_additional_cmake_args():
50 | """Test building when using additional CMake args to those config"""
51 | pass # TODO: Add test which sets cmake args with catkin config, then adds more when building
52 |
53 |
54 | def test_make_args():
55 | """Test passing arguments to the make command"""
56 | pass # TODO: Implement this
57 |
58 |
59 | def test_additional_make_args():
60 | """Test building when using additional make args to those config"""
61 | pass # TODO: Add test which sets make args with catkin config, then adds more when building
62 |
63 |
64 | def test_no_make_args():
65 | """Test building when disabling make args in config"""
66 | pass # TODO: Add test which sets make args with catkin config, then ignores them when building
67 |
68 |
69 | def test_catkin_make_args():
70 | """Test passing arguments to the make command for catkin packages only"""
71 | pass # TODO: Implement this
72 |
73 |
74 | def test_additional_catkin_make_args():
75 | """Test building when using additional catkin make args to those config"""
76 | pass # TODO: Add test which sets catkin make args with catkin config, then adds more when building
77 |
78 |
79 | def test_no_catkin_make_args():
80 | """Test building when disabling catkin make args in config"""
81 | pass # TODO: Add test which sets catkin make args with catkin config, then ignores them when building
82 |
83 |
84 | def test_jobs_args():
85 | """Test parallel jobs and parallel packages args"""
86 | pass # TODO: Run catkin build, then check JobServer singleton
87 |
--------------------------------------------------------------------------------
/tests/system/verbs/catkin_build/test_bwlists.py:
--------------------------------------------------------------------------------
1 | import os
2 |
3 | TEST_DIR = os.path.dirname(__file__)
4 | RESOURCES_DIR = os.path.join(os.path.dirname(__file__), '..', '..', 'resources')
5 |
6 | BUILD = ['build', '--no-notify', '--no-status']
7 | CLEAN = ['clean', '--all', '--yes'] # , '--no-notify', '--no-color', '--no-status']
8 |
9 |
10 | def test_buildlist():
11 | """Test building buildlisted packages only"""
12 | pass # TODO: Write test
13 |
14 |
15 | def test_skiplist():
16 | """Test building all packages except skiplisted packages"""
17 | pass # TODO: Write test
18 |
19 |
20 | def test_skiplist_buildlist():
21 | """Test building with non-empty skiplist and buildlist"""
22 | pass # TODO: Write test
23 |
--------------------------------------------------------------------------------
/tests/system/verbs/catkin_build/test_context.py:
--------------------------------------------------------------------------------
1 | import os
2 |
3 | TEST_DIR = os.path.dirname(__file__)
4 | RESOURCES_DIR = os.path.join(os.path.dirname(__file__), '..', '..', 'resources')
5 |
6 | BUILD = ['build', '--no-notify', '--no-status']
7 | CLEAN = ['clean', '--all', '--yes'] # , '--no-notify', '--no-color', '--no-status']
8 |
9 |
10 | def test_build_this():
11 | """Test package context awareness"""
12 | pass # TODO: Implement this (both negative and positive results)
13 |
14 |
15 | def test_start_with_this():
16 | """Test package context awareness for --start-with option"""
17 | pass # TODO: Implement this (both negative and positive results)
18 |
--------------------------------------------------------------------------------
/tests/system/verbs/catkin_build/test_eclipse.py:
--------------------------------------------------------------------------------
1 | import os
2 |
3 | from ....utils import assert_files_exist
4 | from ....utils import catkin_success
5 | from ....utils import in_temporary_directory
6 | from ....utils import redirected_stdio
7 | from ....workspace_assertions import assert_no_warnings
8 | from ....workspace_assertions import assert_workspace_initialized
9 |
10 | TEST_DIR = os.path.dirname(__file__)
11 | RESOURCES_DIR = os.path.join(os.path.dirname(__file__), '..', '..', 'resources')
12 |
13 |
14 | @in_temporary_directory
15 | def test_build_eclipse():
16 | cwd = os.getcwd()
17 | source_space = os.path.join(cwd, 'src')
18 | print("Creating source directory: %s" % source_space)
19 | os.mkdir(source_space)
20 | with redirected_stdio() as (out, err):
21 | assert catkin_success(
22 | ['create', 'pkg', '--rosdistro', 'hydro', '-p', source_space, 'pkg_a']), 'create pkg'
23 | assert catkin_success(
24 | ['build', '--no-notify', '--no-status', '--verbose',
25 | '--cmake-args', '-GEclipse CDT4 - Unix Makefiles'])
26 | assert_no_warnings(out)
27 | assert_workspace_initialized('.')
28 | assert_files_exist(os.path.join(cwd, 'build', 'pkg_a'),
29 | ['.project', '.cproject'])
30 |
--------------------------------------------------------------------------------
/tests/system/verbs/catkin_build/test_modify_ws.py:
--------------------------------------------------------------------------------
1 | import os
2 |
3 | TEST_DIR = os.path.dirname(__file__)
4 | RESOURCES_DIR = os.path.join(os.path.dirname(__file__), '..', '..', 'resources')
5 |
6 | BUILD = ['build', '--no-notify', '--no-status']
7 | CLEAN = ['clean', '--all', '--yes'] # , '--no-notify', '--no-color', '--no-status']
8 |
9 |
10 | def test_add_package():
11 | """Test build behavior when adding packages to the workspace"""
12 | pass # TODO: Implement this for various dependency relationships
13 |
14 |
15 | def test_remove_package():
16 | """Test build behavior when removing packages from the workspace"""
17 | pass # TODO: Implement this for various dependency relationships
18 |
19 |
20 | def test_rename_package():
21 | """Test build behavior when renaming a package in the workspace"""
22 | pass # TODO: Implement this for various dependency relationships
23 |
24 |
25 | def test_ignore_package():
26 | """Test build behavior when adding a CATKIN_IGNORE file to a package in the workspace"""
27 | pass # TODO: Implement this for various dependency relationships
28 |
29 |
30 | def test_deskiplist():
31 | """Test build behavior when removing a package from the skiplist that has yet to be built"""
32 | pass # TODO: Implement this for various dependency relationships
33 |
--------------------------------------------------------------------------------
/tests/system/verbs/catkin_build/test_unicode_in_env.py:
--------------------------------------------------------------------------------
1 | import os
2 |
3 | from ....utils import catkin_success
4 | from ....utils import redirected_stdio
5 | from ...workspace_factory import workspace_factory
6 |
7 |
8 | def test_catkin_build_with_unicode_in_env():
9 | with workspace_factory() as wf:
10 | wf.create_package('foo', depends=['bar'])
11 | wf.create_package('bar')
12 | wf.build()
13 |
14 | print('Workspace: {0}'.format(wf.workspace))
15 |
16 | assert os.path.isdir(wf.workspace)
17 |
18 | env = {'NON_ASCII': '\xc3\xb6'}
19 | cmd = ['build', '--no-status', '--no-notify', '--verbose']
20 | with redirected_stdio():
21 | assert catkin_success(cmd, env)
22 |
--------------------------------------------------------------------------------
/tests/system/verbs/catkin_build/test_whitespace_in_paths.py:
--------------------------------------------------------------------------------
1 | import os
2 |
3 | from ....utils import catkin_success
4 | from ....utils import redirected_stdio
5 | from ...workspace_factory import workspace_factory
6 |
7 |
8 | def test_catkin_build_with_whitespace_in_paths():
9 | with workspace_factory(source_space='source packages') as wf:
10 | wf.create_package('foo', depends=['bar'])
11 | wf.create_package('bar')
12 | wf.build()
13 |
14 | print('Workspace: {0}'.format(wf.workspace))
15 |
16 | assert os.path.isdir(wf.workspace)
17 |
18 | with redirected_stdio():
19 | cmd = ['config', '--source-space', wf.source_space,
20 | '--devel-space', 'devel space',
21 | '--build-space', 'build space',
22 | '--install-space', 'install space']
23 | assert catkin_success(cmd), cmd
24 |
25 | cmd = ['build', '--no-status', '--no-notify', '--verbose']
26 | assert catkin_success(cmd), cmd
27 |
--------------------------------------------------------------------------------
/tests/system/verbs/catkin_clean/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/catkin/catkin_tools/e9f058b9a9d26d760f633981bbfca0c303b1cb51/tests/system/verbs/catkin_clean/__init__.py
--------------------------------------------------------------------------------
/tests/system/verbs/catkin_clean/clean.py:
--------------------------------------------------------------------------------
1 | # For reasons unknown to me, this file cannot be named test_clean.py because the CI will fail.
2 | import os
3 | import shutil
4 |
5 | from ....utils import catkin_success
6 | from ....utils import redirected_stdio
7 | from ...workspace_factory import workspace_factory
8 |
9 | RESOURCES_DIR = os.path.join(os.path.dirname(__file__), '..', '..', 'resources')
10 |
11 | BUILD = ['build', '--no-notify', '--no-status']
12 |
13 |
14 | def test_clean_devel():
15 | """Test if files in the devel space get cleaned correctly"""
16 | with redirected_stdio():
17 | with workspace_factory() as wf:
18 | wf.build()
19 | shutil.copytree(
20 | os.path.join(RESOURCES_DIR, 'catkin_pkgs', 'products_0'),
21 | os.path.join('src/products_0'))
22 | shutil.copytree(
23 | os.path.join(RESOURCES_DIR, 'catkin_pkgs', 'python_pkg'),
24 | os.path.join('src/python_pkg'))
25 |
26 | assert catkin_success(['config', '--link-devel'])
27 | assert catkin_success(BUILD)
28 | assert os.path.exists(os.path.join(wf.workspace, 'devel', 'lib', 'products_0'))
29 | assert os.path.exists(os.path.join(wf.workspace, 'devel', 'lib', 'libproducts_0_lib.so'))
30 | assert os.path.exists(os.path.join(wf.workspace, 'devel', 'lib', 'python3',
31 | 'dist-packages', 'python_pkg'))
32 |
33 | assert catkin_success(['clean', 'products_0'])
34 | assert not os.path.exists(os.path.join(wf.workspace, 'devel', 'lib', 'products_0'))
35 | assert not os.path.exists(os.path.join(wf.workspace, 'devel', 'lib', 'libproducts_0_lib.so'))
36 | assert os.path.exists(os.path.join(wf.workspace, 'devel', 'lib', 'python3',
37 | 'dist-packages', 'python_pkg'))
38 |
39 | assert catkin_success(['clean', 'python_pkg'])
40 | assert not os.path.exists(os.path.join(wf.workspace, 'devel', 'lib', 'python3',
41 | 'dist-packages', 'python_pkg'))
42 | assert os.path.exists(os.path.join(wf.workspace, 'devel', '_setup_util.py'))
43 |
44 |
45 | def test_clean_install():
46 | """Test if installed files get cleaned correctly"""
47 | with redirected_stdio():
48 | with workspace_factory() as wf:
49 | wf.build()
50 | shutil.copytree(
51 | os.path.join(RESOURCES_DIR, 'catkin_pkgs', 'products_0'),
52 | os.path.join('src/products_0'))
53 | shutil.copytree(
54 | os.path.join(RESOURCES_DIR, 'catkin_pkgs', 'python_pkg'),
55 | os.path.join('src/python_pkg'))
56 |
57 | assert catkin_success(['config', '--install'])
58 | assert catkin_success(BUILD)
59 | assert os.path.exists(os.path.join(wf.workspace, 'install', 'lib', 'products_0'))
60 | assert os.path.exists(os.path.join(wf.workspace, 'install', 'lib', 'libproducts_0_lib.so'))
61 | assert os.path.exists(os.path.join(wf.workspace, 'install', 'lib', 'python3', 'dist-packages',
62 | 'python_pkg', 'lib.py'))
63 |
64 | assert catkin_success(['clean', 'products_0'])
65 | assert not os.path.exists(os.path.join(wf.workspace, 'install', 'lib', 'products_0'))
66 | assert not os.path.exists(os.path.join(wf.workspace, 'install', 'lib', 'libproducts_0_lib.so'))
67 | assert os.path.exists(os.path.join(wf.workspace, 'install', 'lib', 'python3', 'dist-packages',
68 | 'python_pkg', 'lib.py'))
69 |
70 | assert catkin_success(['clean', 'python_pkg'])
71 | assert not os.path.exists(os.path.join(wf.workspace, 'install', 'lib', 'python3', 'dist-packages',
72 | 'python_pkg', 'lib.py'))
73 | assert os.path.exists(os.path.join(wf.workspace, 'install', '_setup_util.py'))
74 |
--------------------------------------------------------------------------------
/tests/system/verbs/catkin_config/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/catkin/catkin_tools/e9f058b9a9d26d760f633981bbfca0c303b1cb51/tests/system/verbs/catkin_config/__init__.py
--------------------------------------------------------------------------------
/tests/system/verbs/catkin_config/test_config.py:
--------------------------------------------------------------------------------
1 | import os
2 |
3 | from ....utils import catkin_success
4 | from ....utils import in_temporary_directory
5 | from ....utils import redirected_stdio
6 | from ....workspace_assertions import assert_in_config
7 | from ....workspace_assertions import assert_no_warnings
8 | from ....workspace_assertions import assert_warning_message
9 | from ....workspace_assertions import assert_workspace_initialized
10 | from ...workspace_factory import workspace_factory
11 |
12 |
13 | @in_temporary_directory
14 | def test_config_no_ws():
15 | with redirected_stdio() as (out, err):
16 | assert catkin_success(['config'])
17 | assert_warning_message(out, 'Workspace is not yet initialized')
18 |
19 |
20 | @in_temporary_directory
21 | def test_init_local_empty_src():
22 | cwd = os.getcwd()
23 | os.mkdir(os.path.join(cwd, 'src'))
24 | with redirected_stdio() as (out, err):
25 | assert catkin_success(['config', '--init'])
26 | assert_no_warnings(out)
27 | assert_workspace_initialized('.')
28 |
29 |
30 | @in_temporary_directory
31 | def test_config_non_bare():
32 | with redirected_stdio() as (out, err):
33 | assert catkin_success(['config', '--install'])
34 | assert_warning_message(out, 'Source space .+ does not yet exist')
35 | assert_workspace_initialized('.')
36 |
37 |
38 | @in_temporary_directory
39 | def test_config_unchanged():
40 | with workspace_factory() as wf:
41 | wf.build()
42 | with redirected_stdio():
43 | assert catkin_success(['config', '--make-args', '-j6'])
44 | assert catkin_success(['config'])
45 | assert_in_config('.', 'default', 'jobs_args', ['-j6'])
46 |
47 |
48 | def test_config_no_args_flags():
49 | with workspace_factory() as wf:
50 | wf.build()
51 | with redirected_stdio():
52 | assert catkin_success(['config', '--make-args', '-j6', 'test'])
53 | assert catkin_success(['config', '--cmake-args', '-DCMAKE_BUILD_TYPE=Release'])
54 | assert catkin_success(['config', '--catkin-make-args', 'run_tests'])
55 | assert catkin_success(['config', '--no-make-args', '--no-cmake-args', '--no-catkin-make-args'])
56 | assert_in_config('.', 'default', 'jobs_args', [])
57 | assert_in_config('.', 'default', 'make_args', [])
58 | assert_in_config('.', 'default', 'cmake_args', [])
59 |
60 |
61 | @in_temporary_directory
62 | def test_config_no_buildlist():
63 | with redirected_stdio():
64 | assert catkin_success(['config', '--buildlist', 'mypackage'])
65 | assert_in_config('.', 'default', 'whitelist', ['mypackage'])
66 | assert catkin_success(['config', '--no-buildlist'])
67 | assert_in_config('.', 'default', 'whitelist', [])
68 |
69 |
70 | @in_temporary_directory
71 | def test_config_no_skiplist():
72 | with redirected_stdio():
73 | assert catkin_success(['config', '--skiplist', 'mypackage'])
74 | assert_in_config('.', 'default', 'blacklist', ['mypackage'])
75 | assert catkin_success(['config', '--no-skiplist'])
76 | assert_in_config('.', 'default', 'blacklist', [])
77 |
--------------------------------------------------------------------------------
/tests/system/verbs/catkin_init/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/catkin/catkin_tools/e9f058b9a9d26d760f633981bbfca0c303b1cb51/tests/system/verbs/catkin_init/__init__.py
--------------------------------------------------------------------------------
/tests/system/verbs/catkin_init/test_init.py:
--------------------------------------------------------------------------------
1 | import os
2 |
3 | from ....utils import catkin_success
4 | from ....utils import in_temporary_directory
5 | from ....utils import redirected_stdio
6 | from ....workspace_assertions import assert_no_warnings
7 | from ....workspace_assertions import assert_warning_message
8 | from ....workspace_assertions import assert_workspace_initialized
9 |
10 |
11 | @in_temporary_directory
12 | def test_init_local_no_src():
13 | with redirected_stdio() as (out, err):
14 | assert catkin_success(['init'])
15 | assert_warning_message(out, 'Source space .+ does not yet exist')
16 | assert_workspace_initialized('.')
17 |
18 |
19 | @in_temporary_directory
20 | def test_init_local_empty_src():
21 | cwd = os.getcwd()
22 | os.mkdir(os.path.join(cwd, 'src'))
23 | with redirected_stdio() as (out, err):
24 | assert catkin_success(['init'])
25 | assert_no_warnings(out)
26 | assert_workspace_initialized('.')
27 |
--------------------------------------------------------------------------------
/tests/system/verbs/catkin_profile/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/catkin/catkin_tools/e9f058b9a9d26d760f633981bbfca0c303b1cb51/tests/system/verbs/catkin_profile/__init__.py
--------------------------------------------------------------------------------
/tests/system/verbs/catkin_profile/test_profile.py:
--------------------------------------------------------------------------------
1 | import os
2 |
3 | import yaml
4 |
5 | from ....utils import assert_cmd_success
6 | from ....utils import catkin_success
7 | from ....utils import in_temporary_directory
8 | from ....utils import redirected_stdio
9 | from ....workspace_assertions import assert_in_config
10 | from ...workspace_factory import workspace_factory
11 |
12 | BUILD = ['build', '--no-notify', '--no-status']
13 |
14 | BUILD = ['build', '--no-notify', '--no-status']
15 |
16 |
17 | def assert_active_profile(workspace, profile):
18 | profile_file = os.path.join(workspace, '.catkin_tools', 'profiles', 'profiles.yaml')
19 | if not os.path.exists(profile_file):
20 | assert profile == 'default'
21 | else:
22 | with open(profile_file) as f:
23 | profiles = yaml.safe_load(f)
24 | assert profiles.get('active', 'default') == profile
25 |
26 |
27 | @in_temporary_directory
28 | def test_profile_list():
29 | assert_cmd_success(['mkdir', 'src'])
30 | with redirected_stdio():
31 | assert catkin_success(['init'])
32 | assert catkin_success(BUILD)
33 | assert catkin_success(['profile', 'list'])
34 | assert_active_profile('.', 'default')
35 |
36 |
37 | @in_temporary_directory
38 | def test_profile_set():
39 | assert_cmd_success(['mkdir', 'src'])
40 | with redirected_stdio():
41 | assert catkin_success(['init'])
42 | assert catkin_success(BUILD)
43 | assert catkin_success(['profile', 'set', 'default'])
44 | assert catkin_success(['profile', 'add', 'second'])
45 | assert_active_profile('.', 'default')
46 | assert catkin_success(['profile', 'set', 'second'])
47 | assert_active_profile('.', 'second')
48 |
49 |
50 | def test_profile_copy():
51 | with workspace_factory() as wf:
52 | wf.build()
53 | with redirected_stdio():
54 | assert catkin_success(['config', '--make-args', 'test'])
55 | assert catkin_success(['profile', 'add', '--copy', 'default', 'mycopy'])
56 | assert_in_config('.', 'mycopy', 'make_args', ['test'])
57 | assert_active_profile('.', 'default')
58 |
59 |
60 | def test_profile_extend():
61 | with workspace_factory() as wf:
62 | wf.build()
63 | with redirected_stdio():
64 | assert catkin_success(['config', '--make-args', 'test'])
65 | assert catkin_success(['profile', 'add', '--extend', 'default', 'myextend'])
66 | assert catkin_success(['config', '--profile', 'myextend', '--skiplist', 'mypackage'])
67 | assert_in_config('.', 'default', 'make_args', ['test'])
68 | assert_in_config('.', 'myextend', 'blacklist', ['mypackage'])
69 |
70 |
71 | def test_different_first_profile():
72 | with workspace_factory() as wf:
73 | wf.build()
74 | assert catkin_success(BUILD + ['--profile', 'release'])
75 | assert_active_profile(wf.workspace, 'release')
76 |
--------------------------------------------------------------------------------
/tests/system/verbs/catkin_test/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/catkin/catkin_tools/e9f058b9a9d26d760f633981bbfca0c303b1cb51/tests/system/verbs/catkin_test/__init__.py
--------------------------------------------------------------------------------
/tests/system/verbs/catkin_test/test_unit_tests.py:
--------------------------------------------------------------------------------
1 | import os
2 | import shutil
3 |
4 | from ....utils import catkin_failure
5 | from ....utils import catkin_success
6 | from ....utils import in_temporary_directory
7 | from ....utils import redirected_stdio
8 |
9 | TEST_DIR = os.path.dirname(__file__)
10 | RESOURCES_DIR = os.path.join(os.path.dirname(__file__), '..', '..', 'resources')
11 |
12 | BUILD = ['build', '--no-notify', '--no-status']
13 | TEST = ['test', '--no-notify', '--no-status']
14 |
15 | @in_temporary_directory
16 | def test_catkin_success():
17 | """Test running working unit tests"""
18 | cwd = os.getcwd()
19 | source_space = os.path.join(cwd, 'src')
20 | shutil.copytree(os.path.join(RESOURCES_DIR, 'catkin_pkgs', 'python_tests'), source_space)
21 | with redirected_stdio():
22 | assert catkin_success(BUILD + ['python_tests'])
23 | assert catkin_success(TEST + ['python_tests'])
24 |
25 |
26 | @in_temporary_directory
27 | def test_catkin_failure():
28 | """Test running broken unit tests"""
29 | cwd = os.getcwd()
30 | source_space = os.path.join(cwd, 'src')
31 | shutil.copytree(os.path.join(RESOURCES_DIR, 'catkin_pkgs', 'python_tests_err'), source_space)
32 |
33 | with redirected_stdio():
34 | assert catkin_success(BUILD + ['python_tests_err'])
35 | assert catkin_failure(TEST + ['python_tests_err'])
36 |
37 |
38 | @in_temporary_directory
39 | def test_cmake_success():
40 | """Test vanilla cmake package"""
41 | cwd = os.getcwd()
42 | source_space = os.path.join(cwd, 'src')
43 | shutil.copytree(os.path.join(RESOURCES_DIR, 'cmake_pkgs', 'test_pkg'), source_space)
44 |
45 | with redirected_stdio():
46 | assert catkin_success(BUILD + ['test_pkg'])
47 | assert catkin_success(TEST + ['test_pkg'])
48 |
49 |
50 | @in_temporary_directory
51 | def test_cmake_failure():
52 | """Test failing vanilla cmake package"""
53 | cwd = os.getcwd()
54 | source_space = os.path.join(cwd, 'src')
55 | shutil.copytree(os.path.join(RESOURCES_DIR, 'cmake_pkgs', 'test_err_pkg'), source_space)
56 |
57 | with redirected_stdio():
58 | assert catkin_success(BUILD + ['test_err_pkg'])
59 | assert catkin_failure(TEST + ['test_err_pkg'])
60 |
61 |
62 | @in_temporary_directory
63 | def test_skip_missing_test():
64 | """Test to skip packages without tests"""
65 | cwd = os.getcwd()
66 | source_space = os.path.join(cwd, 'src')
67 | shutil.copytree(os.path.join(RESOURCES_DIR, 'cmake_pkgs', 'cmake_pkg'), source_space)
68 |
69 | with redirected_stdio():
70 | assert catkin_success(BUILD + ['cmake_pkg'])
71 | assert catkin_success(TEST)
72 |
73 |
74 | @in_temporary_directory
75 | def test_other_target():
76 | """Test with a manually specified target"""
77 | cwd = os.getcwd()
78 | source_space = os.path.join(cwd, 'src')
79 | shutil.copytree(os.path.join(RESOURCES_DIR, 'catkin_pkgs', 'python_tests_targets'), source_space)
80 |
81 | with redirected_stdio():
82 | assert catkin_success(BUILD + ['python_tests_targets'])
83 | assert catkin_success(TEST + ['--test-target', 'run_tests_python_tests_targets_nosetests_test_good.py'])
84 | assert catkin_failure(TEST + ['--test-target', 'run_tests_python_tests_targets_nosetests_test_bad.py'])
85 |
--------------------------------------------------------------------------------
/tests/unit/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/catkin/catkin_tools/e9f058b9a9d26d760f633981bbfca0c303b1cb51/tests/unit/__init__.py
--------------------------------------------------------------------------------
/tests/unit/ascii_text.txt:
--------------------------------------------------------------------------------
1 | Hello ASCII!
2 |
--------------------------------------------------------------------------------
/tests/unit/test_common.py:
--------------------------------------------------------------------------------
1 | from unittest import mock
2 |
3 | from catkin_tools import common
4 |
5 |
6 | class MockPackage(mock.Mock):
7 | def __init__(self, name):
8 | super(MockPackage, self).__init__()
9 | self.name = name
10 | self.build_depends = []
11 | self.buildtool_depends = []
12 | self.test_depends = []
13 | self.run_depends = []
14 | self.exec_depends = []
15 | self.build_export_depends = []
16 | self.evaluated_condition = True
17 |
18 |
19 | def test_get_recursive_build_depends_in_workspace_with_test_depend():
20 | pkg1 = MockPackage('pkg1')
21 | pkg2 = MockPackage('pkg2')
22 | pkg1.test_depends.append(pkg2)
23 |
24 | ordered_packages = [
25 | ('/path/to/pkg1', pkg1),
26 | ('/path/to/pkg2', pkg2),
27 | ]
28 |
29 | r = common.get_recursive_build_depends_in_workspace(pkg1, ordered_packages)
30 | assert r == ordered_packages[1:], r
31 |
32 |
33 | def test_get_recursive_build_depends_in_workspace_with_condition():
34 | pkg = MockPackage('pkg')
35 | cond_false_pkg = MockPackage('cond_false_pkg')
36 | cond_false_pkg.evaluated_condition = False
37 | cond_true_pkg = MockPackage('cond_true_pkg')
38 | pkg.build_depends = [cond_true_pkg, cond_false_pkg]
39 |
40 | ordered_packages = [
41 | ('/path/to/pkg', pkg),
42 | ('/path/to/cond_false_pkg', cond_false_pkg),
43 | ('/path/to/cond_true_pkg', cond_true_pkg),
44 | ]
45 |
46 | r = common.get_recursive_build_depends_in_workspace(pkg, ordered_packages)
47 | assert r == ordered_packages[2:], r
48 |
49 |
50 | def test_get_recursive_build_depends_in_workspace_circular_run_depend():
51 | pkg1 = MockPackage('pkg1')
52 | pkg2 = MockPackage('pkg2')
53 | pkg1.run_depends.append(pkg2)
54 | pkg2.run_depends.append(pkg1)
55 |
56 | ordered_packages = [
57 | ('/path/to/pkg1', pkg1),
58 | ('/path/to/pkg2', pkg2),
59 | ]
60 |
61 | r = common.get_recursive_build_depends_in_workspace(pkg1, ordered_packages)
62 | assert r == ordered_packages[:], r
63 |
64 | r = common.get_recursive_build_depends_in_workspace(pkg2, ordered_packages)
65 | assert r == ordered_packages[:], r
66 |
67 |
68 | def test_format_time_delta_short():
69 | inputs = {
70 | 1.45: "1.4",
71 | 61.45: "01:01.4",
72 | 121.45: "02:01.4",
73 | # this one tests: https://github.com/catkin/catkin_tools/issues/356
74 | 3601.45: "1:00:01.4",
75 | 3721.45: "1:02:01.4",
76 | 7321.45: "2:02:01.4",
77 | 93821.45: "1 day 2:03:41.5",
78 | }
79 | for k, v in inputs.items():
80 | f = common.format_time_delta_short(k)
81 | assert f == v, "format_time_delta_short({0}) -> '{1}' != '{2}'".format(k, f, v)
82 |
--------------------------------------------------------------------------------
/tests/unit/test_io.py:
--------------------------------------------------------------------------------
1 | import binascii
2 | from queue import Queue
3 |
4 | from catkin_tools.execution import io as io
5 |
6 |
7 | def test_invalid_utf8_characters():
8 | io_container = io.IOBufferContainer('test', 'test_id', 'test', Queue(), '/tmp')
9 | bad_byte_array = binascii.a2b_hex(b'80')
10 | try:
11 | io_container._decode(bad_byte_array)
12 | except UnicodeDecodeError:
13 | assert False, "Bad decoding"
14 |
--------------------------------------------------------------------------------
/tests/unit/test_job_flag_regex.py:
--------------------------------------------------------------------------------
1 | from catkin_tools.argument_parsing import extract_jobs_flags
2 | from catkin_tools.argument_parsing import extract_jobs_flags_values
3 |
4 | JOB_FLAG_ERR = "`extract_job_flags` failed to correctly extract flags from %s"
5 |
6 |
7 | def check_only_strings_in_list_util(mflags, args_list):
8 | """Utility function for testing regular expressions used in argument parsing
9 |
10 | Tests if all space-separated values in mflags are in args_list and
11 | that there are no extra entries in args_list. If either of these
12 | tests fail, we return false.
13 |
14 | :param mflags: space separated string of arguments
15 | :type mflags: str
16 | :param args_list: list of strings to test against
17 | :type args_list: list
18 | :returns: if tests pass
19 | :rtype: bool
20 | """
21 | split_flags = mflags.split()
22 | if len(args_list) != len(split_flags):
23 | return False
24 | for arg in args_list:
25 | if arg not in split_flags:
26 | return False
27 | else:
28 | first_index = next(
29 | i for i, val in enumerate(split_flags) if val == arg)
30 | split_flags.pop(first_index)
31 | if not split_flags:
32 | return True
33 | else:
34 | return False
35 |
36 |
37 | def test_job_flag_filtering_jl_packages():
38 | """Test ensures packages that start with `j` or `l` are not converted to make job args:"""
39 | args = "jpkg lpkg -j1 -l1"
40 | filtered = extract_jobs_flags(args)
41 | assert check_only_strings_in_list_util(
42 | "-j1 -l1", filtered), JOB_FLAG_ERR % args
43 | args = "--jobs=1 j2pkg l2pkg --load-average=1"
44 | filtered = extract_jobs_flags(args)
45 | assert check_only_strings_in_list_util(
46 | "--jobs=1 --load-average=1", filtered), JOB_FLAG_ERR % args
47 | args = "--jobs=1 j2pkg --verbose --no-deps l2pkg --load-average=1 --dry-run --start-with j2pkg"
48 | filtered = extract_jobs_flags(args)
49 | assert check_only_strings_in_list_util(
50 | "--jobs=1 --load-average=1", filtered), JOB_FLAG_ERR % args
51 |
52 |
53 | def test_job_flag_filtering_empty_jl():
54 | """Test ensures proper capture of -j/-l args without a value (accepted by GNU Make)"""
55 | args = "pkg1 pkg2 -j"
56 | filtered = extract_jobs_flags(args)
57 | assert check_only_strings_in_list_util(
58 | "-j", filtered), JOB_FLAG_ERR % args
59 | args = "pkg1 pkg2 -l"
60 | filtered = extract_jobs_flags(args)
61 | assert check_only_strings_in_list_util(
62 | "-l", filtered), JOB_FLAG_ERR % args
63 | args = "--jobs pkg1 --verbose --no-deps pkg2 --load-average --dry-run --start-with pkg1"
64 | filtered = extract_jobs_flags(args)
65 | assert check_only_strings_in_list_util(
66 | "--jobs --load-average", filtered), JOB_FLAG_ERR % args
67 |
68 |
69 | def test_no_job_flag():
70 | args = "jpkg1 lpkg2"
71 | filtered = extract_jobs_flags(args)
72 | assert filtered is None, JOB_FLAG_ERR % args
73 |
74 |
75 | def test_job_flag_load_float():
76 | """Test ensures floating point values are handled correctly for load average"""
77 | args = "pkg1 pkg2 --load-average=1.23"
78 | filtered = extract_jobs_flags(args)
79 | assert check_only_strings_in_list_util(
80 | "--load-average=1.23", filtered), JOB_FLAG_ERR % args
81 | args = "-l2 pkg1 pkg2 --load-average=1.23 --no-deps --load-average=1 --load-average -l"
82 | filtered = extract_jobs_flags(args)
83 | assert check_only_strings_in_list_util(
84 | "-l2 --load-average=1.23 --load-average=1 --load-average -l", filtered), JOB_FLAG_ERR % args
85 |
86 |
87 | def test_job_flag_values():
88 | """Test to ensure values are properly extracted from list of job flags"""
89 | flags = "-j1 -j2 --jobs=3 --jobs 4"
90 | valdict = extract_jobs_flags_values(flags)
91 | assert valdict['jobs'] == 4
92 | flags = "-l1 -l2 --load-average=3 --load-average 4"
93 | valdict = extract_jobs_flags_values(flags)
94 | assert abs(valdict['load-average'] - 4.0) < 1e-12
95 | flags = "-l -j"
96 | valdict = extract_jobs_flags_values(flags)
97 | assert 'load-average' in valdict and 'jobs' in valdict
98 | assert valdict['load-average'] is None and valdict['jobs'] is None
99 | flags = "--load-average --jobs"
100 | valdict = extract_jobs_flags_values(flags)
101 | assert 'load-average' in valdict and 'jobs' in valdict
102 | assert valdict['load-average'] is None and valdict['jobs'] is None
103 | flags = '-j -l2 -j -l --load-average=4'
104 | valdict = extract_jobs_flags_values(flags)
105 | assert 'load-average' in valdict and 'jobs' in valdict
106 | assert valdict['jobs'] is None and abs(
107 | valdict['load-average'] - 4.0) < 1e-12
108 |
--------------------------------------------------------------------------------
/tests/unit/test_jobs.py:
--------------------------------------------------------------------------------
1 | from catkin_tools.jobs.utils import merge_envs
2 |
3 |
4 | def test_merge_envs_basic():
5 | job_env = {'PATH': '/usr/local/bin:/usr/bin', 'FOO': 'foo'}
6 |
7 | merge_envs(job_env, [
8 | {'PATH': '/usr/local/bin:/bar/baz/bin'},
9 | {'BAR': 'bar'}])
10 |
11 | # Validate that the known path was not moved from the existing order, and the unfamiliar
12 | # path was correctly prepended.
13 | assert job_env['PATH'] == '/bar/baz/bin:/usr/local/bin:/usr/bin'
14 |
15 | # Confirm that a key only in the original env persists.
16 | assert job_env['FOO'] == 'foo'
17 |
18 | # Confirm that a new key is added.
19 | assert job_env['BAR'] == 'bar'
20 |
21 |
22 | def test_merge_envs_complex():
23 | """Confirm that merged paths are deduplicated and that order is maintained."""
24 | job_env = {'PATH': 'C:B:A'}
25 | merge_envs(job_env, [{'PATH': 'D:C'}, {'PATH': 'E:A:C'}])
26 | assert job_env['PATH'] == 'E:D:C:B:A', job_env['PATH']
27 |
28 |
29 | def test_merge_envs_nonpaths():
30 | """Confirm that non-path vars are simply overwritten on a last-wins policy."""
31 | job_env = {'FOO': 'foo:bar'}
32 | merge_envs(job_env, [{'FOO': 'bar:baz'}, {'FOO': 'baz:bar'}])
33 | assert job_env['FOO'] == 'baz:bar'
34 |
--------------------------------------------------------------------------------
/tests/unit/unicode_text.txt:
--------------------------------------------------------------------------------
1 | Hello Unicode‽
2 |
--------------------------------------------------------------------------------
/tests/workspace_assertions.py:
--------------------------------------------------------------------------------
1 | import os
2 | import re
3 | from io import StringIO
4 |
5 | import yaml
6 |
7 | from .utils import assert_files_exist
8 |
9 |
10 | def assert_workspace_initialized(path):
11 | assert_files_exist(path, ['.catkin_tools'])
12 |
13 |
14 | def assert_warning_message(out_str, pattern=''):
15 | """
16 | Assert that the stdout returned from a call contains a catkin_tools
17 | warning.
18 | """
19 | if isinstance(out_str, StringIO):
20 | out_str = out_str.getvalue()
21 | out_str_stripped = ' '.join(str(out_str).splitlines())
22 | found = re.findall('WARNING:', out_str_stripped)
23 | assert len(found) > 0
24 |
25 | if pattern:
26 | found = re.findall(pattern, out_str_stripped)
27 | assert len(found) > 0
28 |
29 |
30 | def assert_no_warnings(out_str):
31 | """
32 | Assert that the stdout returned from a call contains a catkin_tools
33 | warning.
34 | """
35 | if isinstance(out_str, StringIO):
36 | out_str = out_str.getvalue()
37 | out_str_stripped = ' '.join(str(out_str).splitlines())
38 | found = re.findall('WARNING:', out_str_stripped)
39 | assert len(found) == 0
40 |
41 |
42 | def assert_in_config(workspace, profile, key, value):
43 | with open(os.path.join(workspace, '.catkin_tools', 'profiles', profile, 'config.yaml')) as f:
44 | config = yaml.safe_load(f)
45 |
46 | assert config.get(key, None) == value
47 |
--------------------------------------------------------------------------------