Skip to content

Instantly share code, notes, and snippets.

@rickmak
Created November 8, 2017 08:14
Show Gist options
  • Save rickmak/b896d73bd1063cac0efe00dc997356f4 to your computer and use it in GitHub Desktop.
Save rickmak/b896d73bd1063cac0efe00dc997356f4 to your computer and use it in GitHub Desktop.
Getting license from cocoapod acknowledgement
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