Hello,
For people who have upgraded standard existing Analysis installations (so
via the Project --> Upgrade menu) rather than installing from scratch, I
have attached a little Python script, addScripts.py, which adds three new
scripts into the ccpnmr/bin directory:
dataShifter:
This is a program you can use to shift data between different projects
(it's existed for awhile but just hasn't had a script in the bin
directory)
updateCheck:
This will run the Analysis update popup without you having to be
running Analysis. (Because sometimes updates accidentally break Analysis
so you need to run the update stand-alone once we have fixed the problem.)
It is called updateCheck because you get to check interactively which
updates you want (and normally you select all).
updateAll:
This will fetch all available updates without user interaction. So
one option, if you want to make sure you are always up-to-date, would be
to run a cron job which runs this script. (I wouldn't necessarily
recommend that though!)
In order to run addScripts.py, put it in your ccpnmr (so top-level)
directory and run it there. It will cd into the bin directory and try to
create the three new scripts based on what your existing formatConverter
and analysis scripts say.
People who install from scratch will get all the bin scripts
automatically.
Wayne
import os
format_program = 'formatConverter'
data_shifter_program = 'dataShifter'
analysis_program = 'analysis'
updateCode_program = 'updateCheck'
updateAuto_program = 'updateAll'
searchString = 'analysis/AnalysisGui'
replaceString = { \
data_shifter_program: 'DataShifter',
updateCode_program: 'update/UpdatePopup',
updateAuto_program: 'update/UpdateAuto',
}
try:
os.chdir('bin')
except:
print 'could not change to bin directory, make sure you are in ccpnmr directory'
raise
if os.path.exists(format_program):
fp = open(format_program)
lines = fp.readlines()
fp.close()
for program in (data_shifter_program, ):
if os.path.exists(program):
print '%s already exists, skipping' % program
else:
try:
fp = open(program, 'w')
except:
print 'could not open %s for writing, do you have write permission in bin directory?' % program
continue
for line in lines:
n = line.find('FormatConverter')
if n >= 0:
line = line.replace(searchString, replaceString[program])
line = line.replace(' -i ', ' ')
fp.write(line)
fp.close()
os.chmod(program, 0755)
print '%s created ok' % program
else:
print 'could not find %s, so cannot create dataShifter script' % format_program
if os.path.exists(analysis_program):
fp = open(analysis_program)
lines = fp.readlines()
fp.close()
for program in (updateCode_program, updateAuto_program):
if os.path.exists(program):
print '%s already exists, skipping' % program
else:
try:
fp = open(program, 'w')
except:
print 'could not open %s for writing, do you have write permission in bin directory?' % program
continue
for line in lines:
n = line.find('analysis/AnalysisGui')
if n >= 0:
line = line.replace(searchString, replaceString[program])
line = line.replace(' -i ', ' ')
fp.write(line)
fp.close()
os.chmod(program, 0755)
print '%s created ok' % program
else:
print 'could not find %s, so cannot create update scripts' % analysis_program
|