forked from flutter/engine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
executable file
·43 lines (34 loc) · 888 Bytes
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/env python3
# Copyright 2013 The Flutter Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
'''
Sets up githooks.
'''
import os
import subprocess
import sys
SRC_ROOT = os.path.dirname(
os.path.dirname(
os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
)
)
FLUTTER_DIR = os.path.join(SRC_ROOT, 'flutter')
def IsWindows():
os_id = sys.platform
return os_id.startswith('win32') or os_id.startswith('cygwin')
def Main(argv):
git = 'git'
githooks = os.path.join(FLUTTER_DIR, 'tools', 'githooks')
if IsWindows():
git = 'git.bat'
result = subprocess.run([
git,
'config',
'core.hooksPath',
githooks,
],
cwd=FLUTTER_DIR)
return result.returncode
if __name__ == '__main__':
sys.exit(Main(sys.argv))