Created
November 8, 2017 08:14
-
-
Save rickmak/b896d73bd1063cac0efe00dc997356f4 to your computer and use it in GitHub Desktop.
Getting license from cocoapod acknowledgement
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import os | |
import plistlib | |
from pprint import pprint | |
def get_acknowledgements(path='.'): | |
paths = [] | |
for root, dirs, files in os.walk("."): | |
if 'Pods' in root: | |
for filename in files: | |
if 'acknowledgements.plist' in filename: | |
paths.append(os.path.join(root, filename)) | |
return paths | |
def main(): | |
ack_files = get_acknowledgements() | |
all_lib = [] | |
for ack_file in ack_files: | |
ack = plistlib.readPlist(ack_file) | |
for item in ack['PreferenceSpecifiers']: | |
if 'License' in item: | |
print(item['Title'] + ' \t ' + item['License']) | |
all_lib.append({ | |
'License': item['License'], | |
'Title': item['Title'] | |
}) | |
else: | |
title = item['Title'] | |
if title != 'Acknowledgements' and title != '': | |
print('No Liecnse for: ' + title) | |
pprint(all_lib) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment