Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Converge all commands into one #433
Conversation
sergiusens
added some commits
Apr 7, 2016
|
I am also fixing bug #1567041 here |
sergiusens
added some commits
Apr 7, 2016
kyrofa
reviewed
Apr 7, 2016
| from snapcraft import common | ||
| +from snapcraft import lifecycle # noqa | ||
| +from snapcraft import plugins # noqa |
sergiusens
Apr 7, 2016
Collaborator
Because they are imported but not used, but by doing this you can just import snapcraft and get snapcraft.plugins and snapcraft.lifecycle already imported as well
Just like you get os.path when importing os
kyrofa
reviewed
Apr 7, 2016
| @@ -115,7 +115,11 @@ | ||
| import os | ||
| import shutil | ||
| +from snapcraft._help import topic_help # noqa | ||
| +from snapcraft._store import login, logout, upload # noqa |
kyrofa
Apr 7, 2016
Member
Elsewhere we use a format like:
from snapcraft._store import (
login,
logout,
upload
)Should we be consistent?
sergiusens
Apr 7, 2016
Collaborator
Those are imported but not used, so I'd like to call them out explicitly.
It's defacto done like this for a package __init__.py
sergiusens
Apr 7, 2016
Collaborator
I can give you a personal note here too, I don't like the way tupling looks either
sergiusens
Apr 7, 2016
Collaborator
With tupling, but it would also be an indication that we are doing something wrong IMHO
kyrofa
reviewed
Apr 7, 2016
| + f.write(yaml) | ||
| + logger.info('Created snapcraft.yaml.') | ||
| + | ||
| + | ||
| def execute(step, part_names=None): | ||
| """Exectute until step in the lifecycle. |
kyrofa
reviewed
Apr 7, 2016
| + this. | ||
| + -s <step>, --step <step> only clean the specified step and those | ||
| + that depend upon it. <step> can be one | ||
| + of: pull, build, stage or strip. |
kyrofa
Apr 7, 2016
Member
Still a relative docopt newbie, but should --step be here if it's in the Usage section above? Doesn't it make it a global option, when it should really be specific to clean?
sergiusens
Apr 7, 2016
Collaborator
It doesn't really matter. I can break down the header (Options) into "Options for cleaning", "Options for building"
and then just Options.
Meaning of [options] shortcut slightly changed. Previously it meant "any known option". Now it means "any option not in usage-pattern". This avoids the situation when an option is allowed to be repeated unintentionally.
from the first lines of https://github.com/docopt/docopt
kyrofa
reviewed
Apr 7, 2016
| + snapcraft [options] stage [<part> ...] | ||
| + snapcraft [options] strip [<part> ...] | ||
| + snapcraft [options] clean [<part> ...] [--step <step>] | ||
| + snapcraft [options] snap [<directory> --output <snap-file>] |
kyrofa
Apr 7, 2016
Member
Does this syntax mean that --output is required when specifying <directory>, and not possible to specify when not specifying <directory>? Should this instead be snapcraft [options] snap [<directory>] [--output <snap-file>] ?
sergiusens
Apr 7, 2016
Collaborator
It is totally valid POSIX to do it this way, you can look at the last bullet here:
https://github.com/docopt/docopt#option-descriptions-format
Also, the tests pass and we have tests for -o and . If you think it would look nicer to put them in individual brackets that's fine, but look at git pull:
SYNOPSIS
git pull [options] [<repository> [<refspec>...]]
kyrofa
reviewed
Apr 7, 2016
| + that depend upon it. <step> can be one | ||
| + of: pull, build, stage or strip. | ||
| + -o <snap-file>, --output <snap-file> used in case you want to rename the | ||
| + snap. |
kyrofa
reviewed
Apr 7, 2016
| snapcraft [options] | ||
| + snapcraft [options] init | ||
| + snapcraft [options] pull [<part> ...] | ||
| + snapcraft [options] build [<part> ...] |
kyrofa
Apr 7, 2016
Member
Now that these are all together, should --no-parallel-build be an option specific to build?
sergiusens
added some commits
Apr 7, 2016
kyrofa
reviewed
Apr 7, 2016
| + elif args['help']: | ||
| + snapcraft.topic_help(args['<topic>'] or args['<plugin>'], | ||
| + args['--devel'], args['topics']) | ||
| + else: # snap of default: |
sergiusens
Apr 7, 2016
Collaborator
I wanted to say "or" but "by" is better :-)
El 07/04/16 a las 12:58, Kyle Fazzari escribió:
In snapcraft/main.py
ubuntu-core#433 (comment):
+def run(args):
- lifecycle_command = _get_lifecycle_command(args)
- argless_command = _get_command_from_arg(args)
- if lifecycle_command:
snapcraft.lifecycle.execute(lifecycle_command, args['<part>'])- elif argless_command:
argless_command()- elif args['clean']:
snapcraft.lifecycle.clean(args['<part>'], args['--step'])- elif args['upload']:
snapcraft.upload(args['<snap-file>'])- elif args['help']:
snapcraft.topic_help(args['<topic>'] or args['<plugin>'],args['--devel'], args['topics'])- else: # snap of default:
s/snap of default/snap by default/
—
You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
https://github.com/ubuntu-core/snapcraft/pull/433/files/71398bd40679e08f4a3233187e516894d69e7242#r58897251
kyrofa
reviewed
Apr 7, 2016
| + snapcraft [options] stage [<part> ...] | ||
| + snapcraft [options] strip [<part> ...] | ||
| + snapcraft [options] clean [<part> ...] [--step <step>] | ||
| + snapcraft [options] snap [<directory> --output <snap-file>] |
sergiusens
Apr 7, 2016
Collaborator
It is totally valid POSIX to do it this way, you can look at the last bullet here:
https://github.com/docopt/docopt#option-descriptions-format
Also, the tests pass and we have tests for -o and . If you think it would look nicer to put them in individual brackets that's fine, but look at git pull:
SYNOPSIS
git pull [options] [<repository> [<refspec>...]]
|
I'm a little sad to see the commands go, but I understand the need. |
|
El 07/04/16 a las 13:24, Kyle Fazzari escribió:
I feel the same. But it was an invitation to a problem as those commands aren't necessarily independent. |
sergiusens commentedApr 7, 2016
LP: #1567058
LP: #1567041
Signed-off-by: Sergio Schvezov sergio.schvezov@ubuntu.com