From 7dd469fdf92a45b80049cd0583c75550ce1032ff Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 3 Jun 2020 19:21:20 -0700 Subject: [PATCH] WIP: Add sage_tdlib package, use symlinks for sagelib package --- .gitignore | 2 ++ build/pkgs/sage_tdlib/dependencies | 1 + build/pkgs/sage_tdlib/spkg-install | 1 + build/pkgs/sage_tdlib/src/sage | 1 + build/pkgs/sage_tdlib/src/sage_setup | 1 + build/pkgs/sage_tdlib/src/setup.cfg | 2 ++ build/pkgs/sage_tdlib/src/setup.py | 30 ++++++++++++++++++++++++++++ build/pkgs/sage_tdlib/type | 1 + build/pkgs/sagelib/spkg-install | 2 +- build/pkgs/sagelib/src/sage | 1 + build/pkgs/sagelib/src/sage_setup | 1 + build/pkgs/sagelib/src/setup.cfg | 1 + build/pkgs/sagelib/src/setup.py | 1 + src/sage_setup/find.py | 7 ++++++- src/setup.py | 4 +++- 15 files changed, 53 insertions(+), 3 deletions(-) create mode 100644 build/pkgs/sage_tdlib/dependencies create mode 120000 build/pkgs/sage_tdlib/spkg-install create mode 120000 build/pkgs/sage_tdlib/src/sage create mode 120000 build/pkgs/sage_tdlib/src/sage_setup create mode 100644 build/pkgs/sage_tdlib/src/setup.cfg create mode 100644 build/pkgs/sage_tdlib/src/setup.py create mode 100644 build/pkgs/sage_tdlib/type create mode 120000 build/pkgs/sagelib/src/sage create mode 120000 build/pkgs/sagelib/src/sage_setup create mode 120000 build/pkgs/sagelib/src/setup.cfg create mode 120000 build/pkgs/sagelib/src/setup.py diff --git a/.gitignore b/.gitignore index d91c194b1b1..4dbf0288812 100644 --- a/.gitignore +++ b/.gitignore @@ -101,6 +101,8 @@ gitlab-build-docker.log /src/bin/sage-env-config /build/bin/sage-build-env-config +/build/pkgs/*/src/build + ####################### # tox generated files # ####################### diff --git a/build/pkgs/sage_tdlib/dependencies b/build/pkgs/sage_tdlib/dependencies new file mode 100644 index 00000000000..d4bff231a23 --- /dev/null +++ b/build/pkgs/sage_tdlib/dependencies @@ -0,0 +1 @@ +tdlib diff --git a/build/pkgs/sage_tdlib/spkg-install b/build/pkgs/sage_tdlib/spkg-install new file mode 120000 index 00000000000..fa9e254e2f0 --- /dev/null +++ b/build/pkgs/sage_tdlib/spkg-install @@ -0,0 +1 @@ +../sagelib/spkg-install \ No newline at end of file diff --git a/build/pkgs/sage_tdlib/src/sage b/build/pkgs/sage_tdlib/src/sage new file mode 120000 index 00000000000..c4f2d5df534 --- /dev/null +++ b/build/pkgs/sage_tdlib/src/sage @@ -0,0 +1 @@ +../../../../src/sage \ No newline at end of file diff --git a/build/pkgs/sage_tdlib/src/sage_setup b/build/pkgs/sage_tdlib/src/sage_setup new file mode 120000 index 00000000000..a2cca6f09f7 --- /dev/null +++ b/build/pkgs/sage_tdlib/src/sage_setup @@ -0,0 +1 @@ +../../../../src/sage_setup \ No newline at end of file diff --git a/build/pkgs/sage_tdlib/src/setup.cfg b/build/pkgs/sage_tdlib/src/setup.cfg new file mode 100644 index 00000000000..c29be60cadf --- /dev/null +++ b/build/pkgs/sage_tdlib/src/setup.cfg @@ -0,0 +1,2 @@ +[metadata] +name = sage-tdlib diff --git a/build/pkgs/sage_tdlib/src/setup.py b/build/pkgs/sage_tdlib/src/setup.py new file mode 100644 index 00000000000..62f29302bbd --- /dev/null +++ b/build/pkgs/sage_tdlib/src/setup.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python + +from distutils import log +from setuptools import setup + +from sage_setup.command.sage_build import sage_build +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.find import find_python_sources, is_package_or_namespace_package_dir +python_packages, python_modules, cython_modules = find_python_sources( + '.', ['sage'], distributions=['sage-tdlib']) + +log.warn('python_packages = {0}'.format(python_packages)) +log.warn('python_modules = {0}'.format(python_modules)) +log.warn('cython_modules = {0}'.format(cython_modules)) + +import Cython.Build.Dependencies +import Cython.Build.Cythonize +import Cython.Utils +Cython.Utils.is_package_dir = Cython.Build.Cythonize.is_package_dir = Cython.Build.Dependencies.is_package_dir = is_package_or_namespace_package_dir + +from sage_setup.command.sage_install import sage_install + +setup( + cmdclass = dict(build_cython=sage_build_cython, + build_ext=sage_build_ext, + install=sage_install), # need this, or "setup.py install" will install an egg + ext_modules = cython_modules +) diff --git a/build/pkgs/sage_tdlib/type b/build/pkgs/sage_tdlib/type new file mode 100644 index 00000000000..134d9bc32d5 --- /dev/null +++ b/build/pkgs/sage_tdlib/type @@ -0,0 +1 @@ +optional diff --git a/build/pkgs/sagelib/spkg-install b/build/pkgs/sagelib/spkg-install index 0fa42a7e912..0848bc307e3 100755 --- a/build/pkgs/sagelib/spkg-install +++ b/build/pkgs/sagelib/spkg-install @@ -1,5 +1,5 @@ #!/usr/bin/env bash -cd "$SAGE_SRC" +cd src ## All sagelib-building is done by setup.py. ## This is so that sagelib can be installed by standard Python procedures, ## such as "./setup.py install" or "pip install ." diff --git a/build/pkgs/sagelib/src/sage b/build/pkgs/sagelib/src/sage new file mode 120000 index 00000000000..c4f2d5df534 --- /dev/null +++ b/build/pkgs/sagelib/src/sage @@ -0,0 +1 @@ +../../../../src/sage \ No newline at end of file diff --git a/build/pkgs/sagelib/src/sage_setup b/build/pkgs/sagelib/src/sage_setup new file mode 120000 index 00000000000..a2cca6f09f7 --- /dev/null +++ b/build/pkgs/sagelib/src/sage_setup @@ -0,0 +1 @@ +../../../../src/sage_setup \ No newline at end of file diff --git a/build/pkgs/sagelib/src/setup.cfg b/build/pkgs/sagelib/src/setup.cfg new file mode 120000 index 00000000000..d0692546cf3 --- /dev/null +++ b/build/pkgs/sagelib/src/setup.cfg @@ -0,0 +1 @@ +../../../../setup.cfg \ No newline at end of file diff --git a/build/pkgs/sagelib/src/setup.py b/build/pkgs/sagelib/src/setup.py new file mode 120000 index 00000000000..eb662b1b9b6 --- /dev/null +++ b/build/pkgs/sagelib/src/setup.py @@ -0,0 +1 @@ +../../../../setup.py \ No newline at end of file diff --git a/src/sage_setup/find.py b/src/sage_setup/find.py index 190c5ba03bd..d72d53505a9 100644 --- a/src/sage_setup/find.py +++ b/src/sage_setup/find.py @@ -221,7 +221,8 @@ def is_package_or_namespace_package_dir(dirpath): return True return os.path.exists(os.path.join(dirpath, 'namespace')) -def find_extra_files(src_dir, modules, cythonized_dir, special_filenames=[]): +def find_extra_files(src_dir, modules, cythonized_dir, special_filenames=[], + distributions=None): """ Find all extra files which should be installed. @@ -266,6 +267,10 @@ def find_extra_files(src_dir, modules, cythonized_dir, special_filenames=[]): """ from Cython.Utils import is_package_dir + if not (distributions is None or '' in distributions): + # FIXME: This is only a 0th order approximation of what we need + return [] + data_files = {} cy_exts = ('.pxd', '.pxi', '.pyx') diff --git a/src/setup.py b/src/setup.py index ac3a6f1d98f..1ba50edf314 100755 --- a/src/setup.py +++ b/src/setup.py @@ -58,7 +58,9 @@ from sage_setup.optional_extension import is_package_installed_and_updated -optional_packages_with_extensions = ['mcqd', 'bliss', 'tdlib', 'primecount', +optional_packages_with_extensions = ['mcqd', 'bliss', + #'tdlib', ## handled by sage_tdlib + 'primecount', 'coxeter3', 'fes', 'sirocco', 'meataxe'] distributions += ['sage-{}'.format(pkg)