Skip to content

Commit

Permalink
Trac #21559: Install src/bin scripts by sagelib's setup.py, not make
Browse files Browse the repository at this point in the history
This ticket cleans up how the contents of `src/bin` are installed. One
of its goals is to make the `sagelib` installation done by
`src/setup.py` self-contained regarding the scripts that it needs at
runtime.

Previous tickets moved some of the scripts to `build/bin` (no longer
installed in `SAGE_LOCAL`).

In follow-up tickets, `src/bin` could be cleaned up more.
 - See the list of files added on this ticket to `src/setup.py` for
beginnings of a categorization.
 - #29850: Install `src/bin/sage-env-config` as part of `sage_conf`
 - #29847: Install `sage_setup` with `setuptools` as a prerequisite for
building/installing sagelib, install sage-the-distribution scripts as
"scripts"

URL: https://trac.sagemath.org/21559
Reported by: mkoeppe
Ticket author(s): Matthias Koeppe
Reviewer(s): John Palmieri, François Bissey
  • Loading branch information
Release Manager committed Jul 9, 2020
2 parents cc19847 + 19d7f67 commit ed49c85
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 30 deletions.
18 changes: 3 additions & 15 deletions build/make/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -96,16 +96,13 @@ OPTIONAL_CLEANED_PACKAGES_CLEANS = $(OPTIONAL_CLEANED_PACKAGES:%=%-clean)
# All packages which should be downloaded
SDIST_PACKAGES = @SAGE_SDIST_PACKAGES@

SCRIPTS = @SAGE_SCRIPTS@

# Packages that use the 'normal' build rules
NORMAL_PACKAGES = @SAGE_NORMAL_PACKAGES@

# Packages that use the 'pip' package build rules
PIP_PACKAGES = @SAGE_PIP_PACKAGES@

# Packages that use the 'script' package build rules (not to be confused with
# the $(SCRIPTS) list)
# Packages that use the 'script' package build rules
SCRIPT_PACKAGES = @SAGE_SCRIPT_PACKAGES@


Expand Down Expand Up @@ -207,8 +204,7 @@ all-sage: \
sagelib \
$(STANDARD_PACKAGE_INSTS) \
$(OPTIONAL_INSTALLED_PACKAGE_INSTS) \
$(OPTIONAL_CLEANED_PACKAGES_CLEANS) \
$(SCRIPTS)
$(OPTIONAL_CLEANED_PACKAGES_CLEANS)

# Download all packages which should be inside an sdist tarball (the -B
# option to make forces all targets to be built unconditionally)
Expand Down Expand Up @@ -247,7 +243,7 @@ PYTHON_TOOLCHAIN = setuptools pip setuptools_scm

# Everything needed to start up Sage using "./sage". Of course, not
# every part of Sage will work. It does not include Maxima for example.
SAGERUNTIME = sagelib $(SCRIPTS) $(inst_ipython) $(inst_pexpect) \
SAGERUNTIME = sagelib $(inst_ipython) $(inst_pexpect) \
$(inst_psutil)

all-sageruntime: toolchain-deps
Expand All @@ -273,14 +269,6 @@ $(STARTED): $(STANDARD_PACKAGE_INSTS)
###############################################################################
base: $(inst_patch) $(inst_pkgconf)

###############################################################################
# Building scripts
###############################################################################

# Don't just use "install" since we don't want to change permissions
$(SAGE_LOCAL)/bin/%: $(SAGE_SRC)/bin/%
$(AM_V_at)cp $< $@

###############################################################################
# Building the documentation
###############################################################################
Expand Down
15 changes: 0 additions & 15 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -414,21 +414,6 @@ AC_SUBST([SAGE_SPKG_OPTIONS])

SAGE_SPKG_COLLECT()

# We need sage-env-config to exist before running this.
# TODO: fix this in Trac #21524
touch "$SAGE_SRC/bin/sage-env-config"

SAGE_SCRIPTS=''
for file in "$SAGE_SRC/bin/"*; do
# Skip files with ".in" extension
ext=${file##*.}
if test "$ext" != in; then
SAGE_SCRIPTS="${SAGE_SCRIPTS} \\$(printf '\n ')\$(SAGE_LOCAL)${file#$SAGE_SRC}"
fi
done

AC_SUBST([SAGE_SCRIPTS])

dnl AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([build/make/Makefile-auto build/make/Makefile])
AC_CONFIG_FILES([src/bin/sage-env-config build/bin/sage-build-env-config])
Expand Down
57 changes: 57 additions & 0 deletions src/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,63 @@
'ext_data/valgrind/*',
'ext_data/threejs/*']
},
scripts = [## The sage script
'bin/sage',
## Other scripts that should be in the path also for OS packaging of sage:
'bin/sage-eval',
'bin/sage-runtests', # because it is useful for doctesting user scripts too
'bin/sage-fixdoctests', # likewise
'bin/sage-coverage', # because it is useful for coverage-testing user scripts too
'bin/sage-coverageall', # likewise
'bin/sage-cython', # deprecated, might be used in user package install scripts
## Helper scripts invoked by sage script
## (they would actually belong to something like libexec)
'bin/sage-cachegrind',
'bin/sage-callgrind',
'bin/sage-massif',
'bin/sage-omega',
'bin/sage-valgrind',
'bin/sage-version.sh',
'bin/sage-cleaner',
## Only makes sense in sage-the-distribution. TODO: Move to another installation script.
'bin/sage-list-packages',
'bin/sage-clone-source',
'bin/sage-download-upstream',
'bin/sage-sdist',
'bin/sage-location',
## Uncategorized scripts in alphabetical order
'bin/math-readline',
'bin/sage-env',
'bin/sage-env-config',
# sage-env-config.in -- not to be installed',
'bin/sage-gdb-commands',
'bin/sage-grep',
'bin/sage-grepdoc',
'bin/sage-inline-fortran',
'bin/sage-ipynb2rst',
'bin/sage-ipython',
'bin/sage-maxima.lisp',
'bin/sage-native-execute',
'bin/sage-notebook',
'bin/sage-num-threads.py',
'bin/sage-open',
'bin/sage-preparse',
'bin/sage-pypkg-location',
'bin/sage-python',
'bin/sage-rebase.bat',
'bin/sage-rebase.sh',
'bin/sage-rebaseall.bat',
'bin/sage-rebaseall.sh',
'bin/sage-rst2sws',
'bin/sage-rst2txt',
'bin/sage-run',
'bin/sage-run-cython',
'bin/sage-startuptime.py',
'bin/sage-sws2rst',
'bin/sage-update-src',
'bin/sage-update-version',
'bin/sage-upgrade',
],
cmdclass = dict(build=sage_build,
build_cython=sage_build_cython,
build_ext=sage_build_ext,
Expand Down

0 comments on commit ed49c85

Please sign in to comment.