Документ взят из кэша поисковой машины. Адрес оригинального документа : http://www.stsci.edu/spst/UnixTransition/doc/move_ccl.py
Дата изменения: Fri Feb 28 14:46:10 2014
Дата индексирования: Sat Mar 1 14:17:47 2014
Кодировка:
#!/usr/bin/env python
#
#MODULE move_ccl
#
#***********************************************************************
"""

**PURPOSE** --
Move a C&C list from one area to another.

**DEVELOPER** --
Don Chance

**MODIFICATION HISTORY** --
o Initial implementation 10/22/12 drc
"""
#***********************************************************************

__version__ = '10/22/12'

import spss_sys_util
import spst_getopt
import os

def run(*args):
"""Move a C&C list from one area to another.
"""
legal_opts = ['source=', 'destination=']
options, parms = spst_getopt.spst_getopt(args, legal_opts)

if options.has_key('-source'):
source_dir = options['-source']
else:
source_dir = '/data/implementation/test-calendars/'

if options.has_key('-destination'):
destination_dir = options['-destination']
else:
destination_dir = os.environ['SPSSCCL']

if len(parms) < 2:
raise IOError('source and destination CCL names must be input')
elif len(parms) > 2:
raise IOError('one and only one source and destination CCL names must be input')


status, output = spss_sys_util.command('(SPSSCCL=%s ; export SPSSCCL ; cclist -get %s ; SPSSCCL=%s ; export SPSSCCL ; cclist -save %s)' % (source_dir,
parms[0],
destination_dir,
parms[1]))
print output
return

if __name__ == '__main__':
import sys
if len(sys.argv) > 1:
run(*sys.argv[1:])
else:
run()