import os
import sys
import time
import setuptools
from distutils import log
from setuptools import setup
if os.uname().sysname == 'Darwin':
import multiprocessing
multiprocessing.set_start_method('fork', force=True)
try:
import setuptools_scm.integration
setuptools_scm.integration.find_files = lambda _: []
except ImportError:
pass
import setuptools.command.egg_info
setuptools.command.egg_info.walk_revctrl = lambda: ()
sys.path.insert(0, os.path.dirname(__file__))
import sage.env
sage.env.SAGE_SRC = os.getcwd()
from sage.env import *
from sage_setup.excepthook import excepthook
sys.excepthook = excepthook
from sage_setup.setenv import setenv
setenv()
from sage_setup.command.sage_build_cython import sage_build_cython
from sage_setup.command.sage_build_ext import sage_build_ext
from sage_setup.command.sage_install import sage_develop, sage_install
cmdclass = dict(build_cython=sage_build_cython,
build_ext=sage_build_ext,
develop=sage_develop,
install=sage_install)
if any(x in sys.argv
for x in ['build', 'build_ext', 'bdist_wheel', 'install']):
log.info("Generating auto-generated sources")
from sage_setup.autogen import autogen_all
autogen_all()
print("Discovering Python/Cython source code....")
t = time.time()
distributions = ['sagemath-categories',
'sagemath-environment',
'sagemath-objects',
'sagemath-repl',
'']
log.warn('distributions = {0}'.format(distributions))
from sage_setup.find import find_python_sources
python_packages, python_modules, cython_modules = find_python_sources(
SAGE_SRC, ['sage'], distributions=distributions)
log.debug('python_packages = {0}'.format(python_packages))
log.debug('python_modules = {0}'.format(python_modules))
log.debug('cython_modules = {0}'.format(cython_modules))
print("Discovered Python/Cython sources, time: %.2f seconds." % (time.time() - t))
code = setup(
packages=python_packages,
cmdclass=cmdclass,
ext_modules=cython_modules,
)