开源 企业版 高校版 私有云 模力方舟 AI 队友
代码拉取完成,页面将自动刷新
捐赠
捐赠前请先登录
扫描微信二维码支付
取消
支付完成
支付提示
将跳转至支付宝完成支付
确定
取消
1 Star 1 Fork 2

Noneghost/scons

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
已有帐号? 立即登录
master
分支 (37)
标签 (36)
master
feature/new-toolchain
rel_3.1.1
rel_3.1.0
rel_3.0.5
rel_3.0.4
rel_3.0.3
rel_3.0.2
rel_3.0.1
test_bb
rel_3.0.0
rel_2.5.1
python3win32
python3raise
rel_2.5.0
optimize-scan-path-subst-v2
python3-port
rel_2.4.1
rel_2.4.0
rel_2.3.6
3.1.1
3.1.0
3.0.5
3.0.5a2
3.0.4
3.0.3
3.0.2
3.0.1
3.0.0
2.5.1
pre_python3_merge
2.5.0
2.4.1
2.4.0
2.3.6
2.3.5
2.3.4
2.3.3
2.3.2
2.3.1
克隆/下载
克隆/下载
提示
下载代码请复制以下命令到终端执行
为确保你提交的代码身份被 Gitee 正确识别,请执行以下命令完成配置
初次使用 SSH 协议进行代码克隆、推送等操作时,需按下述提示完成 SSH 配置
1 生成 RSA 密钥
2 获取 RSA 公钥内容,并配置到 SSH公钥
在 Gitee 上使用 SVN,请访问 使用指南
使用 HTTPS 协议时,命令行会出现如下账号密码验证步骤。基于安全考虑,Gitee 建议 配置并使用私人令牌 替代登录密码进行克隆、推送等操作
Username for 'https://gitee.com': userName
Password for 'https://userName@gitee.com': # 私人令牌
贡献代码
同步代码
对比差异 通过 Pull Request 同步
同步更新到分支
通过 Pull Request 同步
将会在向当前分支创建一个 Pull
Request,合入后将完成同步
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT
MIT

SCons - a software construction tool

Sourceforge Monthly Downloads Travis CI build status CodeCov Coverage Status

Welcome to the SCons development tree. The real purpose of this tree is to package SCons for production distribution in a variety of formats, not just to hack SCons code.

If all you want to do is install and run SCons, it will be easier for you to download and install the scons-{version}.tar.gz or scons-{version}.zip package rather than to work with the packaging logic in this tree.

To the extent that this tree is about building SCons packages, the full development cycle is not just to test the code directly, but to package SCons, unpack the package, "install" SCons in a test subdirectory, and then to run the tests against the unpacked and installed software. This helps eliminate problems caused by, for example, failure to update the list of files to be packaged.

For just working on making an individual change to the SCons source, however, you don't actually need to build or install SCons; you can actually edit and execute SCons in-place. See the following sections below for more information:

Making Changes
How to edit and execute SCons in-place.
Debugging
Tips for debugging problems in SCons.
Testing
How to use the automated regression tests.
Development Workflow
An example of how to put the edit/execute/test pieces together in a reasonable development workflow.

Latest Version

Before going further, you can check that this package you have is the latest version at the SCons download page:

Execution Requirements

Running SCons requires either Python version 2.7.* or Python 3.5 or higher. There should be no other dependencies or requirements to run SCons.

The default SCons configuration assumes use of the Microsoft Visual C++ compiler suite on WIN32 systems, and assumes a C compiler named 'cc', a C++ compiler named 'c++', and a Fortran compiler named 'g77' (such as found in the GNU C compiler suite) on any other type of system. You may, of course, override these default values by appropriate configuration of Environment construction variables.

By default, SCons knows how to search for available programming tools on various systems--see the SCons man page for details. You may, of course, override the default SCons choices made by appropriate configuration of Environment construction variables.

Installation Requirements

Nothing special.

Executing SCons Without Installing

You can execute the local SCons directly from the src/ subdirectory by first setting the SCONS_LIB_DIR environment variable to the local src/engine subdirectory, and then executing the local src/script/scons.py script to populate the build/scons/ subdirectory. You would do this as follows on a Linux or UNIX system (using sh or a derivative like bash or ksh):

$ setenv MYSCONS=`pwd`/src
$ python $MYSCONS/script/scons.py [arguments]

Or on Windows:

C:\scons>set MYSCONS=%cd%\src
C:\scons>python %MYSCONS%\script\scons.py [arguments]

An alternative approach is to skip the above and use:

$ python bootstrap.py [arguments]

bootstrap.py keeps the src/ subdirectory free of compiled Python (*.pyc or *.pyo) files by copying the necessary SCons files to a local bootstrap/ subdirectory and executing it from there.

You can use the -C option to have SCons change directory to another location where you already have a build configuration set up:

$ python bootstrap.py -C /some/other/location [arguments]

For simplicity in the following examples, we will only show the bootstrap.py approach.

Installation

Note: You don't need to build SCons packages or install SCons if you just want to work on developing a patch. See the sections about Making Changes and Testing below if you just want to submit a bug fix or some new functionality. See the sections below about Building Packages and Testing Packages if your enhancement involves changing the way in which SCons is packaged and/or installed on an end-user system.

Assuming your system satisfies the installation requirements in the previous section, install SCons from this package by first populating the build/scons/ subdirectory. (For an easier way to install SCons, without having to populate this directory, use the scons-{version}.tar.gz or scons-{version}.zip package.)

Populate build/scons/ using a pre-installed SCons

If you already have an appropriate version of SCons installed on your system, populate the build/scons/ directory by running:

$ scons build/scons

Populate build/scons/ using the SCons source

You can also use this version of SCons to populate its own build directory by using a supplied bootstrap.py script (see the section above about Executing SCons Without Installing):

$ python bootstrap.py build/scons

Install the built SCons files

Any of the above commands will populate the build/scons/ directory with the necessary files and directory structure to use the Python-standard setup script as follows on Linux or UNIX:

# cd build/scons
# python setup.py install

Or on Windows:

C:\scons\>cd build\scons
C:\scons\build\scons>python setup.py install

By default, the above commands will do the following:

  • Install the version-numbered "scons-3.1.0" and "sconsign-3.0.3" scripts in the default system script directory (/usr/bin or C:\Python*\Scripts, for example). This can be disabled by specifying the "--no-version-script" option on the command line.

  • Install scripts named "scons" and "sconsign" scripts in the default system script directory (/usr/bin or C:\Python*\Scripts, for example). This can be disabled by specifying the "--no-scons-script" option on the command line, which is useful if you want to install and experiment with a new version before making it the default on your system.

    On UNIX or Linux systems, you can have the "scons" and "sconsign" scripts be hard links or symbolic links to the "scons-3.0.3" and "sconsign-3.0.3" scripts by specifying the "--hardlink-scons" or "--symlink-scons" options on the command line.

  • Install "scons-3.0.3.bat" and "scons.bat" wrapper scripts in the Python prefix directory on Windows (C:\Python*, for example). This can be disabled by specifying the "--no-install-bat" option on the command line.

    On UNIX or Linux systems, the "--install-bat" option may be specified to have "scons-3.0.3.bat" and "scons.bat" files installed in the default system script directory, which is useful if you want to install SCons in a shared file system directory that can be used to execute SCons from both UNIX/Linux and Windows systems.

  • Install the SCons build engine (a Python module) in an appropriate version-numbered SCons library directory (/usr/lib/scons-3.0.3 or C:\Python*\scons-3.0.3, for example). See below for more options related to installing the build engine library.

  • Install the troff-format man pages in an appropriate directory on UNIX or Linux systems (/usr/share/man/man1 or /usr/man/man1, for example). This can be disabled by specifying the "--no-install-man" option on the command line. The man pages can be installed on Windows systems by specifying the "--install-man" option on the command line.

Note that, by default, SCons does not install its build engine library in the standard Python library directories. If you want to be able to use the SCons library modules (the build engine) in other Python scripts, specify the "--standard-lib" option on the command line, as follows:

# python setup.py install --standard-lib

This will install the build engine in the standard Python library directory (/usr/lib/python*/site-packages or C:\Python*\Lib\site-packages).

Alternatively, you can have SCons install its build engine library in a hard-coded standalone library directory, instead of the default version-numbered directory, by specifying the "--standalone-lib" option on the command line, as follows:

# python setup.py install --standalone-lib

This is usually not recommended, however.

Note that, to install SCons in any of the above system directories, you should have system installation privileges (that is, "root" or "Administrator") when running the setup.py script. If you don't have system installation privileges, you can use the --prefix option to specify an alternate installation location, such as your home directory:

$ python setup.py install --prefix=$HOME

This will install SCons in the appropriate locations relative to $HOME--that is, the scons script itself $HOME/bin and the associated library in $HOME/lib/scons, for example.

Making Changes

Because SCons is implemented in a scripting language, you don't need to build it in order to make changes and test them.

Virtually all of the SCons functionality exists in the "build engine," the src/engine/SCons subdirectory hierarchy that contains all of the modules that make up SCons. The src/script/scons.py wrapper script exists mainly to find the appropriate build engine library and then execute it.

In order to make your own changes locally and test them by hand, simply edit modules in the local src/engine/SCons subdirectory tree and use the local bootstrap.py script (see the section above about Executing SCons Without Installing):

$ python bootstrap.py [arguments]

If you want to be able to just execute your modified version of SCons from the command line, you can make it executable and add its directory to your $PATH like so:

$ chmod 755 src/script/scons.py
$ export PATH=$PATH:`pwd`/src/script

You should then be able to run this version of SCons by just typing "scons.py" at your UNIX or Linux command line.

Note that the regular SCons development process makes heavy use of automated testing. See the Testing and Development Workflow sections below for more information about the automated regression tests and how they can be used in a development cycle to validate that your changes don't break existing functionality.

Debugging

Python comes with a good interactive debugger. When debugging changes by hand (i.e., when not using the automated tests), you can invoke SCons under control of the Python debugger by specifying the --debug=pdb option:

$ scons --debug=pdb [arguments]
> /home/knight/SCons/src/engine/SCons/Script/Main.py(927)_main()
-> default_warnings = [ SCons.Warnings.CorruptSConsignWarning,
(Pdb)

Once in the debugger, you can set breakpoints at lines in files in the build engine modules by providing the path name of the file relative to the src/engine subdirectory (that is, including the SCons/ as the first directory component):

(Pdb) b SCons/Tool/msvc.py:158

The debugger also supports single stepping, stepping into functions, printing variables, etc.

Trying to debug problems found by running the automated tests (see the Testing section, below) is more difficult, because the test automation harness re-invokes SCons and captures output. Consequently, there isn't an easy way to invoke the Python debugger in a useful way on any particular SCons call within a test script.

The most effective technique for debugging problems that occur during an automated test is to use the good old tried-and-true technique of adding statements to print tracing information. But note that you can't just use "print" statement, or even "sys.stdout.write()" because those change the SCons output, and the automated tests usually look for matches of specific output strings to decide if a given SCons invocations passes the test.

To deal with this, SCons supports a Trace() function that (by default) will print messages to your console screen ("/dev/tty" on UNIX or Linux, "con" on Windows). By adding Trace() calls to the SCons source code:

def sample_method(self, value):
 from SCons.Debug import Trace
 Trace('called sample_method(%s, %s)\n' % (self, value))

You can then run automated tests that print any arbitrary information you wish about what's going on inside SCons, without interfering with the test automation.

The Trace() function can also redirect its output to a file, rather than the screen:

def sample_method(self, value):
 from SCons.Debug import Trace
 Trace('called sample_method(%s, %s)\n' % (self, value),
 file='trace.out')

Where the Trace() function sends its output is stateful: once you use the "file=" argument, all subsequent calls to Trace() send their output to the same file, until another call with a "file=" argument is reached.

Testing

Tests are run by the runtest.py script in this directory.

There are two types of tests in this package:

  1. Unit tests for individual SCons modules live underneath the src/engine/ subdirectory and are the same base name as the module with "Tests.py" appended--for example, the unit test for the Builder.py module is the BuilderTests.py script.
  2. End-to-end tests of SCons live in the test/ subdirectory.

You may specifically list one or more tests to be run:

$ python runtest.py src/engine/SCons/BuilderTests.py

$ python runtest.py test/option-j.py test/Program.py

You also use the -f option to execute just the tests listed in a specified text file:

$ cat testlist.txt
test/option-j.py
test/Program.py
$ python runtest.py -f testlist.txt

One test must be listed per line, and any lines that begin with '#' will be ignored (allowing you, for example, to comment out tests that are currently passing and then uncomment all of the tests in the file for a final validation run).

The runtest.py script also takes a -a option that searches the tree for all of the tests and runs them:

$ python runtest.py -a

If more than one test is run, the runtest.py script prints a summary of how many tests passed, failed, or yielded no result, and lists any unsuccessful tests.

The above invocations all test directly the files underneath the src/ subdirectory, and do not require that a build be performed first. The runtest.py script supports additional options to run tests against unpacked packages in the build/test-*/ subdirectories. See the Testing Packages section below.

Development Workflow

Caveat: The point of this section isn't to describe one dogmatic workflow. Just running the test suite can be time-consuming, and getting a patch to pass all of the tests can be more so. If you're genuinely blocked, it may make more sense to submit a patch with a note about which tests still fail, and how. Someone else may be able to take your "initial draft" and figure out how to improve it to fix the rest of the tests. So there's plenty of room for use of good judgement.

The various techniques described in the above sections can be combined to create simple and effective workflows that allow you to validate that patches you submit to SCons don't break existing functionality and have adequate testing, thereby increasing the speed with which they can be integrated.

For example, suppose your project's SCons configuration is blocked by an SCons bug, and you decide you want to fix it and submit the patch. Here's one possible way to go about doing that (using UNIX/Linux as the development platform, Windows users can translate as appropriate)):

  • Change to the top of your checked-out SCons tree.

  • Confirm that the bug still exists in this version of SCons by using the -C

    option to run the broken build:

    $ python bootstrap.py -C /home/me/broken_project .
    
  • Fix the bug in SCons by editing appropriate module files underneath src/engine/SCons.

  • Confirm that you've fixed the bug affecting your project:

    $ python bootstrap.py -C /home/me/broken_project .
    
  • Test to see if your fix had any unintended side effects that break existing functionality:

    $ python runtest.py -a -o test.log
    

    Be patient, there are more than 700 test scripts in the whole suite. If you are on UNIX/Linux, you can use:

    $ python runtest.py -a | tee test.log
    

    instead so you can monitor progress from your terminal.

    If any test scripts fail, they will be listed in a summary at the end of the log file. Some test scripts may also report NO RESULT because (for example) your local system is the wrong type or doesn't have some installed utilities necessary to run the script. In general, you can ignore the NO RESULT list.

  • Cut-and-paste the list of failed tests into a file:

    $ cat > failed.txt
    test/failed-test-1.py
    test/failed-test-2.py
    test/failed-test-3.py
    ^D
    $
    
  • Now debug the test failures and fix them, either by changing SCons, or by making necessary changes to the tests (if, for example, you have a strong reason to change functionality, or if you find that the bug really is in the test script itself). After each change, use the runtest.py -f option to examine the effects of the change on the subset of tests that originally failed:

    $ [edit]
    $ python runtest.py -f failed.txt
    

    Repeat this until all of the tests that originally failed now pass.

  • Now you need to go back and validate that any changes you made while getting the tests to pass didn't break the fix you originally put in, and didn't introduce any additional unintended side effects that broke other tests:

    $ python bootstrap.py -C /home/me/broken_project .
    $ python runtest.py -a -o test.log
    

    If you find any newly-broken tests, add them to your "failed.txt" file and go back to the previous step.

Of course, the above is only one suggested workflow. In practice, there is a lot of room for judgment and experience to make things go quicker. For example, if you're making a change to just the Java support, you might start looking for regressions by just running the test/Java/*.py tests instead of running all of "runtest.py -a".

Building Packages

We use SCons (version 3.0.3 or later) to build its own packages. If you already have an appropriate version of SCons installed on your system, you can build everything by simply running it:

$ scons

If you don't have SCons already installed on your system, you can use the supplied bootstrap.py script (see the section above about Executing SCons Without Installing):

$ python bootstrap.py build/scons

Depending on the utilities installed on your system, any or all of the following packages will be built:

build/dist/scons-3.1.1.tar.gz
build/dist/scons-3.1.1.zip
build/dist/scons-doc-3.1.1.tar.gz
build/dist/scons-local-3.1.1.tar.gz
build/dist/scons-local-3.1.1.zip
build/dist/scons-src-3.1.1.tar.gz
build/dist/scons-src-3.1.1.zip

The SConstruct file is supposed to be smart enough to avoid trying to build packages for which you don't have the proper utilities installed. For example, if you don't have Debian packaging tools installed, it should just not build the .deb package, not fail the build.

If you receive a build error, please report it to the scons-devel mailing list and open a bug report on the SCons bug tracker.

Note that in addition to creating the above packages, the default build will also unpack one or more of the packages for testing.

Testing Packages

A full build will unpack and/or install any .deb, .rpm., .local.tar.gz, .local.zip, .src.tar.gz, .src.zip, .tar.gz, and .zip packages into separate build/test-*/ subdirectories. (Of course, if a package was not built on your system, it should not try to install it.) The runtest.py script supports a -p option that will run the specified tests (individually or collectively via the -a option) against the unpacked build/test-/* subdirectory:

$ python runtest.py -p local-tar-gz

$ python runtest.py -p local-zip

$ python runtest.py -p src-tar-gz

$ python runtest.py -p src-zip

$ python runtest.py -p tar-gz

$ python runtest.py -p zip

(The canonical invocation is to also use the runtest.py -a option so that all tests are run against the specified package.)

Contents of this Package

Not guaranteed to be up-to-date (but better than nothing):

bench/
A subdirectory for benchmarking scripts, used to perform timing tests to decide what specific idioms are most efficient for various parts of the code base. We check these in so they're available in case we have to revisit any of these decisions in the future.
bin/

Miscellaneous utilities used in SCons development. Right now, some of the stuff here includes:

  • a script that runs pychecker on our source tree;
  • a script that counts source and test files and numbers of lines in each;
  • a prototype script for capturing sample SCons output in xml files;
  • a script that can profile and time a packaging build of SCons itself;
  • a copy of xml_export, which can retrieve project data from SourceForge; and
  • scripts and a Python module for translating the SCons home-brew XML documentation tags into DocBook and man page format
bootstrap.py
Build script for running SCons from the current source code checkout. This copies SCons files to bootstrap/ subdirectory, and then executes SCons with the supplied command-line arguments.
build/
This doesn't exist yet if you're looking at a vanilla source tree. This is generated as part of our build process, and it's where, believe it or not, we build everything.
debian/
Files needed to construct a Debian package. The contents of this directory are dictated by the Debian Policy Manual (
src/
Where the actual source code is kept, of course.
test/
End-to-end tests of the SCons utility itself. These are separate from the individual module unit tests, which live side-by-side with the modules under src/.

Documentation

See the src/RELEASE.txt file for notes about this specific release, including known problems. See the src/CHANGES.txt file for a list of changes since the previous release.

The doc/man/scons.1 man page is included in this package, and contains a section of small examples for getting started using SCons.

Additional documentation for SCons is available at:

Licensing

SCons is distributed under the MIT license, a full copy of which is available in the LICENSE file.

Reporting Bugs

The SCons project welcomes bug reports and feature requests.

Please make sure you send email with the problem or feature request to the SCons users mailing list, which you can join via the link below:

https://github.com/SCons/scons/issues

Mailing Lists

An active mailing list for developers of SCons is available. You may send questions or comments to the list at:

scons-dev@scons.org

You may subscribe to the developer's mailing list using form on this page:

announce-subscribe@scons.tigris.org

There are other mailing lists available for SCons users, for notification of SCons code changes, and for notification of updated bug reports and project documents. Please see our mailing lists page for details.

Donations

If you find SCons helpful, please consider making a donation (of cash, software, or hardware) to support continued work on the project. Information is available at:

For More Information

Check the SCons web site at:

Author Info

SCons was originally written by Steven Knight, knight at baldmt dot com. Since around 2010 it has been maintained by the SCons development team, co-managed by Bill Deegan and Gary Oberbrunner, with many contributors, including but not at all limited to:

  • Chad Austin
  • Dirk Baechle
  • Charles Crain
  • William Deegan
  • Steve Leblanc
  • Rob Managan
  • Greg Noel
  • Gary Oberbrunner
  • Anthony Roach
  • Greg Spencer
  • Tom Tanner
  • Anatoly Techtonik
  • Christoph Wiedemann
  • Russel Winder

... and many others.

Copyright (c) 2001 - 2019 The SCons Foundation

MIT License Copyright (c) 2001 - 2019 The SCons Foundation 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.
Copyright and license for SCons - a software construction tool This copyright and license do not apply to any other software with which this software may have been included. 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.
举报
举报成功
我们将于2个工作日内通过站内信反馈结果给你!
请认真填写举报原因,尽可能描述详细。
请选择举报类型
取消
发送
误判申诉

此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。

如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。

取消
提交

简介

SCons - a software construction tool
暂无标签
README
MIT
使用 MIT 开源许可协议
, MIT
使用 MIT 开源许可协议
取消

发行版

暂无发行版

贡献者

全部

近期动态

不能加载更多了
编辑仓库简介
简介内容
主页
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/noneghost/scons.git
git@gitee.com:noneghost/scons.git
noneghost
scons
scons
master
点此查找更多帮助

搜索帮助

评论
仓库举报
回到顶部
登录提示
该操作需登录 Gitee 帐号,请先登录后再操作。
立即登录
没有帐号,去注册

AltStyle によって変換されたページ (->オリジナル) /