From b04f11622218f809f9a4055c93d56ba08257afbe Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Sun, 21 Jan 2024 17:02:05 +0700 Subject: [PATCH] #280 detect minifier, default to 'copy' if not found --- setup.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index bd0547b1..936bf6e9 100755 --- a/setup.py +++ b/setup.py @@ -524,6 +524,14 @@ def sdist(): ) +def detect_minifier() -> str: + cmd = "yuicompressor" if sys.platform.startswith("win") else "uglifyjs" + from shutil import which + if not which(cmd): + return "" + return cmd + + def main(args): def help(): cmd = args[0] @@ -547,7 +555,7 @@ def help(): record_vcs_info() except Exception: print("Warning: src_info is missing") - minifier = "yuicompressor" if sys.platform.startswith("win") else "uglifyjs" + minifier = detect_minifier() root_dir = "" install_dir = os.path.normpath(os.path.join(sys.prefix, "share/xpra/www")) # Platform-dependent configuration file location: