diff options
author | Jannis Pohlmann <jannis.pohlmann@codethink.co.uk> | 2012-01-17 17:29:06 +0000 |
---|---|---|
committer | Jannis Pohlmann <jannis.pohlmann@codethink.co.uk> | 2012-01-19 12:07:31 +0000 |
commit | 85069b20d623b93154fb3858eaae0e978fd6a2e6 (patch) | |
tree | 8bed2d00c77609b5974316b11ece7c54ceba6a5a /morphlib/blobs.py | |
parent | f0531394958d2ce3fb44ca4e5f1ae204a599fda7 (diff) | |
download | morph-85069b20d623b93154fb3858eaae0e978fd6a2e6.tar.gz |
Initial work on integrate the build order work into builder.
Diffstat (limited to 'morphlib/blobs.py')
-rw-r--r-- | morphlib/blobs.py | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/morphlib/blobs.py b/morphlib/blobs.py new file mode 100644 index 00000000..70cd1f90 --- /dev/null +++ b/morphlib/blobs.py @@ -0,0 +1,59 @@ +# Copyright (C) 2012 Codethink Limited +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + +class Blob(object): + + def __init__(self, parent, morph): + self.parent = parent + self.morph = morph + self.dependencies = set() + self.dependents = set() + + def add_dependency(self, other): + self.dependencies.add(other) + other.dependents.add(self) + + def remove_dependency(self, other): + self.dependencies.remove(other) + other.dependents.remove(self) + + def depends_on(self, other): + return other in self.dependencies + + @property + def chunks(self): + if self.morph.chunks: + return self.morph.chunks + else: + return { self.morph.name: ['.'] } + + def __str__(self): + return str(self.morph) + + +class Chunk(Blob): + + pass + + +class Stratum(Blob): + + pass + + +class System(Blob): + + pass |