mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-25 01:41:43 +00:00
Fixes format.py on windows (#293)
This commit is contained in:
committed by
Peter Johnson
parent
1071686d81
commit
60e199b0bd
@@ -1,5 +1,4 @@
|
||||
#!/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
|
||||
@@ -12,17 +11,26 @@ 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)
|
||||
|
||||
# Run main format.py script
|
||||
args = ["python3", path + "/format.py"]
|
||||
args.extend(sys.argv[1:])
|
||||
proc = subprocess.Popen(args)
|
||||
sys.exit(proc.wait())
|
||||
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