diff --git a/copyparty/__main__.py b/copyparty/__main__.py index 2d939828..862146cf 100755 --- a/copyparty/__main__.py +++ b/copyparty/__main__.py @@ -398,19 +398,14 @@ def disable_quickedit() -> None: def showlic() -> None: - p = os.path.join(E.mod, "COPYING.txt") + p = os.path.join(E.mod, "res", "COPYING.txt") if not os.path.exists(p): print("no relevant license info to display") return - t = " licenses are only relevant to this EXE edition of copyparty, as they are a result of packaging by pyoxidizer" - - print("the below" + t + ":\n") with open(p, "rb") as f: print(f.read().decode("utf-8", "replace")) - print("\nthe above" + t) - def run_argparse(argv: list[str], formatter: Any, retry: bool) -> argparse.Namespace: ap = argparse.ArgumentParser( @@ -578,8 +573,7 @@ def run_argparse(argv: list[str], formatter: Any, retry: bool) -> argparse.Names ap2.add_argument("-mcr", metavar="SEC", type=int, default=60, help="md-editor mod-chk rate") ap2.add_argument("--urlform", metavar="MODE", type=u, default="print,get", help="how to handle url-form POSTs; see --help-urlform") ap2.add_argument("--wintitle", metavar="TXT", type=u, default="cpp @ $pub", help="window title, for example '$ip-10.1.2.' or '$ip-'") - if E.ox: - ap2.add_argument("--license", action="store_true", help="show licenses and exit") + ap2.add_argument("--license", action="store_true", help="show licenses and exit") ap2.add_argument("--version", action="store_true", help="show versions and exit") ap2 = ap.add_argument_group('upload options') @@ -795,7 +789,7 @@ def main(argv: Optional[list[str]] = None) -> None: if "--version" in argv: sys.exit(0) - if "--license" in argv and E.ox: + if "--license" in argv: showlic() sys.exit(0) diff --git a/docs/lics.txt b/docs/lics.txt new file mode 100644 index 00000000..57dab61e --- /dev/null +++ b/docs/lics.txt @@ -0,0 +1,63 @@ +--- server-side --- software --- + +https://github.com/9001/copyparty/ +C: 2019 ed +L: MIT + +https://github.com/pallets/jinja/ +C: 2007 Pallets +L: BSD 3-Clause + +https://github.com/pallets/markupsafe/ +C: 2010 Pallets +L: BSD 3-Clause + +https://github.com/giampaolo/pyftpdlib/ +C: 2007 Giampaolo Rodola' +L: MIT + +https://github.com/python/cpython/blob/3.10/Lib/asyncore.py +C: 1996 Sam Rushing +L: ISC + +https://github.com/ahupp/python-magic/ +C: 2001-2014 Adam Hupp +L: MIT + +--- client-side --- software --- + +https://github.com/Daninet/hash-wasm/ +C: 2020 Dani Biró +L: MIT + +https://github.com/openpgpjs/asmcrypto.js/ +C: 2013 Artem S Vybornov +L: MIT + +https://github.com/feimosi/baguetteBox.js/ +C: 2017 Marek Grzybek +L: MIT + +https://github.com/markedjs/marked/ +C: 2018+, MarkedJS +C: 2011-2018, Christopher Jeffrey (https://github.com/chjj/) +L: MIT + +https://github.com/codemirror/codemirror5/ +C: 2017 Marijn Haverbeke and others +L: MIT + +https://github.com/Ionaru/easy-markdown-editor/ +C: 2015 Sparksuite, Inc. +C: 2017 Jeroen Akkerman. +L: MIT + +--- client-side --- fonts --- + +https://github.com/adobe-fonts/source-code-pro/ +C: 2010-2019 Adobe +L: SIL OFL 1.1 + +https://github.com/FortAwesome/Font-Awesome/ +C: 2022 Fonticons, Inc. +L: SIL OFL 1.1 diff --git a/pyoxidizer.bzl b/pyoxidizer.bzl index 63a5ac19..9e213e2e 100644 --- a/pyoxidizer.bzl +++ b/pyoxidizer.bzl @@ -29,6 +29,7 @@ def make_exe(): "jinja2", "markupsafe", "pyftpdlib", + "python-magic", ] )) return exe diff --git a/scripts/make-sfx.sh b/scripts/make-sfx.sh index e4c8393e..ad51e55a 100755 --- a/scripts/make-sfx.sh +++ b/scripts/make-sfx.sh @@ -226,6 +226,46 @@ tmpdir="$( (cd copyparty; "$pybin" ../../scripts/strip_hints/a.py; rm uh) } +f=../build/mit.txt +[ -e $f ] || + curl https://opensource.org/licenses/MIT | + awk '/div>/{o=0}o>1;o{o++}/;COPYRIGHT HOLDER/{o=1}' | + awk '{gsub(/<[^>]+>/,"")};1' >$f + +f=../build/isc.txt +[ -e $f ] || + curl https://opensource.org/licenses/ISC | + awk '/div>/{o=0}o>2;o{o++}/;OWNER/{o=1}' | + awk '{gsub(/<[^>]+>/,"")};/./{b=0}!/./{b++}b>1{next}1' >$f + +f=../build/3bsd.txt +[ -e $f ] || + curl https://opensource.org/licenses/BSD-3-Clause | + awk '/div>/{o=0}o>1;o{o++}/HOLDER/{o=1}' | + awk '{gsub(/<[^>]+>/,"")};1' >$f + +f=../build/ofl.txt +[ -e $f ] || + curl https://opensource.org/licenses/OFL-1.1 | + awk '/PREAMBLE/{o=1}/sil\.org/{o=0}!o{next}/./{printf "%s ",$0;next}{print"\n"}' | + awk '{gsub(/<[^>]+>/,"");gsub(/^\s+/,"");gsub(/&/,"\\&")}/./{b=0}!/./{b++}b>1{next}1' >$f + +(sed -r 's/^L: /License: /;s/^C: /Copyright (c) /' <../docs/lics.txt +printf '\n\n--- MIT License ---\n\n'; cat ../build/mit.txt +printf '\n\n--- ISC License ---\n\n'; cat ../build/isc.txt +printf '\n\n--- BSD 3-Clause License ---\n\n'; cat ../build/3bsd.txt +printf '\n\n--- SIL Open Font License v1.1 ---\n\n'; cat ../build/ofl.txt +) | +while IFS= read -r x; do + [ "${x:0:4}" = "--- " ] || { + printf '%s\n' "$x" + continue + } + n=${#x} + p=$(( (80-n)/2 )) + printf "%${p}s\033[07m%s\033[0m\n" "" "$x" +done > copyparty/res/COPYING.txt + ver= [ -z "$repack" ] && git describe --tags >/dev/null 2>/dev/null && { @@ -431,8 +471,8 @@ nf=$(ls -1 "$zdir"/arc.* | wc -l) bdir=build/$tgt/release/install/copyparty t="res web" - cp -pv ../$bdir/COPYING.txt copyparty/ && - t="$t COPYING.txt" || + (printf "\n\n\nBUT WAIT! THERE'S MORE!!\n\n"; + cat ../$bdir/COPYING.txt) >> copyparty/res/COPYING.txt || echo "copying.txt 404 pls rebuild" mv ftp/* j2/* copyparty/vend/* . @@ -441,7 +481,8 @@ nf=$(ls -1 "$zdir"/arc.* | wc -l) cd .. pyoxidizer build --release --target-triple $tgt mv $bdir/copyparty.exe dist/ - cp -pv "$(cygpath 'C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Redist\MSVC\14.16.27012\x86\Microsoft.VC141.CRT\vcruntime140.dll')" dist/ + cp -pv "$(for d in '/c/Program Files (x86)/Microsoft Visual Studio/'*'/BuildTools/VC/Redist/MSVC'; do + find "$d" -name vcruntime140.dll; done | sort | grep -vE '/x64/|/onecore/'ƒ | head -n 1)" dist/ dist/copyparty.exe --version cp -pv dist/copyparty{,.orig}.exe [ $ultra ] && a="--best --lzma" || a=-1 diff --git a/scripts/sfx.ls b/scripts/sfx.ls index 980b46b7..c7fb5bcb 100644 --- a/scripts/sfx.ls +++ b/scripts/sfx.ls @@ -19,6 +19,7 @@ copyparty/httpsrv.py, copyparty/ico.py, copyparty/mtag.py, copyparty/res, +copyparty/res/COPYING.txt, copyparty/res/insecure.pem, copyparty/star.py, copyparty/stolen,