Adding check on stanford license for information in __init__ and to stop processing

in insarApp.py and isceApp.py because of their dependencies on licensed code files.
LT1AB
Eric Gurrola 2019-01-22 09:04:06 -08:00
parent 4095681e39
commit 592befb882
3 changed files with 53 additions and 28 deletions

View File

@ -1,18 +1,18 @@
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Copyright 2010 California Institute of Technology. ALL RIGHTS RESERVED. # Copyright 2010 California Institute of Technology. ALL RIGHTS RESERVED.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# #
# United States Government Sponsorship acknowledged. This software is subject to # United States Government Sponsorship acknowledged. This software is subject to
# U.S. export control laws and regulations and has been classified as 'EAR99 NLR' # U.S. export control laws and regulations and has been classified as 'EAR99 NLR'
# (No [Export] License Required except when exporting to an embargoed country, # (No [Export] License Required except when exporting to an embargoed country,
@ -47,3 +47,14 @@ try:
except KeyError: except KeyError:
print('Using default ISCE Path: %s'%(isce_path)) print('Using default ISCE Path: %s'%(isce_path))
os.environ['ISCE_HOME'] = isce_path os.environ['ISCE_HOME'] = isce_path
try:
from . license import stanford_license
except:
print("This is the Open Source version of ISCE.")
print("Some of the workflows depend on a separate licensed package.")
print("To obtain the licensed package, please make a request for ISCE")
print("through the website: https://download.jpl.nasa.gov/ops/request/index.cfm.")
print("Alternatively, if you are a member, or can become a member of WinSAR")
print("you may be able to obtain access to a version of the licensed sofware at")
print("https://winsar.unavco.org/software/isce")

View File

@ -2,19 +2,19 @@
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Copyright 2012 California Institute of Technology. ALL RIGHTS RESERVED. # Copyright 2012 California Institute of Technology. ALL RIGHTS RESERVED.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# #
# United States Government Sponsorship acknowledged. This software is subject to # United States Government Sponsorship acknowledged. This software is subject to
# U.S. export control laws and regulations and has been classified as 'EAR99 NLR' # U.S. export control laws and regulations and has been classified as 'EAR99 NLR'
# (No [Export] License Required except when exporting to an embargoed country, # (No [Export] License Required except when exporting to an embargoed country,
@ -1197,11 +1197,18 @@ class Insar(_InsarBase):
if __name__ == "__main__": if __name__ == "__main__":
#make an instance of Insar class named 'insarApp' if not isce.stanford_license:
insar = Insar(name="insarApp") print("This workflow requires the Stanford licensed code elemnts.")
#configure the insar application print("Unable to find the license information in the isce.stanford_license file.")
insar.configure() print("Please either obtain a stanford license and follow the instructions to")
#invoke the base class run method, which returns status print("install the stanford code elements or else choose a different workflow.")
status = insar.run() raise SystemExit(0)
#inform Python of the status of the run to return to the shell else:
raise SystemExit(status) #make an instance of Insar class named 'insarApp'
insar = Insar(name="insarApp")
#configure the insar application
insar.configure()
#invoke the base class run method, which returns status
status = insar.run()
#inform Python of the status of the run to return to the shell
raise SystemExit(status)

View File

@ -3,19 +3,19 @@
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Copyright 2013 California Institute of Technology. ALL RIGHTS RESERVED. # Copyright 2013 California Institute of Technology. ALL RIGHTS RESERVED.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# #
# United States Government Sponsorship acknowledged. This software is subject to # United States Government Sponsorship acknowledged. This software is subject to
# U.S. export control laws and regulations and has been classified as 'EAR99 NLR' # U.S. export control laws and regulations and has been classified as 'EAR99 NLR'
# (No [Export] License Required except when exporting to an embargoed country, # (No [Export] License Required except when exporting to an embargoed country,
@ -1786,11 +1786,18 @@ class IsceApp(Application, FrameMixin):
if __name__ == "__main__": if __name__ == "__main__":
#create the isce object if not isce.stanford_license:
isceapp = IsceApp(name='isceApp') print("This workflow requires the Stanford licensed code elemnts.")
#configure the isceapp object print("Unable to find the license information in the isce.stanford_license file.")
isceapp.configure() print("Please either obtain a stanford license and follow the instructions to")
#invoke the Application base class run method, which returns status print("install the stanford code elements or else choose a different workflow.")
status = isceapp.run() raise SystemExit(0)
#inform Python of the status of the run to return to the shell else:
raise SystemExit(status) #create the isce object
isceapp = IsceApp(name='isceApp')
#configure the isceapp object
isceapp.configure()
#invoke the Application base class run method, which returns status
status = isceapp.run()
#inform Python of the status of the run to return to the shell
raise SystemExit(status)