# get build path for package within setup.py

Hi,

I want to redirect the c-files coming from cython to the build directory during the installation step. I am experimenting with the following, which is ok,

import os.path
from catkin_tools.context import Context
subfolder = 'cython_build'
build_dir = os.path.join(ctx.build_space_abs, subfolder)


This results for in a cython build_path approx. like "/home/user/catkin_ws/build/cython_build/src/package_name"

but I am wondering if I could (should) just use the following, instead of recreating the same function:

build_dir =  ctx.package_build_space(package)


and hopefully the path ends up to something like: "/home/user/catkin_ws/build/package_name/cython_build/..."

but I don't know what the argument 'package' is. It is definitely not the (String) name_of_package

Background:

I created a setup.py which "cythonizes" my python modules and installs them. However, the created c-files(1) are placed next to the python files per default. This makes trouble during the travis build with industrial_ci, since the source-folder is read-only.

(1) I don't want to keep the c-files right now, so I don't consider them source files and more intermediate build products.

PS: If someone is interested, I am happy to share the lessons-learned for this catkin-cython procedures as soon as my experiments converge. Please, let me know.

This question is somewhat related to http://answers.ros.org/question/26467...

Full example setup.py

#!/usr/bin/env python
## ! DO NOT MANUALLY INVOKE THIS setup.py, USE CATKIN INSTEAD

from distutils.core import setup
from catkin_pkg.python_setup import generate_distutils_setup
from Cython.Build import cythonize
from catkin_tools.context import Context

# fetch values from package.xml
setup_args = generate_distutils_setup(
packages=['my_driver'],
package_dir={'': 'scripts'})