Skip to content

Conversation

@gabrielrussell
Copy link
Contributor

@gabrielrussell gabrielrussell commented Oct 3, 2017

This issue was originally created at: 2005-07-15 04:46:12.
This issue was reported by: gregnoel.
gregnoel said at 2005-07-15 04:46:12

This patch adds a FLAGS keyword to override environments (only). A complete
patch would also add a FLAGS keyword to standard environments, but that turned
out to be much more complex and I don't have time to do it before I leave on
holiday. I'm submitting this patch as a placeholder and a promise: if I make it
back (travel is getting more dangerous these days) I'll update this patch to
include standard environments. Worst case, someone else can do it. (Or someone
can work on it while I'm gone; fixing standard environments looks very messy, so
any help would be appreciated.)

What this patch allows is something like this:
env.Program('foo', 'bar.cpp', FLAGS = '-O2 -Dfoo -lfoobar')
and the flags will be automatically merged into the appropriate environment
variables. It invokes MergeFlags under the covers, so this will also work:
dict = env.ParseFlags('-O2 -Dfoo -lfoobar')
dict['SWIGFLAGS'] = '-c++ -python'
env.Object('bar.i', FLAGS = dict)
The flags can also be a list, with the expected semantics:
env.Program('foo', 'bar.cpp', FLAGS = ['-O2', '!pkg-config ...'])
Unfortunately, mixing dicts and strings isn't supported (maybe that will be a
future enhancement).

As a workaround for standard environments, this works:
env = Environment().MergeFlags(['-O2', '!pkg-config ...'])

stevenknight said at 2006-01-05 18:16:06

Changing version to "unspecified" to conform to new scheme.

kmaples said at 2006-05-20 17:03:29

making the default milestone consistent across the project

kmaples said at 2006-05-20 17:14:13

making the version consistent across the project

stevenknight said at 2006-05-26 03:46:34

Created an attachment (id=5)
diff for Environment.py

stevenknight said at 2006-05-26 03:47:47

Added file attachment as part of final severing of SourceForge ties.

gregnoel said at 2007-05-17 17:53:54

This should be assigned to me. I've already got some additional work beyond the
current patch and it's something I'd like to do.

gregnoel said at 2007-05-17 17:55:53

Humpf. I thought accepting an issue automatically assigned it to me.

gregnoel said at 2007-05-17 17:57:35

Okay, already; I guess I have to assign it to myself, then accept it.

gregnoel said at 2008-03-16 00:40:52

Created an attachment (id=331)
Final patch; applied 14-Mar-2008

gregnoel said at 2008-03-16 00:43:08

Patch applied; includes code, tests, docs, release description

More information about this issue is at http://simtech.sf.net/flags.txt.

gregnoel attached flags-diff at 2008-03-16 00:40:51.

Final patch; applied 14-Mar-2008

stevenknight attached flags.txt at 2008-03-25 11:08:15.

diff for Environment.py

@bdbaddog
Copy link
Contributor

bdbaddog commented Oct 3, 2017

Copying this from the original BB pull request: Comment By Tom Tanner:

Won't this throw an exception if some file in the cache is read only (or at least not writeable by you)

Also if the file is a link, this will set the time on the target of the link (and possibly throw an exception if the link target doesn't exist). Some poking around on goggle and python bug tracker suggests you'd need to use lutimes which isn't supported in 2.7 or 3.3 (and might or might not be supported in 3.4, but is supported in 3.5 as an extra parameter to utime)

@coveralls
Copy link

coveralls commented Dec 12, 2017

Coverage Status

Coverage decreased (-0.008%) to 73.705% when pulling 68b9d30 on gabrielrussell:master into e158a56 on SCons:master.

@coveralls
Copy link

coveralls commented Dec 13, 2017

Coverage Status

Coverage decreased (-0.005%) to 73.707% when pulling 2882c53 on gabrielrussell:master into e158a56 on SCons:master.

@bdbaddog bdbaddog changed the title update mtime on cache retrieval Add FLAGS keyword to override environments Jan 2, 2018
@bdbaddog bdbaddog closed this Jan 2, 2018
@bdbaddog bdbaddog added the P3 label Jan 2, 2018
bdbaddog added a commit that referenced this pull request Apr 27, 2019
Also ignore PURE and ELEMENTAL after MODULE in Scanner and Emitter.
bdbaddog pushed a commit that referenced this pull request May 15, 2022
Change cache key to tuple and read/write list of dictionaries to json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants