Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Narvaez <dwnarvaez@gmail.com>2012-12-05 23:09:41 (GMT)
committer Daniel Narvaez <dwnarvaez@gmail.com>2012-12-14 11:00:09 (GMT)
commite04b49c328255044f4a530be857bbb62373560b6 (patch)
treeba0c84b07c72f2adeefc098e3a9057b4cf1309f1
parentc57347671289dbf9a80d5334d0bb012fb90e6387 (diff)
Rework the install to use git files
Instead of installing everything except a few ignored files. This is consistent with the other packagers.
-rw-r--r--src/sugar3/activity/bundlebuilder.py48
1 files changed, 23 insertions, 25 deletions
diff --git a/src/sugar3/activity/bundlebuilder.py b/src/sugar3/activity/bundlebuilder.py
index 7e54152..6799467 100644
--- a/src/sugar3/activity/bundlebuilder.py
+++ b/src/sugar3/activity/bundlebuilder.py
@@ -97,6 +97,7 @@ class Builder(object):
def __init__(self, config):
self.config = config
+ self.locale_dir = os.path.join(self.config.source_dir, 'locale')
def build(self):
self.build_locale()
@@ -110,8 +111,8 @@ class Builder(object):
locale_dir = os.path.join(self.config.source_dir, 'locale')
- if os.path.exists(locale_dir):
- shutil.rmtree(locale_dir)
+ if os.path.exists(self.locale_dir):
+ shutil.rmtree(self.locale_dir)
for f in os.listdir(po_dir):
if not f.endswith('.po') or f == 'pseudo.po':
@@ -140,10 +141,8 @@ class Builder(object):
f.write('summary = %s\n' % translated_summary)
f.close()
- def get_files(self):
- allfiles = list_files(self.config.source_dir,
- IGNORE_DIRS, IGNORE_FILES)
- return allfiles
+ def get_locale_files(self):
+ return list_files(self.locale_dir, IGNORE_DIRS, IGNORE_FILES)
class Packager(object):
@@ -195,10 +194,9 @@ class XOPackager(Packager):
for f in self.get_files_in_git():
bundle_zip.write(os.path.join(self.config.source_dir, f),
os.path.join(self.config.bundle_root_dir, f))
- locale_dir = os.path.join(self.config.source_dir, 'locale')
- locale_files = list_files(locale_dir, IGNORE_DIRS, IGNORE_FILES)
- for f in locale_files:
- bundle_zip.write(os.path.join(locale_dir, f),
+
+ for f in self.builder.get_locale_files():
+ bundle_zip.write(os.path.join(self.builder.locale_dir, f),
os.path.join(self.config.bundle_root_dir,
'locale', f))
@@ -220,19 +218,11 @@ class SourcePackager(Packager):
tar.close()
-class Installer(object):
- IGNORES = ['po/*', 'MANIFEST', 'AUTHORS']
-
+class Installer(Packager):
def __init__(self, builder):
self.config = builder.config
self.builder = builder
- def should_ignore(self, f):
- for pattern in self.IGNORES:
- if fnmatch(f, pattern):
- return True
- return False
-
def install(self, prefix):
self.builder.build()
@@ -240,13 +230,21 @@ class Installer(object):
self.config.bundle_root_dir)
source_to_dest = {}
- for f in self.builder.get_files():
- if self.should_ignore(f):
- pass
- elif f.startswith('locale/') and f.endswith('.mo'):
- source_to_dest[f] = os.path.join(prefix, 'share', f)
+
+ for f in self.get_files_in_git():
+ source_path = os.path.join(self.config.source_dir, f)
+ dest_path = os.path.join(activity_path, f)
+ source_to_dest[source_path] = dest_path
+
+ for f in self.builder.get_locale_files():
+ source_path = os.path.join(self.builder.locale_dir, f)
+
+ if source_path.endswith(".mo"):
+ dest_path = os.path.join(prefix, 'share', 'locale', f)
else:
- source_to_dest[f] = os.path.join(activity_path, f)
+ dest_path = os.path.join(activity_path, 'locale', f)
+
+ source_to_dest[source_path] = dest_path
for source, dest in source_to_dest.items():
print 'Install %s to %s.' % (source, dest)