summaryrefslogtreecommitdiff
path: root/admin.py
diff options
context:
space:
mode:
authormartin.von.loewis <devnull@localhost>2009-09-11 10:26:55 +0000
committermartin.von.loewis <devnull@localhost>2009-09-11 10:26:55 +0000
commit6f068d9b15900cdfc34fdd05df9a90c258c4b88f (patch)
tree51faf67da43094625cbd77312a6dfa62f5beb129 /admin.py
parentb55c81413f9b8dfdf5c1fe652709ed8a9e5309e4 (diff)
downloaddecorator-6f068d9b15900cdfc34fdd05df9a90c258c4b88f.tar.gz
Add deleteolddocs command.
Diffstat (limited to 'admin.py')
-rw-r--r--admin.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/admin.py b/admin.py
index 51d78a3..128342c 100644
--- a/admin.py
+++ b/admin.py
@@ -90,6 +90,15 @@ def delete_mirror(store, root):
store.delete_mirror(root)
print 'done'
+def delete_old_docs(config, store):
+ '''Delete documentation directories for packages that have been deleted'''
+ for i in os.listdir(config.database_docs_dir):
+ if not store.has_package(i):
+ path = os.path.join(config.database_docs_dir, i)
+ print "Deleting", path
+ shutil.rmtree(path)
+
+
if __name__ == '__main__':
config = config.Config('/usr/local/pypi/config.ini')
store = store.Store(config)
@@ -113,6 +122,8 @@ if __name__ == '__main__':
add_mirror(*args)
elif command == 'delmirror':
delete_mirror(*args)
+ elif command == 'delolddocs':
+ delete_old_docs(config, *args)
else:
print "unknown command '%s'!"%command
store.commit()