forked from Qiskit/qiskit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py.in
More file actions
executable file
·132 lines (114 loc) · 4.57 KB
/
setup.py.in
File metadata and controls
executable file
·132 lines (114 loc) · 4.57 KB
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# -*- coding: utf-8 -*-
# Copyright 2017 IBM RESEARCH. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# =============================================================================
import sys
import os
import platform
from distutils.command.build import build
from multiprocessing import cpu_count
from subprocess import call
from setuptools import setup, find_packages
from setuptools.dist import Distribution
requirements = [
"IBMQuantumExperience>=1.9.0",
"matplotlib>=2.1,<2.2",
"networkx>=2.0,<2.1",
"numpy>=1.13,<1.15",
"ply==3.10",
"scipy>=0.19,<1.1",
"sympy>=1.0",
"pillow>=4.2.1"
]
# C++ components compilation
class QasmSimulatorCppBuild(build):
def run(self):
super().run()
# Store the current working directory, as invoking cmake involves
# an out of source build and might interfere with the rest of the steps.
current_directory = os.getcwd()
try:
supported_platforms = ['Linux', 'Darwin', 'Windows']
current_platform = platform.system()
if current_platform not in supported_platforms:
# TODO: stdout is silenced by pip if the full setup.py invocation is
# successful, unless using '-v' - hence the warnings are not printed.
print('WARNING: QISKit cpp simulator is meant to be built with these '
'platforms: {}. We will support other platforms soon!'
.format(supported_platforms))
return
cmd_cmake = ['cmake', '-vvv']
if 'USER_LIB_PATH' in os.environ:
cmd_cmake.append('-DUSER_LIB_PATH={}'.format(os.environ['USER_LIB_PATH']))
if current_platform == 'Windows':
# We only support MinGW so far
cmd_cmake.append("-GMinGW Makefiles")
cmd_cmake.append('..')
cmd_make = ['make', 'pypi_package_copy_qasm_simulator_cpp']
try:
cmd_make.append('-j%d' % cpu_count())
except NotImplementedError:
print('WARNING: Unable to determine number of CPUs. Using single threaded make.')
def compile_simulator():
self.mkpath('out')
os.chdir('out')
call(cmd_cmake)
call(cmd_make)
self.execute(compile_simulator, [], 'Compiling C++ QASM Simulator')
except Exception as e:
print(str(e))
print("WARNING: Seems like the cpp simulator can't be built, Qiskit will "
"install anyway, but won't have this simulator support.")
# Restore working directory.
os.chdir(current_directory)
# This is for creating wheel specific platforms
class BinaryDistribution(Distribution):
def has_ext_modules(self):
return True
setup(
name="qiskit",
version="${QISKIT_VERSION}",
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 and 3.6""",
url="https://github.com/QISKit/qiskit-sdk-py",
author="QISKit Development Team",
author_email="qiskit@us.ibm.com",
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",
"Topic :: Scientific/Engineering",
],
keywords="qiskit sdk quantum",
packages=find_packages(exclude=['test*']),
install_requires=requirements,
include_package_data=True,
python_requires=">=3.5",
cmdclass={
'build': QasmSimulatorCppBuild,
},
distclass=BinaryDistribution,
extras_require={
'ProjectQ': ["projectq>=0.3.6"],
}
)