From f9ffcd0fd3168f81ae0d05f553e776327e1f4ac0 Mon Sep 17 00:00:00 2001 From: Dan Lee <71398022+dandhlee@users.noreply.github.com> Date: Fri, 16 Apr 2021 17:18:49 -0400 Subject: [PATCH] chore: prevent normalization of semver versioning (#22) * chore: prevent normalization of semver versioning * chore: update workaround to make sic work --- .../google-cloud-binary-authorization/setup.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/packages/google-cloud-binary-authorization/setup.py b/packages/google-cloud-binary-authorization/setup.py index 467910abc265..4bde8f594302 100644 --- a/packages/google-cloud-binary-authorization/setup.py +++ b/packages/google-cloud-binary-authorization/setup.py @@ -20,6 +20,21 @@ import setuptools # type: ignore +# Disable version normalization performed by setuptools.setup() +try: + # Try the approach of using sic(), added in setuptools 46.1.0 + from setuptools import sic +except ImportError: + # Try the approach of replacing packaging.version.Version + sic = lambda v: v + try: + # setuptools >=39.0.0 uses packaging from setuptools.extern + from setuptools.extern import packaging + except ImportError: + # setuptools <39.0.0 uses packaging from pkg_resources.extern + from pkg_resources.extern import packaging + packaging.version.Version = packaging.version.LegacyVersion + version = "0.1.1" package_root = os.path.abspath(os.path.dirname(__file__)) @@ -31,7 +46,7 @@ setuptools.setup( name="google-cloud-binary-authorization", - version=version, + version=sic(version), long_description=readme, author="Google LLC", author_email="googleapis-packages@google.com",