File tree 2 files changed +23
-4
lines changed
2 files changed +23
-4
lines changed Original file line number Diff line number Diff line change 2
2
3
3
import sys
4
4
import os
5
+ import shlex
5
6
6
7
from natsort import natsorted
7
8
import envoy
32
33
33
34
BULLET_POINTS = "*-+=#~"
34
35
35
- PASS = " ✓ PASS"
36
+ if sys .stdout .encoding .lower ().startswith ('utf-' ):
37
+ PASS = " ✓ PASS"
38
+ FAIL = " ✗ FAIL"
39
+ else :
40
+ PASS = " / PASS"
41
+ FAIL = " x FAIL"
36
42
WARN = " ! WARN"
37
- FAIL = " ✗ FAIL"
38
-
39
43
40
44
def bullet (depth ):
41
45
return BULLET_POINTS [depth % len (BULLET_POINTS )]
@@ -56,6 +60,18 @@ def indent(text, depth):
56
60
padding = " " * (depth * 4 )
57
61
return padding + "\n {0}" .format (padding ).join (text .split ("\n " )).rstrip ()
58
62
63
+ def platform_command (path ):
64
+ if sys .platform .startswith ("win" ):
65
+ with open (path ) as file :
66
+ part = file .read (2 )
67
+ if part == "#!" :
68
+ shebang = shlex .split (file .readline ().strip ())
69
+ if shebang :
70
+ shebang .pop (0 )
71
+ path = path .replace ('\\ ' , '/' )
72
+ shebang .append (path )
73
+ return " " .join (shebang )
74
+ return path
59
75
60
76
if __name__ == "__main__" :
61
77
if colorama :
@@ -100,7 +116,7 @@ def indent(text, depth):
100
116
continue
101
117
path = os .path .join (subdir , filename )
102
118
file_depth = depth + 1
103
- result = envoy .run (path , timeout = 2 )
119
+ result = envoy .run (platform_command ( path ) , timeout = 2 )
104
120
out_depth = file_depth + 1
105
121
out = indent (result .std_out , out_depth ) if result .std_out else None
106
122
err = indent (result .std_err , out_depth ) if result .std_err else None
Original file line number Diff line number Diff line change @@ -6,8 +6,11 @@ if not exist ".git" (
6
6
7
7
for %%A in (pre-commit post-checkout post-merge) do (
8
8
mklink " %cd% \.git\hooks\%%A " " %~dp0 hooks\delegate.py"
9
+ mklink /J " %cd% \.git\hooks\%%A .d" " %~dp0 hooks\%%A .d"
9
10
)
10
11
12
+ mklink /J " %cd% \.git\hooks\helpers" " %~dp0 hooks\helpers"
13
+
11
14
if %errorlevel% == 0 (
12
15
echo Installed Unity hooks.
13
16
) else (
You can’t perform that action at this time.
0 commit comments