1
2
3
4
5
6
7
8
9
10
11
12 import os, sys, md5
13 import glob, tarfile, zipfile
14 import cStringIO, shutil
15
16 from twisted.python import log
17
18 from constants import Constants
19
21
23 '''
24 Creates a new instance of ServerCodeManager, which is responsible for
25 extracting MOC packages to temporary directories on server.
26 '''
27 pass
28
40
42 '''
43 Extracts distribution contents to the temporary working directory.
44
45 @type distPath: string
46 @param distPath: String points to the distribution base directory
47 (relative to the application server working directory)
48 '''
49 log.msg('Extracting Distribution: %s' % distPath)
50
51 for moduleFile in glob.glob(os.path.join(distPath, '*' + Constants.MODULE_EXT)):
52 if os.path.isfile(moduleFile):
53 modPackage = tarfile.open(moduleFile, 'r:bz2')
54
55 newDistDirectory = os.path.join(Constants.WORK_DIRECTORY, os.path.basename(distPath))
56 if not os.path.exists(newDistDirectory):
57 os.mkdir(newDistDirectory)
58 modPackage.extractall(newDistDirectory)
59