vmavromatis / absolutely-proprietary

Proprietary package detector for arch-based distros. Compares your installed packages against Parabola's package blacklist and then prints your Stallman Freedom Index (free/total).
GNU General Public License v3.0
274 stars 10 forks source link

Use lists instead of files #12

Closed vmavromatis closed 6 years ago

vmavromatis commented 6 years ago

from @abbidabbi:

why are you reading blacklist.txt again and again for each line of the contents of the installed.txt file? Does python cache filesystem I/O by default? It would look much clearer if you'd read the file just once: https://github.com/vmavromatis/absolutely-proprietary/blob/6a1bef8b0999cb38d7bd807c13572ac6d2d89f35/main.py#L27-L31 And why are you writing the results of pacman -Qq and the blacklist content to files anyway? That could just be kept in memory...

Also, writing each line of matched proprietary packages separately to disgusting.txt doesn't look like a good idea and causes many unnecessary write operations: https://github.com/vmavromatis/absolutely-proprietary/blob/6a1bef8b0999cb38d7bd807c13572ac6d2d89f35/main.py#L37

stiefel40k commented 6 years ago

it is actually partially solved with #9 the only thing is not solved is the saving the blacklist. I mean in line 34 (blacklist_file.write(urllib.request.urlopen(url).read().decode())) instead of writing it to a file you could just split on every newline and save as a list. as it is done a few lines later (blacklist = f.read().strip().split('\n'))

vmavromatis commented 6 years ago

Great job for https://github.com/vmavromatis/absolutely-proprietary/pull/20 :+1: