strongswan / swidGenerator

Application which generates SWID-Tags from Linux package managers like dpkg, rpm or pacman.
MIT License
16 stars 11 forks source link

Refactorings + Bugfixes #21

Closed dbrgn closed 10 years ago

dbrgn commented 10 years ago

Reorganized imports

Moved common code from environment subclasses to CommonEnvironment

Encoding Fixes

Other Fixes

Please review, @cfaessler

dbrgn commented 10 years ago

I also added a test for the common environment. It currently fails. We still need to decide how to handle valid/invalid files. Is everything except a directory a valid file? Or is only a file (type f) a valid file? Or maybe files and symlinks?

Btw, this PR raises landscape rating from 83% to 89% :)

cfaessler commented 10 years ago

Nice work @dbrgn, thx! This whole thing is becoming an engineering masterpiece!

cfaessler commented 10 years ago

Dance the Merge Dance!

dbrgn commented 10 years ago

Before merging, we still need to decide whether we count symlinks as files.

RIght now the algorithm for is_file is as follows:

1. If the path doesn't start with `/`, return False
2. If path cannot be opened with os.stat, return False
3. If path is a directory, return False
4. Otherwise, return True

If that's fine, I'll adjust the docstrings and tests accordingly. I'm not sure whether we should allow "is_file" to return on symlinks, named pipes or other strange file-like objects.

Possible object types, according to man find:

My suggestion would be to include regular files and symlinks.

RFC, @d22 @cfaessler