Skip to content

Commit

Permalink
Fix format script (#918)
Browse files Browse the repository at this point in the history
* remove version check for `pipx`

Does not appear needed. `pkg_resources` is removed in Python 3.12

* add `MONGOCRYPT_PYTHON` to use a specified python install

* add a CONTRIBUTING.md
  • Loading branch information
kevinAlbs authored Dec 4, 2024
1 parent 588f33a commit aa0397a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions .evergreen/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ run_ctest() {

run_python() {
pys=(
"${MONGOCRYPT_PYTHON:-}"
py
python3.14
python3.13
Expand Down
14 changes: 14 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Formatting

To format, install `pipx` and run:
```bash
./etc/format-all.sh
```

To use a specified python install, set `MONGOCRYPT_PYTHON`:

```bash
# Set MONGOCRYPT_PYTHON to a python install with pipx installed.
export MONGOCRYPT_PYTHON=python
./etc/format-all.sh
```
2 changes: 0 additions & 2 deletions etc/format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ if ! run_python -c ''; then
fail "No Python found?"
fi

# Check that we have a pipx of the proper version:
run_python -c 'import pkg_resources; pkg_resources.require("pipx>=0.17.0,<2.0")'

# Give default clang-format an empty string on stdin if there are no inputs files
printf '' | run_python -m pipx run "clang-format==${CLANG_FORMAT_VERSION:?}" "$@"

0 comments on commit aa0397a

Please sign in to comment.