Skip to content

Commit

Permalink
fix(dependency): fix package_url
Browse files Browse the repository at this point in the history
Subfolder was missing from the url when created from version.json file.
  • Loading branch information
mostaphaRoudsari committed May 21, 2020
1 parent d509da7 commit 5b6b0c0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
1 change: 0 additions & 1 deletion queenbee/base/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ class IOBase(BaseModel):

artifacts: List[IOItem]

@classmethod
@validator('parameters', 'artifacts')
def parameter_unique_names(cls, v):
"""Pydantic validator to check that IO item names are unique within their list
Expand Down
9 changes: 7 additions & 2 deletions queenbee/repository/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,15 +137,20 @@ def from_package(cls, package_path: str):
Returns:
ResourceVersion -- A resource version object
"""
file_path = os.path.abspath(package_path)
file_path = os.path.normpath(os.path.abspath(package_path))

tar_file = TarFile.open(file_path)

member = tar_file.getmember('version.json')

version_bytes = tar_file.extractfile(member).read()

return cls.parse_raw(version_bytes)
cls_ = cls.parse_raw(version_bytes)

# add subfolder (e.g. operators, recipes ) to url
cls_.url = '/'.join(file_path.split(os.sep)[-2:])

return cls_

@staticmethod
def path_to_readme(folder_path: str) -> str:
Expand Down

0 comments on commit 5b6b0c0

Please sign in to comment.