Skip to content

Commit

Permalink
fix breakage from 10d032e: don't parse version strings at all; let se…
Browse files Browse the repository at this point in the history
…tuptools complain instead
  • Loading branch information
codeforkjeff committed Feb 1, 2023
1 parent 1d15a76 commit d5004da
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,18 @@
this_directory = os.path.abspath(os.path.dirname(__file__))

# get this package's version from dbt/adapters/<name>/__version__.py
def _get_plugin_version_dict():
def _get_plugin_version():
_version_path = os.path.join(
this_directory, 'dbt', 'adapters', 'sqlite', '__version__.py'
)
_semver = r'''(?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)'''

_semver = r"""(?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)"""
_pre = r"""((?P<prekind>a|b|rc)(?P<pre>\d+))?"""
_version_pattern = fr"""version\s*=\s*["']{_semver}{_pre}["']"""

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.groupdict()


def _get_plugin_version():
parts = _get_plugin_version_dict()
return "{major}.{minor}.{patch}{prekind}{pre}".format(**parts)
line = f.read().strip()
delim = '"' if '"' in line else "'"
return line.split(delim)[1]


package_name = "dbt-sqlite"
Expand Down

0 comments on commit d5004da

Please sign in to comment.