Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/osbuilder.py
diff options
context:
space:
mode:
authorDaniel Drake <dsd@laptop.org>2009-12-23 12:53:40 (GMT)
committer Daniel Drake <dsd@laptop.org>2009-12-23 13:12:09 (GMT)
commitbc3a54699bd29ce6b282b8ec06213ad8fad2f0dc (patch)
tree4115d23f978405463204872ccbe2e28f367fe307 /osbuilder.py
parenta5d6a9ff4650e6fc26d2ea92a795892b1f30ebf3 (diff)
Make system-installable
Diffstat (limited to 'osbuilder.py')
-rwxr-xr-xosbuilder.py28
1 files changed, 21 insertions, 7 deletions
diff --git a/osbuilder.py b/osbuilder.py
index fc8f641..ecf89ca 100755
--- a/osbuilder.py
+++ b/osbuilder.py
@@ -17,8 +17,12 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
+# canonical source of version number
VERSION="1.0.0"
+# "make install" modifies this in the installed copy
+INSTALLED=0
+
import sys
import os
import os.path
@@ -80,7 +84,7 @@ class Stage(object):
else:
outtype = subprocess.PIPE
- path = os.path.join("modules", mod, part)
+ path = os.path.join(self.osb.moddir, mod, part)
if path.endswith(".inc"):
fd = open(path)
for line in fd:
@@ -123,7 +127,8 @@ class Stage(object):
# find all parts to execute for this stage
partlist = []
for mod in self.osb.modules:
- matches = glob('modules/%s/%s.[0-9][0-9].*' % (mod, self.name))
+ matches = glob('%s/%s/%s.[0-9][0-9].*' \
+ % (self.osb.moddir, mod, self.name))
partlist.extend(matches)
# sort them
@@ -245,10 +250,19 @@ class OsBuilder(object):
self.build_config = build_config
print " * OLPC OS builder v%s" % VERSION
- self.libdir = os.path.join(sys.path[0], 'lib')
- self.bindir = os.path.join(sys.path[0], 'bin')
- self.builddir = os.path.join(sys.path[0], 'build')
- self.cachedir = os.path.join(self.builddir, 'cache')
+ if INSTALLED:
+ self.moddir = "/usr/share/olpc-os-builder/modules.d"
+ self.libdir = "/usr/share/olpc-os-builder/lib"
+ self.bindir = "/usr/libexec/olpc-os-builder"
+ self.builddir = "/var/tmp/olpc-os-builder"
+ self.cachedir = "/var/cache/olpc-os-builder"
+ else:
+ self.moddir = os.path.join(sys.path[0], 'modules')
+ self.libdir = os.path.join(sys.path[0], 'lib')
+ self.bindir = os.path.join(sys.path[0], 'bin')
+ self.builddir = os.path.join(sys.path[0], 'build')
+ self.cachedir = os.path.join(self.builddir, 'cache')
+
self.intermediatesdir = os.path.join(self.builddir, 'intermediates')
self.outputdir = os.path.join(self.builddir, 'output')
self.statedir = os.path.join(self.builddir, 'state')
@@ -293,7 +307,7 @@ class OsBuilder(object):
raise OsBuilderException("Invalid module name in config: %s" \
% mod)
- modpath = os.path.join("modules", mod)
+ modpath = os.path.join(self.moddir, mod)
if not os.path.isdir(modpath):
raise OsBuilderException("Module %s doesn't exist" % mod)