File tree Expand file tree Collapse file tree 3 files changed +29
-9
lines changed
Expand file tree Collapse file tree 3 files changed +29
-9
lines changed Original file line number Diff line number Diff line change @@ -219,15 +219,20 @@ def _get_version():
219219 if ((root / ".matplotlib-repo" ).exists ()
220220 and (root / ".git" ).exists ()
221221 and not (root / ".git/shallow" ).exists ()):
222- import setuptools_scm
223- return setuptools_scm .get_version (
224- root = root ,
225- version_scheme = "release-branch-semver" ,
226- local_scheme = "node-and-date" ,
227- fallback_version = _version .version ,
228- )
229- else : # Get the version from the _version.py setuptools_scm file.
230- return _version .version
222+ try :
223+ import setuptools_scm
224+ except ImportError :
225+ pass
226+ else :
227+ return setuptools_scm .get_version (
228+ root = root ,
229+ version_scheme = "release-branch-semver" ,
230+ local_scheme = "node-and-date" ,
231+ fallback_version = _version .version ,
232+ )
233+ # Get the version from the _version.py file if not in repo or setuptools_scm is
234+ # unavailable.
235+ return _version .version
231236
232237
233238@_api .caching_module_getattr
Original file line number Diff line number Diff line change 1+ version = @VCS_TAG@
Original file line number Diff line number Diff line change @@ -138,6 +138,20 @@ typing_sources = [
138138py3.install_sources(python_sources, typing_sources,
139139 subdir : ' matplotlib' )
140140
141+ fs = import (' fs' )
142+ if fs.exists(' _version.py' )
143+ py3.install_sources(' _version.py' , subdir : ' matplotlib' )
144+ else
145+ cfg = configuration_data ()
146+ cfg.set_quoted(' VCS_TAG' , meson .project_version())
147+ configure_file (
148+ input : ' _version.py.in' , output : ' _version.py' ,
149+ configuration : cfg,
150+ install : true ,
151+ install_tag : ' python-runtime' ,
152+ install_dir : py3.get_install_dir() / ' matplotlib' )
153+ endif
154+
141155subdir (' _api' )
142156subdir (' axes' )
143157subdir (' backends' )
You can’t perform that action at this time.
0 commit comments