Autoconf Functionality: check existence of a file
This issue was originally created at: 2008-08-29 02:41:26.
This issue was reported by: bipbip.
bipbip said at 2008-08-29 02:41:26
Hello, This would be great to add in the a autoconf-module a:
conf.CheckFile(filename)which would check if the given file existsconf.CheckProgram(programName)which would check if the given Program is accessible to scons (in path).
This would improve the setup of the build environment.
Thank you so much for this fantastic build tool!
kind Regards,
Adrien.
gregnoel said at 2008-09-02 15:10:27
Bug party triage.
In the short term, you can use the (undocumented)
File().exists()method to determine if a file is present. It knows aboutVariantDirandRepository, and checks those directories to see if the file exists there, as well.In the short term, you can use the
env.WhereIs()method to determine whether a command is present; it's documented in the man page. You could also use the undocumentedenv.Detect()method, which finds the first of multiple commands.In the medium term, the methods you suggest could be implemented as wrappers around the above sequences. This issue will be left open but not assigned to anyone in the hopes someone will step up and offer to do just that.
Adrien, would you be interested in submitting a patch? It would be the quickest way to get the methods implemented. If so, don't hesitate to ask on the dev list for help; we'll be happy to do whatever we can. It would also require documentation and test cases, but we can show you how to do that.
In the long term, Configure contexts are being replaced by something else that will be better integrated in SCons, more like Autoconf, and easier to use. If you have some knowledge and experience with Autotools, we'd be pleased if you would become involved in that effort, to help keep us honest and on-track.
stevenknight said at 2008-12-06 11:29:26
No one's looking at this because it's target milestone is 1.x, but it's still assigned to issues@scons, and we haven't heard back from the O.P. Change the target milestone to -unspecified- so we can prioritize and assign it correctly at the next Bug Party.
stevenknight said at 2008-12-06 11:31:13
Actually changing the target milestone this time.
gregnoel said at 2008-12-24 06:48:50
Bug party triage. Tackle this as part of the revamping of Configure() contexts.
Okay, this says: undocumented File().exists() method and undocumented env.Detect() method - do those need to be added to the docs?
Nope. I think this is an enhancement request asking for configure checks:
conf.CheckFile(filename)which would check if the given file existsconf.CheckProgram(programName)which would check if the given Program is accessible to scons (in path).
Right, that's what the issue is; it's the commentary that suggests workarounds - two of which it notes are undocumented.
o.k. yes doc for manpage for Detect().. but the .exists shouldn't be in manpage but rather in API docs via docstring.