From f08387ede1ec0b5e201b96b59869a4640e453b2c Mon Sep 17 00:00:00 2001 From: Dan Lee <71398022+dandhlee@users.noreply.github.com> Date: Fri, 16 Apr 2021 17:29:15 -0400 Subject: [PATCH] chore: prevent normalization of semver versioning (#17) * chore: prevent normalization of semver versioning * chore: update workaround to make sic work --- packages/google-cloud-audit-log/setup.py | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/packages/google-cloud-audit-log/setup.py b/packages/google-cloud-audit-log/setup.py index 5ebafb9de80c..c0c72f70ab0d 100644 --- a/packages/google-cloud-audit-log/setup.py +++ b/packages/google-cloud-audit-log/setup.py @@ -16,7 +16,21 @@ import os import setuptools -from setuptools import setup, find_packages + +# 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 name = "google-cloud-audit-log" description = "Google Cloud Audit Protos" @@ -33,7 +47,7 @@ setuptools.setup( name=name, - version=version, + version=sic(version), author="Google LLC", author_email="googleapis-packages@google.com", classifiers=[ @@ -53,7 +67,7 @@ long_description_content_type="text/markdown", install_requires=dependencies, license="Apache-2.0", - packages=find_packages(), + packages=setuptools.find_packages(), package_data={"": ["*.proto"]}, python_requires=">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*", namespace_packages=["google", "google.cloud"],