Files
upstream-zulip/tools/check-thirdparty
upstream-mirror 64898b2c79
Some checks failed
Code scanning / CodeQL (push) Failing after 15s
Zulip production suite / Ubuntu 22.04 production build (push) Failing after 26s
Zulip production suite / Debian 12 production install with custom db name and user (push) Has been skipped
Zulip production suite / Ubuntu 22.04 production install and PostgreSQL upgrade with pgroonga (push) Has been skipped
Zulip production suite / Ubuntu 24.04 production install (push) Has been skipped
Zulip production suite / Ubuntu 26.04 production install (push) Has been skipped
Zulip production suite / Debian 13 production install (push) Has been skipped
Zulip production suite / 7.0 Version Upgrade (push) Has been skipped
Zulip production suite / 8.0 Version Upgrade (push) Has been skipped
Zulip production suite / 6.0 Version Upgrade (push) Has been skipped
Zulip production suite / 10.0 Version Upgrade (push) Has been skipped
Zulip production suite / 9.0 Version Upgrade (push) Has been skipped
Zulip production suite / 12.0 Version Upgrade (push) Has been skipped
Zulip production suite / 11.0 Version Upgrade (push) Has been skipped
GitHub Actions Security Analysis with zizmor / zizmor (push) Failing after 3s
Zulip CI / Debian 12 (Python 3.11, backend + documentation) (push) Failing after 26s
Zulip CI / Ubuntu 22.04 (Python 3.10, backend + frontend) (push) Failing after 3s
Zulip CI / Ubuntu 24.04 (Python 3.12, backend) (push) Failing after 25s
Zulip CI / Ubuntu 26.04 (Python 3.14, backend) (push) Failing after 25s
Zulip CI / Debian 13 (Python 3.13, backend) (push) Failing after 28s
Zulip production suite / Required jobs (push) Has been cancelled
Zulip CI / Required jobs (push) Has been cancelled
API Documentation Update Check / check-feature-level-updated (push) Has been cancelled
API Documentation Update Check / notify-if-api-docs-changed (push) Has been cancelled
snapshot of https://github.com/zulip/zulip.git @ 48c69911c7dd4e03b20552eb3bd77ad8151c1357 (2026-09-15)
2026-09-15 15:05:30 +05:00

87 lines
2.5 KiB
Python
Executable File

#!/usr/bin/env python3
"""Check the docs/THIRDPARTY file against the DEP-5 copyright format.
https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Disclaimer: This script is not a lawyer. It cannot validate that the
claimed licenses are correct. It can only check for basic syntactic
issues.
"""
# Copyright © 2020 Kandra Labs, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
import difflib
import io
import os
import subprocess
import sys
from debian import copyright
COPYRIGHT_FILENAME = "docs/THIRDPARTY"
os.chdir(os.path.join(os.path.dirname(__file__), ".."))
status = 0
*files, empty = subprocess.check_output(
["git", "ls-files", "-z"],
encoding="utf-8",
).split("\0")
assert empty == ""
files += [
"static/generated/emoji/images/emoji/unicode/ignore-this-path",
]
with open(COPYRIGHT_FILENAME) as f:
lines = list(f)
c = copyright.Copyright(lines)
if not c.header.known_format():
print(f"{COPYRIGHT_FILENAME}: Unknown header format {c.header.format}")
status = 1
defined_licenses = {
p.license.to_str().split("\n", 1)[0]
for p in c.all_license_paragraphs()
if "\n" in p.license.to_str()
}
for p in c.all_files_paragraphs():
for g in p.files:
if not any(map(copyright.globs_to_re([g]).fullmatch, files)):
print(f"{COPYRIGHT_FILENAME}: No such file {g}")
status = 1
if "\n" not in p.license.to_str() and p.license.to_str() not in defined_licenses:
print(f"{COPYRIGHT_FILENAME}: Missing license text for {p.license.to_str()}")
status = 1
dumped = c.dump()
if dumped != "".join(lines):
print(f"{COPYRIGHT_FILENAME}: Changes expected:")
sys.stdout.writelines(
difflib.unified_diff(
lines,
io.StringIO(dumped).readlines(),
COPYRIGHT_FILENAME,
COPYRIGHT_FILENAME,
),
)
status = 1
sys.exit(status)