diff --git a/collection-ionic.yaml b/collection-ionic.yaml deleted file mode 100644 index cffae24..0000000 --- a/collection-ionic.yaml +++ /dev/null @@ -1,66 +0,0 @@ ---- -repositories: - gz-cmake: - type: git - url: https://github.com/gazebosim/gz-cmake - version: main - gz-common: - type: git - url: https://github.com/gazebosim/gz-common - version: main - gz-fuel-tools: - type: git - url: https://github.com/gazebosim/gz-fuel-tools - version: main - gz-sim: - type: git - url: https://github.com/gazebosim/gz-sim - version: main - gz-gui: - type: git - url: https://github.com/gazebosim/gz-gui - version: main - gz-launch: - type: git - url: https://github.com/gazebosim/gz-launch - version: main - gz-math: - type: git - url: https://github.com/gazebosim/gz-math - version: main - gz-msgs: - type: git - url: https://github.com/gazebosim/gz-msgs - version: main - gz-physics: - type: git - url: https://github.com/gazebosim/gz-physics - version: main - gz-plugin: - type: git - url: https://github.com/gazebosim/gz-plugin - version: main - gz-rendering: - type: git - url: https://github.com/gazebosim/gz-rendering - version: mjcarroll/pixi_gl - gz-sensors: - type: git - url: https://github.com/gazebosim/gz-sensors - version: main - gz-tools: - type: git - url: https://github.com/gazebosim/gz-tools - version: gz-tools2 - gz-transport: - type: git - url: https://github.com/gazebosim/gz-transport - version: main - gz-utils: - type: git - url: https://github.com/gazebosim/gz-utils - version: main - sdformat: - type: git - url: https://github.com/gazebosim/sdformat - version: main diff --git a/gazebo.toml b/gazebo.toml deleted file mode 100644 index d167336..0000000 --- a/gazebo.toml +++ /dev/null @@ -1,4 +0,0 @@ -[gazebo] -distro = "ionic" -colcon_defaults = ".github/ci/colcon_defaults.yaml" -repos_file = "collection-ionic.yaml" diff --git a/helper.py b/helper.py index 1a1f9e1..befcbd2 100755 --- a/helper.py +++ b/helper.py @@ -24,62 +24,57 @@ import os import shutil import sys -import tomllib import urllib.request +WORKSPACE_NAME = 'gazebosim_ws' +COLCON_DEFAULTS_FILE = '.github/ci/colcon_defaults.yaml' +DEFAULT_COLLECTION = 'collection-ionic.yaml' def sync(args, rem_args): from vcstool.commands.vcs import main as vcs_main - workspace_name = f'{args.distro}_ws' - if args.repos_file: - repos_file = args.repos_file - else: - repos_file = f'{workspace_name}/gazebodistro.repos' - urllib.request.urlretrieve( - f'https://raw.githubusercontent.com/gazebo-tooling/gazebodistro/master/collection-{args.distro}.yaml', - repos_file) - - if not os.path.exists(f'{workspace_name}/src'): - os.makedirs(os.path.join(args.curdir, f'{workspace_name}/src')) - - argv = ['import', '--input', repos_file, *rem_args, f'{workspace_name}/src'] + + uri = f'https://raw.githubusercontent.com/gazebo-tooling/gazebodistro/master/{args.collection}' + if args.repos_uri: + uri = args.repos_uri + + if not os.path.exists(f'{args.workspace_name}/src'): + os.makedirs(os.path.join(args.curdir, f'{args.workspace_name}/src')) + + repos_file = f'{args.workspace_name}/workspace.repos' + print(f'Fetching: {uri}') + urllib.request.urlretrieve(uri, repos_file) + + argv = ['import', '--input', repos_file, *rem_args, f'{args.workspace_name}/src'] return vcs_main(argv) def colcon(args, rem_args): from colcon_core.command import main as colcon_main os.environ["COLCON_DEFAULTS_FILE"] = os.path.join(args.curdir, args.colcon_defaults) - os.chdir(os.path.join(args.curdir, f'{args.distro}_ws')) + os.chdir(os.path.join(args.curdir, f'{args.workspace_name}')) return colcon_main(argv=rem_args) def clean(args, rem_args): for subdir in ['build', 'install', 'log']: try: - shutil.rmtree(os.path.join(os.curdir, f'{args.distro}_ws/{subdir}')) + shutil.rmtree(os.path.join(os.curdir, f'{args.workspace_name}/{subdir}')) except Exception as ex: print(ex) if __name__ == "__main__": - # Read some configuration defaults from the toml file - with open('gazebo.toml', 'rb') as f: - data = tomllib.load(f) - defaults = data['gazebo'] - - if 'repos_file' not in defaults: - defaults['repos_file'] = None - parser = argparse.ArgumentParser( prog='Pixi Task Helper', description='Help with common pixi tasks') - parser.add_argument('--distro', type=str, default=defaults['distro']) - parser.add_argument('--colcon-defaults', type=str, default=defaults['colcon_defaults']) - parser.add_argument('--repos-file', type=str, default=defaults['repos_file']) + parser.add_argument('--workspace-name', type=str, default=WORKSPACE_NAME) + parser.add_argument('--colcon-defaults', type=str, default=COLCON_DEFAULTS_FILE) subparsers = parser.add_subparsers() sync_parser = subparsers.add_parser('sync') + sync_parser.add_argument('--collection', type=str, default=DEFAULT_COLLECTION) + sync_parser.add_argument('--repos-uri', type=str) sync_parser.set_defaults(func=sync) colcon_parser = subparsers.add_parser('colcon') @@ -89,5 +84,6 @@ def clean(args, rem_args): clean_parser.set_defaults(func=clean) args, rem_args = parser.parse_known_args() + args.curdir = os.path.abspath(os.path.curdir) sys.exit(args.func(args, rem_args))