|
12 | 12 | # See the License for the specific language governing permissions and
|
13 | 13 | # limitations under the License.
|
14 | 14 |
|
15 |
| -import io |
16 |
| -import os |
| 15 | +import runpy |
| 16 | + |
17 | 17 | from setuptools import find_packages, setup
|
18 | 18 |
|
19 |
| -# This reads the __version__ variable from cirq/_version.py |
20 |
| -__version__ = '' |
21 |
| -exec(open('cirq_ionq/_version.py').read()) |
| 19 | +# This reads the __version__ variable from cirq_ionq/_version.py |
| 20 | +__version__ = runpy.run_path('cirq_ionq/_version.py')['__version__'] |
| 21 | +assert __version__, 'Version string cannot be empty' |
22 | 22 |
|
23 | 23 | name = 'cirq-ionq'
|
24 | 24 |
|
25 | 25 | description = 'A Cirq package to simulate and connect to IonQ quantum computers'
|
26 | 26 |
|
27 | 27 | # README file as long_description.
|
28 |
| -long_description = io.open('README.md', encoding='utf-8').read() |
29 |
| - |
30 |
| -# If CIRQ_PRE_RELEASE_VERSION is set then we update the version to this value. |
31 |
| -# It is assumed that it ends with one of `.devN`, `.aN`, `.bN`, `.rcN` and hence |
32 |
| -# it will be a pre-release version on PyPi. See |
33 |
| -# https://packaging.python.org/guides/distributing-packages-using-setuptools/#pre-release-versioning |
34 |
| -# for more details. |
35 |
| -if 'CIRQ_PRE_RELEASE_VERSION' in os.environ: |
36 |
| - __version__ = os.environ['CIRQ_PRE_RELEASE_VERSION'] |
37 |
| - long_description = ( |
38 |
| - "<div align='center' width='50%'>\n\n" |
39 |
| - "| ⚠️ WARNING |\n" |
40 |
| - "|:----------:|\n" |
41 |
| - "| **This is a development version of `cirq-ionq` and may be<br>" |
42 |
| - "unstable. For the latest stable release of `cirq-ionq`,<br>" |
43 |
| - "please visit** <https://pypi.org/project/cirq-ionq>.|\n" |
44 |
| - "\n</div>\n\n" + long_description |
45 |
| - ) |
| 28 | +long_description = open('README.md', encoding='utf-8').read() |
46 | 29 |
|
47 | 30 | # Read in requirements
|
48 | 31 | requirements = open('requirements.txt').readlines()
|
49 | 32 | requirements = [r.strip() for r in requirements]
|
| 33 | +requirements += [f'cirq-core=={__version__}'] |
50 | 34 |
|
51 | 35 | cirq_packages = ['cirq_ionq'] + [
|
52 | 36 | 'cirq_ionq.' + package for package in find_packages(where='cirq_ionq')
|
53 | 37 | ]
|
54 | 38 |
|
55 |
| -# Sanity check |
56 |
| -assert __version__, 'Version string cannot be empty' |
57 |
| - |
58 |
| -requirements += [f'cirq-core=={__version__}'] |
59 | 39 |
|
60 | 40 | setup(
|
61 | 41 | name=name,
|
|
0 commit comments