diff options
Diffstat (limited to 'xobuild.py')
-rw-r--r-- | xobuild.py | 24 |
1 files changed, 19 insertions, 5 deletions
@@ -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" |