ros/catkin — pull request #222 by tkruse (2012-10-15 12:35:47+00:00)
Title: Test and refactor setup py

added refactor of workspace as well, as it is related.
* replaced long dict check in workspace.py continuations with equivalent continuation using get with default.
This may in some cases do an unecessary ''.split(), but I think it is still preferrable code.
then refactored functions in setup.py:
* moved in get_workspaces() (Note it would be much better to use catkin/workspace.py, but I am not sure about PYTHONPATH issues to consider)
* renamed a lot of vars to make the code readable
* replaced long continuations with shorter ones using dict.get() with default
* removed / prefix in subfolder argument if any, and use os.path.join instead

Note that I would also like to refactor the CLI api of setup.py.
Instead of
setup.py --prefix --name xxx --value yyy
it would be nicer to use
setup.py prepend xxx --values yyy
setup.py reversed-workspace --exclude yyy
setup.py remove xxx --subfolder yyy

Also it would be much nicer if the ..._dir varssetup.sh did not contain a leading '/'

And it would be better that instead of --prefix returning the prefix we would use --prepend returning the whole new env var value (makes both setup.py and setup.sh cleaner)

But since setup.sh is not unit tested yet, I did not do these changes, and will wait for you to comment before trying them.