Skip to content

Commit

Permalink
Switch to ButlerURI for relative path calculation.
Browse files Browse the repository at this point in the history
  • Loading branch information
TallJimbo committed Nov 17, 2020
1 parent 5da0cb0 commit eebffa6
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions python/lsst/obs/base/gen2to3/convertRepo.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

from lsst.daf.butler import (
Butler as Butler3,
ButlerURI,
CollectionType,
SkyPixDimension
)
Expand Down Expand Up @@ -138,10 +139,10 @@ def guessCollectionNames(self, instrument: Instrument, root: str) -> None:
return
if self.chainName is None:
if os.path.isabs(self.path):
if not os.path.isabs(root):
root = os.path.abspath(root)
chainName = os.path.relpath(self.path, root)
if chainName.startswith(".."):
rerunURI = ButlerURI(self.path)
rootURI = ButlerURI(root)
chainName = rerunURI.relative_to(rootURI)
if chainName is None:
raise ValueError(
f"Cannot guess run name collection for rerun at '{self.path}': "
f"no clear relationship to root '{root}'."
Expand Down

0 comments on commit eebffa6

Please sign in to comment.