mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-24 13:54:57 +00:00
The module entry point `run = run_cmd` shadowed the imported subprocess helper `run` from cli.helpers, causing TypeError on dispatch. Import as `run_proc` and use a proper wrapper function for the module entry point. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
58 lines
2.7 KiB
Python
58 lines
2.7 KiB
Python
"""Build testcontainers Conan packages (C shared library + Go sidecar) and upload to Nexus."""
|
|
|
|
import argparse
|
|
import os
|
|
import shutil
|
|
from cli.helpers import PROJECT_ROOT, log_err, log_info, log_ok, run as run_proc, run_check
|
|
|
|
|
|
def run_cmd(args: argparse.Namespace, config: dict) -> int:
|
|
nexus_url = os.environ.get("NEXUS_URL", "http://localhost:8091/repository/conan-hosted/")
|
|
nexus_user = os.environ.get("NEXUS_USER", "admin")
|
|
nexus_pass = os.environ.get("NEXUS_PASS", "nexus")
|
|
recipes_dir = PROJECT_ROOT / "dbal" / "production" / "build-config" / "conan-recipes"
|
|
|
|
log_info("Checking prerequisites...")
|
|
for tool, install_msg in [("go", "https://go.dev/dl/"), ("conan", "pip install conan")]:
|
|
if not shutil.which(tool):
|
|
log_err(f"{tool} not found. Install: {install_msg}")
|
|
return 1
|
|
run_proc([tool, "version" if tool == "go" else "--version"])
|
|
|
|
log_info("Configuring Nexus Conan remote...")
|
|
run_proc(["conan", "remote", "add", "nexus", nexus_url, "--force"])
|
|
run_check(["conan", "remote", "login", "nexus", nexus_user, "--password", nexus_pass])
|
|
run_proc(["conan", "remote", "disable", "conancenter"])
|
|
run_proc(["conan", "remote", "enable", "conancenter"])
|
|
run_proc(["conan", "remote", "update", "nexus", "--index", "0"])
|
|
|
|
if not args.skip_native:
|
|
log_info("Building testcontainers-native/0.1.0 (C shared library)...")
|
|
run_check(["conan", "create", str(recipes_dir / "testcontainers-native"),
|
|
"-s", "build_type=Release", "-s", "compiler.cppstd=20", "--build=missing"])
|
|
log_info("Uploading testcontainers-native to Nexus...")
|
|
run_check(["conan", "upload", "testcontainers-native/0.1.0", "--remote", "nexus", "--confirm"])
|
|
log_ok("testcontainers-native uploaded")
|
|
else:
|
|
log_info("Skipping testcontainers-native (--skip-native)")
|
|
|
|
if not args.skip_sidecar:
|
|
sidecar_src = PROJECT_ROOT / "dbal" / "testcontainers-sidecar"
|
|
log_info("Building testcontainers-sidecar/0.1.0 (Go binary)...")
|
|
env = os.environ.copy()
|
|
env["TESTCONTAINERS_SIDECAR_SRC"] = str(sidecar_src)
|
|
run_check(["conan", "create", str(recipes_dir / "testcontainers-sidecar"),
|
|
"-s", "build_type=Release", "-s", "compiler.cppstd=20", "--build=missing"], env=env)
|
|
log_info("Uploading testcontainers-sidecar to Nexus...")
|
|
run_check(["conan", "upload", "testcontainers-sidecar/0.1.0", "--remote", "nexus", "--confirm"])
|
|
log_ok("testcontainers-sidecar uploaded")
|
|
else:
|
|
log_info("Skipping testcontainers-sidecar (--skip-sidecar)")
|
|
|
|
log_ok("Testcontainers build complete")
|
|
return 0
|
|
|
|
|
|
def run(args, config):
|
|
return run_cmd(args, config)
|