-
Notifications
You must be signed in to change notification settings - Fork 146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implementation of pluggable spaces. #458
Conversation
'devel = catkin_tools.spaces.devel:description', | ||
'install = catkin_tools.spaces.install:description', | ||
'log = catkin_tools.spaces.log:description', | ||
'source = catkin_tools.spaces.source:description', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If desired, these could be collapsed into a single file, so:
'build = catkin_tools.spaces:build',
'devel = catkin_tools.spaces:devel',
'install = catkin_tools.spaces:install',
'log = catkin_tools.spaces:log',
'source = catkin_tools.spaces:source',
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fine I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool. Yes I think it makes sense to give them their own files, particularly if we're likely to see functions attached to these related to cleaning or other behaviours.
50017fc
to
20cbf3b
Compare
Okay, the story for properly handling
Another interesting thing about this is the question of whether the existing catkin_tools/catkin_tools/jobs/catkin.py Line 485 in 2442e1f
catkin_tools/catkin_tools/jobs/cmake.py Line 328 in 2442e1f
I think in the short term I will focus on the clean_profile side of things as my immediate interest is getting support for |
20cbf3b
to
4fd084d
Compare
@wjwwood Thoughts on the above discussion? IMO this PR is mergeable as-is, and the work to improve |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally looks good. I had a few comments and questions which should be addressed.
catkin_tools/argument_parsing.py
Outdated
@@ -89,15 +89,15 @@ def add_cmake_and_make_and_catkin_make_args(parser): | |||
|
|||
add = parser.add_mutually_exclusive_group().add_argument | |||
add('--make-args', metavar='ARG', dest='make_args', nargs='+', required=False, type=str, default=None, | |||
help='Arbitrary arguments which are passes to make.' | |||
help='Arbitrary arguments which are passes to make. ' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the trailing space, also there is a typo in this help (not new), passes
-> passed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The string gets concatenated with the string immediately below. Without the change, you get:
$ catkin build -h
[ ... ]
--make-args ARG [ARG ...]
Arbitrary arguments which are passes to make.It
collects all of following arguments until a "--" is
read.
Will fix passes -> passed as well.
catkin_tools/argument_parsing.py
Outdated
'It collects all of following arguments until a "--" is read.') | ||
add('--no-make-args', dest='make_args', action='store_const', const=[], default=None, | ||
help='Pass no additional arguments to make (does not affect --catkin-make-args).') | ||
|
||
add = parser.add_mutually_exclusive_group().add_argument | ||
add('--catkin-make-args', metavar='ARG', dest='catkin_make_args', | ||
nargs='+', required=False, type=str, default=None, | ||
help='Arbitrary arguments which are passes to make but only for catkin packages.' | ||
help='Arbitrary arguments which are passes to make but only for catkin packages. ' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same question and typo, lol.
catkin_tools/context.py
Outdated
setattr(self, '__%s_space_abs' % space, os.path.join(self.__workspace, value)) | ||
|
||
def space_exists(self): | ||
"Returns true if the space exists" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use """
here, unless you have a specific reason not to?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a C&P from the old source_space_exists
function. Will update.
catkin_tools/context.py
Outdated
|
||
@classmethod | ||
def setup_space_keys(cls): | ||
''' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe """
is the convention most used in this file, please use that rather than '''
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
Potentially this could be called on import, but it felt saner to defer and do it lazily on first use.
@@ -411,20 +446,20 @@ def summary(self, notes=[]): | |||
"--init`.")] | |||
if not self.source_space_exists(): | |||
summary_warnings += [clr( | |||
"Source space `@{yf}{_Context__source_space_abs}@|` does not yet exist.")] | |||
"Source space `@{yf}{__source_space_abs}@|` does not yet exist.")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this use the self.source_space_abs
property? Why is the _Context
prefix no longer needed, isn't it required due to the name mangling:
https://docs.python.org/2/tutorial/classes.html#private-variables-and-class-local-references
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would have though so, but this was what worked. It may be an indication that I'm not using property
correctly in the setup of these generated properties. I shall investigate and report back.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I'm not really sure what is going on here, but the behaviour is definitely correct in that each instance of Context
has its own set of these properties, eg:
$ ~/env/bin/python
Python 2.7.6 (default, Oct 26 2016, 20:30:19)
[GCC 4.8.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from catkin_tools.context import Context
>>> Context.setup_space_keys()
>>> c = Context('.')
>>> c.source_space
'src'
>>> d = Context('.')
>>> d.source_space
'src'
>>> c.source_space = 'foo'
>>> c.source_space
'foo'
>>> c.source_space_abs
'/home/mikepurvis/test_ws/foo'
>>> d.source_space
'src'
@@ -235,7 +235,6 @@ Sourcing these setup scripts adds this workspace and any "underlaid" workspaces | |||
|
|||
.. [1] GNU/Linux Only | |||
.. [2] Mac OS X Only | |||
.. [3] Windows Only |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this unused, or...?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it was producing a Sphinx build warning.
'devel = catkin_tools.spaces.devel:description', | ||
'install = catkin_tools.spaces.install:description', | ||
'log = catkin_tools.spaces.log:description', | ||
'source = catkin_tools.spaces.source:description', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fine I think.
I'm in favor of merging this and dealing with the generalization of catkin clean afterwards. Honestly I didn't have much to do with |
DEFAULT_INSTALL_SPACE = 'install' | ||
CATKIN_SPACES_GROUP = 'catkin_tools.spaces' | ||
|
||
SPACES = {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given the usage patterns seen below, there might be a case to be made here for using a list rather than a dict, and creating a new Space
class rather than just assigning the entry_point dict directly.
I don't think it much matters for now, so my inclination would be to leave it and add the extra layer as need demands.
As discussed in mikepurvis/catkin_tools_document#3 (comment).
This permits plugins to register new first-class space types. Some potential candidate uses:
docs
space for stashing doxygen/sphinx output.tests
space for placing junit testing reports.merge
space for placing post-build merged installspaces assembled from workspaces built with the--install-isolated
option.symbols
space for placing debug symbols stripped from binaries during/after the the build.I haven't yet updated the
catkin_clean
verb to take advantage of this, but will do so shortly.FYI @wjwwood @tspicer01
Test failure is due to a breakage upstream with the Sphinx spellcheck. I'd suggest either turning off the spellcheck for now, or locking into an older version of Sphinx where the problem didn't happen.