summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Deegan <bill@baddogconsulting.com>2020-04-19 19:30:59 (GMT)
committerGitHub <noreply@github.com>2020-04-19 19:30:59 (GMT)
commit2cd7a523d39eeba5b29a824766fac71298736bb6 (patch)
treef05320e4e7773c34bdbcd546f5df51351f11c795
parentc69043c502044994840e246d8c4926a15b7d2bdb (diff)
parentb8e7b682e517be38bca130e094dafea4d273b4cf (diff)
downloadSCons-2cd7a523d39eeba5b29a824766fac71298736bb6.zip
SCons-2cd7a523d39eeba5b29a824766fac71298736bb6.tar.gz
SCons-2cd7a523d39eeba5b29a824766fac71298736bb6.tar.bz2
Merge branch 'master' into add_vswhere_variable
-rw-r--r--MANIFEST.in10
-rw-r--r--SConstruct972
-rw-r--r--bin/SConsDoc.py69
-rw-r--r--bin/docs-update-generated.py10
-rw-r--r--bin/scons-proc.py94
-rw-r--r--bin/scons-time.py (renamed from src/script/scons-time.py)220
-rwxr-xr-xbootstrap.py6
-rw-r--r--doc/SConscript184
-rw-r--r--doc/generated/functions.mod4
-rw-r--r--doc/generated/tools.mod6
-rw-r--r--doc/man/html.xsl8
-rw-r--r--doc/man/scons.xml664
-rw-r--r--doc/scons.mod2
-rw-r--r--doc/user/html.xsl9
-rw-r--r--doc/user/sconf.xml95
-rw-r--r--gentoo/scons.ebuild.in26
-rwxr-xr-xruntest.py98
-rw-r--r--scripts/MANIFEST.in (renamed from src/script/MANIFEST.in)0
-rw-r--r--scripts/scons-configure-cache.py95
-rw-r--r--scripts/scons.bat (renamed from src/script/scons.bat)0
-rwxr-xr-xscripts/scons.py102
-rw-r--r--scripts/sconsign.py93
-rw-r--r--setup.cfg66
-rw-r--r--setup.py25
-rw-r--r--site_scons/BuildCommandLine.py147
-rw-r--r--site_scons/epydoc.py100
-rw-r--r--site_scons/site_init.py13
-rwxr-xr-xsrc/CHANGES.txt7
-rw-r--r--src/LICENSE.txt22
-rw-r--r--src/engine/MANIFEST.in186
-rw-r--r--src/engine/SCons/Action.py2
-rw-r--r--src/engine/SCons/Action.xml102
-rw-r--r--src/engine/SCons/Defaults.xml11
-rw-r--r--src/engine/SCons/Environment.xml7
-rw-r--r--src/engine/SCons/Tool/MSCommon/common.py80
-rw-r--r--src/engine/SCons/Tool/applelink.xml6
-rw-r--r--src/engine/SCons/Tool/jar.xml2
-rw-r--r--src/engine/SCons/Tool/javac.xml2
-rw-r--r--src/engine/SCons/Tool/javah.xml17
-rw-r--r--src/engine/SCons/Tool/msvs.xml6
-rw-r--r--src/engine/SCons/Tool/packaging/__init__.xml38
-rw-r--r--src/engine/SCons/Utilities/ConfigureCache.py (renamed from src/script/scons-configure-cache.py)155
-rw-r--r--src/engine/SCons/Utilities/__init__.py (renamed from src/MANIFEST.in)0
-rw-r--r--src/engine/SCons/Utilities/sconsign.py (renamed from src/script/sconsign.py)377
-rwxr-xr-xsrc/script/scons.py208
-rw-r--r--src/setup.cfg8
-rwxr-xr-xsrc/setup.py520
-rw-r--r--test/Repository/Program.py2
-rw-r--r--test/Repository/StaticLibrary.py2
-rw-r--r--test/packaging/rpm/explicit-target.py2
-rw-r--r--test/scons-time/run/config/targets.py2
-rw-r--r--test/scons-time/run/option/quiet.py2
-rw-r--r--test/scons-time/run/option/verbose.py2
-rw-r--r--test/scons-time/run/subversion.py81
-rw-r--r--test/sconsign/script/SConsignFile.py1
-rw-r--r--testing/framework/TestSCons_time.py12
56 files changed, 1803 insertions, 3177 deletions
diff --git a/MANIFEST.in b/MANIFEST.in
new file mode 100644
index 0000000..c283957
--- /dev/null
+++ b/MANIFEST.in
@@ -0,0 +1,10 @@
+global-exclude **Tests.py
+
+recursive-include src/engine/SCons/Tool/docbook *
+
+# For license file
+include LICENSE
+
+
+
+
diff --git a/SConstruct b/SConstruct
index 23797da..4fdb401 100644
--- a/SConstruct
+++ b/SConstruct
@@ -31,100 +31,25 @@ month_year = 'December 2019'
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-import distutils.util
-import distutils.command
-import fnmatch
-import os
import os.path
-import re
-import stat
import sys
-import tempfile
-import time
-import socket
import textwrap
-import bootstrap
project = 'scons'
-default_version = '3.1.2'
+default_version = '3.9.9'
copyright = "Copyright (c) %s The SCons Foundation" % copyright_years
-SConsignFile()
-
#
# We let the presence or absence of various utilities determine whether
# or not we bother to build certain pieces of things. This should allow
# people to still do SCons packaging work even if they don't have all
# of the utilities installed
#
-gzip = whereis('gzip')
-git = os.path.exists('.git') and whereis('git')
-unzip = whereis('unzip')
-zip = whereis('zip')
-
-#
-# Now grab the information that we "build" into the files.
-#
-date = ARGUMENTS.get('DATE')
-if not date:
- date = time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime(int(os.environ.get('SOURCE_DATE_EPOCH', time.time()))))
-
-developer = ARGUMENTS.get('DEVELOPER')
-if not developer:
- for variable in ['USERNAME', 'LOGNAME', 'USER']:
- developer = os.environ.get(variable)
- if developer:
- break
- if os.environ.get('SOURCE_DATE_EPOCH'):
- developer = '_reproducible'
-
-build_system = ARGUMENTS.get('BUILD_SYSTEM')
-if not build_system:
- if os.environ.get('SOURCE_DATE_EPOCH'):
- build_system = '_reproducible'
- else:
- build_system = socket.gethostname().split('.')[0]
-
-version = ARGUMENTS.get('VERSION', '')
-if not version:
- version = default_version
-
-git_status_lines = []
-
-if git:
- cmd = "%s ls-files 2> /dev/null" % git
- with os.popen(cmd, "r") as p:
- git_status_lines = p.readlines()
-
-revision = ARGUMENTS.get('REVISION', '')
-def generate_build_id(revision):
- return revision
-
-if not revision and git:
- with os.popen("%s rev-parse HEAD 2> /dev/null" % git, "r") as p:
- git_hash = p.read().strip()
- def generate_build_id(revision):
- result = git_hash
- if [l for l in git_status_lines if 'modified' in l]:
- result = result + '[MODIFIED]'
- return result
- revision = git_hash
-
-checkpoint = ARGUMENTS.get('CHECKPOINT', '')
-if checkpoint:
- if checkpoint == 'd':
- checkpoint = time.strftime('%Y%m%d', time.localtime(time.time()))
- elif checkpoint == 'r':
- checkpoint = 'r' + revision
- version = version + '.beta.' + checkpoint
-
-build_id = ARGUMENTS.get('BUILD_ID')
-if build_id is None:
- if revision:
- build_id = generate_build_id(revision)
- else:
- build_id = ''
+print("git :%s"%git)
+print("gzip :%s"%gzip)
+print("unzip :%s"%unzip)
+print("zip :%s"%zip_path)
#
# Adding some paths to sys.path, this is mainly needed
@@ -136,87 +61,38 @@ for a in addpaths:
if a not in sys.path:
sys.path.append(a)
+# Use site_scons logic to process command line arguments
+command_line = BuildCommandLine(default_version)
+command_line.process_command_line_vars()
-# Re-exporting LD_LIBRARY_PATH is necessary if the Python version was
-# built with the --enable-shared option.
-
-ENV = { 'PATH' : os.environ['PATH'] }
-for key in ['LOGNAME', 'PYTHONPATH', 'LD_LIBRARY_PATH']:
- if key in os.environ:
- ENV[key] = os.environ[key]
-
-build_dir = ARGUMENTS.get('BUILDDIR', 'build')
-if not os.path.isabs(build_dir):
- build_dir = os.path.normpath(os.path.join(os.getcwd(), build_dir))
-
-command_line_variables = [
- ("BUILDDIR=", "The directory in which to build the packages. " +
- "The default is the './build' subdirectory."),
-
- ("BUILD_ID=", "An identifier for the specific build." +
- "The default is the Subversion revision number."),
-
- ("BUILD_SYSTEM=", "The system on which the packages were built. " +
- "The default is whatever hostname is returned " +
- "by socket.gethostname(). If SOURCE_DATE_EPOCH " +
- "env var is set, '_reproducible' is the default."),
-
- ("CHECKPOINT=", "The specific checkpoint release being packaged, " +
- "which will be appended to the VERSION string. " +
- "A value of CHECKPOINT=d will generate a string " +
- "of 'd' plus today's date in the format YYYMMDD. " +
- "A value of CHECKPOINT=r will generate a " +
- "string of 'r' plus the Subversion revision " +
- "number. Any other CHECKPOINT= string will be " +
- "used as is. There is no default value."),
-
- ("DATE=", "The date string representing when the packaging " +
- "build occurred. The default is the day and time " +
- "the SConstruct file was invoked, in the format " +
- "YYYY/MM/DD HH:MM:SS."),
- ("DEVELOPER=", "The developer who created the packages. " +
- "The default is the first set environment " +
- "variable from the list $USERNAME, $LOGNAME, $USER." +
- "If the SOURCE_DATE_EPOCH env var is set, " +
- "'_reproducible' is the default."),
-
- ("REVISION=", "The revision number of the source being built. " +
- "The default is the git hash returned " +
- "'git rev-parse HEAD', with an appended string of " +
- "'[MODIFIED]' if there are any changes in the " +
- "working copy."),
-
- ("VERSION=", "The SCons version being packaged. The default " +
- "is the hard-coded value '%s' " % default_version +
- "from this SConstruct file."),
-
-]
+Default('.', command_line.build_dir)
+# Just make copies, don't symlink them.
+SetOption('duplicate', 'copy')
-Default('.', build_dir)
packaging_flavors = [
- ('tar-gz', "The normal .tar.gz file for end-user installation."),
- ('local-tar-gz', "A .tar.gz file for dropping into other software " +
- "for local use."),
- ('zip', "The normal .zip file for end-user installation."),
- ('local-zip', "A .zip file for dropping into other software " +
- "for local use."),
- ('src-tar-gz', "A .tar.gz file containing all the source " +
- "(including tests and documentation)."),
- ('src-zip', "A .zip file containing all the source " +
- "(including tests and documentation)."),
+ ('tar-gz', "The normal .tar.gz file for end-user installation."),
+ ('local-tar-gz', "A .tar.gz file for dropping into other software " +
+ "for local use."),
+ ('zip', "The normal .zip file for end-user installation."),
+ ('local-zip', "A .zip file for dropping into other software " +
+ "for local use."),
+ ('src-tar-gz', "A .tar.gz file containing all the source " +
+ "(including tests and documentation)."),
+ ('src-zip', "A .zip file containing all the source " +
+ "(including tests and documentation)."),
]
-test_tar_gz_dir = os.path.join(build_dir, "test-tar-gz")
-test_src_tar_gz_dir = os.path.join(build_dir, "test-src-tar-gz")
-test_local_tar_gz_dir = os.path.join(build_dir, "test-local-tar-gz")
-test_zip_dir = os.path.join(build_dir, "test-zip")
-test_src_zip_dir = os.path.join(build_dir, "test-src-zip")
-test_local_zip_dir = os.path.join(build_dir, "test-local-zip")
+test_tar_gz_dir = os.path.join(command_line.build_dir, "test-tar-gz")
+test_src_tar_gz_dir = os.path.join(command_line.build_dir, "test-src-tar-gz")
+test_local_tar_gz_dir = os.path.join(command_line.build_dir, "test-local-tar-gz")
+test_zip_dir = os.path.join(command_line.build_dir, "test-zip")
+test_src_zip_dir = os.path.join(command_line.build_dir, "test-src-zip")
+test_local_zip_dir = os.path.join(command_line.build_dir, "test-local-zip")
-unpack_tar_gz_dir = os.path.join(build_dir, "unpack-tar-gz")
-unpack_zip_dir = os.path.join(build_dir, "unpack-zip")
+unpack_tar_gz_dir = os.path.join(command_line.build_dir, "unpack-tar-gz")
+unpack_zip_dir = os.path.join(command_line.build_dir, "unpack-zip")
if is_windows():
tar_hflag = ''
@@ -227,9 +103,6 @@ else:
python_project_subinst_dir = os.path.join("lib", project)
project_script_subinst_dir = 'bin'
-
-
-
indent_fmt = ' %-26s '
Help("""\
@@ -243,9 +116,9 @@ aliases = sorted(packaging_flavors + [('doc', 'The SCons documentation.')])
for alias, help_text in aliases:
tw = textwrap.TextWrapper(
- width = 78,
- initial_indent = indent_fmt % alias,
- subsequent_indent = indent_fmt % '' + ' ',
+ width=78,
+ initial_indent=indent_fmt % alias,
+ subsequent_indent=indent_fmt % '' + ' ',
)
Help(tw.fill(help_text) + '\n')
@@ -254,776 +127,69 @@ The following command-line variables can be set:
""")
-for variable, help_text in command_line_variables:
+for variable, help_text in command_line.command_line_variables:
tw = textwrap.TextWrapper(
- width = 78,
- initial_indent = indent_fmt % variable,
- subsequent_indent = indent_fmt % '' + ' ',
+ width=78,
+ initial_indent=indent_fmt % variable,
+ subsequent_indent=indent_fmt % '' + ' ',
)
Help(tw.fill(help_text) + '\n')
-
-
-
revaction = SCons_revision
-revbuilder = Builder(action = Action(SCons_revision,
- varlist=['COPYRIGHT', 'VERSION']))
-
+revbuilder = Builder(action=Action(SCons_revision,
+ varlist=['COPYRIGHT', 'VERSION']))
-# Just make copies, don't symlink them.
-SetOption('duplicate', 'copy')
env = Environment(
- ENV = ENV,
-
- BUILD = build_id,
- BUILDDIR = build_dir,
- BUILDSYS = build_system,
- COPYRIGHT = copyright,
- DATE = date,
- DEB_DATE = deb_date,
- DEVELOPER = developer,
- DISTDIR = os.path.join(build_dir, 'dist'),
- MONTH_YEAR = month_year,
- REVISION = revision,
- VERSION = version,
-
- TAR_HFLAG = tar_hflag,
-
- ZIP = zip,
- ZIPFLAGS = '-r',
- UNZIP = unzip,
- UNZIPFLAGS = '-o -d $UNPACK_ZIP_DIR',
-
- ZCAT = zcat,
-
- TEST_SRC_TAR_GZ_DIR = test_src_tar_gz_dir,
- TEST_SRC_ZIP_DIR = test_src_zip_dir,
- TEST_TAR_GZ_DIR = test_tar_gz_dir,
- TEST_ZIP_DIR = test_zip_dir,
-
- UNPACK_TAR_GZ_DIR = unpack_tar_gz_dir,
- UNPACK_ZIP_DIR = unpack_zip_dir,
-
- BUILDERS = { 'SCons_revision' : revbuilder,
- 'SOElim' : soelimbuilder },
-
- PYTHON = '"%s"' % sys.executable,
- PYTHONFLAGS = '-tt',
- )
-
-Version_values = [Value(version), Value(build_id)]
-
-#
-# Define SCons packages.
-#
-# In the original, more complicated packaging scheme, we were going
-# to have separate packages for:
-#
-# python-scons only the build engine
-# scons-script only the script
-# scons the script plus the build engine
-#
-# We're now only delivering a single "scons" package, but this is still
-# "built" as two sub-packages (the build engine and the script), so
-# the definitions remain here, even though we're not using them for
-# separate packages.
-#
-
-from distutils.sysconfig import get_python_lib
-
-
-python_scons = {
- 'pkg' : 'python-' + project,
- 'src_subdir' : 'engine',
- 'inst_subdir' : get_python_lib(),
-
- 'debian_deps' : [
- 'debian/changelog',
- 'debian/compat',
- 'debian/control',
- 'debian/copyright',
- 'debian/dirs',
- 'debian/docs',
- 'debian/postinst',
- 'debian/prerm',
- 'debian/rules',
- ],
-
- 'files' : [ 'LICENSE.txt',
- 'README.txt',
- 'setup.cfg',
- 'setup.py',
- ],
-
- 'filemap' : {
- 'LICENSE.txt' : '../LICENSE.txt'
- },
-
- 'buildermap' : {},
-
- 'explicit_deps' : {
- 'SCons/__init__.py' : Version_values,
- },
-}
-
-
-scons_script = {
- 'pkg' : project + '-script',
- 'src_subdir' : 'script',
- 'inst_subdir' : 'bin',
-
- 'debian_deps' : [
- 'debian/changelog',
- 'debian/compat',
- 'debian/control',
- 'debian/copyright',
- 'debian/dirs',
- 'debian/docs',
- 'debian/postinst',
- 'debian/prerm',
- 'debian/rules',
- ],
-
- 'files' : [
- 'LICENSE.txt',
- 'README.txt',
- 'setup.cfg',
- 'setup.py',
- ],
-
- 'filemap' : {
- 'LICENSE.txt' : '../LICENSE.txt',
- 'scons' : 'scons.py',
- 'sconsign' : 'sconsign.py',
- 'scons-time' : 'scons-time.py',
- 'scons-configure-cache' : 'scons-configure-cache.py',
- },
-
- 'buildermap' : {},
-
- 'explicit_deps' : {
- 'scons' : Version_values,
- 'sconsign' : Version_values,
- },
-}
-
-scons = {
- 'pkg' : project,
-
- 'debian_deps' : [
- 'debian/changelog',
- 'debian/compat',
- 'debian/control',
- 'debian/copyright',
- 'debian/dirs',
- 'debian/docs',
- 'debian/postinst',
- 'debian/prerm',
- 'debian/rules',
- ],
-
- 'files' : [
- 'CHANGES.txt',
- 'LICENSE.txt',
- 'README.txt',
- 'RELEASE.txt',
- 'scons.1',
- 'sconsign.1',
- 'scons-time.1',
- 'script/scons.bat',
- 'setup.cfg',
- 'setup.py',
- ],
-
- 'filemap' : {
- 'scons.1' : '$BUILDDIR/doc/man/scons.1',
- 'sconsign.1' : '$BUILDDIR/doc/man/sconsign.1',
- 'scons-time.1' : '$BUILDDIR/doc/man/scons-time.1',
- },
-
- 'buildermap' : {
- 'scons.1' : env.SOElim,
- 'sconsign.1' : env.SOElim,
- 'scons-time.1' : env.SOElim,
- },
-
- 'subpkgs' : [ python_scons, scons_script ],
-
- 'subinst_dirs' : {
- 'python-' + project : python_project_subinst_dir,
- project + '-script' : project_script_subinst_dir,
- },
-}
-
-scripts = ['scons', 'sconsign', 'scons-time', 'scons-configure-cache']
-
-src_deps = []
-src_files = []
-
-for p in [ scons ]:
- #
- # Initialize variables with the right directories for this package.
- #
- pkg = p['pkg']
- pkg_version = "%s-%s" % (pkg, version)
-
- src = 'src'
- if 'src_subdir' in p:
- src = os.path.join(src, p['src_subdir'])
-
- build = os.path.join(build_dir, pkg)
-
- tar_gz = os.path.join(build, 'dist', "%s.tar.gz" % pkg_version)
- platform_tar_gz = os.path.join(build,
- 'dist',
- "%s.%s.tar.gz" % (pkg_version, platform))
- zip = os.path.join(build, 'dist', "%s.zip" % pkg_version)
- platform_zip = os.path.join(build,
- 'dist',
- "%s.%s.zip" % (pkg_version, platform))
-
+ ENV=command_line.ENV,
- #
- # Update the environment with the relevant information
- # for this package.
- #
- # We can get away with calling setup.py using a directory path
- # like this because we put a preamble in it that will chdir()
- # to the directory in which setup.py exists.
- #
- setup_py = os.path.join(build, 'setup.py')
- env.Replace(PKG = pkg,
- PKG_VERSION = pkg_version,
- SETUP_PY = '"%s"' % setup_py)
- Local(setup_py)
+ BUILD=command_line.build_id,
+ BUILDDIR=command_line.build_dir,
+ BUILDSYS=command_line.build_system,
+ COPYRIGHT=copyright,
+ DATE=command_line.date,
+ DEB_DATE=deb_date,
- #
- # Read up the list of source files from our MANIFEST.in.
- # This list should *not* include LICENSE.txt, MANIFEST,
- # README.txt, or setup.py. Make a copy of the list for the
- # destination files.
- #
- manifest_in = File(os.path.join(src, 'MANIFEST.in')).rstr()
- src_files = bootstrap.parseManifestLines(src, manifest_in)
- raw_files = src_files[:]
- dst_files = src_files[:]
+ DEVELOPER=command_line.developer,
+ DISTDIR=os.path.join(command_line.build_dir, 'dist'),
+ MONTH_YEAR=month_year,
+ REVISION=command_line.revision,
+ VERSION=command_line.version,
- MANIFEST_in_list = []
+ TAR_HFLAG=tar_hflag,
+ ZIP=zip_path,
+ ZIPFLAGS='-r',
+ UNZIP=unzip,
+ UNZIPFLAGS='-o -d $UNPACK_ZIP_DIR',
- if 'subpkgs' in p:
- #
- # This package includes some sub-packages. Read up their
- # MANIFEST.in files, and add them to our source and destination
- # file lists, modifying them as appropriate to add the
- # specified subdirs.
- #
- for sp in p['subpkgs']:
- ssubdir = sp['src_subdir']
- isubdir = p['subinst_dirs'][sp['pkg']]
+ ZCAT=zcat,
- MANIFEST_in = File(os.path.join(src, ssubdir, 'MANIFEST.in')).rstr()
- MANIFEST_in_list.append(MANIFEST_in)
- files = bootstrap.parseManifestLines(os.path.join(src, ssubdir), MANIFEST_in)
+ TEST_SRC_TAR_GZ_DIR=test_src_tar_gz_dir,
+ TEST_SRC_ZIP_DIR=test_src_zip_dir,
+ TEST_TAR_GZ_DIR=test_tar_gz_dir,
+ TEST_ZIP_DIR=test_zip_dir,
- raw_files.extend(files)
- src_files.extend([os.path.join(ssubdir, x) for x in files])
+ UNPACK_TAR_GZ_DIR=unpack_tar_gz_dir,
+ UNPACK_ZIP_DIR=unpack_zip_dir,
- files = [os.path.join(isubdir, x) for x in files]
- dst_files.extend(files)
- for k, f in sp['filemap'].items():
- if f:
- k = os.path.join(ssubdir, k)
- p['filemap'][k] = os.path.join(ssubdir, f)
- for f, deps in sp['explicit_deps'].items():
- f = os.path.join(build, ssubdir, f)
- env.Depends(f, deps)
+ BUILDERS={'SCons_revision': revbuilder,
+ 'SOElim': soelimbuilder},
- #
- # Now that we have the "normal" source files, add those files
- # that are standard for each distribution. Note that we don't
- # add these to dst_files, because they don't get installed.
- # And we still have the MANIFEST to add.
- #
- src_files.extend(p['files'])
+ PYTHON='"%s"' % sys.executable,
+ PYTHONFLAGS='-tt',
+)
- #
- # Now run everything in src_file through the sed command we
- # concocted to expand __FILE__, __VERSION__, etc.
- #
- for b in src_files:
- s = p['filemap'].get(b, b)
- if not s[0] == '$' and not os.path.isabs(s):
- s = os.path.join(src, s)
+Version_values = [Value(command_line.version), Value(command_line.build_id)]
- builder = p['buildermap'].get(b, env.SCons_revision)
- x = builder(os.path.join(build, b), s)
- Local(x)
-
- #
- # NOW, finally, we can create the MANIFEST, which we do
- # by having Python spit out the contents of the src_files
- # array we've carefully created. After we've added
- # MANIFEST itself to the array, of course.
- #
- src_files.append("MANIFEST")
- MANIFEST_in_list.append(os.path.join(src, 'MANIFEST.in'))
-
- def write_src_files(target, source, **kw):
- global src_files
- src_files.sort()
- with open(str(target[0]), 'w') as f:
- for file in src_files:
- f.write(file + "\n")
- return 0
- env.Command(os.path.join(build, 'MANIFEST'),
- MANIFEST_in_list,
- write_src_files)
-
- #
- # Now go through and arrange to create whatever packages we can.
- #
- build_src_files = [os.path.join(build, x) for x in src_files]
- Local(*build_src_files)
-
- distutils_formats = []
- distutils_targets = []
- dist_distutils_targets = []
-
- for target in distutils_targets:
- dist_target = env.Install('$DISTDIR', target)
- AddPostAction(dist_target, Chmod(dist_target, 0o644))
- dist_distutils_targets += dist_target
-
- if not gzip:
- print("gzip not found in %s; skipping .tar.gz package for %s." % (os.environ['PATH'], pkg))
- else:
-
- distutils_formats.append('gztar')
-
- src_deps.append(tar_gz)
-
- distutils_targets.extend([ tar_gz, platform_tar_gz ])
-
- dist_tar_gz = env.Install('$DISTDIR', tar_gz)
- dist_platform_tar_gz = env.Install('$DISTDIR', platform_tar_gz)
- Local(dist_tar_gz, dist_platform_tar_gz)
- AddPostAction(dist_tar_gz, Chmod(dist_tar_gz, 0o644))
- AddPostAction(dist_platform_tar_gz, Chmod(dist_platform_tar_gz, 0o644))
-
- #
- # Unpack the tar.gz archive created by the distutils into
- # build/unpack-tar-gz/scons-{version}.
- #
- # We'd like to replace the last three lines with the following:
- #
- # tar zxf $SOURCES -C $UNPACK_TAR_GZ_DIR
- #
- # but that gives heartburn to Cygwin's tar, so work around it
- # with separate zcat-tar-rm commands.
- #
- unpack_tar_gz_files = [os.path.join(unpack_tar_gz_dir, pkg_version, x)
- for x in src_files]
- env.Command(unpack_tar_gz_files, dist_tar_gz, [
- Delete(os.path.join(unpack_tar_gz_dir, pkg_version)),
- "$ZCAT $SOURCES > .temp",
- "tar xf .temp -C $UNPACK_TAR_GZ_DIR",
- Delete(".temp"),
- ])
-
- #
- # Run setup.py in the unpacked subdirectory to "install" everything
- # into our build/test subdirectory. The runtest.py script will set
- # PYTHONPATH so that the tests only look under build/test-{package},
- # and under testing/framework (for the testing modules TestCmd.py, TestSCons.py,
- # etc.). This makes sure that our tests pass with what
- # we really packaged, not because of something hanging around in
- # the development directory.
- #
- # We can get away with calling setup.py using a directory path
- # like this because we put a preamble in it that will chdir()
- # to the directory in which setup.py exists.
- #
- dfiles = [os.path.join(test_tar_gz_dir, x) for x in dst_files]
- env.Command(dfiles, unpack_tar_gz_files, [
- Delete(os.path.join(unpack_tar_gz_dir, pkg_version, 'build')),
- Delete("$TEST_TAR_GZ_DIR"),
- '$PYTHON $PYTHONFLAGS "%s" install "--prefix=$TEST_TAR_GZ_DIR" --standalone-lib' % \
- os.path.join(unpack_tar_gz_dir, pkg_version, 'setup.py'),
- ])
-
- #
- # Generate portage files for submission to Gentoo Linux.
- #
- gentoo = os.path.join(build, 'gentoo')
- ebuild = os.path.join(gentoo, 'scons-%s.ebuild' % version)
- digest = os.path.join(gentoo, 'files', 'digest-scons-%s' % version)
- env.Command(ebuild, os.path.join('gentoo', 'scons.ebuild.in'), SCons_revision)
-
- def Digestify(target, source, env):
- import hashlib
- src = source[0].rfile()
- with open(str(src),'rb') as f:
- contents = f.read()
- m = hashlib.md5()
- m.update(contents)
- sig = m.hexdigest()
- bytes = os.stat(str(src))[6]
- with open(str(target[0]), 'w') as f:
- f.write("MD5 %s %s %d\n" % (sig, src.name, bytes))
- env.Command(digest, tar_gz, Digestify)
-
- if not zipit:
- print("zip not found; skipping .zip package for %s." % pkg)
- else:
-
- distutils_formats.append('zip')
-
- src_deps.append(zip)
-
- distutils_targets.extend([ zip, platform_zip ])
-
- dist_zip = env.Install('$DISTDIR', zip)
- dist_platform_zip = env.Install('$DISTDIR', platform_zip)
- Local(dist_zip, dist_platform_zip)
- AddPostAction(dist_zip, Chmod(dist_zip, 0o644))
- AddPostAction(dist_platform_zip, Chmod(dist_platform_zip, 0o644))
-
- #
- # Unpack the zip archive created by the distutils into
- # build/unpack-zip/scons-{version}.
- #
- unpack_zip_files = [os.path.join(unpack_zip_dir, pkg_version, x)
- for x in src_files]
-
- env.Command(unpack_zip_files, dist_zip, [
- Delete(os.path.join(unpack_zip_dir, pkg_version)),
- unzipit,
- ])
-
- #
- # Run setup.py in the unpacked subdirectory to "install" everything
- # into our build/test subdirectory. The runtest.py script will set
- # PYTHONPATH so that the tests only look under build/test-{package},
- # and under testing/framework (for the testing modules TestCmd.py, TestSCons.py,
- # etc.). This makes sure that our tests pass with what
- # we really packaged, not because of something hanging around in
- # the development directory.
- #
- # We can get away with calling setup.py using a directory path
- # like this because we put a preamble in it that will chdir()
- # to the directory in which setup.py exists.
- #
- dfiles = [os.path.join(test_zip_dir, x) for x in dst_files]
- env.Command(dfiles, unpack_zip_files, [
- Delete(os.path.join(unpack_zip_dir, pkg_version, 'build')),
- Delete("$TEST_ZIP_DIR"),
- '$PYTHON $PYTHONFLAGS "%s" install "--prefix=$TEST_ZIP_DIR" --standalone-lib' % \
- os.path.join(unpack_zip_dir, pkg_version, 'setup.py'),
- ])
-
-
-
- #
- # Use the Python distutils to generate the appropriate packages.
- #
- commands = [
- Delete(os.path.join(build, 'build', 'lib')),
- Delete(os.path.join(build, 'build', 'scripts')),
- ]
-
- if distutils_formats:
- commands.append(Delete(os.path.join(build,
- 'build',
- 'bdist.' + platform,
- 'dumb')))
- for format in distutils_formats:
- commands.append("$PYTHON $PYTHONFLAGS $SETUP_PY bdist_dumb -f %s" % format)
-
- commands.append("$PYTHON $PYTHONFLAGS $SETUP_PY sdist --formats=%s" % \
- ','.join(distutils_formats))
-
- env.Command(distutils_targets, build_src_files, commands)
-
- #
- # Now create local packages for people who want to let people
- # build their SCons-buildable packages without having to
- # install SCons.
- #
- s_l_v = '%s-local-%s' % (pkg, version)
-
- local = pkg + '-local'
- build_dir_local = os.path.join(build_dir, local)
- build_dir_local_slv = os.path.join(build_dir, local, s_l_v)
-
- dist_local_tar_gz = os.path.join("$DISTDIR/%s.tar.gz" % s_l_v)
- dist_local_zip = os.path.join("$DISTDIR/%s.zip" % s_l_v)
- AddPostAction(dist_local_tar_gz, Chmod(dist_local_tar_gz, 0o644))
- AddPostAction(dist_local_zip, Chmod(dist_local_zip, 0o644))
-
- commands = [
- Delete(build_dir_local),
- '$PYTHON $PYTHONFLAGS $SETUP_PY install "--install-script=%s" "--install-lib=%s" --no-install-man --no-compile --standalone-lib --no-version-script' % \
- (build_dir_local, build_dir_local_slv),
- ]
-
- for script in scripts:
- # add .py extension for scons-local scripts on non-windows platforms
- if is_windows():
- break
- local_script = os.path.join(build_dir_local, script)
- commands.append(Move(local_script + '.py', local_script))
-
- rf = [x for x in raw_files if not x in scripts]
- rf = [os.path.join(s_l_v, x) for x in rf]
- for script in scripts:
- rf.append("%s.py" % script)
- local_targets = [os.path.join(build_dir_local, x) for x in rf]
-
- env.Command(local_targets, build_src_files, commands)
-
- scons_LICENSE = os.path.join(build_dir_local, 'scons-LICENSE')
- l = env.SCons_revision(scons_LICENSE, 'LICENSE-local')
- local_targets.append(l)
- Local(l)
-
- scons_README = os.path.join(build_dir_local, 'scons-README')
- l = env.SCons_revision(scons_README, 'README-local')
- local_targets.append(l)
- Local(l)
-
- if gzip:
- if is_windows():
- # avoid problem with tar interpreting c:/ as a remote machine
- tar_cargs = '-cz --force-local -f'
- else:
- tar_cargs = '-czf'
- env.Command(dist_local_tar_gz,
- local_targets,
- "cd %s && tar %s $( ${TARGET.abspath} $) *" % (build_dir_local, tar_cargs))
-
- unpack_targets = [os.path.join(test_local_tar_gz_dir, x) for x in rf]
- commands = [Delete(test_local_tar_gz_dir),
- Mkdir(test_local_tar_gz_dir),
- "cd %s && tar xzf $( ${SOURCE.abspath} $)" % test_local_tar_gz_dir]
-
- env.Command(unpack_targets, dist_local_tar_gz, commands)
-
- if zipit:
- env.Command(dist_local_zip, local_targets, zipit,
- CD = build_dir_local, PSV = '.')
-
- unpack_targets = [os.path.join(test_local_zip_dir, x) for x in rf]
- commands = [Delete(test_local_zip_dir),
- Mkdir(test_local_zip_dir),
- unzipit]
-
- env.Command(unpack_targets, dist_local_zip, unzipit,
- UNPACK_ZIP_DIR = test_local_zip_dir)
-
-#
#
#
-Export('build_dir', 'env')
-
-SConscript('testing/framework/SConscript')
-
-#
#
#
-sp = env.Install(build_dir, 'runtest.py')
-Local(sp)
-files = [
- 'runtest.py',
-]
-
-
-#
# Documentation.
#
-Export('build_dir', 'env', 'whereis', 'revaction')
+Export('command_line', 'env', 'whereis', 'revaction')
SConscript('doc/SConscript')
-#
-# If we're running in a Git working directory, pack up a complete
-# source archive from the project files and files in the change.
-#
-
-
-sfiles = [l.split()[-1] for l in git_status_lines]
-if git_status_lines:
- # slines = [l for l in git_status_lines if 'modified:' in l]
- # sfiles = [l.split()[-1] for l in slines]
- pass
-else:
- print("Not building in a Git tree; skipping building src package.")
-
-if sfiles:
- remove_patterns = [
- '*.gitignore',
- '*.hgignore',
- 'www/*',
- ]
-
- for p in remove_patterns:
- sfiles = [s for s in sfiles if not fnmatch.fnmatch(s, p)]
-
- if sfiles:
- ps = "%s-src" % project
- psv = "%s-%s" % (ps, version)
- b_ps = os.path.join(build_dir, ps)
- b_psv = os.path.join(build_dir, psv)
- b_psv_stamp = b_psv + '-stamp'
-
- src_tar_gz = os.path.join(build_dir, 'dist', '%s.tar.gz' % psv)
- src_zip = os.path.join(build_dir, 'dist', '%s.zip' % psv)
-
- Local(src_tar_gz, src_zip)
-
- for file in sfiles:
- if file.endswith('jpg') or file.endswith('png'):
- # don't revision binary files.
- env.Install(os.path.dirname(os.path.join(b_ps,file)), file)
- else:
- env.SCons_revision(os.path.join(b_ps, file), file)
-
- b_ps_files = [os.path.join(b_ps, x) for x in sfiles]
- cmds = [
- Delete(b_psv),
- Copy(b_psv, b_ps),
- Touch("$TARGET"),
- ]
-
- env.Command(b_psv_stamp, src_deps + b_ps_files, cmds)
-
- Local(*b_ps_files)
-
- if gzip:
-
- env.Command(src_tar_gz, b_psv_stamp,
- "tar cz${TAR_HFLAG} -f $TARGET -C build %s" % psv)
-
- #
- # Unpack the archive into build/unpack/scons-{version}.
- #
- unpack_tar_gz_files = [os.path.join(unpack_tar_gz_dir, psv, x)
- for x in sfiles]
-
- #
- # We'd like to replace the last three lines with the following:
- #
- # tar zxf $SOURCES -C $UNPACK_TAR_GZ_DIR
- #
- # but that gives heartburn to Cygwin's tar, so work around it
- # with separate zcat-tar-rm commands.
- env.Command(unpack_tar_gz_files, src_tar_gz, [
- Delete(os.path.join(unpack_tar_gz_dir, psv)),
- "$ZCAT $SOURCES > .temp",
- "tar xf .temp -C $UNPACK_TAR_GZ_DIR",
- Delete(".temp"),
- ])
-
- #
- # Run setup.py in the unpacked subdirectory to "install" everything
- # into our build/test subdirectory. The runtest.py script will set
- # PYTHONPATH so that the tests only look under build/test-{package},
- # and under testing/framework (for the testing modules TestCmd.py,
- # TestSCons.py, etc.). This makes sure that our tests pass with
- # what we really packaged, not because of something hanging around
- # in the development directory.
- #
- # We can get away with calling setup.py using a directory path
- # like this because we put a preamble in it that will chdir()
- # to the directory in which setup.py exists.
- #
- dfiles = [os.path.join(test_src_tar_gz_dir, x) for x in dst_files]
- scons_lib_dir = os.path.join(unpack_tar_gz_dir, psv, 'src', 'engine')
- ENV = env.Dictionary('ENV').copy()
- ENV['SCONS_LIB_DIR'] = scons_lib_dir
- ENV['USERNAME'] = developer
- env.Command(dfiles, unpack_tar_gz_files,
- [
- Delete(os.path.join(unpack_tar_gz_dir,
- psv,
- 'build',
- 'scons',
- 'build')),
- Delete("$TEST_SRC_TAR_GZ_DIR"),
- 'cd "%s" && $PYTHON $PYTHONFLAGS "%s" "%s" VERSION="$VERSION"' % \
- (os.path.join(unpack_tar_gz_dir, psv),
- os.path.join('src', 'script', 'scons.py'),
- os.path.join('build', 'scons')),
- '$PYTHON $PYTHONFLAGS "%s" install "--prefix=$TEST_SRC_TAR_GZ_DIR" --standalone-lib' % \
- os.path.join(unpack_tar_gz_dir,
- psv,
- 'build',
- 'scons',
- 'setup.py'),
- ],
- ENV = ENV)
-
- if zipit:
-
- env.Command(src_zip, b_psv_stamp, zipit, CD = 'build', PSV = psv)
-
- #
- # Unpack the archive into build/unpack/scons-{version}.
- #
- unpack_zip_files = [os.path.join(unpack_zip_dir, psv, x)
- for x in sfiles]
-
- env.Command(unpack_zip_files, src_zip, [
- Delete(os.path.join(unpack_zip_dir, psv)),
- unzipit
- ])
-
- #
- # Run setup.py in the unpacked subdirectory to "install" everything
- # into our build/test subdirectory. The runtest.py script will set
- # PYTHONPATH so that the tests only look under build/test-{package},
- # and under testing/framework (for the testing modules TestCmd.py,
- # TestSCons.py, etc.). This makes sure that our tests pass with
- # what we really packaged, not because of something hanging
- # around in the development directory.
- #
- # We can get away with calling setup.py using a directory path
- # like this because we put a preamble in it that will chdir()
- # to the directory in which setup.py exists.
- #
- dfiles = [os.path.join(test_src_zip_dir, x) for x in dst_files]
- scons_lib_dir = os.path.join(unpack_zip_dir, psv, 'src', 'engine')
- ENV = env.Dictionary('ENV').copy()
- ENV['SCONS_LIB_DIR'] = scons_lib_dir
- ENV['USERNAME'] = developer
- env.Command(dfiles, unpack_zip_files,
- [
- Delete(os.path.join(unpack_zip_dir,
- psv,
- 'build',
- 'scons',
- 'build')),
- Delete("$TEST_SRC_ZIP_DIR"),
- 'cd "%s" && $PYTHON $PYTHONFLAGS "%s" "%s" VERSION="$VERSION"' % \
- (os.path.join(unpack_zip_dir, psv),
- os.path.join('src', 'script', 'scons.py'),
- os.path.join('build', 'scons')),
- '$PYTHON $PYTHONFLAGS "%s" install "--prefix=$TEST_SRC_ZIP_DIR" --standalone-lib' % \
- os.path.join(unpack_zip_dir,
- psv,
- 'build',
- 'scons',
- 'setup.py'),
- ],
- ENV = ENV)
-
-for pf, help_text in packaging_flavors:
- Alias(pf, [
- os.path.join(build_dir, 'test-'+pf),
- os.path.join(build_dir, 'testing/framework'),
- os.path.join(build_dir, 'runtest.py'),
- ])
-
-
diff --git a/bin/SConsDoc.py b/bin/SConsDoc.py
index e560a44..e211b3c 100644
--- a/bin/SConsDoc.py
+++ b/bin/SConsDoc.py
@@ -114,8 +114,7 @@ import os.path
import re
import sys
import copy
-
-PY2 = sys.version_info[0] == 2
+import importlib
# Do we have libxml2/libxslt/lxml?
has_libxml2 = True
@@ -312,20 +311,14 @@ if not has_libxml2:
@staticmethod
def writeGenTree(root, fp):
dt = DoctypeDeclaration()
- try:
- encfun = unicode # PY2
- except NameError:
- encfun = str
+ encfun = str
fp.write(etree.tostring(root, encoding=encfun,
pretty_print=True,
doctype=dt.createDoctype()))
@staticmethod
def writeTree(root, fpath):
- try:
- encfun = unicode # PY2
- except NameError:
- encfun = "utf-8"
+ encfun = "utf-8"
with open(fpath, 'wb') as fp:
fp.write(etree.tostring(root, encoding=encfun,
pretty_print=True))
@@ -859,45 +852,23 @@ class SConsDocHandler(object):
# Parse it
self.parseDomtree(t.root, t.xpath_context, t.nsmap)
-# lifted from Ka-Ping Yee's way cool pydoc module.
-if PY2:
- def importfile(path):
- """Import a Python source file or compiled file given its path."""
- import imp
- magic = imp.get_magic()
- with open(path, 'r') as ifp:
- if ifp.read(len(magic)) == magic:
- kind = imp.PY_COMPILED
- else:
- kind = imp.PY_SOURCE
- filename = os.path.basename(path)
- name, ext = os.path.splitext(filename)
- with open(path, 'r') as ifp:
- try:
- module = imp.load_module(name, ifp, path, (ext, 'r', kind))
- except ImportError as e:
- sys.stderr.write("Could not import %s: %s\n" % (path, e))
- return None
- return module
-
-else: # PY3 version, from newer pydoc
- def importfile(path):
- """Import a Python source file or compiled file given its path."""
- from importlib.util import MAGIC_NUMBER
- with open(path, 'rb') as ifp:
- is_bytecode = MAGIC_NUMBER == ifp.read(len(MAGIC_NUMBER))
- filename = os.path.basename(path)
- name, ext = os.path.splitext(filename)
- if is_bytecode:
- loader = importlib._bootstrap_external.SourcelessFileLoader(name, path)
- else:
- loader = importlib._bootstrap_external.SourceFileLoader(name, path)
- # XXX We probably don't need to pass in the loader here.
- spec = importlib.util.spec_from_file_location(name, path, loader=loader)
- try:
- return importlib._bootstrap._load(spec)
- except ImportError:
- raise ErrorDuringImport(path, sys.exc_info())
+def importfile(path):
+ """Import a Python source file or compiled file given its path."""
+ from importlib.util import MAGIC_NUMBER
+ with open(path, 'rb') as ifp:
+ is_bytecode = MAGIC_NUMBER == ifp.read(len(MAGIC_NUMBER))
+ filename = os.path.basename(path)
+ name, ext = os.path.splitext(filename)
+ if is_bytecode:
+ loader = importlib._bootstrap_external.SourcelessFileLoader(name, path)
+ else:
+ loader = importlib._bootstrap_external.SourceFileLoader(name, path)
+ # XXX We probably don't need to pass in the loader here.
+ spec = importlib.util.spec_from_file_location(name, path, loader=loader)
+ try:
+ return importlib._bootstrap._load(spec)
+ except ImportError:
+ raise Exception(path, sys.exc_info())
# Local Variables:
# tab-width:4
diff --git a/bin/docs-update-generated.py b/bin/docs-update-generated.py
index 98c923d..0a373aa 100644
--- a/bin/docs-update-generated.py
+++ b/bin/docs-update-generated.py
@@ -51,13 +51,9 @@ def generate_all():
'-v', argpair('variables')] + flist,
shell=False)
- cp.check_returncode() # bail if it failed
- # lxml: fixup possibly broken tools.gen:
- with open(os.path.join(gen_folder, 'tools.gen'), 'r') as f :
- filedata = f.read()
- filedata = filedata.replace(r'&amp;cv-link', r'&cv-link')
- with open(os.path.join(gen_folder, 'tools.gen'), 'w') as f :
- f.write(filedata)
+ # No-op: scons-proc doesn't actually set an exit code at the moment.
+ if cp.returncode:
+ print("Generation failed", file=sys.stderr)
if __name__ == "__main__":
diff --git a/bin/scons-proc.py b/bin/scons-proc.py
index 6c1f66a..30832a0 100644
--- a/bin/scons-proc.py
+++ b/bin/scons-proc.py
@@ -11,10 +11,7 @@
#
import getopt
import os
-import re
-import string
import sys
-from io import StringIO # usable as of 2.6; takes unicode only
import SConsDoc
from SConsDoc import tf as stf
@@ -107,10 +104,10 @@ class SCons_XML(object):
for k, v in kw.items():
setattr(self, k, v)
- def fopen(self, name):
+ def fopen(self, name, mode='w'):
if name == '-':
return sys.stdout
- return open(name, 'w')
+ return open(name, mode)
def write(self, files):
gen, mod = files.split(',')
@@ -141,23 +138,31 @@ class SCons_XML(object):
added = True
stf.appendNode(vl, stf.copyNode(s))
+ # Generate the text for sets/uses lists of construction vars.
+ # This used to include an entity reference which would be replaced
+ # by the link to the cvar, but with lxml, dumping out the tree
+ # with tostring() will encode the & introducing the entity,
+ # breaking it. Instead generate the actual link. (issue #3580)
if v.sets:
added = True
vp = stf.newNode("para")
- # if using lxml, the &entity; entries will be encoded,
- # effectively breaking them. should fix,
- # for now handled post-process in calling script.
- s = ['&cv-link-%s;' % x for x in v.sets]
- stf.setText(vp, 'Sets: ' + ', '.join(s) + '.')
+ stf.setText(vp, "Sets: ")
+ for setv in v.sets:
+ link = stf.newSubNode(vp, "link", linkend="cv-%s" % setv)
+ linktgt = stf.newSubNode(link, "varname")
+ stf.setText(linktgt, "$" + setv)
+ stf.setTail(link, " ")
stf.appendNode(vl, vp)
+
if v.uses:
added = True
vp = stf.newNode("para")
- # if using lxml, the &entity; entries will be encoded,
- # effectively breaking them. should fix,
- # for now handled post-process in calling script.
- u = ['&cv-link-%s;' % x for x in v.uses]
- stf.setText(vp, 'Uses: ' + ', '.join(u) + '.')
+ stf.setText(vp, "Uses: ")
+ for use in v.uses:
+ link = stf.newSubNode(vp, "link", linkend="cv-%s" % use)
+ linktgt = stf.newSubNode(link, "varname")
+ stf.setText(linktgt, "$" + use)
+ stf.setTail(link, " ")
stf.appendNode(vl, vp)
# Still nothing added to this list item?
@@ -246,6 +251,7 @@ class Proxy(object):
## return self.__dict__ < other.__dict__
class SConsThing(Proxy):
+ """Base class for the SConsDoc special elements"""
def idfunc(self):
return self.name
@@ -255,6 +261,7 @@ class SConsThing(Proxy):
return [e]
class Builder(SConsThing):
+ """Generate the descriptions and entities for <builder> elements"""
description = 'builder'
prefix = 'b-'
tag = 'function'
@@ -264,20 +271,21 @@ class Builder(SConsThing):
builders don't show a full signature, just func()
"""
+ # build term for global function
gterm = stf.newNode("term")
- sig = stf.newSubNode(gterm, "literal")
- func = stf.newSubNode(sig, "emphasis", role="bold")
+ func = stf.newSubNode(gterm, Builder.tag)
stf.setText(func, self.name)
stf.setTail(func, '()')
+ # build term for env. method
mterm = stf.newNode("term")
- sig = stf.newSubNode(mterm, "literal")
- inst = stf.newSubNode(sig, "replaceable")
+ inst = stf.newSubNode(mterm, "parameter")
stf.setText(inst, "env")
stf.setTail(inst, ".")
- func = stf.newSubNode(sig, "emphasis", role="bold")
- stf.setText(func, self.name)
- stf.setTail(func, '()')
+ # we could use <function> here, but it's a "method"
+ meth = stf.newSubNode(mterm, "methodname")
+ stf.setText(meth, self.name)
+ stf.setTail(meth, '()')
return [gterm, mterm]
@@ -285,6 +293,7 @@ class Builder(SConsThing):
return self.name
class Function(SConsThing):
+ """Generate the descriptions and entities for <scons_function> elements"""
description = 'function'
prefix = 'f-'
tag = 'function'
@@ -306,23 +315,38 @@ class Function(SConsThing):
signature = 'both'
if stf.hasAttribute(arg, 'signature'):
signature = stf.getAttribute(arg, 'signature')
- s = stf.getText(arg).strip()
+ sig = stf.getText(arg).strip()[1:-1] # strip (), temporarily
if signature in ('both', 'global'):
+ # build term for global function
gterm = stf.newNode("term")
- sig = stf.newSubNode(gterm, "literal")
- func = stf.newSubNode(sig, "emphasis", role="bold")
+ func = stf.newSubNode(gterm, Function.tag)
stf.setText(func, self.name)
- stf.setTail(func, s)
+ if sig:
+ # if there are parameters, use that entity
+ stf.setTail(func, "(")
+ s = stf.newSubNode(gterm, "parameter")
+ stf.setText(s, sig)
+ stf.setTail(s, ")")
+ else:
+ stf.setTail(func, "()")
tlist.append(gterm)
if signature in ('both', 'env'):
+ # build term for env. method
mterm = stf.newNode("term")
- sig = stf.newSubNode(mterm, "literal")
- inst = stf.newSubNode(sig, "replaceable")
+ inst = stf.newSubNode(mterm, "replaceable")
stf.setText(inst, "env")
stf.setTail(inst, ".")
- func = stf.newSubNode(sig, "emphasis", role="bold")
- stf.setText(func, self.name)
- stf.setTail(func, s)
+ # we could use <function> here, but it's a "method"
+ meth = stf.newSubNode(mterm, "methodname")
+ stf.setText(meth, self.name)
+ if sig:
+ # if there are parameters, use that entity
+ stf.setTail(meth, "(")
+ s = stf.newSubNode(mterm, "parameter")
+ stf.setText(s, sig)
+ stf.setTail(s, ")")
+ else:
+ stf.setTail(meth, "()")
tlist.append(mterm)
if not tlist:
@@ -333,6 +357,7 @@ class Function(SConsThing):
return self.name
class Tool(SConsThing):
+ """Generate the descriptions and entities for <tool> elements"""
description = 'tool'
prefix = 't-'
tag = 'literal'
@@ -344,9 +369,16 @@ class Tool(SConsThing):
return self.name
class Variable(SConsThing):
+ """Generate the descriptions and entities for <cvar> elements"""
description = 'construction variable'
prefix = 'cv-'
tag = 'envar'
+
+ def xml_terms(self):
+ term = stf.newNode("term")
+ var = stf.newSubNode(term, Variable.tag)
+ stf.setText(var, self.name)
+ return [term]
def entityfunc(self):
return '$' + self.name
diff --git a/src/script/scons-time.py b/bin/scons-time.py
index e4dd863..693b254 100644
--- a/src/script/scons-time.py
+++ b/bin/scons-time.py
@@ -40,7 +40,7 @@ import shutil
import sys
import tempfile
import time
-import subprocess
+
def HACK_for_exec(cmd, *args):
"""
@@ -49,9 +49,13 @@ def HACK_for_exec(cmd, *args):
This function is a hack that calls exec() in a function with no
internal functions.
"""
- if not args: exec(cmd)
- elif len(args) == 1: exec(cmd, args[0])
- else: exec(cmd, args[0], args[1])
+ if not args:
+ exec(cmd)
+ elif len(args) == 1:
+ exec(cmd, args[0])
+ else:
+ exec(cmd, args[0], args[1])
+
class Plotter(object):
def increment_size(self, largest):
@@ -76,6 +80,7 @@ class Plotter(object):
increment = self.increment_size(largest)
return ((largest + increment - 1) // increment) * increment
+
class Line(object):
def __init__(self, points, type, title, label, comment, fmt="%s %s"):
self.points = points
@@ -111,10 +116,11 @@ class Line(object):
print('e')
def get_x_values(self):
- return [ p[0] for p in self.points ]
+ return [p[0] for p in self.points]
def get_y_values(self):
- return [ p[1] for p in self.points ]
+ return [p[1] for p in self.points]
+
class Gnuplotter(Plotter):
@@ -201,22 +207,21 @@ class Gnuplotter(Plotter):
max_y = self.max_graph_value(self.get_max_y())
incr = (max_y - min_y) / 10.0
start = min_y + (max_y / 2.0) + (2.0 * incr)
- position = [ start - (i * incr) for i in range(5) ]
+ position = [start - (i * incr) for i in range(5)]
inx = 1
for line in self.lines:
- line.print_label(inx, line.points[0][0]-1,
- position[(inx-1) % len(position)])
+ line.print_label(inx, line.points[0][0] - 1,
+ position[(inx - 1) % len(position)])
inx += 1
- plot_strings = [ self.plot_string(l) for l in self.lines ]
+ plot_strings = [self.plot_string(l) for l in self.lines]
print('plot ' + ', \\\n '.join(plot_strings))
for line in self.lines:
line.print_points()
-
def untar(fname):
import tarfile
tar = tarfile.open(name=fname, mode='r')
@@ -224,6 +229,7 @@ def untar(fname):
tar.extract(tarinfo)
tar.close()
+
def unzip(fname):
import zipfile
zf = zipfile.ZipFile(fname, 'r')
@@ -231,11 +237,12 @@ def unzip(fname):
dir = os.path.dirname(name)
try:
os.makedirs(dir)
- except:
+ except OSError:
pass
with open(name, 'wb') as f:
f.write(zf.read(name))
+
def read_tree(dir):
for dirpath, dirnames, filenames in os.walk(dir):
for fn in filenames:
@@ -244,14 +251,15 @@ def read_tree(dir):
with open(fn, 'rb') as f:
f.read()
+
def redirect_to_file(command, log):
return '%s > %s 2>&1' % (command, log)
+
def tee_to_file(command, log):
return '%s 2>&1 | tee %s' % (command, log)
-
class SConsTimer(object):
"""
Usage: scons-time SUBCOMMAND [ARGUMENTS]
@@ -267,45 +275,45 @@ class SConsTimer(object):
"""
name = 'scons-time'
- name_spaces = ' '*len(name)
+ name_spaces = ' ' * len(name)
def makedict(**kw):
return kw
default_settings = makedict(
- chdir = None,
- config_file = None,
- initial_commands = [],
- key_location = 'bottom left',
- orig_cwd = os.getcwd(),
- outdir = None,
- prefix = '',
- python = '"%s"' % sys.executable,
- redirect = redirect_to_file,
- scons = None,
- scons_flags = '--debug=count --debug=memory --debug=time --debug=memoizer',
- scons_lib_dir = None,
- scons_wrapper = None,
- startup_targets = '--help',
- subdir = None,
- subversion_url = None,
- svn = 'svn',
- svn_co_flag = '-q',
- tar = 'tar',
- targets = '',
- targets0 = None,
- targets1 = None,
- targets2 = None,
- title = None,
- unzip = 'unzip',
- verbose = False,
- vertical_bars = [],
-
- unpack_map = {
- '.tar.gz' : (untar, '%(tar)s xzf %%s'),
- '.tgz' : (untar, '%(tar)s xzf %%s'),
- '.tar' : (untar, '%(tar)s xf %%s'),
- '.zip' : (unzip, '%(unzip)s %%s'),
+ chdir=None,
+ config_file=None,
+ initial_commands=[],
+ key_location='bottom left',
+ orig_cwd=os.getcwd(),
+ outdir=None,
+ prefix='',
+ python='"%s"' % sys.executable,
+ redirect=redirect_to_file,
+ scons=None,
+ scons_flags='--debug=count --debug=memory --debug=time --debug=memoizer',
+ scons_lib_dir=None,
+ scons_wrapper=None,
+ startup_targets='--help',
+ subdir=None,
+ subversion_url=None,
+ svn='svn',
+ svn_co_flag='-q',
+ tar='tar',
+ targets='',
+ targets0=None,
+ targets1=None,
+ targets2=None,
+ title=None,
+ unzip='unzip',
+ verbose=False,
+ vertical_bars=[],
+
+ unpack_map={
+ '.tar.gz': (untar, '%(tar)s xzf %%s'),
+ '.tgz': (untar, '%(tar)s xzf %%s'),
+ '.tar': (untar, '%(tar)s xf %%s'),
+ '.zip': (unzip, '%(unzip)s %%s'),
},
)
@@ -329,10 +337,10 @@ class SConsTimer(object):
]
stage_strings = {
- 'pre-read' : 'Memory before reading SConscript files:',
- 'post-read' : 'Memory after reading SConscript files:',
- 'pre-build' : 'Memory before building targets:',
- 'post-build' : 'Memory after building targets:',
+ 'pre-read': 'Memory before reading SConscript files:',
+ 'post-read': 'Memory after reading SConscript files:',
+ 'pre-build': 'Memory before building targets:',
+ 'post-build': 'Memory after building targets:',
}
memory_string_all = 'Memory '
@@ -340,10 +348,10 @@ class SConsTimer(object):
default_stage = stages[-1]
time_strings = {
- 'total' : 'Total build time',
- 'SConscripts' : 'Total SConscript file execution time',
- 'SCons' : 'Total SCons execution time',
- 'commands' : 'Total command execution time',
+ 'total': 'Total build time',
+ 'SConscripts': 'Total SConscript file execution time',
+ 'SCons': 'Total SCons execution time',
+ 'commands': 'Total command execution time',
}
time_string_all = 'Total .* time'
@@ -425,7 +433,7 @@ class SConsTimer(object):
Executes a list of commands, substituting values from the
specified dictionary.
"""
- commands = [ self.subst_variables(c, dict) for c in commands ]
+ commands = [self.subst_variables(c, dict) for c in commands]
for action, string, args in commands:
self.display(string, *args)
sys.stdout.flush()
@@ -444,11 +452,11 @@ class SConsTimer(object):
p = os.popen(command)
output = p.read()
p.close()
- #TODO: convert to subrocess, os.popen is obsolete. This didn't work:
- #process = subprocess.Popen(command, stdout=subprocess.PIPE, shell=True)
- #output = process.stdout.read()
- #process.stdout.close()
- #process.wait()
+ # TODO: convert to subrocess, os.popen is obsolete. This didn't work:
+ # process = subprocess.Popen(command, stdout=subprocess.PIPE, shell=True)
+ # output = process.stdout.read()
+ # process.stdout.close()
+ # process.wait()
if self.verbose:
sys.stdout.write(output)
# TODO: Figure out
@@ -563,7 +571,7 @@ class SConsTimer(object):
except IndexError:
t = '??? %s ???' % i
results[i].sort()
- gp.line(results[i], i+1, t, None, t, fmt=fmt)
+ gp.line(results[i], i + 1, t, None, t, fmt=fmt)
for bar_tuple in self.vertical_bars:
try:
@@ -592,11 +600,13 @@ class SConsTimer(object):
if lines[0] == '':
lines = lines[1:]
spaces = re.match(' *', lines[0]).group(0)
- def strip_initial_spaces(l, s=spaces):
- if l.startswith(spaces):
- l = l[len(spaces):]
- return l
- return '\n'.join([ strip_initial_spaces(l) for l in lines ]) + '\n'
+
+ def strip_initial_spaces(line, s=spaces):
+ if line.startswith(spaces):
+ line = line[len(spaces):]
+ return line
+
+ return '\n'.join([strip_initial_spaces(l) for l in lines]) + '\n'
def profile_name(self, invocation):
"""
@@ -625,7 +635,7 @@ class SConsTimer(object):
sys.stderr.write('file %s has no contents!\n' % repr(file))
return None
result = re.findall(r'%s: ([\d.]*)' % search_string, contents)[-4:]
- result = [ float(r) for r in result ]
+ result = [float(r) for r in result]
if time_string is not None:
try:
result = result[0]
@@ -646,7 +656,7 @@ class SConsTimer(object):
sys.stderr.write('%s Cannot use the "func" subcommand.\n' % self.name_spaces)
sys.exit(1)
statistics = pstats.Stats(file).stats
- matches = [ e for e in statistics.items() if e[0][2] == function ]
+ matches = [e for e in statistics.items() if e[0][2] == function]
r = matches[0]
return r[0][0], r[0][1], r[0][2], r[1][3]
@@ -667,8 +677,8 @@ class SConsTimer(object):
search_string = memory_string
with open(file) as f:
lines = f.readlines()
- lines = [ l for l in lines if l.startswith(search_string) ][-4:]
- result = [ int(l.split()[-1]) for l in lines[-4:] ]
+ lines = [l for l in lines if l.startswith(search_string)][-4:]
+ result = [int(l.split()[-1]) for l in lines[-4:]]
if len(result) == 1:
result = result[0]
return result
@@ -680,13 +690,12 @@ class SConsTimer(object):
object_string = ' ' + object_name + '\n'
with open(file) as f:
lines = f.readlines()
- line = [ l for l in lines if l.endswith(object_string) ][0]
- result = [ int(field) for field in line.split()[:4] ]
+ line = [l for l in lines if l.endswith(object_string)][0]
+ result = [int(field) for field in line.split()[:4]]
if index is not None:
result = result[index]
return result
-
command_alias = {}
def execute_subcommand(self, argv):
@@ -841,7 +850,7 @@ class SConsTimer(object):
for file in args:
try:
f, line, func, time = \
- self.get_function_profile(file, function_name)
+ self.get_function_profile(file, function_name)
except ValueError as e:
sys.stderr.write("%s: func: %s: %s\n" %
(self.name, file, e))
@@ -885,7 +894,11 @@ class SConsTimer(object):
def do_mem(self, argv):
format = 'ascii'
- logfile_path = lambda x: x
+ def _logfile_path(x):
+ return x
+
+ logfile_path = _logfile_path
+
stage = self.default_stage
tail = None
@@ -934,10 +947,12 @@ class SConsTimer(object):
if self.chdir:
os.chdir(self.chdir)
- logfile_path = lambda x: os.path.join(self.chdir, x)
+ def _logfile_path_join(x):
+ return os.path.join(self.chdir, x)
- if not args:
+ logfile_path = _logfile_path_join
+ if not args:
pattern = '%s*.log' % self.prefix
args = self.args_to_files([pattern], tail)
@@ -956,7 +971,7 @@ class SConsTimer(object):
args = self.args_to_files(args, tail)
- cwd_ = os.getcwd() + os.sep
+ # cwd_ = os.getcwd() + os.sep
if format == 'ascii':
@@ -999,7 +1014,12 @@ class SConsTimer(object):
def do_obj(self, argv):
format = 'ascii'
- logfile_path = lambda x: x
+
+ def _logfile_path(x):
+ return x
+
+ logfile_path = _logfile_path
+
stage = self.default_stage
tail = None
@@ -1056,10 +1076,13 @@ class SConsTimer(object):
if self.chdir:
os.chdir(self.chdir)
- logfile_path = lambda x: os.path.join(self.chdir, x)
- if not args:
+ def _logfile_path_join(x):
+ return os.path.join(self.chdir, x)
+ logfile_path = _logfile_path_join
+
+ if not args:
pattern = '%s*.log' % self.prefix
args = self.args_to_files([pattern], tail)
@@ -1216,11 +1239,11 @@ class SConsTimer(object):
except ValueError:
result.append(int(n))
else:
- result.extend(list(range(int(x), int(y)+1)))
+ result.extend(list(range(int(x), int(y) + 1)))
return result
def scons_path(self, dir):
- return os.path.join(dir, 'src', 'script', 'scons.py')
+ return os.path.join(dir, 'scripts', 'scons.py')
def scons_lib_dir_path(self, dir):
return os.path.join(dir, 'src', 'engine')
@@ -1247,9 +1270,9 @@ class SConsTimer(object):
if prepare:
prepare(commands, removals)
- save_scons = self.scons
- save_scons_wrapper = self.scons_wrapper
- save_scons_lib_dir = self.scons_lib_dir
+ save_scons = self.scons
+ save_scons_wrapper = self.scons_wrapper
+ save_scons_lib_dir = self.scons_lib_dir
if self.outdir is None:
self.outdir = self.orig_cwd
@@ -1308,7 +1331,7 @@ class SConsTimer(object):
commands.extend([
(lambda: read_tree('.'),
- 'find * -type f | xargs cat > /dev/null'),
+ 'find * -type f | xargs cat > /dev/null'),
(self.set_env, 'export %%s=%%s',
'SCONS_LIB_DIR', self.scons_lib_dir),
@@ -1338,9 +1361,9 @@ class SConsTimer(object):
self.run_command_list(commands, self.__dict__)
- self.scons = save_scons
- self.scons_lib_dir = save_scons_lib_dir
- self.scons_wrapper = save_scons_wrapper
+ self.scons = save_scons
+ self.scons_lib_dir = save_scons_lib_dir
+ self.scons_wrapper = save_scons_wrapper
#
@@ -1363,7 +1386,12 @@ class SConsTimer(object):
def do_time(self, argv):
format = 'ascii'
- logfile_path = lambda x: x
+
+ def _logfile_path(x):
+ return x
+
+ logfile_path = _logfile_path
+
tail = None
which = 'total'
@@ -1413,10 +1441,13 @@ class SConsTimer(object):
if self.chdir:
os.chdir(self.chdir)
- logfile_path = lambda x: os.path.join(self.chdir, x)
- if not args:
+ def _logfile_path_join(x):
+ return os.path.join(self.chdir, x)
+
+ logfile_path = _logfile_path_join
+ if not args:
pattern = '%s*.log' % self.prefix
args = self.args_to_files([pattern], tail)
@@ -1454,6 +1485,7 @@ class SConsTimer(object):
sys.stderr.write('%s: time: Unknown format "%s".\n' % (self.name, format))
sys.exit(1)
+
if __name__ == '__main__':
opts, args = getopt.getopt(sys.argv[1:], 'h?V', ['help', 'version'])
diff --git a/bootstrap.py b/bootstrap.py
index d47c966..3bf53ea 100755
--- a/bootstrap.py
+++ b/bootstrap.py
@@ -183,7 +183,7 @@ def main():
else:
pass_through_args.append(arg)
- scons_py = os.path.join('src', 'script', 'scons.py')
+ scons_py = os.path.join('scripts', 'scons.py')
src_engine = os.path.join('src', 'engine')
MANIFEST_in = find(os.path.join(src_engine, 'MANIFEST.in'))
manifest_files = [os.path.join(src_engine, x)
@@ -220,6 +220,10 @@ def main():
if __name__ == "__main__":
+ print("Please use")
+ print("python scripts/scons.py")
+ print("Instead of python bootstrap.py. Bootstrap.py is obsolete")
+ sys.exit(-1)
main()
# Local Variables:
diff --git a/doc/SConscript b/doc/SConscript
index 8f6d1cd..6a522d0 100644
--- a/doc/SConscript
+++ b/doc/SConscript
@@ -31,7 +31,7 @@ import glob
import bootstrap
-Import('build_dir', 'env', 'whereis', 'revaction')
+Import('command_line', 'env', 'whereis', 'revaction')
#
# -- Check prerequisites for building the documentation ---
@@ -54,15 +54,19 @@ if not fop and not xep:
print("doc: No PDF renderer found (fop|xep)!")
skip_doc = True
+
+skip_doc_arg = ARGUMENTS.get('SKIP_DOC')
+if skip_doc_arg is not None:
+ skip_doc = skip_doc_arg in ['True', '1', 'true']
+
#
# --- Configure build
#
env = env.Clone()
-build = os.path.join(build_dir, 'doc')
+build = os.path.join(command_line.build_dir, 'doc')
-epydoc_cli = whereis('epydoc')
gs = whereis('gs')
lynx = whereis('lynx')
@@ -72,7 +76,7 @@ tar_deps = []
tar_list = []
orig_env = env
-env = orig_env.Clone(SCONS_PY = File('#src/script/scons.py').rfile())
+env = orig_env.Clone(SCONS_PY = File('#/scripts/scons.py').rfile())
#
# --- Helpers ---
@@ -248,7 +252,7 @@ else:
fpattern = [fpattern]
if use_builddir:
- target_dir = env.Dir(os.path.join(build_dir, *(toolpath+paths)))
+ target_dir = env.Dir(os.path.join(command_line.build_dir, *(toolpath+paths)))
buildsuite.extend(env.GlobInstall(target_dir,
os.path.join('..', *(toolpath+paths+fpattern))))
else:
@@ -494,127 +498,57 @@ else:
tar_list.extend([css_file])
Local(css_file)
-if not epydoc_cli:
- try:
- import epydoc
- except ImportError:
- epydoc = None
+if not skip_doc:
+ if True: #not epydoc_cli and not epydoc:
+ print("doc: epydoc not found, skipping building API documentation.")
else:
- # adding Epydoc builder using imported module
- def epydoc_builder_action(target, source, env):
- """
- Take a list of `source` files and build docs for them in
- `target` dir.
-
- `target` and `source` are lists.
-
- Uses OUTDIR and EPYDOCFLAGS environment variables.
-
- http://www.scons.org/doc/2.0.1/HTML/scons-user/x3594.html
- """
-
- # the epydoc build process is the following:
- # 1. build documentation index
- # 2. feed doc index to writer for docs
-
- from epydoc.docbuilder import build_doc_index
- from epydoc.docwriter.html import HTMLWriter
- from epydoc.docwriter.latex import LatexWriter
-
- # first arg is a list where can be names of python package dirs,
- # python files, object names or objects itself
- docindex = build_doc_index([str(src) for src in source])
- if docindex is None:
- return -1
-
- if env['EPYDOCFLAGS'] == '--html':
- html_writer = HTMLWriter(docindex,
- docformat='restructuredText',
- prj_name='SCons',
- prj_url='http://www.scons.org/')
- try:
- html_writer.write(env['OUTDIR'])
- except OSError: # If directory cannot be created or any file cannot
- # be created or written to.
- return -2
-
- """
- # PDF support requires external Linux utilites, so it's not crossplatform.
- # Leaving for now.
- # http://epydoc.svn.sourceforge.net/viewvc/epydoc/trunk/epydoc/src/epydoc/cli.py
-
- elif env['EPYDOCFLAGS'] == '--pdf':
- pdf_writer = LatexWriter(docindex,
- docformat='restructuredText',
- prj_name='SCons',
- prj_url='http://www.scons.org/')
- """
- return 0
-
- epydoc_commands = [
- Delete('$OUTDIR'),
- epydoc_builder_action,
- Touch('$TARGET'),
- ]
-
-else: # epydoc_cli is found
- epydoc_commands = [
- Delete('$OUTDIR'),
- '$EPYDOC $EPYDOCFLAGS --debug --output $OUTDIR --docformat=restructuredText --name SCons --url http://www.scons.org/ $SOURCES',
- Touch('$TARGET'),
- ]
-
-
-if not epydoc_cli and not epydoc:
- print("doc: epydoc not found, skipping building API documentation.")
-else:
- # XXX Should be in common with reading the same thing in
- # the SConstruct file.
- # bootstrap.py runs outside of SCons, so need to process the path
- e = Dir(os.path.join('#src', 'engine')).rstr()
- sources = bootstrap.parseManifestLines(e, os.path.join(e, 'MANIFEST.in'))
+ # XXX Should be in common with reading the same thing in
+ # the SConstruct file.
+ # bootstrap.py runs outside of SCons, so need to process the path
+ e = Dir(os.path.join('#src', 'engine')).rstr()
+ sources = bootstrap.parseManifestLines(e, os.path.join(e, 'MANIFEST.in'))
- # Omit some files:
- #
- # Don't omit Platform as we need Platform.virtualenv for the examples to be run
- # sources = [x for x in sources if x.find('Platform') == -1]
- sources = [x for x in sources if x.find('Tool') == -1]
- sources = [x for x in sources if x.find('Options') == -1]
-
- e = os.path.join(build, '..', 'scons', 'engine')
- sources = [os.path.join(e, x) for x in sources]
-
- htmldir = os.path.join(build, 'HTML', 'scons-api')
- env.Command('${OUTDIR}/index.html', sources, epydoc_commands,
- EPYDOC=epydoc_cli, EPYDOCFLAGS='--html', OUTDIR=htmldir)
- tar_deps.append(htmldir)
- tar_list.append(htmldir)
-
- if sys.platform == 'darwin' or not epydoc_cli:
- print("doc: command line epydoc is not found, skipping PDF/PS/Tex output")
- else:
- # PDF and PostScript and TeX are built from the
- # same invocation.
- api_dir = os.path.join(build, 'scons-api')
- api_pdf = os.path.join(api_dir, 'api.pdf')
- api_ps = os.path.join(api_dir, 'api.ps')
- api_tex = os.path.join(api_dir, 'api.tex')
- api_targets = [api_pdf, api_ps, api_tex]
- env.Command(api_targets, sources, epydoc_commands,
- EPYDOC=epydoc_cli, EPYDOCFLAGS='--pdf', OUTDIR=api_dir)
- Local(api_targets)
-
- pdf_install = os.path.join(build, 'PDF', 'scons-api.pdf')
- env.InstallAs(pdf_install, api_pdf)
- tar_deps.append(pdf_install)
- tar_list.append(pdf_install)
- Local(pdf_install)
-
- ps_install = os.path.join(build, 'PS', 'scons-api.ps')
- env.InstallAs(ps_install, api_ps)
- tar_deps.append(ps_install)
- tar_list.append(ps_install)
- Local(ps_install)
+ # Omit some files:
+ #
+ # Don't omit Platform as we need Platform.virtualenv for the examples to be run
+ # sources = [x for x in sources if x.find('Platform') == -1]
+ sources = [x for x in sources if x.find('Tool') == -1]
+ sources = [x for x in sources if x.find('Options') == -1]
+
+ e = os.path.join(build, '..', 'scons', 'engine')
+ sources = [os.path.join(e, x) for x in sources]
+
+ htmldir = os.path.join(build, 'HTML', 'scons-api')
+ env.Command('${OUTDIR}/index.html', sources, epydoc_commands,
+ EPYDOC=epydoc_cli, EPYDOCFLAGS='--html', OUTDIR=htmldir)
+ tar_deps.append(htmldir)
+ tar_list.append(htmldir)
+
+ if sys.platform == 'darwin' or not epydoc_cli:
+ print("doc: command line epydoc is not found, skipping PDF/PS/Tex output")
+ else:
+ # PDF and PostScript and TeX are built from the
+ # same invocation.
+ api_dir = os.path.join(build, 'scons-api')
+ api_pdf = os.path.join(api_dir, 'api.pdf')
+ api_ps = os.path.join(api_dir, 'api.ps')
+ api_tex = os.path.join(api_dir, 'api.tex')
+ api_targets = [api_pdf, api_ps, api_tex]
+ env.Command(api_targets, sources, epydoc_commands,
+ EPYDOC=epydoc_cli, EPYDOCFLAGS='--pdf', OUTDIR=api_dir)
+ Local(api_targets)
+
+ pdf_install = os.path.join(build, 'PDF', 'scons-api.pdf')
+ env.InstallAs(pdf_install, api_pdf)
+ tar_deps.append(pdf_install)
+ tar_list.append(pdf_install)
+ Local(pdf_install)
+
+ ps_install = os.path.join(build, 'PS', 'scons-api.ps')
+ env.InstallAs(ps_install, api_ps)
+ tar_deps.append(ps_install)
+ tar_list.append(ps_install)
+ Local(ps_install)
#
# Now actually create the tar file of the documentation,
@@ -628,4 +562,4 @@ if tar_deps:
Local(t)
Alias('doc', t)
else:
- Alias('doc', os.path.join(build_dir, 'doc'))
+ Alias('doc', os.path.join(command_line.build_dir, 'doc'))
diff --git a/doc/generated/functions.mod b/doc/generated/functions.mod
index 3d49229..47d2be4 100644
--- a/doc/generated/functions.mod
+++ b/doc/generated/functions.mod
@@ -80,7 +80,6 @@ THIS IS AN AUTOMATICALLY-GENERATED FILE. DO NOT EDIT.
<!ENTITY f-SetDefault "<function xmlns='http://www.scons.org/dbxsd/v1.0'>SetDefault</function>">
<!ENTITY f-SetOption "<function xmlns='http://www.scons.org/dbxsd/v1.0'>SetOption</function>">
<!ENTITY f-SideEffect "<function xmlns='http://www.scons.org/dbxsd/v1.0'>SideEffect</function>">
-<!ENTITY f-SourceCode "<function xmlns='http://www.scons.org/dbxsd/v1.0'>SourceCode</function>">
<!ENTITY f-Split "<function xmlns='http://www.scons.org/dbxsd/v1.0'>Split</function>">
<!ENTITY f-subst "<function xmlns='http://www.scons.org/dbxsd/v1.0'>subst</function>">
<!ENTITY f-Tag "<function xmlns='http://www.scons.org/dbxsd/v1.0'>Tag</function>">
@@ -161,7 +160,6 @@ THIS IS AN AUTOMATICALLY-GENERATED FILE. DO NOT EDIT.
<!ENTITY f-env-SetDefault "<function xmlns='http://www.scons.org/dbxsd/v1.0'>env.SetDefault</function>">
<!ENTITY f-env-SetOption "<function xmlns='http://www.scons.org/dbxsd/v1.0'>env.SetOption</function>">
<!ENTITY f-env-SideEffect "<function xmlns='http://www.scons.org/dbxsd/v1.0'>env.SideEffect</function>">
-<!ENTITY f-env-SourceCode "<function xmlns='http://www.scons.org/dbxsd/v1.0'>env.SourceCode</function>">
<!ENTITY f-env-Split "<function xmlns='http://www.scons.org/dbxsd/v1.0'>env.Split</function>">
<!ENTITY f-env-subst "<function xmlns='http://www.scons.org/dbxsd/v1.0'>env.subst</function>">
<!ENTITY f-env-Tag "<function xmlns='http://www.scons.org/dbxsd/v1.0'>env.Tag</function>">
@@ -252,7 +250,6 @@ THIS IS AN AUTOMATICALLY-GENERATED FILE. DO NOT EDIT.
<!ENTITY f-link-SetDefault "<link linkend='f-SetDefault' xmlns='http://www.scons.org/dbxsd/v1.0'><function>SetDefault</function></link>">
<!ENTITY f-link-SetOption "<link linkend='f-SetOption' xmlns='http://www.scons.org/dbxsd/v1.0'><function>SetOption</function></link>">
<!ENTITY f-link-SideEffect "<link linkend='f-SideEffect' xmlns='http://www.scons.org/dbxsd/v1.0'><function>SideEffect</function></link>">
-<!ENTITY f-link-SourceCode "<link linkend='f-SourceCode' xmlns='http://www.scons.org/dbxsd/v1.0'><function>SourceCode</function></link>">
<!ENTITY f-link-Split "<link linkend='f-Split' xmlns='http://www.scons.org/dbxsd/v1.0'><function>Split</function></link>">
<!ENTITY f-link-subst "<link linkend='f-subst' xmlns='http://www.scons.org/dbxsd/v1.0'><function>subst</function></link>">
<!ENTITY f-link-Tag "<link linkend='f-Tag' xmlns='http://www.scons.org/dbxsd/v1.0'><function>Tag</function></link>">
@@ -333,7 +330,6 @@ THIS IS AN AUTOMATICALLY-GENERATED FILE. DO NOT EDIT.
<!ENTITY f-link-env-SetDefault "<link linkend='f-SetDefault' xmlns='http://www.scons.org/dbxsd/v1.0'><function>env.SetDefault</function></link>">
<!ENTITY f-link-env-SetOption "<link linkend='f-SetOption' xmlns='http://www.scons.org/dbxsd/v1.0'><function>env.SetOption</function></link>">
<!ENTITY f-link-env-SideEffect "<link linkend='f-SideEffect' xmlns='http://www.scons.org/dbxsd/v1.0'><function>env.SideEffect</function></link>">
-<!ENTITY f-link-env-SourceCode "<link linkend='f-SourceCode' xmlns='http://www.scons.org/dbxsd/v1.0'><function>env.SourceCode</function></link>">
<!ENTITY f-link-env-Split "<link linkend='f-Split' xmlns='http://www.scons.org/dbxsd/v1.0'><function>env.Split</function></link>">
<!ENTITY f-link-env-subst "<link linkend='f-subst' xmlns='http://www.scons.org/dbxsd/v1.0'><function>env.subst</function></link>">
<!ENTITY f-link-env-Tag "<link linkend='f-Tag' xmlns='http://www.scons.org/dbxsd/v1.0'><function>env.Tag</function></link>">
diff --git a/doc/generated/tools.mod b/doc/generated/tools.mod
index 1209d74..3f8e22a 100644
--- a/doc/generated/tools.mod
+++ b/doc/generated/tools.mod
@@ -78,11 +78,12 @@ THIS IS AN AUTOMATICALLY-GENERATED FILE. DO NOT EDIT.
<!ENTITY t-mwcc "<literal xmlns='http://www.scons.org/dbxsd/v1.0'>mwcc</literal>">
<!ENTITY t-mwld "<literal xmlns='http://www.scons.org/dbxsd/v1.0'>mwld</literal>">
<!ENTITY t-nasm "<literal xmlns='http://www.scons.org/dbxsd/v1.0'>nasm</literal>">
-<!ENTITY t-Packaging "<literal xmlns='http://www.scons.org/dbxsd/v1.0'>Packaging</literal>">
<!ENTITY t-packaging "<literal xmlns='http://www.scons.org/dbxsd/v1.0'>packaging</literal>">
+<!ENTITY t-Packaging "<literal xmlns='http://www.scons.org/dbxsd/v1.0'>Packaging</literal>">
<!ENTITY t-pdf "<literal xmlns='http://www.scons.org/dbxsd/v1.0'>pdf</literal>">
<!ENTITY t-pdflatex "<literal xmlns='http://www.scons.org/dbxsd/v1.0'>pdflatex</literal>">
<!ENTITY t-pdftex "<literal xmlns='http://www.scons.org/dbxsd/v1.0'>pdftex</literal>">
+<!ENTITY t-python "<literal xmlns='http://www.scons.org/dbxsd/v1.0'>python</literal>">
<!ENTITY t-qt "<literal xmlns='http://www.scons.org/dbxsd/v1.0'>qt</literal>">
<!ENTITY t-rmic "<literal xmlns='http://www.scons.org/dbxsd/v1.0'>rmic</literal>">
<!ENTITY t-rpcgen "<literal xmlns='http://www.scons.org/dbxsd/v1.0'>rpcgen</literal>">
@@ -186,11 +187,12 @@ THIS IS AN AUTOMATICALLY-GENERATED FILE. DO NOT EDIT.
<!ENTITY t-link-mwcc "<link linkend='t-mwcc' xmlns='http://www.scons.org/dbxsd/v1.0'><literal>mwcc</literal></link>">
<!ENTITY t-link-mwld "<link linkend='t-mwld' xmlns='http://www.scons.org/dbxsd/v1.0'><literal>mwld</literal></link>">
<!ENTITY t-link-nasm "<link linkend='t-nasm' xmlns='http://www.scons.org/dbxsd/v1.0'><literal>nasm</literal></link>">
-<!ENTITY t-link-Packaging "<link linkend='t-Packaging' xmlns='http://www.scons.org/dbxsd/v1.0'><literal>Packaging</literal></link>">
<!ENTITY t-link-packaging "<link linkend='t-packaging' xmlns='http://www.scons.org/dbxsd/v1.0'><literal>packaging</literal></link>">
+<!ENTITY t-link-Packaging "<link linkend='t-Packaging' xmlns='http://www.scons.org/dbxsd/v1.0'><literal>Packaging</literal></link>">
<!ENTITY t-link-pdf "<link linkend='t-pdf' xmlns='http://www.scons.org/dbxsd/v1.0'><literal>pdf</literal></link>">
<!ENTITY t-link-pdflatex "<link linkend='t-pdflatex' xmlns='http://www.scons.org/dbxsd/v1.0'><literal>pdflatex</literal></link>">
<!ENTITY t-link-pdftex "<link linkend='t-pdftex' xmlns='http://www.scons.org/dbxsd/v1.0'><literal>pdftex</literal></link>">
+<!ENTITY t-link-python "<link linkend='t-python' xmlns='http://www.scons.org/dbxsd/v1.0'><literal>python</literal></link>">
<!ENTITY t-link-qt "<link linkend='t-qt' xmlns='http://www.scons.org/dbxsd/v1.0'><literal>qt</literal></link>">
<!ENTITY t-link-rmic "<link linkend='t-rmic' xmlns='http://www.scons.org/dbxsd/v1.0'><literal>rmic</literal></link>">
<!ENTITY t-link-rpcgen "<link linkend='t-rpcgen' xmlns='http://www.scons.org/dbxsd/v1.0'><literal>rpcgen</literal></link>">
diff --git a/doc/man/html.xsl b/doc/man/html.xsl
index 00cc782..d4f33da 100644
--- a/doc/man/html.xsl
+++ b/doc/man/html.xsl
@@ -28,7 +28,7 @@
xmlns:fo="http://www.w3.org/1999/XSL/Format"
version="1.0">
- <xsl:import href="../../src/engine/SCons/Tool/docbook/docbook-xsl-1.76.1/html/docbook.xsl"/>
+<xsl:import href="../../src/engine/SCons/Tool/docbook/docbook-xsl-1.76.1/html/docbook.xsl"/>
<xsl:param name="l10n.gentext.default.language" select="'en'"/>
<xsl:param name="section.autolabel" select="1"/>
@@ -54,6 +54,12 @@ reference title
set toc,title
</xsl:param>
+<xsl:template match="function">
+ <xsl:call-template name="inline.boldmonoseq"/>
+</xsl:template>
+<xsl:template match="methodname">
+ <xsl:call-template name="inline.boldmonoseq"/>
+</xsl:template>
<!-- Prevent our EPUB cover image from getting included -->
<xsl:template match="mediaobject[@role = 'cover']">
</xsl:template>
diff --git a/doc/man/scons.xml b/doc/man/scons.xml
index 5630e93..f7eed2d 100644
--- a/doc/man/scons.xml
+++ b/doc/man/scons.xml
@@ -1185,11 +1185,11 @@ and re-initialize the dependency graph from scratch.</para>
<term><emphasis role="bold">build</emphasis><emphasis>[OPTIONS] [TARGETS] ...</emphasis></term>
<listitem>
<para>Builds the specified
-<emphasis>TARGETS</emphasis>
+<parameter>TARGETS</parameter>
(and their dependencies)
with the specified
SCons command-line
-<emphasis>OPTIONS</emphasis>.
+<parameter>OPTIONS</parameter>.
<emphasis role="bold">b</emphasis>
and
<emphasis role="bold">scons</emphasis>
@@ -1232,9 +1232,10 @@ which only happens once at the beginning of interactive mode).</para>
<term><emphasis role="bold">clean</emphasis><emphasis>[OPTIONS] [TARGETS] ...</emphasis></term>
<listitem>
<para>Cleans the specified
-<emphasis>TARGETS</emphasis>
+<parameter>TARGETS</parameter>
(and their dependencies)
-with the specified options.
+with the specified
+<parameter>OPTIONS</parameter>.
<emphasis role="bold">c</emphasis>
is a synonym.
This command is itself a synonym for
@@ -2000,15 +2001,15 @@ These warnings are enabled by default.</para>
<listitem>
<para>Warnings about attempts to set the
reserved &consvar; names
-<envar>CHANGED_SOURCES</envar>,
-<envar>CHANGED_TARGETS</envar>,
-<envar>TARGET</envar>,
-<envar>TARGETS</envar>,
-<envar>SOURCE</envar>,
-<envar>SOURCES</envar>,
-<envar>UNCHANGED_SOURCES</envar>
+&cv-CHANGED_SOURCES;,
+&cv-CHANGED_TARGETS;,
+&cv-TARGET;,
+&cv-TARGETS;,
+&cv-SOURCE;,
+&cv-SOURCES;,
+&cv-UNCHANGED_SOURCES;
or
-<envar>UNCHANGED_TARGETS</envar>.
+&cv-UNCHANGED_TARGETS;.
These warnings are disabled by default.</para>
</listitem>
</varlistentry>
@@ -2105,7 +2106,7 @@ env['BAR'] = 'bar'
<para>As a convenience,
&consvars; may also be set or modified by the
-<parameter class="function">parse_flags</parameter>
+<parameter>parse_flags</parameter>
keyword argument, which applies the
&f-link-env-MergeFlags;
method (described below) to the argument value
@@ -2119,11 +2120,15 @@ env = Environment(parse_flags='-Iinclude -DEBUG -lm')
</programlisting>
<para>This example adds 'include' to
-<envar>CPPPATH</envar>,
+the <envar>CPPPATH</envar> &consvar;
'EBUG' to
<envar>CPPDEFINES</envar>,
and 'm' to
-<envar>LIBS</envar>.</para>
+<envar>LIBS</envar>.
+&f-link-env-ParseFlags; describes how these arguments
+are distributed to &consvars;.
+</para>
+
<para>By default, a new &consenv; is
initialized with a set of builder methods
@@ -2148,21 +2153,21 @@ and suffixes appropriate for that platform.</para>
<para>Note that the
<emphasis role="bold">win32</emphasis>
platform adds the
-<emphasis role="bold">SystemDrive</emphasis>
+<envar>SystemDrive</envar>
and
-<emphasis role="bold">SystemRoot</emphasis>
+<envar>SystemRoot</envar>
variables from the user's external environment
to the &consenv;'s
-<emphasis role="bold">ENV</emphasis>
+<envar>ENV</envar>
dictionary.
This is so that any executed commands
that use sockets to connect with other systems
(such as fetching source files from
external CVS repository specifications like
-<emphasis role="bold">:pserver:anonymous@cvs.sourceforge.net:/cvsroot/scons</emphasis>)
+<literal>:pserver:anonymous@cvs.sourceforge.net:/cvsroot/scons</literal>)
will work on Windows systems.</para>
-<para>The platform argument may be a function or callable object.
+<para>The <parameter>platform</parameter> argument may be a function or callable object,
in which case the &Environment; method
will call it to update
the new &consenv;:</para>
@@ -2259,15 +2264,15 @@ env = Environment(tools=[my_tool])
may also themselves be two-element lists of the form
(<emphasis>toolname</emphasis>, <emphasis>kw_dict</emphasis>).
SCons searches for the
-<emphasis>toolname</emphasis>
+<parameter>toolname</parameter>
specification file as described above, and
passes
-<emphasis>kw_dict</emphasis>,
+<parameter>kw_dict</parameter>,
which must be a dictionary, as keyword arguments to the tool's
-<emphasis role="bold">generate</emphasis>
+<function>generate</function>
function.
The
-<emphasis role="bold">generate</emphasis>
+<function>generate</function>
function can use the arguments to modify the tool's behavior
by setting up the environment in different ways
or otherwise changing its initialization.</para>
@@ -2553,11 +2558,11 @@ env = Program('hello', 'hello.c', parse_flags='-Iinclude -DEBUG -lm')
</programlisting>
<para>This example adds 'include' to
-<emphasis role="bold">CPPPATH</emphasis>,
+<envar>CPPPATH</envar>,
'EBUG' to
-<emphasis role="bold">CPPDEFINES</emphasis>,
+<envar>CPPDEFINES</envar>,
and 'm' to
-<emphasis role="bold">LIBS</emphasis>.</para>
+<envar>LIBS</envar>.</para>
<para>Although the builder methods defined by
&scons;
@@ -2938,7 +2943,7 @@ to affect how you want the build to be performed.</para>
<variablelist>
<varlistentry>
- <term>ARGLIST</term>
+ <term>&ARGLIST;</term>
<listitem>
<para>A list of the
<emphasis>keyword</emphasis>=<emphasis>value</emphasis>
@@ -2971,7 +2976,7 @@ for key, value in ARGLIST:
</varlistentry>
<varlistentry>
- <term>ARGUMENTS</term>
+ <term>&ARGUMENTS;</term>
<listitem>
<para>A dictionary of all the
<emphasis>keyword</emphasis>=<emphasis>value</emphasis>
@@ -2981,8 +2986,7 @@ and if a given keyword has
more than one value assigned to it
on the command line,
the last (right-most) value is
-the one in the
-<emphasis role="bold">ARGUMENTS</emphasis>
+the one in the &ARGUMENTS;
dictionary.</para>
<para>Example:</para>
@@ -2997,7 +3001,7 @@ else:
</varlistentry>
<varlistentry>
- <term>BUILD_TARGETS</term>
+ <term>&BUILD_TARGETS;</term>
<listitem>
<para>A list of the targets which
&scons;
@@ -3043,7 +3047,7 @@ if 'special/program' in BUILD_TARGETS:
</varlistentry>
<varlistentry>
- <term>COMMAND_LINE_TARGETS</term>
+ <term>&COMMAND_LINE_TARGETS;</term>
<listitem>
<para>A list of the targets explicitly specified on
the command line. If there are command line targets,
@@ -3066,7 +3070,7 @@ if 'special/program' in COMMAND_LINE_TARGETS:
</varlistentry>
<varlistentry>
- <term>DEFAULT_TARGETS</term>
+ <term>&DEFAULT_TARGETS;</term>
<listitem>
<para>A list of the target
<emphasis>nodes</emphasis>
@@ -3205,8 +3209,7 @@ env = Environment(CC="cc")
</programlisting>
<para>or when copying a &consenv; using the
-<emphasis role="bold">Clone</emphasis>
-method:</para>
+&f-link-Clone; method:</para>
<programlisting language="python">
env2 = env.Clone(CC="cl.exe")
@@ -3217,67 +3220,75 @@ env2 = env.Clone(CC="cl.exe")
<refsect2 id='configure_contexts'>
<title>Configure Contexts</title>
-<para>&scons;
+<para>&SCons;
supports a
-<firstterm>configure context</firstterm>,
+<firstterm>&configure_context;</firstterm>,
an integrated mechanism similar to the
various <constant>AC_CHECK</constant> macros in GNU &Autoconf;
-for testing for the existence of C header
-files, libraries, etc.
-In contrast to &Autoconf;,
+for testing the existence of external items needed
+for the build, such as C header files, libraries, etc.
+The mechanism is portable across platforms.
+</para>
+
+<para>
&scons;
-does not maintain an explicit cache of the tested values,
+does not maintain an explicit cache of the tested values
+(this is different than &Autoconf;),
but uses its normal dependency tracking to keep the checked values
up to date. However, users may override this behaviour with the
<option>--config</option>
command line option.</para>
-<para>To create a configure context:</para>
-
<variablelist>
<varlistentry>
- <term>Configure(<emphasis>env</emphasis>, [<emphasis>custom_tests</emphasis>, <emphasis>conf_dir</emphasis>, <emphasis>log_file</emphasis>, <emphasis>config_h</emphasis>, <emphasis>clean</emphasis>, <emphasis>help])</emphasis></term>
- <term><replaceable>env</replaceable>.Configure([<emphasis>custom_tests</emphasis>, <emphasis>conf_dir</emphasis>, <emphasis>log_file</emphasis>, <emphasis>config_h</emphasis>, <emphasis>clean</emphasis>, <emphasis>help])</emphasis></term>
+ <term><function>Configure</function>(<parameter>env, [custom_tests, conf_dir, log_file, config_h, clean, help]</parameter>)</term>
+ <term><replaceable>env</replaceable>.<methodname>Configure</methodname>(<parameter>[custom_tests, conf_dir, log_file, config_h, clean, help]</parameter>)</term>
<listitem>
-<para>Create a configure context, which tracks information
-discovered while running tests. The context includes a
-&consenv;, which is used when running the tests and
-which is updated with the check results.
-When the context is complete, the (possibly modified)
-environment is returned). Only one context may be active
+<para>Create a &configure_context;, which tracks information
+discovered while running tests. The context includes a local &consenv;
+(available as <replaceable>context</replaceable>.<varname>env</varname>)
+which is used when running the tests and
+which can be updated with the check results.
+Only one context may be active
at a time (since 4.0, &scons; will raise an exception
-if this rule is not followed), but a new context can be created
-after the active one is completed.</para>
-<para>
-The required <emphasis>env</emphasis> argument
-specifies the environment for building the tests.
-<emphasis>custom_tests</emphasis>
-is a dictionary containing custom tests
+on an attempt to create a new context when there is
+an active context), but a new context can be created
+after the active one is completed.
+For the global function form, the required <parameter>env</parameter>
+describes the initial values for the context's local &consenv;;
+for the &consenv; method form the instance provides the values.
+</para>
+<para><parameter>custom_tests</parameter>
+specifies a dictionary containing custom tests
(see the section on custom tests below).
-By default, no custom tests are added to the configure context.
-<emphasis>conf_dir</emphasis>
+The default value is <constant>None</constant>,
+meaning no custom tests are added to the &configure_context;.</para>
+<para>
+<parameter>conf_dir</parameter>
specifies a directory where the test cases are built.
-Note that this directory is not used for building
-normal targets.
-The default value is the directory
-<filename>#/.sconf_temp</filename>.
-<emphasis>log_file</emphasis>
+This directory is not used for building normal targets.
+The default value is
+<quote><filename>#/.sconf_temp</filename></quote>.</para>
+<para>
+<parameter>log_file</parameter>
specifies a file which collects the output from commands
that are executed to check for the existence of header files, libraries, etc.
-The default is the file <filename>#/config.log</filename>.
+The default is <quote><filename>#/config.log</filename></quote>.
If you are using the
&VariantDir; function,
-you may want to specify a subdirectory under your variant directory.
-<emphasis>config_h</emphasis>
+you may want to specify a subdirectory under your variant directory.</para>
+<para>
+<parameter>config_h</parameter>
specifies a C header file where the results of tests
-will be written, e.g.
+will be written. The results will consist of lines like
<literal>#define HAVE_STDIO_H</literal>,
<literal>#define HAVE_LIBM</literal>, etc.
+Customarily, the name chosen is <quote><filename>config.h</filename></quote>.
The default is to not write a
-<filename>config.h</filename>
+<parameter>config_h</parameter>
file.
You can specify the same
-<filename>config.h</filename>
+<parameter>config_h</parameter>
file in multiple calls to &Configure;,
in which case &SCons;
will concatenate all results in the specified file.
@@ -3285,19 +3296,17 @@ Note that &SCons;
uses its normal dependency checking
to decide if it's necessary to rebuild
the specified
-<filename>config_h</filename>
+<parameter>config_h</parameter>
file.
This means that the file is not necessarily re-built each
time scons is run,
but is only rebuilt if its contents will have changed
and some target that depends on the
-<filename>config_h</filename>
+<parameter>config_h</parameter>
file is being built.</para>
-
-<para>The optional
-<emphasis role="bold">clean</emphasis>
+<para>The <parameter>clean</parameter>
and
-<emphasis role="bold">help</emphasis>
+<parameter>help</parameter>
arguments can be used to suppress execution of the configuration
tests when the
<option>-c</option>/<option>--clean</option>
@@ -3305,15 +3314,15 @@ or
<option>-H</option>/<option>-h</option>/<option>--help</option>
options are used, respectively.
The default behavior is always to execute
-configure context tests,
+&configure_context; tests,
since the results of the tests may
affect the list of targets to be cleaned
or the help text.
If the configure tests do not affect these,
then you may add the
-<emphasis role="bold">clean=False</emphasis>
+<option>clean=False</option>
or
-<emphasis role="bold">help=False</emphasis>
+<option>help=False</option>
arguments
(or both)
to avoid unnecessary test execution.</para>
@@ -3321,19 +3330,19 @@ to avoid unnecessary test execution.</para>
</varlistentry>
<varlistentry>
- <term>SConf.Finish(<emphasis>context</emphasis>)</term>
- <term><replaceable>context</replaceable>.Finish()</term>
+ <term><literal>SConf</literal>.<function>Finish</function>(<parameter>context</parameter>)</term>
+ <term><replaceable>context</replaceable>.<methodname>Finish</methodname>()</term>
<listitem>
<para>This method must be called after configuration is done.
Though required, this is not enforced except
-if &Configure; is called when there still an active context,
+if &Configure; is called again while there is still an active context,
in which case an exception is raised.
&Finish; returns the environment as modified
during the course of running the configuration checks.
After this method is called, no further checks can be performed
with this configuration context.
However, you can create a new
-configure context to perform additional checks.
+&configure_context; to perform additional checks.
</para>
</listitem>
</varlistentry>
@@ -3353,19 +3362,27 @@ if conf.CheckLibWithHeader("qt", "qapp.h", "c++", "QApplication qapp(0,0);"):
env = conf.Finish()
</programlisting>
-<para>A configure context
+<para>A &configure_context;
has the following predefined methods which
-can be used to perform checks:</para>
+can be used to perform checks. Where
+<parameter>language</parameter> is a required or
+optional parameter, the choice can currently
+be C or C++. The spellings accepted for
+C are <quote>C</quote> or <quote>c</quote>;
+for C++ the value can be
+<quote>CXX</quote>, <quote>cxx</quote>, <quote>C++</quote>
+or <quote>c++</quote>.
+</para>
<variablelist>
<varlistentry>
- <term>SConf.CheckHeader(<emphasis>context</emphasis>, <emphasis>header</emphasis>, [<emphasis>include_quotes</emphasis>, <emphasis>language</emphasis>])</term>
- <term><replaceable>context</replaceable>.CheckHeader(<emphasis>header</emphasis>, [<emphasis>include_quotes</emphasis>, <emphasis>language</emphasis>])</term>
+ <term><literal>SConf</literal>.<function>CheckHeader</function>(<parameter>context, header, [include_quotes, language]</parameter>)</term>
+ <term><replaceable>context</replaceable>.<methodname>CheckHeader</methodname>(<parameter>header, [include_quotes, language]</parameter>)</term>
<listitem>
<para>Checks if
-<emphasis>header</emphasis>
+<parameter>header</parameter>
is usable in the specified language.
-<emphasis>header</emphasis>
+<parameter>header</parameter>
may be a list,
in which case the last item in the list
is the header file to be checked,
@@ -3375,32 +3392,32 @@ header files whose
lines should precede the
header line being checked for.
The optional argument
-<emphasis>include_quotes</emphasis>
+<parameter>include_quotes</parameter>
must be
a two character string, where the first character denotes the opening
quote and the second character denotes the closing quote.
-By default, both characters are " (double quote).
+By default, both characters are <markup>"</markup> (double quote).
The optional argument
-<emphasis>language</emphasis>
+<parameter>language</parameter>
should be either
<emphasis role="bold">C</emphasis>
or
<emphasis role="bold">C++</emphasis>
and selects the compiler to be used for the check.
-Returns 1 on success and 0 on failure.</para>
+Returns a boolean indicating success or failure.</para>
</listitem>
</varlistentry>
<varlistentry>
- <term>SConf.CheckCHeader(<emphasis>context</emphasis>, <emphasis>header</emphasis>, [<emphasis>include_quotes</emphasis>])</term>
- <term><replaceable>context</replaceable>.CheckCHeader(<emphasis>header</emphasis>, [<emphasis>include_quotes</emphasis>])</term>
+ <term><literal>SConf</literal>.<function>CheckCHeader</function>(<parameter>context, header, [include_quotes]</parameter>)</term>
+ <term><replaceable>context</replaceable>.<methodname>CheckCHeader</methodname>(<parameter>header, [include_quotes]</parameter>)</term>
<listitem>
<para>This is a wrapper around
-<methodname>SConf.CheckHeader</methodname>
+<function>SConf.CheckHeader</function>
which checks if
-<emphasis>header</emphasis>
+<parameter>header</parameter>
is usable in the C language.
-<emphasis>header</emphasis>
+<parameter>header</parameter>
may be a list,
in which case the last item in the list
is the header file to be checked,
@@ -3410,25 +3427,25 @@ header files whose
lines should precede the
header line being checked for.
The optional argument
-<emphasis>include_quotes</emphasis>
+<parameter>include_quotes</parameter>
must be
a two character string, where the first character denotes the opening
-quote and the second character denotes the closing quote (both default
-to \N'34').
-Returns 1 on success and 0 on failure.</para>
+quote and the second character denotes the closing quote.
+By default, both characters are <markup>"</markup> (double quote).
+Returns a boolean indicating success or failure.</para>
</listitem>
</varlistentry>
<varlistentry>
- <term>SConf.CheckCXXHeader(<emphasis>context</emphasis>, <emphasis>header</emphasis>, [<emphasis>include_quotes</emphasis>])</term>
- <term><replaceable>context</replaceable>.CheckCXXHeader(<emphasis>header</emphasis>, [<emphasis>include_quotes</emphasis>])</term>
+ <term><literal>SConf</literal>.<function>CheckCXXHeader</function>(<parameter>context, header, [include_quotes]</parameter>)</term>
+ <term><replaceable>context</replaceable>.<methodname>CheckCXXHeader</methodname>(<parameter>header, [include_quotes]</parameter>)</term>
<listitem>
<para>This is a wrapper around
-<methodname>SConf.CheckHeader</methodname>
+<function>SConf.CheckHeader</function>
which checks if
-<emphasis>header</emphasis>
+<parameter>header</parameter>
is usable in the C++ language.
-<emphasis>header</emphasis>
+<parameter>header</parameter>
may be a list,
in which case the last item in the list
is the header file to be checked,
@@ -3438,25 +3455,32 @@ header files whose
lines should precede the
header line being checked for.
The optional argument
-<emphasis>include_quotes</emphasis>
+<parameter>include_quotes</parameter>
must be
a two character string, where the first character denotes the opening
-quote and the second character denotes the closing quote (both default
-to \N'34').
-Returns 1 on success and 0 on failure.</para>
+quote and the second character denotes the closing quote.
+By default, both characters are <markup>"</markup> (double quote).
+Returns a boolean indicating success or failure.</para>
</listitem>
</varlistentry>
<varlistentry>
- <term>SConf.CheckFunc(<emphasis>context,</emphasis>, <emphasis>function_name</emphasis>, [<emphasis>header</emphasis>, <emphasis>language</emphasis>])</term>
- <term><replaceable>context</replaceable>.CheckFunc(<emphasis>function_name</emphasis>, [<emphasis>header</emphasis>, <emphasis>language</emphasis>])</term>
+ <term><literal>SConf</literal>.<function>CheckFunc</function>(<parameter>context, function_name, [header, language]</parameter>)</term>
+ <term><replaceable>context</replaceable>.<methodname>CheckFunc</methodname>(<parameter>function_name, [header, language]</parameter>)</term>
<listitem>
<para>Checks if the specified
-C or C++ function is available.
-<emphasis>function_name</emphasis>
+C or C++ library function is available based on the
+context's local environment settings (that is, using
+the values of <varname>CFLAGS</varname>,
+<varname>CPPFLAGS</varname>, <varname>LIBS</varname>
+or other relevant &consvars;).
+</para>
+
+<para>
+<parameter>function_name</parameter>
is the name of the function to check for.
The optional
-<emphasis>header</emphasis>
+<parameter>header</parameter>
argument is a string
that will be
placed at the top
@@ -3472,77 +3496,65 @@ extern "C"
char function_name();
</programlisting>
-<para>The optional
-<emphasis>language</emphasis>
-argument should be
-<emphasis role="bold">C</emphasis>
-or
-<emphasis role="bold">C++</emphasis>
-and selects the compiler to be used for the check;
-the default is "C".</para>
+<para>
+Returns an empty string on success, a string containing
+an error message on failure.
+</para>
</listitem>
</varlistentry>
<varlistentry>
- <term>SConf.CheckLib(<emphasis>context</emphasis>, [<emphasis>library</emphasis>, <emphasis>symbol</emphasis>, <emphasis>header</emphasis>, <emphasis>language</emphasis>, <emphasis>autoadd=1</emphasis>])</term>
- <term><replaceable>context</replaceable>.CheckLib([<emphasis>library</emphasis>, <emphasis>symbol</emphasis>, <emphasis>header</emphasis>, <emphasis>language</emphasis>, <emphasis>autoadd=1</emphasis>])</term>
+ <term><literal>SConf</literal>.<function>CheckLib</function>(<parameter>context, [library, symbol, header, language, autoadd=True]</parameter>)</term>
+ <term><replaceable>context</replaceable>.<methodname>CheckLib</methodname>(<parameter>[library, symbol, header, language, autoadd=True]</parameter>) </term>
<listitem>
<para>Checks if
-<emphasis>library</emphasis>
+<parameter>library</parameter>
provides
-<emphasis>symbol</emphasis>.
-If the value of
-<emphasis>autoadd</emphasis>
-is 1 and the library provides the specified
-<emphasis>symbol</emphasis>,
-appends the library to the LIBS &consvar;
-<emphasis>library</emphasis>
-may also be None (the default),
+<parameter>symbol</parameter>.
+If
+<parameter>autoadd</parameter>
+is true (the default) and the library provides the specified
+<parameter>symbol</parameter>,
+appends the library to the <varname>LIBS</varname> &consvar;
+<parameter>library</parameter>
+may also be <constant>None</constant> (the default),
in which case
-<emphasis>symbol</emphasis>
-is checked with the current LIBS variable,
+<parameter>symbol</parameter>
+is checked with the current <varname>LIBS</varname> variable,
or a list of library names,
in which case each library in the list
will be checked for
-<emphasis>symbol</emphasis>.
+<parameter>symbol</parameter>.
If
-<emphasis>symbol</emphasis>
+<parameter>symbol</parameter>
is not set or is
-<emphasis role="bold">None</emphasis>,
+<constant>None</constant>,
then
-<methodname>SConf.CheckLib</methodname>()
+<function>SConf.CheckLib</function>
just checks if
you can link against the specified
-<emphasis>library</emphasis>.
-The optional
-<emphasis>language</emphasis>
-argument should be
-<emphasis role="bold">C</emphasis>
-or
-<emphasis role="bold">C++</emphasis>
-and selects the compiler to be used for the check;
-the default is "C".
-The default value for
-<emphasis>autoadd</emphasis>
-is 1.
-This method returns 1 on success and 0 on error.</para>
+<parameter>library</parameter>.
+Note though it is legal syntax, it would
+not be very useful to call this method
+with <parameter>library</parameter>
+and <parameter>symbol</parameter> both
+omitted or <constant>None</constant>.
+Returns a boolean indicating success or failure.</para>
</listitem>
</varlistentry>
<varlistentry>
- <term>SConf.CheckLibWithHeader(<emphasis>context</emphasis>, <emphasis>library</emphasis>, <emphasis>header</emphasis>, <emphasis>language</emphasis>, [<emphasis>call</emphasis>, <emphasis>autoadd</emphasis>])</term>
- <term><replaceable>context</replaceable>.CheckLibWithHeader(<emphasis>library</emphasis>, <emphasis>header</emphasis>, <emphasis>language</emphasis>, [<emphasis>call</emphasis>, <emphasis>autoadd</emphasis>])</term>
+ <term><literal>SConf</literal>.<function>CheckLibWithHeader</function>(<parameter>context, library, header, language, [call, autoadd=True]</parameter>)</term>
+ <term><replaceable>context</replaceable>.<methodname>CheckLibWithHeader</methodname>(<parameter>library, header, language, [call, autoadd=True]</parameter>)</term>
<listitem>
-<para>In contrast to the
-<methodname>SConf.CheckLib</methodname>
-call, this call provides a more sophisticated way to check against libraries.
-Again,
-<emphasis>library</emphasis>
+<para>Provides a more sophisticated way to check against libraries then the
+<function>SConf.CheckLib</function> call.
+<parameter>library</parameter>
specifies the library or a list of libraries to check.
-<emphasis>header</emphasis>
+<parameter>header</parameter>
specifies a header to check for.
-<emphasis>header</emphasis>
+<parameter>header</parameter>
may be a list,
in which case the last item in the list
is the header file to be checked,
@@ -3551,91 +3563,95 @@ header files whose
<literal>#include</literal>
lines should precede the
header line being checked for.
-<emphasis>language</emphasis>
-may be one of 'C','c','CXX','cxx','C++' and 'c++'.
-<emphasis>call</emphasis>
+<parameter>call</parameter>
can be any valid expression (with a trailing ';').
If
-<emphasis>call</emphasis>
+<parameter>call</parameter>
is not set,
the default simply checks that you
can link against the specified
-<emphasis>library</emphasis>.
-<emphasis>autoadd</emphasis>
-specifies whether to add the library to the environment (only if the check
-succeeds). This method returns 1 on success and 0 on error.</para>
+<parameter>library</parameter>.
+<parameter>autoadd</parameter> (default true)
+specifies whether to add the library to the environment if the check
+succeeds.
+Returns a boolean indicating success or failure.</para>
</listitem>
</varlistentry>
<varlistentry>
- <term>SConf.CheckType(<emphasis>context</emphasis>, <emphasis>type_name</emphasis>, [<emphasis>includes</emphasis>, <emphasis>language</emphasis>])</term>
- <term><replaceable>context</replaceable>.CheckType(<emphasis>type_name</emphasis>, [<emphasis>includes</emphasis>, <emphasis>language</emphasis>])</term>
+ <term><literal>SConf</literal>.<function>CheckType</function>(<parameter>context, type_name, [includes, language]</parameter>)</term>
+ <term><replaceable>context</replaceable>.<methodname>CheckType</methodname>(<parameter>type_name, [includes, language]</parameter>)</term>
<listitem>
<para>Checks for the existence of a type defined by
-<emphasis role="bold">typedef</emphasis>.
-<emphasis>type_name</emphasis>
+<literal>typedef</literal>.
+<parameter>type_name</parameter>
specifies the typedef name to check for.
-<emphasis>includes</emphasis>
+<parameter>includes</parameter>
is a string containing one or more
<literal>#include</literal>
lines that will be inserted into the program
that will be run to test for the existence of the type.
-The optional
-<emphasis>language</emphasis>
-argument should be
-<emphasis role="bold">C</emphasis>
-or
-<emphasis role="bold">C++</emphasis>
-and selects the compiler to be used for the check;
-the default is "C".
Example:</para>
<programlisting language="python">
sconf.CheckType('foo_type', '#include "my_types.h"', 'C++')
</programlisting>
+<para>
+Returns an empty string on success, a string containing
+an error message on failure.
+</para>
+
</listitem>
</varlistentry>
<varlistentry>
- <term>SConf.CheckCC(<emphasis>self</emphasis>)</term>
- <term><replaceable>context</replaceable>.CheckCC(<emphasis>self</emphasis>)</term>
+ <term><literal>SConf</literal>.<function>CheckCC</function>(<parameter>context</parameter>)</term>
+ <term><replaceable>context</replaceable>.<methodname>CheckCC</methodname>()</term>
<listitem>
-<para>Checks whether the C compiler (as defined by the CC &consvar;) works
-by trying to compile a small source file.</para>
+<para>Checks whether the C compiler (as defined by the
+<varname>CC</varname> &consvar;) works
+by trying to compile a small source file.
+Returns a boolean indicating success or failure.</para>
<para>By default, SCons only detects if there is a program with the correct name, not
if it is a functioning compiler.</para>
-<para>This uses the exact same command than the one used by the object builder for C
-source file, so it can be used to detect if a particular compiler flag works or
+<para>This uses the exact same command as the one used by the object builder for C
+source files, so it can be used to detect if a particular compiler flag works or
not.</para>
</listitem>
</varlistentry>
<varlistentry>
- <term>SConf.CheckCXX(<emphasis>self</emphasis>)</term>
- <term><replaceable>context</replaceable>.CheckCXX(<emphasis>self</emphasis>)</term>
+ <term><literal>SConf</literal>.<function>CheckCXX</function>(<parameter>context</parameter>)</term>
+ <term><replaceable>context</replaceable>.<methodname>CheckCXX</methodname>()</term>
<listitem>
-<para>Checks whether the C++ compiler (as defined by the CXX &consvar;)
-works by trying to compile a small source file. By default, SCons only detects
-if there is a program with the correct name, not if it is a functioning compiler.</para>
+<para>Checks whether the C++ compiler (as defined by the
+<varname>CXX</varname> &consvar;)
+works by trying to compile a small source file. By default,
+SCons only detects if there is a program with the correct name,
+not if it is a functioning compiler.
+Returns a boolean indicating success or failure.</para>
-<para>This uses the exact same command than the one used by the object builder for
-CXX source files, so it can be used to detect if a particular compiler flag
+<para>This uses the exact same command as the one used by the object builder for
+C++ source files, so it can be used to detect if a particular compiler flag
works or not.</para>
</listitem>
</varlistentry>
<varlistentry>
- <term>SConf.CheckSHCC(<emphasis>self</emphasis>)</term>
- <term><replaceable>context</replaceable>.CheckSHCC(<emphasis>self</emphasis>)</term>
+ <term><literal>SConf</literal>.<function>CheckSHCC</function>(<parameter>context</parameter>)</term>
+ <term><replaceable>context</replaceable>.<methodname>CheckSHCC</methodname>()</term>
<listitem>
-<para>Checks whether the C compiler (as defined by the SHCC &consvar;) works
-by trying to compile a small source file. By default, SCons only detects if
-there is a program with the correct name, not if it is a functioning compiler.</para>
+<para>Checks whether the shared-object C compiler (as defined by the
+<varname>SHCC</varname> &consvar;) works
+by trying to compile a small source file. By default,
+SCons only detects if there is a program with the correct name,
+not if it is a functioning compiler.
+Returns a boolean indicating success or failure.</para>
-<para>This uses the exact same command than the one used by the object builder for C
+<para>This uses the exact same command as the one used by the object builder for C
source file, so it can be used to detect if a particular compiler flag works or
not. This does not check whether the object code can be used to build a shared
library, only that the compilation (not link) succeeds.</para>
@@ -3643,97 +3659,90 @@ library, only that the compilation (not link) succeeds.</para>
</varlistentry>
<varlistentry>
- <term>SConf.CheckSHCXX(<emphasis>self</emphasis>)</term>
- <term><replaceable>context</replaceable>.CheckSHCXX(<emphasis>self</emphasis>)</term>
+ <term><literal>SConf</literal>.<function>CheckSHCXX</function>(<parameter>context</parameter>)</term>
+ <term><replaceable>context</replaceable>.<methodname>CheckSHCXX</methodname>()</term>
<listitem>
-<para>Checks whether the C++ compiler (as defined by the SHCXX &consvar;)
-works by trying to compile a small source file. By default, SCons only detects
-if there is a program with the correct name, not if it is a functioning compiler.</para>
+<para>Checks whether the shared-object C++ compiler (as defined by the
+<varname>SHCXX</varname> &consvar;)
+works by trying to compile a small source file. By default,
+SCons only detects if there is a program with the correct name,
+not if it is a functioning compiler.
+Returns a boolean indicating success or failure.</para>
-<para>This uses the exact same command than the one used by the object builder for
-CXX source files, so it can be used to detect if a particular compiler flag
+<para>This uses the exact same command as the one used by the object builder for
+C++ source files, so it can be used to detect if a particular compiler flag
works or not. This does not check whether the object code can be used to build
a shared library, only that the compilation (not link) succeeds.</para>
</listitem>
</varlistentry>
<varlistentry>
- <term>SConf.CheckTypeSize(<emphasis>context</emphasis>, <emphasis>type_name</emphasis>, [<emphasis>header</emphasis>, <emphasis>language</emphasis>, <emphasis>expect</emphasis>])</term>
- <term><replaceable>context</replaceable>.CheckTypeSize(<emphasis>type_name</emphasis>, [<emphasis>header</emphasis>, <emphasis>language</emphasis>, <emphasis>expect</emphasis>])</term>
+ <term><literal>SConf</literal>.<function>CheckTypeSize</function>(<parameter>context, type_name, [header, language, expect]</parameter>)</term>
+ <term><replaceable>context</replaceable>.<methodname>CheckTypeSize</methodname>(<parameter>type_name, [header, language, expect]</parameter>)</term>
<listitem>
<para>Checks for the size of a type defined by
-<emphasis role="bold">typedef</emphasis>.
-<emphasis>type_name</emphasis>
+<literal>typedef</literal>.
+<parameter>type_name</parameter>
specifies the typedef name to check for.
The optional
-<emphasis>header</emphasis>
+<parameter>header</parameter>
argument is a string
that will be
placed at the top
of the test file
that will be compiled
-to check if the function exists;
+to check if the type exists;
the default is empty.
-The optional
-<emphasis>language</emphasis>
-argument should be
-<emphasis role="bold">C</emphasis>
-or
-<emphasis role="bold">C++</emphasis>
-and selects the compiler to be used for the check;
-the default is "C".
-The optional
-<emphasis>expect</emphasis>
-argument should be an integer.
-If this argument is used,
-the function will only check whether the type
-given in type_name has the expected size (in bytes).
+If the optional
+<parameter>expect</parameter>,
+is supplied, it should be an integer size;
+&CheckTypeSize; will fail unless
+<parameter>type_name</parameter> is actually
+that size.
+Returns the size in bytes, or zero if the type was not found
+(or if the size did not match <parameter>expect</parameter>).</para>
+
+<para>
For example,</para>
<programlisting language="python">
CheckTypeSize('short', expect=2)
</programlisting>
-<para>will return success only if short is two bytes.</para>
+<para>will return the size <literal>2</literal> only if short is
+actually two bytes.</para>
</listitem>
</varlistentry>
<varlistentry>
- <term>SConf.CheckDeclaration(<emphasis>context</emphasis>, <emphasis>symbol</emphasis>, [<emphasis>includes</emphasis>, <emphasis>language</emphasis>])</term>
- <term><replaceable>context</replaceable>.CheckDeclaration(<emphasis>symbol</emphasis>, [<emphasis>includes</emphasis>, <emphasis>language</emphasis>])</term>
+ <term><literal>SConf</literal>.<function>CheckDeclaration</function>(<parameter>context, symbol, [includes, language]</parameter>)</term>
+ <term><replaceable>context</replaceable>.<methodname>CheckDeclaration</methodname>(<parameter>symbol, [includes, language]</parameter>)</term>
<listitem>
<para>Checks if the specified
-<emphasis>symbol</emphasis>
+<parameter>symbol</parameter>
is declared.
-<emphasis>includes</emphasis>
+<parameter>includes</parameter>
is a string containing one or more
-<emphasis role="bold">#include</emphasis>
+<literal>#include</literal>
lines that will be inserted into the program
-that will be run to test for the existence of the type.
-The optional
-<emphasis>language</emphasis>
-argument should be
-<emphasis role="bold">C</emphasis>
-or
-<emphasis role="bold">C++</emphasis>
-and selects the compiler to be used for the check;
-the default is "C".</para>
+that will be run to test for the existence of the symbol.
+Returns a boolean indicating success or failure.</para>
</listitem>
</varlistentry>
<varlistentry>
- <term>SConf.Define(<emphasis>context</emphasis>, <emphasis>symbol</emphasis>, [<emphasis>value</emphasis>, <emphasis>comment</emphasis>])</term>
- <term><replaceable>context</replaceable>.Define(<emphasis>symbol</emphasis>, [<emphasis>value</emphasis>, <emphasis>comment</emphasis>])</term>
+ <term><literal>SConf</literal>.<function>Define</function>(<parameter>context, symbol, [value, comment]</parameter>)</term>
+ <term><replaceable>context</replaceable>.<methodname>Define</methodname>(<parameter>symbol, [value, comment]</parameter>)</term>
<listitem>
<para>This function does not check for anything, but defines a
preprocessor symbol that will be added to the configuration header file.
-It is the equivalent of AC_DEFINE,
+It is the equivalent of <constant>AC_DEFINE</constant>,
and defines the symbol
-<emphasis>name</emphasis>
+<parameter>name</parameter>
with the optional
-<emphasis role="bold">value</emphasis>
+<parameter>value</parameter>
and the optional comment
-<emphasis role="bold">comment</emphasis>.</para>
+<parameter>comment</parameter>.</para>
<para>Define Examples:</para>
@@ -3783,112 +3792,119 @@ conf.Define("A_SYMBOL", 1, "Set to 1 if you have a symbol")
</varlistentry>
</variablelist>
-<para>You can define your own custom checks.
+<para>You can define your own custom checks
in addition to the predefined checks.
-These are passed in a dictionary to the Configure function.
+You pass a dictionary of these
+to the &Configure; function
+as the <parameter>custom_tests</parameter> argument.
This dictionary maps the names of the checks
-to user defined Python callables
-(either Python functions or class instances implementing the
-<emphasis>__call__</emphasis>
+to the user defined Python callables
+(either Python functions or class instances implementing a
+<methodname>__call__</methodname>
method).
-The first argument of the call is always a
-<emphasis>CheckContext</emphasis>
+Each custom check will be called with a first
+argument of a <emphasis>CheckContext</emphasis>,
instance followed by the arguments,
which must be supplied by the user of the check.
-These CheckContext instances define the following methods:</para>
+A CheckContext instance defines the following methods:</para>
<variablelist>
<varlistentry>
- <term>CheckContext.Message(<emphasis>self</emphasis>, <emphasis>text</emphasis>)</term>
+ <term><replaceable>context</replaceable>.<methodname>Message</methodname>(<parameter>text</parameter>)</term>
<listitem>
-<para>Usually called before the check is started.
-<emphasis>text</emphasis>
-will be displayed to the user, e.g. 'Checking for library X...'</para>
+<para>Displays a message, as an indicator of progess.
+<parameter>text</parameter>
+will be displayed, e.g.
+<computeroutput>Checking for library X...</computeroutput>.
+Usually called before the check is started.
+</para>
</listitem>
</varlistentry>
<varlistentry>
- <term>CheckContext.Result(<emphasis>self</emphasis>, <emphasis>res</emphasis>)</term>
+ <term><replaceable>context</replaceable>.<methodname>Result</methodname>(<parameter>res</parameter>)</term>
<listitem>
-<para>Usually called after the check is done.
-<emphasis>res</emphasis>
-can be either an integer or a string. In the former case, 'yes' (res != 0)
-or 'no' (res == 0) is displayed to the user, in the latter case the
-given string is displayed.</para>
+<para>Displays a <quote>result</quote> message, as an indicator of progress.
+
+<parameter>res</parameter>
+can be either an integer or a string. If an integer, displays
+<computeroutput>yes</computeroutput>
+(if <parameter>res</parameter> evaluates <constant>True</constant>)
+or <computeroutput>no</computeroutput>
+(if <parameter>res</parameter> evaluates <constant>False</constant>).
+If a string, it is displayed as-is.
+Usually called after the check has completed.</para>
</listitem>
</varlistentry>
<varlistentry>
- <term>CheckContext.TryCompile(<emphasis>self</emphasis>, <emphasis>text</emphasis>, <emphasis>extension</emphasis>)</term>
+ <term><replaceable>context</replaceable>.<methodname>TryCompile</methodname>(<parameter>text, extension=''</parameter>)</term>
<listitem>
<para>Checks if a file with the specified
-<emphasis>extension</emphasis>
+<parameter>extension</parameter>
(e.g. '.c') containing
-<emphasis>text</emphasis>
+<parameter>text</parameter>
can be compiled using the environment's
-<emphasis role="bold">Object</emphasis>
-builder. Returns 1 on success and 0 on failure.</para>
+&Object; builder.
+Returns a boolean indicating success or failure.</para>
</listitem>
</varlistentry>
<varlistentry>
- <term>CheckContext.TryLink(<emphasis>self</emphasis>, <emphasis>text</emphasis>, <emphasis>extension</emphasis>)</term>
+ <term><replaceable>context</replaceable>.<methodname>TryLink</methodname>(<parameter>text, extension=''</parameter>)</term>
<listitem>
<para>Checks, if a file with the specified
-<emphasis>extension</emphasis>
+<parameter>extension</parameter>
(e.g. '.c') containing
-<emphasis>text</emphasis>
-can be compiled using the environment's
-<emphasis role="bold">Program</emphasis>
-builder. Returns 1 on success and 0 on failure.</para>
+<parameter>text</parameter>
+can be compiled using the environment's &Program; builder.
+Returns a boolean indicating success or failure.</para>
</listitem>
</varlistentry>
<varlistentry>
- <term>CheckContext.TryRun(<emphasis>self</emphasis>, <emphasis>text</emphasis>, <emphasis>extension</emphasis>)</term>
+ <term><replaceable>context</replaceable>.<methodname>TryRun</methodname>(<parameter>text, extension=''</parameter>)</term>
<listitem>
-<para>Checks, if a file with the specified
-<emphasis>extension</emphasis>
+<para>Checks if a file with the specified
+<parameter>extension</parameter>
(e.g. '.c') containing
-<emphasis>text</emphasis>
+<parameter>text</parameter>
can be compiled using the environment's
-<emphasis role="bold">Program</emphasis>
-builder. On success, the program is run. If the program
+&Program; builder. On success, the program is run. If the program
executes successfully
(that is, its return status is 0),
a tuple
<emphasis>(1, outputStr)</emphasis>
is returned, where
-<emphasis>outputStr</emphasis>
+<varname>outputStr</varname>
is the standard output of the
program.
If the program fails execution
(its return status is non-zero),
-then (0, '') is returned.</para>
+then <emphasis>(0, '')</emphasis> is returned.</para>
</listitem>
</varlistentry>
<varlistentry>
- <term>CheckContext.TryAction(<emphasis>self</emphasis>, <emphasis>action</emphasis>, [<emphasis>text</emphasis>, <emphasis>extension</emphasis>])</term>
+ <term><replaceable>context</replaceable>.<methodname>TryAction</methodname>(<parameter>action, [text, extension='']</parameter>)</term>
<listitem>
<para>Checks if the specified
-<emphasis>action</emphasis>
+<parameter>action</parameter>
with an optional source file (contents
-<emphasis>text</emphasis>
-, extension
-<emphasis>extension</emphasis>
-= ''
-) can be executed.
-<emphasis>action</emphasis>
+<parameter>text</parameter>,
+extension
+<parameter>extension</parameter>)
+can be executed.
+<parameter>action</parameter>
may be anything which can be converted to a
&scons;
Action.
On success,
<emphasis>(1, outputStr)</emphasis>
is returned, where
-<emphasis>outputStr</emphasis>
+<varname>outputStr</varname>
is the content of the target file.
On failure
<emphasis>(0, '')</emphasis>
@@ -3897,23 +3913,24 @@ is returned.</para>
</varlistentry>
<varlistentry>
- <term>CheckContext.TryBuild(<emphasis>self</emphasis>, <emphasis>builder</emphasis>, [<emphasis>text</emphasis>, <emphasis>extension</emphasis>])</term>
+ <term><replaceable>context</replaceable>.<methodname>TryBuild</methodname>(<parameter>builder[, text, extension='']</parameter>)</term>
<listitem>
<para>Low level implementation for testing specific builds;
the methods above are based on this method.
Given the Builder instance
-<emphasis>builder</emphasis>
+<parameter>builder</parameter>
and the optional
-<emphasis>text</emphasis>
+<parameter>text</parameter>
of a source file with optional
-<emphasis>extension</emphasis>,
-this method returns 1 on success and 0 on failure. In addition,
-<emphasis>self.lastTarget</emphasis>
-is set to the build target node, if the build was successful.</para>
+<parameter>extension</parameter>,
+returns a boolean indicating success or failure.
+In addition,
+<varname>context.lastTarget</varname>
+is set to the build target node if the build was successful.</para>
</listitem>
</varlistentry>
</variablelist>
-<para>Example for implementing and using custom tests:</para>
+<para>Example of implementing and using custom tests:</para>
<programlisting language="python">
def CheckQt(context, qtdir):
@@ -3921,7 +3938,7 @@ def CheckQt(context, qtdir):
lastLIBS = context.env['LIBS']
lastLIBPATH = context.env['LIBPATH']
lastCPPPATH= context.env['CPPPATH']
- context.env.Append(LIBS = 'qt', LIBPATH = qtdir + '/lib', CPPPATH = qtdir + '/include' )
+ context.env.Append(LIBS='qt', LIBPATH=qtdir + '/lib', CPPPATH=qtdir + '/include')
ret = context.TryLink("""
#include &lt;qapp.h&gt;
int main(int argc, char **argv) {
@@ -3930,12 +3947,12 @@ int main(int argc, char **argv) {
}
""")
if not ret:
- context.env.Replace(LIBS = lastLIBS, LIBPATH=lastLIBPATH, CPPPATH=lastCPPPATH)
+ context.env.Replace(LIBS=lastLIBS, LIBPATH=lastLIBPATH, CPPPATH=lastCPPPATH)
context.Result( ret )
return ret
env = Environment()
-conf = Configure( env, custom_tests = { 'CheckQt' : CheckQt } )
+conf = Configure(env, custom_tests = {'CheckQt': CheckQt})
if not conf.CheckQt('/usr/lib/qt'):
print('We really need qt!')
Exit(1)
@@ -5610,11 +5627,8 @@ and configured with the same &consenv;
into single invocations of the Action object's
command line or function.
Command lines will typically want to use the
-<emphasis role="bold">CHANGED_SOURCES</emphasis>
-&consvar;
-(and possibly
-<emphasis role="bold">CHANGED_TARGETS</emphasis>
-as well)
+&cv-CHANGED_SOURCES; &consvar;
+(and possibly &cv-CHANGED_TARGETS; as well)
to only pass to the command line those sources that
have actually changed since their targets were built.</para>
@@ -5944,7 +5958,7 @@ special variables for each command execution:</para>
<variablelist>
<varlistentry>
- <term>CHANGED_SOURCES</term>
+ <term>&cv-CHANGED_SOURCES;</term>
<listitem>
<para>The file names of all sources of the build command
that have changed since the target was last built.</para>
@@ -5952,7 +5966,7 @@ that have changed since the target was last built.</para>
</varlistentry>
<varlistentry>
- <term>CHANGED_TARGETS</term>
+ <term>&cv-CHANGED_TARGETS;</term>
<listitem>
<para>The file names of all targets that would be built
from sources that have changed since the target was last built.</para>
@@ -5960,7 +5974,7 @@ from sources that have changed since the target was last built.</para>
</varlistentry>
<varlistentry>
- <term>SOURCE</term>
+ <term>&cv-SOURCE;</term>
<listitem>
<para>The file name of the source of the build command,
or the file name of the first source
@@ -5969,14 +5983,14 @@ if multiple sources are being built.</para>
</varlistentry>
<varlistentry>
- <term>SOURCES</term>
+ <term>&cv-SOURCES;</term>
<listitem>
<para>The file names of the sources of the build command.</para>
</listitem>
</varlistentry>
<varlistentry>
- <term>TARGET</term>
+ <term>&cv-TARGET;</term>
<listitem>
<para>The file name of the target being built,
or the file name of the first target
@@ -5985,14 +5999,14 @@ if multiple targets are being built.</para>
</varlistentry>
<varlistentry>
- <term>TARGETS</term>
+ <term>&cv-TARGETS;</term>
<listitem>
<para>The file names of all targets being built.</para>
</listitem>
</varlistentry>
<varlistentry>
- <term>UNCHANGED_SOURCES</term>
+ <term>&cv-UNCHANGED_SOURCES;</term>
<listitem>
<para>The file names of all sources of the build command
that have
@@ -6002,7 +6016,7 @@ changed since the target was last built.</para>
</varlistentry>
<varlistentry>
- <term>UNCHANGED_TARGETS</term>
+ <term>&cv-UNCHANGED_TARGETS;</term>
<listitem>
<para>The file names of all targets that would be built
from sources that have
@@ -6183,7 +6197,7 @@ ${SOURCE.rsrcdir} =&gt; /usr/repository/src
to enclose arbitrary Python code to be evaluated.
(In fact, this is how the above modifiers are substituted,
they are simply attributes of the Python objects
-that represent TARGET, SOURCES, etc.)
+that represent &cv-TARGET;, &cv-SOURCES;, etc.)
See the section "Python Code Substitution" below,
for more thorough examples of
how this can be used.</para>
@@ -6245,7 +6259,7 @@ env=Environment(FOO=foo, BAR="$FOO baz")
Python function by creating a callable class
that stores one or more arguments in an object,
and then uses them when the
-<function>__call__()</function>
+<methodname>__call__()</methodname>
method is called.
Note that in this case,
the entire variable expansion must
diff --git a/doc/scons.mod b/doc/scons.mod
index bc63a42..006107e 100644
--- a/doc/scons.mod
+++ b/doc/scons.mod
@@ -447,6 +447,8 @@
<!ENTITY Consenvs "<phrase xmlns='http://www.scons.org/dbxsd/v1.0'>Construction environments</phrase>">
<!ENTITY consenv "<phrase xmlns='http://www.scons.org/dbxsd/v1.0'>construction environment</phrase>">
<!ENTITY consenvs "<phrase xmlns='http://www.scons.org/dbxsd/v1.0'>construction environments</phrase>">
+<!ENTITY DefEnv "<phrase xmlns='http://www.scons.org/dbxsd/v1.0'>Default Environment</phrase>">
+<!ENTITY defenv "<phrase xmlns='http://www.scons.org/dbxsd/v1.0'>default environment</phrase>">
<!ENTITY ConsVar "<phrase xmlns='http://www.scons.org/dbxsd/v1.0'>Construction Variable</phrase>">
<!ENTITY ConsVars "<phrase xmlns='http://www.scons.org/dbxsd/v1.0'>Construction Variables</phrase>">
diff --git a/doc/user/html.xsl b/doc/user/html.xsl
index 0c215cf..2cef43d 100644
--- a/doc/user/html.xsl
+++ b/doc/user/html.xsl
@@ -28,7 +28,7 @@
xmlns:fo="http://www.w3.org/1999/XSL/Format"
version="1.0">
- <xsl:import href="../../src/engine/SCons/Tool/docbook/docbook-xsl-1.76.1/html/docbook.xsl"/>
+<xsl:import href="../../src/engine/SCons/Tool/docbook/docbook-xsl-1.76.1/html/docbook.xsl"/>
<xsl:param name="l10n.gentext.default.language" select="'en'"/>
<xsl:param name="section.autolabel" select="1"/>
@@ -54,9 +54,14 @@ reference toc,title
set toc,title
</xsl:param>
+<xsl:template match="function">
+ <xsl:call-template name="inline.boldmonoseq"/>
+</xsl:template>
+<xsl:template match="methodname">
+ <xsl:call-template name="inline.boldmonoseq"/>
+</xsl:template>
<!-- Prevent our EPUB cover image from getting included -->
<xsl:template match="mediaobject[@role = 'cover']">
</xsl:template>
</xsl:stylesheet>
-
diff --git a/doc/user/sconf.xml b/doc/user/sconf.xml
index 109e468..8961606 100644
--- a/doc/user/sconf.xml
+++ b/doc/user/sconf.xml
@@ -46,35 +46,29 @@
<para>
- &SCons; has integrated support for multi-platform build configuration
- similar to that offered by GNU &Autoconf;,
- such as
- figuring out what libraries or header files
- are available on the local system.
+ &SCons; has integrated support for build configuration
+ similar in style to GNU &Autoconf;, but designed to be
+ transparently multi-platform. The configuration system
+ can help figure out if external build requirements such
+ as system libraries or header files
+ are available on the build system.
This section describes how to use
this &SCons; feature.
+ (See also the &SCons; man page for additional information).
</para>
- <note>
- <para>
- This chapter is still under development,
- so not everything is explained as well as it should be.
- See the &SCons; man page for additional information.
- </para>
- </note>
-
<section>
<title>&Configure_Contexts;</title>
<para>
The basic framework for multi-platform build configuration
- in &SCons; is to attach a &configure_context; to a
- construction environment by calling the &Configure; function,
- perform a number of checks for
+ in &SCons; is to create a &configure_context; inside a
+ &consenv; by calling the &Configure; function,
+ perform the desired checks for
libraries, functions, header files, etc.,
- and to then call the configure context's &Finish; method
+ and then call the configure context's &Finish; method
to finish off the configuration:
</para>
@@ -88,7 +82,15 @@ env = conf.Finish()
<para>
- &SCons; provides a number of basic checks,
+ The &Finish; call is required; if a new context is
+ created while a context is active, even in a different
+ &consenv;, &scons; will complain and exit.
+
+ </para>
+
+ <para>
+
+ &SCons; provides a number of pre-defined basic checks,
as well as a mechanism for adding your own custom checks.
</para>
@@ -125,8 +127,11 @@ env = conf.Finish()
Testing the existence of a header file
requires knowing what language the header file is.
- A configure context has a &CheckCHeader; method
- that checks for the existence of a C header file:
+ This information is supplied in the <varname>language</varname>
+ keyword parameter to the &CheckHeader; method.
+ Since &scons; grew up in a world of C/C++ code,
+ a &configure_context; also has a &CheckCHeader; method
+ that specifically checks for the existence of a C header file:
</para>
@@ -134,7 +139,7 @@ env = conf.Finish()
env = Environment()
conf = Configure(env)
if not conf.CheckCHeader('math.h'):
- print 'Math.h must be installed!'
+ print('Math.h must be installed!')
Exit(1)
if conf.CheckCHeader('foo.h'):
conf.env.Append('-DHAS_FOO_H')
@@ -143,10 +148,18 @@ env = conf.Finish()
<para>
- Note that you can choose to terminate
+ As shown in the example, depending on the circumstances
+ you can choose to terminate
the build if a given header file doesn't exist,
or you can modify the construction environment
- based on the existence of a header file.
+ based on the presence or absence of a header file
+ (the same applies to any other check). If there are a
+ many elements to check for, it may be friendlier for
+ the user if you do not terminate on the first failure,
+ but track the problems found until the end and report on
+ all of them, that way the user does not have to iterate
+ multiple times, each time finding one new dependency that
+ needs to be installed.
</para>
@@ -162,7 +175,7 @@ env = conf.Finish()
env = Environment()
conf = Configure(env)
if not conf.CheckCXXHeader('vector.h'):
- print 'vector.h must be installed!'
+ print('vector.h must be installed!')
Exit(1)
env = conf.Finish()
</sconstruct>
@@ -183,8 +196,8 @@ env = conf.Finish()
env = Environment()
conf = Configure(env)
if not conf.CheckFunc('strcpy'):
- print 'Did not find strcpy(), using local version'
- conf.env.Append(CPPDEFINES = '-Dstrcpy=my_local_strcpy')
+ print('Did not find strcpy(), using local version')
+ conf.env.Append(CPPDEFINES='-Dstrcpy=my_local_strcpy')
env = conf.Finish()
</sconstruct>
@@ -197,7 +210,7 @@ env = conf.Finish()
Check for the availability of a library
using the &CheckLib; method.
- You only specify the basename of the library,
+ You only specify the base part of the library name,
you don't need to add a <literal>lib</literal>
prefix or a <literal>.a</literal> or <literal>.lib</literal> suffix:
@@ -207,7 +220,7 @@ env = conf.Finish()
env = Environment()
conf = Configure(env)
if not conf.CheckLib('m'):
- print 'Did not find libm.a or m.lib, exiting!'
+ print('Did not find libm.a or m.lib, exiting!')
Exit(1)
env = conf.Finish()
</sconstruct>
@@ -227,8 +240,8 @@ env = conf.Finish()
<sconstruct>
env = Environment()
conf = Configure(env)
-if not conf.CheckLibWithHeader('m', 'math.h', 'c'):
- print 'Did not find libm.a or m.lib, exiting!'
+if not conf.CheckLibWithHeader('m', 'math.h', language='c'):
+ print('Did not find libm.a or m.lib, exiting!')
Exit(1)
env = conf.Finish()
</sconstruct>
@@ -257,8 +270,8 @@ env = conf.Finish()
env = Environment()
conf = Configure(env)
if not conf.CheckType('off_t'):
- print 'Did not find off_t typedef, assuming int'
- conf.env.Append(CCFLAGS = '-Doff_t=int')
+ print('Did not find off_t typedef, assuming int')
+ conf.env.Append(CCFLAGS='-Doff_t=int')
env = conf.Finish()
</sconstruct>
@@ -276,8 +289,8 @@ env = conf.Finish()
env = Environment()
conf = Configure(env)
if not conf.CheckType('off_t', '#include &lt;sys/types.h&gt;\n'):
- print 'Did not find off_t typedef, assuming int'
- conf.env.Append(CCFLAGS = '-Doff_t=int')
+ print('Did not find off_t typedef, assuming int')
+ conf.env.Append(CCFLAGS='-Doff_t=int')
env = conf.Finish()
</sconstruct>
@@ -292,7 +305,7 @@ env = conf.Finish()
env = Environment()
conf = Configure(env)
int_size = conf.CheckTypeSize('unsigned int')
-print 'sizeof unsigned int is', int_size
+print('sizeof unsigned int is', int_size)
env = conf.Finish()
</sconstruct>
@@ -317,7 +330,7 @@ scons: `.' is up to date.
env = Environment()
conf = Configure(env)
if not conf.CheckProg('foobar'):
- print 'Unable to find the program foobar on the system'
+ print('Unable to find the program foobar on the system')
Exit(1)
env = conf.Finish()
</sconstruct>
@@ -399,7 +412,7 @@ def CheckMyLibrary(context):
<sconstruct>
env = Environment()
-conf = Configure(env, custom_tests = {'CheckMyLibrary' : CheckMyLibrary})
+conf = Configure(env, custom_tests={'CheckMyLibrary': CheckMyLibrary})
</sconstruct>
<para>
@@ -436,9 +449,9 @@ def CheckMyLibrary(context):
return result
env = Environment()
-conf = Configure(env, custom_tests = {'CheckMyLibrary' : CheckMyLibrary})
+conf = Configure(env, custom_tests={'CheckMyLibrary': CheckMyLibrary})
if not conf.CheckMyLibrary():
- print 'MyLibrary is not installed!'
+ print('MyLibrary is not installed!')
Exit(1)
env = conf.Finish()
@@ -516,9 +529,9 @@ Removed foo
<sconstruct>
env = Environment()
if not env.GetOption('clean'):
- conf = Configure(env, custom_tests = {'CheckMyLibrary' : CheckMyLibrary})
+ conf = Configure(env, custom_tests={'CheckMyLibrary': CheckMyLibrary})
if not conf.CheckMyLibrary():
- print 'MyLibrary is not installed!'
+ print('MyLibrary is not installed!')
Exit(1)
env = conf.Finish()
</sconstruct>
diff --git a/gentoo/scons.ebuild.in b/gentoo/scons.ebuild.in
deleted file mode 100644
index 50c9ad9..0000000
--- a/gentoo/scons.ebuild.in
+++ /dev/null
@@ -1,26 +0,0 @@
-# Copyright 1999-2003 Gentoo Technologies, Inc.
-# Distributed under the terms of the GNU General Public License v2
-# $__NULL__Header: /home/cvsroot/gentoo-x86/dev-util/scons/scons-__VERSION__.ebuild,v 1.2 2003/02/13 12:00:11 vapier Exp __NULL__$
-
-MY_P=${PN}-__VERSION__
-S=${WORKDIR}/${MY_P}
-DESCRIPTION="Extensible python-based build utility"
-SRC_URI="mirror://sourceforge/${PN}/${MY_P}.tar.gz"
-HOMEPAGE="http://www.scons.org"
-
-SLOT="0"
-LICENSE="as-is"
-KEYWORDS="~x86 ~sparc"
-
-DEPEND=">=dev-lang/python-2.4"
-
-src_compile() {
- python setup.py build
-}
-
-src_install () {
- python setup.py install --root=${D}
- dodoc *.txt PKG-INFO MANIFEST
- doman scons.1
- doman sconsign.1
-}
diff --git a/runtest.py b/runtest.py
index 3edf36c..519cc74 100755
--- a/runtest.py
+++ b/runtest.py
@@ -478,90 +478,31 @@ else:
Test = SystemExecutor
# --- start processing ---
-if package:
-
- dirs = {
- 'deb' : 'usr',
- 'local-tar-gz' : None,
- 'local-zip' : None,
- 'rpm' : 'usr',
- 'src-tar-gz' : '',
- 'src-zip' : '',
- 'tar-gz' : '',
- 'zip' : '',
- }
-
- # The hard-coded "python2.1" here is the library directory
- # name on Debian systems, not an executable, so it's all right.
- lib = {
- 'deb' : os.path.join('python2.1', 'site-packages')
- }
-
- if package not in dirs:
- sys.stderr.write("Unknown package '%s'\n" % package)
- sys.exit(2)
-
- test_dir = os.path.join(builddir, 'test-%s' % package)
-
- if dirs[package] is None:
- scons_script_dir = test_dir
- globs = glob.glob(os.path.join(test_dir, 'scons-local-*'))
- if not globs:
- sys.stderr.write("No `scons-local-*' dir in `%s'\n" % test_dir)
- sys.exit(2)
- scons_lib_dir = None
- pythonpath_dir = globs[len(globs)-1]
- elif sys.platform == 'win32':
- scons_script_dir = os.path.join(test_dir, dirs[package], 'Scripts')
- scons_lib_dir = os.path.join(test_dir, dirs[package])
- pythonpath_dir = scons_lib_dir
- else:
- scons_script_dir = os.path.join(test_dir, dirs[package], 'bin')
- sconslib = lib.get(package, 'scons')
- scons_lib_dir = os.path.join(test_dir, dirs[package], 'lib', sconslib)
- pythonpath_dir = scons_lib_dir
- scons_runtest_dir = builddir
+sd = None
+tools_dir = None
+ld = None
+if not baseline or baseline == '.':
+ base = cwd
+elif baseline == '-':
+ print("This logic used to checkout from svn. It's been removed. If you used this, please let us know on devel mailing list, IRC, or discord server")
+ sys.exit(-1)
else:
- sd = None
- ld = None
-
- if not baseline or baseline == '.':
- base = cwd
- elif baseline == '-':
- url = None
- with os.popen("svn info 2>&1", "r") as p:
- svn_info = p.read()
- match = re.search(r'URL: (.*)', svn_info)
- if match:
- url = match.group(1)
- if not url:
- sys.stderr.write('runtest.py: could not find a URL:\n')
- sys.stderr.write(svn_info)
- sys.exit(1)
- base = tempfile.mkdtemp(prefix='runtest-tmp-')
-
- command = 'cd %s && svn co -q %s' % (base, url)
-
- base = os.path.join(base, os.path.split(url)[1])
- if printcommand:
- print(command)
- if execute_tests:
- os.system(command)
- else:
- base = baseline
+ base = baseline
- scons_runtest_dir = base
+scons_runtest_dir = base
- if not external:
- scons_script_dir = sd or os.path.join(base, 'src', 'script')
- scons_lib_dir = ld or os.path.join(base, 'src', 'engine')
- else:
- scons_script_dir = sd or ''
- scons_lib_dir = ld or ''
+if not external:
+ scons_script_dir = sd or os.path.join(base, 'scripts')
+ scons_tools_dir = tools_dir or os.path.join(base, 'bin')
+ scons_lib_dir = ld or os.path.join(base, 'src', 'engine')
+else:
+ scons_script_dir = sd or ''
+ scons_tools_dir = tools_dir or ''
+ scons_lib_dir = ld or ''
- pythonpath_dir = scons_lib_dir
+pythonpath_dir = scons_lib_dir
if scons:
# Let the version of SCons that the -x option pointed to find
@@ -581,6 +522,7 @@ if external:
os.environ['SCONS_RUNTEST_DIR'] = scons_runtest_dir
os.environ['SCONS_SCRIPT_DIR'] = scons_script_dir
+os.environ['SCONS_TOOLS_DIR'] = scons_tools_dir
os.environ['SCONS_CWD'] = cwd
os.environ['SCONS_VERSION'] = version
diff --git a/src/script/MANIFEST.in b/scripts/MANIFEST.in
index d10cc82..d10cc82 100644
--- a/src/script/MANIFEST.in
+++ b/scripts/MANIFEST.in
diff --git a/scripts/scons-configure-cache.py b/scripts/scons-configure-cache.py
new file mode 100644
index 0000000..62cab56
--- /dev/null
+++ b/scripts/scons-configure-cache.py
@@ -0,0 +1,95 @@
+#! /usr/bin/env python
+#
+# SCons - a Software Constructor
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+"""Show or convert the configuration of an SCons cache directory.
+
+A cache of derived files is stored by file signature.
+The files are split into directories named by the first few
+digits of the signature. The prefix length used for directory
+names can be changed by this script.
+"""
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+__version__ = "__VERSION__"
+
+__build__ = "__BUILD__"
+
+__buildsys__ = "__BUILDSYS__"
+
+__date__ = "__DATE__"
+
+__developer__ = "__DEVELOPER__"
+
+
+import os
+import sys
+
+# python compatibility check
+if sys.version_info < (3, 5, 0):
+ msg = "scons: *** SCons version %s does not run under Python version %s.\n\
+Python >= 3.5 is required.\n"
+ sys.stderr.write(msg % (__version__, sys.version.split()[0]))
+ sys.exit(1)
+
+# Strip the script directory from sys.path so on case-insensitive
+# (WIN32) systems Python doesn't think that the "scons" script is the
+# "SCons" package.
+script_dir = os.path.dirname(os.path.realpath(__file__))
+script_path = os.path.realpath(os.path.dirname(__file__))
+if script_path in sys.path:
+ sys.path.remove(script_path)
+
+libs = []
+
+if "SCONS_LIB_DIR" in os.environ:
+ libs.append(os.environ["SCONS_LIB_DIR"])
+
+# running from source takes 2nd priority (since 2.3.2), following SCONS_LIB_DIR
+source_path = os.path.join(script_path, os.pardir, 'src', 'engine')
+if os.path.isdir(source_path):
+ libs.append(source_path)
+
+# add local-install locations
+local_version = 'scons-local-' + __version__
+local = 'scons-local'
+if script_dir:
+ local_version = os.path.join(script_dir, local_version)
+ local = os.path.join(script_dir, local)
+if os.path.isdir(local_version):
+ libs.append(os.path.abspath(local_version))
+if os.path.isdir(local):
+ libs.append(os.path.abspath(local))
+
+scons_version = 'scons-%s' % __version__
+
+sys.path = libs + sys.path
+
+##############################################################################
+# END STANDARD SCons SCRIPT HEADER
+##############################################################################
+from SCons.Utilities.ConfigureCache import main
+
+if __name__ == "__main__":
+ main() \ No newline at end of file
diff --git a/src/script/scons.bat b/scripts/scons.bat
index 10b8637..10b8637 100644
--- a/src/script/scons.bat
+++ b/scripts/scons.bat
diff --git a/scripts/scons.py b/scripts/scons.py
new file mode 100755
index 0000000..1dc6c78
--- /dev/null
+++ b/scripts/scons.py
@@ -0,0 +1,102 @@
+#! /usr/bin/env python
+#
+# SCons - a Software Constructor
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+__version__ = "__VERSION__"
+
+__build__ = "__BUILD__"
+
+__buildsys__ = "__BUILDSYS__"
+
+__date__ = "__DATE__"
+
+__developer__ = "__DEVELOPER__"
+
+
+import os
+import sys
+
+
+# Python compatibility check
+if sys.version_info < (3, 5, 0):
+ msg = "scons: *** SCons version %s does not run under Python version %s.\n\
+Python >= 3.5 is required.\n"
+ sys.stderr.write(msg % (__version__, sys.version.split()[0]))
+ sys.exit(1)
+
+# Strip the script directory from sys.path so on case-insensitive
+# (WIN32) systems Python doesn't think that the "scons" script is the
+# "SCons" package.
+script_dir = os.path.dirname(os.path.realpath(__file__))
+script_path = os.path.realpath(os.path.dirname(__file__))
+if script_path in sys.path:
+ sys.path.remove(script_path)
+
+libs = []
+
+if "SCONS_LIB_DIR" in os.environ:
+ libs.append(os.environ["SCONS_LIB_DIR"])
+
+# running from source takes 2nd priority (since 2.3.2), following SCONS_LIB_DIR
+source_path = os.path.join(script_path, os.pardir, 'src', 'engine')
+if os.path.isdir(source_path):
+ libs.append(source_path)
+
+# add local-install locations
+local_version = 'scons-local-' + __version__
+local = 'scons-local'
+if script_dir:
+ local_version = os.path.join(script_dir, local_version)
+ local = os.path.join(script_dir, local)
+if os.path.isdir(local_version):
+ libs.append(os.path.abspath(local_version))
+if os.path.isdir(local):
+ libs.append(os.path.abspath(local))
+
+sys.path = libs + sys.path
+
+##############################################################################
+# END STANDARD SCons SCRIPT HEADER
+##############################################################################
+
+if __name__ == "__main__":
+ try:
+ import SCons.Script
+ except ImportError:
+ sys.stderr.write("SCons import failed. Unable to find engine files in:\n")
+ for path in libs:
+ sys.stderr.write(" {}\n".format(path))
+ raise
+
+ # this does all the work, and calls sys.exit
+ # with the proper exit status when done.
+ SCons.Script.main()
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/scripts/sconsign.py b/scripts/sconsign.py
new file mode 100644
index 0000000..493bd40
--- /dev/null
+++ b/scripts/sconsign.py
@@ -0,0 +1,93 @@
+#! /usr/bin/env python
+#
+# SCons - a Software Constructor
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+__version__ = "__VERSION__"
+
+__build__ = "__BUILD__"
+
+__buildsys__ = "__BUILDSYS__"
+
+__date__ = "__DATE__"
+
+__developer__ = "__DEVELOPER__"
+
+import os
+import sys
+
+# python compatibility check
+if sys.version_info < (3, 5, 0):
+ msg = "scons: *** SCons version %s does not run under Python version %s.\n\
+Python >= 3.5 is required.\n"
+ sys.stderr.write(msg % (__version__, sys.version.split()[0]))
+ sys.exit(1)
+
+# Strip the script directory from sys.path so on case-insensitive
+# (WIN32) systems Python doesn't think that the "scons" script is the
+# "SCons" package.
+script_dir = os.path.dirname(os.path.realpath(__file__))
+script_path = os.path.realpath(os.path.dirname(__file__))
+if script_path in sys.path:
+ sys.path.remove(script_path)
+
+libs = []
+
+if "SCONS_LIB_DIR" in os.environ:
+ libs.append(os.environ["SCONS_LIB_DIR"])
+
+# running from source takes 2nd priority (since 2.3.2), following SCONS_LIB_DIR
+source_path = os.path.join(script_path, os.pardir, 'src', 'engine')
+if os.path.isdir(source_path):
+ libs.append(source_path)
+
+# add local-install locations
+local_version = 'scons-local-' + __version__
+local = 'scons-local'
+if script_dir:
+ local_version = os.path.join(script_dir, local_version)
+ local = os.path.join(script_dir, local)
+if os.path.isdir(local_version):
+ libs.append(os.path.abspath(local_version))
+if os.path.isdir(local):
+ libs.append(os.path.abspath(local))
+
+scons_version = 'scons-%s' % __version__
+
+sys.path = libs + sys.path
+
+##############################################################################
+# END STANDARD SCons SCRIPT HEADER
+##############################################################################
+from SCons.Utilities.sconsign import main
+if __name__ == "__main__":
+ main()
+ sys.exit(0)
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/setup.cfg b/setup.cfg
new file mode 100644
index 0000000..614303c
--- /dev/null
+++ b/setup.cfg
@@ -0,0 +1,66 @@
+[metadata]
+name = SCons
+version=3.9.9a991
+license = MIT
+author = William Deegan
+author_email =bill@baddogconsulting.com
+long_description = file: README.rst
+description = Open Source next-generation build tool.
+group = Development/Tools
+license_file = LICENSE
+
+
+url = http://www.scons.org/
+project-urls =
+ Documentation = https://scons.org/documentation.html
+ Twitter = https://twitter.com/SConsProject
+ GitHub = https://github.com/SCons/scons
+ Bug-Tracker = https://github.com/SCons/scons/issues
+
+
+classifiers =
+ Development Status :: 5 - Production/Stable
+ Topic :: Utilities
+ Programming Language :: Python
+ Programming Language :: Python :: 3
+ Programming Language :: Python :: 3 :: Only
+ Programming Language :: Python :: 3.5
+ Programming Language :: Python :: 3.6
+ Programming Language :: Python :: 3.7
+ Programming Language :: Python :: 3.8
+ Environment :: Console
+ Intended Audience :: Developers
+ License :: OSI Approved :: MIT License
+ Operating System :: POSIX :: Linux
+ Operating System :: Unix
+ Operating System :: MacOS
+ Operating System :: Microsoft :: Windows
+
+
+[options]
+zip_safe = False
+python_requires = >=3.5
+install_requires = setuptools
+setup_requires = setuptools
+include_package_data = True
+package_dir=
+ =src/engine
+packages = find:
+
+[options.packages.find]
+ where=src/engine
+
+[options.entry_points]
+console_scripts =
+ scons = SCons.Script.Main:main
+ sconsign = SCons.Utilities.sconsign:main
+ scons-configure-cache = SCons.Utilities.ConfigureCache:main
+
+
+[options.package_data]
+* = *.txt, *.rst
+SCons.Tool.docbook = *.*
+
+
+[bdist_wheel]
+universal=0
diff --git a/setup.py b/setup.py
new file mode 100644
index 0000000..d6b7783
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,25 @@
+import fnmatch
+from setuptools import setup
+from setuptools.command.build_py import build_py as build_py_orig
+
+
+exclude = ['*Tests']
+
+
+class build_py(build_py_orig):
+
+ def find_package_modules(self, package, package_dir):
+ """
+ Custom module to find package modules.
+ It will strip out any modules which match the glob patters in exclude above
+ """
+ modules = super().find_package_modules(package, package_dir)
+ return [(pkg, mod, file, ) for (pkg, mod, file, ) in modules
+ if not any(fnmatch.fnmatchcase(mod, pat=pattern)
+ for pattern in exclude)]
+
+setup(
+ cmdclass={
+ 'build_py': build_py,
+ }
+) \ No newline at end of file
diff --git a/site_scons/BuildCommandLine.py b/site_scons/BuildCommandLine.py
new file mode 100644
index 0000000..b8c7d63
--- /dev/null
+++ b/site_scons/BuildCommandLine.py
@@ -0,0 +1,147 @@
+import time
+import os
+import socket
+
+from SCons.Script import ARGUMENTS
+
+class BuildCommandLine(object):
+
+ git = None
+
+ def init_command_line_variables(self):
+ self.command_line_variables = [
+ ("BUILDDIR=", "The directory in which to build the packages. " +
+ "The default is the './build' subdirectory."),
+
+ ("BUILD_ID=", "An identifier for the specific build." +
+ "The default is the Subversion revision number."),
+
+ ("BUILD_SYSTEM=", "The system on which the packages were built. " +
+ "The default is whatever hostname is returned " +
+ "by socket.gethostname(). If SOURCE_DATE_EPOCH " +
+ "env var is set, '_reproducible' is the default."),
+
+ ("CHECKPOINT=", "The specific checkpoint release being packaged, " +
+ "which will be appended to the VERSION string. " +
+ "A value of CHECKPOINT=d will generate a string " +
+ "of 'd' plus today's date in the format YYYMMDD. " +
+ "A value of CHECKPOINT=r will generate a " +
+ "string of 'r' plus the Subversion revision " +
+ "number. Any other CHECKPOINT= string will be " +
+ "used as is. There is no default value."),
+
+ ("DATE=", "The date string representing when the packaging " +
+ "build occurred. The default is the day and time " +
+ "the SConstruct file was invoked, in the format " +
+ "YYYY/MM/DD HH:MM:SS."),
+
+ ("DEVELOPER=", "The developer who created the packages. " +
+ "The default is the first set environment " +
+ "variable from the list $USERNAME, $LOGNAME, $USER." +
+ "If the SOURCE_DATE_EPOCH env var is set, " +
+ "'_reproducible' is the default."),
+
+ ("REVISION=", "The revision number of the source being built. " +
+ "The default is the git hash returned " +
+ "'git rev-parse HEAD', with an appended string of " +
+ "'[MODIFIED]' if there are any changes in the " +
+ "working copy."),
+
+ ("VERSION=", "The SCons version being packaged. The default " +
+ "is the hard-coded value '%s' " % self.default_version +
+ "from this SConstruct file."),
+
+ ("SKIP_DOC=", "Skip building all documents. The default is False (build docs)"),
+ ]
+
+ def __init__(self, default_version="99.99.99"):
+ self.date = None
+ self.default_version = default_version
+ self.developer = None
+ self.build_dir = None
+ self.build_system = None
+ self.version = None
+ self.revision = None
+ self.git_status_lines = []
+ self.git_hash = None
+
+ self.init_command_line_variables()
+
+ def process_command_line_vars(self):
+ #
+ # Now grab the information that we "build" into the files.
+ #
+ self.date = ARGUMENTS.get('DATE')
+ if not self.date:
+ self.date = time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime(int(os.environ.get('SOURCE_DATE_EPOCH', time.time()))))
+
+ self.developer = ARGUMENTS.get('DEVELOPER')
+ if not self.developer:
+ for variable in ['USERNAME', 'LOGNAME', 'USER']:
+ self.developer = os.environ.get(variable)
+ if self.developer:
+ break
+ if os.environ.get('SOURCE_DATE_EPOCH'):
+ self.developer = '_reproducible'
+
+ self.build_system = ARGUMENTS.get('BUILD_SYSTEM')
+ if not self.build_system:
+ if os.environ.get('SOURCE_DATE_EPOCH'):
+ self.build_system = '_reproducible'
+ else:
+ self.build_system = socket.gethostname().split('.')[0]
+
+ self.version = ARGUMENTS.get('VERSION', '')
+ if not self.version:
+ self.version = self.default_version
+
+ if BuildCommandLine.git:
+ cmd = "%s ls-files 2> /dev/null" % BuildCommandLine.git
+ with os.popen(cmd, "r") as p:
+ self.git_status_lines = p.readlines()
+
+ self.revision = ARGUMENTS.get('REVISION', '')
+
+ def _generate_build_id(revision):
+ return revision
+
+ generate_build_id=_generate_build_id
+
+ if not self.revision and BuildCommandLine.git:
+ with os.popen("%s rev-parse HEAD 2> /dev/null" % BuildCommandLine.git, "r") as p:
+ self.git_hash = p.read().strip()
+
+ def _generate_build_id_git(revision):
+ result = self.git_hash
+ if [l for l in self.git_status_lines if 'modified' in l]:
+ result = result + '[MODIFIED]'
+ return result
+
+ generate_build_id = _generate_build_id_git
+ self.revision = self.git_hash
+
+ self.checkpoint = ARGUMENTS.get('CHECKPOINT', '')
+ if self.checkpoint:
+ if self.checkpoint == 'd':
+ self.checkpoint = time.strftime('%Y%m%d', time.localtime(time.time()))
+ elif self.checkpoint == 'r':
+ self.checkpoint = 'r' + self.revision
+ self.version = self.version + '.beta.' + self.checkpoint
+
+ self.build_id = ARGUMENTS.get('BUILD_ID')
+ if self.build_id is None:
+ if self.revision:
+ self.build_id = generate_build_id(self.revision)
+ else:
+ self.build_id = ''
+
+ # Re-exporting LD_LIBRARY_PATH is necessary if the Python version was
+ # built with the --enable-shared option.
+ self.ENV = {'PATH': os.environ['PATH']}
+ for key in ['LOGNAME', 'PYTHONPATH', 'LD_LIBRARY_PATH']:
+ if key in os.environ:
+ self.ENV[key] = os.environ[key]
+
+ self.build_dir = ARGUMENTS.get('BUILDDIR', 'build')
+ if not os.path.isabs(self.build_dir):
+ self.build_dir = os.path.normpath(os.path.join(os.getcwd(), self.build_dir))
diff --git a/site_scons/epydoc.py b/site_scons/epydoc.py
new file mode 100644
index 0000000..3d6e5de
--- /dev/null
+++ b/site_scons/epydoc.py
@@ -0,0 +1,100 @@
+#
+# Setup epydoc builder
+#
+
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+# from Utilities import whereis
+from SCons.Script import Delete, Touch, WhereIs
+
+epydoc_cli = WhereIs('epydoc')
+
+if not epydoc_cli:
+ try:
+ import epydoc
+ except ImportError:
+ epydoc = None
+ else:
+ # adding Epydoc builder using imported module
+ def epydoc_builder_action(target, source, env):
+ """
+ Take a list of `source` files and build docs for them in
+ `target` dir.
+
+ `target` and `source` are lists.
+
+ Uses OUTDIR and EPYDOCFLAGS environment variables.
+
+ http://www.scons.org/doc/2.0.1/HTML/scons-user/x3594.html
+ """
+
+ # the epydoc build process is the following:
+ # 1. build documentation index
+ # 2. feed doc index to writer for docs
+
+ from epydoc.docbuilder import build_doc_index
+ from epydoc.docwriter.html import HTMLWriter
+ # from epydoc.docwriter.latex import LatexWriter
+
+ # first arg is a list where can be names of python package dirs,
+ # python files, object names or objects itself
+ docindex = build_doc_index([str(src) for src in source])
+ if docindex is None:
+ return -1
+
+ if env['EPYDOCFLAGS'] == '--html':
+ html_writer = HTMLWriter(docindex,
+ docformat='restructuredText',
+ prj_name='SCons',
+ prj_url='http://www.scons.org/')
+ try:
+ html_writer.write(env['OUTDIR'])
+ except OSError: # If directory cannot be created or any file cannot
+ # be created or written to.
+ return -2
+
+ """
+ # PDF support requires external Linux utilites, so it's not crossplatform.
+ # Leaving for now.
+ # http://epydoc.svn.sourceforge.net/viewvc/epydoc/trunk/epydoc/src/epydoc/cli.py
+
+ elif env['EPYDOCFLAGS'] == '--pdf':
+ pdf_writer = LatexWriter(docindex,
+ docformat='restructuredText',
+ prj_name='SCons',
+ prj_url='http://www.scons.org/')
+ """
+ return 0
+
+ epydoc_commands = [
+ Delete('$OUTDIR'),
+ epydoc_builder_action,
+ Touch('$TARGET'),
+ ]
+
+else:
+ # epydoc_cli is found
+ epydoc_commands = [
+ Delete('$OUTDIR'),
+ '$EPYDOC $EPYDOCFLAGS --debug --output $OUTDIR --docformat=restructuredText --name SCons --url http://www.scons.org/ $SOURCES',
+ Touch('$TARGET'),
+ ]
diff --git a/site_scons/site_init.py b/site_scons/site_init.py
index b62eb37..81c4753 100644
--- a/site_scons/site_init.py
+++ b/site_scons/site_init.py
@@ -1,4 +1,15 @@
+import os.path
+
from SConsRevision import SCons_revision
from Utilities import is_windows, whereis, platform, deb_date
from zip_utils import unzipit, zipit, zcat
-from soe_utils import soelim, soscan, soelimbuilder \ No newline at end of file
+from soe_utils import soelim, soscan, soelimbuilder
+# from epydoc import epydoc_cli, epydoc_commands
+from BuildCommandLine import BuildCommandLine
+
+gzip = whereis('gzip')
+git = os.path.exists('.git') and whereis('git')
+unzip = whereis('unzip')
+zip_path = whereis('zip')
+
+BuildCommandLine.git = git \ No newline at end of file
diff --git a/src/CHANGES.txt b/src/CHANGES.txt
index 862380b..dc9b40c 100755
--- a/src/CHANGES.txt
+++ b/src/CHANGES.txt
@@ -31,7 +31,9 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER
- C:\msys64\mingw64\bin
- Purge obsolete internal build and tooling scripts
- Allow user specified location for vswhere.exe specified by VSWHERE.
- NOTE: This must be set at the time the 'msvc' tool is initialized to have any effect.
+ NOTE: This must be set at the time the 'msvc' 'msvs' and/or 'mslink' tool(s) are initialized to have any effect.
+ - Resolve Issue #3451 and Issue #3450 - Rewrite SCons setup.py and packaging. Move script logic to entry points so
+ package can create scripts which use the correct version of Python.
From Jeremy Elson:
- Updated design doc to use the correct syntax for Depends()
@@ -93,6 +95,9 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER
- Fixed bug where changing TEXTFILESUFFIX would cause Substfile() to rebuild. (Github Issue #3540)
- Script/Main.py now uses importlib instead of imp module.
- Drop some Python 2-isms.
+ - MSVC updates: pass on VSCMD_DEBUG and VSCMD_SKIP_SENDTELEMETRY to msvc
+ tool setup if set in environment. Add powershell to default env
+ (used to call telemetry script).
- Docbook builder provides a fallback if lxml fails to generate
a document with tostring().
diff --git a/src/LICENSE.txt b/src/LICENSE.txt
deleted file mode 100644
index 1641aba..0000000
--- a/src/LICENSE.txt
+++ /dev/null
@@ -1,22 +0,0 @@
-MIT License
-
-__COPYRIGHT__
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be included
-in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
-KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
-WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/src/engine/MANIFEST.in b/src/engine/MANIFEST.in
deleted file mode 100644
index 3c2c0c2..0000000
--- a/src/engine/MANIFEST.in
+++ /dev/null
@@ -1,186 +0,0 @@
-SCons/__init__.py
-SCons/__main__.py
-SCons/Action.py
-SCons/Builder.py
-SCons/compat/*.py
-SCons/CacheDir.py
-SCons/Conftest.py
-SCons/cpp.py
-SCons/dblite.py
-SCons/Debug.py
-SCons/Defaults.py
-SCons/Environment.py
-SCons/Errors.py
-SCons/Executor.py
-SCons/Job.py
-SCons/exitfuncs.py
-SCons/Memoize.py
-SCons/Node/__init__.py
-SCons/Node/Alias.py
-SCons/Node/FS.py
-SCons/Node/Python.py
-SCons/PathList.py
-SCons/Platform/__init__.py
-SCons/Platform/aix.py
-SCons/Platform/cygwin.py
-SCons/Platform/darwin.py
-SCons/Platform/hpux.py
-SCons/Platform/irix.py
-SCons/Platform/os2.py
-SCons/Platform/mingw.py
-SCons/Platform/posix.py
-SCons/Platform/sunos.py
-SCons/Platform/win32.py
-SCons/Platform/virtualenv.py
-SCons/Scanner/__init__.py
-SCons/Scanner/C.py
-SCons/Scanner/D.py
-SCons/Scanner/Dir.py
-SCons/Scanner/Fortran.py
-SCons/Scanner/IDL.py
-SCons/Scanner/LaTeX.py
-SCons/Scanner/Prog.py
-SCons/Scanner/Python.py
-SCons/Scanner/RC.py
-SCons/Scanner/SWIG.py
-SCons/SConf.py
-SCons/SConsign.py
-SCons/Script/__init__.py
-SCons/Script/Interactive.py
-SCons/Script/Main.py
-SCons/Script/SConscript.py
-SCons/Script/SConsOptions.py
-SCons/Subst.py
-SCons/Taskmaster.py
-SCons/Tool/__init__.py
-SCons/Tool/386asm.py
-SCons/Tool/aixc++.py
-SCons/Tool/aixcxx.py
-SCons/Tool/aixcc.py
-SCons/Tool/aixf77.py
-SCons/Tool/aixlink.py
-SCons/Tool/applelink.py
-SCons/Tool/ar.py
-SCons/Tool/as.py
-SCons/Tool/bcc32.py
-SCons/Tool/c++.py
-SCons/Tool/cxx.py
-SCons/Tool/cc.py
-SCons/Tool/cyglink.py
-SCons/Tool/clangCommon/__init__.py
-SCons/Tool/clang.py
-SCons/Tool/clangxx.py
-SCons/Tool/cvf.py
-SCons/Tool/DCommon.py
-SCons/Tool/default.py
-SCons/Tool/dmd.py
-SCons/Tool/docbook/__init__.py
-SCons/Tool/dvi.py
-SCons/Tool/dvipdf.py
-SCons/Tool/dvips.py
-SCons/Tool/f03.py
-SCons/Tool/f08.py
-SCons/Tool/f77.py
-SCons/Tool/f90.py
-SCons/Tool/f95.py
-SCons/Tool/filesystem.py
-SCons/Tool/fortran.py
-SCons/Tool/FortranCommon.py
-SCons/Tool/g++.py
-SCons/Tool/gxx.py
-SCons/Tool/g77.py
-SCons/Tool/gas.py
-SCons/Tool/gcc.py
-SCons/Tool/gdc.py
-SCons/Tool/gfortran.py
-SCons/Tool/gnulink.py
-SCons/Tool/gs.py
-SCons/Tool/hpc++.py
-SCons/Tool/hpcxx.py
-SCons/Tool/hpcc.py
-SCons/Tool/hplink.py
-SCons/Tool/icc.py
-SCons/Tool/icl.py
-SCons/Tool/ifl.py
-SCons/Tool/ifort.py
-SCons/Tool/ilink.py
-SCons/Tool/ilink32.py
-SCons/Tool/install.py
-SCons/Tool/intelc.py
-SCons/Tool/ipkg.py
-SCons/Tool/jar.py
-SCons/Tool/JavaCommon.py
-SCons/Tool/javac.py
-SCons/Tool/javah.py
-SCons/Tool/latex.py
-SCons/Tool/ldc.py
-SCons/Tool/lex.py
-SCons/Tool/link.py
-SCons/Tool/linkloc.py
-SCons/Tool/MSCommon/__init__.py
-SCons/Tool/MSCommon/arch.py
-SCons/Tool/MSCommon/common.py
-SCons/Tool/MSCommon/netframework.py
-SCons/Tool/MSCommon/sdk.py
-SCons/Tool/MSCommon/vs.py
-SCons/Tool/MSCommon/vc.py
-SCons/Tool/m4.py
-SCons/Tool/masm.py
-SCons/Tool/midl.py
-SCons/Tool/mingw.py
-SCons/Tool/mslib.py
-SCons/Tool/mslink.py
-SCons/Tool/mssdk.py
-SCons/Tool/msvc.py
-SCons/Tool/msvs.py
-SCons/Tool/mwcc.py
-SCons/Tool/mwld.py
-SCons/Tool/nasm.py
-SCons/Tool/packaging/*.py
-SCons/Tool/pdf.py
-SCons/Tool/pdflatex.py
-SCons/Tool/pdftex.py
-SCons/Tool/PharLapCommon.py
-SCons/Tool/python.py
-SCons/Tool/qt.py
-SCons/Tool/rmic.py
-SCons/Tool/rpcgen.py
-SCons/Tool/rpm.py
-SCons/Tool/rpmutils.py
-SCons/Tool/sgiar.py
-SCons/Tool/sgic++.py
-SCons/Tool/sgicxx.py
-SCons/Tool/sgicc.py
-SCons/Tool/sgilink.py
-SCons/Tool/sunar.py
-SCons/Tool/sunc++.py
-SCons/Tool/suncxx.py
-SCons/Tool/suncc.py
-SCons/Tool/sunf77.py
-SCons/Tool/sunf90.py
-SCons/Tool/sunf95.py
-SCons/Tool/sunlink.py
-SCons/Tool/swig.py
-SCons/Tool/tar.py
-SCons/Tool/tex.py
-SCons/Tool/textfile.py
-SCons/Tool/tlib.py
-SCons/Tool/wix.py
-SCons/Tool/yacc.py
-SCons/Tool/zip.py
-SCons/Util.py
-SCons/Variables/__init__.py
-SCons/Variables/BoolVariable.py
-SCons/Variables/EnumVariable.py
-SCons/Variables/ListVariable.py
-SCons/Variables/PackageVariable.py
-SCons/Variables/PathVariable.py
-SCons/Warnings.py
-SCons/Tool/GettextCommon.py
-SCons/Tool/gettext_tool.py
-SCons/Tool/msgfmt.py
-SCons/Tool/msginit.py
-SCons/Tool/msgmerge.py
-SCons/Tool/xgettext.py
-#SCons/Tool/docbook/docbook-xsl-1.76.1/**
-#SCons/Tool/docbook/utils/**
diff --git a/src/engine/SCons/Action.py b/src/engine/SCons/Action.py
index c02dd33..5bc85d5 100644
--- a/src/engine/SCons/Action.py
+++ b/src/engine/SCons/Action.py
@@ -964,7 +964,7 @@ class CommandAction(_ActionAction):
if is_String(icd) and icd[:1] == '$':
icd = env.subst(icd)
- if not icd or icd in ('0', 'None'):
+ if not icd or str(icd).lower in ('0', 'none', 'false', 'no', 'off'):
return []
try:
diff --git a/src/engine/SCons/Action.xml b/src/engine/SCons/Action.xml
index 350082d..b519cdc 100644
--- a/src/engine/SCons/Action.xml
+++ b/src/engine/SCons/Action.xml
@@ -35,70 +35,88 @@ executed to build targets.
By default, SCons will add
to each target
an implicit dependency on the command
-represented by the first argument on any
-command line it executes.
+represented by the first argument of any
+command line it executes (which is typically
+the command itself). By setting such
+a dependency, &SCons; can determine that
+a target should be rebuilt if the command changes,
+such as when a compiler is upgraded to a new version.
The specific file for the dependency is
found by searching the
<varname>PATH</varname>
variable in the
-<varname>ENV</varname>
-environment used to execute the command.
+<varname>ENV</varname> dictionary
+in the &consenv; used to execute the command.
+The default is the same as
+setting the &consvar;
+&cv-IMPLICIT_COMMAND_DEPENDENCIES;
+to a True-like value (<quote>true</quote>,
+<quote>yes</quote>,
+or <quote>1</quote> - but not a number
+greater than one, as that has a different meaning).
</para>
<para>
-If the construction variable
-&cv-IMPLICIT_COMMAND_DEPENDENCIES;
-is set to a false value
-(<literal>None</literal>,
-<literal>False</literal>,
-<literal>0</literal>,
+Action strings can be segmented by the
+use of an AND operator, <literal>&amp;&amp;</literal>.
+In a segemented string, each segment is a separate
+<quote>command line</quote>, these are run
+sequentially until one fails or the entire
+sequence has been executed. If an
+action string is segmented, then the selected
+behavior of &cv-IMPLICIT_COMMAND_DEPENDENCIES;
+is applied to each segment.
+</para>
+
+<para>
+If &cv-IMPLICIT_COMMAND_DEPENDENCIES;
+is set to a False-like value
+(<quote>none</quote>,
+<quote>false</quote>,
+<quote>no</quote>,
+<quote>0</quote>,
etc.),
then the implicit dependency will
not be added to the targets
-built with that construction environment.
+built with that &consenv;.
</para>
<para>
-If the construction variable
-&cv-IMPLICIT_COMMAND_DEPENDENCIES;
-is set to <literal>2</literal> or higher,
-then that number of entries in the command
-string will be scanned for relative or absolute
-paths. The count will reset after any
-<literal>&amp;&amp;</literal> entries are found.
-The first command in the action string and
-the first after any <literal>&amp;&amp;</literal>
-entries will be found by searching the
-<varname>PATH</varname> variable in the
-<varname>ENV</varname> environment used to
-execute the command. All other commands will
-only be found if they are absolute paths or
-valid paths relative to the working directory.
+If &cv-IMPLICIT_COMMAND_DEPENDENCIES;
+is set to <quote>2</quote> or higher,
+then that number of arguments in the command line
+will be scanned for relative or absolute paths.
+If any are present, they will be added as
+implicit dependencies to the targets built
+with that &consenv;.
+The first argument in the command line will be
+searched for using the <varname>PATH</varname>
+variable in the <varname>ENV</varname> dictionary
+in the &consenv; used to execute the command.
+The other arguments will only be found if they
+are absolute paths or valid paths relative
+to the working directory.
</para>
<para>
-If the construction variable
-&cv-IMPLICIT_COMMAND_DEPENDENCIES;
-is set to <literal>all</literal>, then
-all entries in all command strings will be
-scanned for relative or absolute paths. If
-any are present, they will be added as
+If &cv-IMPLICIT_COMMAND_DEPENDENCIES;
+is set to <quote>all</quote>,
+then all arguments in the command line will be
+scanned for relative or absolute paths.
+If any are present, they will be added as
implicit dependencies to the targets built
-with that construction environment.
-not be added to the targets built with that
-construction environment. The first command
-in the action string and the first after any
-<literal>&amp;&amp;</literal> entries will be found
-by searching the <varname>PATH</varname>
-variable in the <varname>ENV</varname>
-environment used to execute the command.
-All other commands will only be found if they
+with that &consenv;.
+The first argument in the command line will be
+searched for using the <varname>PATH</varname>
+variable in the <varname>ENV</varname> dictionary
+in the &consenv; used to execute the command.
+The other arguments will only be found if they
are absolute paths or valid paths relative
to the working directory.
</para>
<example_commands>
-env = Environment(IMPLICIT_COMMAND_DEPENDENCIES = 0)
+env = Environment(IMPLICIT_COMMAND_DEPENDENCIES=False)
</example_commands>
</summary>
</cvar>
diff --git a/src/engine/SCons/Defaults.xml b/src/engine/SCons/Defaults.xml
index 22f46fe..06fad1c 100644
--- a/src/engine/SCons/Defaults.xml
+++ b/src/engine/SCons/Defaults.xml
@@ -268,12 +268,8 @@ into a list of Dir instances relative to the target being built.
<para>
The list of suffixes of files that will be scanned
for imported D package files.
-The default list is:
+The default list is <literal>['.d']</literal>.
</para>
-
-<example_commands>
-['.d']
-</example_commands>
</summary>
</cvar>
@@ -584,9 +580,12 @@ in order to execute many of the global functions in this list
from source code management systems.
The default environment is a singleton, so the keyword
arguments affect it only on the first call, on subsequent
-calls the already-constructed object is returned.
+calls the already-constructed object is returned and
+any arguments are ignored.
The default environment can be modified in the same way
as any &consenv;.
+Modifying the &defenv; has no effect on the environment
+constructed by a subsequent &f-Environment; call.
</para>
</summary>
</scons_function>
diff --git a/src/engine/SCons/Environment.xml b/src/engine/SCons/Environment.xml
index a171f38..48980e2 100644
--- a/src/engine/SCons/Environment.xml
+++ b/src/engine/SCons/Environment.xml
@@ -1836,9 +1836,10 @@ Examples:
</para>
<example_commands>
-Program('foo', Glob('*.c'))
-Zip('/tmp/everything', Glob('.??*') + Glob('*'))
-sources = Glob('*.cpp', exclude=['os_*_specific_*.cpp']) + Glob('os_%s_specific_*.cpp'%currentOS)
+Program("foo", Glob("*.c"))
+Zip("/tmp/everything", Glob(".??*") + Glob("*"))
+sources = Glob("*.cpp", exclude=["os_*_specific_*.cpp"]) + \
+ Glob( "os_%s_specific_*.cpp" % currentOS)
</example_commands>
</summary>
</scons_function>
diff --git a/src/engine/SCons/Tool/MSCommon/common.py b/src/engine/SCons/Tool/MSCommon/common.py
index 7f832c6..b2b5de9 100644
--- a/src/engine/SCons/Tool/MSCommon/common.py
+++ b/src/engine/SCons/Tool/MSCommon/common.py
@@ -156,15 +156,14 @@ def normalize_env(env, keys, force=False):
if k in os.environ and (force or k not in normenv):
normenv[k] = os.environ[k]
- # This shouldn't be necessary, since the default environment should include system32,
- # but keep this here to be safe, since it's needed to find reg.exe which the MSVC
- # bat scripts use.
- sys32_dir = os.path.join(os.environ.get("SystemRoot",
- os.environ.get("windir", r"C:\Windows\system32")),
- "System32")
-
- if sys32_dir not in normenv['PATH']:
- normenv['PATH'] = normenv['PATH'] + os.pathsep + sys32_dir
+ # add some things to PATH to prevent problems:
+ # Shouldn't be necessary to add system32, since the default environment
+ # should include it, but keep this here to be safe (needed for reg.exe)
+ sys32_dir = os.path.join(
+ os.environ.get("SystemRoot", os.environ.get("windir", r"C:\Windows")), "System32"
+)
+ if sys32_dir not in normenv["PATH"]:
+ normenv["PATH"] = normenv["PATH"] + os.pathsep + sys32_dir
# Without Wbem in PATH, vcvarsall.bat has a "'wmic' is not recognized"
# error starting with Visual Studio 2017, although the script still
@@ -173,8 +172,14 @@ def normalize_env(env, keys, force=False):
if sys32_wbem_dir not in normenv['PATH']:
normenv['PATH'] = normenv['PATH'] + os.pathsep + sys32_wbem_dir
- debug("PATH: %s" % normenv['PATH'])
+ # Without Powershell in PATH, an internal call to a telemetry
+ # function (starting with a VS2019 update) can fail
+ # Note can also set VSCMD_SKIP_SENDTELEMETRY to avoid this.
+ sys32_ps_dir = os.path.join(sys32_dir, r'WindowsPowerShell\v1.0')
+ if sys32_ps_dir not in normenv['PATH']:
+ normenv['PATH'] = normenv['PATH'] + os.pathsep + sys32_ps_dir
+ debug("PATH: %s" % normenv['PATH'])
return normenv
@@ -185,16 +190,21 @@ def get_output(vcbat, args=None, env=None):
# Create a blank environment, for use in launching the tools
env = SCons.Environment.Environment(tools=[])
- # TODO: This is a hard-coded list of the variables that (may) need
- # to be imported from os.environ[] for v[sc]*vars*.bat file
- # execution to work. This list should really be either directly
- # controlled by vc.py, or else derived from the common_tools_var
- # settings in vs.py.
+ # TODO: Hard-coded list of the variables that (may) need to be
+ # imported from os.environ[] for the chain of development batch
+ # files to execute correctly. One call to vcvars*.bat may
+ # end up running a dozen or more scripts, changes not only with
+ # each release but with what is installed at the time. We think
+ # in modern installations most are set along the way and don't
+ # need to be picked from the env, but include these for safety's sake.
+ # Any VSCMD variables definitely are picked from the env and
+ # control execution in interesting ways.
+ # Note these really should be unified - either controlled by vs.py,
+ # or synced with the the common_tools_var # settings in vs.py.
vs_vc_vars = [
- 'COMSPEC',
- # VS100 and VS110: Still set, but modern MSVC setup scripts will
- # discard these if registry has values. However Intel compiler setup
- # script still requires these as of 2013/2014.
+ 'COMSPEC', # path to "shell"
+ 'VS160COMNTOOLS', # path to common tools for given version
+ 'VS150COMNTOOLS',
'VS140COMNTOOLS',
'VS120COMNTOOLS',
'VS110COMNTOOLS',
@@ -204,6 +214,8 @@ def get_output(vcbat, args=None, env=None):
'VS71COMNTOOLS',
'VS70COMNTOOLS',
'VS60COMNTOOLS',
+ 'VSCMD_DEBUG', # enable logging and other debug aids
+ 'VSCMD_SKIP_SENDTELEMETRY',
]
env['ENV'] = normalize_env(env['ENV'], vs_vc_vars, force=False)
@@ -234,21 +246,35 @@ def get_output(vcbat, args=None, env=None):
# debug('get_output():stdout:%s'%stdout)
# debug('get_output():stderr:%s'%stderr)
+ # Ongoing problems getting non-corrupted text led to this
+ # changing to "oem" from "mbcs" - the scripts run presumably
+ # attached to a console, so some particular rules apply.
+ # Unfortunately, "oem" not defined in Python 3.5, so get another way
+ if sys.version_info.major == 3 and sys.version_info.minor < 6:
+ from ctypes import windll
+
+ OEM = "cp{}".format(windll.kernel32.GetConsoleOutputCP())
+ else:
+ OEM = "oem"
if stderr:
# TODO: find something better to do with stderr;
# this at least prevents errors from getting swallowed.
- sys.stderr.write(stderr)
+ sys.stderr.write(stderr.decode(OEM))
if popen.wait() != 0:
- raise IOError(stderr.decode("mbcs"))
+ raise IOError(stderr.decode(OEM))
- output = stdout.decode("mbcs")
- return output
+ return stdout.decode(OEM)
-KEEPLIST = ("INCLUDE", "LIB", "LIBPATH", "PATH", 'VSCMD_ARG_app_plat',
- 'VCINSTALLDIR', # needed by clang -VS 2017 and newer
- 'VCToolsInstallDir', # needed by clang - VS 2015 and older
- )
+KEEPLIST = (
+ "INCLUDE",
+ "LIB",
+ "LIBPATH",
+ "PATH",
+ "VSCMD_ARG_app_plat",
+ "VCINSTALLDIR", # needed by clang -VS 2017 and newer
+ "VCToolsInstallDir", # needed by clang - VS 2015 and older
+)
def parse_output(output, keep=KEEPLIST):
diff --git a/src/engine/SCons/Tool/applelink.xml b/src/engine/SCons/Tool/applelink.xml
index fc0cf63..977f2ce 100644
--- a/src/engine/SCons/Tool/applelink.xml
+++ b/src/engine/SCons/Tool/applelink.xml
@@ -171,7 +171,7 @@ See its __doc__ string for a discussion of the format.
</para>
<example_commands>
- env.AppendUnique(FRAMEWORKS=Split('System Cocoa SystemConfiguration'))
+env.AppendUnique(FRAMEWORKS=Split('System Cocoa SystemConfiguration'))
</example_commands>
</summary>
@@ -213,7 +213,7 @@ See its __doc__ string for a discussion of the format.
</para>
<example_commands>
- env.AppendUnique(FRAMEWORKPATH='#myframeworkdir')
+env.AppendUnique(FRAMEWORKPATH='#myframeworkdir')
</example_commands>
<para>
@@ -221,7 +221,7 @@ See its __doc__ string for a discussion of the format.
</para>
<example_commands>
- ... -Fmyframeworkdir
+... -Fmyframeworkdir
</example_commands>
<para>
diff --git a/src/engine/SCons/Tool/jar.xml b/src/engine/SCons/Tool/jar.xml
index 30c51f8..151dda1 100644
--- a/src/engine/SCons/Tool/jar.xml
+++ b/src/engine/SCons/Tool/jar.xml
@@ -120,7 +120,7 @@ If this is not set, then &cv-link-JARCOM; (the command line) is displayed.
</para>
<example_commands>
-env = Environment(JARCOMSTR = "JARchiving $SOURCES into $TARGET")
+env = Environment(JARCOMSTR="JARchiving $SOURCES into $TARGET")
</example_commands>
</summary>
</cvar>
diff --git a/src/engine/SCons/Tool/javac.xml b/src/engine/SCons/Tool/javac.xml
index 893130b..b1548c7 100644
--- a/src/engine/SCons/Tool/javac.xml
+++ b/src/engine/SCons/Tool/javac.xml
@@ -174,7 +174,7 @@ env['ENV']['LANG'] = 'en_GB.UTF-8'
</para>
<example_commands>
-env = Environment(JAVACCOMSTR = "Compiling class files $TARGETS from $SOURCES")
+env = Environment(JAVACCOMSTR="Compiling class files $TARGETS from $SOURCES")
</example_commands>
</summary>
</cvar>
diff --git a/src/engine/SCons/Tool/javah.xml b/src/engine/SCons/Tool/javah.xml
index 4d436b1..5a2840f 100644
--- a/src/engine/SCons/Tool/javah.xml
+++ b/src/engine/SCons/Tool/javah.xml
@@ -77,17 +77,18 @@ Examples:
<example_commands>
# builds java_native.h
-classes = env.Java(target = 'classdir', source = 'src')
-env.JavaH(target = 'java_native.h', source = classes)
+classes = env.Java(target="classdir", source="src")
+env.JavaH(target="java_native.h", source=classes)
# builds include/package_foo.h and include/package_bar.h
-env.JavaH(target = 'include',
- source = ['package/foo.class', 'package/bar.class'])
+env.JavaH(target="include", source=["package/foo.class", "package/bar.class"])
# builds export/foo.h and export/bar.h
-env.JavaH(target = 'export',
- source = ['classes/foo.class', 'classes/bar.class'],
- JAVACLASSDIR = 'classes')
+env.JavaH(
+ target="export",
+ source=["classes/foo.class", "classes/bar.class"],
+ JAVACLASSDIR="classes",
+)
</example_commands>
</summary>
</builder>
@@ -120,7 +121,7 @@ If this is not set, then &cv-link-JAVAHCOM; (the command line) is displayed.
</para>
<example_commands>
-env = Environment(JAVAHCOMSTR = "Generating header/stub file(s) $TARGETS from $SOURCES")
+env = Environment(JAVAHCOMSTR="Generating header/stub file(s) $TARGETS from $SOURCES")
</example_commands>
</summary>
</cvar>
diff --git a/src/engine/SCons/Tool/msvs.xml b/src/engine/SCons/Tool/msvs.xml
index b1f79b2..f6c9a39 100644
--- a/src/engine/SCons/Tool/msvs.xml
+++ b/src/engine/SCons/Tool/msvs.xml
@@ -422,7 +422,11 @@ env.MSVSProject(target='Bar' + env['MSVSPROJECTSUFFIX'],
</variablelist>
<para>Example Usage:</para>
<example_commands>
-env.MSVSSolution(target='Bar' + env['MSVSSOLUTIONSUFFIX'], projects=['bar' + env['MSVSPROJECTSUFFIX']], variant='Release')
+env.MSVSSolution(
+ target="Bar" + env["MSVSSOLUTIONSUFFIX"],
+ projects=["bar" + env["MSVSPROJECTSUFFIX"]],
+ variant="Release",
+)
</example_commands>
</summary>
</builder> <cvar name="MSVS">
diff --git a/src/engine/SCons/Tool/packaging/__init__.xml b/src/engine/SCons/Tool/packaging/__init__.xml
index 2b3c4fd..37e97ff 100644
--- a/src/engine/SCons/Tool/packaging/__init__.xml
+++ b/src/engine/SCons/Tool/packaging/__init__.xml
@@ -86,18 +86,19 @@ on a project that has packaging activated.
</para>
<example_commands>
-env = Environment(tools=['default', 'packaging'])
-env.Install('/bin/', 'my_program')
-env.Package( NAME = 'foo',
- VERSION = '1.2.3',
- PACKAGEVERSION = 0,
- PACKAGETYPE = 'rpm',
- LICENSE = 'gpl',
- SUMMARY = 'balalalalal',
- DESCRIPTION = 'this should be really really long',
- X_RPM_GROUP = 'Application/fu',
- SOURCE_URL = 'http://foo.org/foo-1.2.3.tar.gz'
- )
+env = Environment(tools=["default", "packaging"])
+env.Install("/bin/", "my_program")
+env.Package(
+ NAME="foo",
+ VERSION="1.2.3",
+ PACKAGEVERSION=0,
+ PACKAGETYPE="rpm",
+ LICENSE="gpl",
+ SUMMARY="balalalalal",
+ DESCRIPTION="this should be really really long",
+ X_RPM_GROUP="Application/fu",
+ SOURCE_URL="http://foo.org/foo-1.2.3.tar.gz",
+)
</example_commands>
</summary>
</builder>
@@ -503,13 +504,14 @@ Added in version 3.1.
<example_commands>
env.Package(
- NAME = 'foo',
-...
- X_RPM_EXTRADEFS = [
- '%define _unpackaged_files_terminate_build 0'
- '%define _missing_doc_files_terminate_build 0'
+ NAME="foo",
+ ...
+ X_RPM_EXTRADEFS=[
+ "%define _unpackaged_files_terminate_build 0"
+ "%define _missing_doc_files_terminate_build 0"
],
-... )
+ ...
+)
</example_commands>
</summary>
diff --git a/src/script/scons-configure-cache.py b/src/engine/SCons/Utilities/ConfigureCache.py
index 716315c..80783a9 100644
--- a/src/script/scons-configure-cache.py
+++ b/src/engine/SCons/Utilities/ConfigureCache.py
@@ -100,78 +100,83 @@ config_entries = {
}
}
-parser = argparse.ArgumentParser(
- description='Modify the configuration of an scons cache directory',
- epilog='''
- Unspecified options will not be changed unless they are not
- set at all, in which case they are set to an appropriate default.
- ''')
-
-parser.add_argument('cache-dir', help='Path to scons cache directory')
-for param in config_entries:
- parser.add_argument('--' + param.replace('_', '-'),
- **config_entries[param]['command-line'])
-parser.add_argument('--version',
- action='version',
- version='%(prog)s 1.0')
-parser.add_argument('--show',
- action="store_true",
- help="show current configuration")
-
-# Get the command line as a dict without any of the unspecified entries.
-args = dict([x for x in vars(parser.parse_args()).items() if x[1]])
-
-# It seems somewhat strange to me, but positional arguments don't get the -
-# in the name changed to _, whereas optional arguments do...
-cache = args['cache-dir']
-if not os.path.isdir(cache):
- raise RuntimeError("There is no cache directory named %s" % cache)
-os.chdir(cache)
-del args['cache-dir']
-
-if not os.path.exists('config'):
- # old config dirs did not have a 'config' file. Try to update.
- # Validate the only files in the directory are directories 0-9, a-f
- expected = ['{:X}'.format(x) for x in range(0, 16)]
- if not set(os.listdir('.')).issubset(expected):
- raise RuntimeError(
- "%s does not look like a valid version 1 cache directory" % cache)
- config = dict()
-else:
- with open('config') as conf:
- config = json.load(conf)
-
-if args.get('show', None):
- print("Current configuration in '%s':" % cache)
- print(json.dumps(config, sort_keys=True,
- indent=4, separators=(',', ': ')))
- # in case of the show argument, emit some stats as well
- file_count = 0
- for _, _, files in os.walk('.'):
- file_count += len(files)
- if file_count: # skip config file if it exists
- file_count -= 1
- print("Cache contains %s files" % file_count)
- del args['show']
-
-# Find any keys that are not currently set but should be
-for key in config_entries:
- if key not in config:
- if 'implicit' in config_entries[key]:
- config[key] = config_entries[key]['implicit']
- else:
- config[key] = config_entries[key]['default']
- if key not in args:
- args[key] = config_entries[key]['default']
-
-# Now go through each entry in args to see if it changes an existing config
-# setting.
-for key in args:
- if args[key] != config[key]:
- if 'converter' in config_entries[key]:
- config_entries[key]['converter'](config[key], args[key])
- config[key] = args[key]
-
-# and write the updated config file
-with open('config', 'w') as conf:
- json.dump(config, conf)
+
+def main():
+ parser = argparse.ArgumentParser(
+ description='Modify the configuration of an scons cache directory',
+ epilog='''
+ Unspecified options will not be changed unless they are not
+ set at all, in which case they are set to an appropriate default.
+ ''')
+
+ parser.add_argument('cache-dir', help='Path to scons cache directory')
+ for param in config_entries:
+ parser.add_argument('--' + param.replace('_', '-'),
+ **config_entries[param]['command-line'])
+ parser.add_argument('--version',
+ action='version',
+ version='%(prog)s 1.0')
+ parser.add_argument('--show',
+ action="store_true",
+ help="show current configuration")
+
+ # Get the command line as a dict without any of the unspecified entries.
+ args = dict([x for x in vars(parser.parse_args()).items() if x[1]])
+
+ # It seems somewhat strange to me, but positional arguments don't get the -
+ # in the name changed to _, whereas optional arguments do...
+ cache = args['cache-dir']
+ if not os.path.isdir(cache):
+ raise RuntimeError("There is no cache directory named %s" % cache)
+ os.chdir(cache)
+ del args['cache-dir']
+
+ if not os.path.exists('config'):
+ # old config dirs did not have a 'config' file. Try to update.
+ # Validate the only files in the directory are directories 0-9, a-f
+ expected = ['{:X}'.format(x) for x in range(0, 16)]
+ if not set(os.listdir('.')).issubset(expected):
+ raise RuntimeError(
+ "%s does not look like a valid version 1 cache directory" % cache)
+ config = dict()
+ else:
+ with open('config') as conf:
+ config = json.load(conf)
+
+ if args.get('show', None):
+ print("Current configuration in '%s':" % cache)
+ print(json.dumps(config, sort_keys=True,
+ indent=4, separators=(',', ': ')))
+ # in case of the show argument, emit some stats as well
+ file_count = 0
+ for _, _, files in os.walk('.'):
+ file_count += len(files)
+ if file_count: # skip config file if it exists
+ file_count -= 1
+ print("Cache contains %s files" % file_count)
+ del args['show']
+
+ # Find any keys that are not currently set but should be
+ for key in config_entries:
+ if key not in config:
+ if 'implicit' in config_entries[key]:
+ config[key] = config_entries[key]['implicit']
+ else:
+ config[key] = config_entries[key]['default']
+ if key not in args:
+ args[key] = config_entries[key]['default']
+
+ # Now go through each entry in args to see if it changes an existing config
+ # setting.
+ for key in args:
+ if args[key] != config[key]:
+ if 'converter' in config_entries[key]:
+ config_entries[key]['converter'](config[key], args[key])
+ config[key] = args[key]
+
+ # and write the updated config file
+ with open('config', 'w') as conf:
+ json.dump(config, conf)
+
+if __name__ == "__main__":
+ main() \ No newline at end of file
diff --git a/src/MANIFEST.in b/src/engine/SCons/Utilities/__init__.py
index e69de29..e69de29 100644
--- a/src/MANIFEST.in
+++ b/src/engine/SCons/Utilities/__init__.py
diff --git a/src/script/sconsign.py b/src/engine/SCons/Utilities/sconsign.py
index 726838c..89084ba 100644
--- a/src/script/sconsign.py
+++ b/src/engine/SCons/Utilities/sconsign.py
@@ -35,162 +35,15 @@ __date__ = "__DATE__"
__developer__ = "__DEVELOPER__"
+import getopt
import os
import sys
-
-##############################################################################
-# BEGIN STANDARD SCons SCRIPT HEADER
-#
-# This is the cut-and-paste logic so that a self-contained script can
-# interoperate correctly with different SCons versions and installation
-# locations for the engine. If you modify anything in this section, you
-# should also change other scripts that use this same header.
-##############################################################################
-
-# compatibility check
-if sys.version_info < (3,5,0):
- msg = "scons: *** SCons version %s does not run under Python version %s.\n\
-Python >= 3.5 is required.\n"
- sys.stderr.write(msg % (__version__, sys.version.split()[0]))
- sys.exit(1)
-
-# Strip the script directory from sys.path so on case-insensitive
-# (WIN32) systems Python doesn't think that the "scons" script is the
-# "SCons" package.
-script_dir = os.path.dirname(os.path.realpath(__file__))
-script_path = os.path.realpath(os.path.dirname(__file__))
-if script_path in sys.path:
- sys.path.remove(script_path)
-
-libs = []
-
-if "SCONS_LIB_DIR" in os.environ:
- libs.append(os.environ["SCONS_LIB_DIR"])
-
-# running from source takes 2nd priority (since 2.3.2), following SCONS_LIB_DIR
-source_path = os.path.join(script_path, os.pardir, 'engine')
-if os.path.isdir(source_path):
- libs.append(source_path)
-
-# add local-install locations
-local_version = 'scons-local-' + __version__
-local = 'scons-local'
-if script_dir:
- local_version = os.path.join(script_dir, local_version)
- local = os.path.join(script_dir, local)
-if os.path.isdir(local_version):
- libs.append(os.path.abspath(local_version))
-if os.path.isdir(local):
- libs.append(os.path.abspath(local))
-
-scons_version = 'scons-%s' % __version__
-
-# preferred order of scons lookup paths
-prefs = []
-
-# if we can find package information, use it
-try:
- import pkg_resources
-except ImportError:
- pass
-else:
- try:
- d = pkg_resources.get_distribution('scons')
- except pkg_resources.DistributionNotFound:
- pass
- else:
- prefs.append(d.location)
-
-if sys.platform == 'win32':
- # Use only sys.prefix on Windows
- prefs.append(sys.prefix)
- prefs.append(os.path.join(sys.prefix, 'Lib', 'site-packages'))
-else:
- # On other (POSIX) platforms, things are more complicated due to
- # the variety of path names and library locations.
- # Build up some possibilities, then transform them into candidates
- temp = []
- if script_dir == 'bin':
- # script_dir is `pwd`/bin;
- # check `pwd`/lib/scons*.
- temp.append(os.getcwd())
- else:
- if script_dir in ('.', ''):
- script_dir = os.getcwd()
- head, tail = os.path.split(script_dir)
- if tail == "bin":
- # script_dir is /foo/bin;
- # check /foo/lib/scons*.
- temp.append(head)
-
- head, tail = os.path.split(sys.prefix)
- if tail == "usr":
- # sys.prefix is /foo/usr;
- # check /foo/usr/lib/scons* first,
- # then /foo/usr/local/lib/scons*.
- temp.append(sys.prefix)
- temp.append(os.path.join(sys.prefix, "local"))
- elif tail == "local":
- h, t = os.path.split(head)
- if t == "usr":
- # sys.prefix is /foo/usr/local;
- # check /foo/usr/local/lib/scons* first,
- # then /foo/usr/lib/scons*.
- temp.append(sys.prefix)
- temp.append(head)
- else:
- # sys.prefix is /foo/local;
- # check only /foo/local/lib/scons*.
- temp.append(sys.prefix)
- else:
- # sys.prefix is /foo (ends in neither /usr or /local);
- # check only /foo/lib/scons*.
- temp.append(sys.prefix)
-
- # suffix these to add to our original prefs:
- prefs.extend([os.path.join(x, 'lib') for x in temp])
- prefs.extend([os.path.join(x, 'lib', 'python' + sys.version[:3],
- 'site-packages') for x in temp])
-
-
- # Add the parent directory of the current python's library to the
- # preferences. This picks up differences between, e.g., lib and lib64,
- # and finds the base location in case of a non-copying virtualenv.
- try:
- libpath = os.__file__
- except AttributeError:
- pass
- else:
- # Split /usr/libfoo/python*/os.py to /usr/libfoo/python*.
- libpath, _ = os.path.split(libpath)
- # Split /usr/libfoo/python* to /usr/libfoo
- libpath, tail = os.path.split(libpath)
- # Check /usr/libfoo/scons*.
- prefs.append(libpath)
-
-# Look first for 'scons-__version__' in all of our preference libs,
-# then for 'scons'. Skip paths that do not exist.
-libs.extend([os.path.join(x, scons_version) for x in prefs if os.path.isdir(x)])
-libs.extend([os.path.join(x, 'scons') for x in prefs if os.path.isdir(x)])
-
-sys.path = libs + sys.path
-
-##############################################################################
-# END STANDARD SCons SCRIPT HEADER
-##############################################################################
-
-import SCons.compat
-
-try:
- import whichdb
-
- whichdb = whichdb.whichdb
-except ImportError as e:
- from dbm import whichdb
+from dbm import whichdb
import time
import pickle
+import SCons.compat
import SCons.SConsign
@@ -202,16 +55,8 @@ def my_whichdb(filename):
return "SCons.dblite"
except IOError:
pass
- return _orig_whichdb(filename)
-
+ return whichdb(filename)
-# Should work on python2
-_orig_whichdb = whichdb
-whichdb = my_whichdb
-
-# was changed for python3
-#_orig_whichdb = whichdb.whichdb
-#dbm.whichdb = my_whichdb
def my_import(mname):
import imp
@@ -364,19 +209,21 @@ def field(name, entry, verbose=Verbose):
def nodeinfo_raw(name, ninfo, prefix=""):
- # This just formats the dictionary, which we would normally use str()
- # to do, except that we want the keys sorted for deterministic output.
+ """
+ This just formats the dictionary, which we would normally use str()
+ to do, except that we want the keys sorted for deterministic output.
+ """
d = ninfo.__getstate__()
try:
keys = ninfo.field_list + ['_version_id']
except AttributeError:
keys = sorted(d.keys())
- l = []
- for k in keys:
- l.append('%s: %s' % (repr(k), repr(d.get(k))))
+ values = []
+ for key in keys:
+ values.append('%s: %s' % (repr(key), repr(d.get(key))))
if '\n' in name:
name = repr(name)
- return name + ': {' + ', '.join(l) + '}'
+ return name + ': {' + ', '.join(values) + '}'
def nodeinfo_cooked(name, ninfo, prefix=""):
@@ -433,7 +280,7 @@ def printentries(entries, location):
for name in sorted(entries.keys()):
entry = entries[name]
try:
- ninfo = entry.ninfo
+ entry.ninfo
except AttributeError:
print(name + ":")
else:
@@ -536,54 +383,101 @@ def Do_SConsignDir(name):
##############################################################################
+def main():
+ global Do_Call
+ global nodeinfo_string
+ global args
+ global Verbose
+ global Readable
+
+ helpstr = """\
+ Usage: sconsign [OPTIONS] [FILE ...]
+ Options:
+ -a, --act, --action Print build action information.
+ -c, --csig Print content signature information.
+ -d DIR, --dir=DIR Print only info about DIR.
+ -e ENTRY, --entry=ENTRY Print only info about ENTRY.
+ -f FORMAT, --format=FORMAT FILE is in the specified FORMAT.
+ -h, --help Print this message and exit.
+ -i, --implicit Print implicit dependency information.
+ -r, --readable Print timestamps in human-readable form.
+ --raw Print raw Python object representations.
+ -s, --size Print file sizes.
+ -t, --timestamp Print timestamp information.
+ -v, --verbose Verbose, describe each field.
+ """
-import getopt
-
-helpstr = """\
-Usage: sconsign [OPTIONS] [FILE ...]
-Options:
- -a, --act, --action Print build action information.
- -c, --csig Print content signature information.
- -d DIR, --dir=DIR Print only info about DIR.
- -e ENTRY, --entry=ENTRY Print only info about ENTRY.
- -f FORMAT, --format=FORMAT FILE is in the specified FORMAT.
- -h, --help Print this message and exit.
- -i, --implicit Print implicit dependency information.
- -r, --readable Print timestamps in human-readable form.
- --raw Print raw Python object representations.
- -s, --size Print file sizes.
- -t, --timestamp Print timestamp information.
- -v, --verbose Verbose, describe each field.
-"""
-
-try:
- opts, args = getopt.getopt(sys.argv[1:], "acd:e:f:hirstv",
- ['act', 'action',
- 'csig', 'dir=', 'entry=',
- 'format=', 'help', 'implicit',
- 'raw', 'readable',
- 'size', 'timestamp', 'verbose'])
-except getopt.GetoptError as err:
- sys.stderr.write(str(err) + '\n')
- print(helpstr)
- sys.exit(2)
-
-for o, a in opts:
- if o in ('-a', '--act', '--action'):
- Print_Flags['action'] = 1
- elif o in ('-c', '--csig'):
- Print_Flags['csig'] = 1
- elif o in ('-d', '--dir'):
- Print_Directories.append(a)
- elif o in ('-e', '--entry'):
- Print_Entries.append(a)
- elif o in ('-f', '--format'):
- # Try to map the given DB format to a known module
- # name, that we can then try to import...
- Module_Map = {'dblite': 'SCons.dblite', 'sconsign': None}
- dbm_name = Module_Map.get(a, a)
- if dbm_name:
- try:
+ try:
+ opts, args = getopt.getopt(sys.argv[1:], "acd:e:f:hirstv",
+ ['act', 'action',
+ 'csig', 'dir=', 'entry=',
+ 'format=', 'help', 'implicit',
+ 'raw', 'readable',
+ 'size', 'timestamp', 'verbose'])
+ except getopt.GetoptError as err:
+ sys.stderr.write(str(err) + '\n')
+ print(helpstr)
+ sys.exit(2)
+
+ for o, a in opts:
+ if o in ('-a', '--act', '--action'):
+ Print_Flags['action'] = 1
+ elif o in ('-c', '--csig'):
+ Print_Flags['csig'] = 1
+ elif o in ('-d', '--dir'):
+ Print_Directories.append(a)
+ elif o in ('-e', '--entry'):
+ Print_Entries.append(a)
+ elif o in ('-f', '--format'):
+ # Try to map the given DB format to a known module
+ # name, that we can then try to import...
+ Module_Map = {'dblite': 'SCons.dblite', 'sconsign': None}
+ dbm_name = Module_Map.get(a, a)
+ if dbm_name:
+ try:
+ if dbm_name != "SCons.dblite":
+ dbm = my_import(dbm_name)
+ else:
+ import SCons.dblite
+
+ dbm = SCons.dblite
+ # Ensure that we don't ignore corrupt DB files,
+ # this was handled by calling my_import('SCons.dblite')
+ # again in earlier versions...
+ SCons.dblite.ignore_corrupt_dbfiles = 0
+ except ImportError:
+ sys.stderr.write("sconsign: illegal file format `%s'\n" % a)
+ print(helpstr)
+ sys.exit(2)
+ Do_Call = Do_SConsignDB(a, dbm)
+ else:
+ Do_Call = Do_SConsignDir
+ elif o in ('-h', '--help'):
+ print(helpstr)
+ sys.exit(0)
+ elif o in ('-i', '--implicit'):
+ Print_Flags['implicit'] = 1
+ elif o in ('--raw',):
+ nodeinfo_string = nodeinfo_raw
+ elif o in ('-r', '--readable'):
+ Readable = 1
+ elif o in ('-s', '--size'):
+ Print_Flags['size'] = 1
+ elif o in ('-t', '--timestamp'):
+ Print_Flags['timestamp'] = 1
+ elif o in ('-v', '--verbose'):
+ Verbose = 1
+
+ if Do_Call:
+ for a in args:
+ Do_Call(a)
+ else:
+ if not args:
+ args = [".sconsign.dblite"]
+ for a in args:
+ dbm_name = my_whichdb(a)
+ if dbm_name:
+ Map_Module = {'SCons.dblite': 'dblite'}
if dbm_name != "SCons.dblite":
dbm = my_import(dbm_name)
else:
@@ -594,56 +488,17 @@ for o, a in opts:
# this was handled by calling my_import('SCons.dblite')
# again in earlier versions...
SCons.dblite.ignore_corrupt_dbfiles = 0
- except ImportError:
- sys.stderr.write("sconsign: illegal file format `%s'\n" % a)
- print(helpstr)
- sys.exit(2)
- Do_Call = Do_SConsignDB(a, dbm)
- else:
- Do_Call = Do_SConsignDir
- elif o in ('-h', '--help'):
- print(helpstr)
- sys.exit(0)
- elif o in ('-i', '--implicit'):
- Print_Flags['implicit'] = 1
- elif o in ('--raw',):
- nodeinfo_string = nodeinfo_raw
- elif o in ('-r', '--readable'):
- Readable = 1
- elif o in ('-s', '--size'):
- Print_Flags['size'] = 1
- elif o in ('-t', '--timestamp'):
- Print_Flags['timestamp'] = 1
- elif o in ('-v', '--verbose'):
- Verbose = 1
-
-if Do_Call:
- for a in args:
- Do_Call(a)
-else:
- if not args:
- args = [".sconsign.dblite"]
- for a in args:
- dbm_name = whichdb(a)
- if dbm_name:
- Map_Module = {'SCons.dblite': 'dblite'}
- if dbm_name != "SCons.dblite":
- dbm = my_import(dbm_name)
+ Do_SConsignDB(Map_Module.get(dbm_name, dbm_name), dbm)(a)
else:
- import SCons.dblite
-
- dbm = SCons.dblite
- # Ensure that we don't ignore corrupt DB files,
- # this was handled by calling my_import('SCons.dblite')
- # again in earlier versions...
- SCons.dblite.ignore_corrupt_dbfiles = 0
- Do_SConsignDB(Map_Module.get(dbm_name, dbm_name), dbm)(a)
- else:
- Do_SConsignDir(a)
+ Do_SConsignDir(a)
+
+ if Warns:
+ print("NOTE: there were %d warnings, please check output" % Warns)
+
- if Warns:
- print("NOTE: there were %d warnings, please check output" % Warns)
-sys.exit(0)
+if __name__ == "__main__":
+ main()
+ sys.exit(0)
# Local Variables:
# tab-width:4
diff --git a/src/script/scons.py b/src/script/scons.py
deleted file mode 100755
index 1e12898..0000000
--- a/src/script/scons.py
+++ /dev/null
@@ -1,208 +0,0 @@
-#! /usr/bin/env python
-#
-# SCons - a Software Constructor
-#
-# __COPYRIGHT__
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be included
-# in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
-# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
-# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-
-__version__ = "__VERSION__"
-
-__build__ = "__BUILD__"
-
-__buildsys__ = "__BUILDSYS__"
-
-__date__ = "__DATE__"
-
-__developer__ = "__DEVELOPER__"
-
-# This is the entry point to the SCons program.
-# The only job of this script is to work out where the guts of the program
-# could be and import them, where the real work begins.
-# SCons can be invoked several different ways
-# - from an installed location
-# - from a "local install" copy
-# - from a source tree, which has a different dir struture than the other two
-# Try to account for all those possibilities.
-
-import os
-import sys
-
-##############################################################################
-# BEGIN STANDARD SCons SCRIPT HEADER
-#
-# This is the cut-and-paste logic so that a self-contained script can
-# interoperate correctly with different SCons versions and installation
-# locations for the engine. If you modify anything in this section, you
-# should also change other scripts that use this same header.
-##############################################################################
-
-# compatibility check
-if sys.version_info < (3,5,0):
- msg = "scons: *** SCons version %s does not run under Python version %s.\n\
-Python >= 3.5 is required.\n"
- sys.stderr.write(msg % (__version__, sys.version.split()[0]))
- sys.exit(1)
-
-# Strip the script directory from sys.path so on case-insensitive
-# (WIN32) systems Python doesn't think that the "scons" script is the
-# "SCons" package.
-script_dir = os.path.dirname(os.path.realpath(__file__))
-script_path = os.path.realpath(os.path.dirname(__file__))
-if script_path in sys.path:
- sys.path.remove(script_path)
-
-libs = []
-
-if "SCONS_LIB_DIR" in os.environ:
- libs.append(os.environ["SCONS_LIB_DIR"])
-
-# running from source takes 2nd priority (since 2.3.2), following SCONS_LIB_DIR
-source_path = os.path.join(script_path, os.pardir, 'engine')
-if os.path.isdir(source_path):
- libs.append(source_path)
-
-# add local-install locations
-local_version = 'scons-local-' + __version__
-local = 'scons-local'
-if script_dir:
- local_version = os.path.join(script_dir, local_version)
- local = os.path.join(script_dir, local)
-if os.path.isdir(local_version):
- libs.append(os.path.abspath(local_version))
-if os.path.isdir(local):
- libs.append(os.path.abspath(local))
-
-scons_version = 'scons-%s' % __version__
-
-# preferred order of scons lookup paths
-prefs = []
-
-# if we can find package information, use it
-try:
- import pkg_resources
-except ImportError:
- pass
-else:
- try:
- d = pkg_resources.get_distribution('scons')
- except pkg_resources.DistributionNotFound:
- pass
- else:
- prefs.append(d.location)
-
-if sys.platform == 'win32':
- # Use only sys.prefix on Windows
- prefs.append(sys.prefix)
- prefs.append(os.path.join(sys.prefix, 'Lib', 'site-packages'))
-else:
- # On other (POSIX) platforms, things are more complicated due to
- # the variety of path names and library locations.
- # Build up some possibilities, then transform them into candidates
- temp = []
- if script_dir == 'bin':
- # script_dir is `pwd`/bin;
- # check `pwd`/lib/scons*.
- temp.append(os.getcwd())
- else:
- if script_dir == '.' or script_dir == '':
- script_dir = os.getcwd()
- head, tail = os.path.split(script_dir)
- if tail == "bin":
- # script_dir is /foo/bin;
- # check /foo/lib/scons*.
- temp.append(head)
-
- head, tail = os.path.split(sys.prefix)
- if tail == "usr":
- # sys.prefix is /foo/usr;
- # check /foo/usr/lib/scons* first,
- # then /foo/usr/local/lib/scons*.
- temp.append(sys.prefix)
- temp.append(os.path.join(sys.prefix, "local"))
- elif tail == "local":
- h, t = os.path.split(head)
- if t == "usr":
- # sys.prefix is /foo/usr/local;
- # check /foo/usr/local/lib/scons* first,
- # then /foo/usr/lib/scons*.
- temp.append(sys.prefix)
- temp.append(head)
- else:
- # sys.prefix is /foo/local;
- # check only /foo/local/lib/scons*.
- temp.append(sys.prefix)
- else:
- # sys.prefix is /foo (ends in neither /usr or /local);
- # check only /foo/lib/scons*.
- temp.append(sys.prefix)
-
- # suffix these to add to our original prefs:
- prefs.extend([os.path.join(x, 'lib') for x in temp])
- prefs.extend([os.path.join(x, 'lib', 'python' + sys.version[:3],
- 'site-packages') for x in temp])
-
-
- # Add the parent directory of the current python's library to the
- # preferences. This picks up differences between, e.g., lib and lib64,
- # and finds the base location in case of a non-copying virtualenv.
- try:
- libpath = os.__file__
- except AttributeError:
- pass
- else:
- # Split /usr/libfoo/python*/os.py to /usr/libfoo/python*.
- libpath, tail = os.path.split(libpath)
- # Split /usr/libfoo/python* to /usr/libfoo
- libpath, tail = os.path.split(libpath)
- # Check /usr/libfoo/scons*.
- prefs.append(libpath)
-
-# Look first for 'scons-__version__' in all of our preference libs,
-# then for 'scons'. Skip paths that do not exist.
-libs.extend([os.path.join(x, scons_version) for x in prefs if os.path.isdir(x)])
-libs.extend([os.path.join(x, 'scons') for x in prefs if os.path.isdir(x)])
-
-sys.path = libs + sys.path
-
-##############################################################################
-# END STANDARD SCons SCRIPT HEADER
-##############################################################################
-
-if __name__ == "__main__":
- try:
- import SCons.Script
- except ImportError:
- sys.stderr.write("SCons import failed. Unable to find engine files in:\n")
- for path in libs:
- sys.stderr.write(" {}\n".format(path))
- raise
-
- # this does all the work, and calls sys.exit
- # with the proper exit status when done.
- SCons.Script.main()
-
-# Local Variables:
-# tab-width:4
-# indent-tabs-mode:nil
-# End:
-# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/src/setup.cfg b/src/setup.cfg
deleted file mode 100644
index bda7571..0000000
--- a/src/setup.cfg
+++ /dev/null
@@ -1,8 +0,0 @@
-[bdist_rpm]
-group = Development/Tools
-
-[bdist_wininst]
-title = SCons - a software construction tool
-
-[bdist_wheel]
-universal=1
diff --git a/src/setup.py b/src/setup.py
deleted file mode 100755
index 261e2a4..0000000
--- a/src/setup.py
+++ /dev/null
@@ -1,520 +0,0 @@
-#
-# __COPYRIGHT__
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be included
-# in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
-# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
-# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import distutils.command.build_scripts
-import distutils.command.install_scripts
-import distutils.command.install_lib
-import distutils.command.install_data
-import distutils.command.install
-import distutils.core
-import distutils
-# import setuptools
-"""
-NOTE: Installed SCons is not importable like usual Python packages. It is
- executed explicitly with command line scripts. This allows multiple
- SCons versions to coexist within single Python installation, which
- is critical for enterprise build cases. Explicit invokation is
- necessary to avoid confusion over which version of SCons is active.
-
- By default SCons is installed into versioned directory, e.g.
- site-packages/scons-2.1.0.alpha.20101125 and much of the stuff
- below is dedicated to make it happen on various platforms.
-"""
-
-
-__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-
-import os
-import stat
-import sys
-
-Version = "__VERSION__"
-
-man_pages = [
- 'scons.1',
- 'sconsign.1',
- 'scons-time.1',
-]
-
-# change to setup.py directory if it was executed from other dir
-(head, tail) = os.path.split(sys.argv[0])
-if head:
- os.chdir(head)
- sys.argv[0] = tail
-
-# flag if setup.py is run on win32 or _for_ win32 platform,
-# (when building windows installer on linux, for example)
-is_win32 = 0
-if not sys.platform == 'win32':
- try:
- if sys.argv[1] == 'bdist_wininst':
- is_win32 = 1
- except IndexError:
- pass
-else:
- is_win32 = 1
-
-
-_install = distutils.command.install.install
-_install_data = distutils.command.install_data.install_data
-_install_lib = distutils.command.install_lib.install_lib
-_install_scripts = distutils.command.install_scripts.install_scripts
-_build_scripts = distutils.command.build_scripts.build_scripts
-
-
-class _options(object):
- pass
-
-
-Options = _options()
-
-Installed = []
-
-
-def set_explicitly(name, args):
- """
- Return if the installation directory was set explicitly by the
- user on the command line. This is complicated by the fact that
- "install --install-lib=/foo" gets turned into "install_lib
- --install-dir=/foo" internally.
- """
- if args[0] == "install_" + name:
- s = "--install-dir="
- else:
- # The command is something else (usually "install")
- s = "--install-%s=" % name
- set = 0
- length = len(s)
- for a in args[1:]:
- if a[:length] == s:
- set = 1
- break
- return set
-
-
-class install(_install):
- user_options = _install.user_options + [
- ('no-scons-script', None,
- "don't install 'scons', only install 'scons-%s'" % Version),
- ('no-version-script', None,
- "don't install 'scons-%s', only install 'scons'" % Version),
- ('install-bat', None,
- "install 'scons.bat' script"),
- ('no-install-bat', None,
- "do not install 'scons.bat' script"),
- ('install-man', None,
- "install SCons man pages"),
- ('no-install-man', None,
- "do not install SCons man pages"),
- ('standard-lib', None,
- "install SCons library in standard Python location"),
- ('standalone-lib', None,
- "install SCons library in separate standalone directory"),
- ('version-lib', None,
- "install SCons library in version-numbered directory"),
- ]
- boolean_options = _install.boolean_options + [
- 'no-scons-script',
- 'no-version-script',
- 'install-bat',
- 'no-install-bat',
- 'install-man',
- 'no-install-man',
- 'standard-lib',
- 'standalone-lib',
- 'version-lib'
- ]
-
- if hasattr(os, 'link'):
- user_options.append(
- ('hardlink-scons', None,
- "hard link 'scons' to the version-numbered script, don't make a separate 'scons' copy"),
- )
- boolean_options.append('hardlink-script')
-
- if hasattr(os, 'symlink'):
- user_options.append(
- ('symlink-scons', None,
- "make 'scons' a symbolic link to the version-numbered script, don't make a separate 'scons' copy"),
- )
- boolean_options.append('symlink-script')
-
- def initialize_options(self):
- _install.initialize_options(self)
- self.no_scons_script = 0
- self.no_version_script = 0
- self.install_bat = 0
- self.no_install_bat = False # not is_win32
- self.install_man = 0
- self.no_install_man = is_win32
- self.standard_lib = 0
- self.standalone_lib = 0
- self.version_lib = 0
- self.hardlink_scons = 0
- self.symlink_scons = 0
- # Don't warn about having to put the library directory in the
- # search path.
- self.warn_dir = 0
-
- def finalize_options(self):
- _install.finalize_options(self)
- if self.install_bat:
- Options.install_bat = 1
- else:
- Options.install_bat = not self.no_install_bat
- if self.install_man:
- Options.install_man = 1
- else:
- Options.install_man = not self.no_install_man
- Options.standard_lib = self.standard_lib
- Options.standalone_lib = self.standalone_lib
- Options.version_lib = self.version_lib
- Options.install_scons_script = not self.no_scons_script
- Options.install_version_script = not self.no_version_script
- Options.hardlink_scons = self.hardlink_scons
- Options.symlink_scons = self.symlink_scons
-
-
-def get_scons_prefix(libdir, is_win32):
- """
- Return the right prefix for SCons library installation. Find
- this by starting with the library installation directory
- (.../site-packages, most likely) and crawling back up until we reach
- a directory name beginning with "python" (or "Python").
- """
- drive, head = os.path.splitdrive(libdir)
- while head:
- if head == os.sep:
- break
- head, tail = os.path.split(head)
- if tail.lower()[:6] == "python":
- # Found the Python library directory...
- if is_win32:
- # ...on Win32 systems, "scons" goes in the directory:
- # C:\PythonXX => C:\PythonXX\scons
- return os.path.join(drive + head, tail)
- else:
- # ...on other systems, "scons" goes above the directory:
- # /usr/lib/pythonX.X => /usr/lib/scons
- return os.path.join(drive + head)
- return libdir
-
-
-def force_to_usr_local(self):
- """
- A hack to decide if we need to "force" the installation directories
- to be under /usr/local. This is because Mac Os X Tiger and
- Leopard, by default, put the libraries and scripts in their own
- directories under /Library or /System/Library.
- """
- return (sys.platform[:6] == 'darwin' and
- (self.install_dir[:9] == '/Library/' or
- self.install_dir[:16] == '/System/Library/'))
-
-
-class install_lib(_install_lib):
- def finalize_options(self):
- _install_lib.finalize_options(self)
- if force_to_usr_local(self):
- self.install_dir = '/usr/local/lib'
- args = self.distribution.script_args
- if not set_explicitly("lib", args):
- # They didn't explicitly specify the installation
- # directory for libraries...
- is_win32 = sys.platform == "win32" or args[0] == 'bdist_wininst'
- prefix = get_scons_prefix(self.install_dir, is_win32)
- if Options.standalone_lib:
- # ...but they asked for a standalone directory.
- self.install_dir = os.path.join(prefix, "scons")
- elif Options.version_lib:
- # ...they asked for a version-specific directory,
- self.install_dir = os.path.join(prefix, "scons-%s" % Version)
- elif not Options.standard_lib:
- # default.
- self.install_dir = os.path.join(prefix, "scons")
-
- msg = "Installed SCons library modules into %s" % self.install_dir
- Installed.append(msg)
-
-
-class install_scripts(_install_scripts):
- def finalize_options(self):
- _install_scripts.finalize_options(self)
- if force_to_usr_local(self):
- self.install_dir = '/usr/local/bin'
- self.build_dir = os.path.join('build', 'scripts')
- msg = "Installed SCons scripts into %s" % self.install_dir
- Installed.append(msg)
-
- def do_nothing(self, *args, **kw):
- pass
-
- def hardlink_scons(self, src, dst, ver):
- try:
- os.unlink(dst)
- except OSError:
- pass
- os.link(ver, dst)
-
- def symlink_scons(self, src, dst, ver):
- try:
- os.unlink(dst)
- except OSError:
- pass
- os.symlink(os.path.split(ver)[1], dst)
-
- def copy_scons(self, src, dst, *args):
- try:
- os.unlink(dst)
- except OSError:
- pass
- self.copy_file(src, dst)
- self.outfiles.append(dst)
-
- def run(self):
- # --- distutils copy/paste ---
- if not self.skip_build:
- self.run_command('build_scripts')
- # --- /distutils copy/paste ---
-
- # Custom SCons installation stuff.
- if Options.hardlink_scons:
- create_basename_script = self.hardlink_scons
- elif Options.symlink_scons:
- create_basename_script = self.symlink_scons
- elif Options.install_scons_script:
- create_basename_script = self.copy_scons
- else:
- create_basename_script = self.do_nothing
-
- if Options.install_version_script:
- create_version_script = self.copy_scons
- else:
- create_version_script = self.do_nothing
-
- inputs = self.get_inputs()
- bat_scripts = [x for x in inputs if x[-4:] == '.bat']
- non_bat_scripts = [x for x in inputs if x[-4:] != '.bat']
-
- self.outfiles = []
- self.mkpath(self.install_dir)
-
- for src in non_bat_scripts:
- base = os.path.basename(src)
- scons = os.path.join(self.install_dir, base)
- scons_ver = scons + '-' + Version
- if is_win32:
- scons = scons + '.py'
- scons_ver = scons_ver + '.py'
- create_version_script(src, scons_ver)
- create_basename_script(src, scons, scons_ver)
-
- if Options.install_bat:
- if is_win32:
- bat_install_dir = get_scons_prefix(self.install_dir, is_win32)
- else:
- bat_install_dir = self.install_dir
- for src in bat_scripts:
- scons_bat = os.path.join(bat_install_dir, 'scons.bat')
- scons_version_bat = os.path.join(bat_install_dir,
- 'scons-' + Version + '.bat')
- self.copy_scons(src, scons_bat)
- self.copy_scons(src, scons_version_bat)
-
- # --- distutils copy/paste ---
- if hasattr(os, 'chmod') and hasattr(os, 'stat'):
- # Set the executable bits (owner, group, and world) on
- # all the scripts we just installed.
- for file in self.get_outputs():
- if self.dry_run:
- # log.info("changing mode of %s", file)
- pass
- else:
- # Use symbolic versions of permissions so this script doesn't fail to parse under python3.x
- exec_and_read_permission = stat.S_IXOTH | stat.S_IXUSR | stat.S_IXGRP | stat.S_IROTH | stat.S_IRUSR | stat.S_IRGRP
- mode_mask = 4095 # Octal 07777 used because python3 has different octal syntax than python 2
- mode = ((os.stat(file)[stat.ST_MODE]) |
- exec_and_read_permission) & mode_mask
- # log.info("changing mode of %s to %o", file, mode)
- os.chmod(file, mode)
- # --- /distutils copy/paste ---
-
-
-class build_scripts(_build_scripts):
- def finalize_options(self):
- _build_scripts.finalize_options(self)
- self.build_dir = os.path.join('build', 'scripts')
-
-
-class install_data(_install_data):
- def initialize_options(self):
- _install_data.initialize_options(self)
-
- def finalize_options(self):
- _install_data.finalize_options(self)
- if force_to_usr_local(self):
- self.install_dir = '/usr/local'
- if Options.install_man:
- if is_win32:
- dir = 'Doc'
- else:
- dir = os.path.join('man', 'man1')
- self.data_files = [(dir, man_pages)]
- man_dir = os.path.join(self.install_dir, dir)
- msg = "Installed SCons man pages into %s" % man_dir
- Installed.append(msg)
- else:
- self.data_files = []
-
-
-description = "Open Source next-generation build tool."
-
-long_description = """Open Source next-generation build tool.
-Improved, cross-platform substitute for the classic Make
-utility. In short, SCons is an easier, more reliable
-and faster way to build software."""
-
-scripts = [
- 'script/scons',
- 'script/sconsign',
- 'script/scons-time',
- 'script/scons-configure-cache',
-
- # We include scons.bat in the list of scripts, even on UNIX systems,
- # because we provide an option to allow it be installed explicitly,
- # for example if you're installing from UNIX on a share that's
- # accessible to Windows and you want the scons.bat.
- 'script/scons.bat',
-]
-
-arguments = {
- 'name': "scons",
- 'version': Version,
- 'description': description,
- 'long_description': long_description,
- 'author': 'William Deegan',
- 'author_email': 'bill@baddogconsulting.com',
- 'url': "http://www.scons.org/",
- 'packages': ["SCons",
- "SCons.compat",
- "SCons.Node",
- "SCons.Platform",
- "SCons.Scanner",
- "SCons.Script",
- "SCons.Tool",
- "SCons.Tool.clangCommon",
- "SCons.Tool.docbook",
- 'SCons.Tool.clangCommon',
- "SCons.Tool.MSCommon",
- "SCons.Tool.packaging",
- "SCons.Variables",
- ],
- 'package_dir': {'': 'engine',
- 'SCons.Tool.docbook': 'engine/SCons/Tool/docbook'},
- 'package_data': {'SCons.Tool.docbook': ['docbook-xsl-1.76.1/*',
- 'docbook-xsl-1.76.1/common/*',
- 'docbook-xsl-1.76.1/docsrc/*',
- 'docbook-xsl-1.76.1/eclipse/*',
- 'docbook-xsl-1.76.1/epub/*',
- 'docbook-xsl-1.76.1/epub/bin/*',
- 'docbook-xsl-1.76.1/epub/bin/lib/*',
- 'docbook-xsl-1.76.1/epub/bin/xslt/*',
- 'docbook-xsl-1.76.1/extensions/*',
- 'docbook-xsl-1.76.1/fo/*',
- 'docbook-xsl-1.76.1/highlighting/*',
- 'docbook-xsl-1.76.1/html/*',
- 'docbook-xsl-1.76.1/htmlhelp/*',
- 'docbook-xsl-1.76.1/images/*',
- 'docbook-xsl-1.76.1/images/callouts/*',
- 'docbook-xsl-1.76.1/images/colorsvg/*',
- 'docbook-xsl-1.76.1/javahelp/*',
- 'docbook-xsl-1.76.1/lib/*',
- 'docbook-xsl-1.76.1/manpages/*',
- 'docbook-xsl-1.76.1/params/*',
- 'docbook-xsl-1.76.1/profiling/*',
- 'docbook-xsl-1.76.1/roundtrip/*',
- 'docbook-xsl-1.76.1/slides/browser/*',
- 'docbook-xsl-1.76.1/slides/fo/*',
- 'docbook-xsl-1.76.1/slides/graphics/*',
- 'docbook-xsl-1.76.1/slides/graphics/active/*',
- 'docbook-xsl-1.76.1/slides/graphics/inactive/*',
- 'docbook-xsl-1.76.1/slides/graphics/toc/*',
- 'docbook-xsl-1.76.1/slides/html/*',
- 'docbook-xsl-1.76.1/slides/htmlhelp/*',
- 'docbook-xsl-1.76.1/slides/keynote/*',
- 'docbook-xsl-1.76.1/slides/keynote/xsltsl/*',
- 'docbook-xsl-1.76.1/slides/svg/*',
- 'docbook-xsl-1.76.1/slides/xhtml/*',
- 'docbook-xsl-1.76.1/template/*',
- 'docbook-xsl-1.76.1/tests/*',
- 'docbook-xsl-1.76.1/tools/bin/*',
- 'docbook-xsl-1.76.1/tools/make/*',
- 'docbook-xsl-1.76.1/webhelp/*',
- 'docbook-xsl-1.76.1/webhelp/docs/*',
- 'docbook-xsl-1.76.1/webhelp/docs/common/*',
- 'docbook-xsl-1.76.1/webhelp/docs/common/css/*',
- 'docbook-xsl-1.76.1/webhelp/docs/common/images/*',
- 'docbook-xsl-1.76.1/webhelp/docs/common/jquery/*',
- 'docbook-xsl-1.76.1/webhelp/docs/common/jquery/theme-redmond/*',
- 'docbook-xsl-1.76.1/webhelp/docs/common/jquery/theme-redmond/images/*',
- 'docbook-xsl-1.76.1/webhelp/docs/common/jquery/treeview/*',
- 'docbook-xsl-1.76.1/webhelp/docs/common/jquery/treeview/images/*',
- 'docbook-xsl-1.76.1/webhelp/docs/content/*',
- 'docbook-xsl-1.76.1/webhelp/docs/content/search/*',
- 'docbook-xsl-1.76.1/webhelp/docs/content/search/stemmers/*',
- 'docbook-xsl-1.76.1/webhelp/docsrc/*',
- 'docbook-xsl-1.76.1/webhelp/template/*',
- 'docbook-xsl-1.76.1/webhelp/template/common/*',
- 'docbook-xsl-1.76.1/webhelp/template/common/css/*',
- 'docbook-xsl-1.76.1/webhelp/template/common/images/*',
- 'docbook-xsl-1.76.1/webhelp/template/common/jquery/*',
- 'docbook-xsl-1.76.1/webhelp/template/common/jquery/theme-redmond/*',
- 'docbook-xsl-1.76.1/webhelp/template/common/jquery/theme-redmond/images/*',
- 'docbook-xsl-1.76.1/webhelp/template/common/jquery/treeview/*',
- 'docbook-xsl-1.76.1/webhelp/template/common/jquery/treeview/images/*',
- 'docbook-xsl-1.76.1/webhelp/template/content/search/*',
- 'docbook-xsl-1.76.1/webhelp/template/content/search/stemmers/*',
- 'docbook-xsl-1.76.1/webhelp/xsl/*',
- 'docbook-xsl-1.76.1/website/*',
- 'docbook-xsl-1.76.1/xhtml/*',
- 'docbook-xsl-1.76.1/xhtml-1_1/*',
- 'utils/*']},
- 'data_files': [('man/man1', man_pages)],
- 'scripts': scripts,
- 'cmdclass': {'install': install,
- 'install_lib': install_lib,
- 'install_data': install_data,
- 'install_scripts': install_scripts,
- 'build_scripts': build_scripts},
-}
-
-distutils.core.setup(**arguments)
-
-if Installed:
- for i in Installed:
- print(i)
-
-# Local Variables:
-# tab-width:4
-# indent-tabs-mode:nil
-# End:
-# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/test/Repository/Program.py b/test/Repository/Program.py
index 1af3578..3946d95 100644
--- a/test/Repository/Program.py
+++ b/test/Repository/Program.py
@@ -32,7 +32,7 @@ if sys.platform == 'win32':
else:
_exe = ''
-for implicit_deps in ['0', '1', '"all"']:
+for implicit_deps in ['0', '1', '2', '\"all\"']:
# First, test a single repository.
test = TestSCons.TestSCons()
test.subdir('repository', 'work1')
diff --git a/test/Repository/StaticLibrary.py b/test/Repository/StaticLibrary.py
index 29cb841..c4a901b 100644
--- a/test/Repository/StaticLibrary.py
+++ b/test/Repository/StaticLibrary.py
@@ -30,7 +30,7 @@ import TestSCons
_obj = TestSCons._obj
_exe = TestSCons._exe
-for implicit_deps in ['1', '2']:
+for implicit_deps in ['0', '1', '2', '\"all\"']:
test = TestSCons.TestSCons()
#
diff --git a/test/packaging/rpm/explicit-target.py b/test/packaging/rpm/explicit-target.py
index fba0237..0cf486e 100644
--- a/test/packaging/rpm/explicit-target.py
+++ b/test/packaging/rpm/explicit-target.py
@@ -77,7 +77,7 @@ env.Package( NAME = 'foo',
expect = """
scons: *** Setting target is not supported for rpm.
-""" + test.python_file_line(test.workpath('SConstruct'), 23)
+""" + test.python_file_line(test.workpath('SConstruct'), 12)
test.run(arguments='', status=2, stderr=expect)
diff --git a/test/scons-time/run/config/targets.py b/test/scons-time/run/config/targets.py
index 482a44d..1712b32 100644
--- a/test/scons-time/run/config/targets.py
+++ b/test/scons-time/run/config/targets.py
@@ -45,7 +45,7 @@ targets = 'target1 target2'
test.run(arguments = 'run -f config foo.tar.gz')
-scons_py = re.escape(test.workpath('src', 'script', 'scons.py'))
+scons_py = re.escape(test.workpath('scripts', 'scons.py'))
src_engine = re.escape(test.workpath('src', 'engine'))
prof1 = re.escape(test.workpath('foo-000-1.prof'))
diff --git a/test/scons-time/run/option/quiet.py b/test/scons-time/run/option/quiet.py
index 2910e8e..0f6c22b 100644
--- a/test/scons-time/run/option/quiet.py
+++ b/test/scons-time/run/option/quiet.py
@@ -37,7 +37,7 @@ python = TestSCons_time.python
test = TestSCons_time.TestSCons_time(match = TestSCons_time.match_re,
diff = TestSCons_time.diff_re)
-scons_py = re.escape(test.workpath('src', 'script', 'scons.py'))
+scons_py = re.escape(test.workpath('scripts', 'scons.py'))
src_engine = re.escape(test.workpath('src', 'engine'))
tmp_scons_time = test.tempdir_re()
diff --git a/test/scons-time/run/option/verbose.py b/test/scons-time/run/option/verbose.py
index 6f8f72f..9c4e7e8 100644
--- a/test/scons-time/run/option/verbose.py
+++ b/test/scons-time/run/option/verbose.py
@@ -39,7 +39,7 @@ _python_ = re.escape('"' + sys.executable + '"')
test = TestSCons_time.TestSCons_time(match = TestSCons_time.match_re,
diff = TestSCons_time.diff_re)
-scons_py = re.escape(test.workpath('src', 'script', 'scons.py'))
+scons_py = re.escape(test.workpath('scripts', 'scons.py'))
src_engine = re.escape(test.workpath('src', 'engine'))
tmp_scons_time = test.tempdir_re()
diff --git a/test/scons-time/run/subversion.py b/test/scons-time/run/subversion.py
deleted file mode 100644
index f895760..0000000
--- a/test/scons-time/run/subversion.py
+++ /dev/null
@@ -1,81 +0,0 @@
-#!/usr/bin/env python
-#
-# __COPYRIGHT__
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be included
-# in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
-# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
-# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-
-__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-
-"""
-Verify ability to "check out" an SCons revision from a fake
-Subversion utility.
-"""
-
-import re
-import tempfile
-
-import TestSCons_time
-
-test = TestSCons_time.TestSCons_time()
-
-test.write_sample_project('foo.tar')
-
-_python_ = TestSCons_time._python_
-my_svn_py = test.write_fake_svn_py('my_svn.py')
-
-test.write('config', """\
-svn = r'%(_python_)s %(my_svn_py)s'
-""" % locals())
-
-test.run(arguments = 'run -f config --svn http://xyzzy --number 617,716 foo.tar')
-
-test.must_exist('foo-617-0.log',
- 'foo-617-0.prof',
- 'foo-617-1.log',
- 'foo-617-1.prof',
- 'foo-617-2.log',
- 'foo-617-2.prof')
-
-test.must_exist('foo-716-0.log',
- 'foo-716-0.prof',
- 'foo-716-1.log',
- 'foo-716-1.prof',
- 'foo-716-2.log',
- 'foo-716-2.prof')
-
-expect = [
- test.tempdir_re('src', 'script', 'scons.py'),
- 'SCONS_LIB_DIR = %s' % test.tempdir_re('src', 'engine'),
-]
-
-content = test.read(test.workpath('foo-617-2.log'), mode='r')
-
-def re_find(content, line):
- return re.search(line, content)
-test.must_contain_all_lines(content, expect, 'foo-617-2.log', re_find)
-
-test.pass_test()
-
-# Local Variables:
-# tab-width:4
-# indent-tabs-mode:nil
-# End:
-# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/test/sconsign/script/SConsignFile.py b/test/sconsign/script/SConsignFile.py
index 8055b68..cd82fac 100644
--- a/test/sconsign/script/SConsignFile.py
+++ b/test/sconsign/script/SConsignFile.py
@@ -36,7 +36,6 @@ import TestSConsign
_python_ = TestSCons._python_
test = TestSConsign.TestSConsign(match = TestSConsign.match_re)
-
test.subdir('sub1', 'sub2')
fake_cc_py = test.workpath('fake_cc.py')
diff --git a/testing/framework/TestSCons_time.py b/testing/framework/TestSCons_time.py
index 6f46e26..0573404 100644
--- a/testing/framework/TestSCons_time.py
+++ b/testing/framework/TestSCons_time.py
@@ -60,7 +60,7 @@ import os
import sys
dir = sys.argv[-1]
-script_dir = dir + '/src/script'
+script_dir = dir + '/scripts'
os.makedirs(script_dir)
with open(script_dir + '/scons.py', 'w') as f:
f.write(r'''%s''')
@@ -73,7 +73,7 @@ import os
import sys
dir = sys.argv[-1]
-script_dir = dir + '/src/script'
+script_dir = dir + '/scripts'
os.makedirs(script_dir)
with open(script_dir + '/scons.py', 'w') as f:
f.write(r'''%s''')
@@ -158,7 +158,7 @@ class TestSCons_time(TestCommon):
self.orig_cwd = os.getcwd()
try:
- script_dir = os.environ['SCONS_SCRIPT_DIR']
+ script_dir = os.environ['SCONS_TOOLS_DIR']
except KeyError:
pass
else:
@@ -173,8 +173,6 @@ class TestSCons_time(TestCommon):
if 'interpreter' not in kw:
kw['interpreter'] = [python,]
- if sys.version_info[0] < 3:
- kw['interpreter'].append('-tt')
if 'match' not in kw:
kw['match'] = match_exact
@@ -230,8 +228,8 @@ class TestSCons_time(TestCommon):
return x
def write_fake_scons_py(self):
- self.subdir('src', ['src', 'script'])
- self.write('src/script/scons.py', scons_py)
+ self.subdir('scripts')
+ self.write('scripts/scons.py', scons_py)
def write_fake_svn_py(self, name):
name = self.workpath(name)