[install] did some work on the implementation of an installation script
This commit is contained in:
parent
28fc226750
commit
72fa9e8feb
43
makePyLoT.py
43
makePyLoT.py
@ -27,6 +27,8 @@ updated: Updated
|
|||||||
import glob
|
import glob
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
import shutil
|
||||||
|
import copy
|
||||||
|
|
||||||
from argparse import ArgumentParser
|
from argparse import ArgumentParser
|
||||||
from argparse import RawDescriptionHelpFormatter
|
from argparse import RawDescriptionHelpFormatter
|
||||||
@ -123,7 +125,7 @@ def main(argv=None): # IGNORE:C0111
|
|||||||
cleanUp()
|
cleanUp()
|
||||||
return 0
|
return 0
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
cleanUp(verbose)
|
cleanUp(1)
|
||||||
return 0
|
return 0
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
if DEBUG or TESTRUN:
|
if DEBUG or TESTRUN:
|
||||||
@ -156,11 +158,46 @@ def buildPyLoT(verbosity=None):
|
|||||||
|
|
||||||
|
|
||||||
def installPyLoT(verbosity=None):
|
def installPyLoT(verbosity=None):
|
||||||
pass
|
files_to_copy = {'autoPyLoT_local.in':['~', '.pylot'],
|
||||||
|
'autoPyLoT_regional.in':['~', '.pylot'],
|
||||||
|
'filter.in':['~', '.pylot']}
|
||||||
|
if verbosity > 0:
|
||||||
|
print ('starting installation of PyLoT ...')
|
||||||
|
if verbosity > 1:
|
||||||
|
print ('copying input files into destination folder ...')
|
||||||
|
ans = input('please specify scope of interest '
|
||||||
|
'([0]=local, 1=regional) :') or 0
|
||||||
|
if not isinstance(ans, int):
|
||||||
|
ans = int(ans)
|
||||||
|
ans = 'local' if ans is 0 else 'regional'
|
||||||
|
link_dest = []
|
||||||
|
for file, destination in files_to_copy.items():
|
||||||
|
link_file = ans in file
|
||||||
|
if link_file:
|
||||||
|
link_dest = copy.deepcopy(destination)
|
||||||
|
link_dest.append('autoPyLoT.in')
|
||||||
|
link_dest = os.path.join(*link_dest)
|
||||||
|
destination.append(file)
|
||||||
|
destination = os.path.join(*destination)
|
||||||
|
srcfile = os.path.join('input', file)
|
||||||
|
assert not os.path.isabs(srcfile), 'source files seem to be ' \
|
||||||
|
'corrupted ...'
|
||||||
|
if verbosity > 1:
|
||||||
|
print ('copying file {file} to folder {dest}'.format(file=file, dest=destination))
|
||||||
|
shutil.copyfile(srcfile, destination)
|
||||||
|
if link_file:
|
||||||
|
if verbosity:
|
||||||
|
print('linking input file for autoPyLoT ...')
|
||||||
|
os.symlink(destination, link_dest)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def cleanUp(verbosity=None):
|
def cleanUp(verbosity=None):
|
||||||
pass
|
if verbosity >= 1:
|
||||||
|
print('cleaning up build files...')
|
||||||
|
if sys.platform == 'darwin':
|
||||||
|
os.remove('./PyLoT')
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
14
setup.py
Normal file
14
setup.py
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
from distutils.core import setup
|
||||||
|
|
||||||
|
setup(
|
||||||
|
name='PyLoT',
|
||||||
|
version='0.1a1',
|
||||||
|
packages=['pylot', 'pylot.core', 'pylot.core.loc', 'pylot.core.pick',
|
||||||
|
'pylot.core.read', 'pylot.core.util', 'pylot.core.active',
|
||||||
|
'pylot.core.analysis', 'pylot.testing'],
|
||||||
|
url='dummy',
|
||||||
|
license='LGPLv3',
|
||||||
|
author='Sebastian Wehling-Benatelli',
|
||||||
|
author_email='sebastian.wehling@rub.de',
|
||||||
|
description='Comprehensive Python picking and Location Toolbox for seismological data.'
|
||||||
|
)
|
Loading…
Reference in New Issue
Block a user