Skip to content

Commit

Permalink
Move version info around, clean up some bumpversion stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacob Beck committed Mar 27, 2020
1 parent a2dfc67 commit 090a99a
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 8 deletions.
23 changes: 23 additions & 0 deletions .bumpversion-dbt.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[bumpversion]
current_version = 0.16.0
parse = (?P<major>\d+)
\.(?P<minor>\d+)
\.(?P<patch>\d+)
((?P<prerelease>[a-z]+)(?P<num>\d+))?
serialize =
{major}.{minor}.{patch}{prerelease}{num}
{major}.{minor}.{patch}
commit = False
tag = False

[bumpversion:part:prerelease]
first_value = a
values =
a
b
rc

[bumpversion:part:num]
first_value = 1

[bumpversion:file:setup.py]
11 changes: 8 additions & 3 deletions .bumpversion.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,27 @@ current_version = 0.16.0a1
parse = (?P<major>\d+)
\.(?P<minor>\d+)
\.(?P<patch>\d+)
(\.(?P<pluginpatch>\d+))?
((?P<prerelease>[a-z]+)(?P<num>\d+))?
serialize =
serialize =
{major}.{minor}.{patch}.{pluginpatch}{prerelease}{num}
{major}.{minor}.{patch}{prerelease}{num}
{major}.{minor}.{patch}.{pluginpatch}
{major}.{minor}.{patch}
commit = False
tag = False

[bumpversion:part:prerelease]
first_value = a
values =
values =
a
b
rc

[bumpversion:part:num]
first_value = 1

[bumpversion:file:setup.py]
[bumpversion:part:pluginpatch]
first_value = 1

[bumpversion:file:dbt/adapters/spark/__version__.py]
1 change: 1 addition & 0 deletions dbt/adapters/spark/__version__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
version = "0.16.0a1"
24 changes: 19 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env python
from setuptools import find_packages, setup
import os
import re


this_directory = os.path.abspath(os.path.dirname(__file__))
Expand All @@ -9,18 +10,31 @@


package_name = "dbt-spark"
package_version = "0.16.0a1"


# get this from a separate file
def _dbt_spark_version():
_version_path = os.path.join(
this_directory, 'dbt', 'adapters', 'spark', '__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_spark_version()
description = """The SparkSQL plugin for dbt (data build tool)"""

# evade bumpversion with this fun trick
DBT_VERSION = (0, 16, 0)
dbt_version = '.'.join(map(str, DBT_VERSION))
dbt_version = '0.16.0'
# the package version should be the dbt version, with maybe some things on the
# ends of it. (0.16.0 vs 0.16.0a1, 0.16.0.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} (from {DBT_VERSION})'
f'dbt_version={dbt_version}'
)


Expand Down

0 comments on commit 090a99a

Please sign in to comment.