scons

How to replace (or strip) an extension from a filename in Python?

蹲街弑〆低调 提交于 2019-11-27 12:15:56
Is there a built-in function in Python that would replace (or remove, whatever) the extension of a filename (if it has one) ? Example: print replace_extension('/home/user/somefile.txt', '.jpg') In my example: /home/user/somefile.txt would become /home/user/somefile.jpg I don't know if it matters, but I need this for a SCons module I'm writing. (So perhaps there is some SCons specific function I can use ?) I'd like something clean . Doing a simple string replacement of all occurrences of .txt within the string is obviously not clean. (This would fail if my filename is somefile.txt.txt.txt )

How can I use a cross compiler with Scons?

白昼怎懂夜的黑 提交于 2019-11-27 09:51:09
Following the advice on the Scons FAQ and from an old mailing list thread , I've built up a really simple SConstruct and SConscript that I thought would build an example app, but errors out with: scons: Reading SConscript files ... scons: done reading SConscript files. scons: Building targets ... nios2-linux-gnu-g++ -o src/bin/example/example.o -c src/bin/example/example.cpp sh: nios2-linux-gnu-g++: command not found scons: *** [src/bin/example/example.o] Error 127 scons: building terminated because of errors. Ugh. My SConstruct file: import os env_options = { "CC" : "nios2-linux-gnu-gcc",

What are the differences between Autotools, Cmake and Scons?

风格不统一 提交于 2019-11-27 09:08:34
问题 What are the differences between Autotools, Cmake and Scons? 回答1: In truth, Autotools' only real 'saving grace' is that it is what all the GNU projects are largely using. Issues with Autotools: Truly ARCANE m4 macro syntax combined with verbose, twisted shell scripting for tests for "compatibility", etc. If you're not paying attention, you will mess up cross-compilation ability (It should clearly be noted that Nokia came up with Scratchbox/Scratchbox2 to side-step highly broken Autotools

Scons学习【转】

一世执手 提交于 2019-11-26 18:33:55
scons 学习 作者:Sam(甄峰) sam_code@hotmail.com http://www.scons.org/ Sam有个好朋友是做游戏的,整天嘲笑做嵌入式的用的工具多土多原始。gdb不是图形化,DDD又没VC调试好用,只会写Makefile等等。 刚好最近有需要使用scons。所以Sam准备学习之以回击这种挑衅。呵呵。 scons简介: scons是一个Python写的自动化构建工具,从构建这个角度说,它跟GNU make是同一类的工具。 scons与其它工具最显著的差别就是:scons配置文件是Python script. 它的思想是跟GNU make完全不同的。GNU make的核心是“依赖关系”,我要做的事情,就是告诉系统,一个目标依赖什么东西,并且,当被依赖的东西发生变化时,我要做什么。 例如: all: main.c $(CC) $(CFLAGS) $(LFLAGS) main.c -o BT_remote -lbluetooth -lBluetooth_remote -lm -lpthread 意思是:all依赖于main.c。 如果main.c有了变化,作下面这些事。 这样做可以解决相当多的问题,但是也带来了一个最大的问题:我如何判别这个目标依赖什么? 对于一个两个,甚至十几个文件,我当然还比较容易搞清楚,谁依赖谁。但是当文件有成百上千个时

How to replace (or strip) an extension from a filename in Python?

纵饮孤独 提交于 2019-11-26 15:56:53
问题 Is there a built-in function in Python that would replace (or remove, whatever) the extension of a filename (if it has one) ? Example: print replace_extension('/home/user/somefile.txt', '.jpg') In my example: /home/user/somefile.txt would become /home/user/somefile.jpg I don't know if it matters, but I need this for a SCons module I'm writing. (So perhaps there is some SCons specific function I can use ?) I'd like something clean . Doing a simple string replacement of all occurrences of .txt

How can I use a cross compiler with Scons?

蹲街弑〆低调 提交于 2019-11-26 14:57:40
问题 Following the advice on the Scons FAQ and from an old mailing list thread, I've built up a really simple SConstruct and SConscript that I thought would build an example app, but errors out with: scons: Reading SConscript files ... scons: done reading SConscript files. scons: Building targets ... nios2-linux-gnu-g++ -o src/bin/example/example.o -c src/bin/example/example.cpp sh: nios2-linux-gnu-g++: command not found scons: *** [src/bin/example/example.o] Error 127 scons: building terminated

Building multiple executables with similar rules

烈酒焚心 提交于 2019-11-26 13:50:35
I am writing something like an interactive tutorial for C++. The tutorial will consist of two parts: one is compiled into a library (I'm using Scons to build that), and the other (the lessons) is shipped with the tutorial to be compiled by the end user. I'm currently looking for a good, easy way for people to build these lessons. Basically, the second part is a directory with all the lessons in it, each in its own directory. Each lesson will have at least a lesson.cpp and a main.cpp file, there may be also other files, the existence of which I will not know until after it is shipped -- the end

Building multiple executables with similar rules

空扰寡人 提交于 2019-11-26 03:44:28
问题 I am writing something like an interactive tutorial for C++. The tutorial will consist of two parts: one is compiled into a library (I\'m using Scons to build that), and the other (the lessons) is shipped with the tutorial to be compiled by the end user. I\'m currently looking for a good, easy way for people to build these lessons. Basically, the second part is a directory with all the lessons in it, each in its own directory. Each lesson will have at least a lesson.cpp and a main.cpp file,