Package.do_install : removed install_self from arguments#1956
Package.do_install : removed install_self from arguments#1956tgamblin merged 3 commits intospack:developfrom
Package.do_install : removed install_self from arguments#1956Conversation
citibeth
left a comment
There was a problem hiding this comment.
-
In #1603 I was conservative with the UI. IF we're going to change
the UI, we should get rid of the negative logic
("ignore_dependencies"), as I did earlier in the code. I think we
should have a UI something like this:subparser.add_argument( '--only', default='self,dependencies' dest='install_only', help="""Select which parts of the DAG to install --- just the top-level package, just the dependencies or both. Comma-separated list that can include self and dependencies. Eg: --only=self or --only=dependencies or --only=self,dependencies"""You then parse install_only immediately after parsing the command line args:
install_only = set(args.install_only.split(','))Now you can write sane code like
if 'self' in install_only... and
get rid of the boolean variables currently in there. -
Unless there's push-back, I'd get rid of the '-i' and '-d'
shortcuts. If there is push-back, you need to keep the old UI
exactly as-is. Middle ground of changing the UI
sort-of-but-not-quite sees sub-optimal.Having more than one command line arg write into the same
destination variable also violates the "principle of least
surprise." -
Yes,
spack.cmd.parse_specs()can return more than one spec, if
the user supplied more than one spec. You should either:a) Raise an exception if
len(specs) != 1.b) Iterate over the specs, installing each one of them. That's
what the code used to do, apparently. It is what I recommend
unless there's some weird technical reason that makes it not
advisable. You should probably also raise an exception if
len(specs) == 0, or at least tell users that nothing is being
installed because nothing was specified. -
I see... you removed
install-selffromdo_install()and moved
the functionality up into the function that calls it. Looks like a
good change to me, less hacky...
That was my point in the first place and everything I wanted to do in this PR. So I don't get why you consider this not ready... |
Can you please share a command that actually starts installing 2 specs ? I was not able to get a string that at some point is parsed into multiple specs (that's why I added the |
|
On Fri, Oct 7, 2016 at 10:53 AM, Massimiliano Culpo <
I marked it not ready because I also requested 3 significant changes. I |
|
How about: Multiple specs used to work for me on what's now become On Fri, Oct 7, 2016 at 11:01 AM, Massimiliano Culpo <
|
Sorry, I still get : |
|
Then I wouldn't bother with it and raise an exception if the user supplied
On Fri, Oct 7, 2016 at 11:06 AM, Massimiliano Culpo <
|
I didn't mean to change the ui, just to use the facility in I maintained the To be clear : I am not against the changes you propose, just not in the scope of this PR. |
Spack is currently pre-release, it's easier to change now than later. I'd rather break scripts in exchange for eliminating negative logic and redundant command line options now, than bake it into the UI long-term. I also suggested changing the new flag from Or more striking, compare these two: OK, a mini-rant on negative logic... Examples are '--ignore-dependencies' It's bad in UIs and should be turned into positive logic whenever possible; for example, '--include-dependencies=no'. Negative logic makes UIs harder to understand. My "favorite" example of bad UI design with negative logic is "Airplane Mode" on my Android phone. When I turn Airplane Mode ON, that really means my phone's radio is being turned OFF. Similarly, turn Airplane Mode OFF to make my phone work again. Completely backwards... |
As I said I don't mind those changes, so if @davydden @tgamblin @adamjstewart and other frequent users agree with the interface above, I'll make them here. Otherwise, I think we should open a new discussion issue to agree on what we should change in the interface. Looking into the parser though may be a longer task better not done here |
|
|
Ok, I think this should be ready ( but I'll let @citibeth decide on whether to re-apply the tag or not 😄 ). To speed things up I crafted the PR such that you can cherry pick everything but the last commit if you want to avoid backward incompatibility. |
|
Sorry, the message above missed @tgamblin 😄 |
lib/spack/spack/cmd/install.py
Outdated
| '--only', | ||
| default='package:dependencies', | ||
| dest='things_to_install', | ||
| choices=['package', 'dependencies', 'package:dependencies'], |
There was a problem hiding this comment.
Should we also let the user do dependencies:packages here? I proposed the mini-parser to allow this flexibility in order; but for just 2 options, just adding them this way might be another approach. Probably not worth changing, since 'package:dependencies' is already the default, users will rarely use it.
There was a problem hiding this comment.
Should we also let the user do dependencies:packages here?
Yes, that's the easiest way to delegate all of the parsing to argparse.
| # FIXME : Is it ever possible to have more than one spec here ? | ||
| # FIXME : Or is it the parser wrong returning an iterable where | ||
| # FIXME : only an item at most can be computed ? | ||
| spec = specs.pop() |
There was a problem hiding this comment.
Remove the FIXMEs. Needs to raise an Exception if length(specs)>1
|
I think it's close. |
|
@citibeth Are you fine with the latest changes to this PR ? |
2136dbb to
9fe4a59
Compare
2017a0e to
9bc3d73
Compare
|
I made one minor modification (changed I believe this handles all of @citibeth's issues so hopefully she will approve the changes. |
|
Thanks, that looks really nice! |
) * Removes the extra argument from Package.do_install while maintaining the changes in behavior pulled in spack#1603 * install : removed -i and -d shorthands (breaks backward compatibility) * Change ':' to ','
Modifications
package.do_installsignature #1930