Skip to content
Snippets Groups Projects
Commit 47093678 authored by Nicola Vigano's avatar Nicola Vigano
Browse files

Added undocumented generation of install scripts bundles

parent 823696a9
No related branches found
No related tags found
No related merge requests found
...@@ -28,7 +28,8 @@ class DCTLauncher(object): ...@@ -28,7 +28,8 @@ class DCTLauncher(object):
cmd = args[1] cmd = args[1]
if cmd is "-h" or cmd is "--help": if cmd is "-h" or cmd is "--help":
self.command = "help" self.command = "help"
elif cmd in ("matlab", "update", "compile_mex", "compile_matlab", "update_conf"): elif cmd in ("matlab", "update", "compile_mex", "compile_matlab", \
"update_conf", "make"):
self.command = cmd self.command = cmd
else: else:
raise ValueError("Command '%s' not recognized" % cmd) raise ValueError("Command '%s' not recognized" % cmd)
...@@ -51,6 +52,8 @@ class DCTLauncher(object): ...@@ -51,6 +52,8 @@ class DCTLauncher(object):
self._launchCompileMatlab() self._launchCompileMatlab()
elif self.command == "update_conf": elif self.command == "update_conf":
self._launchUpdateConf() self._launchUpdateConf()
elif self.command == "make":
self._launchMake()
else: else:
raise ValueError("Not recognized command: %s" % self.command) raise ValueError("Not recognized command: %s" % self.command)
...@@ -130,6 +133,16 @@ class DCTLauncher(object): ...@@ -130,6 +133,16 @@ class DCTLauncher(object):
confexamplefile = os.path.join(self.dct_dir, "zUtil_Conf", "conf.example.xml") confexamplefile = os.path.join(self.dct_dir, "zUtil_Conf", "conf.example.xml")
upd.safelyInstallNewFile(confexamplefile, "conf.xml") upd.safelyInstallNewFile(confexamplefile, "conf.xml")
def _launchMake(self):
if len(self.args) is 0:
raise ValueError("Not enough arguments")
if self.args[0] == "install_zip":
builder = dct.dct_distrib.DCTMakeInstallBundle()
builder.run(self.dct_dir)
else:
raise ValueError("Unsupported make option: '%s'" % " ".join(self.args))
def printHelp(self): def printHelp(self):
print("\"%s\" launches dct or one of the maintenance routines in the DCT directory: \"%s\"" % print("\"%s\" launches dct or one of the maintenance routines in the DCT directory: \"%s\"" %
(__file__, self.dct_dir) ) (__file__, self.dct_dir) )
...@@ -149,7 +162,9 @@ if __name__ == '__main__': ...@@ -149,7 +162,9 @@ if __name__ == '__main__':
try: try:
launcher.run() launcher.run()
except SystemError as exc: except SystemError as ex:
dct.dct_io_xml.DCTOutput.printError(exc.args) dct.dct_io_xml.DCTOutput.printError(ex.args)
print("Try running:\n # python %s update_conf" % __file__) print("Try running:\n # python %s update_conf" % __file__)
except ValueError as ex:
dct.dct_io_xml.DCTOutput.printError(ex.args)
...@@ -10,4 +10,6 @@ import dct_utils_git ...@@ -10,4 +10,6 @@ import dct_utils_git
import dct_utils_platform import dct_utils_platform
import dct_compile_mex_functions import dct_compile_mex_functions
import dct_compile_matlab_functions import dct_compile_matlab_functions
\ No newline at end of file
import dct_distrib
'''
Created on Feb 4, 2013
@author: ben
'''
import os
import zipfile
class DCTMakeInstallBundle(object):
def __init__(self, *args, **kwargs):
object.__init__(self, *args, **kwargs)
def run(self, dct_dir):
currentDir = os.getcwd()
os.chdir(os.path.join(dct_dir, "zUtil_Python"))
destFile = os.path.join(currentDir, "DCT_install.zip")
zfid = zipfile.ZipFile(destFile, mode = "w")
try:
zfid.write('dct_compile_matlab_functions.py')
zfid.write('dct_compile_mex_functions.py')
zfid.write('dct_io_xml.py')
zfid.write('dct_utils_git.py')
zfid.write('dct_utils_platform.py')
zfid.write('dct_setup.py')
finally:
zfid.close()
print("Created file: %s" % destFile)
os.chdir(currentDir)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment