Peano
Loading...
Searching...
No Matches
Output.py
Go to the documentation of this file.
1# This file is part of the Peano project. For conditions of distribution and
2# use, please see the copyright notice at www.peano-framework.org
3from .Makefile import Makefile
4from .Readme import Readme
5
6
7class Output(object):
8 """
9 Represents the total output generated from the Peano4 data model plus all
10 the operations on it. This is basically a big collection.
11 """
12 def __init__(self):
13 self.artefacts = []
14 self.readme = Readme()
16
17
18 def clear(self):
19 """
20 The clear eliminates all artefacts, but it does not erase the Makefile.
21 This is important as I don't want to loose all the makefile info. If
22 you want to clear the makefile, too, you have to invoke a clear on it.
23 """
24 self.artefacts = []
25 self.readme = Readme()
26 self.makefile.clear_files()
27
28
29 def add(self,artefact,append=True):
30 if append:
31 self.artefacts.append(artefact)
32 else:
33 self.artefacts = [artefact] + self.artefacts
34
35
36 def generate(self,overwrite,directory,subdirectories=[]):
37 """
38 Iterates over all stored artefacts and, hence, finally generates all the
39 C files, makefiles, and so forth.
40 """
41 self.makefile.generate(overwrite, directory, subdirectories)
42 for artefact in self.artefacts:
43 artefact.generate(overwrite,directory)
44
45 self.readme.set_executable_name( self.makefile.executable_name() )
46 self.readme.add_entry( self.makefile.readme_entry )
47 self.readme.add_package_description( self.makefile.readme_package_descriptor )
48
49 self.readme.generate(directory)
Represents the created Makefile of a Peano 4 project.
Definition Makefile.py:14
Represents the total output generated from the Peano4 data model plus all the operations on it.
Definition Output.py:7
clear(self)
The clear eliminates all artefacts, but it does not erase the Makefile.
Definition Output.py:18
generate(self, overwrite, directory, subdirectories=[])
Iterates over all stored artefacts and, hence, finally generates all the C files, makefiles,...
Definition Output.py:36
add(self, artefact, append=True)
Definition Output.py:29