[library-web] Always extract all modules out of a single tarball (GNOME bug 653111)
- From: Frederic Peters <fpeters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [library-web] Always extract all modules out of a single tarball (GNOME bug 653111)
- Date: Tue, 21 Jun 2011 19:54:24 +0000 (UTC)
commit 43db8619b38a22e672fcd21d2f6a7935823c2231
Author: FrÃdÃric PÃters <fpeters 0d be>
Date: Tue Jun 21 21:51:37 2011 +0200
Always extract all modules out of a single tarball (GNOME bug 653111)
src/lgo.py | 6 +++++-
src/modtypes/base.py | 9 +++++++--
2 files changed, 12 insertions(+), 3 deletions(-)
---
diff --git a/src/lgo.py b/src/lgo.py
index 64de655..a78405c 100755
--- a/src/lgo.py
+++ b/src/lgo.py
@@ -485,6 +485,7 @@ class Lgo(App):
if version_cmp(doc_version, more_doc.attrib.get('minimum-version')) < 0:
more_tarball_docs.remove(more_doc)
+ extraction_happened = False
regex_gdu = re.compile(r'include.*gnome-doc-utils.make', re.DOTALL)
for tarinfo in tar:
doc = None
@@ -532,7 +533,10 @@ class Lgo(App):
if doc:
doc.filename = filename
doc.mtime_tarball = mtime
- doc.extract()
+ if extraction_happened:
+ doc.extract(force=True)
+ else:
+ extraction_happened = doc.extract()
doc.setup_channel()
doc.path = self.get_module_web_path(doc)
if self.config.channels is None or doc.channel in self.config.channels:
diff --git a/src/modtypes/base.py b/src/modtypes/base.py
index f283a24..543fe2a 100644
--- a/src/modtypes/base.py
+++ b/src/modtypes/base.py
@@ -78,7 +78,10 @@ class DocModule(object):
return self
create_from_tar = classmethod(create_from_tar)
- def extract(self):
+ def extract(self, force=False):
+ '''Extract a given module out of a tarball; extraction will not happen
+ if the output directory already exists, unless @force is given.'''
+
ext_dirname = os.path.join(app.config.private_dir, 'extracts')
if not os.path.exists(ext_dirname):
os.makedirs(ext_dirname)
@@ -89,7 +92,7 @@ class DocModule(object):
if dirname.endswith('/'):
dirname = dirname[:-1]
- if not os.path.exists(os.path.join(ext_dirname, self.dirname)):
+ if not os.path.exists(os.path.join(ext_dirname, self.dirname)) or force:
logging.debug('extracting %s' % self.dirname)
tar = tarfile.open(self.filename, 'r')
for tarinfo in tar.getmembers():
@@ -103,6 +106,8 @@ class DocModule(object):
os.makedirs(os.path.dirname(dest))
open(dest, 'w').write(tar.extractfile(tarinfo).read())
tar.close()
+ return True
+ return False
def get_libgo_document(self, doc_linguas):
try:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]