mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-26 01:51:41 +00:00
Removed format.py shim (#393)
Now that our formatter is a Python package (wpiformat), the format.py shim for invoking it is no longer necessary. styleguide#29 should be merged before this patch.
This commit is contained in:
committed by
Fred Silberberg
parent
0ee4cadca0
commit
d0900626da
@@ -8,7 +8,8 @@ before_install:
|
||||
- sudo add-apt-repository ppa:wpilib/toolchain -y
|
||||
- sudo apt-get update -q || true
|
||||
- sudo apt-get install frc-toolchain libgazebo7-dev protobuf-compiler libprotobuf-dev python3 clang-format-3.8 -y
|
||||
|
||||
install:
|
||||
- pip3 install wpiformat
|
||||
|
||||
before_cache:
|
||||
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
|
||||
@@ -17,10 +18,7 @@ cache:
|
||||
- $HOME/.gradle/caches/
|
||||
- $HOME/.gradle/wrapper/
|
||||
|
||||
before_script:
|
||||
- git clone git://github.com/wpilibsuite/styleguide $HOME/styleguide
|
||||
|
||||
script:
|
||||
- WPI_FORMAT=$HOME/styleguide python3 styleguide/format.py
|
||||
- wpiformat
|
||||
- git --no-pager diff --exit-code HEAD # Ensure formatter made no changes
|
||||
- ./gradlew build -PmakeSim
|
||||
|
||||
@@ -37,7 +37,7 @@ So you want to contribute your changes back to WPILib. Great! We have a few cont
|
||||
|
||||
## Coding Guidelines
|
||||
|
||||
WPILib uses modified Google style guides for both C++ and Java, which can be found in the [styleguide repository](https://github.com/wpilibsuite/styleguide). Autoformatters are available for many popular editors at https://github.com/google/styleguide. Running format.py, which is in the styleguide directory, is required for all contributions and is enforced by our continuous integration system.
|
||||
WPILib uses modified Google style guides for both C++ and Java, which can be found in the [styleguide repository](https://github.com/wpilibsuite/styleguide). Autoformatters are available for many popular editors at https://github.com/google/styleguide. Running wpiformat is required for all contributions and is enforced by our continuous integration system.
|
||||
|
||||
While the library should be fully formatted according to the styles, additional elements of the style guide were not followed when the library was initially created. All new code should follow the guidelines. If you are looking for some easy ramp-up tasks, finding areas that don't follow the style guide and fixing them is very welcome.
|
||||
|
||||
|
||||
@@ -25,13 +25,13 @@ Using Gradle makes building WPILib very straightforward. It only has a few depen
|
||||
|
||||
- [ARM Compiler Toolchain](http://first.wpi.edu/FRC/roborio/toolchains/)
|
||||
- Doxygen (Only required if you want to build the C++ documentation)
|
||||
- [format.py](https://github.com/wpilibsuite/styleguide)
|
||||
- [wpiformat](https://github.com/wpilibsuite/styleguide)
|
||||
|
||||
## Setup
|
||||
|
||||
Clone the WPILib repository. If the toolchains are not installed, install them, and make sure they are available on the system PATH.
|
||||
|
||||
See the [styleguide README](https://github.com/wpilibsuite/styleguide/blob/master/README.md) for format.py setup instructions.
|
||||
See the [styleguide README](https://github.com/wpilibsuite/styleguide/blob/master/README.md) for wpiformat setup instructions.
|
||||
|
||||
## Building
|
||||
|
||||
@@ -67,7 +67,7 @@ The gradlew wrapper only exists in the root of the main project, so be sure to r
|
||||
|
||||
There are a few tasks other than `build` available. To see them, run the meta-task `tasks`. This will print a list of all available tasks, with a description of each task.
|
||||
|
||||
format.py can be executed in either the styleguide or root directories of the repository via `python3 format.py` or `./format.py`.
|
||||
wpiformat can be executed anywhere in the repository via `py -3 -m wpiformat` on Windows or `python3 -m wpiformat` on other platforms.
|
||||
|
||||
## Publishing
|
||||
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
"""This script invokes format.py in the wpilibsuite/styleguide repository.
|
||||
|
||||
Set the WPI_FORMAT environment variable to its location on disk before use. For
|
||||
example:
|
||||
|
||||
WPI_FORMAT="$HOME/styleguide" ./format.py
|
||||
"""
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
|
||||
def main():
|
||||
path = os.environ.get("WPI_FORMAT")
|
||||
if path == None:
|
||||
print("Error: WPI_FORMAT environment variable not set")
|
||||
sys.exit(1)
|
||||
|
||||
try:
|
||||
# Run main format.py script
|
||||
args = ["python3", path + "/format.py"]
|
||||
args.extend(sys.argv[1:])
|
||||
proc = subprocess.Popen(args)
|
||||
sys.exit(proc.wait())
|
||||
except FileNotFoundError:
|
||||
# Run main format.py script on windows
|
||||
args = ["py", "-3", path + "/format.py"]
|
||||
args.extend(sys.argv[1:])
|
||||
proc = subprocess.Popen(args)
|
||||
sys.exit(proc.wait())
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user