You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This Python package uses Astyle compiled into WebAssembly ([astyle_py/libastyle.wasm](astyle_py/libastyle.wasm)). To rebuild libastyle.wasm, run `build.sh` in the `builder/` directory.
16
+
This Python package uses Astyle compiled into WebAssembly (astyle_py/lib/<VERSION>/libastyle.wasm). To build libastyle.wasm for a new Astyle version, run `build.sh <VERSION>` in the `build-scripts/3.3+` directory. For example, to build the library for Astyle 3.4.7:
17
17
18
-
Updating Astyle to a newer version might require tweaking the patch applied in [builder/build_inner.sh](builder/build_inner.sh).
18
+
```bash
19
+
cd build-scripts/3.3+
20
+
./build.sh 3.4.7
21
+
```
22
+
23
+
You need Docker installed to do the build.
24
+
25
+
A build script for the older Astyle 3.1 is also provided in `build-scripts/3.1`.
- "tests/" # matches a subdirectory 'tests' anywhere in the source tree
105
108
```
106
109
107
-
## Implementation notes
110
+
## Supported Astyle versions
111
+
112
+
This python wrapper bundles multiple copies of Astyle, you can choose which one to use:
113
+
- In the CLI: via `--astyle-version` argument
114
+
- If you are using a rules file: using `version` key
115
+
- When using astyle_py as a library: by passing the version to `Astyle()` constructor
116
+
117
+
The following versions are supported:
108
118
119
+
- 3.1 — used by default, unless a different version is specified
120
+
- 3.4.7
121
+
122
+
## Implementation notes
109
123
110
124
To simplify distribution of astyle, it is compiled to WebAssembly ([astyle_py/libastyle.wasm](astyle_py/libastyle.wasm)) and executed using [wasmtime runtime](https://github.com/bytecodealliance/wasmtime) via its [Python bindings](https://github.com/bytecodealliance/wasmtime-py). This package should work on all operating systems supported by wasmtime — at the time of writing these are:
111
125
- x86_64 (amd64) Windows, Linux, macOS
112
126
- aarch64 (arm64) Linux and macOS
113
127
114
-
There is another project which wraps astyle into a Python package, without using WebAssembly: https://github.com/timonwong/pyastyle. At the time of writing, it is unmaintained.
128
+
Other project which wraps astyle into a Python package include:
129
+
- https://github.com/timonwong/pyastyle — unmaintained at the time of writing, uses native Astyle binaries
@@ -120,4 +136,6 @@ Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details.
120
136
## Copyright and License
121
137
122
138
* The source code in this repository is Copyright (c) 2020-2022 Ivan Grokhotkov and licensed under the [MIT license](LICENSE).
123
-
* `libastyle.wasm` binary bundled herein is built from Artistic Style project, Copyright (c) 2018 by Jim Pattee <[email protected]>, also licensed under the MIT license. See http://astyle.sourceforge.net/ for details.
139
+
* `libastyle.wasm` binaries bundled under [astyle_py/lib](astyle_py/lib) directory are built from [Artistic Style project](https://gitlab.com/saalen/astyle), Copyright (c) 2018 by Jim Pattee <[email protected]>, also licensed under the MIT license. See http://astyle.sourceforge.net/ for details.
140
+
141
+
Thanks to André Simon for maintaining Astyle project!
This should build the docker image with Emscripten SDK, download Astyle and build it with Emscripten. The resulting library will be copied to `astyle_py/lib/3.1/libastyle.wasm`.
where `<version>` is the version of Astyle you want to build. For example, `3.4.7`.
10
+
11
+
The script will build a Docker image with Emscripten SDK, download the required version of Astyle and build it with Emscripten. Since Astyle >=3.3 has a CMake build system, everything is conveniently handled in CMakeLists.txt.
12
+
13
+
The resulting library will be copied to `astyle_py/lib/<version>/libastyle.wasm`.
0 commit comments