diff --git a/setup.py b/setup.py index 16af1e8..5255685 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ from setuptools import setup, find_namespace_packages import os -VERSION = '0.2.2' +VERSION = '0.3.0' print("TEST_VERSION:", os.getenv('TEST_VERSION')) if os.getenv('GHA_TEST_VERSION'): diff --git a/src/barbarians/barbarian.py b/src/barbarians/barbarian.py index 6ea86f9..a8bd304 100644 --- a/src/barbarians/barbarian.py +++ b/src/barbarians/barbarian.py @@ -26,6 +26,16 @@ def __init__(self, reason): class Barbarian(object): def __init__(self): ap = ArgumentParser("barbarian") + + # General options.. + ap.add_argument( + "--remote", + help="The remote Barbarian repo to use specified as `@." + + " Defaults to `https://barbarian.bfgroup.xyz/github@barbarian-github`.", + default="https://barbarian.bfgroup.xyz/github@barbarian-github" + ) + + # Sub-commands.. ap_sub = ap.add_subparsers(dest="command") # Export command.. @@ -89,6 +99,10 @@ def __init__(self): self.args = ap.parse_args() + # Synthesize some info from general arguments.. + self.args.remote_url = self.args.remote.split('@')[0] + self.args.remote_name = self.args.remote.split('@')[1] + if self.args.command: if hasattr(self, "command_"+self.args.command): try: @@ -321,8 +335,8 @@ def conan_api(self): os.path.join(hooks_dir_dst, name)) # Add the Barbarian remote so we can find dependencies. self.conan_api.remote_add( - "barbarian-github", - "https://barbarian.bfgroup.xyz/github", + self.args.remote_name, + self.args.remote_url, force=True) return self._conan_api @@ -392,6 +406,10 @@ def render_template(self, template, path): "<<>>", self._recipe_name_and_version[1]) text = text.replace( "<<>>", self.bpt_package_reference) + text = text.replace( + "<<>>", self.args.remote_url) + text = text.replace( + "<<>>", self.args.remote_name) with open(path, "w") as file: file.write(text) @@ -507,7 +525,7 @@ def command_upload(self, args): conan_export_tgz = self.conan_api.get_path( recipe_ref, path="conan_export.tgz", - remote_name="barbarian-github") + remote_name=self.args.remote_name) finally: # Clean up the upload tree. chdir(cwd) @@ -597,7 +615,7 @@ def command_new(self, args): ga_conan_workflow_template = '''\ env: - CONAN_REMOTES: "https://barbarian.bfgroup.xyz/github@True@barbarian-github" + CONAN_REMOTES: "<<>>@True@<<>>" CONAN_BUILD_POLICY: "missing" BPT_NO_UPLOAD: yes BPT_CONFIG_FILE_VERSION: "11"