File: _common.py

package info (click to toggle)
azure-cli 2.81.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 2,328,780 kB
  • sloc: python: 1,901,859; sh: 1,341; makefile: 404; cs: 145; javascript: 74; sql: 37; xml: 21
file content (25 lines) | stat: -rw-r--r-- 762 bytes parent folder | download | duplicates (3)
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
#!/usr/bin/env python

# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

# common utilities for scripts

def get_repo_root():
    """
    Returns the root path to this repository. The root is where .git folder is.
    """
    import os.path
    here = os.path.dirname(os.path.realpath(__file__))

    while not os.path.exists(os.path.join(here, '.git')):
        here = os.path.dirname(here)

    return here


if __name__ == '__main__':
    print(get_repo_root())