[install] did some work on the implementation of an installation script

This commit is contained in:
Sebastian Wehling-Benatelli 2016-04-29 11:50:28 +02:00
parent 28fc226750
commit 72fa9e8feb
2 changed files with 54 additions and 3 deletions

View File

@ -27,6 +27,8 @@ updated: Updated
import glob
import os
import sys
import shutil
import copy
from argparse import ArgumentParser
from argparse import RawDescriptionHelpFormatter
@ -123,7 +125,7 @@ def main(argv=None): # IGNORE:C0111
cleanUp()
return 0
except KeyboardInterrupt:
cleanUp(verbose)
cleanUp(1)
return 0
except Exception as e:
if DEBUG or TESTRUN:
@ -156,11 +158,46 @@ def buildPyLoT(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):
pass
if verbosity >= 1:
print('cleaning up build files...')
if sys.platform == 'darwin':
os.remove('./PyLoT')
if __name__ == "__main__":

14
setup.py Normal file
View 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.'
)