Commit 5c7abd5d authored by Stefan Behnel's avatar Stefan Behnel

Make the setup.py script importable to enable multiprocessing builds that need...

Make the setup.py script importable to enable multiprocessing builds that need to "spawn" processes (usually on Windows).
parent 4478f22f
...@@ -188,15 +188,10 @@ try: ...@@ -188,15 +188,10 @@ try:
except ValueError: except ValueError:
compile_cython_itself = True compile_cython_itself = True
if compile_cython_itself and (is_cpython or cython_compile_more):
compile_cython_modules(cython_profile, cython_compile_more, cython_with_refnanny)
setup_args.update(setuptools_extra_args) setup_args.update(setuptools_extra_args)
from Cython import __version__ as version
def dev_status(): def dev_status(version):
if 'b' in version or 'c' in version: if 'b' in version or 'c' in version:
# 1b1, 1beta1, 2rc1, ... # 1b1, 1beta1, 2rc1, ...
return 'Development Status :: 4 - Beta' return 'Development Status :: 4 - Beta'
...@@ -224,63 +219,73 @@ packages = [ ...@@ -224,63 +219,73 @@ packages = [
'pyximport', 'pyximport',
] ]
setup(
name='Cython', def run_build():
version=version, if compile_cython_itself and (is_cpython or cython_compile_more):
url='https://cython.org/', compile_cython_modules(cython_profile, cython_compile_more, cython_with_refnanny)
author='Robert Bradshaw, Stefan Behnel, Dag Seljebotn, Greg Ewing, et al.',
author_email='cython-devel@python.org', from Cython import __version__ as version
description="The Cython compiler for writing C extensions for the Python language.", setup(
long_description=textwrap.dedent("""\ name='Cython',
The Cython language makes writing C extensions for the Python language as version=version,
easy as Python itself. Cython is a source code translator based on Pyrex_, url='https://cython.org/',
but supports more cutting edge functionality and optimizations. author='Robert Bradshaw, Stefan Behnel, Dag Seljebotn, Greg Ewing, et al.',
author_email='cython-devel@python.org',
The Cython language is a superset of the Python language (almost all Python description="The Cython compiler for writing C extensions for the Python language.",
code is also valid Cython code), but Cython additionally supports optional long_description=textwrap.dedent("""\
static typing to natively call C functions, operate with C++ classes and The Cython language makes writing C extensions for the Python language as
declare fast C types on variables and class attributes. This allows the easy as Python itself. Cython is a source code translator based on Pyrex_,
compiler to generate very efficient C code from Cython code. but supports more cutting edge functionality and optimizations.
This makes Cython the ideal language for writing glue code for external The Cython language is a superset of the Python language (almost all Python
C/C++ libraries, and for fast C modules that speed up the execution of code is also valid Cython code), but Cython additionally supports optional
Python code. static typing to natively call C functions, operate with C++ classes and
declare fast C types on variables and class attributes. This allows the
Note that for one-time builds, e.g. for CI/testing, on platforms that are not compiler to generate very efficient C code from Cython code.
covered by one of the wheel packages provided on PyPI *and* the pure Python wheel
that we provide is not used, it is substantially faster than a full source build This makes Cython the ideal language for writing glue code for external
to install an uncompiled (slower) version of Cython with:: C/C++ libraries, and for fast C modules that speed up the execution of
Python code.
pip install Cython --install-option="--no-cython-compile"
Note that for one-time builds, e.g. for CI/testing, on platforms that are not
.. _Pyrex: https://www.cosc.canterbury.ac.nz/greg.ewing/python/Pyrex/ covered by one of the wheel packages provided on PyPI *and* the pure Python wheel
"""), that we provide is not used, it is substantially faster than a full source build
license='Apache', to install an uncompiled (slower) version of Cython with::
classifiers=[
dev_status(), pip install Cython --install-option="--no-cython-compile"
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License", .. _Pyrex: https://www.cosc.canterbury.ac.nz/greg.ewing/python/Pyrex/
"Operating System :: OS Independent", """),
"Programming Language :: Python", license='Apache',
"Programming Language :: Python :: 2", classifiers=[
"Programming Language :: Python :: 2.7", dev_status(version),
"Programming Language :: Python :: 3", "Intended Audience :: Developers",
"Programming Language :: Python :: 3.4", "License :: OSI Approved :: Apache Software License",
"Programming Language :: Python :: 3.5", "Operating System :: OS Independent",
"Programming Language :: Python :: 3.6", "Programming Language :: Python",
"Programming Language :: Python :: 3.7", "Programming Language :: Python :: 2",
"Programming Language :: Python :: 3.8", "Programming Language :: Python :: 2.7",
"Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: 3",
"Programming Language :: Python :: Implementation :: PyPy", "Programming Language :: Python :: 3.4",
"Programming Language :: C", "Programming Language :: Python :: 3.5",
"Programming Language :: Cython", "Programming Language :: Python :: 3.6",
"Topic :: Software Development :: Code Generators", "Programming Language :: Python :: 3.7",
"Topic :: Software Development :: Compilers", "Programming Language :: Python :: 3.8",
"Topic :: Software Development :: Libraries :: Python Modules" "Programming Language :: Python :: Implementation :: CPython",
], "Programming Language :: Python :: Implementation :: PyPy",
"Programming Language :: C",
scripts=scripts, "Programming Language :: Cython",
packages=packages, "Topic :: Software Development :: Code Generators",
py_modules=["cython"], "Topic :: Software Development :: Compilers",
**setup_args "Topic :: Software Development :: Libraries :: Python Modules"
) ],
scripts=scripts,
packages=packages,
py_modules=["cython"],
**setup_args
)
if __name__ == '__main__':
run_build()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment