def get_main_git_path():
"""Gets the remote URL of the setup repository.
Returns:
string: remote URL of the setup-repository.
"""
try:
repository_basepath = subprocess.check_output(
'git config --get remote.origin.url'.split(' '))
except subprocess.CalledProcessError as err:
setup_dir_path = os.path.dirname(os.path.realpath(__file__))
err_msg = '''
\'{}\' is not a git repository.
Did you download a .zip file from GitHub?
Use
\'git clone https://github.com/foxBMS/foxBMS-setup\'
to download the foxBMS-setup repository.
'''.format(setup_dir_path)
logging.error(err_msg)
sys.exit(1)
repository_basepath, repository_name = repository_basepath.rsplit('/', 1)
return repository_basepath, repository_name
评论列表
文章目录