@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / 0a74bfce9c
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 15, 18:30 UTC

setup.py: drop assumption about local `main` branch (#14692)

Signed-off-by: Russell Bryant <rbryant@redhat.com>

Russell Bryant committed Mar 17, 2025 at 04:37 UTC 0a74bfce9cb9e51616c50b007e53400244cbc24a
1 file changed +16 -14
setup.py
+16 -14
@@ -294,26 +294,28 @@ class repackage_wheel(build_ext):
294 ]).decode("utf-8")
295 upstream_main_commit = json.loads(resp_json)["sha"]
296
297 - # Check if the local main branch is up-to-date. This is to ensure
298 - # the base commit we found is the most recent commit on the main
299 - # branch.
300 - local_main_commit = subprocess.check_output(
301 - ["git", "rev-parse", "main"]).decode("utf-8").strip()
302 - if local_main_commit != upstream_main_commit:
303 - raise ValueError(
304 - f"Local main branch ({local_main_commit}) is not "
305 - "up-to-date with upstream main branch "
306 - f"({upstream_main_commit}). Please pull the latest "
307 - "changes from upstream main branch first.")
297 + # Check if the upstream_main_commit exists in the local repo
298 + try:
299 + subprocess.check_output(
300 + ["git", "cat-file", "-e", f"{upstream_main_commit}"])
301 + except subprocess.CalledProcessError:
302 + # If not present, fetch it from the remote repository.
303 + # Note that this does not update any local branches,
304 + # but ensures that this commit ref and its history are
305 + # available in our local repo.
306 + subprocess.check_call([
307 + "git", "fetch", "https://github.com/vllm-project/vllm",
308 + "main"
309 + ])
310
311 # Then get the commit hash of the current branch that is the same as
312 # the upstream main commit.
313 current_branch = subprocess.check_output(
314 ["git", "branch", "--show-current"]).decode("utf-8").strip()
315
314 - base_commit = subprocess.check_output(
315 - ["git", "merge-base", "main",
316 - current_branch]).decode("utf-8").strip()
316 + base_commit = subprocess.check_output([
317 + "git", "merge-base", f"{upstream_main_commit}", current_branch
318 + ]).decode("utf-8").strip()
319 return base_commit
320 except ValueError as err:
321 raise ValueError(err) from None