Skip to content

Commit 886ab82

Browse files
authored
Fix #838: replace use of exec with runpy in setup.py (#840)
1 parent 9261c18 commit 886ab82

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

setup.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
import os
1616
import re
17+
import runpy
1718
import sys
1819
import shutil
1920
import platform
@@ -131,8 +132,9 @@ def build_extension(self, ext):
131132
# README file as long_description.
132133
long_description = open("README.md", encoding="utf-8").read()
133134

134-
__version__ = ""
135-
exec(open("qsimcirq/_version.py").read())
135+
__version__ = runpy.run_path("qsimcirq/_version.py")["__version__"]
136+
if not __version__:
137+
raise ValueError("Version string cannot be empty")
136138

137139
setup(
138140
name="qsimcirq",

0 commit comments

Comments
 (0)