Skip to content

Commit

Permalink
Merge pull request #70 from dbt-msft/add_version_file2
Browse files Browse the repository at this point in the history
more sophisticated versioning (take 2)
  • Loading branch information
mikaelene authored Dec 18, 2020
2 parents 0df67bf + 0e3bcf1 commit 6833bcc
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
1 change: 1 addition & 0 deletions dbt/adapters/sqlserver/__version__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
version = '0.18.0b2'
35 changes: 33 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,42 @@
#!/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:
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,
Expand All @@ -26,4 +57,4 @@
]
},
install_requires=["dbt-core~=0.18.0", "pyodbc>=4.0.27", "azure-identity>=1.4.0"],
)
)

0 comments on commit 6833bcc

Please sign in to comment.