3 # python3 setup.py sdist # Build a source distrib (building binary distribs is complex on linux)
5 # twine upload --repository-url https://test.pypi.org/legacy/ dist/simgrid-*.tar.gz # Upload to test
6 # pip3 install --user --index-url https://test.pypi.org/simple simgrid
8 # Once it works, upload to the real infra. /!\ you cannot modify a file once uploaded
9 # twine upload dist/simgrid-*.tar.gz
17 from setuptools import setup, Extension
18 from setuptools.command.build_ext import build_ext
19 from distutils.version import LooseVersion
22 class CMakeExtension(Extension):
23 def __init__(self, name, sourcedir=''):
24 Extension.__init__(self, name, sources=[])
25 self.sourcedir = os.path.abspath(sourcedir)
28 class CMakeBuild(build_ext):
31 out = subprocess.check_output(['cmake', '--version'])
34 "CMake must be installed to build python bindings of SimGrid")
36 if not os.path.exists("MANIFEST.in"):
38 "Please generate a MANIFEST.in file (configure simgrid, and copy it here if you build out of tree)")
40 if platform.system() == "Windows":
41 cmake_version = LooseVersion(
42 re.search(r'version\s*([\d.]+)', out.decode()).group(1))
43 if cmake_version < '3.1.0':
44 raise RuntimeError("CMake >= 3.1.0 is required on Windows")
46 for ext in self.extensions:
47 self.build_extension(ext)
49 def build_extension(self, ext):
50 extdir = os.path.abspath(os.path.dirname(
51 self.get_ext_fullpath(ext.name)))
52 cmake_args = ['-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=' + extdir,
53 '-DPYTHON_EXECUTABLE=' + sys.executable,
57 '-Dminimal-bindings=ON']
59 cfg = 'Debug' if self.debug else 'Release'
60 build_args = ['--config', cfg]
62 if platform.system() == "Windows":
64 '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_{}={}'.format(cfg.upper(), extdir)]
65 if sys.maxsize > 2**32:
66 cmake_args += ['-A', 'x64']
67 build_args += ['--', '/m']
69 cmake_args += ['-DCMAKE_BUILD_TYPE=' + cfg]
70 build_args += ['--', '-j4']
72 env = os.environ.copy()
73 env['CXXFLAGS'] = '{} -DVERSION_INFO=\\"{}\\"'.format(env.get('CXXFLAGS', ''),
74 self.distribution.get_version())
75 if not os.path.exists(self.build_temp):
76 os.makedirs(self.build_temp)
77 subprocess.check_call(['cmake', ext.sourcedir] +
78 cmake_args, cwd=self.build_temp, env=env)
79 subprocess.check_call(['cmake', '--build', '.'] +
80 build_args, cwd=self.build_temp)
86 author='Da SimGrid Team',
87 author_email='simgrid-devel@lists.gforge.inria.fr',
88 description='Toolkit for scalable simulation of distributed applications',
89 long_description=("SimGrid is a scientific instrument to study the behavior of "
90 "large-scale distributed systems such as Grids, Clouds, HPC or P2P "
91 "systems. It can be used to evaluate heuristics, prototype applications "
92 "or even assess legacy MPI applications.\n\n"
93 "This package contains a native library. Please install cmake, boost, pybind11 and a "
94 "C++ compiler before using pip3. On Debian/Ubuntu, this is as easy as\n"
95 "sudo apt install cmake libboost-dev pybind11-dev g++ gcc"),
96 ext_modules=[CMakeExtension('simgrid')],
97 cmdclass=dict(build_ext=CMakeBuild),
98 install_requires=['pybind11>=2.4'],
99 setup_requires=['pybind11>=2.4'],
102 "Development Status :: 4 - Beta",
103 "Environment :: Console",
104 "Intended Audience :: Education",
105 "Intended Audience :: Developers",
106 "Intended Audience :: Science/Research",
107 "Intended Audience :: System Administrators",
108 "License :: OSI Approved :: GNU Lesser General Public License v2 (LGPLv2)",
109 "Operating System :: POSIX",
110 "Operating System :: MacOS",
111 "Operating System :: Microsoft :: Windows",
112 "Programming Language :: Python :: 3",
113 "Programming Language :: C++",
114 "Programming Language :: C",
115 "Programming Language :: Fortran",
116 "Programming Language :: Java",
117 "Topic :: System :: Distributed Computing",
118 "Topic :: System :: Systems Administration",
120 url="https://simgrid.org",
122 'Tracker': 'https://framagit.org/simgrid/simgrid/issues/',
123 'Source': 'https://framagit.org/simgrid/simgrid/',
124 'Documentation': 'https://simgrid.org/doc/latest/',