Skip to content

Add new method to ArchiveWrite- add_entry_from_memory #38

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

Merged
merged 7 commits into from
Aug 22, 2016
Merged

Add new method to ArchiveWrite- add_entry_from_memory #38

merged 7 commits into from
Aug 22, 2016

Conversation

krzysztofzuraw
Copy link

Add new method add_entry_from_memory for creating archive from files stored in memory.

@@ -73,6 +74,39 @@ def add_files(self, *paths):
write_finish_entry(write_p)
entry_clear(entry_p)

def add_entry_from_memory(self, entry):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why an entry object instead of passing directly the 3 arguments?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like more consistency of one object with arguments than 3 arguments but I'm open to discussion and I can change that if you want.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change it. It's inconsistent and confusing, because the type of entry is ArchiveEntry elsewhere in the code, but here it's a "virtual" Entry type that the library doesn't provide (in the test you create it with namedtuple). That would probably be okay in JavaScript code, but this is Python.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Changaco changed, I also added archive_obj_to_write to ease extending libarchive with custom writers: 9bb5015

@Changaco
Copy link
Owner

Note: #26 is a related issue.

@Changaco
Copy link
Owner

A few more tweaks and this should be ready for merge.

@@ -22,7 +22,6 @@
logger = logging.getLogger('libarchive')

page_size = mmap.PAGESIZE

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove that unnecessary whitespace change.

Krzysztof Żuraw added 3 commits August 17, 2016 09:14
@Changaco Changaco merged commit dfddd9c into Changaco:master Aug 22, 2016
@Changaco
Copy link
Owner

Thanks @krzysztofzuraw, good work. :-)

Changaco added a commit that referenced this pull request Nov 29, 2016
Add new method to ArchiveWrite- add_entry_from_memory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants