Skip to content

Commit

Permalink
Update 3rd party license validation (#9450)
Browse files Browse the repository at this point in the history
* Update 3rd party license

* account for different copyright for different versions

Co-authored-by: Ofek Lev <ofekmeister@gmail.com>
  • Loading branch information
coignetp and ofek authored Jun 1, 2021
1 parent 6c70fda commit 9c2e49d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions LICENSE-3rdparty.csv
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ cachetools,PyPI,MIT,Thomas Kemmer
clickhouse-cityhash,PyPI,MIT,Alexander [Amper] Marshalov
clickhouse-driver,PyPI,MIT,Konstantin Lebedev
contextlib2,PyPI,PSF,Nick Coghlan
cryptography,PyPI,Apache-2.0,The cryptography developers
cryptography,PyPI,BSD-3-Clause,The cryptography developers
cryptography,PyPI,Apache-2.0,The Python Cryptographic Authority and individual contributors | The cryptography developers
cryptography,PyPI,BSD-3-Clause,The Python Cryptographic Authority and individual contributors | The cryptography developers
cx-Oracle,PyPI,BSD-3-Clause,Anthony Tuininga
ddtrace,PyPI,BSD-3-Clause,"Datadog, Inc."
dnspython,PyPI,ISC,Bob Halley
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@


def format_attribution_line(package_name, license_id, package_copyright):
package_copyright = ' | '.join(sorted(package_copyright))
if ',' in package_copyright:
package_copyright = f'"{package_copyright}"'

Expand Down Expand Up @@ -138,13 +139,13 @@ async def get_data(url):


async def scrape_license_data(urls):
package_data = defaultdict(lambda: {'copyright': '', 'licenses': [], 'classifiers': set()})
package_data = defaultdict(lambda: {'copyright': set(), 'licenses': [], 'classifiers': set()})

async with Pool() as pool:
async for package_name, package_copyright, package_license, license_classifiers in pool.map(get_data, urls):
data = package_data[package_name]
if package_copyright:
data['copyright'] = package_copyright
data['copyright'].add(package_copyright)

data['classifiers'].update(license_classifiers)
if package_license:
Expand Down

0 comments on commit 9c2e49d

Please sign in to comment.