Skip to content

Commit

Permalink
should fix nightly (#598)
Browse files Browse the repository at this point in the history
  • Loading branch information
doutriaux1 committed Apr 8, 2019
1 parent 8e149e0 commit 7a18cbd
Show file tree
Hide file tree
Showing 13 changed files with 46 additions and 10 deletions.
6 changes: 5 additions & 1 deletion pcmdi_metrics/diurnal/scripts/savg_fourierWrappedInOut.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,11 @@ def spacevavg(tvarb1, tvarb2, sftlf, model):
os.path.abspath(
args.results_dir),
os.path.basename(jsonname))
egg_pth = pkg_resources.resource_filename(pkg_resources.Requirement.parse("pcmdi_metrics"), "share/pmp")
try:
egg_pth = pkg_resources.resource_filename(pkg_resources.Requirement.parse("pcmdi_metrics"), "share/pmp")
except Exception:
# python 2 seems to fail when ran in home directory of source?
egg_pth = os.path.join(os.getcwd(), "share", "pmp")
disclaimer = open(
os.path.join(
egg_pth,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,11 @@ def compute(param):
os.path.abspath(
args.results_dir),
jsonFile())
egg_pth = pkg_resources.resource_filename(pkg_resources.Requirement.parse("pcmdi_metrics"), "share/pmp")
try:
egg_pth = pkg_resources.resource_filename(pkg_resources.Requirement.parse("pcmdi_metrics"), "share/pmp")
except Exception:
# python 2 seems to fail when ran in home directory of source?
egg_pth = os.path.join(os.getcwd(), "share", "pmp")
disclaimer = open(
os.path.join(
egg_pth,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,11 @@ def compute(param):
os.path.abspath(
args.results_dir),
jsonFile())
egg_pth = pkg_resources.resource_filename(pkg_resources.Requirement.parse("pcmdi_metrics"), "share/pmp")
try:
egg_pth = pkg_resources.resource_filename(pkg_resources.Requirement.parse("pcmdi_metrics"), "share/pmp")
except Exception:
# python 2 seems to fail when ran in home directory of source?
egg_pth = os.path.join(os.getcwd(), "share", "pmp")
disclaimer = open(
os.path.join(
egg_pth,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,11 @@ def compute(param):
os.path.abspath(
args.results_dir),
jsonFile())
egg_pth = pkg_resources.resource_filename(pkg_resources.Requirement.parse("pcmdi_metrics"), "share/pmp")
try:
egg_pth = pkg_resources.resource_filename(pkg_resources.Requirement.parse("pcmdi_metrics"), "share/pmp")
except Exception:
# python 2 seems to fail when ran in home directory of source?
egg_pth = os.path.join(os.getcwd(), "share", "pmp")
disclaimer = open(
os.path.join(
egg_pth,
Expand Down
6 changes: 5 additions & 1 deletion pcmdi_metrics/driver/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,11 @@ def get(self):
@staticmethod
def load_path_as_file_obj(name):
''' Returns a File object for the file named name. '''
egg_pth = pkg_resources.resource_filename(pkg_resources.Requirement.parse("pcmdi_metrics"), "share/pmp")
try:
egg_pth = pkg_resources.resource_filename(pkg_resources.Requirement.parse("pcmdi_metrics"), "share/pmp")
except Exception:
# python 2 seems to fail when ran in home directory of source?
egg_pth = os.path.join(os.getcwd(), "share", "pmp")
file_path = os.path.join(egg_pth, name)
opened_file = None
try:
Expand Down
8 changes: 6 additions & 2 deletions pcmdi_metrics/monsoon_wang/monsoon_wang_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,12 @@ def monsoon_wang_runner(args):

#########################################

egg_pth = pkg_resources.resource_filename(
pkg_resources.Requirement.parse("pcmdi_metrics"), "share/pmp")
try:
egg_pth = pkg_resources.resource_filename(
pkg_resources.Requirement.parse("pcmdi_metrics"), "share/pmp")
except Exception:
# python 2 seems to fail when ran in home directory of source?
egg_pth = os.path.join(os.getcwd(), "share", "pmp")
globals = {}
locals = {}
exec(compile(open(os.path.join(egg_pth, "default_regions.py")).read(),
Expand Down
1 change: 1 addition & 0 deletions share/pmp/default_regions.py
1 change: 1 addition & 0 deletions share/pmp/disclaimer.txt
1 change: 1 addition & 0 deletions share/pmp/graphics/png
1 change: 1 addition & 0 deletions share/pmp/graphics/vcs
1 change: 1 addition & 0 deletions share/pmp/obs_info_dictionary.json
6 changes: 5 additions & 1 deletion tests/test_pmp_portrait_values_on.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
import vcs
import sys
import pkg_resources
egg_pth = pkg_resources.resource_filename(pkg_resources.Requirement.parse("pcmdi_metrics"), "share/pmp")
try:
egg_pth = pkg_resources.resource_filename(pkg_resources.Requirement.parse("pcmdi_metrics"), "share/pmp")
except Exception:
# python 2 seems to fail when ran in home directory of source?
egg_pth = os.path.join(os.getcwd(), "share", "pmp")

class TestPortraits(basepmpgraphics.TestGraphics):
def __init__(self,*args,**kargs):
Expand Down
7 changes: 5 additions & 2 deletions tests/test_pmp_portraits.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@
import sys
import pkg_resources
one = pkg_resources.Requirement.parse("pcmdi_metrics")
print("ONE:",one)
egg_pth = pkg_resources.resource_filename(one, "share/pmp")
try:
egg_pth = pkg_resources.resource_filename(one, "share/pmp")
except Exception:
# python 2 seems to fail when ran in home directory of source?
egg_pth = os.path.join(os.getcwd(), "share", "pmp")

class TestPortraits(basepmpgraphics.TestGraphics):
def __init__(self,*args,**kargs):
Expand Down

0 comments on commit 7a18cbd

Please sign in to comment.