Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warn about running build-locally on main #29462

Merged
merged 2 commits into from
Mar 21, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions build-locally.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,27 @@
# This file has been generated by conda-smithy in order to build the recipe
# locally.
#
import os
import glob
import os
import platform
import subprocess
import sys
from argparse import ArgumentParser
import platform
from subprocess import check_output

BUILD_LOCALLY_FILTER = os.environ.get("BUILD_LOCALLY_FILTER", "*")


def verify_system():
branch_name = check_output(["git", "rev-parse", "--abbrev-ref", "HEAD"], text=True).strip()
if branch_name == "main":
raise RuntimeError(
"You should run build-locally from a new branch, not 'main'. "
"Create a new one with:\n\n"
" git checkout -b your-chosen-branch-name\n"
)


def setup_environment(ns):
os.environ["CONFIG"] = ns.config
os.environ["UPLOAD_PACKAGES"] = "False"
Expand Down Expand Up @@ -98,6 +110,7 @@ def main(args=None):
)

ns = p.parse_args(args=args)
verify_system()
verify_config(ns)
setup_environment(ns)

Expand Down
Loading