Merge lp:~jml/pkgme/extra-files into lp:pkgme
Proposed by
Jonathan Lange
Status: | Merged |
---|---|
Merged at revision: | 65 |
Proposed branch: | lp:~jml/pkgme/extra-files |
Merge into: | lp:pkgme |
Prerequisite: | lp:~jml/pkgme/testing-helpers |
Diff against target: |
151 lines (+73/-1) 4 files modified
pkgme/info_elements.py (+11/-0) pkgme/package_files.py (+22/-1) pkgme/tests/test_info_elements.py (+1/-0) pkgme/tests/test_package_files.py (+39/-0) |
To merge this branch: | bzr merge lp:~jml/pkgme/extra-files |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
James Westby | Needs Information | ||
Review via email: mp+67945@code.launchpad.net |
Description of the change
Add a new type of information called 'ExtraFiles', which is a dictionary that maps paths to contents.
It's kind of a hacky implementation, and I haven't tried very hard to make sure it's complete (e.g. I have no idea how an extra_files script would actually work). But it's at a good point to get feedback.
To post a comment you must log in.
90 +class TestExtraFiles( TestCase) : l('extra_ files', ExtraFiles.name) l({}, ExtraFiles.default)
91 +
92 + def test_name(self):
93 + # ExtraFiles information is provided by an 'extra_files' script.
94 + self.assertEqua
95 +
96 + def test_default(self):
97 + # By default, there are no extra files.
98 + self.assertEqua
I didn't do these tests for everything else, as they just seemed like they
would make things harder to change without really testing anything that is
likely to be a problem. I'm interested if you disagree with that opinion?
56 - keys = [element.name for element in elements] info.get_ all(keys) file_cls. from_info( new_info) ) get(ExtraFiles. name, {}) items() : BasicFile( path, contents))
57 + # XXX: Kind of hacky. The thing is that the ExtraFiles element isn't
58 + # an informational element used by key files, but rather a way of
59 + # forcing extra files to be written.
60 + keys = [ExtraFiles.name] + [element.name for element in elements]
61 values = project_
62 new_info = DictInfo(values)
63 files = []
64 for file_cls in self.files_cls:
65 files.append(
66 + extra_files = values.
67 + for path, contents in extra_files.
68 + files.append(
This, perhaps unsurprisingly gives me pause.
I would have expected an ExtraFilesHandler class to be used, rather than a BasicFile
class. This would have been added to the default group, and so avoided the ExtraFiles.name
special casing there.
This class would then have done the for "path, contents in extra_files. items() " bit when
it was asked to write itself out at the end.
Did that approach not suit?
Thanks,
James