Skip to content

Commit

Permalink
MNT: use public ast module in setup.py (#33)
Browse files Browse the repository at this point in the history
Summary:
The `Str` object is no longer in in `_ast` is py38, switch
to using the public `ast` module instead.

python/cpython#9445
https://bugs.python.org/issue32892
Pull Request resolved: #33

Differential Revision: D14721271

Pulled By: aleivag

fbshipit-source-id: 1367f300f74f037983e5f6e51f7af8990f416759
  • Loading branch information
tacaswell authored and facebook-github-bot committed Apr 2, 2019
1 parent b587985 commit 35d1e09
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import time
from pathlib import Path

import _ast
from setuptools import setup
from setuptools.extension import Extension

Expand All @@ -36,9 +35,9 @@
__version__ = [
expr.value.s
for expr in parsed_file.body
if isinstance(expr, _ast.Assign)
and isinstance(expr.targets[0], _ast.Name)
and isinstance(expr.value, _ast.Str)
if isinstance(expr, ast.Assign)
and isinstance(expr.targets[0], ast.Name)
and isinstance(expr.value, ast.Str)
and expr.targets[0].id == "__version__"
][0]

Expand Down

0 comments on commit 35d1e09

Please sign in to comment.