File tree Expand file tree Collapse file tree 3 files changed +11
-9
lines changed Expand file tree Collapse file tree 3 files changed +11
-9
lines changed Original file line number Diff line number Diff line change 27
27
from .functions import register_functions
28
28
from .lookups import register_lookups
29
29
from .utils import check_django_compatability
30
+ from .version import __version__
30
31
31
32
# Monkey-patch google.DatetimeWithNanoseconds's __eq__ compare against
32
33
# datetime.datetime.
47
48
)
48
49
from django .db .models import JSONField
49
50
50
- __version__ = pkg_resources .get_distribution ("django-google-spanner" ).version
51
-
52
51
USE_EMULATOR = os .getenv ("SPANNER_EMULATOR_HOST" ) is not None
53
52
54
53
# 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 6
6
7
7
import io
8
8
import os
9
+ import re
9
10
10
11
from setuptools import find_packages , setup
11
12
27
28
}
28
29
29
30
BASE_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.
37
31
38
32
package_root = os .path .abspath (BASE_DIR )
39
33
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
+
40
43
readme_filename = os .path .join (package_root , "README.rst" )
41
44
with io .open (readme_filename , encoding = "utf-8" ) as readme_file :
42
45
readme = readme_file .read ()
You can’t perform that action at this time.
0 commit comments