forked from Qiskit/qiskit-metapackage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
executable file
·109 lines (85 loc) · 3.29 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# -*- coding: utf-8 -*-
# Copyright 2018, IBM.
#
# This source code is licensed under the Apache License, Version 2.0 found in
# the LICENSE.txt file in the root directory of this source tree.
import sys
import subprocess
from setuptools import setup
from setuptools.command.install import install
from setuptools.command.develop import develop
qiskit_terra = "qiskit_terra==0.7.0"
requirements = [
qiskit_terra,
"qiskit-aer==0.1.1",
]
def _reinstall_terra():
subprocess.check_call(
[sys.executable, "-m", "pip", "install", "--no-deps", "-I", qiskit_terra])
class _install(install):
"""Custom install command to force reinstalling qiskit-terra after removing
qiskit."""
def run(self):
super().run()
_reinstall_terra()
class _develop(develop):
"""Custom develop command to force reinstalling qiskit-terra after removing
qiskit."""
def run(self):
super().run()
_reinstall_terra()
_COMMANDS = { 'develop': _develop, 'install': _install }
try:
from wheel.bdist_wheel import bdist_wheel
class _bdist_wheel(bdist_wheel):
"""Custom bdist_wheel command to force cancelling qiskit-terra wheel
creation."""
def run(self):
"""Intentionally terminating the process with an error code."""
sys.exit(-1)
_COMMANDS['bdist_wheel'] = _bdist_wheel
except:
pass
setup(
name="qiskit",
version="0.7.3",
description="Software for developing quantum computing programs",
long_description="Qiskit is a software development kit for writing "
"quantum computing experiments, programs, and "
"applications. Works with Python 3.5, 3.6, and 3.7",
url="https://github.com/Qiskit/qiskit",
author="Qiskit Development Team",
author_email="[email protected]",
license="Apache 2.0",
classifiers=[
"Environment :: Console",
"License :: OSI Approved :: Apache Software License",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"Operating System :: Microsoft :: Windows",
"Operating System :: MacOS",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Topic :: Scientific/Engineering",
],
keywords="qiskit sdk quantum",
install_requires=requirements,
include_package_data=True,
python_requires=">=3.5",
# qiskit 0.7 metapackage has a bug for which qiskit 0.6.1 cannot correctly
# upgrade to 0.7: some Terra files are deleted when removing qiskit 0.6.1
# before installing qiskit 0.7 but after installing its dependencies. More
# detailed info is provided at:
# https://github.com/Qiskit/qiskit/issues/27#issue-396844438
# https://github.com/Qiskit/qiskit/issues/27#issuecomment-455598103
#
# The fix overrides 'install' and 'develop' setuptools commands to force
# reinstalling 'qiskit-terra' after installation to restore the missing files.
#
# For this fix to work, we cannot distribute a wheel version of the metapackage
# (which does not provide any advantage right now). We can remove the fix once
# we don't support updating from 0.6.
cmdclass=_COMMANDS
)