+ 1#============================================================================
+ 2#Name : ido.py
+ 3#Part of : Helium
+ 4
+ 5#Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ 6#All rights reserved.
+ 7#This component and the accompanying materials are made available
+ 8#under the terms of the License "Eclipse Public License v1.0"
+ 9#which accompanies this distribution, and is available
+10#at the URL "http://www.eclipse.org/legal/epl-v10.html".
+11#
+12#Initial Contributors:
+13#Nokia Corporation - initial contribution.
+14#
+15#Contributors:
+16#
+17#Description:
+18#===============================================================================
+19
+20"""
+21IDO specific features
+22 * find layer_real_source_path from sysdef file.
+23 * time manipulation for robot releasing.
+24"""
+25importre
+26importdatetime
+27
+28MATCH_ENTITY=re.compile(r".*ENTITY\s+layer_real_source_path\s+\"(.+)\"\s*>?.*")
+29
+
43""" This function returns a datetime object representing the monday from closest
+44 even week.
+45 """
+46week=int(now.strftime("%W"))
+47day=int(now.strftime("%w"))-1
+48monday=now-datetime.timedelta(days=day+week.__mod__(2)*7)
+49monday=monday.replace(hour=0,minute=0,second=0,microsecond=0)
+50returnmonday
+
53""" Get the absolute date from the day and time. """
+54time=datetime.datetime.strptime(time,"%H:%M")
+55delta=datetime.timedelta(days=day-1,hours=time.hour,minutes=time.minute)
+56returnget_first_day_of_cycle(now)+delta
+