Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Generate auto-generated sources as the earliest step in the 'build' c…
Browse files Browse the repository at this point in the history
…ommand.

Make sure that entire sub-packages that are auto-generated (namely, sage.ext.interpreters) is added to the distribution's
list of packages.
  • Loading branch information
embray committed Dec 30, 2016
1 parent e82c80c commit 3bb5e73
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 9 deletions.
7 changes: 7 additions & 0 deletions src/sage_setup/autogen/__init__.py
Expand Up @@ -10,3 +10,10 @@ def autogen_all():

from sage_setup.autogen import interpreters
interpreters.rebuild(os.path.join("sage", "ext", "interpreters"))

# Return list of sub-packages that should be appended to the list of
# packages built/installed by setup.py
#
# In the case of Pari it just adds new files to an existing package (rather
# than autogenerating the entire sub-package) so it's omitted here.
return ['sage.ext.interpreters']
26 changes: 17 additions & 9 deletions src/setup.py
Expand Up @@ -4,6 +4,7 @@
import os, sys, time, errno, platform, subprocess
from distutils import log
from distutils.core import setup, DistutilsSetupError
from distutils.command.build import build
from distutils.command.build_ext import build_ext
from distutils.command.install import install
from distutils.dep_util import newer_group
Expand Down Expand Up @@ -664,16 +665,22 @@ def copy_extra_files(self):
for src in src_files:
self.copy_file(src, dst, preserve_mode=False)

#########################################################
### Generating auto-generated Sources
### This must be done before discovering and building
### the python modules. See #22094.
#########################################################

log.info("Generating auto-generated sources")
from sage_setup.autogen import autogen_all
class sage_build(build):
def run_autogen(self):
"""
Generating auto-generated Sources This must be done before discovering
and building the python modules. See #22106.
"""

from sage_setup.autogen import autogen_all
log.info("Generating auto-generated sources")
self.distribution.packages += autogen_all()

def run(self):
self.run_autogen()
build.run(self)

autogen_all()

#########################################################
### Discovering Sources
Expand Down Expand Up @@ -764,5 +771,6 @@ def clean_stale_files(self):
author_email= 'http://groups.google.com/group/sage-support',
url = 'http://www.sagemath.org',
packages = python_packages,
cmdclass = dict(build_ext=sage_build_ext, install=sage_install),
cmdclass = dict(build=sage_build, build_ext=sage_build_ext,
install=sage_install),
ext_modules = ext_modules)

0 comments on commit 3bb5e73

Please sign in to comment.