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 """!
31 Add a new artefact. Once the project is generated, it will call
32 generation() on the artefact. The artefact is either appended to the end of the list or prepended to the front of the list depending on the value of append.
33 """
34 if append:
35 self.artefacts.append(artefact)
36 else:
37 self.artefacts = [artefact] + self.artefacts
38
39
40 def generate(self,overwrite,directory,subdirectories=[]):
41 """!
42 Iterates over all stored artefacts and, hence, finally generates all the
43 C files, makefiles, and so forth.
44 """
45 self.makefile.generate(overwrite, directory, subdirectories)
46 for artefact in self.artefacts:
47 artefact.generate(overwrite,directory)
48
49 self.readme.set_executable_name( self.makefile.executable_name() )
50 self.readme.add_entry( self.makefile.readme_entry )
51 self.readme.add_package_description( self.makefile.readme_package_descriptor )
52
53 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
add(self, artefact, append=True)
Add a new artefact.
Definition Output.py:29
generate(self, overwrite, directory, subdirectories=[])
Iterates over all stored artefacts and, hence, finally generates all the C files, makefiles,...
Definition Output.py:40
clear(self)
The clear eliminates all artefacts, but it does not erase the Makefile.
Definition Output.py:18
Creates one README for the whole setup, so people can look up what they have actually built.
Definition Readme.py:10