From d39663dda6c1ef2a07077b53fb7a40a792b2cf18 Mon Sep 17 00:00:00 2001 From: Anders Swanson Date: Thu, 17 Dec 2020 01:37:04 -0800 Subject: [PATCH 1/2] more sophisticated versioning --- dbt/adapters/sqlserver/__version__.py | 1 + setup.py | 34 +++++++++++++++++++++++++-- 2 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 dbt/adapters/sqlserver/__version__.py diff --git a/dbt/adapters/sqlserver/__version__.py b/dbt/adapters/sqlserver/__version__.py new file mode 100644 index 00000000..86860fd6 --- /dev/null +++ b/dbt/adapters/sqlserver/__version__.py @@ -0,0 +1 @@ +version = '0.18.0b2' \ No newline at end of file diff --git a/setup.py b/setup.py index d5f07488..bcc6ac6e 100644 --- a/setup.py +++ b/setup.py @@ -2,10 +2,40 @@ from setuptools import find_packages from distutils.core import setup + +this_directory = os.path.abspath(os.path.dirname(__file__)) +with open(os.path.join(this_directory, 'README.md')) as f: + long_description = f.read() + + package_name = "dbt-sqlserver" -package_version = "0.18.1" + + +# get this from a separate file +def _dbt_sqlserver_version(): + _version_path = os.path.join( + this_directory, 'dbt', 'adapters', 'sqlserver', '__version__.py' + ) + _version_pattern = r'''version\s*=\s*["'](.+)["']''' + with open(_version_path) as f: + match = re.search(_version_pattern, f.read().strip()) + if match is None: + raise ValueError(f'invalid version at {_version_path}') + return match.group(1) + + +package_version = _dbt_sqlserver_version() description = """A sqlserver adapter plugin for dbt (data build tool)""" +dbt_version = '0.18.0' +# the package version should be the dbt version, with maybe some things on the +# ends of it. (0.18.1 vs 0.18.1a1, 0.18.1.1, ...) +if not package_version.startswith(dbt_version): + raise ValueError( + f'Invalid setup.py: package_version={package_version} must start with ' + f'dbt_version={dbt_version}' + ) + setup( name=package_name, version=package_version, @@ -26,4 +56,4 @@ ] }, install_requires=["dbt-core~=0.18.0", "pyodbc>=4.0.27", "azure-identity>=1.4.0"], -) +) \ No newline at end of file From 0e3bcf15cc000b15d204ed84e752a51e61b40684 Mon Sep 17 00:00:00 2001 From: Anders Swanson Date: Thu, 17 Dec 2020 10:14:49 -0800 Subject: [PATCH 2/2] forgot to copy critical imports --- setup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index bcc6ac6e..7bd668b5 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,8 @@ #!/usr/bin/env python from setuptools import find_packages from distutils.core import setup - +import os +import re this_directory = os.path.abspath(os.path.dirname(__file__)) with open(os.path.join(this_directory, 'README.md')) as f: