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'])
33 raise RuntimeError("CMake must be installed to build the following extensions: " +
34 ", ".join(e.name for e in self.extensions))
35 if not os.path.exists("MANIFEST.in"):
36 raise RuntimeError("Please generate a MANIFEST.in file (configure simgrid, and copy it here if you build out of tree)")
38 if platform.system() == "Windows":
39 cmake_version = LooseVersion(re.search(r'version\s*([\d.]+)', out.decode()).group(1))
40 if cmake_version < '3.1.0':
41 raise RuntimeError("CMake >= 3.1.0 is required on Windows")
43 for ext in self.extensions:
44 self.build_extension(ext)
46 def build_extension(self, ext):
47 extdir = os.path.abspath(os.path.dirname(self.get_ext_fullpath(ext.name)))
48 cmake_args = ['-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=' + extdir,
49 '-DPYTHON_EXECUTABLE=' + sys.executable,
53 '-Dminimal-bindings=ON']
55 cfg = 'Debug' if self.debug else 'Release'
56 build_args = ['--config', cfg]
58 if platform.system() == "Windows":
59 cmake_args += ['-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_{}={}'.format(cfg.upper(), extdir)]
60 if sys.maxsize > 2**32:
61 cmake_args += ['-A', 'x64']
62 build_args += ['--', '/m']
64 cmake_args += ['-DCMAKE_BUILD_TYPE=' + cfg]
65 build_args += ['--', '-j4']
67 env = os.environ.copy()
68 env['CXXFLAGS'] = '{} -DVERSION_INFO=\\"{}\\"'.format(env.get('CXXFLAGS', ''),
69 self.distribution.get_version())
70 if not os.path.exists(self.build_temp):
71 os.makedirs(self.build_temp)
72 subprocess.check_call(['cmake', ext.sourcedir] + cmake_args, cwd=self.build_temp, env=env)
73 subprocess.check_call(['cmake', '--build', '.'] + build_args, cwd=self.build_temp)
78 author='Da SimGrid Team',
79 author_email='simgrid-devel@lists.gforge.inria.fr',
80 description='Toolkit for scalable simulation of distributed applications',
81 long_description=("SimGrid is a scientific instrument to study the behavior of "
82 "large-scale distributed systems such as Grids, Clouds, HPC or P2P "
83 "systems. It can be used to evaluate heuristics, prototype applications "
84 "or even assess legacy MPI applications."),
85 ext_modules=[CMakeExtension('simgrid')],
86 cmdclass=dict(build_ext=CMakeBuild),
87 install_requires=['pybind11>=2.3'],
88 setup_requires=['pybind11>=2.3'],
91 "Development Status :: 4 - Beta",
92 "Environment :: Console",
93 "Intended Audience :: Education",
94 "Intended Audience :: Developers",
95 "Intended Audience :: Science/Research",
96 "Intended Audience :: System Administrators",
97 "License :: OSI Approved :: GNU Lesser General Public License v2 (LGPLv2)",
98 "Operating System :: POSIX",
99 "Operating System :: MacOS",
100 "Operating System :: Microsoft :: Windows",
101 "Programming Language :: Python :: 3",
102 "Programming Language :: C++",
103 "Programming Language :: C",
104 "Programming Language :: Fortran",
105 "Programming Language :: Java",
106 "Topic :: System :: Distributed Computing",
107 "Topic :: System :: Systems Administration",
109 url="https://simgrid.org",
111 'Tracker': 'https://framagit.org/simgrid/simgrid/issues/',
112 'Source': 'https://framagit.org/simgrid/simgrid/',
113 'Documentation': 'https://simgrid.org/doc/latest/',