Skip to content

Commit

Permalink
[doc] Add open source software attributions
Browse files Browse the repository at this point in the history
  • Loading branch information
mxmlnkn committed Nov 13, 2022
1 parent 68e1656 commit 6ffab58
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 2 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2019 Maximilian K.
Copyright (c) 2019-2022 Maximilian Knespel

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion core/LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2019 Maximilian K.
Copyright (c) 2019-2022 Maximilian Knespel

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
34 changes: 34 additions & 0 deletions ratarmount.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import time
import traceback
import urllib.parse
import urllib.request
import zipfile
from typing import Any, Callable, Dict, Iterable, IO, List, Optional, Tuple, Union

Expand Down Expand Up @@ -918,6 +919,35 @@ def printModuleVersion(moduleName: str):
sys.exit(0)


class PrintOSSAttributionAction(argparse.Action):
def __call__(self, parser, args, values, option_string=None):
licenses = []
for name, githubPath in [
("fusepy", "/fusepy/fusepy/master/LICENSE"),
("python-xz", "/Rogdham/python-xz/master/LICENSE.txt"),
("rarfile", "/markokr/rarfile/master/LICENSE"),
("libfuse", "/libfuse/libfuse/master/LGPL2.txt"),
("libsqlite3", "/sqlite/sqlite/master/LICENSE.md"),
("cpython", "/python/cpython/main/LICENSE"),
("libzstd-seek", "/martinellimarco/libzstd-seek/main/LICENSE"),
("zstd", "/facebook/zstd/dev/LICENSE"),
("zlib", "/madler/zlib/master/LICENSE"),
("ratarmountcore", "/mxmlnkn/ratarmount/master/core/LICENSE"),
("indexed_bzip2", "/mxmlnkn/indexed_bzip2/master/LICENSE"),
("indexed_gzip", "/mxmlnkn/indexed_gzip/master/LICENSE"),
("indexed_zstd", "/martinellimarco/indexed_zstd/master/LICENSE"),
]:
licenseUrl = "https://raw.githubusercontent.com" + githubPath
licenseContents = urllib.request.urlopen(licenseUrl).read().decode()
homepage = "https://github.com" + '/'.join(githubPath.split('/', 3)[:3])
licenses.append((name, homepage, licenseContents))

for moduleName, url, license in sorted(licenses):
print(f"# {moduleName}\n\n{url}\n\n\n```\n{license}\n```\n\n")

sys.exit(0)


def _parseArgs(rawArgs: Optional[List[str]] = None):
parser = argparse.ArgumentParser(
formatter_class=_CustomFormatter,
Expand Down Expand Up @@ -1227,6 +1257,10 @@ def _parseArgs(rawArgs: Optional[List[str]] = None):
'backends. Arguments specified last will have the highest priority. A comma-separated list may be '
f'specified. Possible backends: {moduleNames}')

advancedGroup.add_argument(
'--oss-attributions', action=PrintOSSAttributionAction, nargs=0, default=argparse.SUPPRESS,
help='Show licenses of used libraries.')

# Positional Arguments

positionalGroup.add_argument(
Expand Down

0 comments on commit 6ffab58

Please sign in to comment.