Skip to content

Commit

Permalink
Merge pull request #864 from jazzace/pkgcopier
Browse files Browse the repository at this point in the history
Add pkg check to PkgCopier
  • Loading branch information
homebysix committed Jul 7, 2023
2 parents 35b3553 + 0131f57 commit 8b140db
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Code/autopkglib/PkgCopier.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import glob
import os.path

from autopkglib import ProcessorError
from autopkglib.Copier import Copier

__all__ = ["PkgCopier"]
Expand Down Expand Up @@ -84,6 +85,14 @@ def main(self):
f"'{source_pkg}'."
)

# Check that the source path ends with supported extension
pkg_extensions = (".mpkg", ".pkg")
if os.path.splitext(matched_source_path)[1] not in pkg_extensions:
raise ProcessorError(
"Source does not appear to be a package based on its filename: "
f"'{matched_source_path}'"
)

# do the copy
pkg_path = self.env.get("pkg_path") or os.path.join(
self.env["RECIPE_CACHE_DIR"], os.path.basename(matched_source_path)
Expand Down

0 comments on commit 8b140db

Please sign in to comment.