Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
clean cmd: migrate to use new lifecycle attribs #148
Conversation
elopio
reviewed
Dec 3, 2015
| @@ -62,7 +57,8 @@ def main(argv=None): | ||
| not os.listdir(common.get_partsdir())): | ||
| os.rmdir(common.get_partsdir()) | ||
| - clean_stage = not args['PART'] or part_names == set(args['PART']) | ||
| + parts_match = set(config.part_names) == set(args['PART']) | ||
| + clean_stage = not args['PART'] or parts_match | ||
| if clean_stage and os.path.exists(common.get_stagedir()): |
elopio
Dec 3, 2015
Member
This deserves a comment. "Delete the stage dir only if all the parts were cleaned"
did I get it right?
elopio
reviewed
Dec 3, 2015
| -class _IO(io.StringIO): | ||
| - | ||
| - def fileno(self): | ||
| - return 1 |
sergiusens
Dec 3, 2015
Collaborator
It was important when trying to mock stdout for subprocess, that code was killed, so this is not used anymore.
elopio
reviewed
Dec 3, 2015
| + 'Expected for {!r} to be wiped'.format(part['part_dir'])) | ||
| + self.assertFalse( | ||
| + os.path.exists(part['state_file']), | ||
| + 'Expected for {!r} to be wiped'.format(part['state_file'])) |
elopio
Dec 3, 2015
Member
This might be unnecessary, isn't it enough to check that partsdir doesn't exist?
Feel free to leave the extra checks if you think they might be useful.
elopio
reviewed
Dec 3, 2015
| + 'Expected for {!r} to be wiped'.format(part['part_dir'])) | ||
| + self.assertFalse( | ||
| + os.path.exists(part['state_file']), | ||
| + 'Expected for {!r} to be wiped'.format(part['state_file'])) |
|
|
sergiusens
added some commits
Dec 3, 2015
|
all good then? |
|
all good. |
added a commit
that referenced
this pull request
Dec 3, 2015
sergiusens
merged commit 3931b08
into
snapcore:new-cli
Dec 3, 2015
sergiusens
deleted the
sergiusens:07-clean-cleanup
branch
Dec 3, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
sergiusens commentedDec 3, 2015
This also migrates clean to use real elements instead of
over mocking.
Signed-off-by: Sergio Schvezov sergio.schvezov@canonical.com