[GRASS-SVN] r66681 - in grass-addons/grass7/raster/r.green/r.green.hydro: r.green.hydro.delplants r.green.hydro.discharge r.green.hydro.financial r.green.hydro.optimal r.green.hydro.recommended r.green.hydro.structure r.green.hydro.technical r.green.hydro.theoretical

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Oct 30 10:23:35 PDT 2015


Author: zarch
Date: 2015-10-30 10:23:35 -0700 (Fri, 30 Oct 2015)
New Revision: 66681

Modified:
   grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.delplants/r.green.hydro.delplants.py
   grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.discharge/r.green.hydro.discharge.py
   grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.financial/r.green.hydro.financial.py
   grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.optimal/r.green.hydro.optimal.py
   grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.recommended/r.green.hydro.recommended.py
   grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.structure/r.green.hydro.structure.py
   grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.technical/r.green.hydro.technical.py
   grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.theoretical/r.green.hydro.theoretical.py
Log:
r.green: Generate manual page even if ImportError is raised during the compilation

Modified: grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.delplants/r.green.hydro.delplants.py
===================================================================
--- grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.delplants/r.green.hydro.delplants.py	2015-10-30 16:46:22 UTC (rev 66680)
+++ grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.delplants/r.green.hydro.delplants.py	2015-10-30 17:23:35 UTC (rev 66681)
@@ -107,16 +107,20 @@
 from grass.pygrass.messages import get_msgr
 from grass.pygrass.utils import set_path
 
-set_path('r.green', 'libhydro', '..')
-set_path('r.green', 'libgreen', os.path.join('..', '..'))
 
-# finally import the module in the library
-from libgreen.utils import cleanup
-from libgreen.checkparameter import (check_required_columns,
-                                     exception2error)
-from libhydro.plant import read_plants, write_plants
+try:
+    set_path('r.green', 'libhydro', '..')
+    set_path('r.green', 'libgreen', os.path.join('..', '..'))
 
+    # finally import the module in the library
+    from libgreen.utils import cleanup
+    from libgreen.checkparameter import (check_required_columns,
+                                         exception2error)
+    from libhydro.plant import read_plants, write_plants
+except ImportError:
+    warning('libgreen and libhydro not in the python path!')
 
+
 def main(opts, flgs):
     TMPVECT = []
     DEBUG = True if flgs['d'] else False

Modified: grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.discharge/r.green.hydro.discharge.py
===================================================================
--- grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.discharge/r.green.hydro.discharge.py	2015-10-30 16:46:22 UTC (rev 66680)
+++ grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.discharge/r.green.hydro.discharge.py	2015-10-30 17:23:35 UTC (rev 66681)
@@ -172,13 +172,19 @@
 from grass.pygrass.utils import set_path
 from grass.script import mapcalc
 
-set_path('r.green', 'libhydro', '..')
-set_path('r.green', 'libgreen', os.path.join('..', '..'))
-# finally import the module in the library
-from libgreen.utils import cleanup
-from libhydro.basin import dtm_corr
 
+try:
+    # set python path to the shared r.green libraries
+    set_path('r.green', 'libhydro', '..')
+    set_path('r.green', 'libgreen', os.path.join('..', '..'))
 
+    # finally import the module in the library
+    from libgreen.utils import cleanup
+    from libhydro.basin import dtm_corr
+except ImportError:
+    warning('libgreen and libhydro not in the python path!')
+
+
 if "GISBASE" not in os.environ:
     print("You must be in GRASS GIS to run this program.")
     sys.exit(1)

Modified: grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.financial/r.green.hydro.financial.py
===================================================================
--- grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.financial/r.green.hydro.financial.py	2015-10-30 16:46:22 UTC (rev 66680)
+++ grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.financial/r.green.hydro.financial.py	2015-10-30 17:23:35 UTC (rev 66681)
@@ -516,13 +516,16 @@
     warning('You should install numexpr to use this module: '
                   'pip install numexpr')
 
-# set python path to the shared r.green libraries
-set_path('r.green', 'libhydro', '..')
-set_path('r.green', 'libgreen', os.path.join('..', '..'))
+try:
+    # set python path to the shared r.green libraries
+    set_path('r.green', 'libhydro', '..')
+    set_path('r.green', 'libgreen', os.path.join('..', '..'))
 
-from libgreen.utils import cleanup
-from libgreen.checkparameter import check_required_columns, exception2error
-from libhydro.plant import read_plants, write_structures
+    from libgreen.utils import cleanup
+    from libgreen.checkparameter import check_required_columns, exception2error
+    from libhydro.plant import read_plants, write_structures
+except ImportError:
+    warning('libgreen and libhydro not in the python path!')
 
 
 def rname(base):

Modified: grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.optimal/r.green.hydro.optimal.py
===================================================================
--- grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.optimal/r.green.hydro.optimal.py	2015-10-30 16:46:22 UTC (rev 66680)
+++ grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.optimal/r.green.hydro.optimal.py	2015-10-30 17:23:35 UTC (rev 66681)
@@ -107,15 +107,19 @@
 #from grass.pygrass.raster.buffer import Buffer
 from grass.pygrass.utils import set_path
 
-set_path('r.green', 'libhydro', '..')
-set_path('r.green', 'libgreen', os.path.join('..', '..'))
 
-from libgreen.utils import cleanup
-from libgreen.utils import dissolve_lines
-from libhydro.optimal import find_segments
-from libhydro.optimal import write_plants
-from libhydro.optimal import write_points
+try:
+    set_path('r.green', 'libhydro', '..')
+    set_path('r.green', 'libgreen', os.path.join('..', '..'))
 
+    from libgreen.utils import cleanup
+    from libgreen.utils import dissolve_lines
+    from libhydro.optimal import find_segments
+    from libhydro.optimal import write_plants
+    from libhydro.optimal import write_points
+except ImportError:
+    warning('libgreen and libhydro not in the python path!')
+
 ##################################################
 # optimization problem
 # the coordinate along the river is s

Modified: grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.recommended/r.green.hydro.recommended.py
===================================================================
--- grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.recommended/r.green.hydro.recommended.py	2015-10-30 16:46:22 UTC (rev 66680)
+++ grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.recommended/r.green.hydro.recommended.py	2015-10-30 17:23:35 UTC (rev 66681)
@@ -197,12 +197,15 @@
 from grass.pygrass.vector import VectorTopo
 from grass.script import mapcalc
 
-# r.green lib
-set_path('r.green', 'libhydro', '..')
-set_path('r.green', 'libgreen', os.path.join('..', '..'))
-# finally import the module in the library
-from libgreen.utils import cleanup
 
+try:
+    # set python path to the shared r.green libraries
+    set_path('r.green', 'libhydro', '..')
+    set_path('r.green', 'libgreen', os.path.join('..', '..'))
+    # finally import the module in the library
+    from libgreen.utils import cleanup
+except ImportError:
+    warning('libgreen and libhydro not in the python path!')
 
 if "GISBASE" not in os.environ:
     print("You must be in GRASS GIS to run this program.")

Modified: grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.structure/r.green.hydro.structure.py
===================================================================
--- grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.structure/r.green.hydro.structure.py	2015-10-30 16:46:22 UTC (rev 66680)
+++ grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.structure/r.green.hydro.structure.py	2015-10-30 17:23:35 UTC (rev 66681)
@@ -138,14 +138,17 @@
 from grass.pygrass.raster import RasterRow
 
 
-# set python path to the shared r.green libraries
-set_path('r.green', 'libhydro', '..')
-set_path('r.green', 'libgreen', os.path.join('..', '..'))
+try:
+    # set python path to the shared r.green libraries
+    set_path('r.green', 'libhydro', '..')
+    set_path('r.green', 'libgreen', os.path.join('..', '..'))
 
-from libgreen.utils import cleanup
-from libhydro.optimal import conv_segpoints
-from libgreen.checkparameter import check_required_columns, exception2error
-from libhydro.plant import read_plants, write_structures
+    from libgreen.utils import cleanup
+    from libhydro.optimal import conv_segpoints
+    from libgreen.checkparameter import check_required_columns, exception2error
+    from libhydro.plant import read_plants, write_structures
+except ImportError:
+    warning('libgreen and libhydro not in the python path!')
 
 
 def main(opts, flgs):

Modified: grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.technical/r.green.hydro.technical.py
===================================================================
--- grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.technical/r.green.hydro.technical.py	2015-10-30 16:46:22 UTC (rev 66680)
+++ grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.technical/r.green.hydro.technical.py	2015-10-30 17:23:35 UTC (rev 66681)
@@ -225,13 +225,17 @@
 
 import numpy as np
 
-# r.green lib
-set_path('r.green', 'libhydro', '..')
-set_path('r.green', 'libgreen', os.path.join('..', '..'))
-# finally import the module in the library
-from libgreen.utils import cleanup
-from libhydro.optimal import conv_segpoints
 
+try:
+    # set python path to the shared r.green libraries
+    set_path('r.green', 'libhydro', '..')
+    set_path('r.green', 'libgreen', os.path.join('..', '..'))
+    # finally import the module in the library
+    from libgreen.utils import cleanup
+    from libhydro.optimal import conv_segpoints
+except ImportError:
+    warning('libgreen and libhydro not in the python path!')
+
 DEBUG = False
 TMPRAST = []
 

Modified: grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.theoretical/r.green.hydro.theoretical.py
===================================================================
--- grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.theoretical/r.green.hydro.theoretical.py	2015-10-30 16:46:22 UTC (rev 66680)
+++ grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.theoretical/r.green.hydro.theoretical.py	2015-10-30 17:23:35 UTC (rev 66681)
@@ -100,18 +100,23 @@
 from grass.pygrass.messages import get_msgr
 from grass.pygrass.utils import set_path
 
-set_path('r.green', 'libhydro', '..')
-set_path('r.green', 'libgreen', os.path.join('..', '..'))
-# finally import the module in the library
-from libgreen.utils import cleanup
-from libhydro.basin import dtm_corr
-from libhydro import basin
-from libgreen.utils import check_overlay_rr
-#from libgreen.utils import check_overlay_rv
-from libgreen.utils import raster2numpy
-from libgreen.utils import remove_pixel_from_raster
 
+try:
+    # set python path to the shared r.green libraries
+    set_path('r.green', 'libhydro', '..')
+    set_path('r.green', 'libgreen', os.path.join('..', '..'))
+    # finally import the module in the library
+    from libgreen.utils import cleanup
+    from libhydro.basin import dtm_corr
+    from libhydro import basin
+    from libgreen.utils import check_overlay_rr
+    #from libgreen.utils import check_overlay_rv
+    from libgreen.utils import raster2numpy
+    from libgreen.utils import remove_pixel_from_raster
+except ImportError:
+    warning('libgreen and libhydro not in the python path!')
 
+
 if "GISBASE" not in os.environ:
     print("You must be in GRASS GIS to run this program.")
     sys.exit(1)



More information about the grass-commit mailing list