From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 0B5A43858418 for ; Mon, 11 Mar 2024 19:03:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0B5A43858418 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=efficios.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=efficios.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 0B5A43858418 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=158.69.221.121 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710183827; cv=none; b=Has7C5G4VnkCVupSXFxHEVAPK4rlK8HnlnhRp+LCLEZlXAhi+WBGgbobLydvMkFFKQRtnZFKBMwNY3N8zhHhiyM/Rmar5PEUmiqEaC8WWq+2Joq1UXVQMUJMARq3FW+oMjNfIiiyKLnZzJqWsr9+nKQr8foT0XIuYPAwFAbJ8F8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710183827; c=relaxed/simple; bh=wab3ltFMNzxmKC2sqUzCPwC9UXKJWPpwuZ2b4MiYAKA=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=a6ztNNAsH/y+9Yl4ZykA68OJCxjb5tumaYu9xQheSZzbChxfn7y/E+MF1LAFVr7+kBlw7J7IMjoACfvs0TUvSqZ3czOdauyKAUoBV/mFWho/xdeCz8e8373CLh5OdZiDNOSqqrYy8dNHNkx72kHERnys4YqR71PE5elD+YZGNhE= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from smarchi-efficios.internal.efficios.com (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 8831D1E0C1; Mon, 11 Mar 2024 15:03:43 -0400 (EDT) From: Simon Marchi To: buildbot@sourceware.org Cc: Simon Marchi Subject: [PATCH 1/8] autoregen.py: re-format with black 24.2.0 Date: Mon, 11 Mar 2024 15:01:13 -0400 Message-ID: <20240311190341.235331-2-simon.marchi@efficios.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240311190341.235331-1-simon.marchi@efficios.com> References: <20240311190341.235331-1-simon.marchi@efficios.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3496.2 required=5.0 tests=BAYES_00,GIT_PATCH_0,KAM_DMARC_NONE,KAM_DMARC_STATUS,KAM_NUMSUBJECT,SPF_HELO_PASS,SPF_SOFTFAIL,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: This is subjective, but I am completely sold on using black for Python projects, so I propose using it here. It lets us completely stop thinking about formatting whatsoever. --- builder/containers/autoregen.py | 72 ++++++++++++++++++--------------- 1 file changed, 40 insertions(+), 32 deletions(-) diff --git a/builder/containers/autoregen.py b/builder/containers/autoregen.py index 3d307ad24132..861a2ce79ef5 100755 --- a/builder/containers/autoregen.py +++ b/builder/containers/autoregen.py @@ -5,12 +5,13 @@ import shutil import subprocess from pathlib import Path + # On Gentoo, vanilla unpatched autotools are packaged separately. # We place the vanilla names first as we want to prefer those if both exist. -autoconf_names = ['autoconf-vanilla-2.69', 'autoconf-2.69'] -automake_names = ['automake-vanilla-1.15', 'automake-1.15.1'] -aclocal_names = ['aclocal-vanilla-1.15', 'aclocal-1.15.1'] -autoheader_names = ['autoheader-vanilla-2.69', 'autoheader-2.69'] +autoconf_names = ["autoconf-vanilla-2.69", "autoconf-2.69"] +automake_names = ["automake-vanilla-1.15", "automake-1.15.1"] +aclocal_names = ["aclocal-vanilla-1.15", "aclocal-1.15.1"] +autoheader_names = ["autoheader-vanilla-2.69", "autoheader-2.69"] # Pick the first for each list that exists on this system. AUTOCONF_BIN = next(name for name in autoconf_names if shutil.which(name)) @@ -23,23 +24,24 @@ AUTOHEADER_BIN = next(name for name in autoheader_names if shutil.which(name)) ENV = f'WANT_AUTOCONF={AUTOCONF_BIN.split("-", 1)[1]} ' ENV += f'WANT_AUTOMAKE={AUTOMAKE_BIN.split("-", 1)[1]} ' -ENV += f' AUTOCONF={AUTOCONF_BIN} ' -ENV += f' ACLOCAL={ACLOCAL_BIN} ' -ENV += f' AUTOMAKE={AUTOMAKE_BIN}' +ENV += f" AUTOCONF={AUTOCONF_BIN} " +ENV += f" ACLOCAL={ACLOCAL_BIN} " +ENV += f" AUTOMAKE={AUTOMAKE_BIN}" + # Directories we should skip entirely because they're vendored or have different # autotools versions. skip_dirs = [ # readline and minizip are maintained with different autotools versions - 'readline', - 'minizip' + "readline", + "minizip", ] config_folders = [] -for root, _, files in os.walk('.'): +for root, _, files in os.walk("."): for file in files: - if file == 'configure.ac': + if file == "configure.ac": config_folders.append(Path(root).resolve()) for folder in sorted(config_folders): @@ -50,31 +52,37 @@ for folder in sorted(config_folders): os.chdir(folder) - configure_lines = open('configure.ac').read().splitlines() - if any(True for line in configure_lines if line.startswith('AC_CONFIG_MACRO_DIRS')): + configure_lines = open("configure.ac").read().splitlines() + if any(True for line in configure_lines if line.startswith("AC_CONFIG_MACRO_DIRS")): # aclocal does not support the -f short option for force - include_arg = '' - include_arg2 = '' - if (folder / '..' / 'config').is_dir(): - include_arg = '-I../config' + include_arg = "" + include_arg2 = "" + if (folder / ".." / "config").is_dir(): + include_arg = "-I../config" # this is really a hack just for binutils-gdb/gprofng/libcollector # make sure that the order of includes is done as --enable-maintainer-mode - if (folder / '..' / '..' / 'config').is_dir(): - include_arg = '-I../..' - include_arg2 = '-I../../config' - - subprocess.check_output(f'{ENV} {ACLOCAL_BIN} --force {include_arg} {include_arg2}', shell=True, encoding='utf8') - - if ((folder / 'config.in').is_file() - or any(True for line in configure_lines if line.startswith('AC_CONFIG_HEADERS'))): - subprocess.check_output(f'{ENV} {AUTOHEADER_BIN} -f', shell=True, encoding='utf8') + if (folder / ".." / ".." / "config").is_dir(): + include_arg = "-I../.." + include_arg2 = "-I../../config" + + subprocess.check_output( + f"{ENV} {ACLOCAL_BIN} --force {include_arg} {include_arg2}", + shell=True, + encoding="utf8", + ) + + if (folder / "config.in").is_file() or any( + True for line in configure_lines if line.startswith("AC_CONFIG_HEADERS") + ): + subprocess.check_output( + f"{ENV} {AUTOHEADER_BIN} -f", shell=True, encoding="utf8" + ) # apparently automake is somehow unstable -> skip it for gotools - if (any(True for line in configure_lines if line.startswith('AM_INIT_AUTOMAKE')) - and not str(folder).endswith('gotools')): - subprocess.check_output(f'{ENV} {AUTOMAKE_BIN} -f', - shell=True, encoding='utf8') - - subprocess.check_output(f'{ENV} {AUTOCONF_BIN} -f', shell=True, encoding='utf8') + if any( + True for line in configure_lines if line.startswith("AM_INIT_AUTOMAKE") + ) and not str(folder).endswith("gotools"): + subprocess.check_output(f"{ENV} {AUTOMAKE_BIN} -f", shell=True, encoding="utf8") + subprocess.check_output(f"{ENV} {AUTOCONF_BIN} -f", shell=True, encoding="utf8") -- 2.44.0