dsx.ware.Ware is an object containing a description of something made of elements. In DSX, this can be an application’s Tcg, an Hardware description, or a Software. Other wares exist in DSX. These are the most used ones. In any case, their elements are subclasses of the dsx.ware.WNode class.
A Ware can contain an arbitrary set of WNodes.
WNodes have a type and a name, which are strings relevant to the Ware only. Ware objects have accessors for nodes by name, by type, all.
Ware subclasses are actually an internal representation of some part of the design in DSX. Main goal is to transform the Ware into something else. Driver objects are there to transform (i.e. drive()) Wares:
Driver objects can be nested, like Ware objects may contain other Ware objects. This hierarchy is explicitly built at driver construction.
Commands are not directly run by the Drivers, but Drivers use dsx.runner.Runner objects. In turn, Runners may directly call commands, or create Makefiles.
A ware object
Object construction
Creates a new empty ware object
Access to WNodes
Add nodes to the ware object.
Parameters: | nodes (variadic of WNode objects) – Nodes to add |
---|
Retrieves all the node types seen in this ware.
Returns: | an iterable of type strings |
---|
Retrieves the nodes of a given type.
Parameters: | _type (str) – Type of nodes to get |
---|---|
Returns: | an iterable containing WNode objects |
Usage with Drivers
Whether this ware is prepared.
Returns: | a boolean |
---|
Sets this ware as prepared.
Adds a given ware to be also driven when this ware is finally driven. The driver used for the ware will be:
driver_class(*args, parent = self, **kwargs)
Parameters: |
|
---|
Do the generation.
For each driver, call the drive method of the driver with given keyword arguments.
This also does the post-driver, i.e. call all drivers added through addPostDriver().
Parameters: |
|
---|
Driver class. WNode can register their generation method to this class.
Object construction
File-related
Output directory
Generate a filename inside the output directory.
Parameters: | name (str) – Filename relative to the output directory |
---|---|
Returns: | Absolute path corresponding to the filename |
Generate a name corresponding to the output directory, but suitable for a file name without special characters.
Returns: | A filename corresponding to output directory, without directory separators |
---|
Generation of file and links
Subset generation support
Whether the selected output directories contain the one of this driver.
Whether the selected output directories do not contain the one of this driver.
Actual generation entry-points
Prepare the driver:
Does the actual work of the driver. This method should be overloaded for inherited classes.
Parameters: | desc (dsx.ware.Ware) – A ware to work on. |
---|
Runner settings
Override the runner for this driver.
kwargs are passed verbatim to the runner.
Parameters: |
|
---|
dsx.runner.Runner object associated to the driver
Generation low-level primitives, are wrappers around Runner‘s methods
Run a command by calling the current runner. If the runner does not directly call the program, errors may be reported later.
Parameters: |
---|
Add a dependency to target for the “clean” target of current runner.
Parameters: | target – Target name |
---|
Add a dependency to target for the “compile” target of current runner.
Parameters: | target – Target name |
---|
A class able to run commands, immediately or delayed.
Adds a command to the run queue.
Parameters: |
|
---|
A Makefile-based runner. Saves all the commands to run in a Makefile. This does not directly run the commands.
Creates a new Makefile-based runner.
Parameters: | makefile_path (str) – Path where to save the Makefile to. |
---|
Saves the Makefile to its destination path.