[Scons-users] check for build

Philipp Kraus philipp.kraus at flashpixx.de
Fri Jun 7 19:28:22 EDT 2013



Am 07.06.2013 um 22:11 schrieb Philipp Kraus:


>

> Am 07.06.2013 um 21:25 schrieb Dirk Bächle:

>

>> Hi Phil,

>>

>> On 07.06.2013 20:57, Philipp Kraus wrote:

>>>

>>> Am 07.06.2013 um 20:28 schrieb Dirk Bächle:

>>>

>>>> On 07.06.2013 19:45, Bill Deegan wrote:

>>>>> Sounds like what you really want is a scanner to get the hash from the source for your download builder.

>>>>> Not a change to your emitter..

>>>>>

>>>>

>>>> Another approach would be to put the HTTP header text into a ValueNode, and then let the target (downloaded file) depend on it.

>>>

>>> Both ideas are nice, but your idea sound a little bit better. My emitter creates the target filename eg

>>> env.Download("a_target_name", "http://..../file.tar"), so the emitter changes the target name into file.tar, the builder create the access for download.

>>>

>>> With an option I can use the target name, that is set in the function call or the name can be replaced by the emitter.

>>>

>>

>> why do you want to do the "#"s in the Emitter?

>

> That's my first idea, is there a better position?

> I hope for any idea to solve this problem


I have created my own Node class:

class URLNode(SCons.Node.Python.Value) :

def get_csig(self, calc=None):
try:
return self.ninfo.csig
except AttributeError:
pass

try :
response = urllib2.urlopen( str(self.value) ).info()
except Exception, e :
raise SCons.Errors.StopError( e )

contents = ""
if "Last-Modified" in response :
contents = contents + response["Last-Modified"]
if "Content-Length" in response :
contents = contents + response["Content-Length"]
if not contents :
contents = self.get_contents()
self.get_ninfo().csig = contents
return contents

I have copied the get_csig from the Python.Value node and add the part of the URL header data. This seems to be working, but I need some tests. The node
is exactlly build, if the Last-Modified & Content-Length part are changed, otherwise SCons reports "nodes up-to-date" and this is correct.

phil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://four.pairlist.net/pipermail/scons-users/attachments/20130608/4722d4e7/attachment.htm


More information about the Scons-users mailing list