File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -148,6 +148,10 @@ def get_docstring_and_version_via_ast(target):
148148 with target_path .open ('rb' ) as f :
149149 node = ast .parse (f .read ())
150150 for child in node .body :
151+ if sys .version_info >= (3 , 8 ):
152+ target_type = ast .Constant
153+ else :
154+ target_type = ast .Str
151155 # Only use the version from the given module if it's a simple
152156 # string assignment to __version__
153157 is_version_str = (
@@ -157,10 +161,13 @@ def get_docstring_and_version_via_ast(target):
157161 and target .id == "__version__"
158162 for target in child .targets
159163 )
160- and isinstance (child .value , ast . Str )
164+ and isinstance (child .value , target_type )
161165 )
162166 if is_version_str :
163- version = child .value .s
167+ if sys .version_info >= (3 , 8 ):
168+ version = child .value .value
169+ else :
170+ version = child .value .s
164171 break
165172 return ast .get_docstring (node ), version
166173
You can’t perform that action at this time.
0 commit comments