File tree Expand file tree Collapse file tree 1 file changed +13
-10
lines changed Expand file tree Collapse file tree 1 file changed +13
-10
lines changed Original file line number Diff line number Diff line change 14
14
15
15
from os import path
16
16
17
+ import astropy
17
18
import sphinx
18
19
from distutils .version import LooseVersion
19
20
@@ -110,17 +111,19 @@ def check_sphinx_version(expected_version):
110
111
# https://github.com/numpy/numpydoc/blob/b352cd7635f2ea7748722f410a31f937d92545cc/numpydoc/xref.py#L62-L94
111
112
# numpydoc_xref_aliases = {}
112
113
113
- # TODO! refactor if #11678 is implemented
114
- from astropy .units .physical import _units_and_physical_types
115
114
numpydoc_xref_aliases_astropy_physical_type = {}
116
- for _ , ptypes in _units_and_physical_types :
117
- ptypes = {ptypes } if isinstance (ptypes , str ) else ptypes
118
- for ptype in ptypes :
119
- key = f"'{ ptype } '"
120
- val = f":ref:`:ref: '{ ptype } ' <astropy:{ ptype } >`" # <= intersphinxed.
121
- numpydoc_xref_aliases_astropy_physical_type [key ] = val
122
-
123
- del ptypes , key , val
115
+ if float (astropy .__version__ [:3 ]) >= 4.3 :
116
+
117
+ # TODO! refactor if #11678 is implemented
118
+ from astropy .units .physical import _units_and_physical_types
119
+ for _ , ptypes in _units_and_physical_types :
120
+ ptypes = {ptypes } if isinstance (ptypes , str ) else ptypes
121
+ for ptype in ptypes :
122
+ key = f"'{ ptype } '"
123
+ val = f":ref:`:ref: '{ ptype } ' <astropy:{ ptype } >`" # <= intersphinxed.
124
+ numpydoc_xref_aliases_astropy_physical_type [key ] = val
125
+
126
+ del ptypes , key , val
124
127
125
128
# -- Project information ------------------------------------------------------
126
129
You can’t perform that action at this time.
0 commit comments