aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--release/README.md1
-rwxr-xr-xrelease/cibuild.py9
-rw-r--r--setup.py1
-rw-r--r--test/release/test_cibuild.py4
4 files changed, 13 insertions, 2 deletions
diff --git a/release/README.md b/release/README.md
index f07357f9..d817ee18 100644
--- a/release/README.md
+++ b/release/README.md
@@ -41,7 +41,6 @@ release for! The command examples assume that you have a git remote called
- Please check https://hub.docker.com/r/mitmproxy/mitmproxy/tags/ about the latest version
- Update `latest` tag: TODO write instructions
-
## Website
- Update version here:
https://github.com/mitmproxy/www/blob/master/src/config.toml
diff --git a/release/cibuild.py b/release/cibuild.py
index 8ff6f9b6..2e543f1d 100755
--- a/release/cibuild.py
+++ b/release/cibuild.py
@@ -13,6 +13,7 @@ import zipfile
import click
import cryptography.fernet
+import parver
@contextlib.contextmanager
@@ -181,6 +182,14 @@ class BuildEnviron:
return self.docker_username and self.docker_password
@property
+ def is_prod_release(self) -> bool:
+ try:
+ v = parver.Version.parse(self.version)
+ except (parver.ParseError, BuildError):
+ return False
+ return not v.is_prerelease
+
+ @property
def is_pull_request(self) -> bool:
if self.appveyor_pull_request_number:
return True
diff --git a/setup.py b/setup.py
index 7300edd1..852de64c 100644
--- a/setup.py
+++ b/setup.py
@@ -89,6 +89,7 @@ setup(
"flake8>=3.5, <3.6",
"Flask>=1.0,<1.1",
"mypy>=0.590,<0.591",
+ "parver>=0.1<2.0",
"pytest-asyncio>=0.8",
"pytest-cov>=2.5.1,<3",
"pytest-faulthandler>=1.3.1,<2",
diff --git a/test/release/test_cibuild.py b/test/release/test_cibuild.py
index 71395c6d..596300aa 100644
--- a/test/release/test_cibuild.py
+++ b/test/release/test_cibuild.py
@@ -58,6 +58,7 @@ def test_buildenviron_pr():
appveyor_pull_request_number = "xxxx",
)
assert be.is_pull_request
+ assert not be.is_prod_release
def test_buildenviron_commit():
@@ -77,6 +78,7 @@ def test_buildenviron_commit():
assert be.should_upload_docker
assert not be.should_upload_pypi
assert be.should_upload_docker
+ assert not be.is_prod_release
def test_buildenviron_rleasetag():
@@ -102,7 +104,7 @@ def test_buildenviron_rleasetag():
assert be.docker_tag == "0.0.1"
assert be.should_upload_pypi
assert be.should_upload_docker
-
+ assert be.is_prod_release
def test_buildenviron_branch():
# Simulates a development branch on the main repo