diff options
l--------- | .style.yapf | 1 | ||||
-rwxr-xr-x | conf/uncrustify-mode.el | 2 | ||||
-rwxr-xr-x | conf/uncrustify_precommit | 2 | ||||
-rwxr-xr-x | configure | 23 | ||||
-rw-r--r-- | semver.py | 2 | ||||
-rw-r--r-- | talerbuildconfig.py | 49 |
6 files changed, 52 insertions, 27 deletions
diff --git a/.style.yapf b/.style.yapf deleted file mode 120000 index b7630a2..0000000 --- a/.style.yapf +++ /dev/null @@ -1 +0,0 @@ -conf/.style.yapf
\ No newline at end of file diff --git a/conf/uncrustify-mode.el b/conf/uncrustify-mode.el index 97118c0..2d1ca1c 100755 --- a/conf/uncrustify-mode.el +++ b/conf/uncrustify-mode.el @@ -114,7 +114,7 @@ (message "uncrustify error: <%s> <%s>" ret (buffer-string))) nil)))))) - ;; This goto-line is outside the save-excursion becuase it'd get + ;; This goto-line is outside the save-excursion because it'd get ;; removed otherwise. I hate this bug. It makes things so ugly. (goto-line original-line) (not result))) diff --git a/conf/uncrustify_precommit b/conf/uncrustify_precommit index fd29998..2487333 100755 --- a/conf/uncrustify_precommit +++ b/conf/uncrustify_precommit @@ -30,6 +30,6 @@ if [ $RET = 1 ]; then echo "Run" echo "uncrustify --no-backup -c uncrustify.cfg ${crustified}" - echo "before commiting." + echo "before committing." fi exit $RET @@ -20,14 +20,29 @@ # This script checks if a suitable python3 executable is installed and then # executes the actual configure logic written in Python. -scriptpath=build-system/taler-build-scripts +build_system_dir=build-system -if ! test -d "$scriptpath"; then - echo "fatal error: taler-build-scripts not found at $scriptpath" >&2 +if ! test -d "$build_system_dir"; then + # Maybe this is not a top-level configure invocation + # For monorepos, try location from top-level + build_system_dir=../../build-system +fi + +if ! test -d "$build_system_dir"; then + echo "fatal error: build-system directory not found" >&2 + echo "hint: are you running this script from the right directory?" >&2 + exit 1 +fi + +scriptpath=$build_system_dir/taler-build-scripts +if ! test -d "$build_system_dir"; then + echo "fatal error: taler-build-scripts directory not found at $scriptpath" >&2 echo "hint: did you run './bootstrap'?" >&2 exit 1 fi +export TALERBUILDSYSTEMDIR=$build_system_dir + # Check that the python3 executable is on the PATH. # This follows PEP 394 (https://www.python.org/dev/peps/pep-0394/). if ! python3 --version >/dev/null 2>&1; then @@ -41,7 +56,5 @@ python3 "$scriptpath/pyvercheck.py" || exit $? # Allow Python to find libraries that are checked into the build system git. export PYTHONPATH="$scriptpath:${PYTHONPATH:-}" -export TALERBUILDSYSTEMDIR=./build-system - # Call configure.py, assuming all went well. python3 $TALERBUILDSYSTEMDIR/configure.py "$@" @@ -572,7 +572,7 @@ def match(spec, version): def validate(version_string): - """Validates a version string againt the SemVer specification.""" + """Validates a version string against the SemVer specification.""" try: Version.parse(version_string) return True diff --git a/talerbuildconfig.py b/talerbuildconfig.py index f6dba99..642bcbc 100644 --- a/talerbuildconfig.py +++ b/talerbuildconfig.py @@ -40,7 +40,7 @@ from pathlib import Path """ This module aims to replicate a small GNU Coding Standards -configure script, taylored at projects in GNU Taler. We hope it +configure script, tailored at projects in GNU Taler. We hope it can be of use outside of GNU Taler, hence it is dedicated to the public domain ('0BSD'). It takes a couple of arguments on the commandline equivalent to @@ -48,7 +48,7 @@ configure by autotools, in addition some environment variables xan take precedence over the switches. In the absence of switches, /usr/local is assumed as the PREFIX. When all data from tests are gathered, it generates a config.mk -Makefile fragement, which is the processed by a Makefile (usually) in +Makefile fragment, which is the processed by a Makefile (usually) in GNU Make format. """ @@ -79,6 +79,7 @@ class BuildConfig: self.args = None self.prefix_enabled = False self.configmk_enabled = False + self.configmk_dotfile = False def add_tool(self, tool): """Deprecated. Prefer the 'use' method.""" @@ -108,9 +109,10 @@ class BuildConfig: def _error(self, msg): print("Error", msg) - def enable_configmk(self): + def enable_configmk(self, dotfile=False): """If enabled, output the config.mk makefile fragment.""" self.configmk_enabled = True + self.configmk_dotfile = dotfile def run(self): parser = argparse.ArgumentParser() @@ -155,10 +157,15 @@ class BuildConfig: print(f"found {tool.name} as {path} (version {version})") if self.configmk_enabled: - d = Path(os.environ.get("TALERBUILDSYSTEMDIR", ".")) + if self.configmk_dotfile: + d = Path(".") + cf = d / ".config.mk" + else: + d = Path(os.environ.get("TALERBUILDSYSTEMDIR", ".")) + cf = d / "config.mk" d.mkdir(parents=True, exist_ok=True) - with open(d / "config.mk", "w") as f: - print("writing config.mk") + print(f"writing {cf}") + with open(cf, "w") as f: f.write("# this makefile fragment is autogenerated by configure.py\n") if self.prefix_enabled: f.write(f"prefix = {args.prefix}\n") @@ -330,17 +337,17 @@ class YapfTool(Tool): "3.8": "yapf3.8", "3.9": "yapf3.9", "4.0": "yapf4.0", - "4.1": "yapf-3.0", - "4.2": "yapf-3.1", - "4.3": "yapf-3.2", - "4.4": "yapf-3.3", - "4.5": "yapf-3.4", - "4.6": "yapf-3.5", - "4.7": "yapf-3.6", - "4.8": "yapf-3.7", - "4.9": "yapf-3.8", - "5.0": "yapf-3.9", - "5.1": "yapf-4.0", + "4.1": "yapf4.1", + "4.2": "yapf4.2", + "4.3": "yapf4.3", + "4.4": "yapf4.4", + "4.5": "yapf4.5", + "4.6": "yapf4.6", + "4.7": "yapf4.7", + "4.8": "yapf4.8", + "4.9": "yapf4.9", + "5.0": "yapf5.0", + "5.1": "yapf5.1", } for key, value in version_dict.items(): if existence(value): @@ -428,8 +435,14 @@ class PythonTool(Tool): # is checking pybabel + pybabel-3.[0-9]* too much and could # be broken down to pybabel + pybabel-3.7 and later names? version_dict = { + "3.7": "python3.7", "3.8": "python3.8", "3.9": "python3.9", + "3.10": "python3.10", + "3.11": "python3.11", + "3.12": "python3.12", + "3.13": "python3.13", + "3.14": "python3.14", } for key, value in version_dict.items(): if existence(value): @@ -480,7 +493,7 @@ class NodeJsTool(Tool): return False if ( subprocess.getstatusoutput( - "node -p 'process.exit(!(/v([0-9]+)/.exec(process.version)[1] >= 4))'" + "node -p 'process.exit((/v([0-9]+)/.exec(process.version)[1] >= 4) ? 0 : 5)'" )[1] != "" ): |