Add the capability to pass a topName to the P&R script in designflow.pnr
This commit is contained in:
parent
09cace5300
commit
6fb0215742
|
@ -24,7 +24,7 @@ class PnR ( FlowTask ):
|
||||||
textMode = True
|
textMode = True
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def mkRule ( rule, targets=[], depends=[], script=None ):
|
def mkRule ( rule, targets=[], depends=[], script=None, topName=None ):
|
||||||
"""
|
"""
|
||||||
Creates a new rule instance (``doit`` task).
|
Creates a new rule instance (``doit`` task).
|
||||||
|
|
||||||
|
@ -36,11 +36,12 @@ class PnR ( FlowTask ):
|
||||||
:param script: A callable, typically a ``scriptMain()`` function. The only
|
:param script: A callable, typically a ``scriptMain()`` function. The only
|
||||||
requirement is that it should accept one keyworded argument (``**kw``).
|
requirement is that it should accept one keyworded argument (``**kw``).
|
||||||
"""
|
"""
|
||||||
return PnR( rule, targets, depends, script )
|
return PnR( rule, targets, depends, script, topName )
|
||||||
|
|
||||||
def __init__ ( self, rule, targets, depends, script ):
|
def __init__ ( self, rule, targets, depends, script, topName ):
|
||||||
super().__init__( rule, targets, depends )
|
super().__init__( rule, targets, depends )
|
||||||
self.script = script
|
self.script = script
|
||||||
|
self.topName = topName
|
||||||
self.addClean( self.targets )
|
self.addClean( self.targets )
|
||||||
|
|
||||||
def __repr__ ( self ):
|
def __repr__ ( self ):
|
||||||
|
@ -70,8 +71,10 @@ class PnR ( FlowTask ):
|
||||||
if self.script and not callable(self.script):
|
if self.script and not callable(self.script):
|
||||||
e = ErrorMessage( 1, 'PnR.doTask(): "script" argument is *not* callable.' )
|
e = ErrorMessage( 1, 'PnR.doTask(): "script" argument is *not* callable.' )
|
||||||
return TaskFailed( e )
|
return TaskFailed( e )
|
||||||
if self.script:
|
kw = {}
|
||||||
self.script( **{} )
|
if self.script and self.topName:
|
||||||
|
kw[ 'loadCell' ] = self.topName
|
||||||
|
self.script( **kw )
|
||||||
if not PnR.textMode:
|
if not PnR.textMode:
|
||||||
# Run in graphic mode.
|
# Run in graphic mode.
|
||||||
ha = Viewer.HApplication.create( [] )
|
ha = Viewer.HApplication.create( [] )
|
||||||
|
|
Loading…
Reference in New Issue