Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-31721: Fix exception catching for getPackageDir #607

Merged
merged 3 commits into from
Sep 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/convolveLinear.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include <sstream>
#include <string>

#include "lsst/utils/Utils.h"
#include "lsst/utils/packaging.h"
#include "lsst/pex/exceptions.h"
#include "lsst/daf/base.h"
#include "lsst/log/Log.h"
Expand Down
2 changes: 1 addition & 1 deletion examples/decoratedImage.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include <string>
#include <algorithm>

#include "lsst/utils/Utils.h"
#include "lsst/utils/packaging.h"
#include "lsst/geom.h"
#include "lsst/pex/exceptions.h"
#include "lsst/afw/image/Image.h"
Expand Down
2 changes: 1 addition & 1 deletion examples/mask.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include <algorithm>

#include "lsst/geom.h"
#include "lsst/utils/Utils.h"
#include "lsst/utils/packaging.h"
#include "lsst/pex/exceptions.h"
#include "lsst/afw/image.h"

Expand Down
2 changes: 1 addition & 1 deletion examples/maskedImageFitsIo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include <iostream>
#include <sstream>

#include "lsst/utils/Utils.h"
#include "lsst/utils/packaging.h"
#include "lsst/pex/exceptions.h"
#include "lsst/afw/image/MaskedImage.h"

Expand Down
2 changes: 1 addition & 1 deletion examples/simpleConvolve.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include <sstream>
#include <string>

#include "lsst/utils/Utils.h"
#include "lsst/utils/packaging.h"
#include "lsst/pex/exceptions.h"
#include "lsst/log/Log.h"
#include "lsst/afw/math.h"
Expand Down
2 changes: 1 addition & 1 deletion examples/spatialCellExample.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
*/
#include <string>
#include "lsst/geom.h"
#include "lsst/utils/Utils.h"
#include "lsst/utils/packaging.h"
#include "lsst/pex/exceptions.h"
#include "lsst/daf/base.h"
#include "lsst/afw/detection.h"
Expand Down
2 changes: 1 addition & 1 deletion examples/spatiallyVaryingConvolve.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include <iostream>
#include <sstream>

#include "lsst/utils/Utils.h"
#include "lsst/utils/packaging.h"
#include "lsst/pex/exceptions.h"
#include "lsst/log/Log.h"
#include "lsst/afw/math.h"
Expand Down
2 changes: 1 addition & 1 deletion examples/timeConvolve.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include <sstream>
#include <ctime>

#include "lsst/utils/Utils.h"
#include "lsst/utils/packaging.h"
#include "lsst/pex/exceptions.h"
#include "lsst/afw/math/FunctionLibrary.h"
#include "lsst/afw/image/Image.h"
Expand Down
2 changes: 1 addition & 1 deletion examples/timeWcs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include <ctime>
#include <cmath>

#include "lsst/utils/Utils.h"
#include "lsst/utils/packaging.h"
#include "lsst/geom.h"
#include "lsst/afw/geom/SkyWcs.h"
#include "lsst/afw/image.h"
Expand Down
2 changes: 1 addition & 1 deletion examples/wcsTest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#include <memory>

#include "lsst/geom.h"
#include "lsst/utils/Utils.h"
#include "lsst/utils/packaging.h"
#include "lsst/log/Log.h"
#include "lsst/pex/exceptions.h"
#include "lsst/afw/geom/SkyWcs.h"
Expand Down
3 changes: 1 addition & 2 deletions python/lsst/afw/table/catalogMatches.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

import numpy as np

import lsst.pex.exceptions as pexExcept
from ._schema import Schema
from ._schemaMapper import SchemaMapper
from ._base import BaseCatalog
Expand Down Expand Up @@ -177,7 +176,7 @@ def matchesToCatalog(matches, matchMeta):
# obtain reference catalog name if one is setup
try:
catalogName = os.path.basename(getPackageDir("astrometry_net_data"))
except pexExcept.NotFoundError:
except LookupError:
catalogName = "NOT_SET"
matchMeta.add("REFCAT", catalogName)
mergedCatalog.getTable().setMetadata(matchMeta)
Expand Down
2 changes: 1 addition & 1 deletion tests/background.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#pragma clang diagnostic pop
#include "boost/test/tools/floating_point_comparison.hpp"

#include "lsst/utils/Utils.h"
#include "lsst/utils/packaging.h"
#include "lsst/pex/exceptions.h"
#include "lsst/afw/image/Image.h"
#include "lsst/afw/math/Interpolate.h"
Expand Down
2 changes: 1 addition & 1 deletion tests/maskedImage1.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include "lsst/pex/exceptions.h"
#include "lsst/log/Log.h"
#include "lsst/afw/image.h"
#include "lsst/utils/Utils.h"
#include "lsst/utils/packaging.h"

using namespace std;
namespace pexEx = lsst::pex::exceptions;
Expand Down
2 changes: 1 addition & 1 deletion tests/ramFitsIO.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include "lsst/afw/geom/SkyWcs.h"
#include "lsst/afw/image.h"
#include "lsst/afw/image/Image.h"
#include "lsst/utils/Utils.h"
#include "lsst/utils/packaging.h"
#include <fstream>
#include <iostream>
#include <memory>
Expand Down
2 changes: 1 addition & 1 deletion tests/statistics.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#pragma clang diagnostic pop
#include "boost/test/tools/floating_point_comparison.hpp"

#include "lsst/utils/Utils.h"
#include "lsst/utils/packaging.h"
#include "lsst/pex/exceptions.h"
#include "lsst/geom.h"
#include "lsst/afw/image/Image.h"
Expand Down
3 changes: 1 addition & 2 deletions tests/test_background.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,14 @@
import lsst.afw.image as afwImage
import lsst.afw.math as afwMath
import lsst.afw.display as afwDisplay
import lsst.pex.exceptions as pexExcept

# Set to True to display debug messages and images
debugMode = False

afwDisplay.setDefaultMaskTransparency(75)
try:
AfwdataDir = lsst.utils.getPackageDir("afwdata")
except pexExcept.NotFoundError:
except LookupError:
AfwdataDir = None


Expand Down
3 changes: 1 addition & 2 deletions tests/test_convolve.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
import lsst.afw.image as afwImage
import lsst.afw.math as afwMath
import lsst.afw.math.detail as mathDetail
import lsst.pex.exceptions as pexExcept

from test_kernel import makeDeltaFunctionKernelList, makeGaussianKernelList
from lsst.log import Log
Expand All @@ -55,7 +54,7 @@

try:
dataDir = os.path.join(lsst.utils.getPackageDir("afwdata"), "data")
except pexExcept.NotFoundError:
except LookupError:
dataDir = None
else:
InputMaskedImagePath = os.path.join(dataDir, "medexp.fits")
Expand Down
2 changes: 1 addition & 1 deletion tests/test_exposure.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@

try:
dataDir = os.path.join(lsst.utils.getPackageDir("afwdata"), "data")
except pexExcept.NotFoundError:
except LookupError:
dataDir = None
else:
InputMaskedImageName = "871034p_1_MI.fits"
Expand Down
2 changes: 1 addition & 1 deletion tests/test_fitsTables.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <map>
#include <filesystem>

#include "lsst/utils/Utils.h"
#include "lsst/utils/packaging.h"
#include "lsst/afw/table/Source.h"
#include "lsst/afw/geom/Span.h"
#include "lsst/afw/geom/SpanSet.h"
Expand Down
3 changes: 1 addition & 2 deletions tests/test_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,10 @@
import lsst.afw.math as afwMath
from lsst.afw.fits import readMetadata
import lsst.afw.display as afwDisplay
import lsst.pex.exceptions as pexExcept

try:
afwdataDir = lsst.utils.getPackageDir("afwdata")
except pexExcept.NotFoundError:
except LookupError:
afwdataDir = None

try:
Expand Down
3 changes: 1 addition & 2 deletions tests/test_imageIo1.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import lsst.afw.fits as afwFits
import lsst.utils.tests
import lsst.afw.display as afwDisplay
import lsst.pex.exceptions as pexExcept

try:
type(display)
Expand All @@ -42,7 +41,7 @@

try:
dataDir = os.path.join(lsst.utils.getPackageDir("afwdata"), "data")
except pexExcept.NotFoundError:
except LookupError:
dataDir = None


Expand Down
2 changes: 1 addition & 1 deletion tests/test_mask.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@

try:
afwdataDir = lsst.utils.getPackageDir("afwdata")
except pexExcept.NotFoundError:
except LookupError:
afwdataDir = None

afwDisplay.setDefaultMaskTransparency(75)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_maskedImageIO.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

try:
dataDir = lsst.utils.getPackageDir("afwdata")
except pexEx.NotFoundError:
except LookupError:
dataDir = None

try:
Expand Down
3 changes: 1 addition & 2 deletions tests/test_sourceMatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,10 @@
import lsst.afw.table as afwTable
import lsst.daf.base as dafBase
import lsst.utils.tests
import lsst.pex.exceptions as pexExcept

try:
afwdataDir = lsst.utils.getPackageDir("afwdata")
except pexExcept.NotFoundError:
except LookupError:
afwdataDir = None


Expand Down
3 changes: 1 addition & 2 deletions tests/test_statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,12 @@
import lsst.afw.image as afwImage
import lsst.afw.math as afwMath
import lsst.afw.display as afwDisplay
import lsst.pex.exceptions as pexExcept

afwDisplay.setDefaultMaskTransparency(75)

try:
afwdataDir = lsst.utils.getPackageDir("afwdata")
except pexExcept.NotFoundError:
except LookupError:
afwdataDir = None

try:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_tableArchives.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#include "Eigen/Core"

#include "lsst/utils/Utils.h"
#include "lsst/utils/packaging.h"
#include "lsst/geom.h"
#include "lsst/afw/detection/Footprint.h"
#include "lsst/afw/detection/HeavyFootprint.h"
Expand Down
3 changes: 1 addition & 2 deletions tests/test_tableMultiMatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,13 @@

import lsst.afw.table as afwTable
import lsst.geom
import lsst.pex.exceptions as pexExcept
import lsst.utils
import lsst.utils.tests


try:
afwdataDir = lsst.utils.getPackageDir("afwdata")
except pexExcept.NotFoundError:
except LookupError:
afwdataDir = None


Expand Down
2 changes: 1 addition & 1 deletion tests/test_warpExposure.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@

try:
afwdataDir = lsst.utils.getPackageDir("afwdata")
except pexExcept.NotFoundError:
except LookupError:
afwdataDir = None
else:
dataDir = os.path.join(afwdataDir, "data")
Expand Down
3 changes: 1 addition & 2 deletions tests/test_warper.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import lsst.afw.geom as afwGeom
import lsst.afw.image as afwImage
import lsst.afw.math as afwMath
import lsst.pex.exceptions as pexExcept
from lsst.log import Log

# Change the level to Log.DEBUG to see debug messages
Expand All @@ -40,7 +39,7 @@

try:
afwdataDir = lsst.utils.getPackageDir("afwdata")
except pexExcept.NotFoundError:
except LookupError:
afwdataDir = None
dataDir = None
else:
Expand Down