Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Francis <francis@sugarlabs.org>2012-11-16 17:38:32 (GMT)
committer Daniel Francis <francis@sugarlabs.org>2012-11-16 17:38:32 (GMT)
commit9c2f9f6a41a827497f9de4f1f92f9f3b4dd9fad8 (patch)
tree57aff26244186231fa6451110c439faba1a7bf90
parent6e3d2bb64e1e73f324d4d730fe93406d88f1c2a2 (diff)
Use logging when building bundles.
Now it saves all in the dist directory. Signed-off-by: Daniel Francis <francis@sugarlabs.org>
-rw-r--r--desktopbuild.py25
-rw-r--r--xobuild.py24
2 files changed, 39 insertions, 10 deletions
diff --git a/desktopbuild.py b/desktopbuild.py
index 1692020..2ea7edd 100644
--- a/desktopbuild.py
+++ b/desktopbuild.py
@@ -21,9 +21,23 @@
import sys
import os
sys.path.append(os.path.abspath('.'))
+if not os.path.exists('./dist'):
+ os.mkdir('./dist')
os.environ['INFO_L10N'] = '0'
import tarfile
import info
+import logging
+bundle_name = 'dist/%s-%s.tar.gz' % (info.name.replace(' ', ''), info.version)
+log_file = '%s.log' % bundle_name
+if os.path.exists(log_file):
+ os.remove(log_file)
+logging.basicConfig(filename=log_file, level=logging.DEBUG)
+print "Started log in %s" % log_file
+logger = logging.getLogger('xo-bundler')
+import time
+
+logger.debug('Log started on %s' % time.strftime('%c'))
+
ignore_ends = ['.pyc',
'~',
@@ -75,17 +89,18 @@ def packdir(path, newpath=None):
else:
new_path = list(os.path.split(filename))
if newpath:
- global new_path
if newpath != '.':
new_path[0] = newpath
manifest.append((filename, '/'.join(new_path)))
- print '%s listed to pack' % filename
+ logger.info('%s listed to pack' % filename)
packdir('./', '%s-%s' % (info.lower_name, info.version))
-tar = tarfile.open('./%s-%s.tgz' % (info.lower_name,
- info.version), 'w:gz')
+tar = tarfile.open(bundle_name, 'w:gz')
for name, path in manifest:
tar.add(name, path)
- print 'Packed %s as %s' % (name, path)
+ logger.info('Packed %s as %s' % (name, path))
tar.close()
+
+logger.info('Closing log file')
+print "Closed log file"
diff --git a/xobuild.py b/xobuild.py
index fd21c9c..8508bdc 100644
--- a/xobuild.py
+++ b/xobuild.py
@@ -21,9 +21,22 @@
import sys
import os
sys.path.append(os.path.abspath('.'))
+if not os.path.exists('./dist'):
+ os.mkdir('./dist')
os.environ['INFO_L10N'] = '0'
import zipfile
import info
+import logging
+bundle_name = 'dist/%s-%s.xo' % (info.name.replace(' ', ''), info.version)
+log_file = '%s.log' % bundle_name
+if os.path.exists(log_file):
+ os.remove(log_file)
+logging.basicConfig(filename=log_file, level=logging.DEBUG)
+print "Started log in %s" % log_file
+logger = logging.getLogger('xo-bundler')
+import time
+
+logger.debug('Log started on %s' % time.strftime('%c'))
ignore_ends = ['.pyc',
'~',
@@ -75,17 +88,18 @@ def packdir(path, newpath=None):
else:
new_path = list(os.path.split(filename))
if newpath:
- global new_path
if newpath != '.':
new_path[0] = newpath
manifest.append((filename, '/'.join(new_path)))
- print '%s listed to pack' % filename
+ logger.info('%s listed to pack' % filename)
packdir('./', '%s.activity' % info.name.replace(' ', ''))
-xofile = zipfile.ZipFile('./%s-%s.xo' % (info.name.replace(' ', ''),
- info.version), 'w')
+xofile = zipfile.ZipFile(bundle_name, 'w')
for name, path in manifest:
xofile.write(name, path)
- print 'Packed %s as %s' % (name, path)
+ logger.info('Packed %s as %s' % (name, path))
xofile.close()
+
+logger.info('Closing log file')
+print "Closed log file"