diff options
Diffstat (limited to 'sbhs_server/pages/management')
-rw-r--r-- | sbhs_server/pages/management/__init__.py | 0 | ||||
-rw-r--r-- | sbhs_server/pages/management/__init__.pyc | bin | 0 -> 155 bytes | |||
-rw-r--r-- | sbhs_server/pages/management/commands/__init__.py | 0 | ||||
-rw-r--r-- | sbhs_server/pages/management/commands/arm.diff | 14 | ||||
-rw-r--r-- | sbhs_server/pages/management/commands/zip_client.py | 66 |
5 files changed, 80 insertions, 0 deletions
diff --git a/sbhs_server/pages/management/__init__.py b/sbhs_server/pages/management/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/sbhs_server/pages/management/__init__.py diff --git a/sbhs_server/pages/management/__init__.pyc b/sbhs_server/pages/management/__init__.pyc Binary files differnew file mode 100644 index 0000000..d400ccc --- /dev/null +++ b/sbhs_server/pages/management/__init__.pyc diff --git a/sbhs_server/pages/management/commands/__init__.py b/sbhs_server/pages/management/commands/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/sbhs_server/pages/management/commands/__init__.py diff --git a/sbhs_server/pages/management/commands/arm.diff b/sbhs_server/pages/management/commands/arm.diff new file mode 100644 index 0000000..868bec1 --- /dev/null +++ b/sbhs_server/pages/management/commands/arm.diff @@ -0,0 +1,14 @@ +--- a/sbhs_server/pages/management/commands/zip_client.py ++++ b/sbhs_server/pages/management/commands/zip_client.py +@@ -33,6 +33,10 @@ class Command(BaseCommand): + run_file_dirpath = os.path.join(dirpath, "run_file") + + os.mkdir(tmp_dirpath) ++ for root, dirs, files in os.walk(dirpath): ++ for f in files: ++ shutil.copy(os.path.join(dirpath, f), os.path.join(tmp_dirpath, f)) ++ + distutils.dir_util.copy_tree(scilab_codes_dirpath, tmp_dirpath) + try: + shutil.rmtree(tmp_dirpath + "/" + scilab_codes_dirname + "/.git") + diff --git a/sbhs_server/pages/management/commands/zip_client.py b/sbhs_server/pages/management/commands/zip_client.py new file mode 100644 index 0000000..89263bf --- /dev/null +++ b/sbhs_server/pages/management/commands/zip_client.py @@ -0,0 +1,66 @@ +from django.core.management.base import BaseCommand +import os, zipfile, shutil, distutils.core +from sbhs_server import settings + +class Command(BaseCommand): + args = '' + help = 'ZIP all clients for all architectures.' + + def handle(self, *args, **options): + def zipdir(path, zip, rootname): + for root, dirs, files in os.walk(path): + for file in files: + pathname = os.path.join(root, file) + zip.write(pathname, rootname + "/" + pathname.replace(path, "")) + + scilab_codes_dirname = "scilab_codes" + scilab_codes_dirpath = os.path.join(settings.SBHSCLIENT_STATIC_DIR, scilab_codes_dirname) + zipped_dirname = "zipped" + zipped_dirpath = os.path.join(settings.SBHSCLIENT_STATIC_DIR, zipped_dirname) + + dirs = os.listdir(settings.SBHSCLIENT_STATIC_DIR) + print dirs + dirs.remove(scilab_codes_dirname) + dirs.remove(zipped_dirname) + print dirs + dirs = [d for d in dirs if os.path.isdir(os.path.join(settings.SBHSCLIENT_STATIC_DIR, d))] + print dirs + dirs = [d for d in dirs if not d.startswith(".")] + + for dirname in dirs: + print dirname + dirpath = os.path.join(settings.SBHSCLIENT_STATIC_DIR, dirname) + tmp_dirpath = os.path.join(zipped_dirpath, dirname) + common_files_dirpath = os.path.join(dirpath, "common_files") + run_file_dirpath = os.path.join(dirpath, "run_file") + + os.mkdir(tmp_dirpath) + for f in os.listdir(dirpath): + if os.path.isfile(os.path.join(dirpath, f)): + shutil.copy(os.path.join(dirpath, f), os.path.join(tmp_dirpath, f)) + + if dirname not in ["analysis", "local"]: + distutils.dir_util.copy_tree(scilab_codes_dirpath, tmp_dirpath) + else: + distutils.dir_util.copy_tree(dirpath, tmp_dirpath) + try: + shutil.rmtree(tmp_dirpath + "/" + scilab_codes_dirname + "/.git") + except: + pass + + try: + for root, dirs, files in os.walk(tmp_dirpath): + if os.path.exists(os.path.join(root, "scilabread.sce")): + distutils.dir_util.copy_tree(run_file_dirpath, root) + except: + pass + + try: + distutils.dir_util.copy_tree(common_files_dirpath, os.path.join(tmp_dirpath, "common_files")) + except: + pass + + zipf = zipfile.ZipFile(os.path.join(zipped_dirpath, "sbhsclient/scilab_codes_" + dirname + ".zip"), 'w', zipfile.ZIP_DEFLATED) + zipdir(tmp_dirpath, zipf, "scilab_codes_" + dirname) + zipf.close() + shutil.rmtree(tmp_dirpath) |