Skip to content

Commit

Permalink
flyingpigeon tests passed
Browse files Browse the repository at this point in the history
  • Loading branch information
nilshempelmann committed Dec 8, 2018
1 parent 72c3702 commit 5c9eba0
Show file tree
Hide file tree
Showing 4 changed files with 409 additions and 271 deletions.
71 changes: 38 additions & 33 deletions eggshell/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
with this.
"""

import os
from os.path import join, pardir, abspath
from pywps import configuration
import logging
LOGGER = logging.getLogger("PYWPS")
Expand All @@ -20,27 +20,36 @@ def __init__(self, module):
:param module: Imported module relative to which paths will be defined.
"""
self._base = module.__path__[0]
self._base = module.__path__[0] # _base is not the top level

@property
def cache(self):
"""Return the path to the server cache directory."""
out = configuration.get_config_value("cache", "cache_path")
if not out:
LOGGER.warn("No cache path configured. Using default value.")
out = os.path.join(configuration.get_config_value("server", "outputpath"), "cache")
return out
def top_level(self):
""" return the top level directory of a WPS bird """
return abspath(join(self._base, pardir))

@property
def data(self):
"""Return the path to the data directory."""
return os.path.join(self._base, 'data')
return join(self.top_level, 'data')

@property
def shapefiles(self):
"""Return the path to the geographic data directory."""
return join(self.data, 'shapefiles')

@property
def masks(self):
"""Return the path to the masks directory."""
# TODO: currently this folder is not used
return os.path.join(self.data, 'masks')
def testdata(self):
"""Return the path to the test data directory."""
return join(self.top_level, 'tests/testdata')

@property
def cache(self):
"""Return the path to the server cache directory."""
out = configuration.get_config_value("cache", "cache_path")
if not out:
LOGGER.warn("No cache path configured. Using default value.")
out = join(configuration.get_config_value("server", "outputpath"), "cache")
return out

@property
def outputpath(self):
Expand All @@ -52,25 +61,21 @@ def outputurl(self):
"""Return the server URL for process outputs."""
return configuration.get_config_value("server", "outputurl").rstrip('/')

@property
def Rsrc_dir(self):
"""Return the path to the R source directory."""
return os.path.join(self._base, 'Rsrc')

@property
def shapefiles(self):
"""Return the path to the geographic data directory."""
return os.path.join(self.data, 'shapefiles')

@property
def static(self):
"""Return the path to the static content directory."""
return os.path.join(self._base, 'static')

@property
def testdata(self):
"""Return the path to the test data directory."""
return os.path.join(self._base, 'tests/testdata')
# @property
# def masks(self):
# """Return the path to the masks directory."""
# # TODO: currently this folder is not used
# return join(self.data, 'masks')

# @property
# def Rsrc_dir(self):
# """Return the path to the R source directory."""
# return os.path.join(self._base, 'Rsrc')
#
# @property
# def static(self):
# """Return the path to the static content directory."""
# return os.path.join(self._base, 'static')


# Should these go into the class or they're too specialized ?
Expand Down

0 comments on commit 5c9eba0

Please sign in to comment.