mirror of
https://github.com/iiab/iiab.git
synced 2025-03-09 15:40:17 +00:00
Move 19 roles into roles/0-DEPRECATED-ROLES
This commit is contained in:
parent
0e39c42bbd
commit
2218d2334b
124 changed files with 5 additions and 1 deletions
|
|
@ -0,0 +1,30 @@
|
|||
#!/usr/bin/python
|
||||
# Copyright (C) 2008 One Laptop Per Child Association, Inc.
|
||||
# Licensed under the terms of the GNU GPL v2 or later; see COPYING for details.
|
||||
#
|
||||
# written by Douglas Bagnall <douglas@paradise.net.nz>
|
||||
|
||||
"""This script reads activity.info from bundle files and reports on
|
||||
their quality.
|
||||
"""
|
||||
|
||||
import xs_activities
|
||||
import sys, os
|
||||
|
||||
xs_activities.USE_STDERR = True
|
||||
|
||||
show_all = '--show-all' in sys.argv
|
||||
if show_all:
|
||||
sys.argv.remove('--show-all')
|
||||
|
||||
|
||||
try:
|
||||
directory = sys.argv[1]
|
||||
os.stat(directory)
|
||||
except (IndexError, OSError):
|
||||
print __doc__
|
||||
print "USAGE: %s DIRECTORY" % sys.argv[0]
|
||||
sys.exit(1)
|
||||
|
||||
xs_activities.check_all_bundles(directory, show_all)
|
||||
|
||||
|
|
@ -0,0 +1,93 @@
|
|||
#!/usr/bin/python
|
||||
# Copyright (C) 2008 One Laptop Per Child Association, Inc.
|
||||
# Licensed under the terms of the GNU GPL v2 or later; see COPYING for details.
|
||||
#
|
||||
# written by Douglas Bagnall <douglas@paradise.net.nz>
|
||||
|
||||
"""Read activity.info files from a directory full of activity bundles
|
||||
and write an appropriate html manifest of the most recent versions.
|
||||
The manifest uses the OLPC activity microformat:
|
||||
|
||||
http://wiki.laptop.org/go/Activity_microformat
|
||||
|
||||
This is put in a place where apache can find it, and apache will serve
|
||||
it and the activities to the laptops. Messages go to /var/log/user.log.
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
import shutil
|
||||
from time import time
|
||||
|
||||
import xs_activities
|
||||
|
||||
INPUT_DIR = "/library/xs-activity-server/activities"
|
||||
OUTPUT_LINK = "/library/xs-activity-server/www"
|
||||
|
||||
try:
|
||||
CURRENT_DIR = os.readlink(OUTPUT_LINK)
|
||||
except OSError:
|
||||
CURRENT_DIR = None
|
||||
|
||||
|
||||
def create_dir_manifest(dir_path):
|
||||
manifest = []
|
||||
os.chdir(dir_path)
|
||||
for root, dirs, files in os.walk("."):
|
||||
for filename in files:
|
||||
if not filename.endswith(".xo") and not filename.endswith(".xol"):
|
||||
continue
|
||||
|
||||
path = os.path.join(root, filename)
|
||||
s = os.stat(path)
|
||||
manifest.append((path, s.st_ino))
|
||||
|
||||
manifest.sort()
|
||||
return manifest
|
||||
|
||||
|
||||
def input_changed():
|
||||
if CURRENT_DIR is None:
|
||||
return True
|
||||
|
||||
input_manifest = create_dir_manifest(INPUT_DIR)
|
||||
current_manifest = create_dir_manifest(CURRENT_DIR)
|
||||
return input_manifest != current_manifest
|
||||
|
||||
|
||||
if not input_changed():
|
||||
# no changes or nothing to do
|
||||
sys.exit(0)
|
||||
|
||||
# create new output dir
|
||||
OUTPUT_DIR = OUTPUT_LINK + "." + str(time())
|
||||
os.mkdir(OUTPUT_DIR)
|
||||
|
||||
# link in all activities
|
||||
os.chdir(INPUT_DIR)
|
||||
for root, dirs, files in os.walk("."):
|
||||
output_dir = os.path.join(OUTPUT_DIR, root)
|
||||
if not os.path.isdir(output_dir):
|
||||
os.makedirs(output_dir)
|
||||
|
||||
for filename in files:
|
||||
if not filename.endswith(".xo") and not filename.endswith(".xol"):
|
||||
continue
|
||||
|
||||
path = os.path.join(root, filename)
|
||||
output_path = os.path.join(output_dir, filename)
|
||||
os.link(path, output_path)
|
||||
|
||||
# create html index
|
||||
output_html = os.path.join(output_dir, 'index.html')
|
||||
xs_activities.htmlise_bundles(output_dir, output_html)
|
||||
|
||||
|
||||
# update symlink atomically
|
||||
link = OUTPUT_DIR + ".lnk"
|
||||
os.symlink(OUTPUT_DIR, link)
|
||||
os.rename(link, OUTPUT_LINK)
|
||||
|
||||
# remove old index
|
||||
if CURRENT_DIR is not None:
|
||||
shutil.rmtree(CURRENT_DIR, ignore_errors=True)
|
||||
Loading…
Add table
Add a link
Reference in a new issue