File tree Expand file tree Collapse file tree
packages/django-google-spanner Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2727from .functions import register_functions
2828from .lookups import register_lookups
2929from .utils import check_django_compatability
30+ from .version import __version__
3031
3132# Monkey-patch google.DatetimeWithNanoseconds's __eq__ compare against
3233# datetime.datetime.
4748)
4849from django .db .models import JSONField
4950
50- __version__ = pkg_resources .get_distribution ("django-google-spanner" ).version
51-
5251USE_EMULATOR = os .getenv ("SPANNER_EMULATOR_HOST" ) is not None
5352
5453# Only active LTS django versions (3.2.*, 4.2.*) are supported by this library right now.
File renamed without changes.
Original file line number Diff line number Diff line change 66
77import io
88import os
9+ import re
910
1011from setuptools import find_packages , setup
1112
2728}
2829
2930BASE_DIR = os .path .dirname (__file__ )
30- VERSION_FILENAME = os .path .join (BASE_DIR , "version.py" )
31- PACKAGE_INFO = {}
32- with open (VERSION_FILENAME ) as f :
33- exec (f .read (), PACKAGE_INFO )
34- version = PACKAGE_INFO ["__version__" ]
35-
36- # Setup boilerplate below this line.
3731
3832package_root = os .path .abspath (BASE_DIR )
3933
34+ version = None
35+
36+ with open (os .path .join (package_root , "django_spanner/version.py" )) as fp :
37+ version_candidates = re .findall (r"(?<=\")\d+.\d+.\d+(?=\")" , fp .read ())
38+ assert len (version_candidates ) == 1
39+ version = version_candidates [0 ]
40+
41+ # Setup boilerplate below this line.
42+
4043readme_filename = os .path .join (package_root , "README.rst" )
4144with io .open (readme_filename , encoding = "utf-8" ) as readme_file :
4245 readme = readme_file .read ()
You can’t perform that action at this time.
0 commit comments