[library-web] remove stale versions
- From: Frederic Peters <fpeters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [library-web] remove stale versions
- Date: Sat, 6 Sep 2014 08:15:20 +0000 (UTC)
commit 99ef4bc8f9bf22c9f18dcbfa57d9c897f68e2ffd
Author: Frédéric Péters <fpeters 0d be>
Date: Sat Sep 6 10:07:57 2014 +0200
remove stale versions
This doesn't do it for real yet, it only logs files and directories that
should be removed, for human inspection.
src/document.py | 19 +++++++++++++++++++
src/lgo.py | 5 +++++
2 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/src/document.py b/src/document.py
index 9d1f1ff..c6d6932 100644
--- a/src/document.py
+++ b/src/document.py
@@ -162,6 +162,25 @@ class Document:
return doc
+ def remove_stale_versions(self):
+ if not self.path:
+ return
+
+ base_path = app.config.doc_path_template % {
+ 'channel': self.channel,
+ 'module': self.module }
+ dirname = os.path.join(app.config.output_dir, base_path[1:])
+ for filename in os.listdir(dirname):
+ if filename.startswith('index.html'):
+ continue
+ if filename in self.versions:
+ continue
+ if filename in self.tarballs.values():
+ continue
+ if filename in ['stable', 'unstable']:
+ continue
+ logging.info('Should wipe %s' % os.path.join(dirname, filename))
+
class RemoteDocument(Document):
'''Class for documentation files downloaded from remote servers and
diff --git a/src/lgo.py b/src/lgo.py
index e2de2aa..edae60c 100755
--- a/src/lgo.py
+++ b/src/lgo.py
@@ -173,6 +173,7 @@ class Lgo(App):
#self.generate_sitemap()
self.generate_symbols_files()
self.generate_static_pages()
+ self.remove_stale_versions()
def fix_modules_order(self, modules):
for doc in modules[:]:
@@ -1022,6 +1023,10 @@ class Lgo(App):
return os.path.join(self.config.output_dir,
self.get_module_web_path(module, versioned=versioned)[1:])
+ def remove_stale_versions(self):
+ for doc in self.documents:
+ doc.remove_stale_versions()
+
if __name__ == '__main__':
app = Lgo()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]