From 85526e5370e32a93b7086648ece12c3bd5269db8 Mon Sep 17 00:00:00 2001
From: Aldo Cortesi <aldo@corte.si>
Date: Sat, 16 Jun 2018 10:17:59 +1200
Subject: cibuild: Match Travis env variable behaviour

Whenever TRAVIS_TAG is non-empty, TRAVIS_BRANCH is over-ridden to match the
TRAVIS_TAG value. Adjust our tests to reflect this, and add a sanity check that
fails hard if this constraint is ever not met.

See https://github.com/travis-ci/travis-ci/issues/4745
---
 release/cibuild.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

(limited to 'release')

diff --git a/release/cibuild.py b/release/cibuild.py
index 734eaf39..76eb377e 100755
--- a/release/cibuild.py
+++ b/release/cibuild.py
@@ -63,6 +63,12 @@ class BuildEnviron:
 
         self.travis_tag = travis_tag
         self.travis_branch = travis_branch
+
+        if travis_tag and travis_tag != travis_branch:
+            raise ValueError(
+                f"Something is wrong - TRAVIS_TAG={travis_tag}, but TRAVIS_BRANCH={travis_branch}"
+            )
+
         self.travis_pull_request = travis_pull_request
 
         self.should_build_wheel = should_build_wheel
@@ -202,7 +208,7 @@ class BuildEnviron:
 
     @property
     def is_prod_release(self) -> bool:
-        if not self.tag:
+        if not (self.tag and self.tag.startswith("v")):
             return False
         try:
             v = parver.Version.parse(self.version, strict=True)
-- 
cgit v1.2.3