File: format

package info (click to toggle)
libpqxx 7.10.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,184 kB
  • sloc: cpp: 14,681; sh: 4,859; python: 801; makefile: 244
file content (21 lines) | stat: -rwxr-xr-x 578 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#! /bin/bash
#
# Reformat source code using clang-format.
#
# This script is not portable: as of Ubuntu 21.04, virtualenv's "activate"
# seems to rely on a non-POSIX variable, $OSTYPE.

set -C -u -e

# Reformat C++ files.
find . -name '*.[ch]xx' -print0 | xargs -0 clang-format -i


# Reformat CMake files.
WORKDIR=$(mktemp -d)
virtualenv -q --python="$(which python3)" "$WORKDIR/venv"
# shellcheck disable=SC1091
source "$WORKDIR"/venv/bin/activate
pip install -q six pyaml cmake-format
(find . -name '*.cmake' -print0 | xargs -0 -n1 cmake-format -i) || true
rm -rf "$WORKDIR"