added verbose output functionality

This commit is contained in:
Sebastian Wehling-Benatelli 2014-12-02 12:07:02 +01:00
parent 04e6a51e99
commit 609005433a

View File

@ -95,18 +95,20 @@ USAGE
if verbose > 0: if verbose > 0:
print("Verbose mode on") print("Verbose mode on")
if install and not directory: if install and not directory:
raise CLIError("trying to install without destination; please specify an installation directory") raise CLIError("""Trying to install without appropriate
destination; please specify an installation
directory!""")
if build and install: if build and install:
print("Building and installing PyLoT ...") print("Building and installing PyLoT ...\n")
buildPyLoT() buildPyLoT(verbose)
installPyLoT() installPyLoT(verbose)
elif build and not install: elif build and not install:
print("Building PyLoT without installing! Please wait ...") print("Building PyLoT without installing! Please wait ...\n")
buildPyLoT() buildPyLoT(verbose)
cleanUp() cleanUp()
return 0 return 0
except KeyboardInterrupt: except KeyboardInterrupt:
cleanUp() cleanUp(verbose)
return 0 return 0
except Exception, e: except Exception, e:
if DEBUG or TESTRUN: if DEBUG or TESTRUN:
@ -116,23 +118,30 @@ USAGE
sys.stderr.write(indent + " for help use --help") sys.stderr.write(indent + " for help use --help")
return 2 return 2
def buildPyLoT(): def buildPyLoT(verbosity=None):
if sys.platform.startswith('win' or 'microsoft'): system = sys.platform
if verbosity > 1:
msg = ("... on system: {0}\n"
"\n"
" Current working directory: {1}\n"
).format(system, os.getcwd())
print msg
if system.startswith(('win', 'microsoft')):
raise CLIError("building on Windows system not tested yet; implementation pending") raise CLIError("building on Windows system not tested yet; implementation pending")
elif sys.platform == 'darwin': elif system == 'darwin':
# create a symbolic link to the desired python interpreter in order to # create a symbolic link to the desired python interpreter in order to
# display the right application name # display the right application name
for path in os.getenv('PATH').split(':'): for path in os.getenv('PATH').split(':'):
found = glob.glob(os.path.join(path, 'python')) found = glob.glob(os.path.join(path, 'python'))
if found: if found:
os.symlink(found, 'PyLoT') os.symlink(found, './PyLoT')
break break
def installPyLoT(): def installPyLoT(verbosity=None):
pass pass
def cleanUp(): def cleanUp(verbosity=None):
pass pass
if __name__ == "__main__": if __name__ == "__main__":