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