summaryrefslogtreecommitdiff
path: root/morphlib/blobs.py
diff options
context:
space:
mode:
authorJannis Pohlmann <jannis.pohlmann@codethink.co.uk>2012-01-17 17:29:06 +0000
committerJannis Pohlmann <jannis.pohlmann@codethink.co.uk>2012-01-19 12:07:31 +0000
commit85069b20d623b93154fb3858eaae0e978fd6a2e6 (patch)
tree8bed2d00c77609b5974316b11ece7c54ceba6a5a /morphlib/blobs.py
parentf0531394958d2ce3fb44ca4e5f1ae204a599fda7 (diff)
downloadmorph-85069b20d623b93154fb3858eaae0e978fd6a2e6.tar.gz
Initial work on integrate the build order work into builder.
Diffstat (limited to 'morphlib/blobs.py')
-rw-r--r--morphlib/blobs.py59
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