-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add submodule helper scripts, update readme
- Loading branch information
Showing
7 changed files
with
162 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/env bash | ||
|
||
git checkout "$@" && git submodule update |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,3 @@ install_data( | |
join_paths('gamecontrollerdb', 'gamecontrollerdb.txt'), | ||
install_dir : data_path | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/env bash | ||
|
||
git pull "$@" && git submodule update |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#!/usr/bin/env python3 | ||
|
||
from taiseilib.common import ( | ||
run_main, | ||
) | ||
|
||
import subprocess | ||
import pathlib | ||
import sys | ||
import re | ||
import os | ||
|
||
|
||
submodule_regex = re.compile('^.[0-9a-f]*? ([^ ]*)(?: .*?)?') | ||
|
||
|
||
def handle_no_git(): | ||
# TODO | ||
pass | ||
|
||
|
||
def main(args): | ||
try: | ||
p = subprocess.run(['git', 'submodule', 'status'], | ||
cwd=os.environ.get('MESON_SOURCE_ROOT', pathlib.Path(__file__).parent), | ||
capture_output=True, | ||
universal_newlines=True | ||
) | ||
except FileNotFoundError: | ||
return handle_no_git() | ||
|
||
if p.returncode != 0: | ||
if p.stderr.startswith('fatal: not a git repository'): | ||
return handle_no_git() | ||
|
||
print('Git error:', p.stderr.strip(), file=sys.stderr) | ||
exit(1) | ||
|
||
for module in p.stdout.rstrip('\n').split('\n'): | ||
status = module[0] | ||
|
||
if status != ' ': | ||
match = submodule_regex.match(module) | ||
|
||
try: | ||
path = match[1] | ||
except TypeError: | ||
print('Failed to parse submodule: {0}'.format(module)) | ||
continue | ||
|
||
if status == '+': | ||
print('Submodule `{0}` is not in sync with HEAD. Run `git submodule update` if this is not intended.'.format(path)) | ||
elif status == '-': | ||
print('Submodule `{0}` is not initialized. Run `git submodule update --init` if this is not intended.'.format(path)) | ||
elif status == 'U': | ||
print('Submodule `{0}` has unresolved conflicts.'.format(path)) | ||
else: | ||
print('Status of submodule `{0}` is unknown: {1}'.format(path, module)) | ||
|
||
|
||
if __name__ == '__main__': | ||
run_main(main) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters